diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-05-19 12:51:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-19 12:51:12 -0400 |
commit | 913caaa9b1de2b63692c9bae15120208194c9eb3 (patch) | |
tree | b6b446de9365f1972600484e08322548ffec9b31 /pkg | |
parent | 948c5e915aec709beb4e171a72c7e54504889baf (diff) | |
parent | b22143267bfd114d23ac25b08b71496f79092a91 (diff) | |
download | podman-913caaa9b1de2b63692c9bae15120208194c9eb3.tar.gz podman-913caaa9b1de2b63692c9bae15120208194c9eb3.tar.bz2 podman-913caaa9b1de2b63692c9bae15120208194c9eb3.zip |
Merge pull request #14288 from vrothberg/linters
linter: enable unconvert linter
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/handlers/compat/containers.go | 6 | ||||
-rw-r--r-- | pkg/api/handlers/compat/images_build.go | 2 | ||||
-rw-r--r-- | pkg/bindings/images/build_unix.go | 4 | ||||
-rw-r--r-- | pkg/domain/infra/abi/containers.go | 2 | ||||
-rw-r--r-- | pkg/domain/infra/abi/parse/parse.go | 2 | ||||
-rw-r--r-- | pkg/domain/infra/abi/system.go | 6 | ||||
-rw-r--r-- | pkg/k8s.io/apimachinery/pkg/api/resource/amount.go | 2 | ||||
-rw-r--r-- | pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go | 4 | ||||
-rw-r--r-- | pkg/specgen/generate/config_linux.go | 2 | ||||
-rw-r--r-- | pkg/specgen/generate/container.go | 16 | ||||
-rw-r--r-- | pkg/specgen/generate/oci.go | 2 |
11 files changed, 24 insertions, 24 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index 1c339730e..e3d51fadf 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -254,7 +254,7 @@ func KillContainer(w http.ResponseWriter, r *http.Request) { utils.InternalServerError(w, err) return } - if sig == 0 || syscall.Signal(sig) == syscall.SIGKILL { + if sig == 0 || sig == syscall.SIGKILL { opts := entities.WaitOptions{ Condition: []define.ContainerStatus{define.ContainerStateExited, define.ContainerStateStopped}, Interval: time.Millisecond * 250, @@ -341,8 +341,8 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error for idx, portMapping := range portMappings { ports[idx] = types.Port{ IP: portMapping.HostIP, - PrivatePort: uint16(portMapping.ContainerPort), - PublicPort: uint16(portMapping.HostPort), + PrivatePort: portMapping.ContainerPort, + PublicPort: portMapping.HostPort, Type: portMapping.Protocol, } } diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go index 318688222..1a0ac6801 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -605,7 +605,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { Output: output, OutputFormat: format, PullPolicy: pullPolicy, - PullPushRetryDelay: time.Duration(2 * time.Second), + PullPushRetryDelay: 2 * time.Second, Quiet: query.Quiet, Registry: registry, RemoveIntermediateCtrs: query.Rm, diff --git a/pkg/bindings/images/build_unix.go b/pkg/bindings/images/build_unix.go index 67a5e2998..32e2ba9af 100644 --- a/pkg/bindings/images/build_unix.go +++ b/pkg/bindings/images/build_unix.go @@ -11,7 +11,7 @@ import ( func checkHardLink(fi os.FileInfo) (devino, bool) { st := fi.Sys().(*syscall.Stat_t) return devino{ - Dev: uint64(st.Dev), - Ino: uint64(st.Ino), + Dev: uint64(st.Dev), // nolint: unconvert + Ino: st.Ino, }, st.Nlink > 1 } diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index 4e9f38b95..d2fafccb1 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -1113,7 +1113,7 @@ func (ic *ContainerEngine) GetContainerExitCode(ctx context.Context, ctr *libpod time.Sleep(250 * time.Millisecond) continue } - return int(event.ContainerExitCode) + return event.ContainerExitCode } logrus.Errorf("Could not retrieve exit code from event: %v", err) return define.ExecErrorCodeNotFound diff --git a/pkg/domain/infra/abi/parse/parse.go b/pkg/domain/infra/abi/parse/parse.go index 3bac2ef99..66794e592 100644 --- a/pkg/domain/infra/abi/parse/parse.go +++ b/pkg/domain/infra/abi/parse/parse.go @@ -43,7 +43,7 @@ func VolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error) if err != nil { return nil, errors.Wrapf(err, "cannot convert inodes %s to integer", splitO[1]) } - libpodOptions = append(libpodOptions, libpod.WithVolumeInodes(uint64(inodes))) + libpodOptions = append(libpodOptions, libpod.WithVolumeInodes(inodes)) finalVal = append(finalVal, o) // set option "INODES": "$size" volumeOptions["INODES"] = splitO[1] diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go index 17df0e3f8..10f3e70b1 100644 --- a/pkg/domain/infra/abi/system.go +++ b/pkg/domain/infra/abi/system.go @@ -216,9 +216,9 @@ func (ic *ContainerEngine) SystemDf(ctx context.Context, options entities.System Tag: stat.Tag, ImageID: stat.ID, Created: stat.Created, - Size: int64(stat.Size), - SharedSize: int64(stat.SharedSize), - UniqueSize: int64(stat.UniqueSize), + Size: stat.Size, + SharedSize: stat.SharedSize, + UniqueSize: stat.UniqueSize, Containers: stat.Containers, } dfImages = append(dfImages, &report) diff --git a/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go b/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go index 9f76f9154..d05984dac 100644 --- a/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go +++ b/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go @@ -221,7 +221,7 @@ func (a int64Amount) AsCanonicalBytes(out []byte) (result []byte, exponent int32 exponent = int32(a.scale) amount, times := removeInt64Factors(mantissa, 10) - exponent += int32(times) + exponent += times // make sure exponent is a multiple of 3 var ok bool diff --git a/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go b/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go index 965d2ccaf..dcc5df219 100644 --- a/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go +++ b/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go @@ -293,7 +293,7 @@ func ParseQuantity(str string) (Quantity, error) { switch { case exponent >= 0 && len(denom) == 0: // only handle positive binary numbers with the fast path - mantissa = int64(int64(mantissa) << uint64(exponent)) + mantissa <<= uint64(exponent) // 1Mi (2^20) has ~6 digits of decimal precision, so exponent*3/10 -1 is roughly the precision precision = 15 - int32(len(num)) - int32(float32(exponent)*3/10) - 1 default: @@ -313,7 +313,7 @@ func ParseQuantity(str string) (Quantity, error) { if err != nil { return Quantity{}, ErrNumeric } - if result, ok := int64Multiply(value, int64(mantissa)); ok { + if result, ok := int64Multiply(value, mantissa); ok { if !positive { result = -result } diff --git a/pkg/specgen/generate/config_linux.go b/pkg/specgen/generate/config_linux.go index 8f83fc09b..ed2e5408d 100644 --- a/pkg/specgen/generate/config_linux.go +++ b/pkg/specgen/generate/config_linux.go @@ -327,7 +327,7 @@ func deviceFromPath(path string) (*spec.LinuxDevice, error) { var ( devType string mode = stat.Mode - devNumber = uint64(stat.Rdev) + devNumber = uint64(stat.Rdev) // nolint: unconvert m = os.FileMode(mode) ) diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go index d8008b10b..cc376125f 100644 --- a/pkg/specgen/generate/container.go +++ b/pkg/specgen/generate/container.go @@ -303,8 +303,8 @@ func FinishThrottleDevices(s *specgen.SpecGenerator) error { if err := unix.Stat(k, &statT); err != nil { return err } - v.Major = (int64(unix.Major(uint64(statT.Rdev)))) - v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) + v.Major = (int64(unix.Major(uint64(statT.Rdev)))) // nolint: unconvert + v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) // nolint: unconvert if s.ResourceLimits.BlockIO == nil { s.ResourceLimits.BlockIO = new(spec.LinuxBlockIO) } @@ -317,8 +317,8 @@ func FinishThrottleDevices(s *specgen.SpecGenerator) error { if err := unix.Stat(k, &statT); err != nil { return err } - v.Major = (int64(unix.Major(uint64(statT.Rdev)))) - v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) + v.Major = (int64(unix.Major(uint64(statT.Rdev)))) // nolint: unconvert + v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) // nolint: unconvert s.ResourceLimits.BlockIO.ThrottleWriteBpsDevice = append(s.ResourceLimits.BlockIO.ThrottleWriteBpsDevice, v) } } @@ -328,8 +328,8 @@ func FinishThrottleDevices(s *specgen.SpecGenerator) error { if err := unix.Stat(k, &statT); err != nil { return err } - v.Major = (int64(unix.Major(uint64(statT.Rdev)))) - v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) + v.Major = (int64(unix.Major(uint64(statT.Rdev)))) // nolint: unconvert + v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) // nolint: unconvert s.ResourceLimits.BlockIO.ThrottleReadIOPSDevice = append(s.ResourceLimits.BlockIO.ThrottleReadIOPSDevice, v) } } @@ -339,8 +339,8 @@ func FinishThrottleDevices(s *specgen.SpecGenerator) error { if err := unix.Stat(k, &statT); err != nil { return err } - v.Major = (int64(unix.Major(uint64(statT.Rdev)))) - v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) + v.Major = (int64(unix.Major(uint64(statT.Rdev)))) // nolint: unconvert + v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) // nolint: unconvert s.ResourceLimits.BlockIO.ThrottleWriteIOPSDevice = append(s.ResourceLimits.BlockIO.ThrottleWriteIOPSDevice, v) } } diff --git a/pkg/specgen/generate/oci.go b/pkg/specgen/generate/oci.go index b77c00f50..081df0441 100644 --- a/pkg/specgen/generate/oci.go +++ b/pkg/specgen/generate/oci.go @@ -377,7 +377,7 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt if err := unix.Stat(k, &statT); err != nil { return nil, errors.Wrapf(err, "failed to inspect '%s' in --blkio-weight-device", k) } - g.AddLinuxResourcesBlockIOWeightDevice((int64(unix.Major(uint64(statT.Rdev)))), (int64(unix.Minor(uint64(statT.Rdev)))), *v.Weight) + g.AddLinuxResourcesBlockIOWeightDevice((int64(unix.Major(uint64(statT.Rdev)))), (int64(unix.Minor(uint64(statT.Rdev)))), *v.Weight) // nolint: unconvert } BlockAccessToKernelFilesystems(s.Privileged, s.PidNS.IsHost(), s.Mask, s.Unmask, &g) |