Skip to content

Commit 93caba9

Browse files
committed
apply go fmt for go1.19
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
1 parent 12342d8 commit 93caba9

File tree

25 files changed

+151
-128
lines changed

25 files changed

+151
-128
lines changed

deploy/crds/crd-certificaterequests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ spec:
115115
description: Usages is the set of x509 usages that are requested for the certificate. If usages are set they SHOULD be encoded inside the CSR spec Defaults to `digital signature` and `key encipherment` if not specified.
116116
type: array
117117
items:
118-
description: 'KeyUsage specifies valid usage contexts for keys. See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 https://tools.ietf.org/html/rfc5280#section-4.2.1.12 Valid KeyUsage values are as follows: "signing", "digital signature", "content commitment", "key encipherment", "key agreement", "data encipherment", "cert sign", "crl sign", "encipher only", "decipher only", "any", "server auth", "client auth", "code signing", "email protection", "s/mime", "ipsec end system", "ipsec tunnel", "ipsec user", "timestamping", "ocsp signing", "microsoft sgc", "netscape sgc"'
118+
description: "KeyUsage specifies valid usage contexts for keys. See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 https://tools.ietf.org/html/rfc5280#section-4.2.1.12 \n Valid KeyUsage values are as follows: \"signing\", \"digital signature\", \"content commitment\", \"key encipherment\", \"key agreement\", \"data encipherment\", \"cert sign\", \"crl sign\", \"encipher only\", \"decipher only\", \"any\", \"server auth\", \"client auth\", \"code signing\", \"email protection\", \"s/mime\", \"ipsec end system\", \"ipsec tunnel\", \"ipsec user\", \"timestamping\", \"ocsp signing\", \"microsoft sgc\", \"netscape sgc\""
119119
type: string
120120
enum:
121121
- signing

deploy/crds/crd-certificates.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ spec:
274274
description: Usages is the set of x509 usages that are requested for the certificate. Defaults to `digital signature` and `key encipherment` if not specified.
275275
type: array
276276
items:
277-
description: 'KeyUsage specifies valid usage contexts for keys. See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 https://tools.ietf.org/html/rfc5280#section-4.2.1.12 Valid KeyUsage values are as follows: "signing", "digital signature", "content commitment", "key encipherment", "key agreement", "data encipherment", "cert sign", "crl sign", "encipher only", "decipher only", "any", "server auth", "client auth", "code signing", "email protection", "s/mime", "ipsec end system", "ipsec tunnel", "ipsec user", "timestamping", "ocsp signing", "microsoft sgc", "netscape sgc"'
277+
description: "KeyUsage specifies valid usage contexts for keys. See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 https://tools.ietf.org/html/rfc5280#section-4.2.1.12 \n Valid KeyUsage values are as follows: \"signing\", \"digital signature\", \"content commitment\", \"key encipherment\", \"key agreement\", \"data encipherment\", \"cert sign\", \"crl sign\", \"encipher only\", \"decipher only\", \"any\", \"server auth\", \"client auth\", \"code signing\", \"email protection\", \"s/mime\", \"ipsec end system\", \"ipsec tunnel\", \"ipsec user\", \"timestamping\", \"ocsp signing\", \"microsoft sgc\", \"netscape sgc\""
278278
type: string
279279
enum:
280280
- signing

internal/apis/certmanager/types.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ const (
130130
)
131131

132132
// KeyUsage specifies valid usage contexts for keys.
133-
// See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3
134-
// https://tools.ietf.org/html/rfc5280#section-4.2.1.12
133+
// See:
134+
// https://tools.ietf.org/html/rfc5280#section-4.2.1.3
135+
// https://tools.ietf.org/html/rfc5280#section-4.2.1.12
136+
//
135137
// Valid KeyUsage values are as follows:
136138
// "signing",
137139
// "digital signature",

internal/apis/certmanager/v1alpha2/types.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ const (
137137
)
138138

139139
// KeyUsage specifies valid usage contexts for keys.
140-
// See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3
141-
// https://tools.ietf.org/html/rfc5280#section-4.2.1.12
140+
// See:
141+
// https://tools.ietf.org/html/rfc5280#section-4.2.1.3
142+
// https://tools.ietf.org/html/rfc5280#section-4.2.1.12
143+
//
142144
// Valid KeyUsage values are as follows:
143145
// "signing",
144146
// "digital signature",

internal/apis/certmanager/v1alpha3/types.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ const (
137137
)
138138

139139
// KeyUsage specifies valid usage contexts for keys.
140-
// See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3
141-
// https://tools.ietf.org/html/rfc5280#section-4.2.1.12
140+
// See:
141+
// https://tools.ietf.org/html/rfc5280#section-4.2.1.3
142+
// https://tools.ietf.org/html/rfc5280#section-4.2.1.12
143+
//
142144
// Valid KeyUsage values are as follows:
143145
// "signing",
144146
// "digital signature",

