Add MarkFlagRequired to exceptions

This commit is contained in:
Denis Bilenko 2024-12-11 09:53:22 +01:00
parent 09a2a408b9
commit 883a1c3b11
3 changed files with 5 additions and 4 deletions

View File

@ -18,8 +18,9 @@ linters-settings:
replacement: 'any'
errcheck:
exclude-functions:
- (*github.com/spf13/pflag.FlagSet).MarkHidden
- (*github.com/spf13/pflag.FlagSet).MarkDeprecated
- (*github.com/spf13/cobra.Command).RegisterFlagCompletionFunc
- (*github.com/spf13/cobra.Command).MarkFlagRequired
- (*github.com/spf13/pflag.FlagSet).MarkDeprecated
- (*github.com/spf13/pflag.FlagSet).MarkHidden
issues:
exclude-dirs-use-default: false # recommended by docs https://golangci-lint.run/usage/false-positives/

View File

@ -30,7 +30,7 @@ func NewGenerateJobCommand() *cobra.Command {
}
cmd.Flags().Int64Var(&jobId, "existing-job-id", 0, `Job ID of the job to generate config for`)
_ = cmd.MarkFlagRequired("existing-job-id")
cmd.MarkFlagRequired("existing-job-id")
wd, err := os.Getwd()
if err != nil {

View File

@ -30,7 +30,7 @@ func NewGeneratePipelineCommand() *cobra.Command {
}
cmd.Flags().StringVar(&pipelineId, "existing-pipeline-id", "", `ID of the pipeline to generate config for`)
_ = cmd.MarkFlagRequired("existing-pipeline-id")
cmd.MarkFlagRequired("existing-pipeline-id")
wd, err := os.Getwd()
if err != nil {