Skip to content

Commit

Permalink
Fix linter errors flagged with latest golanglint
Browse files Browse the repository at this point in the history
Signed-off-by: Anuj Chaudhari <[email protected]>
  • Loading branch information
anujc25 committed Jan 3, 2025
1 parent 320231c commit bb9708b
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ issues:
- 'declaration of "(err|ctx)" shadows declaration at'
- 'unnamedResult: consider giving a name to these results'
- '(Expect directory permissions to be 0750 or less|Expect (WriteFile|file) permissions to be 0600 or less)'
- 'dot-imports: should not use dot imports'

exclude-rules:
- path: _test\.go
Expand Down Expand Up @@ -164,4 +165,4 @@ run:
# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
golangci-lint-version: 1.46.0 # use the fixed version to not introduce new linters unexpectedly
golangci-lint-version: 1.63.3 # use the fixed version to not introduce new linters unexpectedly
4 changes: 2 additions & 2 deletions command/deprecate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/spf13/cobra"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // Using dot import for readability in test files

Check failure on line 12 in command/deprecate_test.go

View workflow job for this annotation

GitHub Actions / Lint

directive `//nolint:revive // Using dot import for readability in test files` is unused for linter "revive" (nolintlint)
. "github.com/onsi/gomega" //nolint:revive // Using dot import for readability in test files

Check failure on line 13 in command/deprecate_test.go

View workflow job for this annotation

GitHub Actions / Lint

directive `//nolint:revive // Using dot import for readability in test files` is unused for linter "revive" (nolintlint)
)

func TestCommand(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion component/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (obw *objectwriter) SetKeys(_ ...string) {
}

// MarkDynamicKeys marks the headers as dynamic
func (obw *objectwriter) MarkDynamicKeys(dynamicKeys ...string) {
func (obw *objectwriter) MarkDynamicKeys(_ ...string) {
// Object writer does not have the concept of dynamic keys
fmt.Fprintln(obw.out, "Programming error, attempt to mark dynamic headers to object output")
}
Expand Down
4 changes: 2 additions & 2 deletions component/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"os"
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // Using dot import for readability in test files

Check failure on line 10 in component/reader_test.go

View workflow job for this annotation

GitHub Actions / Lint

directive `//nolint:revive // Using dot import for readability in test files` is unused for linter "revive" (nolintlint)
. "github.com/onsi/gomega" //nolint:revive // Using dot import for readability in test files

Check failure on line 11 in component/reader_test.go

View workflow job for this annotation

GitHub Actions / Lint

directive `//nolint:revive // Using dot import for readability in test files` is unused for linter "revive" (nolintlint)
)

func TestComponent(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion config/contexts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/ginkgo/v2" //nolint:revive // Using dot import for readability in test files

Check failure on line 10 in config/contexts_test.go

View workflow job for this annotation

GitHub Actions / Lint

directive `//nolint:revive // Using dot import for readability in test files` is unused for linter "revive" (nolintlint)
"github.com/onsi/gomega"

"github.com/stretchr/testify/assert"
Expand Down
6 changes: 3 additions & 3 deletions log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func getLogThreshold() int32 {
if reqLogLevelStr != "" {
requestedLogLevel, err := strconv.ParseUint(reqLogLevelStr, 10, 32)
if err == nil {
return int32(requestedLogLevel)
return int32(requestedLogLevel) //nolint:gosec // overflow conversion does not apply
}
fmt.Fprintf(os.Stderr, "invalid value %q for %s\n", reqLogLevelStr, EnvTanzuCLILogLevel)
}
Expand Down Expand Up @@ -145,7 +145,7 @@ func (l *logger) Outputf(format string, args ...interface{}) {
// V returns an InfoLogger value for a specific verbosity level.
func (l *logger) V(level int) LoggerImpl {
nl := l.clone()
nl.level = int32(level)
nl.level = int32(level) //nolint:gosec // overflow conversion does not apply
return nl
}

Expand Down Expand Up @@ -184,7 +184,7 @@ func (l *logger) Clone() LoggerImpl {
func (l *logger) CloneWithLevel(level int) LoggerImpl {
return &logger{
threshold: l.threshold,
level: int32(level),
level: int32(level), //nolint:gosec // overflow conversion does not apply
prefix: l.prefix,
values: copySlice(l.values),
callDepth: l.callDepth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
testCmd = &cobra.Command{
Use: "test",
Short: "A test command that parse the file and trigger the runtime apis",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
// Parse the file into array of apis struct
apis, err := compatibilitytestingcore.ParseRuntimeAPIsFromFile(filepath)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (
testCmd = &cobra.Command{
Use: "test",
Short: "A test command that parse the apis file and trigger the runtime library apis",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
apis, err := core.ParseRuntimeAPIsFromFile(filepath)
if err != nil {
fmt.Println(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
testCmd = &cobra.Command{
Use: "test",
Short: "A test command that parse the file and trigger the runtime apis",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
apis, err := core.ParseRuntimeAPIsFromFile(filepath)
if err != nil {
fmt.Println(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
testCmd = &cobra.Command{
Use: "test",
Short: "A test command that parse the file and trigger the runtime apis",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
// Parse the file into array of apis struct
apis, err := core.ParseRuntimeAPIsFromFile(filepath)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
testCmd = &cobra.Command{
Use: "test",
Short: "A test command that parse the file and trigger the runtime apis",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
// Parse the file into array of apis struct
apis, err := compatibilitytestingcore.ParseRuntimeAPIsFromFile(filepath)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
testCmd = &cobra.Command{
Use: "test",
Short: "A test command that parse the file and trigger the runtime apis",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
// Parse the file into array of apis struct
apis, err := compatibilitytestingcore.ParseRuntimeAPIsFromFile(filepath)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions test/plugin_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"path/filepath"
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // Using dot import for readability in test files

Check failure on line 13 in test/plugin_e2e_test.go

View workflow job for this annotation

GitHub Actions / Lint

directive `//nolint:revive // Using dot import for readability in test files` is unused for linter "revive" (nolintlint)
. "github.com/onsi/gomega" //nolint:revive // Using dot import for readability in test files

Check failure on line 14 in test/plugin_e2e_test.go

View workflow job for this annotation

GitHub Actions / Lint

directive `//nolint:revive // Using dot import for readability in test files` is unused for linter "revive" (nolintlint)

executil "github.com/vmware-tanzu/tanzu-plugin-runtime/test/exec"
)
Expand Down

0 comments on commit bb9708b

Please sign in to comment.