Last active
November 17, 2017 09:12
-
-
Save xcoulon/c8c37d876ff62896102ff1981d1b469e to your computer and use it in GitHub Desktop.
The benefit of using named return values in Golang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IsEnabled queries whether or not the specified feature is enabled or not. | |
func (uc Client) IsEnabled(feature string, options ...FeatureOption) (enabled bool) { | |
defer func() { | |
uc.metrics.count(feature, enabled) | |
}() | |
if f == nil { | |
... | |
return false | |
} | |
if !f.Enabled { | |
return false | |
} | |
for _, s := range f.Strategies { | |
... | |
return true | |
} | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment