Skip to content

Commit

Permalink
better builder.X comments. rename private builder
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyLoy committed Apr 5, 2019
1 parent fee5f56 commit 87c8001
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Builder struct {
configMap map[string]string
}

func newConfigBuilder() *Builder {
func newBuilder() *Builder {
return &Builder{
configMap: make(map[string]string),
delim: delim,
Expand All @@ -60,10 +60,10 @@ func (c *Builder) To(target interface{}) {
// From returns a new Builder, populated with the values from file.
// It panics if unable to open the file.
func From(file string) *Builder {
return newConfigBuilder().From(file)
return newBuilder().From(file)
}

// From merges new values from file into the current config state.
// From merges new values from file into the current config state, returning the Builder.
// It panics if unable to open the file.
func (c *Builder) From(file string) *Builder {
f, err := os.Open(file)
Expand All @@ -82,10 +82,10 @@ func (c *Builder) From(file string) *Builder {

// FromEnv returns a new Builder, populated with environment variables
func FromEnv() *Builder {
return newConfigBuilder().FromEnv()
return newBuilder().FromEnv()
}

// FromEnv merges new values from the environment into the current config state..
// FromEnv merges new values from the environment into the current config state, returning the Builder.
func (c *Builder) FromEnv() *Builder {
c.mergeConfig(stringsToMap(os.Environ()))
return c
Expand Down

0 comments on commit 87c8001

Please sign in to comment.