|
@@ -410,14 +410,14 @@ func getConflictFreeConfiguration(configFile string, flags *pflag.FlagSet) (*Con
|
|
return nil, err
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
|
|
- var config Config
|
|
|
|
-
|
|
|
|
// Strip the UTF-8 BOM if present ([RFC 8259] allows JSON implementations to optionally strip the BOM for
|
|
// Strip the UTF-8 BOM if present ([RFC 8259] allows JSON implementations to optionally strip the BOM for
|
|
// interoperability; do so here as Notepad on older versions of Windows Server insists on a BOM).
|
|
// interoperability; do so here as Notepad on older versions of Windows Server insists on a BOM).
|
|
// [RFC 8259]: https://tools.ietf.org/html/rfc8259#section-8.1
|
|
// [RFC 8259]: https://tools.ietf.org/html/rfc8259#section-8.1
|
|
b = bytes.TrimPrefix(b, []byte("\xef\xbb\xbf"))
|
|
b = bytes.TrimPrefix(b, []byte("\xef\xbb\xbf"))
|
|
-
|
|
|
|
|
|
+ // Trim whitespace so that an empty config can be detected for an early return.
|
|
b = bytes.TrimSpace(b)
|
|
b = bytes.TrimSpace(b)
|
|
|
|
+
|
|
|
|
+ var config Config
|
|
if len(b) == 0 {
|
|
if len(b) == 0 {
|
|
return &config, nil // early return on empty config
|
|
return &config, nil // early return on empty config
|
|
}
|
|
}
|