From 75fe2fb4d3cd19c4740d793c592c4f03d724db4d Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 30 Nov 2023 14:15:16 -0800 Subject: [PATCH 01/16] Add golangci-lint step --- .github/workflows/golangci-lint.yml | 34 +++++++++++++++++++++++++++++ .golangci.yaml | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/golangci-lint.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000000..25b2f38a2d --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,34 @@ +name: golangci-lint +on: + pull_request: + types: + - opened + - synchronize + - reopened + - ready_for_review + +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: '1.20' + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Require: The version of golangci-lint to use. + # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. + # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. + version: v1.54 + + # Show only new issues if it's a pull request. The default value is `false`. + only-new-issues: true diff --git a/.golangci.yaml b/.golangci.yaml index 8bd835bdbd..cf483ee8d6 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -12,7 +12,7 @@ linters-settings: - (*github.com/ActiveState/termtest.ConsoleProcess).Expect - (*github.com/ActiveState/termtest.ConsoleProcess).WaitForInput -# When issues occur with linting us the snippet below to help with debugging +# When issues occur with linting use the snippet below to help with debugging # linters: # # Disable all and re-enable the default linters as a starting point. # disable-all: true From f9197c238fcdc2ccd6c3855ad867191f7e29a540 Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 30 Nov 2023 14:19:58 -0800 Subject: [PATCH 02/16] Increase timeout --- .github/workflows/golangci-lint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 25b2f38a2d..ab24fcc1f2 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -32,3 +32,6 @@ jobs: # Show only new issues if it's a pull request. The default value is `false`. only-new-issues: true + + # Command line arguments + args: --timeout 5m From 2664147ba208acc879515d8c6ae7c2cfc6810c5b Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 30 Nov 2023 14:23:46 -0800 Subject: [PATCH 03/16] Trial import order --- internal/runbits/requirements/requirements.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/runbits/requirements/requirements.go b/internal/runbits/requirements/requirements.go index 4eff7aee3e..785eb1adad 100644 --- a/internal/runbits/requirements/requirements.go +++ b/internal/runbits/requirements/requirements.go @@ -11,8 +11,8 @@ import ( "github.com/ActiveState/cli/internal/config" "github.com/ActiveState/cli/internal/constants" "github.com/ActiveState/cli/internal/errs" - "github.com/ActiveState/cli/internal/locale" "github.com/ActiveState/cli/internal/logging" + "github.com/ActiveState/cli/internal/locale" "github.com/ActiveState/cli/internal/multilog" "github.com/ActiveState/cli/internal/output" "github.com/ActiveState/cli/internal/primer" From 08fdf4fac7dd782d0e4a15251bb3146c1eba7c4f Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 30 Nov 2023 14:27:26 -0800 Subject: [PATCH 04/16] Enable gci --- .golangci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.golangci.yaml b/.golangci.yaml index cf483ee8d6..b9665298c5 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -13,6 +13,7 @@ linters-settings: - (*github.com/ActiveState/termtest.ConsoleProcess).WaitForInput # When issues occur with linting use the snippet below to help with debugging +# Make sure to disable the other linters block first # linters: # # Disable all and re-enable the default linters as a starting point. # disable-all: true @@ -24,3 +25,7 @@ linters-settings: # - staticcheck # - typecheck # - unused + +linters: + enable: + - gci \ No newline at end of file From b94dd423bc17dfe67eb9095bcae3a63fe2c11387 Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 30 Nov 2023 14:42:14 -0800 Subject: [PATCH 05/16] Formatting --- .golangci.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index b9665298c5..771196c4ec 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -12,6 +12,10 @@ linters-settings: - (*github.com/ActiveState/termtest.ConsoleProcess).Expect - (*github.com/ActiveState/termtest.ConsoleProcess).WaitForInput +linters: + enable: + - gci + # When issues occur with linting use the snippet below to help with debugging # Make sure to disable the other linters block first # linters: @@ -24,8 +28,4 @@ linters-settings: # - ineffassign # - staticcheck # - typecheck -# - unused - -linters: - enable: - - gci \ No newline at end of file +# - unused \ No newline at end of file From 2a0a52587054f26fed6b197ef3ba5e684daf0cae Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 30 Nov 2023 14:46:51 -0800 Subject: [PATCH 06/16] Add config file argument --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index ab24fcc1f2..de09b1c664 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -34,4 +34,4 @@ jobs: only-new-issues: true # Command line arguments - args: --timeout 5m + args: --timeout 5m --config .golangci.yaml From 91a53efbcd9aa721ce6d97c13c1f260c0bce0e18 Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 30 Nov 2023 14:52:28 -0800 Subject: [PATCH 07/16] Try not only new issues --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index de09b1c664..4ab91450ba 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -31,7 +31,7 @@ jobs: version: v1.54 # Show only new issues if it's a pull request. The default value is `false`. - only-new-issues: true + only-new-issues: false # Command line arguments args: --timeout 5m --config .golangci.yaml From 14b0bb6a19a84d6b4792eab0b57424bc1ef569ea Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 30 Nov 2023 15:24:14 -0800 Subject: [PATCH 08/16] Enable pull-request read option --- .github/workflows/golangci-lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 4ab91450ba..63e856f69d 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -10,7 +10,7 @@ on: permissions: contents: read # Optional: allow read access to pull request. Use with `only-new-issues` option. - # pull-requests: read + pull-requests: read jobs: golangci: @@ -31,7 +31,7 @@ jobs: version: v1.54 # Show only new issues if it's a pull request. The default value is `false`. - only-new-issues: false + only-new-issues: true # Command line arguments args: --timeout 5m --config .golangci.yaml From 45bcde42120e687d996ed51e90303cbcd7bb1816 Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 30 Nov 2023 15:30:47 -0800 Subject: [PATCH 09/16] Remove config flag --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 63e856f69d..4b3b5b83c3 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -34,4 +34,4 @@ jobs: only-new-issues: true # Command line arguments - args: --timeout 5m --config .golangci.yaml + args: --timeout 5m From 6d7ddd91dfe9112638f2425170231e131d69a54d Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 30 Nov 2023 15:38:46 -0800 Subject: [PATCH 10/16] Try more pull request types? --- .github/workflows/golangci-lint.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 4b3b5b83c3..ebc1b4ae71 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -1,11 +1,13 @@ name: golangci-lint -on: +'on': pull_request: types: - opened - synchronize - reopened - ready_for_review + - labeled + - edited permissions: contents: read From 2761eff42015b368d0bada871db857908fa60bcf Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 30 Nov 2023 15:45:13 -0800 Subject: [PATCH 11/16] More obvious failure --- .golangci.yaml | 1 + internal/runbits/requirements/requirements.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 771196c4ec..64ad85365a 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -13,6 +13,7 @@ linters-settings: - (*github.com/ActiveState/termtest.ConsoleProcess).WaitForInput linters: + disable-all: true enable: - gci diff --git a/internal/runbits/requirements/requirements.go b/internal/runbits/requirements/requirements.go index 785eb1adad..3e45aa8c3f 100644 --- a/internal/runbits/requirements/requirements.go +++ b/internal/runbits/requirements/requirements.go @@ -1,10 +1,9 @@ package requirements import ( - "fmt" "strconv" "strings" - + "github.com/ActiveState/cli/internal/analytics" anaConsts "github.com/ActiveState/cli/internal/analytics/constants" "github.com/ActiveState/cli/internal/captain" @@ -19,6 +18,7 @@ import ( "github.com/ActiveState/cli/internal/prompt" "github.com/ActiveState/cli/internal/rtutils/ptr" "github.com/ActiveState/cli/internal/runbits" + "fmt" "github.com/ActiveState/cli/internal/runbits/commitmediator" "github.com/ActiveState/cli/internal/runbits/rationalize" bpModel "github.com/ActiveState/cli/pkg/platform/api/buildplanner/model" From a30c3a816e5908f92cd5d1a38887f8e83bd973b4 Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 30 Nov 2023 15:45:27 -0800 Subject: [PATCH 12/16] Remove disable all --- .golangci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.golangci.yaml b/.golangci.yaml index 64ad85365a..771196c4ec 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -13,7 +13,6 @@ linters-settings: - (*github.com/ActiveState/termtest.ConsoleProcess).WaitForInput linters: - disable-all: true enable: - gci From efc8af2e4949c830930e7e56187cee42e11a1765 Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 30 Nov 2023 16:01:37 -0800 Subject: [PATCH 13/16] Add back config --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index ebc1b4ae71..795540eee1 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -36,4 +36,4 @@ jobs: only-new-issues: true # Command line arguments - args: --timeout 5m + args: --timeout 5m --config .golangci.yaml From aaefc8176125f1c01445f28e6c04ee9ff7048eac Mon Sep 17 00:00:00 2001 From: mdrakos Date: Mon, 4 Dec 2023 09:59:53 -0800 Subject: [PATCH 14/16] Change go version --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 795540eee1..5f26c2e1c5 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: '1.20.x' cache: false - name: golangci-lint uses: golangci/golangci-lint-action@v3 From e906aa108dbdc6627cb79c574940ab564bf89211 Mon Sep 17 00:00:00 2001 From: mdrakos Date: Mon, 4 Dec 2023 10:11:59 -0800 Subject: [PATCH 15/16] Try to enable all linters --- .golangci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 771196c4ec..82e515be57 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -13,8 +13,7 @@ linters-settings: - (*github.com/ActiveState/termtest.ConsoleProcess).WaitForInput linters: - enable: - - gci + enable-all: true # When issues occur with linting use the snippet below to help with debugging # Make sure to disable the other linters block first From 45c104e28c94ea7b79b1b831b5130197403aa4b6 Mon Sep 17 00:00:00 2001 From: mdrakos Date: Mon, 4 Dec 2023 10:42:18 -0800 Subject: [PATCH 16/16] Try enable all via command line argument --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 5f26c2e1c5..d7e0d7d405 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -36,4 +36,4 @@ jobs: only-new-issues: true # Command line arguments - args: --timeout 5m --config .golangci.yaml + args: --timeout 5m --enable-all