feat: add go vet #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go Format Check | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
gofmt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
# - name: Install golangci-lint | |
# run: | | |
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1 | |
# - name: Run golangci-lint | |
# run: golangci-lint run | |
- name: Check Go format | |
run: | | |
# First check if files can be parsed correctly | |
if ! go vet ./...; then | |
echo "❌ Go files contain syntax errors" | |
exit 1 | |
fi | |
# Then check formatting | |
if [ -n "$(gofmt -l .)" ]; then | |
echo "❌ Go code is not formatted:" | |
gofmt -d . | |
exit 1 | |
else | |
echo "✅ Go code is properly formatted" | |
fi |