fix go.mod and lint issues

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2025-03-19 11:52:08 +01:00
parent bf95aa3dfa
commit 212d598ab1
No known key found for this signature in database
GPG Key ID: ADE44D8C9D44FBE4
12 changed files with 29 additions and 44 deletions

View File

@ -4,6 +4,7 @@ import (
"context"
"encoding"
"io"
"maps"
"os"
"path"
"path/filepath"
@ -1104,9 +1105,7 @@ func (t *Target) GetEvalContexts(ectx *hcl.EvalContext, block *hcl.Block, loadDe
e2 := ectx.NewChild()
e2.Variables = make(map[string]cty.Value)
if e != ectx {
for k, v := range e.Variables {
e2.Variables[k] = v
}
maps.Copy(e2.Variables, e.Variables)
}
e2.Variables[k] = v
ectxs2 = append(ectxs2, e2)

View File

@ -3,6 +3,7 @@ package bake
import (
"context"
"fmt"
"maps"
"os"
"path/filepath"
"slices"
@ -91,9 +92,7 @@ func ParseCompose(cfgs []composetypes.ConfigFile, envs map[string]string) (*Conf
var additionalContexts map[string]string
if s.Build.AdditionalContexts != nil {
additionalContexts = map[string]string{}
for k, v := range s.Build.AdditionalContexts {
additionalContexts[k] = v
}
maps.Copy(additionalContexts, s.Build.AdditionalContexts)
}
var shmSize *string

View File

@ -8,6 +8,7 @@ import (
"encoding/json"
"fmt"
"io"
"maps"
"os"
"slices"
"strconv"
@ -431,9 +432,7 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opts map[
FrontendInputs: frontendInputs,
FrontendOpt: make(map[string]string),
}
for k, v := range so.FrontendAttrs {
req.FrontendOpt[k] = v
}
maps.Copy(req.FrontendOpt, so.FrontendAttrs)
so.Frontend = ""
so.FrontendInputs = nil

View File

@ -2,6 +2,7 @@ package build
import (
"context"
"maps"
"os"
"path"
"path/filepath"
@ -127,9 +128,7 @@ func getGitAttributes(ctx context.Context, contextPath, dockerfilePath string) (
if so.FrontendAttrs == nil {
so.FrontendAttrs = make(map[string]string)
}
for k, v := range res {
so.FrontendAttrs[k] = v
}
maps.Copy(so.FrontendAttrs, res)
if !setGitInfo || root == "" {
return

View File

@ -5,6 +5,7 @@ import (
"encoding/base64"
"encoding/json"
"io"
"maps"
"strings"
"sync"
@ -40,9 +41,7 @@ func setRecordProvenance(ctx context.Context, c *client.Client, sr *client.Solve
if err != nil {
return err
}
for k, v := range res {
sr.ExporterResponse[k] = v
}
maps.Copy(sr.ExporterResponse, res)
return nil
})
}

View File

@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"maps"
"sort"
"strings"
"time"
@ -409,9 +410,7 @@ func truncPlatforms(pfs []string, max int) truncatedPlatforms {
left[ppf] = append(left[ppf], pf)
}
}
for k, v := range left {
res[k] = v
}
maps.Copy(res, left)
return truncatedPlatforms{
res: res,
input: pfs,

View File

@ -1,6 +1,10 @@
package pb
import "github.com/moby/buildkit/client"
import (
"maps"
"github.com/moby/buildkit/client"
)
func CreateCaches(entries []*CacheOptionsEntry) []client.CacheOptionsEntry {
var outs []client.CacheOptionsEntry
@ -12,9 +16,7 @@ func CreateCaches(entries []*CacheOptionsEntry) []client.CacheOptionsEntry {
Type: entry.Type,
Attrs: map[string]string{},
}
for k, v := range entry.Attrs {
out.Attrs[k] = v
}
maps.Copy(out.Attrs, entry.Attrs)
outs = append(outs, out)
}
return outs

View File

@ -2,6 +2,7 @@ package pb
import (
"io"
"maps"
"os"
"strconv"
@ -26,9 +27,7 @@ func CreateExports(entries []*ExportEntry) ([]client.ExportEntry, []string, erro
Type: entry.Type,
Attrs: map[string]string{},
}
for k, v := range entry.Attrs {
out.Attrs[k] = v
}
maps.Copy(out.Attrs, entry.Attrs)
supportFile := false
supportDir := false

4
go.mod
View File

@ -1,8 +1,6 @@
module github.com/docker/buildx
go 1.23
toolchain go1.23.7
go 1.23.0
require (
github.com/Masterminds/semver/v3 v3.2.1

View File

@ -2,6 +2,7 @@ package store
import (
"fmt"
"maps"
"slices"
"time"
@ -93,9 +94,7 @@ func (ng *NodeGroup) Update(name, endpoint string, platforms []string, endpoints
needsRestart = true
}
if buildkitdConfigFile != "" {
for k, v := range files {
n.Files[k] = v
}
maps.Copy(n.Files, files)
needsRestart = true
}
if needsRestart {
@ -147,9 +146,7 @@ func (n *Node) Copy() *Node {
buildkitdFlags := []string{}
copy(buildkitdFlags, n.BuildkitdFlags)
driverOpts := map[string]string{}
for k, v := range n.DriverOpts {
driverOpts[k] = v
}
maps.Copy(driverOpts, n.DriverOpts)
files := map[string][]byte{}
for k, v := range n.Files {
vv := []byte{}

View File

@ -107,9 +107,7 @@ func (r *Resolver) Combine(ctx context.Context, srcs []*Source, ann map[exptypes
if old.Annotations == nil {
old.Annotations = map[string]string{}
}
for k, v := range d.Annotations {
old.Annotations[k] = v
}
maps.Copy(old.Annotations, d.Annotations)
newDescs[idx] = old
} else {
m[d.Digest] = len(newDescs)

View File

@ -6,6 +6,7 @@ import (
"context"
"encoding/base64"
"encoding/json"
"maps"
"regexp"
"sort"
"strings"
@ -126,13 +127,9 @@ func (l *loader) Load(ctx context.Context, ref string) (*result, error) {
}
var a asset
annotations := make(map[string]string, len(mfst.manifest.Annotations)+len(mfst.desc.Annotations))
for k, v := range mfst.desc.Annotations {
annotations[k] = v
}
for k, v := range mfst.manifest.Annotations {
annotations[k] = v
}
annotations := map[string]string{}
maps.Copy(annotations, mfst.desc.Annotations)
maps.Copy(annotations, mfst.manifest.Annotations)
if err := l.scanConfig(ctx, fetcher, mfst.manifest.Config, &a); err != nil {
return nil, err