Skip to content

Commit

Permalink
lint up
Browse files Browse the repository at this point in the history
* golangci-lint v1.64.5 (was 1.63.4)
* cleanup yaml, remove redundant rules

Signed-off-by: Alex Aizman <[email protected]>
  • Loading branch information
alex-aizman committed Feb 17, 2025
1 parent 1061d4c commit 95c11af
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: golangci/golangci-lint-action@v6
with:
# NOTE: See `lint-update-ci` target in Makefile.
version: v1.63.4
version: v1.64.5
args: --timeout=30m

- name: Lint
Expand Down
42 changes: 4 additions & 38 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ linters-settings:
ignore-generated-header: true
severity: warning
rules:
# name: import-shadowing ## TODO: enable
# name: import-shadowing ## (e.g., url)
# name: unhandled-error
# name: line-length-limit
# name: dot-imports
Expand Down Expand Up @@ -85,7 +85,7 @@ linters-settings:
enable-all: true
disable:
- fieldalignment # TODO: enable once in a while (lots of noise though)
- shadow # Reports a lot of false-positives and conflicts with other linters.
- shadow # (e.g., proxyURL)
errcheck:
check-blank: true
check-type-assertions: false
Expand Down Expand Up @@ -113,6 +113,8 @@ linters-settings:
rules:
main:
deny:
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
- pkg: 'math/rand$'
desc: "`math/rand` package has been deprecated use `math/rand/v2`"

Expand All @@ -125,45 +127,9 @@ issues:
- linters: [errcheck]
text: "Error return value of" # ignores 'error return value of ... is unchecked'

- linters: [golint]
text: "and that stutters; consider calling this"

- linters: [golint]
text: "don't use an underscore in package name"

- linters: [revive]
text: "or a comment on this block"

- linters: [unused]
text: "`noCopy` is unused"

- linters: [gocritic]
text: "importShadow: shadow of imported"

- linters: [gocritic]
text: "builtinShadow: shadowing of predeclared identifier: new"

- linters: [gocritic, gofmt, goimports]
source: "///" # commentFormatting

- linters: [gocritic, gofmt, goimports]
source: "//==" # commentFormatting

- linters: [staticcheck]
text: "SA5011:" # produces a lot of false-positives; hopefully in the future we could enable it!

- linters: [interfacer]
text: "k8s.io/client-go/rest.HTTPClient" # suggests to change `*http.Client` to `rest.HTTPClient`...

- linters: [staticcheck]
text: "SA3000: TestMain should call os.Exit to set exit code" # This is not true for Go1.15 or later.

- linters: [gocritic]
text: "block doesn't have definitions" # Sometimes blocks are useful for better readability.

- linters: [golint]
source: "embed" # Justification for `import _ "embed"` is not needed.

# Set to 0 to disable limit
max-same-issues: 0
max-issues-per-linter: 0
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ lint-update:
## See also: .github/workflows/lint.yml
lint-update-ci:
@rm -f $(GOPATH)/bin/golangci-lint
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.63.4
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.64.5

lint:
@([[ -x "$(command -v golangci-lint)" ]] && echo "Cannot find golangci-lint, run 'make lint-update' to install" && exit 1) || true
Expand Down
4 changes: 2 additions & 2 deletions ais/clustermap.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const clusterMap = "Smap"
// NOTE: to access Snode, Smap and related structures, external
// packages and HTTP clients must import aistore/cluster (and not ais)

//=====================================================================
// =====================================================================
//
// - smapX is a server-side extension of the meta.Smap
// - smapX represents AIStore cluster in terms of its member nodes and their properties
Expand All @@ -47,7 +47,7 @@ const clusterMap = "Smap"
// (*) for merges and conflict resolution, check smapX version prior to put()
// (version check must be protected by the same critical section)
//
//=====================================================================
// =====================================================================

type (
smapX struct {
Expand Down
2 changes: 1 addition & 1 deletion docs/_posts/2025-02-16-split-brain-blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Could also be misdiagnosed. Misattributed. Misinterpreted. Totally innocuous aft
Anything's possible. And if it is possible it will surely happen.

But still, suppose we - eventually — heuristicize our ways to detect the unexpected.
Suppose, we nail it. Suppose, we have already. What do we do about it?
Suppose, we nail it. Suppose, we already have. What do we do about it?

Well, again, the aforementioned conventional wisdom comes to the rescue, offering a menu of decisive militaristic actions:

Expand Down

0 comments on commit 95c11af

Please sign in to comment.