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
-2
View File
@@ -19,8 +19,6 @@ type IndexCache struct {
type entry struct {
indices *apt.Indices
suite *apt.Suite
gen int64
dirty bool
}
+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
+4 -4
View File
@@ -136,11 +136,11 @@ func TestListPackages_FiltersAndPagination(t *testing.T) {
}
// Filter by arch (matches arch OR 'all').
list, total, _ = s.ListPackages(ctx, repo.ID, d.ID, PackageFilters{Arch: "amd64"}, 1, 100)
_, total, _ = s.ListPackages(ctx, repo.ID, d.ID, PackageFilters{Arch: "amd64"}, 1, 100)
if total != 3 { // alpha, beta, delta
t.Fatalf("amd64 filter: expected 3, got %d", total)
}
list, total, _ = s.ListPackages(ctx, repo.ID, d.ID, PackageFilters{Arch: "arm64"}, 1, 100)
_, total, _ = s.ListPackages(ctx, repo.ID, d.ID, PackageFilters{Arch: "arm64"}, 1, 100)
if total != 2 { // gamma, epsilon
t.Fatalf("arm64 filter: expected 2, got %d", total)
}
@@ -152,7 +152,7 @@ func TestListPackages_FiltersAndPagination(t *testing.T) {
}
// Query (LIKE on name/description).
list, total, _ = s.ListPackages(ctx, repo.ID, d.ID, PackageFilters{Query: "a test"}, 1, 100)
_, total, _ = s.ListPackages(ctx, repo.ID, d.ID, PackageFilters{Query: "a test"}, 1, 100)
if total != 5 {
t.Fatalf("query filter: expected all 5 to match description, got %d", total)
}
@@ -163,7 +163,7 @@ func TestListPackages_FiltersAndPagination(t *testing.T) {
t.Fatalf("page 1: total=%d len=%d", total, len(list))
}
// page 3 -> only 1 item.
list, total, _ = s.ListPackages(ctx, repo.ID, d.ID, PackageFilters{}, 3, 2)
list, _, _ = s.ListPackages(ctx, repo.ID, d.ID, PackageFilters{}, 3, 2)
if len(list) != 1 {
t.Fatalf("page 3: expected 1 item, got %d", len(list))
}