Fix lint errors and bump golangci-lint to v2/action v9
CI / Test (linux/amd64) (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Cross-build (darwin/amd64) (push) Waiting to run
CI / Cross-build (linux/amd64) (push) Waiting to run
CI / Cross-build (darwin/arm64) (push) Waiting to run
CI / Cross-build (linux/arm64) (push) Waiting to run

- Migrate .golangci.yml to golangci-lint v2 config format
- Bump golangci-lint-action from v6 (Node 20, deprecated) to v9 (Node 24)
- Fix errcheck: check fmt.Fscanln and fmt.Sscanf return values
- Fix ineffassign: replace unused vars with _ in test files
- Fix revive unused-parameter: rename unused cmd/args/r/c params to _
- Fix revive empty-block: invert if condition in push command
- Fix revive redefines-builtin-id: rename 'clear' to 'clearsigned'
- Fix revive blank-imports: add comment on modernc.org/sqlite import
- Fix unused: remove unused 'suite' and 'gen' fields from cache entry
This commit is contained in:
2026-06-28 17:07:50 -05:00
parent f7ccf67b8a
commit c5e64cf63f
19 changed files with 84 additions and 71 deletions
+3 -3
View File
@@ -136,7 +136,7 @@ func TestRegisterFirstUserIsAdmin(t *testing.T) {
h.token = resp.Token
// /me with token
code, body = h.do("GET", "/api/v1/me", h.token, nil)
code, _ = h.do("GET", "/api/v1/me", h.token, nil)
if code != 200 {
t.Fatalf("me status %d", code)
}
@@ -199,7 +199,7 @@ func TestLoginAndAuthFlow(t *testing.T) {
}
// create token
code, body = h.do("POST", "/api/v1/me/tokens", resp.Token, map[string]string{"name": "laptop"})
code, _ = h.do("POST", "/api/v1/me/tokens", resp.Token, map[string]string{"name": "laptop"})
if code != 201 {
t.Fatalf("create token status %d", code)
}
@@ -241,7 +241,7 @@ func TestUsersAdminOnly(t *testing.T) {
t.Fatalf("non-admin list users should be 403, got %d", code)
}
// admin can list users
code, body = h.do("GET", "/api/v1/users", admin.Token, nil)
code, _ = h.do("GET", "/api/v1/users", admin.Token, nil)
if code != 200 {
t.Fatalf("admin list users should be 200, got %d", code)
}
+1 -1
View File
@@ -149,7 +149,7 @@ func TestPushPullDeletePackage(t *testing.T) {
}
// list
code, body = h.do("GET", "/api/v1/repositories/pkgrepo/distributions/stable/packages", owner.Token, nil)
code, _ = h.do("GET", "/api/v1/repositories/pkgrepo/distributions/stable/packages", owner.Token, nil)
if code != 200 {
t.Fatalf("list packages status %d", code)
}
+1 -1
View File
@@ -31,7 +31,7 @@ func TestRepoCreateAndPermissions(t *testing.T) {
}
// bob cannot see it (private, not a member)
code, body = h.do("GET", "/api/v1/repositories/myrepo", bob.Token, nil)
code, _ = h.do("GET", "/api/v1/repositories/myrepo", bob.Token, nil)
if code != 403 {
t.Fatalf("bob should be forbidden from private repo, got %d", code)
}
+1 -1
View File
@@ -28,7 +28,7 @@ func (api *API) ServerInfo(w http.ResponseWriter, r *http.Request) {
}
// ServerPubkey returns the ASCII-armored default signing key.
func (api *API) ServerPubkey(w http.ResponseWriter, r *http.Request) {
func (api *API) ServerPubkey(w http.ResponseWriter, _ *http.Request) {
if api.Signer == nil {
httputil.WriteError(w, http.StatusServiceUnavailable, httputil.CodeInternal, "no signing key configured")
return