Skip to content

fix: separate a trailing capital in a default env name - #446

Open
SashaMIT wants to merge 1 commit into
caarlos0:mainfrom
SashaMIT:fix/trailing-capital-env-name
Open

SashaMIT wants to merge 1 commit into
caarlos0:mainfrom
SashaMIT:fix/trailing-capital-env-name

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Oct 2, 2026 •

Copy link
Copy Markdown

Summary

UseFieldNameByDefault builds the env name in toEnvName. A capital that ends the field was not split from the lowercase letter before it, because that check only ran when another character followed. MyA became MYA, so MY_A=set left the field empty. FooBar was already FOO_BAR. HTTP and userID stay HTTP and USER_ID.

Test plan

  • toEnvName("MyA") was MYA before the change and MY_A after
  • ParseWithOptions with UseFieldNameByDefault and MY_A=set left MyA empty before the change and reads set after
  • go test ./...

UseFieldNameByDefault turned MyA into MYA, so MY_A was ignored and the field stayed empty. FooBar already becomes FOO_BAR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant