mirror of
https://github.com/rancher/k3k.git
synced 2026-02-14 18:10:01 +00:00
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:
17
.github/workflows/test.yaml
vendored
17
.github/workflows/test.yaml
vendored
@@ -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
9
.golangci.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
linters:
|
||||
enable:
|
||||
# default linters
|
||||
- errcheck
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
- staticcheck
|
||||
- unused
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user