Skip to content

Commit

Permalink
chore(doc): fix use semicolon not comma as map separator in example u…
Browse files Browse the repository at this point in the history
…sage
  • Loading branch information
Anddor committed Oct 31, 2024
1 parent d3a94c5 commit 3b3dbf7
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export MYAPP_USER=Kelsey
export MYAPP_RATE="0.5"
export MYAPP_TIMEOUT="3m"
export MYAPP_USERS="rob,ken,robert"
export MYAPP_COLORCODES="red:1,green:2,blue:3"
export MYAPP_COLORCODES="red:1;green:2;blue:3"
```

Write some code:
Expand Down Expand Up @@ -144,7 +144,7 @@ If envconfig can't find an environment variable value for `MYAPP_DEFAULTVAR`,
it will populate it with "foobar" as a default value.

If envconfig can't find an environment variable value for `MYAPP_REQUIREDVAR`,
it will return an error when asked to process the struct. If
it will return an error when asked to process the struct. If
`MYAPP_REQUIREDVAR` is present but empty, envconfig will not return an error.

If envconfig can't find an environment variable in the form `PREFIX_MYVAR`, and there
Expand All @@ -155,6 +155,7 @@ variable that directly matches the envconfig tag in your struct definition:
export SERVICE_HOST=127.0.0.1
export MYAPP_DEBUG=true
```

```Go
type Specification struct {
ServiceHost string `envconfig:"SERVICE_HOST"`
Expand All @@ -169,15 +170,15 @@ environment variable is set.

envconfig supports these struct field types:

* string
* int8, int16, int32, int64
* bool
* float32, float64
* slices of any supported type
* maps (keys and values of any supported type)
* [encoding.TextUnmarshaler](https://golang.org/pkg/encoding/#TextUnmarshaler)
* [encoding.BinaryUnmarshaler](https://golang.org/pkg/encoding/#BinaryUnmarshaler)
* [time.Duration](https://golang.org/pkg/time/#Duration)
- string
- int8, int16, int32, int64
- bool
- float32, float64
- slices of any supported type
- maps (keys and values of any supported type)
- [encoding.TextUnmarshaler](https://golang.org/pkg/encoding/#TextUnmarshaler)
- [encoding.BinaryUnmarshaler](https://golang.org/pkg/encoding/#BinaryUnmarshaler)
- [time.Duration](https://golang.org/pkg/time/#Duration)

Embedded structs using these fields are also supported.

Expand Down

0 comments on commit 3b3dbf7

Please sign in to comment.