Skip to content
Open
Show file tree
Hide file tree
Changes from 13 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
2 changes: 2 additions & 0 deletions .github/config/file-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ lint:
- '**/*.sh'
- '.golangci.yml'
- 'packaging/**'
- 'go.mod'
- 'Makefile'

build:
- 'Makefile'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/PR-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
if: needs.changes.outputs.lint == 'true'
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
go-version: ~1.25
cache: false

- name: Check out code
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
if: needs.changes.outputs.build == 'true'
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
go-version: ~1.25
cache: false

- name: Check out code
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
if: needs.changes.outputs.build == 'true'
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
go-version: ~1.25
cache: false

- name: Check out code
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/PR-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
go-version: ~1.25

StartLocalStack:
name: 'StartLocalStack'
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
go-version: ~1.25

- name: Install jq
run: sudo apt-get install -y jq
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
go-version: ~1.25

- name: SetOutputs
id: set-outputs
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
go-version: ~1.25

- name: Generate matrix
id: set-matrix
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/eks-performance-cluster-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.24.4
go-version: ~1.25

- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/otel-fork-replace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
go-version: ~1.25
cache: false
- name: Update OTel fork components version
id: set-matrix
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
go-version: ~1.25

GenerateTestMatrix:
name: 'GenerateTestMatrix'
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
go-version: ~1.25

- name: Generate matrix
id: set-matrix
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ~1.22.2
go-version: ~1.25

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
go-version: ~1.25

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
go-version: ~1.25

- name: Free up disk space
run: .github/scripts/free-disk-space.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
go-version: ~1.25
cache: false

- name: Free up disk space
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ~1.22.2
go-version: ~1.25

- name: Upload Dependencies and Test Repo
run: |
Expand Down
100 changes: 45 additions & 55 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,58 @@
version: "2"
run:
# The default concurrency value is the number of available CPU.
concurrency: 4

# Timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 20m

# Exit code when at least one issue was found, default is 1
modules-download-mode: readonly
issues-exit-code: 1

# Include test files or not, default is true
tests: true

# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
# to go.mod are needed. This setting is most useful to check that go.mod does
# not need updates, such as in a continuous integration and testing system.
modules-download-mode: readonly

output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
formats: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true

# print linter name in the end of issue text, default is true
print-linter-name: true

# All available settings of specific linters
linters-settings:
gofmt:
# Simplify code: gofmt with `-s` option, true by default
simplify: true
goimports:
# Put imports beginning with prefix after 3rd-party packages.
# It's a comma-separated list of prefixes.
local-prefixes: github.com/aws/amazon-cloudwatch-agent
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
ignore-words:
- performancetest

formats:
text:
path: stdout
print-linter-name: true
print-issued-lines: true
linters:
disable:
- errcheck
enable:
- gofmt
- goimports
- gosec
- gosimple
- ineffassign
- misspell
- revive
- unused
- nonamedreturns
- revive
disable:
- errcheck
settings:
misspell:
ignore-rules:
- performancetest
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
rules:
# Package name based on field in JSON
- path: 'translator/translate/logs/logs_collected/windows_events'
text: "var-naming: don't use an underscore in package name"
linters:
- revive
Comment on lines -61 to -65
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't realize this exception was in the original config and wasn't moved in the migration until after I fixed it.


- linters:
- revive
path: 'translator/translate/util/*'
text: 'var-naming: avoid meaningless package names'
issues:
new-from-rev: 9af4477
new-from-rev: 9af4477
formatters:
enable:
- gofmt
- goimports
settings:
gofmt:
simplify: true
goimports:
local-prefixes:
- github.com/aws/amazon-cloudwatch-agent
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ install-addlicense:
install-golangci-lint:
#Install from source for golangci-lint is not recommended based on https://golangci-lint.run/usage/install/#install-from-source so using binary
#installation
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_BIN_DIR) v1.64.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(TOOLS_BIN_DIR) v2.4.0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

master -> HEAD more closely aligns with recommendation: https://golangci-lint.run/docs/welcome/install/#binaries


fmt: install-goimports addlicense
go fmt ./...
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/aws/amazon-cloudwatch-agent

go 1.24.9
go 1.25.5

replace github.com/influxdata/telegraf => github.com/aws/telegraf v0.10.2-0.20250113150713-a2dfaa4cdf6d

Expand Down
2 changes: 1 addition & 1 deletion internal/detector/common/constants.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT

package common
package common //nolint:revive // existing package name

const (
ExtJAR = ".jar"
Expand Down
4 changes: 2 additions & 2 deletions internal/detector/kafkabroker/extract/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type brokerInfo struct {

// ShouldParseProperties returns true if the properties file should be read to extract the log directories or broker ID.
func (i *brokerInfo) ShouldParseProperties() bool {
return len(i.serverProperties) != 0 && !(i.HasLogDirs() && i.HasBrokerID())
return len(i.serverProperties) != 0 && (!i.HasLogDirs() || !i.HasBrokerID())
}

func (i *brokerInfo) HasLogDirs() bool {
Expand Down Expand Up @@ -206,7 +206,7 @@ func (e *attributesExtractor) parseServerPropertiesFile(ctx context.Context, pro
} else if key == propertyLogDirs && !info.HasLogDirs() {
info.logDirs = value
}
return !(info.HasBrokerID() && info.HasLogDirs())
return !info.HasBrokerID() || !info.HasLogDirs()
})
}

Expand Down
2 changes: 1 addition & 1 deletion internal/detector/nvidia/nvidia.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/aws/amazon-cloudwatch-agent/internal/detector"
)

const nvidiaSMI = "nvidia-smi"
const nvidiaSMI = "nvidia-smi" //nolint:unused // Used in platform-specific files

// nvidiaDetector implements logging and checker for NVIDIA GPU
type nvidiaDetector struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/detector/util/process.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT

package util
package util //nolint:revive // existing package name

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion internal/detector/util/process_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT

package util
package util //nolint:revive // existing package name

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion internal/detector/util/scan.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT

package util
package util //nolint:revive // existing package name

import (
"bufio"
Expand Down
2 changes: 1 addition & 1 deletion internal/detector/util/scan_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT

package util
package util //nolint:revive // existing package name

import (
"strings"
Expand Down
2 changes: 1 addition & 1 deletion internal/detector/util/util.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT

package util
package util //nolint:revive // existing package name

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion internal/detector/util/util_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT

package util
package util //nolint:revive // existing package name

import (
"context"
Expand Down
Loading
Loading