Skip to content

Commit 2d00107

Browse files
author
Baptiste Boussemart
authored
Merge pull request #5 from objenious/go1.13
Go1.13, don't take PATH env variable
2 parents beef673 + 63bc023 commit 2d00107

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-0
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ go:
99
- 1.9.x
1010
- 1.10.x
1111
- 1.11.x
12+
- 1.12.x
13+
- 1.13.x
14+
- 1.x

envconfig.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ func generateAlternatives(matrice, name string) []string {
164164
split := strings.Split(matrice, "_")
165165
for i := 1; i < len(split); i++ {
166166
alt := strings.Join(split[i:], "_")
167+
if alt == "PATH" {
168+
break
169+
}
167170
alts = append(alts, alt)
168171
if alt == name {
169172
break

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/objenious/envconfig
2+
3+
go 1.13
4+
5+
require github.com/stretchr/testify v1.4.0

go.sum

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
2+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
6+
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
7+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
8+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
9+
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
10+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

path_env_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package envconfig
2+
3+
import "testing"
4+
5+
type cfPath struct {
6+
JSONPath string `envconfig:"json_path" default:"test"`
7+
}
8+
9+
func TestPath(t *testing.T) {
10+
config := &cfPath{}
11+
MustProcess("", config)
12+
if config.JSONPath != "test" {
13+
t.Logf("should be default, not path : %+v", config)
14+
t.Fail()
15+
}
16+
}

0 commit comments

Comments
 (0)