Skip to content

Conversation

ndeloof
Copy link
Collaborator

@ndeloof ndeloof commented Apr 4, 2023

fixes docker/compose#10430

added a test case so we don't re-introduce this regression in the future

I'm a bit sad we can't (in a portable way) just check err == EISDIR after os.ReadFile and need to preventively check os.Stat.

@ndeloof ndeloof force-pushed the dotEnv branch 2 times, most recently from bbce9c3 to b1ae8d9 Compare April 4, 2023 08:18
Copy link
Member

@milas milas left a comment

Choose a reason for hiding this comment

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

LGTM!

func TestGetEnvFromFile(t *testing.T) {
wd := t.TempDir()
f := filepath.Join(wd, ".env")
err := os.Mkdir(f, 0700)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
err := os.Mkdir(f, 0700)
err := os.Mkdir(f, 0o700)

to make the linter happy

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@ndeloof ndeloof merged commit dff689d into compose-spec:master Apr 17, 2023
@ndeloof ndeloof deleted the dotEnv branch April 17, 2023 09:00
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.

[BUG] docker-compose fails with "read .env: is a directory" when .env is a directory and --env-file is not specified
2 participants