From 0cc992f1346d87d177d45223f132612b59bf9809 Mon Sep 17 00:00:00 2001 From: Matt Moore Date: Mon, 21 Feb 2022 11:46:43 -0800 Subject: [PATCH] Start to consume the go formatting actions Signed-off-by: Matt Moore --- .github/workflows/style.yaml | 55 +++++++++++++----------------------- 1 file changed, 19 insertions(+), 36 deletions(-) diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml index 5ac438cded9..aa058bab240 100644 --- a/.github/workflows/style.yaml +++ b/.github/workflows/style.yaml @@ -7,51 +7,34 @@ on: permissions: read-all jobs: - autoformat: - name: Auto-format and Check + gofmt: + name: check gofmt runs-on: ubuntu-latest - strategy: - fail-fast: false # Keep running if one leg fails. - matrix: - tool: - - goimports - - gofmt + steps: + - name: Set up Go + uses: actions/setup-go@424fc82d43fa5a37540bae62709ddcc23d9520d4 #v2.1.5 + with: + go-version: 1.16.x - include: - - tool: gofmt - options: -s - - tool: goimports - importpath: golang.org/x/tools/cmd/goimports + - name: Check out code + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 #v2.4.0 + + - uses: chainguard-dev/actions/gofmt@main + with: + args: -s + + goimports: + name: check goimports + runs-on: ubuntu-latest steps: - - name: Set up Go 1.16.x + - name: Set up Go uses: actions/setup-go@424fc82d43fa5a37540bae62709ddcc23d9520d4 #v2.1.5 with: go-version: 1.16.x - id: go - name: Check out code uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 #v2.4.0 - - name: Install Dependencies - if: ${{ matrix.importpath != '' }} - run: | - cd $(mktemp -d) - GO111MODULE=on go get ${{ matrix.importpath }} - - - name: ${{ matrix.tool }} ${{ matrix.options }} - shell: bash - run: > - ${{ matrix.tool }} ${{ matrix.options }} -w - $(find . - -path './vendor' -prune - -o -path './third_party' -prune - -o -name '*.pb.go' -prune - -o -name 'wire_gen.go' -prune - -o -type f -name '*.go' -print) - - - name: Verify ${{ matrix.tool }} - uses: chainguard-dev/actions/nodiff@main - with: - fixup-command: "${{ matrix.tool }} ${{ matrix.options }}" + - uses: chainguard-dev/actions/goimports@main