aboutsummaryrefslogtreecommitdiff
path: root/pkg/k8s.io/apimachinery
diff options
context:
space:
mode:
authorValentin Rothberg <vrothberg@redhat.com>2022-05-19 10:45:28 +0200
committerValentin Rothberg <vrothberg@redhat.com>2022-05-19 13:59:15 +0200
commitb22143267bfd114d23ac25b08b71496f79092a91 (patch)
tree09b036d83ce54ed1c0e48ca76781a68f1a1d3ae6 /pkg/k8s.io/apimachinery
parent7093885df73989acd2aa2dd936695d0b30a3dcf8 (diff)
downloadpodman-b22143267bfd114d23ac25b08b71496f79092a91.tar.gz
podman-b22143267bfd114d23ac25b08b71496f79092a91.tar.bz2
podman-b22143267bfd114d23ac25b08b71496f79092a91.zip
linter: enable unconvert linter
Detects unneccessary type conversions and helps in keeping the code base cleaner. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'pkg/k8s.io/apimachinery')
-rw-r--r--pkg/k8s.io/apimachinery/pkg/api/resource/amount.go2
-rw-r--r--pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go4
2 files changed, 3 insertions, 3 deletions
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
}