diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-06-09 20:45:51 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-06-10 05:49:41 -0400 |
commit | 87718c4e676dc503f67ca6f283c4242cf19f9eb7 (patch) | |
tree | fab6dcb9e6c497cb1155b864bcc2085550d23969 /pkg/api/handlers | |
parent | 4bb43b898d72cb938d317055e4ade2771cfc9c54 (diff) | |
download | podman-87718c4e676dc503f67ca6f283c4242cf19f9eb7.tar.gz podman-87718c4e676dc503f67ca6f283c4242cf19f9eb7.tar.bz2 podman-87718c4e676dc503f67ca6f283c4242cf19f9eb7.zip |
Fix Id->ID where possible for lint
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r-- | pkg/api/handlers/compat/containers.go | 4 | ||||
-rw-r--r-- | pkg/api/handlers/compat/images.go | 4 | ||||
-rw-r--r-- | pkg/api/handlers/compat/images_build.go | 8 | ||||
-rw-r--r-- | pkg/api/handlers/compat/ping.go | 4 | ||||
-rw-r--r-- | pkg/api/handlers/compat/version.go | 4 | ||||
-rw-r--r-- | pkg/api/handlers/decoder.go | 6 | ||||
-rw-r--r-- | pkg/api/handlers/utils/handler.go | 24 | ||||
-rw-r--r-- | pkg/api/handlers/utils/handler_test.go | 4 | ||||
-rw-r--r-- | pkg/api/handlers/utils/pods.go | 4 |
9 files changed, 31 insertions, 31 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index cea4bd0f6..b90f3d625 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -348,7 +348,7 @@ func LogsFromContainer(w http.ResponseWriter, r *http.Request) { } func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error) { - imageId, imageName := l.Image() + imageID, imageName := l.Image() var ( err error @@ -378,7 +378,7 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error ID: l.ID(), Names: []string{fmt.Sprintf("/%s", l.Name())}, Image: imageName, - ImageID: imageId, + ImageID: imageID, Command: strings.Join(l.Command(), " "), Created: l.CreatedTime().Unix(), Ports: nil, diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go index b64ed0036..ce9ff1b19 100644 --- a/pkg/api/handlers/compat/images.go +++ b/pkg/api/handlers/compat/images.go @@ -224,7 +224,7 @@ func CreateImageFromSrc(w http.ResponseWriter, r *http.Request) { Status string `json:"status"` Progress string `json:"progress"` ProgressDetail map[string]string `json:"progressDetail"` - Id string `json:"id"` + Id string `json:"id"` //nolint }{ Status: iid, ProgressDetail: map[string]string{}, @@ -289,7 +289,7 @@ func CreateImageFromImage(w http.ResponseWriter, r *http.Request) { Error string `json:"error"` Progress string `json:"progress"` ProgressDetail map[string]string `json:"progressDetail"` - Id string `json:"id"` + Id string `json:"id"` //nolint }{ Status: fmt.Sprintf("pulling image (%s) from %s", img.Tag, strings.Join(img.Names(), ", ")), ProgressDetail: map[string]string{}, diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go index e9d8fd719..6cc766a38 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -59,10 +59,10 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { ForceRm bool `schema:"forcerm"` Memory int64 `schema:"memory"` MemSwap int64 `schema:"memswap"` - CpuShares uint64 `schema:"cpushares"` - CpuSetCpus string `schema:"cpusetcpus"` - CpuPeriod uint64 `schema:"cpuperiod"` - CpuQuota int64 `schema:"cpuquota"` + CpuShares uint64 `schema:"cpushares"` //nolint + CpuSetCpus string `schema:"cpusetcpus"` //nolint + CpuPeriod uint64 `schema:"cpuperiod"` //nolint + CpuQuota int64 `schema:"cpuquota"` //nolint BuildArgs string `schema:"buildargs"` ShmSize int `schema:"shmsize"` Squash bool `schema:"squash"` diff --git a/pkg/api/handlers/compat/ping.go b/pkg/api/handlers/compat/ping.go index abee3d8e8..d275c4a02 100644 --- a/pkg/api/handlers/compat/ping.go +++ b/pkg/api/handlers/compat/ping.go @@ -14,13 +14,13 @@ import ( // Clients will use the Header availability to test which backend engine is in use. // Note: Additionally handler supports GET and HEAD methods func Ping(w http.ResponseWriter, r *http.Request) { - w.Header().Set("API-Version", utils.ApiVersion[utils.CompatTree][utils.CurrentApiVersion].String()) + w.Header().Set("API-Version", utils.APIVersion[utils.CompatTree][utils.CurrentAPIVersion].String()) w.Header().Set("BuildKit-Version", "") w.Header().Set("Docker-Experimental", "true") w.Header().Set("Cache-Control", "no-cache") w.Header().Set("Pragma", "no-cache") - w.Header().Set("Libpod-API-Version", utils.ApiVersion[utils.LibpodTree][utils.CurrentApiVersion].String()) + w.Header().Set("Libpod-API-Version", utils.APIVersion[utils.LibpodTree][utils.CurrentAPIVersion].String()) w.Header().Set("Libpod-Buildha-Version", buildah.Version) w.WriteHeader(http.StatusOK) diff --git a/pkg/api/handlers/compat/version.go b/pkg/api/handlers/compat/version.go index bfc226bb8..3164b16b9 100644 --- a/pkg/api/handlers/compat/version.go +++ b/pkg/api/handlers/compat/version.go @@ -34,14 +34,14 @@ func VersionHandler(w http.ResponseWriter, r *http.Request) { Name: "Podman Engine", Version: versionInfo.Version, Details: map[string]string{ - "APIVersion": utils.ApiVersion[utils.LibpodTree][utils.CurrentApiVersion].String(), + "APIVersion": utils.APIVersion[utils.LibpodTree][utils.CurrentAPIVersion].String(), "Arch": goRuntime.GOARCH, "BuildTime": time.Unix(versionInfo.Built, 0).Format(time.RFC3339), "Experimental": "true", "GitCommit": versionInfo.GitCommit, "GoVersion": versionInfo.GoVersion, "KernelVersion": infoData.Host.Kernel, - "MinAPIVersion": utils.ApiVersion[utils.LibpodTree][utils.MinimalApiVersion].String(), + "MinAPIVersion": utils.APIVersion[utils.LibpodTree][utils.MinimalAPIVersion].String(), "Os": goRuntime.GOOS, }, }} diff --git a/pkg/api/handlers/decoder.go b/pkg/api/handlers/decoder.go index 03b86275d..e46cd8837 100644 --- a/pkg/api/handlers/decoder.go +++ b/pkg/api/handlers/decoder.go @@ -17,7 +17,7 @@ func NewAPIDecoder() *schema.Decoder { d := schema.NewDecoder() d.IgnoreUnknownKeys(true) - d.RegisterConverter(map[string][]string{}, convertUrlValuesString) + d.RegisterConverter(map[string][]string{}, convertURLValuesString) d.RegisterConverter(time.Time{}, convertTimeString) var Signal syscall.Signal @@ -35,12 +35,12 @@ func NewAPIDecoder() *schema.Decoder { // panic(err) // } // payload = url.QueryEscape(payload) -func convertUrlValuesString(query string) reflect.Value { +func convertURLValuesString(query string) reflect.Value { f := map[string][]string{} err := json.Unmarshal([]byte(query), &f) if err != nil { - logrus.Infof("convertUrlValuesString: Failed to Unmarshal %s: %s", query, err.Error()) + logrus.Infof("convertURLValuesString: Failed to Unmarshal %s: %s", query, err.Error()) } return reflect.ValueOf(f) diff --git a/pkg/api/handlers/utils/handler.go b/pkg/api/handlers/utils/handler.go index 2f4a54b98..62fdc05dd 100644 --- a/pkg/api/handlers/utils/handler.go +++ b/pkg/api/handlers/utils/handler.go @@ -28,27 +28,27 @@ const ( // CompatTree supports Libpod endpoints CompatTree - // CurrentApiVersion announces what is the current API level - CurrentApiVersion = VersionLevel(iota) - // MinimalApiVersion announces what is the oldest API level supported - MinimalApiVersion + // CurrentAPIVersion announces what is the current API level + CurrentAPIVersion = VersionLevel(iota) + // MinimalAPIVersion announces what is the oldest API level supported + MinimalAPIVersion ) var ( // See https://docs.docker.com/engine/api/v1.40/ // libpod compat handlers are expected to honor docker API versions - // ApiVersion provides the current and minimal API versions for compat and libpod endpoint trees + // APIVersion provides the current and minimal API versions for compat and libpod endpoint trees // Note: GET|HEAD /_ping is never versioned and provides the API-Version and Libpod-API-Version headers to allow // clients to shop for the Version they wish to support - ApiVersion = map[VersionTree]map[VersionLevel]semver.Version{ + APIVersion = map[VersionTree]map[VersionLevel]semver.Version{ LibpodTree: { - CurrentApiVersion: semver.MustParse("1.0.0"), - MinimalApiVersion: semver.MustParse("1.0.0"), + CurrentAPIVersion: semver.MustParse("1.0.0"), + MinimalAPIVersion: semver.MustParse("1.0.0"), }, CompatTree: { - CurrentApiVersion: semver.MustParse("1.40.0"), - MinimalApiVersion: semver.MustParse("1.24.0"), + CurrentAPIVersion: semver.MustParse("1.40.0"), + MinimalAPIVersion: semver.MustParse("1.24.0"), }, } @@ -103,8 +103,8 @@ func SupportedVersionWithDefaults(r *http.Request) (semver.Version, error) { } return SupportedVersion(r, - fmt.Sprintf(">=%s <=%s", ApiVersion[tree][MinimalApiVersion].String(), - ApiVersion[tree][CurrentApiVersion].String())) + fmt.Sprintf(">=%s <=%s", APIVersion[tree][MinimalAPIVersion].String(), + APIVersion[tree][CurrentAPIVersion].String())) } // WriteResponse encodes the given value as JSON or string and renders it for http client diff --git a/pkg/api/handlers/utils/handler_test.go b/pkg/api/handlers/utils/handler_test.go index 6009432b5..d9fd22b80 100644 --- a/pkg/api/handlers/utils/handler_test.go +++ b/pkg/api/handlers/utils/handler_test.go @@ -12,12 +12,12 @@ import ( func TestSupportedVersion(t *testing.T) { req, err := http.NewRequest("GET", - fmt.Sprintf("/v%s/libpod/testing/versions", ApiVersion[LibpodTree][CurrentApiVersion]), + fmt.Sprintf("/v%s/libpod/testing/versions", APIVersion[LibpodTree][CurrentAPIVersion]), nil) if err != nil { t.Fatal(err) } - req = mux.SetURLVars(req, map[string]string{"version": ApiVersion[LibpodTree][CurrentApiVersion].String()}) + req = mux.SetURLVars(req, map[string]string{"version": APIVersion[LibpodTree][CurrentAPIVersion].String()}) rr := httptest.NewRecorder() handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/pkg/api/handlers/utils/pods.go b/pkg/api/handlers/utils/pods.go index 5b6f6d34d..4a5cbd05c 100644 --- a/pkg/api/handlers/utils/pods.go +++ b/pkg/api/handlers/utils/pods.go @@ -54,7 +54,7 @@ func GetPods(w http.ResponseWriter, r *http.Request) ([]*entities.ListPodsReport if err != nil { return nil, err } - infraId, err := pod.InfraContainerID() + infraID, err := pod.InfraContainerID() if err != nil { return nil, err } @@ -65,7 +65,7 @@ func GetPods(w http.ResponseWriter, r *http.Request) ([]*entities.ListPodsReport Name: pod.Name(), Namespace: pod.Namespace(), Status: status, - InfraId: infraId, + InfraId: infraID, Labels: pod.Labels(), } for _, ctr := range ctrs { |