mirror of https://github.com/joho/godotenv.git
Add punctuation to please godoc (#197)
Fixes issue reported over at https://github.com/golang/go/issues/55888pull/194/merge
parent
85a2237126
commit
5c76d3e02c
20
godotenv.go
20
godotenv.go
|
@ -30,15 +30,15 @@ const doubleQuoteSpecialChars = "\\\n\r\"!$`"
|
||||||
|
|
||||||
// Load will read your env file(s) and load them into ENV for this process.
|
// Load will read your env file(s) and load them into ENV for this process.
|
||||||
//
|
//
|
||||||
// Call this function as close as possible to the start of your program (ideally in main)
|
// Call this function as close as possible to the start of your program (ideally in main).
|
||||||
//
|
//
|
||||||
// If you call Load without any args it will default to loading .env in the current path
|
// If you call Load without any args it will default to loading .env in the current path.
|
||||||
//
|
//
|
||||||
// You can otherwise tell it which files to load (there can be more than one) like
|
// You can otherwise tell it which files to load (there can be more than one) like:
|
||||||
//
|
//
|
||||||
// godotenv.Load("fileone", "filetwo")
|
// godotenv.Load("fileone", "filetwo")
|
||||||
//
|
//
|
||||||
// It's important to note that it WILL NOT OVERRIDE an env variable that already exists - consider the .env file to set dev vars or sensible defaults
|
// It's important to note that it WILL NOT OVERRIDE an env variable that already exists - consider the .env file to set dev vars or sensible defaults.
|
||||||
func Load(filenames ...string) (err error) {
|
func Load(filenames ...string) (err error) {
|
||||||
filenames = filenamesOrDefault(filenames)
|
filenames = filenamesOrDefault(filenames)
|
||||||
|
|
||||||
|
@ -53,11 +53,11 @@ func Load(filenames ...string) (err error) {
|
||||||
|
|
||||||
// Overload will read your env file(s) and load them into ENV for this process.
|
// Overload will read your env file(s) and load them into ENV for this process.
|
||||||
//
|
//
|
||||||
// Call this function as close as possible to the start of your program (ideally in main)
|
// Call this function as close as possible to the start of your program (ideally in main).
|
||||||
//
|
//
|
||||||
// If you call Overload without any args it will default to loading .env in the current path
|
// If you call Overload without any args it will default to loading .env in the current path.
|
||||||
//
|
//
|
||||||
// You can otherwise tell it which files to load (there can be more than one) like
|
// You can otherwise tell it which files to load (there can be more than one) like:
|
||||||
//
|
//
|
||||||
// godotenv.Overload("fileone", "filetwo")
|
// godotenv.Overload("fileone", "filetwo")
|
||||||
//
|
//
|
||||||
|
@ -124,7 +124,7 @@ func Parse(r io.Reader) (envMap map[string]string, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//Unmarshal reads an env file from a string, returning a map of keys and values.
|
// Unmarshal reads an env file from a string, returning a map of keys and values.
|
||||||
func Unmarshal(str string) (envMap map[string]string, err error) {
|
func Unmarshal(str string) (envMap map[string]string, err error) {
|
||||||
return Parse(strings.NewReader(str))
|
return Parse(strings.NewReader(str))
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ func Unmarshal(str string) (envMap map[string]string, err error) {
|
||||||
// Exec loads env vars from the specified filenames (empty map falls back to default)
|
// Exec loads env vars from the specified filenames (empty map falls back to default)
|
||||||
// then executes the cmd specified.
|
// then executes the cmd specified.
|
||||||
//
|
//
|
||||||
// Simply hooks up os.Stdin/err/out to the command and calls Run()
|
// Simply hooks up os.Stdin/err/out to the command and calls Run().
|
||||||
//
|
//
|
||||||
// If you want more fine grained control over your command it's recommended
|
// If you want more fine grained control over your command it's recommended
|
||||||
// that you use `Load()` or `Read()` and the `os/exec` package yourself.
|
// that you use `Load()` or `Read()` and the `os/exec` package yourself.
|
||||||
|
@ -146,7 +146,7 @@ func Exec(filenames []string, cmd string, cmdArgs []string) error {
|
||||||
return command.Run()
|
return command.Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write serializes the given environment and writes it to a file
|
// Write serializes the given environment and writes it to a file.
|
||||||
func Write(envMap map[string]string, filename string) error {
|
func Write(envMap map[string]string, filename string) error {
|
||||||
content, err := Marshal(envMap)
|
content, err := Marshal(envMap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue