From aa84fa41be5dff8ff91f56caaddff41b4f7c8fb0 Mon Sep 17 00:00:00 2001 From: Andrew Nesbitt Date: Mon, 16 Feb 2026 10:15:17 +0000 Subject: [PATCH 1/3] Update Go module dependencies --- go.mod | 14 +++++++------- go.sum | 34 ++++++++++++++++++---------------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/go.mod b/go.mod index e7a5e92..b6ad72b 100644 --- a/go.mod +++ b/go.mod @@ -4,23 +4,23 @@ go 1.25.6 require ( code.gitea.io/sdk/gitea v0.23.2 - github.com/git-pkgs/purl v0.1.5 + github.com/git-pkgs/purl v0.1.8 github.com/google/go-github/v82 v82.0.0 - gitlab.com/gitlab-org/api/client-go v1.28.0 + gitlab.com/gitlab-org/api/client-go v1.34.0 ) require ( github.com/42wim/httpsig v1.2.3 // indirect github.com/davidmz/go-pageant v1.0.2 // indirect + github.com/git-pkgs/packageurl-go v0.2.1 // indirect github.com/git-pkgs/vers v0.2.2 // indirect github.com/go-fed/httpsig v1.1.0 // indirect github.com/google/go-querystring v1.2.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.8 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect - github.com/package-url/packageurl-go v0.1.3 // indirect - golang.org/x/crypto v0.39.0 // indirect - golang.org/x/oauth2 v0.34.0 // indirect - golang.org/x/sys v0.39.0 // indirect + github.com/hashicorp/go-version v1.8.0 // indirect + golang.org/x/crypto v0.48.0 // indirect + golang.org/x/oauth2 v0.35.0 // indirect + golang.org/x/sys v0.41.0 // indirect golang.org/x/time v0.14.0 // indirect ) diff --git a/go.sum b/go.sum index 09af8d1..2ee8456 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,10 @@ github.com/davidmz/go-pageant v1.0.2 h1:bPblRCh5jGU+Uptpz6LgMZGD5hJoOt7otgT454Wv github.com/davidmz/go-pageant v1.0.2/go.mod h1:P2EDDnMqIwG5Rrp05dTRITj9z2zpGcD9efWSkTNKLIE= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= -github.com/git-pkgs/purl v0.1.5 h1:OsOHkhFPEzVaro+mtEajlYn88vRuRF34wtH5JtLaXH0= -github.com/git-pkgs/purl v0.1.5/go.mod h1:4RPpP/nJBGljfUiSpyIcFsieXLUahEoH0gSwjWfjhUQ= +github.com/git-pkgs/packageurl-go v0.2.1 h1:j6VnjJiYS9b1nTLfJGsG6SLaA7Nk6Io+ta8grOyTa4o= +github.com/git-pkgs/packageurl-go v0.2.1/go.mod h1:rcIxiG37BlQLB6FZfgdj9Fm7yjhRQd3l+5o7J0QPAk4= +github.com/git-pkgs/purl v0.1.8 h1:iyjEHM2WIZUL9A3+q9ylrabqILsN4nOay9X6jfEjmzQ= +github.com/git-pkgs/purl v0.1.8/go.mod h1:ihlHw3bnSLXat+9Nl9MsJZBYiG7s3NkwmvE3L/Es/sI= github.com/git-pkgs/vers v0.2.2 h1:42QkiIURhGN2wM8AuYYU+FbzS1YV6jmdGd1RiFp7gXs= github.com/git-pkgs/vers v0.2.2/go.mod h1:biTbSQK1qdbrsxDEKnqe3Jzclxz8vW6uDcwKjfUGcOo= github.com/go-fed/httpsig v1.1.0 h1:9M+hb0jkEICD8/cAiNqEB66R87tTINszBRTjwjQzWcI= @@ -21,43 +23,43 @@ github.com/google/go-github/v82 v82.0.0 h1:OH09ESON2QwKCUVMYmMcVu1IFKFoaZHwqYaUt github.com/google/go-github/v82 v82.0.0/go.mod h1:hQ6Xo0VKfL8RZ7z1hSfB4fvISg0QqHOqe9BP0qo+WvM= github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0= github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU= +github.com/graph-gophers/graphql-go v1.8.0 h1:NT05/H+PdH1/PONExlUycnhULYHBy98dxV63WYc0Ng8= +github.com/graph-gophers/graphql-go v1.8.0/go.mod h1:23olKZ7duEvHlF/2ELEoSZaY1aNPfShjP782SOoNTyM= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-retryablehttp v0.7.8 h1:ylXZWnqa7Lhqpk0L1P1LzDtGcCR0rPVUrx/c8Unxc48= github.com/hashicorp/go-retryablehttp v0.7.8/go.mod h1:rjiScheydd+CxvumBsIrFKlx3iS0jrZ7LvzFGFmuKbw= -github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= -github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.8.0 h1:KAkNb1HAiZd1ukkxDFGmokVZe1Xy9HG6NUp+bPle2i4= +github.com/hashicorp/go-version v1.8.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/package-url/packageurl-go v0.1.3 h1:4juMED3hHiz0set3Vq3KeQ75KD1avthoXLtmE3I0PLs= -github.com/package-url/packageurl-go v0.1.3/go.mod h1:nKAWB8E6uk1MHqiS/lQb9pYBGH2+mdJ2PJc2s50dQY0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gitlab.com/gitlab-org/api/client-go v1.28.0 h1:H28kppWq0/ec5MV3o1dbjOiHegaQgBE4KS5EfgaJdRM= -gitlab.com/gitlab-org/api/client-go v1.28.0/go.mod h1:r060AandE8Md/L5oKdUVjljL8YQprOAxKzUnpqWqP3A= +gitlab.com/gitlab-org/api/client-go v1.34.0 h1:w/Zv3FmfrkZsVUJhzteAu0LsWsz2y7kv/XJ3pvRa+Eo= +gitlab.com/gitlab-org/api/client-go v1.34.0/go.mod h1:nsUbXSLfne+sl+j62f7S3LFNwQ5Ey96oG9QToJT4aTM= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= -golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= -golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= +golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts= +golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= -golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.35.0 h1:Mv2mzuHuZuY2+bkyWXIHMfhNdJAdwW3FuWeCPYN5GVQ= +golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= -golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= +golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= -golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= +golang.org/x/term v0.40.0 h1:36e4zGLqU4yhjlmxEaagx2KuYbJq3EwY8K943ZsHcvg= +golang.org/x/term v0.40.0/go.mod h1:w2P8uVp06p2iyKKuvXIm7N/y0UCRt3UfJTfZ7oOpglM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= From 412a6b03bd94de42ef52864ed9efbb4d6a0af145 Mon Sep 17 00:00:00 2001 From: Andrew Nesbitt Date: Mon, 16 Feb 2026 10:23:43 +0000 Subject: [PATCH 2/3] Fix lint errors: errcheck and deprecated MergeRequestsEnabled --- bitbucket.go | 2 +- bitbucket_test.go | 6 +++--- detect.go | 6 +++--- forges_test.go | 8 ++++---- gitlab.go | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bitbucket.go b/bitbucket.go index cb6bc72..aae15ff 100644 --- a/bitbucket.go +++ b/bitbucket.go @@ -87,7 +87,7 @@ func (f *bitbucketForge) getJSON(ctx context.Context, url string, v any) error { if err != nil { return err } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() if resp.StatusCode == http.StatusNotFound { return ErrNotFound diff --git a/bitbucket_test.go b/bitbucket_test.go index 422746b..7174c4b 100644 --- a/bitbucket_test.go +++ b/bitbucket_test.go @@ -15,7 +15,7 @@ func TestBitbucketFetchRepository(t *testing.T) { if auth := r.Header.Get("Authorization"); auth != "Bearer test-bb-token" { t.Errorf("expected Bearer token, got %q", auth) } - json.NewEncoder(w).Encode(bbRepository{ + _ = json.NewEncoder(w).Encode(bbRepository{ Slug: "stash-example-plugin", Name: "stash-example-plugin", FullName: "atlassian/stash-example-plugin", @@ -110,7 +110,7 @@ func TestBitbucketFetchRepositoryNotFound(t *testing.T) { func TestBitbucketListRepositories(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /2.0/repositories/atlassian", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode(map[string]any{ + _ = json.NewEncoder(w).Encode(map[string]any{ "values": []bbRepository{ { Slug: "repo-a", @@ -178,7 +178,7 @@ func TestBitbucketListRepositoriesNotFound(t *testing.T) { func TestBitbucketFetchTags(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /2.0/repositories/atlassian/myrepo/refs/tags", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode(bbTagsResponse{ + _ = json.NewEncoder(w).Encode(bbTagsResponse{ Values: []bbTag{ {Name: "v1.0.0", Target: struct { Hash string `json:"hash"` diff --git a/detect.go b/detect.go index eaa7f1b..9a739b9 100644 --- a/detect.go +++ b/detect.go @@ -31,7 +31,7 @@ func detectFromHeaders(ctx context.Context, baseURL string) (ForgeType, error) { if err != nil { return Unknown, err } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() if resp.Header.Get("X-Forgejo-Version") != "" { return Forgejo, nil @@ -78,7 +78,7 @@ func probeGiteaAPI(ctx context.Context, baseURL string) (ForgeType, error) { if err != nil { return Unknown, err } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() if resp.StatusCode != http.StatusOK { return Unknown, fmt.Errorf("status %d", resp.StatusCode) @@ -107,7 +107,7 @@ func probeURL(ctx context.Context, url string) (bool, error) { if err != nil { return false, err } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() return resp.StatusCode == http.StatusOK, nil } diff --git a/forges_test.go b/forges_test.go index 1ab0210..12ce8b9 100644 --- a/forges_test.go +++ b/forges_test.go @@ -222,7 +222,7 @@ func TestDetectForgeTypeGiteaAPI(t *testing.T) { w.WriteHeader(http.StatusOK) }) mux.HandleFunc("GET /api/v1/version", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"version":"1.21.0"}`) + _, _ = fmt.Fprintf(w,`{"version":"1.21.0"}`) }) srv := httptest.NewServer(mux) @@ -243,7 +243,7 @@ func TestDetectForgeTypeForgejoAPI(t *testing.T) { w.WriteHeader(http.StatusOK) }) mux.HandleFunc("GET /api/v1/version", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"version":"7.0.0+forgejo"}`) + _, _ = fmt.Fprintf(w,`{"version":"7.0.0+forgejo"}`) }) srv := httptest.NewServer(mux) @@ -267,7 +267,7 @@ func TestDetectForgeTypeGitLabAPI(t *testing.T) { w.WriteHeader(http.StatusNotFound) }) mux.HandleFunc("GET /api/v4/version", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"version":"16.0.0"}`) + _, _ = fmt.Fprintf(w,`{"version":"16.0.0"}`) }) srv := httptest.NewServer(mux) @@ -294,7 +294,7 @@ func TestDetectForgeTypeGitHubAPI(t *testing.T) { w.WriteHeader(http.StatusNotFound) }) mux.HandleFunc("GET /api/v3/meta", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"verifiable_password_authentication": true}`) + _, _ = fmt.Fprintf(w,`{"verifiable_password_authentication": true}`) }) srv := httptest.NewServer(mux) diff --git a/gitlab.go b/gitlab.go index c5f2ba2..fad8023 100644 --- a/gitlab.go +++ b/gitlab.go @@ -35,7 +35,7 @@ func convertGitLabProject(p *gitlab.Project) Repository { ForksCount: int(p.ForksCount), OpenIssuesCount: int(p.OpenIssuesCount), HasIssues: true, - PullRequestsEnabled: p.MergeRequestsEnabled, + PullRequestsEnabled: p.MergeRequestsAccessLevel != gitlab.DisabledAccessControl, Topics: p.Topics, } From 9711fdb2ef6d08376affd55edc1adaedfc73c806 Mon Sep 17 00:00:00 2001 From: Andrew Nesbitt Date: Mon, 16 Feb 2026 10:28:17 +0000 Subject: [PATCH 3/3] Fix remaining errcheck lint errors in test files --- gitea_test.go | 12 ++++++------ github_test.go | 16 ++++++++-------- gitlab_test.go | 12 ++++++------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/gitea_test.go b/gitea_test.go index 7355a68..ee5840d 100644 --- a/gitea_test.go +++ b/gitea_test.go @@ -13,7 +13,7 @@ import ( // giteaVersionHandler serves the /api/v1/version endpoint that the Gitea SDK // requires during client creation. func giteaVersionHandler(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"version":"1.21.0"}`) + _, _ = fmt.Fprintf(w, `{"version":"1.21.0"}`) } func TestGiteaFetchRepository(t *testing.T) { @@ -23,7 +23,7 @@ func TestGiteaFetchRepository(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v1/version", giteaVersionHandler) mux.HandleFunc("GET /api/v1/repos/testorg/testrepo", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode(map[string]any{ + _ = json.NewEncoder(w).Encode(map[string]any{ "full_name": "testorg/testrepo", "name": "testrepo", "description": "A Gitea repo", @@ -55,7 +55,7 @@ func TestGiteaFetchRepository(t *testing.T) { }) }) mux.HandleFunc("GET /api/v1/repos/testorg/testrepo/topics", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode(map[string]any{ + _ = json.NewEncoder(w).Encode(map[string]any{ "topics": []string{"python", "machine-learning"}, }) }) @@ -115,7 +115,7 @@ func TestGiteaListRepositories(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v1/version", giteaVersionHandler) mux.HandleFunc("GET /api/v1/orgs/testorg/repos", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode([]map[string]any{ + _ = json.NewEncoder(w).Encode([]map[string]any{ { "full_name": "testorg/repo-a", "name": "repo-a", @@ -168,7 +168,7 @@ func TestGiteaListRepositoriesFallbackToUser(t *testing.T) { w.WriteHeader(http.StatusNotFound) }) mux.HandleFunc("GET /api/v1/users/someuser/repos", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode([]map[string]any{ + _ = json.NewEncoder(w).Encode([]map[string]any{ { "full_name": "someuser/personal", "name": "personal", @@ -203,7 +203,7 @@ func TestGiteaFetchTags(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v1/version", giteaVersionHandler) mux.HandleFunc("GET /api/v1/repos/testorg/testrepo/tags", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode([]map[string]any{ + _ = json.NewEncoder(w).Encode([]map[string]any{ { "name": "v3.0.0", "id": "sha-tag-1", diff --git a/github_test.go b/github_test.go index 9b64396..1c67ad1 100644 --- a/github_test.go +++ b/github_test.go @@ -13,7 +13,7 @@ import ( func TestGitHubFetchRepository(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v3/repos/octocat/hello-world", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode(github.Repository{ + _ = json.NewEncoder(w).Encode(github.Repository{ FullName: ptr("octocat/hello-world"), Name: ptr("hello-world"), Description: ptr("My first repository"), @@ -88,7 +88,7 @@ func TestGitHubFetchRepositoryNotFound(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v3/repos/octocat/nonexistent", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotFound) - json.NewEncoder(w).Encode(map[string]string{"message": "Not Found"}) + _ = json.NewEncoder(w).Encode(map[string]string{"message": "Not Found"}) }) srv := httptest.NewServer(mux) @@ -107,7 +107,7 @@ func TestGitHubFetchRepositoryNotFound(t *testing.T) { func TestGitHubFetchRepositoryNoassertionLicense(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v3/repos/test/noassertion", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode(github.Repository{ + _ = json.NewEncoder(w).Encode(github.Repository{ FullName: ptr("test/noassertion"), Name: ptr("noassertion"), Owner: &github.User{Login: ptr("test")}, @@ -134,7 +134,7 @@ func TestGitHubFetchRepositoryNoassertionLicense(t *testing.T) { func TestGitHubListRepositories(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v3/orgs/myorg/repos", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode([]*github.Repository{ + _ = json.NewEncoder(w).Encode([]*github.Repository{ { FullName: ptr("myorg/repo-a"), Name: ptr("repo-a"), @@ -176,10 +176,10 @@ func TestGitHubListRepositoriesFallbackToUser(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v3/orgs/someuser/repos", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotFound) - json.NewEncoder(w).Encode(map[string]string{"message": "Not Found"}) + _ = json.NewEncoder(w).Encode(map[string]string{"message": "Not Found"}) }) mux.HandleFunc("GET /api/v3/users/someuser/repos", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode([]*github.Repository{ + _ = json.NewEncoder(w).Encode([]*github.Repository{ { FullName: ptr("someuser/personal"), Name: ptr("personal"), @@ -210,7 +210,7 @@ func TestGitHubListRepositoriesFallbackToUser(t *testing.T) { func TestGitHubListRepositoriesWithFilters(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v3/orgs/myorg/repos", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode([]*github.Repository{ + _ = json.NewEncoder(w).Encode([]*github.Repository{ { FullName: ptr("myorg/active"), Name: ptr("active"), @@ -258,7 +258,7 @@ func TestGitHubListRepositoriesWithFilters(t *testing.T) { func TestGitHubFetchTags(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v3/repos/octocat/hello-world/tags", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode([]github.RepositoryTag{ + _ = json.NewEncoder(w).Encode([]github.RepositoryTag{ { Name: ptr("v1.0.0"), Commit: &github.Commit{SHA: ptr("abc123")}, diff --git a/gitlab_test.go b/gitlab_test.go index fd2d7da..2b9b0df 100644 --- a/gitlab_test.go +++ b/gitlab_test.go @@ -16,7 +16,7 @@ func TestGitLabFetchRepository(t *testing.T) { mux := http.NewServeMux() // GitLab SDK URL-encodes the project path: mygroup/myrepo -> mygroup%2Fmyrepo mux.HandleFunc("GET /api/v4/projects/mygroup%2Fmyrepo", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode(map[string]any{ + _ = json.NewEncoder(w).Encode(map[string]any{ "path_with_namespace": "mygroup/myrepo", "name": "myrepo", "description": "A GitLab project", @@ -78,7 +78,7 @@ func TestGitLabFetchRepositoryNotFound(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v4/projects/mygroup%2Fnonexistent", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotFound) - json.NewEncoder(w).Encode(map[string]string{"message": "404 Project Not Found"}) + _ = json.NewEncoder(w).Encode(map[string]string{"message": "404 Project Not Found"}) }) srv := httptest.NewServer(mux) @@ -95,7 +95,7 @@ func TestGitLabFetchRepositoryNotFound(t *testing.T) { func TestGitLabListRepositories(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v4/groups/mygroup/projects", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode([]map[string]any{ + _ = json.NewEncoder(w).Encode([]map[string]any{ { "path_with_namespace": "mygroup/project-a", "name": "project-a", @@ -140,10 +140,10 @@ func TestGitLabListRepositoriesFallbackToUser(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v4/groups/someuser/projects", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotFound) - json.NewEncoder(w).Encode(map[string]string{"message": "404 Group Not Found"}) + _ = json.NewEncoder(w).Encode(map[string]string{"message": "404 Group Not Found"}) }) mux.HandleFunc("GET /api/v4/users/someuser/projects", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode([]map[string]any{ + _ = json.NewEncoder(w).Encode([]map[string]any{ { "path_with_namespace": "someuser/personal", "name": "personal", @@ -174,7 +174,7 @@ func TestGitLabListRepositoriesFallbackToUser(t *testing.T) { func TestGitLabFetchTags(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("GET /api/v4/projects/mygroup%2Fmyrepo/repository/tags", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode([]map[string]any{ + _ = json.NewEncoder(w).Encode([]map[string]any{ { "name": "v2.0.0", "commit": map[string]string{"id": "aaa111"},