From d0c6cb32037d8707e9af8da96c8c6fc410027554 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Sat, 25 Jan 2020 23:24:15 +0530 Subject: [PATCH 1/5] add gofmt check to actions workflow --- .github/workflows/cli.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index a8ee5bb..ea27f07 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -38,6 +38,14 @@ jobs: with: ref: ${{ github.ref }} + - name: GOFMT Check + run: | + if [ -z $(gofmt -l .) ]; then + exit 0 + else + exit 1 + fi + - name: Run Tests run: | go run build.go vet From 946012b50d4b9342b8b6e6a9dbaaed7b978a5b1f Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Sat, 25 Jan 2020 23:24:30 +0530 Subject: [PATCH 2/5] add file with incorrec formatting to verify test --- context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context.go b/context.go index 74ed519..71e0a5e 100644 --- a/context.go +++ b/context.go @@ -43,7 +43,7 @@ func NewContext(app *App, set *flag.FlagSet, parentCtx *Context) *Context { // NumFlags returns the number of flags set func (c *Context) NumFlags() int { - return c.flagSet.NFlag() + return c.flagSet.NFlag() } // Set sets a context flag to a value. From d114940d57921c2ad86981831028be18a948b213 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Sat, 25 Jan 2020 23:27:56 +0530 Subject: [PATCH 3/5] revert back to correct formatting --- context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context.go b/context.go index 71e0a5e..74ed519 100644 --- a/context.go +++ b/context.go @@ -43,7 +43,7 @@ func NewContext(app *App, set *flag.FlagSet, parentCtx *Context) *Context { // NumFlags returns the number of flags set func (c *Context) NumFlags() int { - return c.flagSet.NFlag() + return c.flagSet.NFlag() } // Set sets a context flag to a value. From 7841e146eee67fefca5d4cb1d166a9d7196e737c Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Sat, 25 Jan 2020 23:30:42 +0530 Subject: [PATCH 4/5] run the gofmt on the latest version of go on ubuntu --- .github/workflows/cli.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index ea27f07..d4f5df7 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -39,6 +39,7 @@ jobs: ref: ${{ github.ref }} - name: GOFMT Check + if: matrix.go == 1.13 && matrix.os == 'ubuntu-latest' run: | if [ -z $(gofmt -l .) ]; then exit 0 From c5720ee3af06bb9c513f1a0fd74c45c8ab058ab6 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Sun, 26 Jan 2020 17:42:27 +0530 Subject: [PATCH 5/5] simplify GOFMT Check --- .github/workflows/cli.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index d4f5df7..88c4020 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -40,12 +40,7 @@ jobs: - name: GOFMT Check if: matrix.go == 1.13 && matrix.os == 'ubuntu-latest' - run: | - if [ -z $(gofmt -l .) ]; then - exit 0 - else - exit 1 - fi + run: test -z $(gofmt -l .) - name: Run Tests run: |