Skip to content

Commit 24e5ce2

Browse files
committed
Removed unreachable code (impossible condition detected by linter)
internal/arduino/sketch/sketch.go:108:14: nilness: impossible condition: non-nil == nil (govet) if mainFile == nil { ^
1 parent a301c8e commit 24e5ce2

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

internal/arduino/sketch/sketch.go

-4
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ func New(path *paths.Path) (*Sketch, error) {
105105
return nil, err
106106
}
107107

108-
if mainFile == nil {
109-
return nil, fmt.Errorf(tr("can't find main Sketch file in %s"), path)
110-
}
111-
112108
sketchFolderFiles, err := sketch.supportedFiles()
113109
if err != nil {
114110
return nil, fmt.Errorf("%s: %w", tr("reading sketch files"), err)

internal/cli/cli.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ func NewCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
6868
logFormat string
6969
jsonOutput bool
7070
outputFormat string
71-
configFile string
7271
additionalUrls []string
7372
)
7473

@@ -179,10 +178,12 @@ func NewCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
179178
cmd.RegisterFlagCompletionFunc("format", cobra.FixedCompletions(validOutputFormats, cobra.ShellCompDirectiveDefault))
180179
cmd.Flag("format").Hidden = true
181180
cmd.PersistentFlags().BoolVar(&jsonOutput, "json", false, tr("Print the output in JSON format."))
182-
cmd.PersistentFlags().StringVar(&configFile, "config-file", "", tr("The custom config file (if not specified the default will be used)."))
183181
cmd.PersistentFlags().StringSliceVar(&additionalUrls, "additional-urls", defaultAdditionalURLs, tr("Comma-separated list of additional URLs for the Boards Manager."))
184182
cmd.PersistentFlags().BoolVar(&noColor, "no-color", defaultOutputNoColor, "Disable colored output.")
185183

184+
// We are not using cobra to parse this flag, because we manually parse it in main.go.
185+
// Just leaving it here so cobra will not complain about it.
186+
cmd.PersistentFlags().String("config-file", "", tr("The custom config file (if not specified the default will be used)."))
186187
return cmd
187188
}
188189

0 commit comments

Comments
 (0)