brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lyubenblagoev <...@git.apache.org>
Subject [GitHub] brooklyn-client pull request: Close config file object (deferred c...
Date Fri, 18 Mar 2016 14:18:29 GMT
Github user lyubenblagoev commented on a diff in the pull request:

    https://github.com/apache/brooklyn-client/pull/9#discussion_r56662094
  
    --- Diff: io/config.go ---
    @@ -48,12 +49,12 @@ func GetConfig() (config *Config) {
     }
     
     func (config *Config) Write() {
    -
     	// Create file as read/write by user (but does not change perms of existing file)
     	fileToWrite, err := os.OpenFile(config.FilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
     	if err != nil {
     		error_handler.ErrorExit(err)
     	}
    +	defer fileToWrite.Close()
    --- End diff --
    
    Nope. `os.OpenFile` will return the file object and nil as an error, or nil and the error
in case of an error.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message