Skip to content

Commit 49b3521

Browse files
authored
Go1.24 bump + fixing non-constant format string issue (#1623)
1 parent a88411a commit 49b3521

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ install-addlicense:
158158
install-golangci-lint:
159159
#Install from source for golangci-lint is not recommended based on https://golangci-lint.run/usage/install/#install-from-source so using binary
160160
#installation
161-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_BIN_DIR) v1.62.2
161+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_BIN_DIR) v1.64.2
162162

163163
fmt: install-goimports addlicense
164164
go fmt ./...

cmd/config-downloader/downloader.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ func main() {
132132
util.SetSSLEnv(cc.SSLMap())
133133
var errorMessage string
134134
if downloadLocation == "" || outputDir == "" {
135-
executable, err := os.Executable()
136-
if err == nil {
137-
errorMessage = fmt.Sprintf("E! usage: " + filepath.Base(executable) + " --output-dir <path> --download-source ssm:<parameter-store-name> ")
135+
var errorMessage string
136+
if executable, err := os.Executable(); err == nil {
137+
errorMessage = "E! usage: " + filepath.Base(executable) + " --output-dir <path> --download-source ssm:<parameter-store-name>"
138138
} else {
139-
errorMessage = fmt.Sprintf("E! usage: --output-dir <path> --download-source ssm:<parameter-store-name> ")
139+
errorMessage = "E! usage: --output-dir <path> --download-source ssm:<parameter-store-name>"
140140
}
141-
log.Panicf(errorMessage)
141+
log.Panic(errorMessage)
142142
}
143143

144144
mode = sdkutil.DetectAgentMode(mode)
@@ -153,7 +153,7 @@ func main() {
153153
errorMessage = "E! Please make sure the credentials and region set correctly on your hosts.\n" +
154154
"Refer to http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html"
155155
}
156-
log.Panicf(errorMessage)
156+
log.Panic(errorMessage)
157157
}
158158

159159
// clean up output dir for tmp files before writing out new tmp file.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/aws/amazon-cloudwatch-agent
22

3-
go 1.23.6
3+
go 1.24.2
44

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

plugins/inputs/logfile/fileconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func (config *FileConfig) init() error {
114114
if config.Enc, _ = charset.Lookup(config.Encoding); config.Enc == nil {
115115
if config.Enc, _ = ianaindex.IANA.Encoding(config.Encoding); config.Enc == nil {
116116
msg := fmt.Sprintf("E! the encoding %s is not supported.", config.Encoding)
117-
log.Printf(msg)
117+
log.Print(msg)
118118
return errors.New(msg)
119119
}
120120
}

plugins/inputs/statsd/graphite/parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func (p *GraphiteParser) Parse(buf []byte) ([]telegraf.Metric, error) {
151151
}
152152

153153
if errStr != "" {
154-
return metrics, fmt.Errorf(strings.TrimSpace(errStr))
154+
return metrics, fmt.Errorf("%s", strings.TrimSpace(errStr))
155155
}
156156
return metrics, nil
157157
}

receiver/awsebsnvmereceiver/internal/nvme/ebs_metrics_notunix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ package nvme
77

88
import "errors"
99

10-
func GetMetrics(devicePath string) (EBSMetrics, error) {
10+
func GetMetrics(_ string) (EBSMetrics, error) {
1111
return EBSMetrics{}, errors.New("ebs metrics not supported")
1212
}

receiver/awsebsnvmereceiver/internal/nvme/util_notunix.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ func (u *Util) GetAllDevices() ([]DeviceFileAttributes, error) {
1111
return nil, errors.New("nvme not supported")
1212
}
1313

14-
func (u *Util) GetDeviceSerial(device *DeviceFileAttributes) (string, error) {
14+
func (u *Util) GetDeviceSerial(_ *DeviceFileAttributes) (string, error) {
1515
return "", errors.New("nvme not supported")
1616
}
1717

18-
func (u *Util) GetDeviceModel(device *DeviceFileAttributes) (string, error) {
18+
func (u *Util) GetDeviceModel(_ *DeviceFileAttributes) (string, error) {
1919
return "", errors.New("nvme not supported")
2020
}
2121

22-
func (u *Util) IsEbsDevice(device *DeviceFileAttributes) (bool, error) {
22+
func (u *Util) IsEbsDevice(_ *DeviceFileAttributes) (bool, error) {
2323
return false, errors.New("nvme not supported")
2424
}
2525

26-
func (u *Util) DevicePath(device string) (string, error) {
26+
func (u *Util) DevicePath(_ string) (string, error) {
2727
return "", errors.New("nvme not supported")
2828
}

translator/translate/logs/metrics_collected/prometheus/ruleConfigPath.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type ConfigPath struct {
2121
func (obj *ConfigPath) ApplyRule(input interface{}) (string, interface{}) {
2222
configPath, err := util.GetConfigPath(prometheusConfigName, common.PrometheusConfigPathKey, defaultLinuxPath+prometheusConfigName, input)
2323
if err != nil {
24-
log.Panicf(err.Error())
24+
log.Panic(err.Error())
2525
}
2626
return common.PrometheusConfigPathKey, configPath
2727
}

0 commit comments

Comments
 (0)