Skip to content

Commit

Permalink
chore: fix linting errors and update to go 1.23
Browse files Browse the repository at this point in the history
Signed-off-by: Clément Nussbaumer <[email protected]>
  • Loading branch information
clementnuss committed Jan 21, 2025
1 parent 7eb0c7c commit 13db1c2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
26 changes: 13 additions & 13 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
---
run:
tests: false
skip-dirs:
- .github
- build
- web
- .go
linters-settings:
dupl:
threshold: 100
Expand All @@ -23,25 +18,22 @@ linters-settings:
- performance
- style
disabled-checks:
- whyNoLint
- hugeParam
gocyclo:
min-complexity: 15
revive:
min-confidence: 0.8
govet:
check-shadowing: true
confidence: 0.8
lll:
line-length: 140
misspell:
locale: UK
nolintlint:
allow-leading-space: false
require-explanation: true
allow-no-explanation:
- gocognit
- funlen
- gocyclo

linters:
disable-all: true
enable:
Expand Down Expand Up @@ -70,7 +62,7 @@ linters:
- prealloc
- protogetter
- rowserrcheck
- exportloopref
- copyloopvar
- staticcheck
- stylecheck
- sqlclosecheck
Expand All @@ -80,11 +72,19 @@ linters:
- unused
- whitespace
- wsl

issues:
exclude:
# Very commonly not checked.
- 'Error return value of .(l.Sync|.*Close|.*.Write|.*Flush|os\.Remove(All)?|os\.(Un)?Setenv). is not checked'
- 'Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked'
- 'G104:.*'
- 'exported method (.*\.MarshalJSON|.*\.UnmarshalJSON) should have comment or be unexported'
- 'exported method (.*\.MarshalJSON|.*\.UnmarshalJSON|.*\.MarshalText|.*\.UnmarshalText|.*\.LogValue|.*\.MarshalLogObject) should have comment or be unexported'
- 'shadow: declaration of "err" shadows declaration.*'
max-same-issues: 0
exclude-use-default: false
exclude-dirs:
- .github
- build
- web
- .go
- vendor
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module github.com/postfinance/kubenurse

go 1.22.0
go 1.23.0

toolchain go1.23.5

require (
Expand Down
2 changes: 1 addition & 1 deletion internal/kubenurse/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (s *Server) Shutdown() error {
}

func getOrDefault(envVar, defaultVal string) string {
if val := os.Getenv(envVar); len(val) > 0 {
if val := os.Getenv(envVar); val != "" {
return val
}

Expand Down
2 changes: 1 addition & 1 deletion internal/servicecheck/httptrace.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
// unique type for context.Context to avoid collisions.
type kubenurseTypeKey struct{}

// // http.RoundTripper
// RoundTripperFunc is a function which performs a round-trip check and potentially returns a response/error
type RoundTripperFunc func(req *http.Request) (*http.Response, error)

func (rt RoundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/servicecheck/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func generateTLSConfig(extraCA string) (*tls.Config, error) {

// Append extra CA, if set
if extraCA != "" {
caCert, err := os.ReadFile(extraCA) // Intentionally included by the user.
caCert, err := os.ReadFile(extraCA) //nolint:gosec // Intentionally included by the user.
if err != nil {
return nil, fmt.Errorf("could not load certificate %s: %w", extraCA, err)
}
Expand Down

0 comments on commit 13db1c2

Please sign in to comment.