Skip to content

Commit

Permalink
fix(go): upgrade the linter (#3140)
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp authored Jun 6, 2024
1 parent cc09700 commit 34a1694
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ runs:
if: ${{ inputs.language == 'go' }}
shell: bash
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.0
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
go install golang.org/x/tools/cmd/goimports@latest
Expand Down
23 changes: 9 additions & 14 deletions clients/algoliasearch-client-go/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
linters-settings:
govet:
check-shadowing: true
enable-all: true
disable:
- fieldalignment

revive:
min-confidence: 0.8
rules:
- name: var-naming
disabled: true
Expand Down Expand Up @@ -54,20 +52,17 @@ linters:
- wastedassign
- gocyclo
- maintidx
- copyloopvar
- intrange
- canonicalheader
- mnd
- perfsprint

# Deprecated
- deadcode
- exhaustivestruct
- golint
- ifshort
- interfacer
- maligned
- nosnakecase
- scopelint
- structcheck
- varcheck
service:
golangci-lint-version: 1.55.2
- execinquery

issues:
exclude-generated: disable

run:
concurrency: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,7 @@ public void processOpts() {
super.processOpts();

// Generation notice, added on every generated files
// The banner is custom for go because golangci-lint will not format generated files, and we
// can't disable it
// https://github.com/golangci/golangci-lint/blob/f921f000f8494e32d2d5d38939c999414bb6b7e1/pkg/result/processors/autogenerated_exclude.go#L77
additionalProperties.put(
"generationBanner",
"File generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will" +
" be lost - read more on https://github.com/algolia/api-clients-automation."
);
Helpers.setGenerationBanner(additionalProperties);

apiTestTemplateFiles.clear();
modelTestTemplateFiles.clear();
Expand Down
2 changes: 1 addition & 1 deletion scripts/docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ RUN echo "export PATH=$PATH:/usr/local/bin/python" >> ~/.profile \
# Go
COPY --from=go-builder /usr/local/go/ /usr/local/go/
RUN echo "export PATH=$PATH:/usr/local/go/bin:/root/go/bin" >> ~/.profile && source ~/.profile \
&& curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2 \
&& curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.0 \
&& go install golang.org/x/tools/cmd/goimports@latest


Expand Down
5 changes: 3 additions & 2 deletions snippets/go/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ linters:
disable:
- ineffassign
- staticcheck
service:
golangci-lint-version: 1.55.2

issues:
exclude-generated: disable

run:
concurrency: 2
Expand Down
5 changes: 3 additions & 2 deletions tests/output/go/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ linters:
disable:
- ineffassign
- staticcheck
service:
golangci-lint-version: 1.55.2

issues:
exclude-generated: disable

run:
concurrency: 2
Expand Down

1 comment on commit 34a1694

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.