Skip to content

Commit d51d237

Browse files
committed
enable gofumpt formatter
Based on our discussion gofumpt won the vote so use that one via golangci-lint. #27291 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
1 parent 2555b8b commit d51d237

File tree

388 files changed

+1226
-1599
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

388 files changed

+1226
-1599
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ run:
44

55
formatters:
66
enable:
7-
- gofmt
7+
- gofumpt
88
- goimports
99
exclusions:
1010
generated: disable

cmd/podman-mac-helper/install.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919
)
2020

2121
const (
22-
mode755 = 0755
23-
mode644 = 0644
22+
mode755 = 0o755
23+
mode644 = 0o644
2424
)
2525

2626
const launchConfig = `<?xml version="1.0" encoding="UTF-8"?>

cmd/podman-testing/store_unsupported.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import (
66
"github.com/containers/podman/v6/pkg/domain/entities"
77
)
88

9-
var (
10-
engineMode = entities.TunnelMode
11-
)
9+
var engineMode = entities.TunnelMode
1210

1311
func storeBefore() error {
1412
return nil

cmd/podman-wslkerninst/main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ func setupLogging(name string) (*eventlog.Log, error) {
4343

4444
func installWslKernel() error {
4545
logrus.Info("Installing WSL Kernel update")
46-
var (
47-
err error
48-
)
46+
var err error
4947
backoff := 500 * time.Millisecond
5048
for i := 1; i < 6; i++ {
5149
err = wutil.SilentExec("--update")

cmd/podman/artifact/add.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,17 @@ import (
1212
"go.podman.io/common/pkg/completion"
1313
)
1414

15-
var (
16-
addCmd = &cobra.Command{
17-
Use: "add [options] ARTIFACT PATH [...PATH]",
18-
Short: "Add an OCI artifact to the local store",
19-
Long: "Add an OCI artifact to the local store from the local filesystem",
20-
RunE: add,
21-
Args: cobra.MinimumNArgs(2),
22-
ValidArgsFunction: common.AutocompleteArtifactAdd,
23-
Example: `podman artifact add quay.io/myimage/myartifact:latest /tmp/foobar.txt
15+
var addCmd = &cobra.Command{
16+
Use: "add [options] ARTIFACT PATH [...PATH]",
17+
Short: "Add an OCI artifact to the local store",
18+
Long: "Add an OCI artifact to the local store from the local filesystem",
19+
RunE: add,
20+
Args: cobra.MinimumNArgs(2),
21+
ValidArgsFunction: common.AutocompleteArtifactAdd,
22+
Example: `podman artifact add quay.io/myimage/myartifact:latest /tmp/foobar.txt
2423
podman artifact add --file-type text/yaml quay.io/myimage/myartifact:latest /tmp/foobar.yaml
2524
podman artifact add --append quay.io/myimage/myartifact:latest /tmp/foobar.tar.gz`,
26-
}
27-
)
25+
}
2826

2927
// AddOptionsWrapper wraps entities.ArtifactsAddOptions and prevents leaking
3028
// CLI-only fields into the API types.

cmd/podman/artifact/extract.go

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,18 @@ import (
88
"go.podman.io/common/pkg/completion"
99
)
1010

