21 Commits

Author SHA1 Message Date
Ville Vesilehto
b72d267a29 chore(lint): bump to v2.5.0 and enable godoclint (#7632) 2025-10-23 10:01:57 -07:00
Catena cyber
625f6c9307 perf: avoid string concatenation in loops (#7572)
* perf: avoid string concatenation in loops

Apply perfpsrint linter

Signed-off-by: Philippe Antoine <contact@catenacyber.fr>

* ci: enable perfsprint

Signed-off-by: Philippe Antoine <contact@catenacyber.fr>

---------

Signed-off-by: Philippe Antoine <contact@catenacyber.fr>
2025-10-06 00:05:58 -07:00
Ville Vesilehto
0d05791404 lint: enable nakedret (#7569)
Replace naked returns with explicit return values to satisfy nakedret
linter and improve readability.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-21 08:17:35 -07:00
Ville Vesilehto
c916cf4259 fix(plugin): nilness findings (#7556)
Enable nilness linter in govet.

Plugin-by-plugin rationale:

- plugin/transfer: reuse error instead of shadowing it inside the for
  loop by declaring "ret" outside of the loop
- plugin/view: remove redundant err check
- plugin/dnstap: avoid possible nil dereference in error reporting
  path in setup test
- plugin/forward: prevent nil deference or empty-slice dereference on
  error paths in setup test

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-15 10:17:06 -07:00
Ville Vesilehto
359632a2f4 lint: enable prealloc (#7493) 2025-09-01 18:05:15 -07:00
Ville Vesilehto
4d3061a9c4 lint: enable durationcheck (#7492) 2025-09-01 18:04:35 -07:00
Matthieu MOREL
67f3ece737 chore: enable more rules from revive (#7352)
* chore: enable context-as-argument from revive
* chore: enable unnecessary-stmt from revive
* chore: enable unused-parameter from revive
* chore: enable use-any from revive

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-05 13:47:52 +02:00
Matthieu MOREL
186e4a1dbb chore: enable early-return and superfluous-else from revive (#7129)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-05 10:10:58 +03:00
Ville Vesilehto
9f9aed31cf test: add t.Helper() calls to test helper functions (#7351) 2025-06-04 14:36:04 -07:00
Ville Vesilehto
8cac83dfb5 lint: enable wastedassign linter (#7340) 2025-06-01 16:30:41 -07:00
Ville Vesilehto
53e9681a39 lint: enable protogetter linter (#7336)
Enable protogetter in golangci config and update all protobuf field
access to use getter methods instead of direct field access.
Getter methods provide safer nil pointer handling and return
appropriate default values, following protobuf best practices.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-05-30 15:29:32 -07:00
Ville Vesilehto
a61d8b3143 lint: enable nolintlint linter (#7332) 2025-05-29 07:19:04 +03:00
Ville Vesilehto
19a6ae4983 lint: enable intrange linter (#7331)
Enable intrange linter to enforce modern Go range syntax over
traditional for loops, by converting:

for i := 0; i < n; i++

to:

for i := range n

Adding type conversions where needed for compatibility
with existing uint64 parameters.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-05-28 17:50:55 -07:00
Ville Vesilehto
bebb7bce43 lint: enable canonicalheader linter (#7330)
Enable canonicalheader linter to enforce proper HTTP header casing.
This ensures headers use Go's canonical format (e.g., "Content-Type"
instead of "content-type") for consistency.

Fixes header casing in DoH implementation.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-05-28 17:33:07 -07:00
Ville Vesilehto
7bd43af427 fix: loop variable capture and linter (#7328)
Enable copyloopvar linter and remove redundant variable
shadowing in Kubernetes plugin metadata handling. This pattern is
no longer needed in Go 1.22+ where loop variables are automatically
captured correctly in closures.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-05-27 14:44:20 -07:00
Ville Vesilehto
eeb1663847 lint: enable usetesting linter (#7322)
Enable the usetesting linter in golangci.yml configuration to
enforce proper testing practices. Replace manual temporary
directory and file creation with t.TempDir() in test files.

This improves test reliability by ensuring proper cleanup and
follows Go testing best practices.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-05-27 10:02:55 -07:00
Manuel Rüger
76ba39ffe9 chore: Upgrade to golangci-lint v2 (#7236)
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2025-04-04 14:27:39 -04:00
Zhizhen He
5de473da1c fix: remove unnecessary conversion (#6258)
Signed-off-by: Zhizhen He <hezhizhen.yi@gmail.com>
2023-08-14 15:14:09 +02:00
Ondřej Benkovský
8c489bd400 replace reviewdog fully by golangci-lint (#6139)
Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
2023-06-09 18:08:23 +02:00
Ondřej Benkovský
257ca65a17 GO linting bump and removal of deprecated linters (#5624)
* bump golangci-lint with support of go 1.19

Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>

* remove deprecated usage of varcheck, deadcode, and structcheck

Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>

Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
2022-09-19 05:53:43 -07:00
Ondřej Benkovský
c2dbb7141a add golangci-lint linter (#5499) 2022-07-10 11:06:33 -07:00