Skip to content

Commit a81ca22

Browse files
danielqsjBogdan Drutu
andauthored
stop build if config file not exist (open-telemetry#4327)
* stop build if config file not exist * Update cmd/builder/cmd/root.go Co-authored-by: Bogdan Drutu <[email protected]> Co-authored-by: Bogdan Drutu <[email protected]>
1 parent 61d3a34 commit a81ca22

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cmd/builder/cmd/root.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,10 @@ func initConfig() {
114114
}
115115

116116
// load the config file
117-
if err := vp.ReadInConfig(); err == nil {
118-
cfg.Logger.Info("Using config file", zap.String("path", vp.ConfigFileUsed()))
117+
if err := vp.ReadInConfig(); err != nil {
118+
cobra.CheckErr(err)
119119
}
120+
cfg.Logger.Info("Using config file", zap.String("path", vp.ConfigFileUsed()))
120121

121122
// convert Viper's internal state into our configuration object
122123
if err := vp.Unmarshal(&cfg); err != nil {

0 commit comments

Comments
 (0)