Skip to content

Commit

Permalink
Update tools and fix CI (#110)
Browse files Browse the repository at this point in the history
Update github.com/elastic/elastic-agent-libs so we get a more recent
version of golangci-lint locally. Now running `mage lint` gives the same
result as the Github Action.

Fix linter errors in existing code, drop deprecated linters, and revert
the `nakedret` linter to its default config.

I've also updated the default Go version to 1.22.7, as the updated
tooling requires it.
  • Loading branch information
swiatekm authored Oct 2, 2024
1 parent e092f62 commit 3f3a65d
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 934 deletions.
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.21.13
1.22.7
14 changes: 4 additions & 10 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ linters:
- unused # checks Go code for unused constants, variables, functions and types
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
- ineffassign # detects when assignments to existing variables are not used
- structcheck # finds unused struct fields
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
- varcheck # Finds unused global variables and constants
- asciicheck # simple linter to check that your code does not contain non-ASCII identifiers
- bodyclose # checks whether HTTP response body is closed successfully
- durationcheck # check for two durations multiplied together
Expand Down Expand Up @@ -87,11 +85,7 @@ linters-settings:

gosimple:
# Select the Go version to target. The default is '1.13'.
go: "1.21.13"

nakedret:
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
max-func-lines: 0
go: ""

nolintlint:
# Enable to ensure that nolint directives are all used. Default is true.
Expand Down Expand Up @@ -121,15 +115,15 @@ linters-settings:

staticcheck:
# Select the Go version to target. The default is '1.13'.
go: "1.21.13"
go: ""

stylecheck:
# Select the Go version to target. The default is '1.13'.
go: "1.21.13"
go: ""

unused:
# Select the Go version to target. The default is '1.13'.
go: "1.21.13"
go: ""

gosec:
excludes:
Expand Down
Loading

0 comments on commit 3f3a65d

Please sign in to comment.