Skip to content

Commit

Permalink
GROUNDWORK-3991 update linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavlo Sumkin committed Jan 13, 2025
1 parent fcef71d commit 2577fe9
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ jobs:
with:
go-version: 1.23
- name: golangci-lint
uses: golangci/golangci-lint-action@v5
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.59.1
version: v1.61.0

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
args: --timeout=5m --disable depguard
args: --config .golangci.yaml --timeout=10m

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
Expand Down
32 changes: 16 additions & 16 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
run:
go: '1.23'
skip-dirs:
- vendor
- bin
- var
- tmp
- gotocjson
- libtransit
- deprecated
- connectors/nsca
skip-files:
- \.pb\.go$
modules-download-mode: readonly
build-tags:
- codeanalysis

govet:
enable:
Expand All @@ -34,11 +24,8 @@ linters:
- staticcheck
- stylecheck
- unconvert
# TODO: - unparam
- unused
- whitespace
# TODO: - gocognit
# TODO: - gocyclo
disable:
- depguard
- gochecknoglobals
Expand All @@ -50,8 +37,21 @@ linters:
- gosimple
- gosec
- funlen

- typecheck
issues:
exclude-dirs:
- vendor
- bin
- var
- tmp
- gotocjson
- libtransit
- deprecated
- connectors/nsca
- connector/nsca/nsca
exclude-files:
- \.pb\.go$
- connector/nsca/nsca/nsca.go
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
Expand Down
4 changes: 3 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ func (c *GWConnection) UnmarshalYAML(unmarshal func(interface{}) error) error {
return fmt.Errorf("unmarshaler error: %s SecKeyEnv is empty", SecVerPrefix)
}
var encrypted []byte
fmt.Sscanf(c.Password, SecVerPrefix+"%x", &encrypted)
if _, err := fmt.Sscanf(c.Password, SecVerPrefix+"%x", &encrypted); err != nil {
return err
}
decrypted, err := Decrypt(encrypted, []byte(s))
if err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions connectors/checker/checker.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !codeanalysis

package checker

import (
Expand Down
2 changes: 2 additions & 0 deletions connectors/checker/checker_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !codeanalysis

package checker

import (
Expand Down
2 changes: 2 additions & 0 deletions connectors/checker/cmd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !codeanalysis

package checker

import (
Expand Down
2 changes: 2 additions & 0 deletions connectors/nsca/cmd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !codeanalysis

package nsca

import (
Expand Down
2 changes: 2 additions & 0 deletions connectors/nsca/nsca.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !codeanalysis

package nsca

import (
Expand Down
2 changes: 2 additions & 0 deletions connectors/nsca/nsca/nsca.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !codeanalysis

package nsca

import (
Expand Down
2 changes: 2 additions & 0 deletions connectors/nsca/parser/parser.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !codeanalysis

package parser

import (
Expand Down
2 changes: 2 additions & 0 deletions connectors/nsca/parser/parser_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !codeanalysis

package parser

import (
Expand Down
1 change: 0 additions & 1 deletion integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ func BenchmarkE2E(b *testing.B) {
}
}
})

}

func resources(countHst, countSvc int, opts ...OV) []transit.MonitoredResource {
Expand Down
4 changes: 2 additions & 2 deletions integration/nats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
// if Groundwork Foundation is unavailable
// TODO: TCG connects to Foundation as local connection
func TestNatsQueue1(t *testing.T) {
setupIntegration(t, OV{natsAckWait, 5*time.Second}, OV{dynInventory, true})
setupIntegration(t, OV{natsAckWait, 5 * time.Second}, OV{dynInventory, true})
apiClient.RemoveAgent(services.GetTransitService().AgentID)
defer apiClient.RemoveAgent(services.GetTransitService().AgentID)
defer cleanNats(t)
Expand Down Expand Up @@ -59,7 +59,7 @@ func TestNatsQueue1(t *testing.T) {
// after NATS streaming server restarting
// TODO: TCG connects to Foundation as remote connection
func TestNatsQueue2(t *testing.T) {
setupIntegration(t, OV{natsAckWait, 30*time.Second}, OV{dynInventory, true})
setupIntegration(t, OV{natsAckWait, 30 * time.Second}, OV{dynInventory, true})
apiClient.RemoveAgent(services.GetTransitService().AgentID)
defer apiClient.RemoveAgent(services.GetTransitService().AgentID)
defer cleanNats(t)
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !codeanalysis

package main

import (
Expand Down
2 changes: 0 additions & 2 deletions services/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ func (service *AgentService) startTransport() error {
service.Connector.AppType == traceOnDemandAppType ||
len(service.Connector.AgentID) == 0 ||
len(service.Connector.AppType) == 0 {

err := fmt.Errorf("connector is not configured: AppType/AgentID: %v/%v",
service.Connector.AppType, service.Connector.AgentID)
log.Err(err).Msg("could not start")
Expand Down Expand Up @@ -624,7 +623,6 @@ func (service *AgentService) fixTracerContext(payloadJSON []byte) []byte {
service.Connector.AppType == traceOnDemandAppType ||
len(service.Connector.AgentID) == 0 ||
len(service.Connector.AppType) == 0 {

err := fmt.Errorf("connector is not configured: AppType/AgentID: %v/%v",
service.Connector.AppType, service.Connector.AgentID)
log.Err(err).Msg("could not fixTracerContext")
Expand Down

0 comments on commit 2577fe9

Please sign in to comment.