Skip to content

Commit 531e724

Browse files
kakkoyunralf0131
andauthored
chore(build): Fix Go 1.25 build errors and support Go 1.24+ (#127)
* chore(build): Fix Go 1.25 build errors Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com> * chore: Fix linter issues Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com> --------- Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com> Co-authored-by: Huxing Zhang <huxing.zhang@gmail.com>
1 parent 6f78db8 commit 531e724

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ linters:
323323
nolintlint:
324324
# Exclude following linters from requiring an explanation.
325325
# Default: []
326-
allow-no-explanation: [ funlen, gocognit, golines ]
326+
allow-no-explanation: [ funlen, gocognit, golines, exhaustive ]
327327
# Enable to require an explanation of nonzero length after each nolint directive.
328328
# Default: false
329329
require-explanation: true

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33

44
module github.com/open-telemetry/opentelemetry-go-compile-instrumentation
55

6-
go 1.23.0
6+
go 1.24.0
77

88
require (
99
github.com/dave/dst v0.27.3
1010
github.com/stretchr/testify v1.11.1
1111
github.com/urfave/cli/v3 v3.4.1
12-
golang.org/x/mod v0.12.0
12+
golang.org/x/mod v0.29.0
1313
gopkg.in/yaml.v3 v3.0.1
1414
)
1515

1616
require (
1717
github.com/davecgh/go-spew v1.1.1 // indirect
1818
github.com/pmezard/go-difflib v1.0.0 // indirect
19-
golang.org/x/sys v0.13.0 // indirect
20-
golang.org/x/tools v0.13.0 // indirect
19+
golang.org/x/sync v0.17.0 // indirect
20+
golang.org/x/tools v0.38.0 // indirect
2121
)

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ github.com/dave/jennifer v1.5.0 h1:HmgPN93bVDpkQyYbqhCHj5QlgvUkvEOzMyEvKLgCRrg=
44
github.com/dave/jennifer v1.5.0/go.mod h1:4MnyiFIlZS3l5tSDn8VnzE6ffAhYBMB2SZntBsZGUok=
55
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
66
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7+
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
8+
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
79
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
810
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
911
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
@@ -12,14 +14,12 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
1214
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
1315
github.com/urfave/cli/v3 v3.4.1 h1:1M9UOCy5bLmGnuu1yn3t3CB4rG79Rtoxuv1sPhnm6qM=
1416
github.com/urfave/cli/v3 v3.4.1/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo=
15-
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
16-
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
17-
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
18-
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
19-
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
20-
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
21-
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
22-
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
17+
golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
18+
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
19+
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
20+
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
21+
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
22+
golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
2323
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2424
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2525
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

test/infra.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package test
55

66
import (
7+
"context"
78
"os/exec"
89
"path/filepath"
910
"testing"
@@ -18,10 +19,10 @@ import (
1819
// compiled binary program, and verify that the output of the binary program
1920
// is as expected.
2021

21-
func runCmd(dir string, args ...string) (string, error) {
22+
func runCmd(ctx context.Context, dir string, args ...string) (string, error) {
2223
path := args[0]
2324
args = args[1:]
24-
cmd := exec.Command(path, args...)
25+
cmd := exec.CommandContext(ctx, path, args...)
2526
cmd.Dir = dir
2627
output, err := cmd.CombinedOutput()
2728
if err != nil {
@@ -38,13 +39,13 @@ func BuildApp(t *testing.T, appDir string, args ...string) {
3839
}
3940
otelPath := filepath.Join("..", "..", binName)
4041
args = append([]string{otelPath}, args...)
41-
out, err := runCmd(appDir, args...)
42+
out, err := runCmd(t.Context(), appDir, args...)
4243
require.NoError(t, err, out)
4344
}
4445

4546
// RunApp runs the application and returns the output.
4647
func RunApp(t *testing.T, dir string) string {
47-
out, err := runCmd(dir, "./"+filepath.Base(dir))
48+
out, err := runCmd(t.Context(), dir, "./"+filepath.Base(dir))
4849
require.NoError(t, err, out)
4950
return out
5051
}

tool/ex/error.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func Wrapf(previousErr error, format string, args ...any) error {
128128
}
129129

130130
func New(message string) error {
131-
return wrapOrCreate(nil, message)
131+
return wrapOrCreate(nil, "%s", message)
132132
}
133133

134134
func Newf(format string, args ...any) error {

tool/internal/instrument/instrument_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package instrument
44

55
import (
6-
"context"
76
"encoding/json"
87
"fmt"
98
"log/slog"
@@ -48,7 +47,7 @@ func TestInstrument(t *testing.T) {
4847
logger := slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
4948
Level: slog.LevelDebug,
5049
}))
51-
ctx := util.ContextWithLogger(context.Background(), logger)
50+
ctx := util.ContextWithLogger(t.Context(), logger)
5251
for _, tt := range tests {
5352
t.Run(tt.name, func(t *testing.T) {
5453
tempDir := setupTestEnvironment(t)

tool/internal/instrument/trampoline.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func (ip *InstrumentPhase) materializeTemplate() error {
105105
// Materialize variable declarations
106106
if decl, ok := node.(*dst.GenDecl); ok {
107107
// No further processing for variable declarations, just append them
108-
//nolint:exhaustive // all possible tokens are handled
108+
//nolint:exhaustive
109109
switch decl.Tok {
110110
case token.VAR:
111111
ip.varDecls = append(ip.varDecls, decl)

0 commit comments

Comments
 (0)