mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-24 12:18:06 +08:00
lint: apply x/tools/modernize fixes
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
@@ -156,7 +156,7 @@ func (r *Resolver) Combine(ctx context.Context, srcs []*Source, ann map[exptypes
|
||||
case exptypes.AnnotationIndex:
|
||||
indexAnnotation[k.Key] = v
|
||||
case exptypes.AnnotationManifestDescriptor:
|
||||
for i := 0; i < len(newDescs); i++ {
|
||||
for i := range newDescs {
|
||||
if newDescs[i].Annotations == nil {
|
||||
newDescs[i].Annotations = map[string]string{}
|
||||
}
|
||||
|
@@ -278,8 +278,8 @@ func (l *loader) scanConfig(ctx context.Context, fetcher remotes.Fetcher, desc o
|
||||
}
|
||||
|
||||
type sbomStub struct {
|
||||
SPDX interface{} `json:",omitempty"`
|
||||
AdditionalSPDXs []interface{} `json:",omitempty"`
|
||||
SPDX any `json:",omitempty"`
|
||||
AdditionalSPDXs []any `json:",omitempty"`
|
||||
}
|
||||
|
||||
func (l *loader) scanSBOM(ctx context.Context, fetcher remotes.Fetcher, r *result, refs []digest.Digest, as *asset) error {
|
||||
@@ -309,7 +309,7 @@ func (l *loader) scanSBOM(ctx context.Context, fetcher remotes.Fetcher, r *resul
|
||||
}
|
||||
|
||||
var spdx struct {
|
||||
Predicate interface{} `json:"predicate"`
|
||||
Predicate any `json:"predicate"`
|
||||
}
|
||||
if err := json.Unmarshal(dt, &spdx); err != nil {
|
||||
return nil, err
|
||||
@@ -330,7 +330,7 @@ func (l *loader) scanSBOM(ctx context.Context, fetcher remotes.Fetcher, r *resul
|
||||
}
|
||||
|
||||
type provenanceStub struct {
|
||||
SLSA interface{} `json:",omitempty"`
|
||||
SLSA any `json:",omitempty"`
|
||||
}
|
||||
|
||||
func (l *loader) scanProvenance(ctx context.Context, fetcher remotes.Fetcher, r *result, refs []digest.Digest, as *asset) error {
|
||||
@@ -360,7 +360,7 @@ func (l *loader) scanProvenance(ctx context.Context, fetcher remotes.Fetcher, r
|
||||
}
|
||||
|
||||
var slsa struct {
|
||||
Predicate interface{} `json:"predicate"`
|
||||
Predicate any `json:"predicate"`
|
||||
}
|
||||
if err := json.Unmarshal(dt, &slsa); err != nil {
|
||||
return nil, err
|
||||
|
@@ -89,7 +89,7 @@ func (p *Printer) Print(raw bool, out io.Writer) error {
|
||||
}
|
||||
|
||||
tpl, err := template.New("").Funcs(template.FuncMap{
|
||||
"json": func(v interface{}) string {
|
||||
"json": func(v any) string {
|
||||
b, _ := json.MarshalIndent(v, "", " ")
|
||||
return string(b)
|
||||
},
|
||||
@@ -101,7 +101,7 @@ func (p *Printer) Print(raw bool, out io.Writer) error {
|
||||
imageconfigs := res.Configs()
|
||||
format := tpl.Root.String()
|
||||
|
||||
var mfst interface{}
|
||||
var mfst any
|
||||
switch p.manifest.MediaType {
|
||||
case images.MediaTypeDockerSchema2Manifest, ocispecs.MediaTypeImageManifest:
|
||||
mfst = p.manifest
|
||||
@@ -206,7 +206,7 @@ func (p *Printer) printManifestList(out io.Writer) error {
|
||||
|
||||
type tplInput struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Manifest interface{} `json:"manifest,omitempty"`
|
||||
Manifest any `json:"manifest,omitempty"`
|
||||
Image *ocispecs.Image `json:"image,omitempty"`
|
||||
|
||||
result *result
|
||||
@@ -236,7 +236,7 @@ func (inp tplInput) Provenance() (provenanceStub, error) {
|
||||
|
||||
type tplInputs struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Manifest interface{} `json:"manifest,omitempty"`
|
||||
Manifest any `json:"manifest,omitempty"`
|
||||
Image map[string]*ocispecs.Image `json:"image,omitempty"`
|
||||
|
||||
result *result
|
||||
|
Reference in New Issue
Block a user