Skip to content

Commit 3f0aec1

Browse files
authored
Merge pull request #3182 from crazy-max/go-1.24
update to go 1.24
2 parents 03f9877 + 1383aa3 commit 3f0aec1

35 files changed

+26
-62
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ env:
3636
TEST_CACHE_SCOPE: "test"
3737
TESTFLAGS: "-v --parallel=6 --timeout=30m"
3838
GOTESTSUM_FORMAT: "standard-verbose"
39-
GO_VERSION: "1.23"
40-
GOTESTSUM_VERSION: "v1.9.0" # same as one in Dockerfile
39+
GO_VERSION: "1.24"
40+
GOTESTSUM_VERSION: "v1.12.0" # same as one in Dockerfile
4141

4242
jobs:
4343
test-integration:

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
pull_request:
1818

1919
env:
20-
GO_VERSION: "1.23"
20+
GO_VERSION: "1.24"
2121

2222
jobs:
2323
codeql:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
ARG GO_VERSION=1.23
3+
ARG GO_VERSION=1.24
44
ARG ALPINE_VERSION=3.21
55
ARG XX_VERSION=1.6.1
66

bake/bake.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,7 @@ func (c Config) expandTargets(pattern string) ([]string, error) {
483483
func (c Config) loadLinks(name string, t *Target, m map[string]*Target, o map[string]map[string]Override, visited []string, ent *EntitlementConf) error {
484484
visited = append(visited, name)
485485
for _, v := range t.Contexts {
486-
if strings.HasPrefix(v, "target:") {
487-
target := strings.TrimPrefix(v, "target:")
486+
if target, ok := strings.CutPrefix(v, "target:"); ok {
488487
if target == name {
489488
return errors.Errorf("target %s cannot link to itself", target)
490489
}
@@ -1275,8 +1274,8 @@ func collectLocalPaths(t build.Inputs) []string {
12751274
if v, ok := isLocalPath(t.DockerfilePath); ok {
12761275
out = append(out, v)
12771276
}
1278-
} else if strings.HasPrefix(t.ContextPath, "cwd://") {
1279-
out = append(out, strings.TrimPrefix(t.ContextPath, "cwd://"))
1277+
} else if v, ok := strings.CutPrefix(t.ContextPath, "cwd://"); ok {
1278+
out = append(out, v)
12801279
}
12811280
for _, v := range t.NamedContexts {
12821281
if v.State != nil {
@@ -1328,11 +1327,11 @@ func toBuildOpt(t *Target, inp *Input) (*build.Options, error) {
13281327
bi.DockerfileInline = *t.DockerfileInline
13291328
}
13301329
updateContext(&bi, inp)
1331-
if strings.HasPrefix(bi.DockerfilePath, "cwd://") {
1330+
if v, ok := strings.CutPrefix(bi.DockerfilePath, "cwd://"); ok {
13321331
// If Dockerfile is local for a remote invocation, we first check if
13331332
// it's not outside the working directory and then resolve it to an
13341333
// absolute path.
1335-
bi.DockerfilePath = path.Clean(strings.TrimPrefix(bi.DockerfilePath, "cwd://"))
1334+
bi.DockerfilePath = path.Clean(v)
13361335
var err error
13371336
bi.DockerfilePath, err = filepath.Abs(bi.DockerfilePath)
13381337
if err != nil {
@@ -1357,15 +1356,15 @@ func toBuildOpt(t *Target, inp *Input) (*build.Options, error) {
13571356
return nil, errors.Errorf("reading a dockerfile for a remote build invocation is currently not supported")
13581357
}
13591358
}
1360-
if strings.HasPrefix(bi.ContextPath, "cwd://") {
1361-
bi.ContextPath = path.Clean(strings.TrimPrefix(bi.ContextPath, "cwd://"))
1359+
if v, ok := strings.CutPrefix(bi.ContextPath, "cwd://"); ok {
1360+
bi.ContextPath = path.Clean(v)
13621361
}
13631362
if !build.IsRemoteURL(bi.ContextPath) && bi.ContextState == nil && !filepath.IsAbs(bi.DockerfilePath) {
13641363
bi.DockerfilePath = filepath.Join(bi.ContextPath, bi.DockerfilePath)
13651364
}
13661365
for k, v := range bi.NamedContexts {
1367-
if strings.HasPrefix(v.Path, "cwd://") {
1368-
bi.NamedContexts[k] = build.NamedContext{Path: path.Clean(strings.TrimPrefix(v.Path, "cwd://"))}
1366+
if v, ok := strings.CutPrefix(v.Path, "cwd://"); ok {
1367+
bi.NamedContexts[k] = build.NamedContext{Path: path.Clean(v)}
13691368
}
13701369
}
13711370

bake/bake_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,6 @@ target "d" {
13811381
},
13821382
}
13831383
for _, tt := range cases {
1384-
tt := tt
13851384
t.Run(tt.name, func(t *testing.T) {
13861385
m, g, err := ReadTargets(ctx, []File{f}, []string{"d"}, tt.overrides, nil, &EntitlementConf{})
13871386
require.NoError(t, err)
@@ -1454,7 +1453,6 @@ group "default" {
14541453
},
14551454
}
14561455
for _, tt := range cases {
1457-
tt := tt
14581456
t.Run(tt.name, func(t *testing.T) {
14591457
m, g, err := ReadTargets(ctx, []File{f}, []string{"default"}, tt.overrides, nil, &EntitlementConf{})
14601458
require.NoError(t, err)
@@ -1509,7 +1507,6 @@ func TestTargetName(t *testing.T) {
15091507
},
15101508
}
15111509
for _, tt := range cases {
1512-
tt := tt
15131510
t.Run(tt.target, func(t *testing.T) {
15141511
_, _, err := ReadTargets(ctx, []File{{
15151512
Name: "docker-bake.hcl",
@@ -1600,7 +1597,6 @@ target "f" {
16001597
},
16011598
}
16021599
for _, tt := range cases {
1603-
tt := tt
16041600
t.Run(strings.Join(tt.names, "+"), func(t *testing.T) {
16051601
m, g, err := ReadTargets(ctx, []File{f}, tt.names, nil, nil, &EntitlementConf{})
16061602
require.NoError(t, err)

bake/compose.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ func ParseCompose(cfgs []composetypes.ConfigFile, envs map[string]string) (*Conf
6262
g := &Group{Name: "default"}
6363

6464
for _, s := range cfg.Services {
65-
s := s
6665
if s.Build == nil {
6766
continue
6867
}
@@ -144,7 +143,6 @@ func ParseCompose(cfgs []composetypes.ConfigFile, envs map[string]string) (*Conf
144143
// compose does not support nil values for labels
145144
labels := map[string]*string{}
146145
for k, v := range s.Build.Labels {
147-
v := v
148146
labels[k] = &v
149147
}
150148

bake/compose_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,6 @@ func TestServiceName(t *testing.T) {
518518
},
519519
}
520520
for _, tt := range cases {
521-
tt := tt
522521
t.Run(tt.svc, func(t *testing.T) {
523522
_, err := ParseCompose([]composetypes.ConfigFile{{Content: []byte(`
524523
services:
@@ -589,7 +588,6 @@ services:
589588
},
590589
}
591590
for _, tt := range cases {
592-
tt := tt
593591
t.Run(tt.name, func(t *testing.T) {
594592
_, err := ParseCompose([]composetypes.ConfigFile{{Content: tt.dt}}, nil)
595593
if tt.wantErr {
@@ -665,7 +663,6 @@ target "default" {
665663
},
666664
}
667665
for _, tt := range cases {
668-
tt := tt
669666
t.Run(tt.name, func(t *testing.T) {
670667
isCompose, err := validateComposeFile(tt.dt, tt.fn)
671668
assert.Equal(t, tt.isCompose, isCompose)

bake/hclparser/hclparser.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,6 @@ func Parse(b hcl.Body, opt Opt, val any) (*ParseMeta, hcl.Diagnostics) {
781781
}
782782

783783
for _, a := range content.Attributes {
784-
a := a
785784
return nil, hcl.Diagnostics{
786785
&hcl.Diagnostic{
787786
Severity: hcl.DiagError,
@@ -834,7 +833,6 @@ func Parse(b hcl.Body, opt Opt, val any) (*ParseMeta, hcl.Diagnostics) {
834833
context = subject
835834
} else {
836835
for _, block := range blocks.Blocks {
837-
block := block
838836
if block.Type == "function" && len(block.Labels) == 1 && block.Labels[0] == k {
839837
subject = block.LabelRanges[0].Ptr()
840838
context = block.DefRange.Ptr()
@@ -903,7 +901,6 @@ func Parse(b hcl.Body, opt Opt, val any) (*ParseMeta, hcl.Diagnostics) {
903901

904902
diags = hcl.Diagnostics{}
905903
for _, b := range content.Blocks {
906-
b := b
907904
v := reflect.ValueOf(val)
908905

909906
err := p.resolveBlock(b, nil)

build/build.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opts map[
383383
wg.Add(1)
384384
sharedSessionsWG[node.Name] = wg
385385
for _, s := range sessions {
386-
s := s
387386
eg.Go(func() error {
388387
return s.Run(baseCtx, c.Dialer())
389388
})

build/git_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ func TestGetGitAttributes(t *testing.T) {
109109
},
110110
}
111111
for _, tt := range cases {
112-
tt := tt
113112
t.Run(tt.name, func(t *testing.T) {
114113
setupTest(t)
115114
if tt.envGitLabels != "" {

0 commit comments

Comments
 (0)