File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import (
19
19
"encoding/json"
20
20
goflag "flag"
21
21
"fmt"
22
+ "io"
22
23
"os"
23
24
"regexp"
24
25
"strconv"
@@ -321,7 +322,7 @@ func (o *options) overrideFlagSetDefaultFromConfig(fs *pflag.FlagSet) error {
321
322
322
323
data := make (map [string ]interface {})
323
324
324
- if err := yaml .NewDecoder (configFile ).Decode (data ); err != nil {
325
+ if err := yaml .NewDecoder (configFile ).Decode (data ); err != nil && err != io . EOF {
325
326
return err
326
327
}
327
328
Original file line number Diff line number Diff line change @@ -812,6 +812,12 @@ func TestOptionsOverrideFlagSetDefaultFromConfig(t *testing.T) {
812
812
expectedTailValue : 1 ,
813
813
wantErr : false ,
814
814
},
815
+ {
816
+ name : "--config=testdata/config-empty.yaml" ,
817
+ flagConfigFilePathValue : filepath .Join (wd , "testdata/config-empty.yaml" ),
818
+ expectedTailValue : - 1 ,
819
+ wantErr : false ,
820
+ },
815
821
{
816
822
name : "--config=config-not-exist.yaml" ,
817
823
flagConfigFilePathValue : filepath .Join (wd , "config-not-exist.yaml" ),
You can’t perform that action at this time.
0 commit comments