This is an automated email from the ASF dual-hosted git repository. vishesh pushed a commit to branch update-docs-gha-and-golangci in repository https://gitbox.apache.org/repos/asf/cloudstack-kubernetes-provider.git
commit fb09f3ad36363f3fa262e9d74c9dfcc6d743103e Author: vishesh92 <[email protected]> AuthorDate: Tue Nov 25 16:14:37 2025 +0100 Update golangci configuration to latest version --- .golangci.yml | 89 +++++++++++++++++++++------------------------- Makefile | 6 ++++ cloudstack_loadbalancer.go | 4 +-- 3 files changed, 49 insertions(+), 50 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 5bc9b136..7221e002 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,53 +1,46 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -linters-settings: - goheader: - template: |- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - +version: "2" +run: + modules-download-mode: readonly + issues-exit-code: 1 linters: enable: - goheader - gosec - - gosimple - - govet - - ineffassign - misspell - - staticcheck - - typecheck - - unused - -run: - modules-download-mode: readonly - timeout: 5m - issues-exit-code: 1 + settings: + goheader: + template: |- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile b/Makefile index aebd9ff7..0b33fb10 100644 --- a/Makefile +++ b/Makefile @@ -53,3 +53,9 @@ docker: ifneq (${GIT_IS_TAG},NOT_A_TAG) docker tag apache/cloudstack-kubernetes-provider:${GIT_COMMIT_SHORT} apache/cloudstack-kubernetes-provider:${GIT_TAG} endif + +lint: + @(echo "Running golangci-lint...") + golangci-lint run + @(echo "Running gofmt...") + @(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) \ No newline at end of file diff --git a/cloudstack_loadbalancer.go b/cloudstack_loadbalancer.go index 7a3fd6b0..4e0ac6ab 100644 --- a/cloudstack_loadbalancer.go +++ b/cloudstack_loadbalancer.go @@ -200,11 +200,11 @@ func (cs *CSCloud) EnsureLoadBalancer(ctx context.Context, clusterName string, s for _, lbRule := range lb.rules { protocol := ProtocolFromLoadBalancer(lbRule.Protocol) if protocol == LoadBalancerProtocolInvalid { - return nil, fmt.Errorf("Error parsing protocol %v: %v", lbRule.Protocol, err) + return nil, fmt.Errorf("error parsing protocol %v: %v", lbRule.Protocol, err) } port, err := strconv.ParseInt(lbRule.Publicport, 10, 32) if err != nil { - return nil, fmt.Errorf("Error parsing port %s: %v", lbRule.Publicport, err) + return nil, fmt.Errorf("error parsing port %s: %v", lbRule.Publicport, err) } klog.V(4).Infof("Deleting firewall rules associated with load balancer rule: %v (%v:%v:%v)", lbRule.Name, protocol, lbRule.Publicip, port)
