Skip to content

Commit c393682

Browse files
authored
Update proxy.go
1 parent 74e2f41 commit c393682

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

cmd/cloud_sql_proxy/proxy.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,19 @@ func CreateInstanceConfigs(dir string, useFuse bool, instances []string, instanc
337337
return nil, nil
338338
}
339339
// FUSE disabled.
340-
if len(instances) == 0 && instancesSrc == "" {
341-
if fuse.Supported() {
342-
return nil, errors.New("must specify -projects, -fuse, or -instances")
343-
}
344-
return nil, errors.New("must specify -projects or -instances")
345-
}
340+
if len(instances) == 0 && instancesSrc == "" {
341+
var flags string
342+
if fuse.Supported() {
343+
flags = "-projects, -fuse, or -instances"
344+
} else {
345+
flags = "-projects or -instances"
346+
}
347+
348+
errStr := fmt.Sprintf("no instance selected because none of %s is specified", flags)
349+
if gcloudErrStr != "" {
350+
errStr = fmt.Sprintf("%s and %s", errStr, gcloudErrStr)
351+
}
352+
return nil, errors.New(errStr)
353+
}
346354
return cfgs, nil
347355
}

0 commit comments

Comments
 (0)