Skip to content

Commit

Permalink
Adds a go format checker
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronzi committed Aug 8, 2024
1 parent 485b987 commit 047aa93
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/go-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Go Formatting

on:
pull_request:
push:
branches: [main]
paths:
- 'backend/aashub/**.go'

jobs:
gofmt:
name: GoFmt Check
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22.5'

- name: Run GoFmt
id: gofmt-run
run: |
if ! gofmt -d backend/aashub/ > gofmt_output.txt; then
echo "Formatting issues found"
cat gofmt_output.txt
exit 1
fi
- name: GoFmt Output
if: ${{ failure() }}
run: |
echo "The following files are not formatted:"
cat gofmt_output.txt
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"detail": "Start the Vue 3 Vite development server"
},
{
"label": "Install dependencies",
"label": "Install/Update frontend dependencies",
"type": "shell",
"command": "yarn",
"args": ["install"],
Expand Down

0 comments on commit 047aa93

Please sign in to comment.