Skip to content

Commit c75ee12

Browse files
committed
Add golangci-lint to CI with minimal config.
Enforce standard linters in GitHub Actions and fix unchecked Close calls flagged by errcheck.
1 parent ce0c294 commit c75ee12

5 files changed

Lines changed: 15 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ jobs:
3434
- name: Go vet
3535
run: go vet ./...
3636

37+
- name: Run golangci-lint
38+
uses: golangci/golangci-lint-action@v9
39+
with:
40+
version: v2.12
41+
3742
- name: Build Linux amd64 binary
3843
run: |
3944
mkdir -p dist

.golangci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: "2"
2+
3+
linters:
4+
default: standard
5+
6+
run:
7+
timeout: 5m

internal/catalog/builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ func decodeHelmRelease(data []byte) ([]byte, error) {
363363
if err != nil {
364364
return nil, err
365365
}
366-
defer gr.Close()
366+
defer func() { _ = gr.Close() }()
367367

368368
decoded, err := io.ReadAll(gr)
369369
if err != nil {

internal/resolver/oci_resolver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ func (r *OCIResolver) negotiateBearerToken(ctx context.Context, wwwAuthenticate,
310310
if err != nil {
311311
return "", fmt.Errorf("fetch oci token: %w", err)
312312
}
313-
defer tokResp.Body.Close()
313+
defer func() { _ = tokResp.Body.Close() }()
314314

315315
if tokResp.StatusCode != http.StatusOK {
316316
return "", fmt.Errorf("oci token status: %s", tokResp.Status)

internal/resolver/repository_resolver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (r *RepositoryResolver) RefreshRepoIndex(ctx context.Context, repoURL strin
9696
if err != nil {
9797
return model.RepoCacheEntry{}, fmt.Errorf("fetch index.yaml: %w", err)
9898
}
99-
defer resp.Body.Close()
99+
defer func() { _ = resp.Body.Close() }()
100100

101101
if resp.StatusCode != http.StatusOK {
102102
return model.RepoCacheEntry{}, fmt.Errorf("fetch index.yaml status: %s", resp.Status)

0 commit comments

Comments
 (0)