Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
- name: golangci-lint
env:
GOOS: ${{ matrix.GOOS }}
uses: golangci/golangci-lint-action@v3
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.55.2
version: v1.64.8

# Give the job more time to execute.
# Regarding `--whole-files`, the linter is supposed to support linting of changed a patch only but,
Expand Down Expand Up @@ -69,10 +69,10 @@ jobs:
- name: golangci-lint
env:
CGO_ENABLED: 1
uses: golangci/golangci-lint-action@v3
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.55.2
version: v1.64.8

# Give the job more time to execute.
# Regarding `--whole-files`, the linter is supposed to support linting of changed a patch only but,
Expand Down
28 changes: 7 additions & 21 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ issues:
# Set to 0 to disable.
# Default: 50
max-issues-per-linter: 0
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- errcheck

output:
sort-results: true
Expand All @@ -36,7 +41,7 @@ linters:
- asciicheck # simple linter to check that your code does not contain non-ASCII identifiers
- bodyclose # checks whether HTTP response body is closed successfully
- durationcheck # check for two durations multiplied together
- exportloopref # checks for pointers to enclosing loop variables
- copyloopvar # checks for pointers to enclosing loop variables
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports
- gosec # inspects source code for security problems
- importas # enforces consistent import aliases
Expand Down Expand Up @@ -71,8 +76,6 @@ linters-settings:
# Forbid the following identifiers
forbid:
- fmt.Print.* # too much log noise
# Exclude godoc examples from forbidigo checks. Default is true.
exclude_godoc_examples: true

goimports:
local-prefixes: github.com/elastic
Expand All @@ -91,20 +94,13 @@ linters-settings:
- github.com/elastic/beats/v7:
reason: "There must be no Beats dependency"

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


nakedret:
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
max-func-lines: 0

nolintlint:
# Enable to ensure that nolint directives are all used. Default is true.
allow-unused: true
# Disable to ensure that nolint directives don't have a leading space. Default is 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.
Expand All @@ -113,21 +109,11 @@ linters-settings:
require-specific: true

staticcheck:
# Select the Go version to target. The default is '1.13'.
go: "1.23.9"
checks: ["all"]

stylecheck:
# Select the Go version to target. The default is '1.13'.
go: "1.23.9"
checks: ["all"]

unused:
# Select the Go version to target. The default is '1.13'.
go: "1.23.9"

gosec:
excludes:
- G115 # Integer overflow conversion
- G306 # Expect WriteFile permissions to be 0600 or less
- G404 # Use of weak random number generator
- G401 # Detect the usage of DES, RC4, MD5 or SHA1: Used in non-crypto contexts.
Expand Down
2 changes: 1 addition & 1 deletion metric/system/cgroup/cgcommon/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func ParseUint(value []byte) (uint64, error) {
intValue, intErr := strconv.ParseInt(strValue, 10, 64)
if intErr == nil && intValue < 0 {
return 0, nil
} else if intErr != nil && intErr.(*strconv.NumError).Err == strconv.ErrRange && intValue < 0 { //nolint: errorlint // keep old behaviour
} else if intErr != nil && intErr.(*strconv.NumError).Err == strconv.ErrRange && intValue < 0 { //nolint: errorlint,errcheck // keep old behaviour
return 0, nil
}

Expand Down
2 changes: 1 addition & 1 deletion metric/system/cgroup/cgv2/io_helper_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func fetchDeviceName(major uint64, minor uint64) (bool, string, error) {
if !ok {
return nil
}
devID = uint64(infoT.Rdev)
devID = infoT.Rdev

// do some bitmapping to extract the major and minor device values
// The odd duplicated logic here is to deal with 32 and 64 bit values.
Expand Down
4 changes: 2 additions & 2 deletions metric/system/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (procStats *Stats) Get() ([]mapstr.M, []mapstr.M, error) {
rootEvents := make([]mapstr.M, 0, len(plist))

for _, process := range plist {
process := process

// Add the RSS pct memory first
process.Memory.Rss.Pct = GetProcMemPercentage(process, totalPhyMem)
// Create the root event
Expand Down Expand Up @@ -402,7 +402,7 @@ func (procStats *Stats) includeTopProcesses(processes []ProcState) []ProcState {
return processes[i].Memory.Rss.Bytes.ValueOr(0) > processes[j].Memory.Rss.Bytes.ValueOr(0)
})
for _, proc := range processes[:numProcs] {
proc := proc

if !isProcessInSlice(result, &proc) {
result = append(result, proc)
}
Expand Down
Loading