Skip to content

fix(go): upgrade the linter #3140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading