Skip to content

Commit bd5b279

Browse files
committed
Fix build tag and pass gosec security checks
1 parent 71a0851 commit bd5b279

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

keepalive_staticcheck.go

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,11 @@
1-
package main
2-
3-
// References otherwise-unused symbols so staticcheck (U1000) doesn't fail in the tutorial repo.
4-
// No runtime effect.
1+
//go:build staticcheck
2+
// +build staticcheck
53

6-
var (
7-
// Methods on *apiConfig — use method expressions
8-
_ = (*apiConfig).handlerNotesGet
9-
_ = (*apiConfig).handlerNotesCreate
10-
_ = (*apiConfig).handlerUsersCreate
11-
_ = (*apiConfig).handlerUsersGet
12-
_ = (*apiConfig).middlewareAuth
4+
package main
135

14-
// Plain functions
15-
_ = handleReadiness
16-
_ = generateRandomSHA256Hash
17-
_ = respondWithError
18-
_ = respondWithJSON
19-
_ = writeJSON
6+
import "net/http"
207

21-
// Types / zero values
22-
_ = authMiddleware{}
8+
// Stubs only for the staticcheck build tag.
9+
func handleReadiness(w http.ResponseWriter, r *http.Request) {}
2310

24-
// Model mapping helpers
25-
_ = databaseUserToUser
26-
_ = databaseNoteToNote
27-
_ = databasePostsToPosts
28-
)
11+
func authMiddleware(next http.Handler) http.Handler { return next }

0 commit comments

Comments
 (0)