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

fix: Add asserts position at start of line. #29

Merged
merged 2 commits into from
Dec 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ If you want to read your local `.env` file, so you can use these variables in yo

With this function the data will be loaded from the file and set as local variables. After that you can read them with standard functions, or you can use the following functions.

[Here](https://regex101.com/r/SEDjKj/5) you can find the regex expression which is used to read the environment variables.
[Here](https://regex101.com/r/SEDjKj/6) you can find the regex expression which is used to read the environment variables.

```go
err := dotenv.Import(".env")
Expand Down
2 changes: 1 addition & 1 deletion import.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type data struct {
}

// regex is to save the compiled expression.
var regex = regexp.MustCompile(`(?m)(?P<key>\w+?)=["']?(?P<value>.*?)(?:["']|\b)$`)
var regex = regexp.MustCompile(`(?m)^(?P<key>\w+?)=["']?(?P<value>.*)(?:["']|\b)$`)

// Import is read the environment variable file and use regex to find
// all sub matches. After that we initialize the environment variables to local.
Expand Down