Skip to content

Commit fb09f3a

Browse files
committed
Update golangci configuration to latest version
1 parent 90adbee commit fb09f3a

File tree

3 files changed

+49
-50
lines changed

3 files changed

+49
-50
lines changed

.golangci.yml

Lines changed: 41 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,46 @@
1-
# Licensed to the Apache Software Foundation (ASF) under one
2-
# or more contributor license agreements. See the NOTICE file
3-
# distributed with this work for additional information
4-
# regarding copyright ownership. The ASF licenses this file
5-
# to you under the Apache License, Version 2.0 (the
6-
# "License"); you may not use this file except in compliance
7-
# with the License. You may obtain a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing,
12-
# software distributed under the License is distributed on an
13-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
# KIND, either express or implied. See the License for the
15-
# specific language governing permissions and limitations
16-
# under the License.
17-
18-
linters-settings:
19-
goheader:
20-
template: |-
21-
* Licensed to the Apache Software Foundation (ASF) under one
22-
* or more contributor license agreements. See the NOTICE file
23-
* distributed with this work for additional information
24-
* regarding copyright ownership. The ASF licenses this file
25-
* to you under the Apache License, Version 2.0 (the
26-
* "License"); you may not use this file except in compliance
27-
* with the License. You may obtain a copy of the License at
28-
*
29-
* http://www.apache.org/licenses/LICENSE-2.0
30-
*
31-
* Unless required by applicable law or agreed to in writing,
32-
* software distributed under the License is distributed on an
33-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
34-
* KIND, either express or implied. See the License for the
35-
* specific language governing permissions and limitations
36-
* under the License.
37-
1+
version: "2"
2+
run:
3+
modules-download-mode: readonly
4+
issues-exit-code: 1
385
linters:
396
enable:
407
- goheader
418
- gosec
42-
- gosimple
43-
- govet
44-
- ineffassign
459
- misspell
46-
- staticcheck
47-
- typecheck
48-
- unused
49-
50-
run:
51-
modules-download-mode: readonly
52-
timeout: 5m
53-
issues-exit-code: 1
10+
settings:
11+
goheader:
12+
template: |-
13+
* Licensed to the Apache Software Foundation (ASF) under one
14+
* or more contributor license agreements. See the NOTICE file
15+
* distributed with this work for additional information
16+
* regarding copyright ownership. The ASF licenses this file
17+
* to you under the Apache License, Version 2.0 (the
18+
* "License"); you may not use this file except in compliance
19+
* with the License. You may obtain a copy of the License at
20+
*
21+
* http://www.apache.org/licenses/LICENSE-2.0
22+
*
23+
* Unless required by applicable law or agreed to in writing,
24+
* software distributed under the License is distributed on an
25+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26+
* KIND, either express or implied. See the License for the
27+
* specific language governing permissions and limitations
28+
* under the License.
29+
exclusions:
30+
generated: lax
31+
presets:
32+
- comments
33+
- common-false-positives
34+
- legacy
35+
- std-error-handling
36+
paths:
37+
- third_party$
38+
- builtin$
39+
- examples$
40+
formatters:
41+
exclusions:
42+
generated: lax
43+
paths:
44+
- third_party$
45+
- builtin$
46+
- examples$

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,9 @@ docker:
5353
ifneq (${GIT_IS_TAG},NOT_A_TAG)
5454
docker tag apache/cloudstack-kubernetes-provider:${GIT_COMMIT_SHORT} apache/cloudstack-kubernetes-provider:${GIT_TAG}
5555
endif
56+
57+
lint:
58+
@(echo "Running golangci-lint...")
59+
golangci-lint run
60+
@(echo "Running gofmt...")
61+
@(echo "gofmt -l"; FMTFILES="$$(gofmt -l .)"; if test -n "$${FMTFILES}"; then echo "Go files that need to be reformatted (use 'go fmt'):\n$${FMTFILES}"; exit 1; fi)

cloudstack_loadbalancer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ func (cs *CSCloud) EnsureLoadBalancer(ctx context.Context, clusterName string, s
200200
for _, lbRule := range lb.rules {
201201
protocol := ProtocolFromLoadBalancer(lbRule.Protocol)
202202
if protocol == LoadBalancerProtocolInvalid {
203-
return nil, fmt.Errorf("Error parsing protocol %v: %v", lbRule.Protocol, err)
203+
return nil, fmt.Errorf("error parsing protocol %v: %v", lbRule.Protocol, err)
204204
}
205205
port, err := strconv.ParseInt(lbRule.Publicport, 10, 32)
206206
if err != nil {
207-
return nil, fmt.Errorf("Error parsing port %s: %v", lbRule.Publicport, err)
207+
return nil, fmt.Errorf("error parsing port %s: %v", lbRule.Publicport, err)
208208
}
209209

210210
klog.V(4).Infof("Deleting firewall rules associated with load balancer rule: %v (%v:%v:%v)", lbRule.Name, protocol, lbRule.Publicip, port)

0 commit comments

Comments
 (0)