Skip to content

Commit fe04f93

Browse files
committed
all: reformat all go files with the next gofmt (Go 1.19)
There are some changes that manually edited, for example using '-' as default list and grouping imports.
1 parent 304cc5a commit fe04f93

File tree

15 files changed

+102
-78
lines changed

15 files changed

+102
-78
lines changed

acme/api/eab.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,11 @@ func keysAreEqual(x, y *jose.JSONWebKey) bool {
107107

108108
// validateEABJWS verifies the contents of the External Account Binding JWS.
109109
// The protected header of the JWS MUST meet the following criteria:
110-
// o The "alg" field MUST indicate a MAC-based algorithm
111-
// o The "kid" field MUST contain the key identifier provided by the CA
112-
// o The "nonce" field MUST NOT be present
113-
// o The "url" field MUST be set to the same value as the outer JWS
110+
//
111+
// - The "alg" field MUST indicate a MAC-based algorithm
112+
// - The "kid" field MUST contain the key identifier provided by the CA
113+
// - The "nonce" field MUST NOT be present
114+
// - The "url" field MUST be set to the same value as the outer JWS
114115
func validateEABJWS(ctx context.Context, jws *jose.JSONWebSignature) (string, *acme.Error) {
115116
if jws == nil {
116117
return "", acme.NewErrorISE("no JWS provided")

acme/api/middleware.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ func parseJWS(next nextHTTP) nextHTTP {
119119
// The JWS Unprotected Header [RFC7515] MUST NOT be used
120120
// The JWS Payload MUST NOT be detached
121121
// The JWS Protected Header MUST include the following fields:
122-
// * “alg” (Algorithm)
123-
// * This field MUST NOT contain “none” or a Message Authentication Code
124-
// (MAC) algorithm (e.g. one in which the algorithm registry description
125-
// mentions MAC/HMAC).
126-
// * “nonce” (defined in Section 6.5)
127-
// * “url” (defined in Section 6.4)
128-
// * Either “jwk” (JSON Web Key) or “kid” (Key ID) as specified below<Paste>
122+
// - “alg” (Algorithm).
123+
// This field MUST NOT contain “none” or a Message Authentication Code
124+
// (MAC) algorithm (e.g. one in which the algorithm registry description
125+
// mentions MAC/HMAC).
126+
// - “nonce” (defined in Section 6.5)
127+
// - “url” (defined in Section 6.4)
128+
// - Either “jwk” (JSON Web Key) or “kid” (Key ID) as specified below<Paste>
129129
func validateJWS(next nextHTTP) nextHTTP {
130130
return func(w http.ResponseWriter, r *http.Request) {
131131
ctx := r.Context()

authority/provisioner/aws.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,27 @@ const awsMetadataTokenTTLHeader = "X-aws-ec2-metadata-token-ttl-seconds"
5151
// signature.
5252
//
5353
// The first certificate is used in:
54-
// ap-northeast-2, ap-south-1, ap-southeast-1, ap-southeast-2
55-
// eu-central-1, eu-north-1, eu-west-1, eu-west-2, eu-west-3
56-
// us-east-1, us-east-2, us-west-1, us-west-2
57-
// ca-central-1, sa-east-1
54+
//
55+
// ap-northeast-2, ap-south-1, ap-southeast-1, ap-southeast-2
56+
// eu-central-1, eu-north-1, eu-west-1, eu-west-2, eu-west-3
57+
// us-east-1, us-east-2, us-west-1, us-west-2
58+
// ca-central-1, sa-east-1
5859
//
5960
// The second certificate is used in:
60-
// eu-south-1
61+
//
62+
// eu-south-1
6163
//
6264
// The third certificate is used in:
63-
// ap-east-1
65+
//
66+
// ap-east-1
6467
//
6568
// The fourth certificate is used in:
66-
// af-south-1
69+
//
70+
// af-south-1
6771
//
6872
// The fifth certificate is used in:
69-
// me-south-1
73+
//
74+
// me-south-1
7075
const awsCertificate = `-----BEGIN CERTIFICATE-----
7176
MIIDIjCCAougAwIBAgIJAKnL4UEDMN/FMA0GCSqGSIb3DQEBBQUAMGoxCzAJBgNV
7277
BAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdTZWF0dGxlMRgw

ca/bootstrap.go

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,18 @@ func Bootstrap(token string) (*Client, error) {
4848
// certificate after 2/3rd of the certificate's lifetime has expired.
4949
//
5050
// Usage:
51-
// // Default example with certificate rotation.
52-
// client, err := ca.BootstrapClient(ctx.Background(), token)
5351
//
54-
// // Example canceling automatic certificate rotation.
55-
// ctx, cancel := context.WithCancel(context.Background())
56-
// defer cancel()
57-
// client, err := ca.BootstrapClient(ctx, token)
58-
// if err != nil {
59-
// return err
60-
// }
61-
// resp, err := client.Get("https://internal.smallstep.com")
52+
// // Default example with certificate rotation.
53+
// client, err := ca.BootstrapClient(ctx.Background(), token)
54+
//
55+
// // Example canceling automatic certificate rotation.
56+
// ctx, cancel := context.WithCancel(context.Background())
57+
// defer cancel()
58+
// client, err := ca.BootstrapClient(ctx, token)
59+
// if err != nil {
60+
// return err
61+
// }
62+
// resp, err := client.Get("https://internal.smallstep.com")
6263
func BootstrapClient(ctx context.Context, token string, options ...TLSOption) (*http.Client, error) {
6364
b, err := createBootstrap(token)
6465
if err != nil {
@@ -96,23 +97,24 @@ func BootstrapClient(ctx context.Context, token string, options ...TLSOption) (*
9697
// ca.AddClientCA(*x509.Certificate).
9798
//
9899
// Usage:
99-
// // Default example with certificate rotation.
100-
// srv, err := ca.BootstrapServer(context.Background(), token, &http.Server{
101-
// Addr: ":443",
102-
// Handler: handler,
103-
// })
104100
//
105-
// // Example canceling automatic certificate rotation.
106-
// ctx, cancel := context.WithCancel(context.Background())
107-
// defer cancel()
108-
// srv, err := ca.BootstrapServer(ctx, token, &http.Server{
109-
// Addr: ":443",
110-
// Handler: handler,
111-
// })
112-
// if err != nil {
113-
// return err
114-
// }
115-
// srv.ListenAndServeTLS("", "")
101+
// // Default example with certificate rotation.
102+
// srv, err := ca.BootstrapServer(context.Background(), token, &http.Server{
103+
// Addr: ":443",
104+
// Handler: handler,
105+
// })
106+
//
107+
// // Example canceling automatic certificate rotation.
108+
// ctx, cancel := context.WithCancel(context.Background())
109+
// defer cancel()
110+
// srv, err := ca.BootstrapServer(ctx, token, &http.Server{
111+
// Addr: ":443",
112+
// Handler: handler,
113+
// })
114+
// if err != nil {
115+
// return err
116+
// }
117+
// srv.ListenAndServeTLS("", "")
116118
func BootstrapServer(ctx context.Context, token string, base *http.Server, options ...TLSOption) (*http.Server, error) {
117119
if base.TLSConfig != nil {
118120
return nil, errors.New("server TLSConfig is already set")
@@ -152,19 +154,20 @@ func BootstrapServer(ctx context.Context, token string, base *http.Server, optio
152154
// ca.AddClientCA(*x509.Certificate).
153155
//
154156
// Usage:
155-
// inner, err := net.Listen("tcp", ":443")
156-
// if err != nil {
157-
// return nil
158-
// }
159-
// ctx, cancel := context.WithCancel(context.Background())
160-
// defer cancel()
161-
// lis, err := ca.BootstrapListener(ctx, token, inner)
162-
// if err != nil {
163-
// return err
164-
// }
165-
// srv := grpc.NewServer()
166-
// ... // register services
167-
// srv.Serve(lis)
157+
//
158+
// inner, err := net.Listen("tcp", ":443")
159+
// if err != nil {
160+
// return nil
161+
// }
162+
// ctx, cancel := context.WithCancel(context.Background())
163+
// defer cancel()
164+
// lis, err := ca.BootstrapListener(ctx, token, inner)
165+
// if err != nil {
166+
// return err
167+
// }
168+
// srv := grpc.NewServer()
169+
// ... // register services
170+
// srv.Serve(lis)
168171
func BootstrapListener(ctx context.Context, token string, inner net.Listener, options ...TLSOption) (net.Listener, error) {
169172
b, err := createBootstrap(token)
170173
if err != nil {

ca/ca.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ func (ca *CA) shouldServeSCEPEndpoints() bool {
523523
return ca.auth.GetSCEPService() != nil
524524
}
525525

526-
//nolint // ignore linters to allow keeping this function around for debugging
526+
// nolint // ignore linters to allow keeping this function around for debugging
527527
func dumpRoutes(mux chi.Routes) {
528528
// helpful routine for logging all routes //
529529
walkFunc := func(method string, route string, handler http.Handler, middlewares ...func(http.Handler) http.Handler) error {

cas/cloudcas/cloudcas.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ func init() {
3232
var now = time.Now
3333

3434
// The actual regular expression that matches a certificate authority is:
35-
// ^projects/[a-z][a-z0-9-]{4,28}[a-z0-9]/locations/[a-z0-9-]+/caPools/[a-zA-Z0-9-_]+/certificateAuthorities/[a-zA-Z0-9-_]+$
35+
//
36+
// ^projects/[a-z][a-z0-9-]{4,28}[a-z0-9]/locations/[a-z0-9-]+/caPools/[a-zA-Z0-9-_]+/certificateAuthorities/[a-zA-Z0-9-_]+$
37+
//
3638
// But we will allow a more flexible one to fail if this changes.
3739
var caRegexp = regexp.MustCompile("^projects/[^/]+/locations/[^/]+/caPools/[^/]+/certificateAuthorities/[^/]+$")
3840

cas/cloudcas/mock_client_test.go

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cas/cloudcas/mock_operation_server_test.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

commands/onboard.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import (
2323

2424
// defaultOnboardingURL is the production onboarding url, to use a development
2525
// url use:
26-
// export STEP_CA_ONBOARDING_URL=http://localhost:3002/onboarding/
26+
//
27+
// export STEP_CA_ONBOARDING_URL=http://localhost:3002/onboarding/
2728
const defaultOnboardingURL = "https://api.smallstep.com/onboarding/"
2829

2930
type onboardingConfiguration struct {

kms/azurekms/internal/mock/key_vault_client.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)