From 4bb43b898d72cb938d317055e4ade2771cfc9c54 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 9 Jun 2020 16:47:30 -0400 Subject: Fixup issues found by golint Signed-off-by: Daniel J Walsh --- pkg/domain/entities/engine.go | 4 ++-- pkg/domain/entities/images.go | 2 +- pkg/domain/infra/abi/containers.go | 4 ++-- pkg/domain/infra/abi/parse/parse.go | 2 +- pkg/domain/infra/abi/play.go | 2 +- pkg/domain/infra/abi/system.go | 8 ++++---- pkg/domain/infra/abi/trust.go | 8 ++++---- pkg/domain/infra/abi/volumes.go | 2 +- pkg/domain/infra/runtime_abi.go | 4 ++-- pkg/domain/infra/runtime_tunnel.go | 4 ++-- pkg/domain/infra/tunnel/containers.go | 2 +- pkg/domain/infra/tunnel/generate.go | 2 +- pkg/domain/infra/tunnel/play.go | 2 +- pkg/domain/infra/tunnel/pods.go | 2 +- pkg/domain/utils/utils.go | 2 +- 15 files changed, 25 insertions(+), 25 deletions(-) (limited to 'pkg/domain') diff --git a/pkg/domain/entities/engine.go b/pkg/domain/entities/engine.go index b2bef0eea..1f056bad7 100644 --- a/pkg/domain/entities/engine.go +++ b/pkg/domain/entities/engine.go @@ -39,7 +39,7 @@ type PodmanConfig struct { CGroupUsage string // rootless code determines Usage message ConmonPath string // --conmon flag will set Engine.ConmonPath - CpuProfile string // Hidden: Should CPU profile be taken + CPUProfile string // Hidden: Should CPU profile be taken EngineMode EngineMode // ABI or Tunneling mode Identities []string // ssh identities for connecting to server MaxWorks int // maximum number of parallel threads @@ -52,7 +52,7 @@ type PodmanConfig struct { SpanCtx context.Context // context to use when tracing Syslog bool // write to StdOut and Syslog, not supported when tunneling Trace bool // Hidden: Trace execution - Uri string // URI to RESTful API Service + URI string // URI to RESTful API Service Runroot string StorageDriver string diff --git a/pkg/domain/entities/images.go b/pkg/domain/entities/images.go index 19a2c87f5..5bb110b57 100644 --- a/pkg/domain/entities/images.go +++ b/pkg/domain/entities/images.go @@ -299,7 +299,7 @@ type ShowTrustReport struct { Raw []byte SystemRegistriesDirPath string JSONOutput []byte - Policies []*trust.TrustPolicy + Policies []*trust.Policy } // SetTrustOptions describes the CLI options for setting trust diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index 043fcfe7e..f8897b41e 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -162,7 +162,7 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin if err != nil && !(options.Ignore && errors.Cause(err) == define.ErrNoSuchCtr) { return nil, err } - errMap, err := parallel.ParallelContainerOp(ctx, ctrs, func(c *libpod.Container) error { + errMap, err := parallel.ContainerOp(ctx, ctrs, func(c *libpod.Container) error { var err error if options.Timeout != nil { err = c.StopWithTimeout(*options.Timeout) @@ -323,7 +323,7 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string, return reports, nil } - errMap, err := parallel.ParallelContainerOp(ctx, ctrs, func(c *libpod.Container) error { + errMap, err := parallel.ContainerOp(ctx, ctrs, func(c *libpod.Container) error { err := ic.Libpod.RemoveContainer(ctx, c, options.Force, options.Volumes) if err != nil { if options.Ignore && errors.Cause(err) == define.ErrNoSuchCtr { diff --git a/pkg/domain/infra/abi/parse/parse.go b/pkg/domain/infra/abi/parse/parse.go index 6c0e1ee55..2320c6a32 100644 --- a/pkg/domain/infra/abi/parse/parse.go +++ b/pkg/domain/infra/abi/parse/parse.go @@ -12,7 +12,7 @@ import ( // Handle volume options from CLI. // Parse "o" option to find UID, GID. -func ParseVolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error) { +func VolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error) { libpodOptions := []libpod.VolumeCreateOption{} volumeOptions := make(map[string]string) diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go index 6d0919d2b..932974aba 100644 --- a/pkg/domain/infra/abi/play.go +++ b/pkg/domain/infra/abi/play.go @@ -243,7 +243,7 @@ func (ic *ContainerEngine) PlayKube(ctx context.Context, path string, options en if err != nil { return nil, err } - ctr, err := createconfig.CreateContainerFromCreateConfig(ic.Libpod, conf, ctx, pod) + ctr, err := createconfig.CreateContainerFromCreateConfig(ctx, ic.Libpod, conf, pod) if err != nil { return nil, err } diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go index 9b538b301..b91dd513d 100644 --- a/pkg/domain/infra/abi/system.go +++ b/pkg/domain/infra/abi/system.go @@ -338,7 +338,7 @@ func (ic *ContainerEngine) SystemDf(ctx context.Context, options entities.System } for _, viu := range inUse { if util.StringInSlice(viu, runningContainers) { - consInUse += 1 + consInUse++ } } report := entities.SystemDfVolumeReport{ @@ -376,12 +376,12 @@ func (se *SystemEngine) Renumber(ctx context.Context, flags *pflag.FlagSet, conf return nil } -func (s SystemEngine) Migrate(ctx context.Context, flags *pflag.FlagSet, config *entities.PodmanConfig, options entities.SystemMigrateOptions) error { +func (se SystemEngine) Migrate(ctx context.Context, flags *pflag.FlagSet, config *entities.PodmanConfig, options entities.SystemMigrateOptions) error { return nil } -func (s SystemEngine) Shutdown(ctx context.Context) { - if err := s.Libpod.Shutdown(false); err != nil { +func (se SystemEngine) Shutdown(ctx context.Context) { + if err := se.Libpod.Shutdown(false); err != nil { logrus.Error(err) } } diff --git a/pkg/domain/infra/abi/trust.go b/pkg/domain/infra/abi/trust.go index 5b89c91d9..03986ad0e 100644 --- a/pkg/domain/infra/abi/trust.go +++ b/pkg/domain/infra/abi/trust.go @@ -112,8 +112,8 @@ func (ir *ImageEngine) SetTrust(ctx context.Context, args []string, options enti return ioutil.WriteFile(policyPath, data, 0644) } -func getPolicyShowOutput(policyContentStruct trust.PolicyContent, systemRegistriesDirPath string) ([]*trust.TrustPolicy, error) { - var output []*trust.TrustPolicy +func getPolicyShowOutput(policyContentStruct trust.PolicyContent, systemRegistriesDirPath string) ([]*trust.Policy, error) { + var output []*trust.Policy registryConfigs, err := trust.LoadAndMergeConfig(systemRegistriesDirPath) if err != nil { @@ -121,7 +121,7 @@ func getPolicyShowOutput(policyContentStruct trust.PolicyContent, systemRegistri } if len(policyContentStruct.Default) > 0 { - defaultPolicyStruct := trust.TrustPolicy{ + defaultPolicyStruct := trust.Policy{ Name: "* (default)", RepoName: "default", Type: trustTypeDescription(policyContentStruct.Default[0].Type), @@ -130,7 +130,7 @@ func getPolicyShowOutput(policyContentStruct trust.PolicyContent, systemRegistri } for _, transval := range policyContentStruct.Transports { for repo, repoval := range transval { - tempTrustShowOutput := trust.TrustPolicy{ + tempTrustShowOutput := trust.Policy{ Name: repo, RepoName: repo, Type: repoval[0].Type, diff --git a/pkg/domain/infra/abi/volumes.go b/pkg/domain/infra/abi/volumes.go index 91b2440df..2c9d31a23 100644 --- a/pkg/domain/infra/abi/volumes.go +++ b/pkg/domain/infra/abi/volumes.go @@ -24,7 +24,7 @@ func (ic *ContainerEngine) VolumeCreate(ctx context.Context, opts entities.Volum volumeOptions = append(volumeOptions, libpod.WithVolumeLabels(opts.Label)) } if len(opts.Options) > 0 { - parsedOptions, err := parse.ParseVolumeOptions(opts.Options) + parsedOptions, err := parse.VolumeOptions(opts.Options) if err != nil { return nil, err } diff --git a/pkg/domain/infra/runtime_abi.go b/pkg/domain/infra/runtime_abi.go index 0a82b9a6b..60d0c6e86 100644 --- a/pkg/domain/infra/runtime_abi.go +++ b/pkg/domain/infra/runtime_abi.go @@ -20,7 +20,7 @@ func NewContainerEngine(facts *entities.PodmanConfig) (entities.ContainerEngine, r, err := NewLibpodRuntime(facts.FlagSet, facts) return r, err case entities.TunnelMode: - ctx, err := bindings.NewConnectionWithIdentity(context.Background(), facts.Uri, facts.PassPhrase, facts.Identities...) + ctx, err := bindings.NewConnectionWithIdentity(context.Background(), facts.URI, facts.PassPhrase, facts.Identities...) return &tunnel.ContainerEngine{ClientCxt: ctx}, err } return nil, fmt.Errorf("runtime mode '%v' is not supported", facts.EngineMode) @@ -33,7 +33,7 @@ func NewImageEngine(facts *entities.PodmanConfig) (entities.ImageEngine, error) r, err := NewLibpodImageRuntime(facts.FlagSet, facts) return r, err case entities.TunnelMode: - ctx, err := bindings.NewConnectionWithIdentity(context.Background(), facts.Uri, facts.PassPhrase, facts.Identities...) + ctx, err := bindings.NewConnectionWithIdentity(context.Background(), facts.URI, facts.PassPhrase, facts.Identities...) return &tunnel.ImageEngine{ClientCxt: ctx}, err } return nil, fmt.Errorf("runtime mode '%v' is not supported", facts.EngineMode) diff --git a/pkg/domain/infra/runtime_tunnel.go b/pkg/domain/infra/runtime_tunnel.go index bba7d2c0c..24a93b888 100644 --- a/pkg/domain/infra/runtime_tunnel.go +++ b/pkg/domain/infra/runtime_tunnel.go @@ -16,7 +16,7 @@ func NewContainerEngine(facts *entities.PodmanConfig) (entities.ContainerEngine, case entities.ABIMode: return nil, fmt.Errorf("direct runtime not supported") case entities.TunnelMode: - ctx, err := bindings.NewConnectionWithIdentity(context.Background(), facts.Uri, facts.PassPhrase, facts.Identities...) + ctx, err := bindings.NewConnectionWithIdentity(context.Background(), facts.URI, facts.PassPhrase, facts.Identities...) return &tunnel.ContainerEngine{ClientCxt: ctx}, err } return nil, fmt.Errorf("runtime mode '%v' is not supported", facts.EngineMode) @@ -28,7 +28,7 @@ func NewImageEngine(facts *entities.PodmanConfig) (entities.ImageEngine, error) case entities.ABIMode: return nil, fmt.Errorf("direct image runtime not supported") case entities.TunnelMode: - ctx, err := bindings.NewConnectionWithIdentity(context.Background(), facts.Uri, facts.PassPhrase, facts.Identities...) + ctx, err := bindings.NewConnectionWithIdentity(context.Background(), facts.URI, facts.PassPhrase, facts.Identities...) return &tunnel.ImageEngine{ClientCxt: ctx}, err } return nil, fmt.Errorf("runtime mode '%v' is not supported", facts.EngineMode) diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index 1981055e2..f9aed4102 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -233,7 +233,7 @@ func (ic *ContainerEngine) ContainerTop(ctx context.Context, options entities.To func (ic *ContainerEngine) ContainerCommit(ctx context.Context, nameOrId string, options entities.CommitOptions) (*entities.CommitReport, error) { var ( repo string - tag string = "latest" + tag = "latest" ) if len(options.ImageName) > 0 { ref, err := reference.Parse(options.ImageName) diff --git a/pkg/domain/infra/tunnel/generate.go b/pkg/domain/infra/tunnel/generate.go index eb5587f89..519dc5907 100644 --- a/pkg/domain/infra/tunnel/generate.go +++ b/pkg/domain/infra/tunnel/generate.go @@ -13,5 +13,5 @@ func (ic *ContainerEngine) GenerateSystemd(ctx context.Context, nameOrID string, } func (ic *ContainerEngine) GenerateKube(ctx context.Context, nameOrID string, options entities.GenerateKubeOptions) (*entities.GenerateKubeReport, error) { - return generate.GenerateKube(ic.ClientCxt, nameOrID, options) + return generate.Kube(ic.ClientCxt, nameOrID, options) } diff --git a/pkg/domain/infra/tunnel/play.go b/pkg/domain/infra/tunnel/play.go index 15383a703..5f6bc4a2a 100644 --- a/pkg/domain/infra/tunnel/play.go +++ b/pkg/domain/infra/tunnel/play.go @@ -8,5 +8,5 @@ import ( ) func (ic *ContainerEngine) PlayKube(ctx context.Context, path string, options entities.PlayKubeOptions) (*entities.PlayKubeReport, error) { - return play.PlayKube(ic.ClientCxt, path, options) + return play.Kube(ic.ClientCxt, path, options) } diff --git a/pkg/domain/infra/tunnel/pods.go b/pkg/domain/infra/tunnel/pods.go index b93c48aab..af302d81f 100644 --- a/pkg/domain/infra/tunnel/pods.go +++ b/pkg/domain/infra/tunnel/pods.go @@ -87,7 +87,7 @@ func (ic *ContainerEngine) PodUnpause(ctx context.Context, namesOrIds []string, func (ic *ContainerEngine) PodStop(ctx context.Context, namesOrIds []string, options entities.PodStopOptions) ([]*entities.PodStopReport, error) { var ( reports []*entities.PodStopReport - timeout int = -1 + timeout = -1 ) foundPods, err := getPodsByContext(ic.ClientCxt, options.All, namesOrIds) if err != nil && !(options.Ignore && errors.Cause(err) == define.ErrNoSuchPod) { diff --git a/pkg/domain/utils/utils.go b/pkg/domain/utils/utils.go index c17769f62..ee213e1b6 100644 --- a/pkg/domain/utils/utils.go +++ b/pkg/domain/utils/utils.go @@ -31,7 +31,7 @@ func ToLibpodFilters(f url.Values) (filters []string) { return } -func ToUrlValues(f []string) (filters url.Values) { +func ToURLValues(f []string) (filters url.Values) { filters = make(url.Values) for _, v := range f { t := strings.SplitN(v, "=", 2) -- cgit v1.2.3-54-g00ecf