Compare commits

..
5 Commits
Author SHA1 Message Date
John Barton 97a2850142 Merge pull request #265 from joho/ci/pin-windows-2025-vs2026
Point CI to new windows tag
2026-05-25 10:52:27 +10:00
John Barton e77328b146 Update the windows version per github warning.
"NOTICE: windows-latest requests are being redirected to windows-2025-vs2026 by June 15, 2028"
2026-05-25 10:37:27 +10:00
John Barton efa32f116f Merge pull request #264 from joho/fix/allow-hyphens-in-keys
Definitively commit to allowing hyphens (again)
2026-05-25 10:33:10 +10:00
John Barton 139cdfde14 Update readme to capture ruby/node key compatibililty 2026-05-25 10:30:10 +10:00
John Barton 87021fd05a test: drop stale parser-error case for hyphens in keys
PR #245 (commit 82194f2) widened the variable-name charset to include
'-', restoring v1.4.0 behaviour. The "Invalid char" case in
TestParserErrors predates that change and has been failing ever since;
CI only started surfacing it after the recent go.mod bump.

The deliberate "hyphens allowed" contract is already covered by
TestLoadHyphenEnv (positive) and TestKeyNameCharsetRejectsDisallowed
(negative lock-in on '+', '@', '/'), so removing this case is the
correct fix rather than reverting #245.
2026-05-25 10:11:01 +10:00
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
go: [ '1.26', '1.25', '1.24', '1.23', '1.22' ]
os: [ ubuntu-latest, macOS-latest, windows-latest ]
os: [ ubuntu-latest, macOS-latest, windows-2025-vs2026 ]
name: ${{ matrix.os }} Go ${{ matrix.go }} Tests
steps:
- uses: actions/checkout@v6
+4
View File
@@ -119,6 +119,10 @@ content := getRemoteFileContent()
myEnv, err := godotenv.Unmarshal(content)
```
### Variable name compatibility
Ruby's dotenv only allows `[A-Za-z0-9_.]` in key names, while Node's dotenv also permits `-`. godotenv has matched the Node charset since v1.4.0, so keys like `MY-VAR` parse cleanly here and in Node but will error under Ruby's dotenv.
### Precedence & Conventions
Existing envs take precedence of envs that are loaded later.
-4
View File
@@ -710,10 +710,6 @@ func TestParserErrors(t *testing.T) {
input string
err error
}{
"Invalid char": {
input: "foo-1=bar",
err: ErrUnexpectedChar,
},
"UnterminatedQuote": {
input: "foo=\"bar",
err: ErrUnterminatedQuote,