Added golangci-lint action (#197)

* added golangci-lint action

* linters

* cleanup linters

* fix error, increase timeout

* removed unnecessary call to Stringer
This commit is contained in:
Enrico Candino
2025-01-21 11:30:57 +01:00
committed by GitHub
parent e7671134d2
commit 0b3a5f250e
3 changed files with 27 additions and 1 deletions

View File

@@ -9,6 +9,23 @@ permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
args: --timeout=5m
version: v1.60
tests:
runs-on: ubuntu-latest

9
.golangci.yml Normal file
View File

@@ -0,0 +1,9 @@
linters:
enable:
# default linters
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused

View File

@@ -109,7 +109,7 @@ func (c *ControllerHandler) RemoveResource(ctx context.Context, obj client.Objec
ctrl, ok := c.controllers[obj.GetObjectKind().GroupVersionKind()]
c.RUnlock()
if !ok {
return fmt.Errorf("no controller found for gvk" + obj.GetObjectKind().GroupVersionKind().String())
return fmt.Errorf("no controller found for gvk %s", obj.GetObjectKind().GroupVersionKind())
}
return ctrl.RemoveResource(ctx, obj.GetNamespace(), obj.GetName())
}