internal/apis/certmanager/v1beta1/types.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ const (
137137
)
138138

139139
// KeyUsage specifies valid usage contexts for keys.
140-
// See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3
141-
// https://tools.ietf.org/html/rfc5280#section-4.2.1.12
140+
// See:
141+
// https://tools.ietf.org/html/rfc5280#section-4.2.1.3
142+
// https://tools.ietf.org/html/rfc5280#section-4.2.1.12
143+
//
142144
// Valid KeyUsage values are as follows:
143145
// "signing",
144146
// "digital signature",

internal/cainjector/feature/features.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const (
2929
// Owner (responsible for graduating feature through to GA): @username
3030
// Alpha: vX.Y
3131
// Beta: ...
32-
//FeatureName featuregate.Feature = "FeatureName"
32+
// FeatureName featuregate.Feature = "FeatureName"
3333
)
3434

3535
func init() {
@@ -39,6 +39,8 @@ func init() {
3939
// cainjectorFeatureGates defines all feature gates for the cainjector component.
4040
// To add a new feature, define a key for it above and add it here.
4141
// To check whether a feature is enabled, use:
42-
// utilfeature.DefaultFeatureGate.Enabled(feature.FeatureName)
42+
//
43+
// utilfeature.DefaultFeatureGate.Enabled(feature.FeatureName)
44+
//
4345
// Where utilfeature is github.com/cert-manager/cert-manager/pkg/util/feature.
4446
var cainjectorFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{}

internal/controller/certificates/policies/checks.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,8 @@ func SecretTemplateMismatchesSecretManagedFields(fieldManager string) Func {
375375
// expected Certificate AdditionalOutputFormats.
376376
// Returns true (violation) if AdditionalOutputFormat(s) are present and any of
377377
// the following:
378-
// * Secret key is missing
379-
// * Secret value is incorrect
378+
// - Secret key is missing
379+
// - Secret value is incorrect
380380
func SecretAdditionalOutputFormatsDataMismatch(input Input) (string, string, bool) {
381381
const message = "Certificate's AdditionalOutputFormats doesn't match Secret Data"
382382
for _, format := range input.Certificate.Spec.AdditionalOutputFormats {
@@ -404,8 +404,9 @@ func SecretAdditionalOutputFormatsDataMismatch(input Input) (string, string, boo
404404
// SecretAdditionalOutputFormatsOwnerMismatch validates that the field manager
405405
// owns the correct Certificate's AdditionalOutputFormats in the Secret.
406406
// Returns true (violation) if:
407-
// * missing AdditionalOutputFormat key owned by the field manager
408-
// * AdditionalOutputFormat key owned by the field manager shouldn't exist
407+
// - missing AdditionalOutputFormat key owned by the field manager
408+
// - AdditionalOutputFormat key owned by the field manager shouldn't exist
409+
//
409410
// A violation with the reason `ManagedFieldsParseError` should be considered a
410411
// non re-triable error.
411412
func SecretAdditionalOutputFormatsOwnerMismatch(fieldManager string) Func {

internal/controller/certificates/policies/policies.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
//Package policies provides functionality to evaluate Certificate's state
17+
// Package policies provides functionality to evaluate Certificate's state
1818
package policies
1919

2020
import (

internal/webhook/feature/features.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ func init() {
5252
// webhookFeatureGates defines all feature gates for the webhook component.
5353
// To add a new feature, define a key for it above and add it here.
5454
// To check whether a feature is enabled, use:
55-
// utilfeature.DefaultFeatureGate.Enabled(feature.FeatureName)
55+
//
56+
// utilfeature.DefaultFeatureGate.Enabled(feature.FeatureName)
57+
//
5658
// Where utilfeature is github.com/cert-manager/cert-manager/pkg/util/feature.
5759
var webhookFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
5860
AdditionalCertificateOutputFormats: {Default: false, PreRelease: featuregate.Alpha},

pkg/api/scheme.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
6969
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
7070
// of clientsets, like in:
7171
//
72-
// import (
73-
// "k8s.io/client-go/kubernetes"
74-
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
75-
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
76-
// )
72+
// import (
73+
// "k8s.io/client-go/kubernetes"
74+
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
75+
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
76+
// )
7777
//
78-
// kclientset, _ := kubernetes.NewForConfig(c)
79-
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
78+
// kclientset, _ := kubernetes.NewForConfig(c)
79+
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
8080
//
8181
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
8282
// correctly.

pkg/api/util/conditions.go

+24-22
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ func IssuerHasCondition(i cmapi.GenericIssuer, c cmapi.IssuerCondition) bool {
4747
}
4848

4949
// SetIssuerCondition will set a 'condition' on the given GenericIssuer.
50-
// - If no condition of the same type already exists, the condition will be
51-
// inserted with the LastTransitionTime set to the current time.
52-
// - If a condition of the same type and state already exists, the condition
53-
// will be updated but the LastTransitionTime will not be modified.
54-
// - If a condition of the same type and different state already exists, the
55-
// condition will be updated and the LastTransitionTime set to the current
56-
// time.
50+
// - If no condition of the same type already exists, the condition will be
51+
// inserted with the LastTransitionTime set to the current time.
52+
// - If a condition of the same type and state already exists, the condition
53+
// will be updated but the LastTransitionTime will not be modified.
54+
// - If a condition of the same type and different state already exists, the
55+
// condition will be updated and the LastTransitionTime set to the current
56+
// time.
57+
//
5758
// This function works with both Issuer and ClusterIssuer resources.
5859
func SetIssuerCondition(i cmapi.GenericIssuer, observedGeneration int64, conditionType cmapi.IssuerConditionType, status cmmeta.ConditionStatus, reason, message string) {
5960
newCondition := cmapi.IssuerCondition{
@@ -151,13 +152,14 @@ func GetCertificateRequestCondition(req *cmapi.CertificateRequest, conditionType
151152
}
152153

153154
// SetCertificateCondition will set a 'condition' on the given Certificate.
154-
// - If no condition of the same type already exists, the condition will be
155-
// inserted with the LastTransitionTime set to the current time.
156-
// - If a condition of the same type and state already exists, the condition
157-
// will be updated but the LastTransitionTime will not be modified.
158-
// - If a condition of the same type and different state already exists, the
159-
// condition will be updated with the LastTransitionTime set to the current
160-
// time.
155+
// - If no condition of the same type already exists, the condition will be
156+
// inserted with the LastTransitionTime set to the current time.
157+
// - If a condition of the same type and state already exists, the condition
158+
// will be updated but the LastTransitionTime will not be modified.
159+
// - If a condition of the same type and different state already exists, the
160+
// condition will be updated with the LastTransitionTime set to the current
161+
// time.
162+
//
161163
// The given ObservedGeneration will always set on the condition, whether the
162164
// lastTransitionTime is modified or not.
163165
func SetCertificateCondition(crt *cmapi.Certificate, observedGeneration int64, conditionType cmapi.CertificateConditionType,
@@ -217,13 +219,13 @@ func RemoveCertificateCondition(crt *cmapi.Certificate, conditionType cmapi.Cert
217219
}
218220

219221
// SetCertificateRequestCondition will set a 'condition' on the given CertificateRequest.
220-
// - If no condition of the same type already exists, the condition will be
221-
// inserted with the LastTransitionTime set to the current time.
222-
// - If a condition of the same type and state already exists, the condition
223-
// will be updated but the LastTransitionTime will not be modified.
224-
// - If a condition of the same type and different state already exists, the
225-
// condition will be updated and the LastTransitionTime set to the current
226-
// time.
222+
// - If no condition of the same type already exists, the condition will be
223+
// inserted with the LastTransitionTime set to the current time.
224+
// - If a condition of the same type and state already exists, the condition
225+
// will be updated but the LastTransitionTime will not be modified.
226+
// - If a condition of the same type and different state already exists, the
227+
// condition will be updated and the LastTransitionTime set to the current
228+
// time.
227229
func SetCertificateRequestCondition(cr *cmapi.CertificateRequest, conditionType cmapi.CertificateRequestConditionType, status cmmeta.ConditionStatus, reason, message string) {
228230
newCondition := cmapi.CertificateRequestCondition{
229231
Type: conditionType,
@@ -283,7 +285,7 @@ func CertificateRequestHasCondition(cr *cmapi.CertificateRequest, c cmapi.Certif
283285
}
284286

285287
// This returns the status reason of a CertificateRequest. The order of reason
286-
// hierarchy is 'Failed' -> 'Ready' -> 'Pending' -> ''
288+
// hierarchy is 'Failed' -> 'Ready' -> 'Pending' ->
287289
func CertificateRequestReadyReason(cr *cmapi.CertificateRequest) string {
288290
for _, reason := range []string{
289291
cmapi.CertificateRequestReasonFailed,

pkg/apis/certmanager/v1/types.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,10 @@ const (
176176
)
177177

178178
// KeyUsage specifies valid usage contexts for keys.
179-
// See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3
180-
// https://tools.ietf.org/html/rfc5280#section-4.2.1.12
179+
// See:
180+
// https://tools.ietf.org/html/rfc5280#section-4.2.1.3
181+
// https://tools.ietf.org/html/rfc5280#section-4.2.1.12
182+
//
181183
// Valid KeyUsage values are as follows:
182184
// "signing",
183185
// "digital signature",

pkg/controller/certificate-shim/gateways/controller.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,16 @@ func (c *controller) ProcessItem(ctx context.Context, key string) error {
112112
// example, the following Certificate "cert-1" is controlled by the Gateway
113113
// "gateway-1":
114114
//
115-
// kind: Certificate
116-
// metadata: Note that the owner
117-
// namespace: cert-1 reference does not
118-
// ownerReferences: have a namespace,
119-
// - controller: true since owner refs
120-
// apiVersion: networking.x-k8s.io/v1alpha1 only work inside
121-
// kind: Gateway the same namespace.
122-
// name: gateway-1
123-
// blockOwnerDeletion: true
124-
// uid: 7d3897c2-ce27-4144-883a-e1b5f89bd65a
115+
// kind: Certificate
116+
// metadata: Note that the owner
117+
// namespace: cert-1 reference does not
118+
// ownerReferences: have a namespace,
119+
// - controller: true since owner refs
120+
// apiVersion: networking.x-k8s.io/v1alpha1 only work inside
121+
// kind: Gateway the same namespace.
122+
// name: gateway-1
123+
// blockOwnerDeletion: true
124+
// uid: 7d3897c2-ce27-4144-883a-e1b5f89bd65a
125125
func certificateHandler(queue workqueue.RateLimitingInterface) func(obj interface{}) {
126126
return func(obj interface{}) {
127127
crt, ok := obj.(*cmapi.Certificate)

pkg/controller/certificate-shim/helper.go

+17-17
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,26 @@ var (
3838
// translateAnnotations updates the Certificate spec using the ingress-like
3939
// annotations. For example, the following Ingress:
4040
//
41-
// kind: Ingress
42-
// metadata:
43-
// annotations:
44-
// cert-manager.io/common-name: example.com
45-
// cert-manager.io/duration: 2160h
46-
// cert-manager.io/renew-before: 1440h
47-
// cert-manager.io/usages: "digital signature,key encipherment"
48-
// cert-manager.io/revision-history-limit: 7
41+
// kind: Ingress
42+
// metadata:
43+
// annotations:
44+
// cert-manager.io/common-name: example.com
45+
// cert-manager.io/duration: 2160h
46+
// cert-manager.io/renew-before: 1440h
47+
// cert-manager.io/usages: "digital signature,key encipherment"
48+
// cert-manager.io/revision-history-limit: 7
4949
//
5050
// is mapped to the following Certificate:
5151
//
52-
// kind: Certificate
53-
// spec:
54-
// commonName: example.com
55-
// duration: 2160h
56-
// renewBefore: 1440h
57-
// usages:
58-
// - digital signature
59-
// - key encipherment
60-
// revisionHistoryLimit: 7
52+
// kind: Certificate
53+
// spec:
54+
// commonName: example.com
55+
// duration: 2160h
56+
// renewBefore: 1440h
57+
// usages:
58+
// - digital signature
59+
// - key encipherment
60+
// revisionHistoryLimit: 7
6161
func translateAnnotations(crt *cmapi.Certificate, ingLikeAnnotations map[string]string) error {
6262
if crt == nil {
6363
return errNilCertificate

pkg/controller/certificate-shim/ingresses/controller.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ func (c *controller) ProcessItem(ctx context.Context, key string) error {
110110
// example, the following Certificate "cert-1" is controlled by the Ingress
111111
// "ingress-1":
112112
//
113-
// kind: Certificate
114-
// metadata: Note that the owner
115-
// namespace: cert-1 reference does not
116-
// ownerReferences: have a namespace,
117-
// - controller: true since owner refs
118-
// apiVersion: networking.k8s.io/v1beta1 only work inside
119-
// kind: Ingress the same namespace.
120-
// name: ingress-1
121-
// blockOwnerDeletion: true
122-
// uid: 7d3897c2-ce27-4144-883a-e1b5f89bd65a
113+
// kind: Certificate
114+
// metadata: Note that the owner
115+
// namespace: cert-1 reference does not
116+
// ownerReferences: have a namespace,
117+
// - controller: true since owner refs
118+
// apiVersion: networking.k8s.io/v1beta1 only work inside
119+
// kind: Ingress the same namespace.
120+
// name: ingress-1
121+
// blockOwnerDeletion: true
122+
// uid: 7d3897c2-ce27-4144-883a-e1b5f89bd65a
123123
func certificateHandler(queue workqueue.RateLimitingInterface) func(obj interface{}) {
124124
return func(obj interface{}) {
125125
cert, ok := obj.(*cmapi.Certificate)

0 commit comments

Comments
 (0)