From 87f36b0f5487de6381ccefeba60a6e5c029ac1f8 Mon Sep 17 00:00:00 2001 From: RebeccaMahany Date: Mon, 6 Jul 2026 12:27:19 -0400 Subject: [PATCH 1/3] Upgrade to go 1.25 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 88f6792..f6161a1 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/kolide/kit -go 1.24.0 +go 1.25.0 require ( github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc From bfb4f9699e5ffeb0556a19718b941b25f3176ef0 Mon Sep 17 00:00:00 2001 From: RebeccaMahany Date: Mon, 6 Jul 2026 12:33:47 -0400 Subject: [PATCH 2/3] Upgrade golangci-lint-action --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7872987..b954b93 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -29,7 +29,7 @@ jobs: check-latest: true - name: golangci-lint - uses: golangci/golangci-lint-action@4696ba8babb6127d732c3c6dde519db15edab9ea + uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9 with: skip-save-cache: true From 98a8f6dad625dc1dca5486207d549eb30bb02493 Mon Sep 17 00:00:00 2001 From: RebeccaMahany Date: Mon, 6 Jul 2026 12:39:00 -0400 Subject: [PATCH 3/3] Migrate to golangci-lint v2 --- .golangci.yml | 177 +++++++++++++++++++++++------------------- dbutil/dbutil.go | 2 +- debug/debug.go | 2 +- health/health_test.go | 2 +- munemo/munemo.go | 6 +- 5 files changed, 101 insertions(+), 88 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 1efcea2..58f1005 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,95 +1,112 @@ -run: - timeout: 5m - +version: "2" linters: enable: - bodyclose - containedctx - - gofmt - - govet - - ineffassign + - exhaustive + - gocritic - misspell + - nakedret - noctx - perfsprint + - predeclared + - revive - rowserrcheck - sloglint - sqlclosecheck - - staticcheck - - usetesting - unconvert - - unused - - gocritic - - nakedret - - predeclared - - revive - - exhaustive + - usetesting disable: - errcheck - gosec - - gosimple - -linters-settings: - errcheck: - exclude-functions: [github.com/go-kit/kit/log:Log] - gofmt: - simplify: false - gocritic: - disabled-checks: - - ifElseChain - - elseif - sloglint: - kv-only: true - context: "all" - key-naming-case: snake - static-msg: true - revive: + settings: + errcheck: + exclude-functions: + - github.com/go-kit/kit/log:Log + gocritic: + disabled-checks: + - ifElseChain + - elseif + revive: + rules: + - name: superfluous-else + arguments: + - preserveScope + severity: warning + disabled: false + - name: package-comments + disabled: false + - name: context-as-argument + disabled: false + - name: context-keys-type + disabled: false + - name: error-return + disabled: false + - name: errorf + disabled: false + - name: unreachable-code + disabled: false + - name: early-return + disabled: false + - name: confusing-naming + disabled: false + - name: defer + disabled: false + sloglint: + kv-only: true + context: all + static-msg: true + key-naming-case: snake + staticcheck: + checks: + - all + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling rules: - - name: superfluous-else - severity: warning - disabled: false - arguments: - - "preserveScope" - - name: package-comments - disabled: false - - name: context-as-argument - disabled: false - - name: context-keys-type - disabled: false - - name: error-return - disabled: false - - name: errorf - disabled: false - - name: unreachable-code - disabled: false - - name: early-return - disabled: false - - name: confusing-naming - disabled: false - - name: defer - disabled: false - staticcheck: - checks: ["all"] - -issues: - exclude-rules: - # False positive: https://github.com/kunwardeep/paralleltest/issues/8. - - linters: - - paralleltest - text: "does not use range value in test Run" - # We prefer fmt.Sprintf over string concatenation for readability - - linters: [perfsprint] - text: "fmt.Sprintf can be replaced with string concatenation" - - linters: [perfsprint] - text: "fmt.Sprintf can be replaced with faster hex.EncodeToString" - - linters: [perfsprint] - text: "fmt.Sprintf can be replaced with faster strconv.FormatBool" - - linters: [perfsprint] - text: "fmt.Sprintf can be replaced with faster strconv.FormatInt" - - linters: [perfsprint] - text: "fmt.Sprintf can be replaced with faster strconv.FormatUint" - - linters: [perfsprint] - text: "fmt.Sprintf can be replaced with faster strconv.Itoa" - - linters: [perfsprint] - text: "fmt.Sprint can be replaced with faster strconv.Itoa" - exclude-dirs: - - test-cmds + - linters: + - paralleltest + text: does not use range value in test Run + - linters: + - perfsprint + text: fmt.Sprintf can be replaced with string concatenation + - linters: + - perfsprint + text: fmt.Sprintf can be replaced with faster hex.EncodeToString + - linters: + - perfsprint + text: fmt.Sprintf can be replaced with faster strconv.FormatBool + - linters: + - perfsprint + text: fmt.Sprintf can be replaced with faster strconv.FormatInt + - linters: + - perfsprint + text: fmt.Sprintf can be replaced with faster strconv.FormatUint + - linters: + - perfsprint + text: fmt.Sprintf can be replaced with faster strconv.Itoa + - linters: + - perfsprint + text: fmt.Sprint can be replaced with faster strconv.Itoa + paths: + - test-cmds + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + settings: + gofmt: + simplify: false + exclusions: + generated: lax + paths: + - test-cmds + - third_party$ + - builtin$ + - examples$ diff --git a/dbutil/dbutil.go b/dbutil/dbutil.go index 4f15a14..d7bd3dc 100644 --- a/dbutil/dbutil.go +++ b/dbutil/dbutil.go @@ -88,7 +88,7 @@ func OpenDB(driver, dsn string, opts ...Option) (*sql.DB, error) { var dbError error for attempt := 0; attempt < config.maxAttempts; attempt++ { - dbError = db.Ping() + dbError = db.Ping() //nolint:noctx if dbError == nil { // we're connected! break diff --git a/debug/debug.go b/debug/debug.go index c37bbb3..b79bddf 100644 --- a/debug/debug.go +++ b/debug/debug.go @@ -82,7 +82,7 @@ func StartServer(opts ...Option) (*Server, error) { } func (s *Server) Start() error { - l, err := net.Listen("tcp", s.addr) + l, err := net.Listen("tcp", s.addr) //nolint:noctx if err != nil { return errors.Wrap(err, "opening socket") } diff --git a/health/health_test.go b/health/health_test.go index 369c9f6..b30b035 100644 --- a/health/health_test.go +++ b/health/health_test.go @@ -62,7 +62,7 @@ func TestHealthzHandler(t *testing.T) { t.Parallel() rr := httptest.NewRecorder() - req := httptest.NewRequest("GET", "/healthz", nil) + req := httptest.NewRequestWithContext(t.Context(), "GET", "/healthz", nil) tt.handler.ServeHTTP(rr, req) assert.Equal(t, rr.Code, tt.wantHeader) }) diff --git a/munemo/munemo.go b/munemo/munemo.go index 3645022..96ee80a 100644 --- a/munemo/munemo.go +++ b/munemo/munemo.go @@ -116,11 +116,7 @@ func (m *munemo) decode(s string) error { // As long as there are characters, parse them // Read the first syllable, interpret, remove. - for { - if s == "" { - break - } - + for s != "" { // Syllables are 2 or 3 letters. Check to see if the first 2 or 3 // characters are in our array of syllables. if val, ok := m.symbolValues[s[0:2]]; ok {