Skip to content

Commit 3e29e0a

Browse files
chore: remove usage of module autorest/to, golint fix (#255)
1 parent 6cd9a6c commit 3e29e0a

File tree

4 files changed

+251
-250
lines changed

4 files changed

+251
-250
lines changed

pkg/helpers/to/to.go

Lines changed: 105 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,105 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
2-
// Licensed under the MIT license.
3-
4-
package to
5-
6-
// IsTrueBoolPointer is a simple boolean helper function for boolean pointers
7-
func IsTrueBoolPointer(b *bool) bool {
8-
if b != nil && *b {
9-
return true
10-
}
11-
return false
12-
}
13-
14-
// IsFalseBoolPointer is a simple boolean helper function for boolean pointers
15-
func IsFalseBoolPointer(b *bool) bool {
16-
if b != nil && !*b {
17-
return true
18-
}
19-
return false
20-
}
21-
22-
// Bool returns a bool value for the passed bool pointer. It returns false if the pointer is nil.
23-
func Bool(b *bool) bool {
24-
if b != nil {
25-
return *b
26-
}
27-
return false
28-
}
29-
30-
// String returns a string value for the passed string pointer. It returns the empty string if the
31-
// pointer is nil.
32-
func String(s *string) string {
33-
if s != nil {
34-
return *s
35-
}
36-
return ""
37-
}
38-
39-
// Int returns an int value for the passed int pointer. It returns 0 if the pointer is nil.
40-
func Int(i *int) int {
41-
if i != nil {
42-
return *i
43-
}
44-
return 0
45-
}
46-
47-
// Int32 returns an int value for the passed int pointer. It returns 0 if the pointer is nil.
48-
func Int32(i *int32) int32 {
49-
if i != nil {
50-
return *i
51-
}
52-
return 0
53-
}
54-
55-
// Int64 returns an int value for the passed int pointer. It returns 0 if the pointer is nil.
56-
func Int64(i *int64) int64 {
57-
if i != nil {
58-
return *i
59-
}
60-
return 0
61-
}
62-
63-
// Float64 returns an int value for the passed int pointer. It returns 0.0 if the pointer is nil.
64-
func Float64(i *float64) float64 {
65-
if i != nil {
66-
return *i
67-
}
68-
return 0.0
69-
}
70-
71-
// BoolPtr returns a pointer to a bool
72-
func BoolPtr(b bool) *bool {
73-
p := b
74-
return &p
75-
}
76-
77-
// StringPtr returns a pointer to a string
78-
func StringPtr(s string) *string {
79-
p := s
80-
return &p
81-
}
82-
83-
// IntPtr returns a pointer to a int
84-
func IntPtr(i int) *int {
85-
p := i
86-
return &p
87-
}
88-
89-
// Int32Ptr returns a pointer to a int32
90-
func Int32Ptr(i int32) *int32 {
91-
p := i
92-
return &p
93-
}
94-
95-
// Int64Ptr returns a pointer to a int64
96-
func Int64Ptr(i int64) *int64 {
97-
p := i
98-
return &p
99-
}
100-
101-
// Float64Ptr returns a pointer to a float64
102-
func Float64Ptr(i float64) *float64 {
103-
p := i
104-
return &p
105-
}
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
package to
5+
6+
// IsTrueBoolPointer is a simple boolean helper function for boolean pointers
7+
func IsTrueBoolPointer(b *bool) bool {
8+
if b != nil && *b {
9+
return true
10+
}
11+
return false
12+
}
13+
14+
// IsFalseBoolPointer is a simple boolean helper function for boolean pointers
15+
func IsFalseBoolPointer(b *bool) bool {
16+
if b != nil && !*b {
17+
return true
18+
}
19+
return false
20+
}
21+
22+
// Bool returns a bool value for the passed bool pointer. It returns false if the pointer is nil.
23+
func Bool(b *bool) bool {
24+
if b != nil {
25+
return *b
26+
}
27+
return false
28+
}
29+
30+
// String returns a string value for the passed string pointer. It returns the empty string if the
31+
// pointer is nil.
32+
func String(s *string) string {
33+
if s != nil {
34+
return *s
35+
}
36+
return ""
37+
}
38+
39+
// Int returns an int value for the passed int pointer. It returns 0 if the pointer is nil.
40+
func Int(i *int) int {
41+
if i != nil {
42+
return *i
43+
}
44+
return 0
45+
}
46+
47+
// Int32 returns an int value for the passed int pointer. It returns 0 if the pointer is nil.
48+
func Int32(i *int32) int32 {
49+
if i != nil {
50+
return *i
51+
}
52+
return 0
53+
}
54+
55+
// Int64 returns an int value for the passed int pointer. It returns 0 if the pointer is nil.
56+
func Int64(i *int64) int64 {
57+
if i != nil {
58+
return *i
59+
}
60+
return 0
61+
}
62+
63+
// Float64 returns an int value for the passed int pointer. It returns 0.0 if the pointer is nil.
64+
func Float64(i *float64) float64 {
65+
if i != nil {
66+
return *i
67+
}
68+
return 0.0
69+
}
70+
71+
// BoolPtr returns a pointer to a bool
72+
func BoolPtr(b bool) *bool {
73+
p := b
74+
return &p
75+
}
76+
77+
// StringPtr returns a pointer to a string
78+
func StringPtr(s string) *string {
79+
p := s
80+
return &p
81+
}
82+
83+
// IntPtr returns a pointer to a int
84+
func IntPtr(i int) *int {
85+
p := i
86+
return &p
87+
}
88+
89+
// Int32Ptr returns a pointer to a int32
90+
func Int32Ptr(i int32) *int32 {
91+
p := i
92+
return &p
93+
}
94+
95+
// Int64Ptr returns a pointer to a int64
96+
func Int64Ptr(i int64) *int64 {
97+
p := i
98+
return &p
99+
}
100+
101+
// Float64Ptr returns a pointer to a float64
102+
func Float64Ptr(i float64) *float64 {
103+
p := i
104+
return &p
105+
}

0 commit comments

Comments
 (0)