Upgrade server dependencies, manage them with govendor
This commit is contained in:
parent
ebee2746d6
commit
971278e7e5
1748 changed files with 196165 additions and 194500 deletions
38
vendor/github.com/spf13/cast/Makefile
generated
vendored
Normal file
38
vendor/github.com/spf13/cast/Makefile
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
# A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
||||
|
||||
.PHONY: check fmt lint test test-race vet test-cover-html help
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
check: test-race fmt vet lint ## Run tests and linters
|
||||
|
||||
test: ## Run tests
|
||||
go test ./...
|
||||
|
||||
test-race: ## Run tests with race detector
|
||||
go test -race ./...
|
||||
|
||||
fmt: ## Run gofmt linter
|
||||
@for d in `go list` ; do \
|
||||
if [ "`gofmt -l -s $$GOPATH/src/$$d | tee /dev/stderr`" ]; then \
|
||||
echo "^ improperly formatted go files" && echo && exit 1; \
|
||||
fi \
|
||||
done
|
||||
|
||||
lint: ## Run golint linter
|
||||
@for d in `go list` ; do \
|
||||
if [ "`golint $$d | tee /dev/stderr`" ]; then \
|
||||
echo "^ golint errors!" && echo && exit 1; \
|
||||
fi \
|
||||
done
|
||||
|
||||
vet: ## Run go vet linter
|
||||
@if [ "`go vet | tee /dev/stderr`" ]; then \
|
||||
echo "^ go vet errors!" && echo && exit 1; \
|
||||
fi
|
||||
|
||||
test-cover-html: ## Generate test coverage report
|
||||
go test -coverprofile=coverage.out -covermode=count
|
||||
go tool cover -func=coverage.out
|
||||
|
||||
help:
|
||||
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
3
vendor/github.com/spf13/cast/README.md
generated
vendored
3
vendor/github.com/spf13/cast/README.md
generated
vendored
|
@ -1,5 +1,8 @@
|
|||
cast
|
||||
====
|
||||
[](https://godoc.org/github.com/spf13/cast)
|
||||
[](https://travis-ci.org/spf13/cast)
|
||||
[](https://goreportcard.com/report/github.com/spf13/cast)
|
||||
|
||||
Easy and safe casting from one type to another in Go
|
||||
|
||||
|
|
86
vendor/github.com/spf13/cast/cast.go
generated
vendored
86
vendor/github.com/spf13/cast/cast.go
generated
vendored
|
@ -3,71 +3,157 @@
|
|||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package cast provides easy and safe casting in Go.
|
||||
package cast
|
||||
|
||||
import "time"
|
||||
|
||||
// ToBool casts an interface to a bool type.
|
||||
func ToBool(i interface{}) bool {
|
||||
v, _ := ToBoolE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToTime casts an interface to a time.Time type.
|
||||
func ToTime(i interface{}) time.Time {
|
||||
v, _ := ToTimeE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToDuration casts an interface to a time.Duration type.
|
||||
func ToDuration(i interface{}) time.Duration {
|
||||
v, _ := ToDurationE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToFloat64 casts an interface to a float64 type.
|
||||
func ToFloat64(i interface{}) float64 {
|
||||
v, _ := ToFloat64E(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToFloat32 casts an interface to a float32 type.
|
||||
func ToFloat32(i interface{}) float32 {
|
||||
v, _ := ToFloat32E(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToInt64 casts an interface to an int64 type.
|
||||
func ToInt64(i interface{}) int64 {
|
||||
v, _ := ToInt64E(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToInt32 casts an interface to an int32 type.
|
||||
func ToInt32(i interface{}) int32 {
|
||||
v, _ := ToInt32E(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToInt16 casts an interface to an int16 type.
|
||||
func ToInt16(i interface{}) int16 {
|
||||
v, _ := ToInt16E(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToInt8 casts an interface to an int8 type.
|
||||
func ToInt8(i interface{}) int8 {
|
||||
v, _ := ToInt8E(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToInt casts an interface to an int type.
|
||||
func ToInt(i interface{}) int {
|
||||
v, _ := ToIntE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToUint casts an interface to a uint type.
|
||||
func ToUint(i interface{}) uint {
|
||||
v, _ := ToUintE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToUint64 casts an interface to a uint64 type.
|
||||
func ToUint64(i interface{}) uint64 {
|
||||
v, _ := ToUint64E(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToUint32 casts an interface to a uint32 type.
|
||||
func ToUint32(i interface{}) uint32 {
|
||||
v, _ := ToUint32E(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToUint16 casts an interface to a uint16 type.
|
||||
func ToUint16(i interface{}) uint16 {
|
||||
v, _ := ToUint16E(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToUint8 casts an interface to a uint8 type.
|
||||
func ToUint8(i interface{}) uint8 {
|
||||
v, _ := ToUint8E(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToString casts an interface to a string type.
|
||||
func ToString(i interface{}) string {
|
||||
v, _ := ToStringE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToStringMapString casts an interface to a map[string]string type.
|
||||
func ToStringMapString(i interface{}) map[string]string {
|
||||
v, _ := ToStringMapStringE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToStringMapStringSlice casts an interface to a map[string][]string type.
|
||||
func ToStringMapStringSlice(i interface{}) map[string][]string {
|
||||
v, _ := ToStringMapStringSliceE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToStringMapBool casts an interface to a map[string]bool type.
|
||||
func ToStringMapBool(i interface{}) map[string]bool {
|
||||
v, _ := ToStringMapBoolE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToStringMap casts an interface to a map[string]interface{} type.
|
||||
func ToStringMap(i interface{}) map[string]interface{} {
|
||||
v, _ := ToStringMapE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToSlice casts an interface to a []interface{} type.
|
||||
func ToSlice(i interface{}) []interface{} {
|
||||
v, _ := ToSliceE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToBoolSlice casts an interface to a []bool type.
|
||||
func ToBoolSlice(i interface{}) []bool {
|
||||
v, _ := ToBoolSliceE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToStringSlice casts an interface to a []string type.
|
||||
func ToStringSlice(i interface{}) []string {
|
||||
v, _ := ToStringSliceE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToIntSlice casts an interface to a []int type.
|
||||
func ToIntSlice(i interface{}) []int {
|
||||
v, _ := ToIntSliceE(i)
|
||||
return v
|
||||
}
|
||||
|
||||
// ToDurationSlice casts an interface to a []time.Duration type.
|
||||
func ToDurationSlice(i interface{}) []time.Duration {
|
||||
v, _ := ToDurationSliceE(i)
|
||||
return v
|
||||
}
|
||||
|
|
164
vendor/github.com/spf13/cast/cast_test.go
generated
vendored
164
vendor/github.com/spf13/cast/cast_test.go
generated
vendored
|
@ -1,164 +0,0 @@
|
|||
// Copyright © 2014 Steve Francia <spf@spf13.com>.
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cast
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestToInt(t *testing.T) {
|
||||
var eight interface{} = 8
|
||||
assert.Equal(t, ToInt(8), 8)
|
||||
assert.Equal(t, ToInt(8.31), 8)
|
||||
assert.Equal(t, ToInt("8"), 8)
|
||||
assert.Equal(t, ToInt(true), 1)
|
||||
assert.Equal(t, ToInt(false), 0)
|
||||
assert.Equal(t, ToInt(eight), 8)
|
||||
}
|
||||
|
||||
func TestToFloat64(t *testing.T) {
|
||||
var eight interface{} = 8
|
||||
assert.Equal(t, ToFloat64(8), 8.00)
|
||||
assert.Equal(t, ToFloat64(8.31), 8.31)
|
||||
assert.Equal(t, ToFloat64("8.31"), 8.31)
|
||||
assert.Equal(t, ToFloat64(eight), 8.0)
|
||||
}
|
||||
|
||||
func TestToString(t *testing.T) {
|
||||
var foo interface{} = "one more time"
|
||||
assert.Equal(t, ToString(8), "8")
|
||||
assert.Equal(t, ToString(8.12), "8.12")
|
||||
assert.Equal(t, ToString([]byte("one time")), "one time")
|
||||
assert.Equal(t, ToString(template.HTML("one time")), "one time")
|
||||
assert.Equal(t, ToString(template.URL("http://somehost.foo")), "http://somehost.foo")
|
||||
assert.Equal(t, ToString(foo), "one more time")
|
||||
assert.Equal(t, ToString(nil), "")
|
||||
assert.Equal(t, ToString(true), "true")
|
||||
assert.Equal(t, ToString(false), "false")
|
||||
}
|
||||
|
||||
type foo struct {
|
||||
val string
|
||||
}
|
||||
|
||||
func (x foo) String() string {
|
||||
return x.val
|
||||
}
|
||||
|
||||
func TestStringerToString(t *testing.T) {
|
||||
|
||||
var x foo
|
||||
x.val = "bar"
|
||||
assert.Equal(t, "bar", ToString(x))
|
||||
}
|
||||
|
||||
type fu struct {
|
||||
val string
|
||||
}
|
||||
|
||||
func (x fu) Error() string {
|
||||
return x.val
|
||||
}
|
||||
|
||||
func TestErrorToString(t *testing.T) {
|
||||
var x fu
|
||||
x.val = "bar"
|
||||
assert.Equal(t, "bar", ToString(x))
|
||||
}
|
||||
|
||||
func TestMaps(t *testing.T) {
|
||||
var taxonomies = map[interface{}]interface{}{"tag": "tags", "group": "groups"}
|
||||
var stringMapBool = map[interface{}]interface{}{"v1": true, "v2": false}
|
||||
|
||||
// ToStringMapString inputs/outputs
|
||||
var stringMapString = map[string]string{"key 1": "value 1", "key 2": "value 2", "key 3": "value 3"}
|
||||
var stringMapInterface = map[string]interface{}{"key 1": "value 1", "key 2": "value 2", "key 3": "value 3"}
|
||||
var interfaceMapString = map[interface{}]string{"key 1": "value 1", "key 2": "value 2", "key 3": "value 3"}
|
||||
var interfaceMapInterface = map[interface{}]interface{}{"key 1": "value 1", "key 2": "value 2", "key 3": "value 3"}
|
||||
|
||||
// ToStringMapStringSlice inputs/outputs
|
||||
var stringMapStringSlice = map[string][]string{"key 1": []string{"value 1", "value 2", "value 3"}, "key 2": []string{"value 1", "value 2", "value 3"}, "key 3": []string{"value 1", "value 2", "value 3"}}
|
||||
var stringMapInterfaceSlice = map[string][]interface{}{"key 1": []interface{}{"value 1", "value 2", "value 3"}, "key 2": []interface{}{"value 1", "value 2", "value 3"}, "key 3": []interface{}{"value 1", "value 2", "value 3"}}
|
||||
var stringMapStringSingleSliceFieldsResult = map[string][]string{"key 1": []string{"value", "1"}, "key 2": []string{"value", "2"}, "key 3": []string{"value", "3"}}
|
||||
var interfaceMapStringSlice = map[interface{}][]string{"key 1": []string{"value 1", "value 2", "value 3"}, "key 2": []string{"value 1", "value 2", "value 3"}, "key 3": []string{"value 1", "value 2", "value 3"}}
|
||||
var interfaceMapInterfaceSlice = map[interface{}][]interface{}{"key 1": []interface{}{"value 1", "value 2", "value 3"}, "key 2": []interface{}{"value 1", "value 2", "value 3"}, "key 3": []interface{}{"value 1", "value 2", "value 3"}}
|
||||
|
||||
var stringMapStringSliceMultiple = map[string][]string{"key 1": []string{"value 1", "value 2", "value 3"}, "key 2": []string{"value 1", "value 2", "value 3"}, "key 3": []string{"value 1", "value 2", "value 3"}}
|
||||
var stringMapStringSliceSingle = map[string][]string{"key 1": []string{"value 1"}, "key 2": []string{"value 2"}, "key 3": []string{"value 3"}}
|
||||
|
||||
assert.Equal(t, ToStringMap(taxonomies), map[string]interface{}{"tag": "tags", "group": "groups"})
|
||||
assert.Equal(t, ToStringMapBool(stringMapBool), map[string]bool{"v1": true, "v2": false})
|
||||
|
||||
// ToStringMapString tests
|
||||
assert.Equal(t, ToStringMapString(stringMapString), stringMapString)
|
||||
assert.Equal(t, ToStringMapString(stringMapInterface), stringMapString)
|
||||
assert.Equal(t, ToStringMapString(interfaceMapString), stringMapString)
|
||||
assert.Equal(t, ToStringMapString(interfaceMapInterface), stringMapString)
|
||||
|
||||
// ToStringMapStringSlice tests
|
||||
assert.Equal(t, ToStringMapStringSlice(stringMapStringSlice), stringMapStringSlice)
|
||||
assert.Equal(t, ToStringMapStringSlice(stringMapInterfaceSlice), stringMapStringSlice)
|
||||
assert.Equal(t, ToStringMapStringSlice(stringMapStringSliceMultiple), stringMapStringSlice)
|
||||
assert.Equal(t, ToStringMapStringSlice(stringMapStringSliceMultiple), stringMapStringSlice)
|
||||
assert.Equal(t, ToStringMapStringSlice(stringMapString), stringMapStringSliceSingle)
|
||||
assert.Equal(t, ToStringMapStringSlice(stringMapInterface), stringMapStringSliceSingle)
|
||||
assert.Equal(t, ToStringMapStringSlice(interfaceMapStringSlice), stringMapStringSlice)
|
||||
assert.Equal(t, ToStringMapStringSlice(interfaceMapInterfaceSlice), stringMapStringSlice)
|
||||
assert.Equal(t, ToStringMapStringSlice(interfaceMapString), stringMapStringSingleSliceFieldsResult)
|
||||
assert.Equal(t, ToStringMapStringSlice(interfaceMapInterface), stringMapStringSingleSliceFieldsResult)
|
||||
}
|
||||
|
||||
func TestSlices(t *testing.T) {
|
||||
assert.Equal(t, []string{"a", "b"}, ToStringSlice([]string{"a", "b"}))
|
||||
assert.Equal(t, []string{"1", "3"}, ToStringSlice([]interface{}{1, 3}))
|
||||
assert.Equal(t, []int{1, 3}, ToIntSlice([]int{1, 3}))
|
||||
assert.Equal(t, []int{1, 3}, ToIntSlice([]interface{}{1.2, 3.2}))
|
||||
assert.Equal(t, []int{2, 3}, ToIntSlice([]string{"2", "3"}))
|
||||
assert.Equal(t, []int{2, 3}, ToIntSlice([2]string{"2", "3"}))
|
||||
}
|
||||
|
||||
func TestToBool(t *testing.T) {
|
||||
assert.Equal(t, ToBool(0), false)
|
||||
assert.Equal(t, ToBool(nil), false)
|
||||
assert.Equal(t, ToBool("false"), false)
|
||||
assert.Equal(t, ToBool("FALSE"), false)
|
||||
assert.Equal(t, ToBool("False"), false)
|
||||
assert.Equal(t, ToBool("f"), false)
|
||||
assert.Equal(t, ToBool("F"), false)
|
||||
assert.Equal(t, ToBool(false), false)
|
||||
assert.Equal(t, ToBool("foo"), false)
|
||||
|
||||
assert.Equal(t, ToBool("true"), true)
|
||||
assert.Equal(t, ToBool("TRUE"), true)
|
||||
assert.Equal(t, ToBool("True"), true)
|
||||
assert.Equal(t, ToBool("t"), true)
|
||||
assert.Equal(t, ToBool("T"), true)
|
||||
assert.Equal(t, ToBool(1), true)
|
||||
assert.Equal(t, ToBool(true), true)
|
||||
assert.Equal(t, ToBool(-1), true)
|
||||
}
|
||||
|
||||
func TestIndirectPointers(t *testing.T) {
|
||||
x := 13
|
||||
y := &x
|
||||
z := &y
|
||||
|
||||
assert.Equal(t, ToInt(y), 13)
|
||||
assert.Equal(t, ToInt(z), 13)
|
||||
}
|
||||
|
||||
func TestToDuration(t *testing.T) {
|
||||
a := time.Second * 5
|
||||
ai := int64(a)
|
||||
b := time.Second * 5
|
||||
bf := float64(b)
|
||||
assert.Equal(t, ToDuration(ai), a)
|
||||
assert.Equal(t, ToDuration(bf), b)
|
||||
}
|
856
vendor/github.com/spf13/cast/caste.go
generated
vendored
856
vendor/github.com/spf13/cast/caste.go
generated
vendored
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue