Skip to content

Commit

Permalink
Fix lint checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyp committed Oct 21, 2024
1 parent 6e29506 commit 7fc0b73
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
4 changes: 1 addition & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ issues:
- scopelint # Otherwise you need tc := tc. This isn't actually a problem unless tests are being run in parallel.
- lll # Don't do line length checks in test code.
- dupl # Sometimes we duplicate a bunch in tests for the sake of clarity.
- gosec # Don't run gosec, it's insecure because it's a test
- path: nacl/secretbox
linters:
- gosec # Don't run gosec on nacl/secretbox* because we know it uses crypto/md5. TODO: Evaluate if this makes sense.
Expand All @@ -43,9 +44,6 @@ issues:
- path: grpc/
linters:
- lll # GRPC code has notoriously long function signatures.
- path: testing/mustcert/example_test.go
linters:
- gosec # Don't run gosec, it's insecure because it's a test

linters-settings:
misspell:
Expand Down
12 changes: 2 additions & 10 deletions dynoid/example_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dynoid_test

import (
"context"
"fmt"

"github.com/heroku/x/dynoid"
Expand All @@ -10,17 +9,10 @@ import (

const AUDIENCE = "testing"

var (
ctx context.Context
token string
)

func init() {
func ExampleVerifier() {
// Normally a token would be passed in, but for testing we'll generate one
ctx, token = internal.GenerateToken(AUDIENCE)
}
ctx, token := internal.GenerateToken(AUDIENCE)

func ExampleVerifier() {
verifier := dynoid.New(AUDIENCE)
verifier.IssuerCallback = dynoid.AllowHerokuHost("heroku.local") // heroku.com for production

Expand Down
4 changes: 3 additions & 1 deletion dynoid/middleware/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ const AUDIENCE = "testing"
func Example() {
authorized := middleware.AuthorizeSameSpace(AUDIENCE)
secureHandler := authorized(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
io.WriteString(w, "Hello from a secure endpoint!\n")
if _, err := io.WriteString(w, "Hello from a secure endpoint!\n"); err != nil {
log.Printf("error writing response (%v)", err)
}
}))

http.Handle("/secure", secureHandler)
Expand Down

0 comments on commit 7fc0b73

Please sign in to comment.