Skip to content

Commit

Permalink
Upgrade golangci-lint action and linter version (hashicorp#1144)
Browse files Browse the repository at this point in the history
* upgrade github action and linter
* reset branch to main
  • Loading branch information
curtbushko authored Apr 5, 2022
1 parent 8455280 commit bea5201
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 42 deletions.
74 changes: 35 additions & 39 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,18 @@ jobs:
run: |
go run ./... -validate
# TODO: Re-enable once we figure out why it runs typecheck linter even though we're disabling all.
# golangci-lint-helm-gen:
# needs:
# - get-go-version
# uses: hashicorp/consul-k8s/.github/workflows/reusable-golangci-lint.yml@main
# with:
# directory: hack/helm-reference-gen
# go-version: ${{ needs.get-go-version.outputs.go-version }}
# #TODO: This is a workaround in order to get pipelines working. godot and staticcheck fail for helm-reference-gen
# args: "--no-config --disable-all --enable gofmt,govet"
golangci-lint-helm-gen:
needs:
- get-go-version
uses: hashicorp/consul-k8s/.github/workflows/reusable-golangci-lint.yml@main
with:
directory: hack/helm-reference-gen
go-version: ${{ needs.get-go-version.outputs.go-version }}
#TODO: This is a workaround in order to get pipelines working. godot and staticcheck fail for helm-reference-gen
args: "--no-config --disable-all --enable gofmt,govet"

unit-helm-gen:
needs: [get-go-version, validate-helm-gen]
needs: [get-go-version, golangci-lint-helm-gen, validate-helm-gen]
uses: hashicorp/consul-k8s/.github/workflows/reusable-unit.yml@main
with:
directory: hack/helm-reference-gen
Expand Down Expand Up @@ -104,17 +103,16 @@ jobs:
working-directory: control-plane
run: go run hack/lint-api-new-client/main.go

# TODO: re-enable once we figure out typecheck failures.
# golangci-lint-control-plane:
# needs:
# - get-go-version
# uses: hashicorp/consul-k8s/.github/workflows/reusable-golangci-lint.yml@main
# with:
# directory: control-plane
# go-version: ${{ needs.get-go-version.outputs.go-version }}
golangci-lint-control-plane:
needs:
- get-go-version
uses: hashicorp/consul-k8s/.github/workflows/reusable-golangci-lint.yml@main
with:
directory: control-plane
go-version: ${{ needs.get-go-version.outputs.go-version }}

test-control-plane:
needs: [get-go-version, lint-control-plane]
needs: [get-go-version, lint-control-plane, golangci-lint-control-plane]
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down Expand Up @@ -161,7 +159,7 @@ jobs:
test-enterprise-control-plane:
if: github.repository_owner == 'hashicorp' # Do not run on forks as this requires secrets
needs: [get-go-version, lint-control-plane]
needs: [get-go-version, lint-control-plane, golangci-lint-control-plane]
runs-on: ubuntu-latest
env:
CONSUL_LICENSE: ${{secrets.CONSUL_LICENSE}}
Expand Down Expand Up @@ -244,33 +242,31 @@ jobs:
name: consul-k8s_${{ matrix.goos }}_${{ matrix.goarch }}.zip
path: control-plane/consul-k8s_${{ matrix.goos }}_${{ matrix.goarch }}.zip

# TODO: re-enable once we figure out typecheck failures.
# golangci-lint-acceptance:
# needs:
# - get-go-version
# uses: hashicorp/consul-k8s/.github/workflows/reusable-golangci-lint.yml@main
# with:
# directory: acceptance
# go-version: ${{ needs.get-go-version.outputs.go-version }}
golangci-lint-acceptance:
needs:
- get-go-version
uses: hashicorp/consul-k8s/.github/workflows/reusable-golangci-lint.yml@main
with:
directory: acceptance
go-version: ${{ needs.get-go-version.outputs.go-version }}

unit-acceptance-framework:
needs: [get-go-version]
needs: [get-go-version, golangci-lint-acceptance]
uses: hashicorp/consul-k8s/.github/workflows/reusable-unit.yml@main
with:
directory: acceptance/framework
go-version: ${{ needs.get-go-version.outputs.go-version }}

# TODO: re-enable once we figure out typecheck failures.
# golangci-lint-cli:
# needs:
# - get-go-version
# uses: hashicorp/consul-k8s/.github/workflows/reusable-golangci-lint.yml@main
# with:
# directory: cli
# go-version: ${{ needs.get-go-version.outputs.go-version }}
golangci-lint-cli:
needs:
- get-go-version
uses: hashicorp/consul-k8s/.github/workflows/reusable-golangci-lint.yml@main
with:
directory: cli
go-version: ${{ needs.get-go-version.outputs.go-version }}

unit-cli:
needs: [get-go-version]
needs: [get-go-version, golangci-lint-cli]
uses: hashicorp/consul-k8s/.github/workflows/reusable-unit.yml@main
with:
directory: cli
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/reusable-golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2


- name: Setup go
uses: actions/setup-go@v2
with:
go-version: ${{ inputs.go-version }}

- name: golangci-lint-${{inputs.directory}}
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3.1.0
with:
version: v1.41.1
version: v1.45.2
working-directory: ${{inputs.directory}}
args: ${{inputs.args}}

0 comments on commit bea5201

Please sign in to comment.