name: Lint, Vet, Test & Build

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:

  lint_and_test:
    runs-on: ubuntu-latest

    steps:
      - name: Install Go
        uses: actions/setup-go@v2
        with:
          go-version: '^1.17.0' # The Go version to download (if necessary) and use.


      - uses: actions/cache@v2
        with:
          # In order:
          # * Module download cache
          # * Build cache (Linux)
          # * Build cache (Mac)
          # * Build cache (Windows)
          path: |
            ~/go/pkg/mod
            ~/.cache/go-build
            ~/Library/Caches/go-build
            %LocalAppData%\go-build
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-go-

      - name: Checkout code
        uses: actions/checkout@v1

      - name: go get ./...
        run: go get ./...

      - name: Lint
        run: go run golang.org/x/lint/golint ./...

      - name: go vet ./...
        run: go vet ./...

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

      - name: go build ./...
        run: go build ./...

name: Lint, Vet, Test & Build

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:

  lint_and_test:
    runs-on: ubuntu-latest

    steps:
      - name: Install Go
        uses: actions/setup-go@v2
        with:
          go-version: '^1.17.0' # The Go version to download (if necessary) and use.


      - uses: actions/cache@v2
        with:
          # In order:
          # * Module download cache
          # * Build cache (Linux)
          # * Build cache (Mac)
          # * Build cache (Windows)
          path: |
            ~/go/pkg/mod
            ~/.cache/go-build
            ~/Library/Caches/go-build
            %LocalAppData%\go-build
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-go-

      - name: Checkout code
        uses: actions/checkout@v2

      - name: go get ./...
        run: go get ./...

      - name: Lint
        run: go run golang.org/x/lint/golint ./...

      - name: go vet ./...
        run: go vet ./...

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

      - name: go build ./...
        run: go build ./...

Update actions/checkout action to v2
Update actions/checkout action to v2
