Skip to content

Commit

Permalink
Finish FixFile
Browse files Browse the repository at this point in the history
  • Loading branch information
zouyx committed Sep 20, 2018
2 parents 7444014 + 61cdf27 commit 4b3c8c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ func writeConfigFile(config *ApolloConfig,configPath string)error{
return errors.New("apollo config is null can not write backup file")
}
file, e := os.Create(getConfigFile(configPath))
defer file.Close()
if e!=nil{
logger.Errorf("writeConfigFile fail,error:",e)
return e
}
defer file.Close()

return json.NewEncoder(file).Encode(config)
}
Expand All @@ -44,11 +44,11 @@ func loadConfigFile(configDir string) (*ApolloConfig,error){
configFilePath := getConfigFile(configDir)
logger.Info("load config file from :",configFilePath)
file, e := os.Open(configFilePath)
defer file.Close()
if e!=nil{
logger.Errorf("loadConfigFile fail,error:",e)
return nil,e
}
defer file.Close()
config:=&ApolloConfig{}
e=json.NewDecoder(file).Decode(config)

Expand Down

0 comments on commit 4b3c8c8

Please sign in to comment.