Skip to content

Commit 671305d

Browse files
authored
sg: do not warn about dev build if flags are configured (sourcegraph#64529)
If they are configured, there is no point warning about the defaults being different. In my case I configure these flags via envvars, so I don't need to be warned about it all the time. Test Plan: I ran an sg command with and without envvars configuring and it didn't and did warn respectively.
1 parent 7485a9c commit 671305d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

dev/sg/main.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,15 @@ func warnSkippedInDev(flag cli.Flag) cli.Flag {
465465
func printSkippedInDevWarning() {
466466
names := []string{}
467467
for _, f := range skippedInDevFlags {
468-
// Safe because it's not possible for a flag to not have name.
469-
names = append(names, f.Names()[0])
468+
// If the user has already configured it, do not warn about it
469+
if !f.IsSet() {
470+
// Safe because it's not possible for a flag to not have name.
471+
names = append(names, f.Names()[0])
472+
}
473+
}
474+
if len(names) > 0 {
475+
std.Out.WriteWarningf("Running sg with a dev build, following flags have different default value unless explictly set: %s", strings.Join(names, ", "))
470476
}
471-
std.Out.WriteWarningf("Running sg with a dev build, following flags have different default value unless explictly set: %s", strings.Join(names, ", "))
472477
}
473478

474479
func exists(file string) bool {

0 commit comments

Comments
 (0)