Skip to content

Merge pull request #1720 from hashicorp/dependabot/go_modules/aws-sdk… #2463

Merge pull request #1720 from hashicorp/dependabot/go_modules/aws-sdk…

Merge pull request #1720 from hashicorp/dependabot/go_modules/aws-sdk… #2463

Workflow file for this run

name: Linters
on:
push:
branches:
- main
- "release/**"
pull_request:
paths:
- .github/workflows/linters.yml
- .golangci.yml
- go.sum
- GNUmakefile
- internal/**
- main.go
- tools/**
jobs:
go_mod_download:
name: go mod download
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: tools/go.mod
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
continue-on-error: true
id: cache-go-pkg-mod
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
# Needed to access private repositories. Unfortunately, this cannot be restricted to specific repositories
- run: git config --global url."https://${{ secrets.PRIVATE_GOMOD_TOKEN }}:x-oauth-basic@github.com/hashicorp".insteadOf "https://github.com/hashicorp"
- if: steps.cache-go-pkg-mod.outputs.cache-hit != 'true' || steps.cache-go-pkg-mod.outcome == 'failure'
run: go mod download
golangci-lint:
needs: [go_mod_download]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: tools/go.mod
- name: GOCACHE
run: |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
continue-on-error: true
timeout-minutes: 2
with:
# TODO: Replace with supported mechanism when it is supported
# https://github.com/actions/setup-go/issues/54
path: ${{ env.GOCACHE }}
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('internal/**') }}
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
continue-on-error: true
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- run: cd tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint
# Needed to access private repositories. Unfortunately, this cannot be restricted to specific repositories
- run: git config --global url."https://${{ secrets.PRIVATE_GOMOD_TOKEN }}:x-oauth-basic@github.com/hashicorp".insteadOf "https://github.com/hashicorp"
- run: golangci-lint run ./internal/...
unit-test:
needs: [go_mod_download]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: tools/go.mod
- name: GOCACHE
run: |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
continue-on-error: true
timeout-minutes: 2
with:
# TODO: Replace with supported mechanism when it is supported
# https://github.com/actions/setup-go/issues/54
path: ${{ env.GOCACHE }}
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('internal/**') }}
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
continue-on-error: true
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
# Needed to access private repositories. Unfortunately, this cannot be restricted to specific repositories
- run: git config --global url."https://${{ secrets.PRIVATE_GOMOD_TOKEN }}:x-oauth-basic@github.com/hashicorp".insteadOf "https://github.com/hashicorp"
- run: make test
semgrep:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: semgrep
uses: returntocorp/semgrep-action@713efdd345f3035192eaa63f56867b88e63e4e5d # v1
importlint:
needs: [go_mod_download]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: tools/go.mod
- name: GOCACHE
run: |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
continue-on-error: true
timeout-minutes: 2
with:
# TODO: Replace with supported mechanism when it is supported
# https://github.com/actions/setup-go/issues/54
path: ${{ env.GOCACHE }}
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('internal/**') }}
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
continue-on-error: true
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- run: cd tools && go install github.com/pavius/impi/cmd/impi
- run: impi --local . --scheme stdThirdPartyLocal --ignore-generated=true ./...