Skip to content

Sync repo templates ⚙ #93

Sync repo templates ⚙

Sync repo templates ⚙ #93

Workflow file for this run

# Maintained in https://github.com/coreos/repo-templates
# Do not edit downstream.
name: Go
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
# don't waste job slots on superseded code
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test
strategy:
matrix:
go-version: [1.16.x, 1.17.x, 1.18.x, 1.19.x, 1.20.x]
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Check out repository
uses: actions/checkout@v4
- name: Install Go dependencies
run: go get golang.org/x/tools/cmd/cover
- name: Check modules
run: go mod verify
- name: Build
run: ./build
- name: Test
run: SUDO_PERMITTED=1 ./test
- name: Check Go formatting (gofmt)
shell: bash
run: |
GO_FILES=$(find . -name '*.go' -not -path "./vendor/*")
UNFORMATTED_FILES=$(gofmt -l $GO_FILES)
if [ -n "$UNFORMATTED_FILES" ]; then
echo "Go files are not formatted. Please run 'gofmt -w .' on your code."
gofmt -d $UNFORMATTED_FILES
exit 1
fi
echo "All Go files are correctly formatted."

Check failure on line 52 in .github/workflows/go.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/go.yml

Invalid workflow file

You have an error in your yaml syntax on line 52
- name: Run linter
uses: golangci/golangci-lint-action@v8
with:
version: v2.1.6