Skip to content

fix env var from host truncated at equal sign#271

Merged
thomasten merged 2 commits intomasterfrom
fix-envvar-equalsign
Apr 24, 2024
Merged

fix env var from host truncated at equal sign#271
thomasten merged 2 commits intomasterfrom
fix-envvar-equalsign

Conversation

@thomasten
Copy link
Member

  • first commit improves debugging with gdb by disabling some Go optimizations
  • second commit fixes the bug where an env var from host like FOO=bar=baz was truncated to the value bar

@thomasten thomasten requested a review from daniel-weisse April 24, 2024 12:29
@netlify
Copy link

netlify bot commented Apr 24, 2024

Deploy Preview for ego-docs canceled.

Name Link
🔨 Latest commit d1dbb51
🔍 Latest deploy log https://app.netlify.com/sites/ego-docs/deploys/6629168adea71400082d62c1

Comment on lines 54 to 55
splitString := strings.SplitN(envVar, "=", 2)
hostEnvironMap[splitString[0]] = splitString[1]
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
splitString := strings.SplitN(envVar, "=", 2)
hostEnvironMap[splitString[0]] = splitString[1]
envName, envValue, _ := strings.Cut(envVar, "=")
hostEnvironMap[envName] = envValue

The Go docs recommend using Cut if splitting around the first instance of a separator.
There shouldn't be any functional difference though

@thomasten thomasten force-pushed the fix-envvar-equalsign branch from 11d00b6 to d8a2d7a Compare April 24, 2024 14:25
@thomasten thomasten force-pushed the fix-envvar-equalsign branch from d8a2d7a to d1dbb51 Compare April 24, 2024 14:26
@thomasten thomasten merged commit f17fe57 into master Apr 24, 2024
@thomasten thomasten deleted the fix-envvar-equalsign branch April 24, 2024 14:33
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.

2 participants