summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-04-25 13:43:57 -0400
committerGitHub <noreply@github.com>2022-04-25 13:43:57 -0400
commit09ef4f2e226c0bd769c93817fa5a4df1a9bb9f8b (patch)
tree1d8b6afb20e8b48f9193d4897162c3a1d24dbd4a /cmd
parent23d2bf518884df59f7177099d07b11b1ca344a2f (diff)
parentc7b16645aff27fff0b87bb2a98298693bbf20894 (diff)
downloadpodman-09ef4f2e226c0bd769c93817fa5a4df1a9bb9f8b.tar.gz
podman-09ef4f2e226c0bd769c93817fa5a4df1a9bb9f8b.tar.bz2
podman-09ef4f2e226c0bd769c93817fa5a4df1a9bb9f8b.zip
Merge pull request #13978 from Luap99/unparam
enable unparam linter
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/containers/create.go19
-rw-r--r--cmd/podman/containers/run.go2
-rw-r--r--cmd/podman/system/connection/add.go4
3 files changed, 13 insertions, 12 deletions
diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go
index b202e404f..29e138e30 100644
--- a/cmd/podman/containers/create.go
+++ b/cmd/podman/containers/create.go
@@ -142,7 +142,7 @@ func create(cmd *cobra.Command, args []string) error {
}
s.RawImageName = rawImageName
- if _, err := createPodIfNecessary(cmd, s, cliVals.Net); err != nil {
+ if err := createPodIfNecessary(cmd, s, cliVals.Net); err != nil {
return err
}
@@ -345,13 +345,13 @@ func PullImage(imageName string, cliVals entities.ContainerCreateOptions) (strin
// createPodIfNecessary automatically creates a pod when requested. if the pod name
// has the form new:ID, the pod ID is created and the name in the spec generator is replaced
// with ID.
-func createPodIfNecessary(cmd *cobra.Command, s *specgen.SpecGenerator, netOpts *entities.NetOptions) (*entities.PodCreateReport, error) {
+func createPodIfNecessary(cmd *cobra.Command, s *specgen.SpecGenerator, netOpts *entities.NetOptions) error {
if !strings.HasPrefix(s.Pod, "new:") {
- return nil, nil
+ return nil
}
podName := strings.Replace(s.Pod, "new:", "", 1)
if len(podName) < 1 {
- return nil, errors.Errorf("new pod name must be at least one character")
+ return errors.Errorf("new pod name must be at least one character")
}
var err error
@@ -359,7 +359,7 @@ func createPodIfNecessary(cmd *cobra.Command, s *specgen.SpecGenerator, netOpts
if cliVals.UserNS != "" {
uns, err = specgen.ParseNamespace(cliVals.UserNS)
if err != nil {
- return nil, err
+ return err
}
}
createOptions := entities.PodCreateOptions{
@@ -383,7 +383,7 @@ func createPodIfNecessary(cmd *cobra.Command, s *specgen.SpecGenerator, netOpts
podSpec.PodSpecGen = *podGen
podGen, err = entities.ToPodSpecGen(podSpec.PodSpecGen, &createOptions)
if err != nil {
- return nil, err
+ return err
}
infraOpts := entities.NewInfraContainerCreateOptions()
@@ -391,14 +391,15 @@ func createPodIfNecessary(cmd *cobra.Command, s *specgen.SpecGenerator, netOpts
infraOpts.Quiet = true
infraOpts.Hostname, err = cmd.Flags().GetString("hostname")
if err != nil {
- return nil, err
+ return err
}
podGen.InfraContainerSpec = specgen.NewSpecGenerator("", false)
podGen.InfraContainerSpec.NetworkOptions = podGen.NetworkOptions
err = specgenutil.FillOutSpecGen(podGen.InfraContainerSpec, &infraOpts, []string{})
if err != nil {
- return nil, err
+ return err
}
podSpec.PodSpecGen = *podGen
- return registry.ContainerEngine().PodCreate(context.Background(), podSpec)
+ _, err = registry.ContainerEngine().PodCreate(context.Background(), podSpec)
+ return err
}
diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go
index 4ad8d3183..951981293 100644
--- a/cmd/podman/containers/run.go
+++ b/cmd/podman/containers/run.go
@@ -197,7 +197,7 @@ func run(cmd *cobra.Command, args []string) error {
s.Passwd = &runOpts.Passwd
runOpts.Spec = s
- if _, err := createPodIfNecessary(cmd, s, cliVals.Net); err != nil {
+ if err := createPodIfNecessary(cmd, s, cliVals.Net); err != nil {
return err
}
diff --git a/cmd/podman/system/connection/add.go b/cmd/podman/system/connection/add.go
index db575a689..387de3c58 100644
--- a/cmd/podman/system/connection/add.go
+++ b/cmd/podman/system/connection/add.go
@@ -112,7 +112,7 @@ func add(cmd *cobra.Command, args []string) error {
iden = cOpts.Identity
}
if uri.Path == "" || uri.Path == "/" {
- if uri.Path, err = getUDS(cmd, uri, iden); err != nil {
+ if uri.Path, err = getUDS(uri, iden); err != nil {
return err
}
}
@@ -204,7 +204,7 @@ func GetUserInfo(uri *url.URL) (*url.Userinfo, error) {
return url.User(usr.Username), nil
}
-func getUDS(cmd *cobra.Command, uri *url.URL, iden string) (string, error) {
+func getUDS(uri *url.URL, iden string) (string, error) {
cfg, err := ValidateAndConfigure(uri, iden)
if err != nil {
return "", errors.Wrapf(err, "failed to validate")