Skip to content

Commit

Permalink
Update Go version to 1.18.4
Browse files Browse the repository at this point in the history
Update Go version to 1.18.4, update linter config (dependant on Go
version) and fix all lint issues reported.

Closes elastic#25
  • Loading branch information
belimawr committed Jul 26, 2022
1 parent 998e03a commit 406f5fd
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.12
1.18.4
58 changes: 29 additions & 29 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@
# options for analysis running
run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 1m
timeout: 15m

issues:
# Maximum count of issues with the same text.
# Set to 0 to disable.
# Default: 3
max-same-issues: 0
max-same-issues: 3
# Maximum issues count per one linter.
# Set to 0 to disable.
# Default: 50
max-issues-per-linter: 0
max-issues-per-linter: 50
exclude-rules:
# Exclude package name contains '-' issue because we have at least one package with
# it on its name.
- text: "ST1003:"
linters:
- stylecheck

output:
sort-results: true
Expand All @@ -36,7 +42,6 @@ linters:
- goconst # finds repeated strings that could be replaced by a constant
- dupl # tool for code clone detection
- forbidigo # forbids identifiers matched by reg exps
- gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
- gosimple # linter for Go source code that specializes in simplifying a code
- misspell # finds commonly misspelled English words in comments
- nakedret # finds naked returns in functions greater than a specified function length
Expand Down Expand Up @@ -98,13 +103,24 @@ linters-settings:
# Exclude godoc examples from forbidigo checks. Default is true.
exclude_godoc_examples: true

gomoddirectives:
# Allow local `replace` directives. Default is false.
replace-local: false
goimports:
local-prefixes: github.com/elastic

gomodguard:
blocked:
# List of blocked modules.
modules:
# Blocked module.
- github.com/pkg/errors:
# Recommended modules that should be used instead. (Optional)
recommendations:
- errors
- fmt
reason: "This package is deprecated, use `fmt.Errorf` with `%w` instead"

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

misspell:
# Correct spellings using locale preferences for US or UK.
Expand All @@ -129,38 +145,22 @@ linters-settings:
# Enable to ensure that nolint directives are all used. Default is true.
allow-unused: false
# Disable to ensure that nolint directives don't have a leading space. Default is true.
allow-leading-space: true
allow-leading-space: false
# Exclude following linters from requiring an explanation. Default is [].
allow-no-explanation: []
# Enable to require an explanation of nonzero length after each nolint directive. Default is false.
require-explanation: true
# Enable to require nolint directives to mention the specific linter being suppressed. Default is false.
require-specific: true

gomodguard:
blocked:
# List of blocked modules.
modules:
# Blocked module.
- github.com/pkg/errors:
# Recommended modules that should be used instead. (Optional)
recommendations:
- errors
- fmt
reason: "This package is deprecated"
- github.com/elastic/beats/v7:
reason: "There must be no Beats dependency"
require-specific: false

staticcheck:
# Select the Go version to target. The default is '1.13'.
go: "1.17.12"
# https://staticcheck.io/docs/options#checks
go: "1.18.4"
checks: ["all"]

stylecheck:
# Select the Go version to target. The default is '1.13'.
go: "1.17.12"
# https://staticcheck.io/docs/options#checks
go: "1.18.4"
checks: ["all"]

unparam:
Expand All @@ -172,4 +172,4 @@ linters-settings:

unused:
# Select the Go version to target. The default is '1.13'.
go: "1.17.12"
go: "1.18.4"
2 changes: 2 additions & 0 deletions CHANGELOG-developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Update Go to 1.18.4

### Deprecated

### Removed
Expand Down
3 changes: 2 additions & 1 deletion pkg/manager/input/input-cursor/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ import (
"sync"
"time"

"go.uber.org/atomic"

"github.com/elastic/elastic-agent-inputs/pkg/statestore"
"github.com/elastic/elastic-agent-inputs/pkg/statestore/cleanup"
"github.com/elastic/elastic-agent-libs/logp"
"github.com/elastic/elastic-agent-libs/transform/typeconv"
"github.com/elastic/go-concert"
"github.com/elastic/go-concert/unison"
"go.uber.org/atomic"
)

// store encapsulates the persistent store and the in memory state store, that
Expand Down
4 changes: 2 additions & 2 deletions pkg/manager/input/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ package input
import (
"time"

"github.com/gofrs/uuid"

"github.com/elastic/elastic-agent-inputs/pkg/publisher"
conf "github.com/elastic/elastic-agent-libs/config"
"github.com/elastic/elastic-agent-libs/logp"
"github.com/gofrs/uuid"

"github.com/elastic/go-concert/unison"
)

Expand Down
3 changes: 2 additions & 1 deletion pkg/publisher/acker/acker.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ package acker
import (
"sync"

"github.com/elastic/elastic-agent-inputs/pkg/publisher"
"go.uber.org/atomic"

"github.com/elastic/elastic-agent-inputs/pkg/publisher"
)

// Nil creates an ACKer that does nothing.
Expand Down
3 changes: 2 additions & 1 deletion pkg/publisher/acker/acker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ package acker
import (
"testing"

"github.com/elastic/elastic-agent-inputs/pkg/publisher"
"github.com/stretchr/testify/require"

"github.com/elastic/elastic-agent-inputs/pkg/publisher"
)

type fakeACKer struct {
Expand Down

0 comments on commit 406f5fd

Please sign in to comment.