summaryrefslogtreecommitdiff
path: root/pkg/k8s.io/apimachinery
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-03-11 17:47:39 +0100
committerPaul Holzinger <pholzing@redhat.com>2022-03-15 14:48:10 +0100
commitf8577766d01e994cfb62b7bf7da14631c1a183b5 (patch)
tree0293770c045de0057a328441414f06b9a1586778 /pkg/k8s.io/apimachinery
parenta0ad1f2ad46507f13a16d342b9ccf35a38bae3d5 (diff)
downloadpodman-f8577766d01e994cfb62b7bf7da14631c1a183b5.tar.gz
podman-f8577766d01e994cfb62b7bf7da14631c1a183b5.tar.bz2
podman-f8577766d01e994cfb62b7bf7da14631c1a183b5.zip
pkg/k8s.io/...: fix lint errors
Fix linting errors. We use different/stricter linters, instead of skipping these packages we should fix it. Most errors are about naming conventions, since I do not want to change the names I added the nolint comment there. I also removed some unused fields where the linter complained. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg/k8s.io/apimachinery')
-rw-r--r--pkg/k8s.io/apimachinery/pkg/api/resource/math.go14
-rw-r--r--pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go14
-rw-r--r--pkg/k8s.io/apimachinery/pkg/api/resource/suffix.go2
-rw-r--r--pkg/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go10
-rw-r--r--pkg/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go10
-rw-r--r--pkg/k8s.io/apimachinery/pkg/apis/meta/v1/time.go10
6 files changed, 8 insertions, 52 deletions
diff --git a/pkg/k8s.io/apimachinery/pkg/api/resource/math.go b/pkg/k8s.io/apimachinery/pkg/api/resource/math.go
index 8ffcb9f09..7b4fa5a36 100644
--- a/pkg/k8s.io/apimachinery/pkg/api/resource/math.go
+++ b/pkg/k8s.io/apimachinery/pkg/api/resource/math.go
@@ -30,11 +30,10 @@ const (
var (
// Commonly needed big.Int values-- treat as read only!
- bigTen = big.NewInt(10)
- bigZero = big.NewInt(0)
- bigOne = big.NewInt(1)
- bigThousand = big.NewInt(1000)
- big1024 = big.NewInt(1024)
+ bigTen = big.NewInt(10)
+ bigZero = big.NewInt(0)
+ bigOne = big.NewInt(1)
+ big1024 = big.NewInt(1024)
// Commonly needed inf.Dec values-- treat as read only!
decZero = inf.NewDec(0, 0)
@@ -42,11 +41,6 @@ var (
// Largest (in magnitude) number allowed.
maxAllowed = infDecAmount{inf.NewDec((1<<63)-1, 0)} // == max int64
-
- // The maximum value we can represent milli-units for.
- // Compare with the return value of Quantity.Value() to
- // see if it's safe to use Quantity.MilliValue().
- MaxMilliValue = int64(((1 << 63) - 1) / 1000)
)
const mostNegative = -(mostPositive + 1)
diff --git a/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go b/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go
index d0e510a1b..fccddc3e0 100644
--- a/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go
+++ b/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go
@@ -138,6 +138,7 @@ const (
var (
// Errors that could happen while parsing a string.
+ // nolint:golint
ErrFormatWrong = errors.New("quantities must match the regular expression '" + splitREString + "'")
ErrNumeric = errors.New("unable to parse numeric part of quantity")
ErrSuffix = errors.New("unable to parse quantity's suffix")
@@ -257,6 +258,7 @@ Suffix:
// we encountered a non decimal in the Suffix loop, but the last character
// was not a valid exponent
err = ErrFormatWrong
+ // nolint:nakedret
return
}
@@ -387,16 +389,6 @@ func (q Quantity) DeepCopy() Quantity {
return q
}
-// OpenAPISchemaType is used by the kube-openapi generator when constructing
-// the OpenAPI spec of this type.
-//
-// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
-func (_ Quantity) OpenAPISchemaType() []string { return []string{"string"} }
-
-// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
-// the OpenAPI spec of this type.
-func (_ Quantity) OpenAPISchemaFormat() string { return "" }
-
// CanonicalizeBytes returns the canonical form of q and its suffix (see comment on Quantity).
//
// Note about BinarySI:
@@ -574,7 +566,7 @@ func (q Quantity) MarshalJSON() ([]byte, error) {
copy(out[1:], q.s)
return out, nil
}
- result := make([]byte, int64QuantityExpectedBytes, int64QuantityExpectedBytes)
+ result := make([]byte, int64QuantityExpectedBytes)
result[0] = '"'
number, suffix := q.CanonicalizeBytes(result[1:1])
// if the same slice was returned to us that we passed in, avoid another allocation by copying number into
diff --git a/pkg/k8s.io/apimachinery/pkg/api/resource/suffix.go b/pkg/k8s.io/apimachinery/pkg/api/resource/suffix.go
index 5ed7abe66..6ec527f9c 100644
--- a/pkg/k8s.io/apimachinery/pkg/api/resource/suffix.go
+++ b/pkg/k8s.io/apimachinery/pkg/api/resource/suffix.go
@@ -165,7 +165,7 @@ func (sh *suffixHandler) constructBytes(base, exponent int32, format Format) (s
if exponent == 0 {
return nil, true
}
- result := make([]byte, 8, 8)
+ result := make([]byte, 8)
result[0] = 'e'
number := strconv.AppendInt(result[1:1], int64(exponent), 10)
if &result[1] == &number[0] {
diff --git a/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go b/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go
index a22b07878..9ea9397e8 100644
--- a/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go
+++ b/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go
@@ -53,13 +53,3 @@ func (d Duration) MarshalJSON() ([]byte, error) {
func (d Duration) ToUnstructured() interface{} {
return d.Duration.String()
}
-
-// OpenAPISchemaType is used by the kube-openapi generator when constructing
-// the OpenAPI spec of this type.
-//
-// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
-func (_ Duration) OpenAPISchemaType() []string { return []string{"string"} }
-
-// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
-// the OpenAPI spec of this type.
-func (_ Duration) OpenAPISchemaFormat() string { return "" }
diff --git a/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go b/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
index 8eb37f436..1da7d54a0 100644
--- a/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
+++ b/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
@@ -160,16 +160,6 @@ func (t MicroTime) MarshalJSON() ([]byte, error) {
return json.Marshal(t.UTC().Format(RFC3339Micro))
}
-// OpenAPISchemaType is used by the kube-openapi generator when constructing
-// the OpenAPI spec of this type.
-//
-// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
-func (_ MicroTime) OpenAPISchemaType() []string { return []string{"string"} }
-
-// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
-// the OpenAPI spec of this type.
-func (_ MicroTime) OpenAPISchemaFormat() string { return "date-time" }
-
// MarshalQueryParameter converts to a URL query parameter value
func (t MicroTime) MarshalQueryParameter() (string, error) {
if t.IsZero() {
diff --git a/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/time.go b/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
index 421770d43..b84531b1a 100644
--- a/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
+++ b/pkg/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
@@ -161,16 +161,6 @@ func (t Time) ToUnstructured() interface{} {
return string(buf)
}
-// OpenAPISchemaType is used by the kube-openapi generator when constructing
-// the OpenAPI spec of this type.
-//
-// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
-func (_ Time) OpenAPISchemaType() []string { return []string{"string"} }
-
-// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
-// the OpenAPI spec of this type.
-func (_ Time) OpenAPISchemaFormat() string { return "date-time" }
-
// MarshalQueryParameter converts to a URL query parameter value
func (t Time) MarshalQueryParameter() (string, error) {
if t.IsZero() {