Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update go 1.21 and fix lint issues #490

Merged
merged 3 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
- name: Set up Go 1.21
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21
id: go

- name: Config credentials
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cli-coexistence_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21
id: go

- name: go cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cli_core_e2e_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21
id: go

- name: go cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cli_core_unit_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21
id: go

- name: go cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.21
id: go

- name: Check out code into the Go module directory
Expand Down
26 changes: 19 additions & 7 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ linters-settings:
linters:
disable-all: true
enable:
- deadcode
- depguard
- dogsled
- dupl
- errcheck
Expand All @@ -67,21 +65,16 @@ linters:
- govet
- ineffassign
- misspell
- nakedret
- nolintlint
- revive
- staticcheck
- stylecheck
- typecheck
- unconvert
- unused
- varcheck
- whitespace
- bodyclose
- noctx
- rowserrcheck
- structcheck
- unparam

mpanchajanya marked this conversation as resolved.
Show resolved Hide resolved
# don't enable:
# - asciicheck
Expand All @@ -99,7 +92,19 @@ linters:
# - testpackage
# - scopelint
# - wsl
# - depguard # This is not being used in the project hence do not enable
# - unparam # TODO: Remove all unused params and re enable the linter
# WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
# - deadcode
# WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
# - structcheck
# WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
# - varcheck

# TODO: Fix unused-parameters and enable the linters
# - revive
# TODO: Fix naked returns and enable the linters
# - nakedret
issues:
exclude:
- 'declaration of "(err|ctx)" shadows declaration at'
Expand All @@ -113,6 +118,13 @@ issues:
- gocritic
- funlen

- linters:
- gosec
text: "G602:" # TODO: Fix disable slice out of bounds issue and re enable the linter

- linters:
- gosec
text: "G601:" # TODO: Fix Implicit memory aliasing in for loop issue and re enable the linter
# https://github.com/go-critic/go-critic/issues/926
- linters:
- gocritic
Expand Down
2 changes: 1 addition & 1 deletion cmd/plugin/builder/command/cli_compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func Compile(compileArgs *PluginCompileArgs) error {
guard := make(chan struct{}, maxConcurrent)

// Mix up IDs so we don't always get the same set.
randSkew := rand.Intn(len(helpers.Identifiers)) // nolint:gosec
randSkew := rand.Intn(len(helpers.Identifiers)) //nolint:gosec
var wg sync.WaitGroup
plugins := make(chan cli.Plugin, len(files))
fatalErrors := make(chan helpers.ErrInfo, len(files))
Expand Down
8 changes: 4 additions & 4 deletions cmd/plugin/builder/inventory_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ type inventoryPluginActivateDeactivateFlags struct {
InventoryDBFile string
}

func newInventoryPluginActivateCmd() *cobra.Command { // nolint:dupl
func newInventoryPluginActivateCmd() *cobra.Command { //nolint:dupl
pluginActivateCmd, flags := getActivateDeactivateBaseCmd()
pluginActivateCmd.Use = "activate" // nolint:goconst
pluginActivateCmd.Use = "activate" //nolint:goconst
pluginActivateCmd.Short = "Activate the existing plugin in the inventory database available on the remote repository"
pluginActivateCmd.Example = ""
pluginActivateCmd.RunE = func(cmd *cobra.Command, args []string) error {
Expand All @@ -111,9 +111,9 @@ func newInventoryPluginActivateCmd() *cobra.Command { // nolint:dupl
return pluginActivateCmd
}

func newInventoryPluginDeactivateCmd() *cobra.Command { // nolint:dupl
func newInventoryPluginDeactivateCmd() *cobra.Command { //nolint:dupl
pluginDeactivateCmd, flags := getActivateDeactivateBaseCmd()
pluginDeactivateCmd.Use = "deactivate" // nolint:goconst
pluginDeactivateCmd.Use = "deactivate" //nolint:goconst
pluginDeactivateCmd.Short = "Deactivate the existing plugin in the inventory database available on the remote repository"
pluginDeactivateCmd.Example = ""
pluginDeactivateCmd.RunE = func(cmd *cobra.Command, args []string) error {
Expand Down
22 changes: 11 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/vmware-tanzu/tanzu-cli

go 1.19
go 1.21

replace cloud.google.com/go => cloud.google.com/go v0.102.1

Expand All @@ -24,8 +24,8 @@ require (
github.com/lithammer/dedent v1.1.0
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/novln/docker-parser v1.0.0
github.com/onsi/ginkgo/v2 v2.10.0
github.com/onsi/gomega v1.27.8
github.com/onsi/ginkgo/v2 v2.12.0
github.com/onsi/gomega v1.27.10
github.com/otiai10/copy v1.6.0
github.com/pkg/errors v0.9.1
github.com/rogpeppe/go-internal v1.10.0
Expand All @@ -43,9 +43,9 @@ require (
github.com/vmware-tanzu/tanzu-framework/capabilities/client v0.0.0-20230523145612-1c6fbba34686
github.com/vmware-tanzu/tanzu-plugin-runtime v1.1.0-dev.0.20230922224422-39c403b3e27a
go.pinniped.dev v0.20.0
golang.org/x/mod v0.10.0
golang.org/x/mod v0.12.0
golang.org/x/oauth2 v0.8.0
golang.org/x/sync v0.2.0
golang.org/x/sync v0.3.0
google.golang.org/grpc v1.55.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
Expand Down Expand Up @@ -213,14 +213,14 @@ require (
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.9.3 // indirect
golang.org/x/tools v0.12.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
Expand Down
Loading