Skip to content

Search up parent directories until we find our files.#166

Open
cdignam-segment wants to merge 2 commits into
joho:mainfrom
segmentio:cdignam-segment/search-up
Open

Search up parent directories until we find our files.#166
cdignam-segment wants to merge 2 commits into
joho:mainfrom
segmentio:cdignam-segment/search-up

Conversation

@cdignam-segment
Copy link
Copy Markdown

Fixes #165

@MichaelHindley
Copy link
Copy Markdown

Any chance of this being merged @alexandear @joho @gnarlex ? It's great for projects with many packages :)

Comment thread godotenv.go
Comment on lines +33 to +39
func stringSet(s []string) map[string]interface{} {
m := make(map[string]interface{})
for _, str := range s {
m[str] = true
}
return m
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change a little bit the method? map[string]struct{} is a common way for implementing set in Go:

Suggested change
func stringSet(s []string) map[string]interface{} {
m := make(map[string]interface{})
for _, str := range s {
m[str] = true
}
return m
}
func stringSet(s []string) map[string]struct{} {
m := make(map[string]struct{}, len(s))
for _, str := range s {
m[str] = struct{}{}
}
return m
}

@alexandear
Copy link
Copy Markdown
Contributor

I'm not a maintainer of the repo. Sorry, can't merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotenv should look up in parent directories for .env

3 participants