diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-02-12 11:30:00 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-12 11:30:00 -0500 |
commit | 291f59600b7857bbec6f340d3ceec6e2e9ce923f (patch) | |
tree | 401aaa4e56cbe585582fa1124a9cd77a83ae21a9 /pkg/api | |
parent | 1b284a298c0bde20561321f325d4a7ad00e7bd25 (diff) | |
parent | 78c8a87362ee27ba1d2a62b7c9d73adc313c7d7e (diff) | |
download | podman-291f59600b7857bbec6f340d3ceec6e2e9ce923f.tar.gz podman-291f59600b7857bbec6f340d3ceec6e2e9ce923f.tar.bz2 podman-291f59600b7857bbec6f340d3ceec6e2e9ce923f.zip |
Merge pull request #9331 from Luap99/lint
Enable more golangci-lint linters
Diffstat (limited to 'pkg/api')
-rw-r--r-- | pkg/api/handlers/compat/containers_archive.go | 2 | ||||
-rw-r--r-- | pkg/api/handlers/compat/events.go | 1 | ||||
-rw-r--r-- | pkg/api/handlers/compat/images.go | 1 | ||||
-rw-r--r-- | pkg/api/handlers/compat/images_history.go | 1 | ||||
-rw-r--r-- | pkg/api/handlers/compat/images_remove.go | 1 | ||||
-rw-r--r-- | pkg/api/handlers/compat/networks.go | 4 | ||||
-rw-r--r-- | pkg/api/handlers/compat/secrets.go | 1 | ||||
-rw-r--r-- | pkg/api/handlers/libpod/containers.go | 3 | ||||
-rw-r--r-- | pkg/api/handlers/libpod/images.go | 2 | ||||
-rw-r--r-- | pkg/api/handlers/libpod/networks.go | 1 | ||||
-rw-r--r-- | pkg/api/handlers/utils/containers.go | 10 | ||||
-rw-r--r-- | pkg/api/server/register_ping.go | 1 |
12 files changed, 6 insertions, 22 deletions
diff --git a/pkg/api/handlers/compat/containers_archive.go b/pkg/api/handlers/compat/containers_archive.go index 083c72ce8..55bd62f90 100644 --- a/pkg/api/handlers/compat/containers_archive.go +++ b/pkg/api/handlers/compat/containers_archive.go @@ -62,7 +62,7 @@ func handleHeadAndGet(w http.ResponseWriter, r *http.Request, decoder *schema.De w.Header().Add(copy.XDockerContainerPathStatHeader, statHeader) } - if errors.Cause(err) == define.ErrNoSuchCtr || errors.Cause(err) == copy.ENOENT { + if errors.Cause(err) == define.ErrNoSuchCtr || errors.Cause(err) == copy.ErrENOENT { // 404 is returned for an absent container and path. The // clients must deal with it accordingly. utils.Error(w, "Not found.", http.StatusNotFound, err) diff --git a/pkg/api/handlers/compat/events.go b/pkg/api/handlers/compat/events.go index 82a74e419..7dad5f566 100644 --- a/pkg/api/handlers/compat/events.go +++ b/pkg/api/handlers/compat/events.go @@ -111,7 +111,6 @@ func GetEvents(w http.ResponseWriter, r *http.Request) { Until: query.Until, } errorChannel <- runtime.Events(r.Context(), readOpts) - }() var flush = func() {} diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go index 0ae0f3bcf..63a329c03 100644 --- a/pkg/api/handlers/compat/images.go +++ b/pkg/api/handlers/compat/images.go @@ -202,7 +202,6 @@ func CreateImageFromSrc(w http.ResponseWriter, r *http.Request) { ProgressDetail: map[string]string{}, Id: iid, }) - } func CreateImageFromImage(w http.ResponseWriter, r *http.Request) { diff --git a/pkg/api/handlers/compat/images_history.go b/pkg/api/handlers/compat/images_history.go index 3b72798e4..174bc6234 100644 --- a/pkg/api/handlers/compat/images_history.go +++ b/pkg/api/handlers/compat/images_history.go @@ -17,7 +17,6 @@ func HistoryImage(w http.ResponseWriter, r *http.Request) { if err != nil { utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "failed to find image %s", name)) return - } history, err := newImage.History(r.Context()) if err != nil { diff --git a/pkg/api/handlers/compat/images_remove.go b/pkg/api/handlers/compat/images_remove.go index 9731c521c..dd2d96bbb 100644 --- a/pkg/api/handlers/compat/images_remove.go +++ b/pkg/api/handlers/compat/images_remove.go @@ -54,5 +54,4 @@ func RemoveImage(w http.ResponseWriter, r *http.Request) { } utils.WriteResponse(w, http.StatusOK, response) - } diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go index 83c80aac9..71b9d180d 100644 --- a/pkg/api/handlers/compat/networks.go +++ b/pkg/api/handlers/compat/networks.go @@ -277,10 +277,10 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) { return } body := struct { - Id string + ID string `json:"Id"` Warning []string }{ - Id: net.ID, + ID: net.ID, } utils.WriteResponse(w, http.StatusCreated, body) } diff --git a/pkg/api/handlers/compat/secrets.go b/pkg/api/handlers/compat/secrets.go index ea2dfc707..571888eba 100644 --- a/pkg/api/handlers/compat/secrets.go +++ b/pkg/api/handlers/compat/secrets.go @@ -58,7 +58,6 @@ func InspectSecret(w http.ResponseWriter, r *http.Request) { return } utils.WriteResponse(w, http.StatusOK, reports[0]) - } func RemoveSecret(w http.ResponseWriter, r *http.Request) { diff --git a/pkg/api/handlers/libpod/containers.go b/pkg/api/handlers/libpod/containers.go index 619cbfd8b..4e79e4a42 100644 --- a/pkg/api/handlers/libpod/containers.go +++ b/pkg/api/handlers/libpod/containers.go @@ -48,7 +48,6 @@ func ContainerExists(w http.ResponseWriter, r *http.Request) { } utils.InternalServerError(w, err) return - } if report.Value { utils.WriteResponse(w, http.StatusNoContent, "") @@ -162,7 +161,6 @@ func UnmountContainer(w http.ResponseWriter, r *http.Request) { utils.InternalServerError(w, err) } utils.WriteResponse(w, http.StatusNoContent, "") - } func MountContainer(w http.ResponseWriter, r *http.Request) { runtime := r.Context().Value("runtime").(*libpod.Runtime) @@ -361,7 +359,6 @@ func ShouldRestart(w http.ResponseWriter, r *http.Request) { } utils.InternalServerError(w, err) return - } if report.Value { utils.WriteResponse(w, http.StatusNoContent, "") diff --git a/pkg/api/handlers/libpod/images.go b/pkg/api/handlers/libpod/images.go index 3b531652f..0d4160a6e 100644 --- a/pkg/api/handlers/libpod/images.go +++ b/pkg/api/handlers/libpod/images.go @@ -266,7 +266,6 @@ func ExportImages(w http.ResponseWriter, r *http.Request) { if len(query.References) > 1 && query.Format != define.V2s2Archive { utils.Error(w, "unsupported format", http.StatusInternalServerError, errors.Errorf("multi-image archives must use format of %s", define.V2s2Archive)) return - } switch query.Format { @@ -445,7 +444,6 @@ func PushImage(w http.ResponseWriter, r *http.Request) { if authconf != nil { username = authconf.Username password = authconf.Password - } options := entities.ImagePushOptions{ Authfile: authfile, diff --git a/pkg/api/handlers/libpod/networks.go b/pkg/api/handlers/libpod/networks.go index 998f89d96..8330b6a45 100644 --- a/pkg/api/handlers/libpod/networks.go +++ b/pkg/api/handlers/libpod/networks.go @@ -42,7 +42,6 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) { return } utils.WriteResponse(w, http.StatusOK, report) - } func ListNetworks(w http.ResponseWriter, r *http.Request) { runtime := r.Context().Value("runtime").(*libpod.Runtime) diff --git a/pkg/api/handlers/utils/containers.go b/pkg/api/handlers/utils/containers.go index 518309a03..ba202cad0 100644 --- a/pkg/api/handlers/utils/containers.go +++ b/pkg/api/handlers/utils/containers.go @@ -130,10 +130,9 @@ func WaitContainerLibpod(w http.ResponseWriter, r *http.Request) { if errors.Cause(err) == define.ErrNoSuchCtr { ContainerNotFound(w, name, err) return - } else { - InternalServerError(w, err) - return } + InternalServerError(w, err) + return } WriteResponse(w, http.StatusOK, strconv.Itoa(int(exitCode))) } @@ -141,7 +140,6 @@ func WaitContainerLibpod(w http.ResponseWriter, r *http.Request) { type containerWaitFn func(conditions ...define.ContainerStatus) (int32, error) func createContainerWaitFn(ctx context.Context, containerName string, interval time.Duration) containerWaitFn { - runtime := ctx.Value("runtime").(*libpod.Runtime) var containerEngine entities.ContainerEngine = &abi.ContainerEngine{Libpod: runtime} @@ -170,7 +168,6 @@ func isValidDockerCondition(cond string) bool { } func waitDockerCondition(ctx context.Context, containerName string, interval time.Duration, dockerCondition string) (int32, error) { - containerWait := createContainerWaitFn(ctx, containerName, interval) var err error @@ -200,9 +197,8 @@ func waitRemoved(ctrWait containerWaitFn) (int32, error) { code, err := ctrWait(define.ContainerStateUnknown) if err != nil && errors.Cause(err) == define.ErrNoSuchCtr { return code, nil - } else { - return code, err } + return code, err } func waitNextExit(ctrWait containerWaitFn) (int32, error) { diff --git a/pkg/api/server/register_ping.go b/pkg/api/server/register_ping.go index 446a12a68..0343d2608 100644 --- a/pkg/api/server/register_ping.go +++ b/pkg/api/server/register_ping.go @@ -8,7 +8,6 @@ import ( ) func (s *APIServer) registerPingHandlers(r *mux.Router) error { - r.Handle("/_ping", s.APIHandler(compat.Ping)).Methods(http.MethodGet, http.MethodHead) r.Handle(VersionedPath("/_ping"), s.APIHandler(compat.Ping)).Methods(http.MethodGet, http.MethodHead) // swagger:operation GET /libpod/_ping libpod libpodPingGet |