diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index dae70f7..c36e132 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -12,6 +12,9 @@ jobs: linux: runs-on: ubuntu-latest + defaults: + run: + shell: bash steps: - uses: actions/checkout@v2 @@ -20,22 +23,23 @@ jobs: with: go-version: 1.15 - - name: Build - run: go build -v ./... - - - name: Test - run: go test -v -race $(go list ./... | grep -v /vendor/) - - name: Format run: | - if [ -n "$(gofmt -l $(go list -f {{.Dir}} ./...| grep -v /vendor/))" ]; then - echo "Go code is not formatted:" - gofmt -d $(go list -f {{.Dir}} ./...| grep -v /vendor/) - exit 1 - fi + out=$(gofmt -d $(go list -f {{.Dir}} ./...)) + if [[ -n $out ]]; then + echo "Go code is not formatted:" + gofmt -d $(go list -f {{.Dir}} ./...) + exit 1 + fi - name: Vet - run: go vet $(go list ./... | grep -v /vendor/) + run: go vet ./... + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v -race ./... windows: runs-on: windows-latest @@ -47,11 +51,11 @@ jobs: with: go-version: 1.15 + - name: Vet + run: go vet ./... + - name: Build run: go build -v ./... - name: Test - run: go test -v -race $(go list ./... | grep -v /vendor/) - - - name: Vet - run: go vet $(go list ./... | grep -v /vendor/) + run: go test -v ./...