Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any key starting lowercase export fails to return value. #66

Closed
HamptonNorth opened this issue Jan 6, 2019 · 1 comment
Closed

Any key starting lowercase export fails to return value. #66

HamptonNorth opened this issue Jan 6, 2019 · 1 comment

Comments

@HamptonNorth
Copy link

HamptonNorth commented Jan 6, 2019

Any key starting lowercase export fails to return value.

All the following will fail to return value:

export export_ export_x export_xx export_xxx export_zzzz export_env export-env export_envx exportabc export_env EXPORT_ENV export_env_settings export_env_

expor or EXPORT are fine.

I note export BAR=BAZ is valid usage.

Changing the if to check 'export ' rather than 'export' and testing specifically for key of export in godotenv.go line 256 gives the expected behaviour for me.

// Parse the key
	key = splitString[0]
	if strings.HasPrefix(key, "export") {
		key = strings.TrimPrefix(key, "export")
	}
	key = strings.Trim(key, " ")

change to

// Parse the key
	key = splitString[0]
	if strings.HasPrefix(key, "export ") && string.Trim(key, " ") != "export" {
		key = strings.TrimPrefix(key, "export")
	}
	key = strings.Trim(key, " ")
@HamptonNorth HamptonNorth changed the title Any variable starting lowercase export fails to return value. Any key starting lowercase export fails to return value. Jan 7, 2019
@joho joho mentioned this issue Jan 29, 2019
6 tasks
@joho joho closed this as completed in #70 Feb 4, 2019
@elimisteve
Copy link

I don't know if #70 was reverted or what, but the replaced (error-inducing) code is back in master --

if strings.HasPrefix(key, "export") {

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

No branches or pull requests

2 participants