Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 7fcd084

Browse files
committed
style: apply gofmt
Signed-off-by: Yves Brissaud <yves.brissaud@docker.com>
1 parent a57b765 commit 7fcd084

22 files changed

Lines changed: 58 additions & 41 deletions

File tree

Taskfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ tasks:
2525

2626
go:fmt:
2727
cmds:
28-
- goimports -w .
28+
- goimports -w -local github.com/atomist-skills,github.com/docker,github.com/docker/index-cli-plugin .
2929
- gofmt -w .
3030
#- go mod tidy
3131

commands/cmd.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@ import (
2424
"os"
2525
"strings"
2626

27+
"github.com/moby/term"
28+
"github.com/pkg/errors"
29+
"github.com/sirupsen/logrus"
30+
"github.com/spf13/cobra"
31+
2732
"github.com/atomist-skills/go-skill"
33+
2834
"github.com/docker/cli/cli"
2935
"github.com/docker/cli/cli-plugins/plugin"
3036
"github.com/docker/cli/cli/command"
3137
"github.com/docker/index-cli-plugin/format"
3238
"github.com/docker/index-cli-plugin/query"
3339
"github.com/docker/index-cli-plugin/sbom"
3440
"github.com/docker/index-cli-plugin/types"
35-
"github.com/moby/term"
36-
"github.com/pkg/errors"
37-
"github.com/sirupsen/logrus"
38-
"github.com/spf13/cobra"
3941
)
4042

4143
func NewRootCmd(name string, isPlugin bool, dockerCli command.Cli) *cobra.Command {
@@ -129,7 +131,7 @@ func NewRootCmd(name string, isPlugin bool, dockerCli command.Cli) *cobra.Comman
129131
return err
130132
}
131133
if output != "" {
132-
_ = os.WriteFile(output, js, 0644)
134+
_ = os.WriteFile(output, js, 0o644)
133135
skill.Log.Infof("SBOM written to %s", output)
134136
} else {
135137
fmt.Println(string(js))

format/cve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func Cves(cve string, cves *[]types.Cve, sb *types.Sbom, remediate bool, dockerC
3535
continue
3636
}
3737

38-
var remediation = make([]string, 0)
38+
remediation := make([]string, 0)
3939
layerIndex := -1
4040
for _, p := range sb.Artifacts {
4141
if p.Purl == c.Purl {

format/format.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ import (
2121
"strconv"
2222
"strings"
2323

24-
"github.com/docker/index-cli-plugin/internal"
25-
"github.com/docker/index-cli-plugin/types"
2624
"github.com/gookit/color"
2725
"github.com/xeonx/timeago"
26+
27+
"github.com/docker/index-cli-plugin/internal"
28+
"github.com/docker/index-cli-plugin/types"
2829
)
2930

3031
type colors struct {

internal/spinner.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ import (
2121
"strings"
2222
"time"
2323

24-
"github.com/atomist-skills/go-skill"
2524
"github.com/briandowns/spinner"
2625
"github.com/gookit/color"
2726
"github.com/sirupsen/logrus"
27+
28+
"github.com/atomist-skills/go-skill"
2829
)
2930

3031
type Fields map[string]interface{}

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"os"
2222

2323
"github.com/atomist-skills/go-skill"
24+
2425
"github.com/docker/cli/cli-plugins/manager"
2526
"github.com/docker/cli/cli-plugins/plugin"
2627
"github.com/docker/cli/cli/command"

query/async.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"sync"
2121

2222
"github.com/atomist-skills/go-skill"
23+
2324
"github.com/docker/index-cli-plugin/types"
2425
)
2526

query/base.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ import (
2626
"sort"
2727
"strings"
2828

29-
"github.com/atomist-skills/go-skill"
30-
"github.com/docker/index-cli-plugin/types"
3129
v1 "github.com/google/go-containerregistry/pkg/v1"
3230
"github.com/hasura/go-graphql-client"
3331
"github.com/opencontainers/go-digest"
3432
"github.com/opencontainers/image-spec/identity"
3533
"github.com/pkg/errors"
3634
"olympos.io/encoding/edn"
35+
36+
"github.com/atomist-skills/go-skill"
37+
38+
"github.com/docker/index-cli-plugin/types"
3739
)
3840

3941
type ImageQueryResult struct {
@@ -117,7 +119,7 @@ func ForBaseImageInIndex(digest digest.Digest, workspace string, apiKey string)
117119
}
118120
repository, err := ForRepositoryInDb(manifestList[0].Name, workspace, apiKey)
119121
if err != nil {
120-
return nil, errors.Wrapf(err, "failed to query for respository")
122+
return nil, errors.Wrapf(err, "failed to query for repository")
121123
}
122124
image := types.Image{
123125
Digest: ii.Digest,
@@ -252,8 +254,8 @@ func ForBaseImageInGraphQL(cfg *v1.ConfigFile) (*types.BaseImagesByDiffIdsQuery,
252254
return nil, errors.Wrapf(err, "failed to run query")
253255
}
254256
count := 0
255-
for ii, _ := range q.ImagesByDiffIds {
256-
for bi, _ := range q.ImagesByDiffIds[ii].Images {
257+
for ii := range q.ImagesByDiffIds {
258+
for bi := range q.ImagesByDiffIds[ii].Images {
257259
count++
258260
q.ImagesByDiffIds[ii].Images[bi].Repository = normalizeRepository(&q.ImagesByDiffIds[ii].Images[bi]).Repository
259261
}

query/query.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ import (
2323
"net/http"
2424
"strings"
2525

26+
"github.com/hasura/go-graphql-client"
27+
2628
"github.com/docker/index-cli-plugin/internal"
2729
"github.com/docker/index-cli-plugin/types"
28-
"github.com/hasura/go-graphql-client"
2930

30-
"github.com/atomist-skills/go-skill"
3131
"github.com/pkg/errors"
3232
"olympos.io/encoding/edn"
33+
34+
"github.com/atomist-skills/go-skill"
3335
)
3436

3537
type CveResult struct {
@@ -101,7 +103,6 @@ func QueryCves(sb *types.Sbom, cve string, workspace string, apiKey string) (*[]
101103
}
102104
})
103105
return &fcves, nil
104-
105106
} else {
106107
return nil, nil
107108
}
@@ -111,7 +112,6 @@ func query(query string, name string, workspace string, apiKey string) (*http.Re
111112
url := fmt.Sprintf("https://api.dso.docker.com/datalog/team/%s/queries", workspace)
112113
if workspace == "" || apiKey == "" {
113114
url = "https://api.dso.docker.com/datalog/shared-vulnerability/queries"
114-
115115
}
116116
query = fmt.Sprintf(`{:queries [{:name "query" :query %s}]}`, query)
117117
skill.Log.Debugf("Query %s", query)

registry/read.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ package registry
1919
import (
2020
stereoscopeimage "github.com/anchore/stereoscope/pkg/image"
2121
"github.com/anchore/syft/syft/source"
22-
"github.com/atomist-skills/go-skill"
2322
"github.com/google/go-containerregistry/pkg/v1/layout"
2423
"github.com/pkg/errors"
24+
25+
"github.com/atomist-skills/go-skill"
2526
)
2627

2728
func ReadImage(name string, path string) (*ImageCache, error) {

0 commit comments

Comments
 (0)