name: Go
on: [ push ]
jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.16
        id: go

      - name: Cache Go modules
        uses: actions/cache@v2
        with:
          path: ~/go/pkg/mod
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-go-

      - name: Test
        run: |
          go mod tidy
          go test -v ./...

      - name: Lint
        uses: golangci/golangci-lint-action@v2.4.0
        with:
          version: v1.37

      - name: Cross-compile
        uses: goreleaser/goreleaser-action@v2
        if: github.ref == 'refs/heads/main'
        with:
          version: latest
          args: build --snapshot

      - name: Release
        uses: goreleaser/goreleaser-action@v2
        if: startsWith(github.ref, 'refs/tags/')
        with:
          version: latest
          args: release --rm-dist
        env:
          GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

name: Go
on: [push]
jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.16
        id: go

      - name: Check out code
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Get dependencies
        run: |
          go get -v -t -d ./...

      - name: Test
        run: go test -v ./...

      - name: Lint
        uses: golangci/golangci-lint-action@v2.4.0
        with:
          version: v1.37

      - name: Cross-compile
        uses: goreleaser/goreleaser-action@v2
        if: github.ref == 'refs/heads/main'
        with:
          version: latest
          args: build --snapshot

      - name: Release
        uses: goreleaser/goreleaser-action@v2
        if: startsWith(github.ref, 'refs/tags/')
        with:
          version: latest
          args: release --rm-dist
        env:
          GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

Revert "Enable Go module caching."
Revert "Enable Go module caching."

This reverts commit e86f30c56f58ec10f3ba4efdcfb410a70519cb58.
