Skip to content

Commit

Permalink
Fix a few minor typos/formatting issues with comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nmiyake authored and anthonyfok committed Jul 23, 2017
1 parent 04691bc commit f257d19
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ func (str UnsupportedConfigError) Error() string {
}

// UnsupportedRemoteProviderError denotes encountering an unsupported remote
// provider. Currently only etcd and Consul are
// supported.
// provider. Currently only etcd and Consul are supported.
type UnsupportedRemoteProviderError string

// Error returns the formatted remote provider error.
Expand Down Expand Up @@ -283,8 +282,8 @@ func (v *Viper) WatchConfig() {
}()
}

// SetConfigFile explicitly defines the path, name and extension of the config file
// Viper will use this and not check any of the config paths
// SetConfigFile explicitly defines the path, name and extension of the config file.
// Viper will use this and not check any of the config paths.
func SetConfigFile(in string) { v.SetConfigFile(in) }
func (v *Viper) SetConfigFile(in string) {
if in != "" {
Expand All @@ -293,8 +292,8 @@ func (v *Viper) SetConfigFile(in string) {
}

// SetEnvPrefix defines a prefix that ENVIRONMENT variables will use.
// E.g. if your prefix is "spf", the env registry
// will look for env. variables that start with "SPF_"
// E.g. if your prefix is "spf", the env registry will look for env
// variables that start with "SPF_".
func SetEnvPrefix(in string) { v.SetEnvPrefix(in) }
func (v *Viper) SetEnvPrefix(in string) {
if in != "" {
Expand All @@ -312,19 +311,19 @@ func (v *Viper) mergeWithEnvPrefix(in string) string {

// TODO: should getEnv logic be moved into find(). Can generalize the use of
// rewriting keys many things, Ex: Get('someKey') -> some_key
// (cammel case to snake case for JSON keys perhaps)
// (camel case to snake case for JSON keys perhaps)

// getEnv is a wrapper around os.Getenv which replaces characters in the original
// key. This allows env vars which have different keys than the config object
// keys
// keys.
func (v *Viper) getEnv(key string) string {
if v.envKeyReplacer != nil {
key = v.envKeyReplacer.Replace(key)
}
return os.Getenv(key)
}

// ConfigFileUsed returns the file used to populate the config registry
// ConfigFileUsed returns the file used to populate the config registry.
func ConfigFileUsed() string { return v.ConfigFileUsed() }
func (v *Viper) ConfigFileUsed() string { return v.configFile }

Expand Down Expand Up @@ -815,7 +814,7 @@ func (v *Viper) BindFlagValues(flags FlagValueSet) (err error) {
}

// BindFlagValue binds a specific key to a FlagValue.
// Example(where serverCmd is a Cobra instance):
// Example (where serverCmd is a Cobra instance):
//
// serverCmd.Flags().Int("port", 1138, "Port to run Application server on")
// Viper.BindFlagValue("port", serverCmd.Flags().Lookup("port"))
Expand Down Expand Up @@ -1288,7 +1287,7 @@ func (v *Viper) WatchRemoteConfigOnChannel() error {
return v.watchKeyValueConfigOnChannel()
}

// Unmarshall a Reader into a map.
// Unmarshal a Reader into a map.
// Should probably be an unexported function.
func unmarshalReader(in io.Reader, c map[string]interface{}) error {
return v.unmarshalReader(in, c)
Expand Down

0 comments on commit f257d19

Please sign in to comment.