Skip to content

Commit 678177c

Browse files
committed
Run golangci-lint run --fix
This commit is entirely generated by earthly +reviewable Signed-off-by: Nic Cope <[email protected]>
1 parent aad05b0 commit 678177c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+812
-86
lines changed

apis/common/v1/condition.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ func IsSystemConditionType(t ConditionType) bool {
126126
case TypeReady, TypeSynced, TypeHealthy:
127127
return true
128128
}
129+
129130
return false
130131
}
131132

@@ -150,6 +151,7 @@ type ConditionedStatus struct {
150151
func NewConditionedStatus(c ...Condition) *ConditionedStatus {
151152
s := &ConditionedStatus{}
152153
s.SetConditions(c...)
154+
153155
return s
154156
}
155157

@@ -171,6 +173,7 @@ func (s *ConditionedStatus) GetCondition(ct ConditionType) Condition {
171173
func (s *ConditionedStatus) SetConditions(c ...Condition) {
172174
for _, cond := range c {
173175
exists := false
176+
174177
for i, existing := range s.Conditions {
175178
if existing.Type != cond.Type {
176179
continue
@@ -184,6 +187,7 @@ func (s *ConditionedStatus) SetConditions(c ...Condition) {
184187
s.Conditions[i] = cond
185188
exists = true
186189
}
190+
187191
if !exists {
188192
s.Conditions = append(s.Conditions, cond)
189193
}

apis/common/v1/connection_details.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func (in *ConnectionSecretMetadata) SetOwnerUID(uid types.UID) {
7272
if in.Labels == nil {
7373
in.Labels = map[string]string{}
7474
}
75+
7576
in.Labels[LabelKeyOwnerUID] = string(uid)
7677
}
7778

@@ -80,6 +81,7 @@ func (in *ConnectionSecretMetadata) GetOwnerUID() string {
8081
if u, ok := in.Labels[LabelKeyOwnerUID]; ok {
8182
return u
8283
}
84+
8385
return ""
8486
}
8587

apis/common/v1/merge.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ func (mo *MergeOptions) MergoConfiguration() []func(*mergo.Config) {
4040
if mo.KeepMapValues != nil && *mo.KeepMapValues {
4141
config = config[:0]
4242
}
43+
4344
if mo.AppendSlice != nil && *mo.AppendSlice {
4445
config = append(config, mergo.WithAppendSlice)
4546
}
47+
4648
return config
4749
}
4850

apis/common/v1/merge_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ func (arr mergoOptArr) names() []string {
3333
for i, opt := range arr {
3434
names[i] = runtime.FuncForPC(reflect.ValueOf(opt).Pointer()).Name()
3535
}
36+
3637
sort.Strings(names)
38+
3739
return names
3840
}
3941

4042
func TestMergoConfiguration(t *testing.T) {
4143
valTrue := true
44+
4245
tests := map[string]struct {
4346
mo *MergeOptions
4447
want mergoOptArr

apis/common/v1/resource.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ func (p *Policy) IsResolutionPolicyOptional() bool {
101101
if p == nil || p.Resolution == nil {
102102
return false
103103
}
104+
104105
return *p.Resolution == ResolutionPolicyOptional
105106
}
106107

@@ -109,6 +110,7 @@ func (p *Policy) IsResolvePolicyAlways() bool {
109110
if p == nil || p.Resolve == nil {
110111
return false
111112
}
113+
112114
return *p.Resolve == ResolvePolicyAlways
113115
}
114116

pkg/certificates/certificates.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ const (
3636
func LoadMTLSConfig(caPath, certPath, keyPath string, isServer bool) (*tls.Config, error) {
3737
tlsCertFilePath := filepath.Clean(certPath)
3838
tlsKeyFilePath := filepath.Clean(keyPath)
39+
3940
certificate, err := tls.LoadX509KeyPair(tlsCertFilePath, tlsKeyFilePath)
4041
if err != nil {
4142
return nil, errors.Wrap(err, errLoadCert)
4243
}
4344

4445
caCertFilePath := filepath.Clean(caPath)
46+
4547
ca, err := os.ReadFile(caCertFilePath)
4648
if err != nil {
4749
return nil, errors.Wrap(err, errLoadCA)

pkg/certificates/certificates_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ func TestLoad(t *testing.T) {
2727
certsFolderPath string
2828
requireClientValidation bool
2929
}
30+
3031
type want struct {
3132
err error
3233
out *tls.Config
3334
}
35+
3436
cases := map[string]struct {
3537
reason string
3638
args
@@ -92,16 +94,16 @@ func TestLoad(t *testing.T) {
9294
}
9395
for name, tc := range cases {
9496
t.Run(name, func(t *testing.T) {
95-
certsFolderPath := tc.args.certsFolderPath
96-
requireClient := tc.args.requireClientValidation
97+
certsFolderPath := tc.certsFolderPath
98+
requireClient := tc.requireClientValidation
9799

98100
cfg, err := LoadMTLSConfig(filepath.Join(certsFolderPath, caCertFileName), filepath.Join(certsFolderPath, tlsCertFileName), filepath.Join(certsFolderPath, tlsKeyFileName), requireClient)
99-
if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" {
101+
if diff := cmp.Diff(tc.err, err, test.EquateErrors()); diff != "" {
100102
t.Errorf("\n%s\nLoad(...): -want error, +got error:\n%s", tc.reason, diff)
101103
}
102104

103105
if requireClient {
104-
if diff := cmp.Diff(tc.want.out.ClientAuth, cfg.ClientAuth); diff != "" {
106+
if diff := cmp.Diff(tc.out.ClientAuth, cfg.ClientAuth); diff != "" {
105107
t.Errorf("\n%s\nLoad(...): -want, +got:\n%s", tc.reason, diff)
106108
}
107109
}

pkg/conditions/manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,6 @@ func (c *observedGenerationPropagationConditionSet) MarkConditions(condition ...
6868
for i := range condition {
6969
condition[i].ObservedGeneration = c.o.GetGeneration()
7070
}
71+
7172
c.o.SetConditions(condition...)
7273
}

pkg/conditions/manager_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func TestOGConditionSetMark(t *testing.T) {
8080
ut := newManaged(42, tt.start...)
8181
c := manager.For(ut)
8282
c.MarkConditions(tt.mark...)
83+
8384
if diff := cmp.Diff(tt.want, ut.Conditions, test.EquateConditions(), cmpopts.EquateApproxTime(1*time.Second)); diff != "" {
8485
t.Errorf("\nReason: %s\n-want, +got:\n%s", tt.reason, diff)
8586
}
@@ -129,5 +130,6 @@ func newManaged(generation int64, conditions ...xpv1.Condition) *fake.Managed {
129130
mg := &fake.Managed{}
130131
mg.Generation = generation
131132
mg.SetConditions(conditions...)
133+
132134
return mg
133135
}

pkg/connection/fake/mocks.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,13 @@ func (s *StoreConfig) GetObjectKind() schema.ObjectKind {
7474
// DeepCopyObject returns a copy of the object as runtime.Object.
7575
func (s *StoreConfig) DeepCopyObject() runtime.Object {
7676
out := &StoreConfig{}
77+
7778
j, err := json.Marshal(s)
7879
if err != nil {
7980
panic(err)
8081
}
82+
8183
_ = json.Unmarshal(j, out)
84+
8285
return out
8386
}

0 commit comments

Comments
 (0)