diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..b2582a79 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,24 @@ +name: Run lint + +on: [ push, pull_request ] + +permissions: + contents: read + +jobs: + lint: + strategy: + matrix: + path: + - . + - examples + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Lint + uses: golangci/golangci-lint-action@v2 + with: + # version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version + version: latest + working-directory: ${{ matrix.path }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 870d1a2f..fe8a775a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,18 +20,6 @@ jobs: go test -v -race ./... - name: Test examples run: cd examples && go test -v -race ./... - lint: - runs-on: ubuntu-latest - steps: - - name: Install Go - uses: actions/setup-go@v1 - - name: Checkout code - uses: actions/checkout@v2 - - name: Lint - run: | - docker run --rm -v `pwd`:/go/src/k8s.io/klog -w /go/src/k8s.io/klog \ - golangci/golangci-lint:v1.50.1 golangci-lint run --disable-all -v \ - -E govet -E misspell -E gofmt -E ineffassign -E golint apidiff: runs-on: ubuntu-latest if: github.base_ref diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 00000000..0d77d65f --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,6 @@ +linters: + disable-all: true + enable: # sorted alphabetical + - gofmt + - misspell + - revive