From 59f392efd5ecabc9e562071a31b535a944f08f28 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Fri, 26 Jan 2024 00:34:20 -0500 Subject: [PATCH] Add gofmt (goimports) Github workflow --- .github/workflows/gofmt.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/gofmt.yml diff --git a/.github/workflows/gofmt.yml b/.github/workflows/gofmt.yml new file mode 100644 index 0000000..65058d1 --- /dev/null +++ b/.github/workflows/gofmt.yml @@ -0,0 +1,20 @@ +name: Check code formatting +on: [push] + +jobs: + goimports: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Go 1.21 + uses: actions/setup-go@v4 + with: + go-version: '1.21.x' + + - name: Install goimports + run: go install golang.org/x/tools/cmd/goimports@latest + + - name: Check goimports + run: if [ "$(goimports -l . | wc -l)" -gt 0 ]; then exit 1; fi