From bea5201c2ab778aa55fda4b1e37140731f76410a Mon Sep 17 00:00:00 2001 From: Curt Bushko Date: Tue, 5 Apr 2022 13:15:14 -0400 Subject: [PATCH] Upgrade golangci-lint action and linter version (#1144) * upgrade github action and linter * reset branch to main --- .github/workflows/build-and-test.yml | 74 +++++++++----------- .github/workflows/reusable-golangci-lint.yml | 11 ++- 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 6fbb609a71..1b9e8fb019 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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 @@ -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 @@ -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}} @@ -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 diff --git a/.github/workflows/reusable-golangci-lint.yml b/.github/workflows/reusable-golangci-lint.yml index 5475e7ae75..83f2449b30 100644 --- a/.github/workflows/reusable-golangci-lint.yml +++ b/.github/workflows/reusable-golangci-lint.yml @@ -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}}