11-
var (
12-
extractCmd = &cobra.Command{
13-
Use: "extract [options] ARTIFACT PATH",
14-
Short: "Extract an OCI artifact to a local path",
15-
Long: "Extract the blobs of an OCI artifact to a local file or directory",
16-
RunE: extract,
17-
Args: cobra.ExactArgs(2),
18-
ValidArgsFunction: common.AutocompleteArtifactAdd,
19-
Example: `podman artifact Extract quay.io/myimage/myartifact:latest /tmp/foobar.txt
11+
var extractCmd = &cobra.Command{
12+
Use: "extract [options] ARTIFACT PATH",
13+
Short: "Extract an OCI artifact to a local path",
14+
Long: "Extract the blobs of an OCI artifact to a local file or directory",
15+
RunE: extract,
16+
Args: cobra.ExactArgs(2),
17+
ValidArgsFunction: common.AutocompleteArtifactAdd,
18+
Example: `podman artifact Extract quay.io/myimage/myartifact:latest /tmp/foobar.txt
2019
podman artifact Extract quay.io/myimage/myartifact:latest /home/paul/mydir`,
21-
}
22-
)
20+
}
2321

24-
var (
25-
extractOpts entities.ArtifactExtractOptions
26-
)
22+
var extractOpts entities.ArtifactExtractOptions
2723

2824
func init() {
2925
registry.Commands = append(registry.Commands, registry.CliCommand{

cmd/podman/artifact/list.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ func (a artifactListOutput) CreatedAt() string {
6363
return a.created.String()
6464
}
6565

66-
var (
67-
defaultArtifactListOutputFormat = "{{range .}}{{.Repository}}\t{{.Tag}}\t{{.Digest}}\t{{.Created}}\t{{.Size}}\n{{end -}}"
68-
)
66+
var defaultArtifactListOutputFormat = "{{range .}}{{.Repository}}\t{{.Tag}}\t{{.Digest}}\t{{.Created}}\t{{.Size}}\n{{end -}}"
6967

7068
func init() {
7169
registry.Commands = append(registry.Commands, registry.CliCommand{
@@ -93,9 +91,7 @@ func outputTemplate(cmd *cobra.Command, lrs []*entities.ArtifactListReport) erro
9391
var err error
9492
artifacts := make([]artifactListOutput, 0)
9593
for _, lr := range lrs {
96-
var (
97-
tag string
98-
)
94+
var tag string
9995
artifactName, err := lr.Artifact.GetName()
10096
if err != nil {
10197
return err

cmd/podman/artifact/rm.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func rmFlags(cmd *cobra.Command) {
3535
flags.BoolVarP(&rmOptions.All, "all", "a", false, "Remove all artifacts")
3636
flags.BoolVarP(&rmOptions.Ignore, "ignore", "i", false, "Ignore error if artifact does not exist")
3737
}
38+
3839
func init() {
3940
registry.Commands = append(registry.Commands, registry.CliCommand{
4041
Command: rmCmd,

cmd/podman/common/build.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ type BuildFlagsWrapper struct {
5252

5353
// FarmBuildHiddenFlags are the flags hidden from the farm build command because they are either not
5454
// supported or don't make sense in the farm build use case
55-
var FarmBuildHiddenFlags = []string{"arch", "all-platforms", "compress", "cw", "disable-content-trust",
55+
var FarmBuildHiddenFlags = []string{
56+
"arch", "all-platforms", "compress", "cw", "disable-content-trust",
5657
"logsplit", "manifest", "os", "output", "platform", "sign-by", "signature-policy", "stdin",
57-
"variant"}
58+
"variant",
59+
}
5860

5961
func DefineBuildFlags(cmd *cobra.Command, buildOpts *BuildFlagsWrapper, isFarmBuild bool) {
6062
flags := cmd.Flags()

cmd/podman/common/completion.go

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,8 +1186,10 @@ func AutocompletePullOption(_ *cobra.Command, _ []string, _ string) ([]string, c
11861186
// AutocompleteRestartOption - Autocomplete restart options for create and run command.
11871187
// -> "always", "no", "on-failure", "unless-stopped"
11881188
func AutocompleteRestartOption(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
1189-
restartOptions := []string{define.RestartPolicyAlways, define.RestartPolicyNo,
1190-
define.RestartPolicyOnFailure, define.RestartPolicyUnlessStopped}
1189+
restartOptions := []string{
1190+
define.RestartPolicyAlways, define.RestartPolicyNo,
1191+
define.RestartPolicyOnFailure, define.RestartPolicyUnlessStopped,
1192+
}
11911193
return restartOptions, cobra.ShellCompDirectiveNoFileComp
11921194
}
11931195

@@ -1595,7 +1597,8 @@ func getMethodNames(f reflect.Value, prefix string) []formatSuggestion {
15951597
// -> "container=", "event=", "image=", "pod=", "volume=", "type="
15961598
func AutocompleteEventFilter(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
15971599
event := func(_ string) ([]string, cobra.ShellCompDirective) {
1598-
return []string{events.Attach.String(), events.AutoUpdate.String(), events.Checkpoint.String(), events.Cleanup.String(),
1600+
return []string{
1601+
events.Attach.String(), events.AutoUpdate.String(), events.Checkpoint.String(), events.Cleanup.String(),
15991602
events.Commit.String(), events.Create.String(), events.Exec.String(), events.ExecDied.String(),
16001603
events.Exited.String(), events.Export.String(), events.Import.String(), events.Init.String(), events.Kill.String(),
16011604
events.LoadFromArchive.String(), events.Mount.String(), events.NetworkConnect.String(),
@@ -1607,7 +1610,8 @@ func AutocompleteEventFilter(cmd *cobra.Command, _ []string, toComplete string)
16071610
}, cobra.ShellCompDirectiveNoFileComp
16081611
}
16091612
eventTypes := func(_ string) ([]string, cobra.ShellCompDirective) {
1610-
return []string{events.Container.String(), events.Image.String(), events.Network.String(),
1613+
return []string{
1614+
events.Container.String(), events.Image.String(), events.Network.String(),
16111615
events.Pod.String(), events.System.String(), events.Volume.String(), events.Secret.String(),
16121616
}, cobra.ShellCompDirectiveNoFileComp
16131617
}
@@ -1710,9 +1714,11 @@ func AutocompleteImageSaveFormat(_ *cobra.Command, _ []string, _ string) ([]stri
17101714
// AutocompleteWaitCondition - Autocomplete wait condition options.
17111715
// -> "unknown", "configured", "created", "running", "stopped", "paused", "exited", "removing"
17121716
func AutocompleteWaitCondition(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
1713-
states := []string{"unknown", "configured", "created", "exited",
1717+
states := []string{
1718+
"unknown", "configured", "created", "exited",
17141719
"healthy", "initialized", "paused", "removing", "running",
1715-
"stopped", "stopping", "unhealthy"}
1720+
"stopped", "stopping", "unhealthy",
1721+
}
17161722
return states, cobra.ShellCompDirectiveNoFileComp
17171723
}
17181724

@@ -1792,8 +1798,10 @@ func AutocompletePsFilters(cmd *cobra.Command, _ []string, toComplete string) ([
17921798
"command=": func(s string) ([]string, cobra.ShellCompDirective) { return getCommands(cmd, s) },
17931799
"exited=": nil,
17941800
"health=": func(_ string) ([]string, cobra.ShellCompDirective) {
1795-
return []string{define.HealthCheckHealthy,
1796-
define.HealthCheckUnhealthy}, cobra.ShellCompDirectiveNoFileComp
1801+
return []string{
1802+
define.HealthCheckHealthy,
1803+
define.HealthCheckUnhealthy,
1804+
}, cobra.ShellCompDirectiveNoFileComp
17971805
},
17981806
"id=": func(s string) ([]string, cobra.ShellCompDirective) { return getContainers(cmd, s, completeIDs) },
17991807
"label=": nil,
@@ -1832,8 +1840,10 @@ func AutocompletePodPsFilters(cmd *cobra.Command, _ []string, toComplete string)
18321840
"name=": func(s string) ([]string, cobra.ShellCompDirective) { return getPods(cmd, s, completeNames) },
18331841
"network=": func(s string) ([]string, cobra.ShellCompDirective) { return getNetworks(cmd, s, completeDefault) },
18341842
"status=": func(_ string) ([]string, cobra.ShellCompDirective) {
1835-
return []string{"stopped", "running",
1836-
"paused", "exited", "dead", "created", "degraded"}, cobra.ShellCompDirectiveNoFileComp
1843+
return []string{
1844+
"stopped", "running",
1845+
"paused", "exited", "dead", "created", "degraded",
1846+
}, cobra.ShellCompDirectiveNoFileComp
18371847
},
18381848
"until=": nil,
18391849
}
@@ -2002,7 +2012,6 @@ func AutocompleteSysctl(_ *cobra.Command, _ []string, toComplete string) ([]stri
20022012

20032013
return nil
20042014
})
2005-
20062015
if err != nil {
20072016
return nil, cobra.ShellCompDirectiveError
20082017
}

0 commit comments

Comments
 (0)