Skip to content

Commit

Permalink
update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mfridman committed Dec 22, 2023
1 parent c1f3959 commit 3800c88
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions env.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import (
"strings"
)

// Env is an interface for getting environment variables by name and returning a boolean indicating
// whether the variable was found.
type Env interface {
Get(key string) (string, bool)
}

// Creates an Env from a slice of environment variables
// NewSliceEnv creates an Env from a slice of environment variables in the form "key=value".
//
// This can be used with [os.Environ] to create an Env.
func NewSliceEnv(env []string) Env {
envMap := mapEnv{}
for _, l := range env {
Expand All @@ -21,7 +25,7 @@ func NewSliceEnv(env []string) Env {
return envMap
}

// Creates an Env from a map of environment variables
// NewMapEnv creates an Env from a map of environment variables.
func NewMapEnv(env map[string]string) Env {
envMap := mapEnv{}
for k, v := range env {
Expand Down

0 comments on commit 3800c88

Please sign in to comment.