Skip to content

Commit 3f63dd9

Browse files
committed
style(staticcheck): error strings should not be capitalized
1 parent ef31bd4 commit 3f63dd9

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

examples/authenticated-api/echo/server/jwt_authenticator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ type JWSValidator interface {
2121
const JWTClaimsContextKey = "jwt_claims"
2222

2323
var (
24-
ErrNoAuthHeader = errors.New("Authorization header is missing")
25-
ErrInvalidAuthHeader = errors.New("Authorization header is malformed")
26-
ErrClaimsInvalid = errors.New("Provided claims do not match expected scopes")
24+
ErrNoAuthHeader = errors.New("authorization header is missing")
25+
ErrInvalidAuthHeader = errors.New("authorization header is malformed")
26+
ErrClaimsInvalid = errors.New("provided claims do not match expected scopes")
2727
)
2828

2929
// GetJWSFromRequest extracts a JWS string from an Authorization: Bearer <jws> header

examples/authenticated-api/stdhttp/server/jwt_authenticator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ type JWSValidator interface {
2020
const JWTClaimsContextKey = "jwt_claims"
2121

2222
var (
23-
ErrNoAuthHeader = errors.New("Authorization header is missing")
24-
ErrInvalidAuthHeader = errors.New("Authorization header is malformed")
25-
ErrClaimsInvalid = errors.New("Provided claims do not match expected scopes")
23+
ErrNoAuthHeader = errors.New("authorization header is missing")
24+
ErrInvalidAuthHeader = errors.New("authorization header is malformed")
25+
ErrClaimsInvalid = errors.New("provided claims do not match expected scopes")
2626
)
2727

2828
// GetJWSFromRequest extracts a JWS string from an Authorization: Bearer <jws> header

pkg/codegen/operations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ func (o *OperationDefinition) GetResponseTypeDefinitions() ([]ResponseTypeDefini
300300
if contentType.Schema != nil {
301301
responseSchema, err := GenerateGoSchema(contentType.Schema, []string{o.OperationId, responseName})
302302
if err != nil {
303-
return nil, fmt.Errorf("Unable to determine Go type for %s.%s: %w", o.OperationId, contentTypeName, err)
303+
return nil, fmt.Errorf("unable to determine Go type for %s.%s: %w", o.OperationId, contentTypeName, err)
304304
}
305305

306306
var typeName string

pkg/ecdsafile/ecdsafile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func LoadEcdsaPublicKey(buf []byte) (*ecdsa.PublicKey, error) {
2929
// which supports multiple types of keys.
3030
keyIface, err := x509.ParsePKIXPublicKey(block.Bytes)
3131
if err != nil {
32-
return nil, fmt.Errorf("Error loading public key: %w", err)
32+
return nil, fmt.Errorf("error loading public key: %w", err)
3333
}
3434

3535
// Now, we're assuming the key content is ECDSA, and converting.
@@ -53,7 +53,7 @@ func LoadEcdsaPrivateKey(buf []byte) (*ecdsa.PrivateKey, error) {
5353
// and we're assuming this encoding contains X509 key material.
5454
privateKey, err := x509.ParseECPrivateKey(block.Bytes)
5555
if err != nil {
56-
return nil, fmt.Errorf("Error loading private ECDSA key: %w", err)
56+
return nil, fmt.Errorf("error loading private ECDSA key: %w", err)
5757
}
5858
return privateKey, nil
5959
}

pkg/util/loader.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,24 @@ func LoadSwaggerWithOverlay(filePath string, opts LoadSwaggerWithOverlayOpts) (s
6666

6767
err = overlay.Validate()
6868
if err != nil {
69-
return nil, fmt.Errorf("The Overlay in %#v was not valid: %v", opts.Path, err)
69+
return nil, fmt.Errorf("the Overlay in %#v was not valid: %v", opts.Path, err)
7070
}
7171

7272
if opts.Strict {
7373
err, vs := overlay.ApplyToStrict(&node)
7474
if err != nil {
75-
return nil, fmt.Errorf("Failed to apply Overlay %#v to specification %#v: %v\nAdditionally, the following validation errors were found:\n- %s", opts.Path, filePath, err, strings.Join(vs, "\n- "))
75+
return nil, fmt.Errorf("failed to apply Overlay %#v to specification %#v: %v\nAdditionally, the following validation errors were found:\n- %s", opts.Path, filePath, err, strings.Join(vs, "\n- "))
7676
}
7777
} else {
7878
err = overlay.ApplyTo(&node)
7979
if err != nil {
80-
return nil, fmt.Errorf("Failed to apply Overlay %#v to specification %#v: %v", opts.Path, filePath, err)
80+
return nil, fmt.Errorf("failed to apply Overlay %#v to specification %#v: %v", opts.Path, filePath, err)
8181
}
8282
}
8383

8484
b, err := yaml.Marshal(&node)
8585
if err != nil {
86-
return nil, fmt.Errorf("Failed to serialize Overlay'd specification %#v: %v", opts.Path, err)
86+
return nil, fmt.Errorf("failed to serialize Overlay'd specification %#v: %v", opts.Path, err)
8787
}
8888

8989
loader := openapi3.NewLoader()
@@ -93,7 +93,7 @@ func LoadSwaggerWithOverlay(filePath string, opts LoadSwaggerWithOverlayOpts) (s
9393
Path: filepath.ToSlash(filePath),
9494
})
9595
if err != nil {
96-
return nil, fmt.Errorf("Failed to serialize Overlay'd specification %#v: %v", opts.Path, err)
96+
return nil, fmt.Errorf("failed to serialize Overlay'd specification %#v: %v", opts.Path, err)
9797
}
9898

9999
return swagger, nil

0 commit comments

Comments
 (0)