diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 9b921fa..d34e75a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,33 +1,39 @@ name: Go on: - - push - - pull_request + push: + branches: + - main + pull_request: jobs: - fmt_vet: - name: Fmt & Vet + lint: + name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: "1.21" - name: go fmt run: | - gofmt -s -d . > fmt.out - cat fmt.out - test -z $(cat fmt.out) + output=$(gofmt -s -d .) + echo "$output" + test -z "$output" - name: go vet run: go vet ./... + - name: install staticcheck + run: go install honnef.co/go/tools/cmd/staticcheck@latest + - name: staticcheck + run: staticcheck ./... test: name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: "1.21" - name: go test run: TZ="" go test ./... -tags=faketime