Migrating from govendor to go dep
Change-Id: I08f2863450e141f1fed0bdef4b9ba64157c7289d
diff --git a/vendor/github.com/kelseyhightower/envconfig/.travis.yml b/vendor/github.com/kelseyhightower/envconfig/.travis.yml
new file mode 100644
index 0000000..e15301a
--- /dev/null
+++ b/vendor/github.com/kelseyhightower/envconfig/.travis.yml
@@ -0,0 +1,7 @@
+language: go
+
+go:
+ - 1.4
+ - 1.5
+ - 1.6
+ - tip
diff --git a/vendor/github.com/kelseyhightower/envconfig/README.md b/vendor/github.com/kelseyhightower/envconfig/README.md
index 09de74b..b6c65a8 100644
--- a/vendor/github.com/kelseyhightower/envconfig/README.md
+++ b/vendor/github.com/kelseyhightower/envconfig/README.md
@@ -21,6 +21,7 @@
export MYAPP_RATE="0.5"
export MYAPP_TIMEOUT="3m"
export MYAPP_USERS="rob,ken,robert"
+export MYAPP_COLORCODES="red:1,green:2,blue:3"
```
Write some code:
@@ -37,12 +38,13 @@
)
type Specification struct {
- Debug bool
- Port int
- User string
- Users []string
- Rate float32
- Timeout time.Duration
+ Debug bool
+ Port int
+ User string
+ Users []string
+ Rate float32
+ Timeout time.Duration
+ ColorCodes map[string]int
}
func main() {
@@ -61,6 +63,11 @@
for _, u := range s.Users {
fmt.Printf(" %s\n", u)
}
+
+ fmt.Println("Color codes:")
+ for k, v := range s.ColorCodes {
+ fmt.Printf(" %s: %d\n", k, v)
+ }
}
```
@@ -76,6 +83,10 @@
rob
ken
robert
+Color codes:
+ red: 1
+ green: 2
+ blue: 3
```
## Struct Tag Support
@@ -145,6 +156,8 @@
* 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)
Embedded structs using these fields are also supported.
diff --git a/vendor/github.com/kelseyhightower/envconfig/envconfig.go b/vendor/github.com/kelseyhightower/envconfig/envconfig.go
index 3ad5e7d..892d746 100644
--- a/vendor/github.com/kelseyhightower/envconfig/envconfig.go
+++ b/vendor/github.com/kelseyhightower/envconfig/envconfig.go
@@ -265,6 +265,27 @@
}
}
field.Set(sl)
+ case reflect.Map:
+ pairs := strings.Split(value, ",")
+ mp := reflect.MakeMap(typ)
+ for _, pair := range pairs {
+ kvpair := strings.Split(pair, ":")
+ if len(kvpair) != 2 {
+ return fmt.Errorf("invalid map item: %q", pair)
+ }
+ k := reflect.New(typ.Key()).Elem()
+ err := processField(kvpair[0], k)
+ if err != nil {
+ return err
+ }
+ v := reflect.New(typ.Elem()).Elem()
+ err = processField(kvpair[1], v)
+ if err != nil {
+ return err
+ }
+ mp.SetMapIndex(k, v)
+ }
+ field.Set(mp)
}
return nil
diff --git a/vendor/github.com/kelseyhightower/envconfig/usage.go b/vendor/github.com/kelseyhightower/envconfig/usage.go
index 4870237..1846353 100644
--- a/vendor/github.com/kelseyhightower/envconfig/usage.go
+++ b/vendor/github.com/kelseyhightower/envconfig/usage.go
@@ -56,6 +56,12 @@
switch t.Kind() {
case reflect.Array, reflect.Slice:
return fmt.Sprintf("Comma-separated list of %s", toTypeDescription(t.Elem()))
+ case reflect.Map:
+ return fmt.Sprintf(
+ "Comma-separated list of %s:%s pairs",
+ toTypeDescription(t.Key()),
+ toTypeDescription(t.Elem()),
+ )
case reflect.Ptr:
return toTypeDescription(t.Elem())
case reflect.Struct: