mirror of
https://github.com/wagoodman/dive
synced 2026-03-14 14:25:50 +01:00
Make errcheck happy
This commit is contained in:
parent
aea85a1f40
commit
e15a2aa0d5
1 changed files with 8 additions and 2 deletions
10
cmd/root.go
10
cmd/root.go
|
|
@ -66,6 +66,8 @@ func initCli() {
|
|||
|
||||
// initConfig reads in config file and ENV variables if set.
|
||||
func initConfig() {
|
||||
var err error
|
||||
|
||||
viper.SetDefault("log.level", log.InfoLevel.String())
|
||||
viper.SetDefault("log.path", "./dive.log")
|
||||
viper.SetDefault("log.enabled", false)
|
||||
|
|
@ -97,7 +99,11 @@ func initConfig() {
|
|||
|
||||
viper.SetDefault("container-engine", "docker")
|
||||
|
||||
viper.BindPFlag("source", rootCmd.PersistentFlags().Lookup("source"))
|
||||
err = viper.BindPFlag("source", rootCmd.PersistentFlags().Lookup("source"))
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
viper.SetEnvPrefix("DIVE")
|
||||
// replace all - with _ when looking for matching environment variables
|
||||
|
|
@ -112,7 +118,7 @@ func initConfig() {
|
|||
} else {
|
||||
viper.SetConfigFile(cfgFile)
|
||||
}
|
||||
err := viper.ReadInConfig()
|
||||
err = viper.ReadInConfig()
|
||||
if err == nil {
|
||||
fmt.Println("Using config file:", viper.ConfigFileUsed())
|
||||
} else if cfgFile != "" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue