Skip to content

Commit

Permalink
chore(lint): satisfy the linter (#1223)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Feb 15, 2024
1 parent 49ae615 commit d05d343
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cmd/file_render.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ combined JSON file:
`,
Args: cobra.ArbitraryArgs,
RunE: executeFileRenderCmd,
PreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(_ *cobra.Command, args []string) error {
fileRenderCmdKongStateFile = args
if len(fileRenderCmdKongStateFile) == 0 {
fileRenderCmdKongStateFile = []string{"-"} // default to stdin
Expand Down
4 changes: 2 additions & 2 deletions cmd/gateway_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func newDiffCmd(deprecated bool) *cobra.Command {
short := "Diff the current entities in Kong with the one on disks"
execute := executeDiff
argsValidator := cobra.MinimumNArgs(0)
preRun := func(cmd *cobra.Command, args []string) error {
preRun := func(_ *cobra.Command, args []string) error {
diffCmdKongStateFile = args
if len(diffCmdKongStateFile) == 0 {
diffCmdKongStateFile = []string{"-"}
Expand All @@ -47,7 +47,7 @@ func newDiffCmd(deprecated bool) *cobra.Command {
return executeDiff(cmd, args)
}
argsValidator = validateNoArgs
preRun = func(cmd *cobra.Command, args []string) error {
preRun = func(_ *cobra.Command, _ []string) error {
if len(diffCmdKongStateFile) == 0 {
return fmt.Errorf("a state file with Kong's configuration " +
"must be specified using `-s`/`--state` flag")
Expand Down
4 changes: 2 additions & 2 deletions cmd/gateway_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func newSyncCmd(deprecated bool) *cobra.Command {
short := "Sync performs operations to get Kong's configuration to match the state file"
execute := executeSync
argsValidator := cobra.MinimumNArgs(0)
preRun := func(cmd *cobra.Command, args []string) error {
preRun := func(_ *cobra.Command, args []string) error {
syncCmdKongStateFile = args
if len(syncCmdKongStateFile) == 0 {
syncCmdKongStateFile = []string{"-"}
Expand All @@ -47,7 +47,7 @@ func newSyncCmd(deprecated bool) *cobra.Command {
return executeSync(cmd, args)
}
argsValidator = validateNoArgs
preRun = func(cmd *cobra.Command, args []string) error {
preRun = func(_ *cobra.Command, _ []string) error {
if len(syncCmdKongStateFile) == 0 {
return fmt.Errorf("a state file with Kong's configuration " +
"must be specified using `-s`/`--state` flag")
Expand Down
4 changes: 2 additions & 2 deletions cmd/gateway_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ this command unless --online flag is used.
return executeValidate(cmd, args)
}
argsValidator = validateNoArgs
preRun = func(cmd *cobra.Command, args []string) error {
preRun = func(_ *cobra.Command, _ []string) error {
if len(diffCmdKongStateFile) == 0 {
return fmt.Errorf("a state file with Kong's configuration " +
"must be specified using `-s`/`--state` flag")
}
return preRunSilenceEventsFlag()
}
} else {
preRun = func(cmd *cobra.Command, args []string) error {
preRun = func(_ *cobra.Command, args []string) error {
validateOnline = online
validateCmdKongStateFile = args
if len(validateCmdKongStateFile) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/konnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func newKonnectCmd() *cobra.Command {
Short: "[deprecated] Configuration tool for Konnect",
Long: `The konnect command prints subcommands that can be used to
configure Konnect.` + konnectAlphaState,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
PersistentPreRun: func(_ *cobra.Command, _ []string) {
cprint.UpdatePrintf("Notice: The 'deck konnect' command has been deprecated as of v1.12. \n" +
"Please use deck <cmd> instead if you would like to declaratively manage your \n" +
"Kong gateway config with Konnect.\n")
Expand Down
4 changes: 2 additions & 2 deletions cmd/konnect_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ func newKonnectDiffCmd() *cobra.Command {
the entities in local files. This allows you to see the entities
that will be created, updated, or deleted.` + konnectAlphaState,
Args: validateNoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
_ = sendAnalytics("konnect-diff", "", modeKonnect)
return syncKonnect(cmd.Context(), konnectDiffCmdKongStateFile, true,
konnectDiffCmdParallelism)
},
PreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(_ *cobra.Command, _ []string) error {
return preRunSilenceEventsFlag()
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/konnect_dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func newKonnectDumpCmd() *cobra.Command {
The file can then be read using the 'deck konnect sync' command or 'deck konnect diff' command to
configure Konnect.` + konnectAlphaState,
Args: validateNoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
httpClient := utils.HTTPClient()
_ = sendAnalytics("konnect-dump", "", modeKonnect)

Expand Down
2 changes: 1 addition & 1 deletion cmd/konnect_ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func newKonnectPingCmd() *cobra.Command {
can connect to Konnect's API endpoint. It also validates the supplied
credentials.` + konnectAlphaState,
Args: validateNoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
_ = sendAnalytics("konnect-ping", "", modeKonnect)
client, err := utils.GetKonnectClient(nil, konnectConfig)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/konnect_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ func newKonnectSyncCmd() *cobra.Command {
Long: `The konnect sync command reads the state file and performs operations in Konnect
to get Konnect's state in sync with the input state.` + konnectAlphaState,
Args: validateNoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
_ = sendAnalytics("konnect-sync", "", modeKonnect)
return syncKonnect(cmd.Context(), konnectDiffCmdKongStateFile, false,
konnectDiffCmdParallelism)
},
PreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(_ *cobra.Command, _ []string) error {
return preRunSilenceEventsFlag()
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ configuration file.
It can be used to export, import, or sync entities to Kong.`,
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
if _, err := url.ParseRequestURI(rootConfig.Address); err != nil {
return fmt.Errorf("invalid URL: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func newVersionCmd() *cobra.Command {
Long: `The version command prints the version of decK along with a Git short
commit hash of the source tree.`,
Args: validateNoArgs,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
fmt.Printf("decK %s (%s) \n", VERSION, COMMIT)
},
}
Expand Down
2 changes: 1 addition & 1 deletion docs/generate-docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

func genMarkdownTree(cmd *cobra.Command, dir string) error {
identity := func(s string) string { return s }
emptyStr := func(s string) string { return "" }
emptyStr := func(_ string) string { return "" }
return genMarkdownTreeCustom(cmd, dir, emptyStr, identity)
}

Expand Down

0 comments on commit d05d343

Please sign in to comment.