├── vendor ├── github.com │ ├── Masterminds │ │ ├── semver │ │ │ └── v3 │ │ │ │ ├── .gitignore │ │ │ │ ├── go.mod │ │ │ │ ├── .golangci.yml │ │ │ │ ├── fuzz.go │ │ │ │ ├── collection.go │ │ │ │ ├── Makefile │ │ │ │ └── LICENSE.txt │ │ ├── sprig │ │ │ └── v3 │ │ │ │ ├── .gitignore │ │ │ │ ├── Makefile │ │ │ │ ├── network.go │ │ │ │ ├── semver.go │ │ │ │ ├── go.mod │ │ │ │ ├── reflect.go │ │ │ │ ├── doc.go │ │ │ │ ├── LICENSE.txt │ │ │ │ ├── url.go │ │ │ │ └── regex.go │ │ └── goutils │ │ │ ├── CHANGELOG.md │ │ │ ├── appveyor.yml │ │ │ ├── .travis.yml │ │ │ └── README.md │ ├── pelletier │ │ ├── go-buffruneio │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── README.md │ │ │ └── buffruneio.go │ │ └── go-toml │ │ │ ├── .gitignore │ │ │ ├── clean.sh │ │ │ ├── .travis.yml │ │ │ ├── example.toml │ │ │ ├── example-crlf.toml │ │ │ ├── position.go │ │ │ ├── LICENSE │ │ │ ├── keysparsing.go │ │ │ ├── test.sh │ │ │ └── token.go │ ├── spf13 │ │ ├── pflag │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── int.go │ │ │ ├── count.go │ │ │ ├── golangflag.go │ │ │ ├── string.go │ │ │ ├── int64.go │ │ │ ├── int8.go │ │ │ ├── uint.go │ │ │ ├── uint8.go │ │ │ ├── int32.go │ │ │ ├── ip.go │ │ │ ├── uint16.go │ │ │ ├── float64.go │ │ │ ├── uint32.go │ │ │ ├── uint64.go │ │ │ ├── bool.go │ │ │ └── float32.go │ │ ├── cobra │ │ │ ├── command_notwin.go │ │ │ ├── .mailmap │ │ │ ├── command_win.go │ │ │ ├── .gitignore │ │ │ └── .travis.yml │ │ └── cast │ │ │ ├── go.mod │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── go.sum │ │ │ ├── LICENSE │ │ │ ├── Makefile │ │ │ └── README.md │ ├── mitchellh │ │ ├── reflectwalk │ │ │ ├── .travis.yml │ │ │ ├── go.mod │ │ │ ├── README.md │ │ │ ├── location.go │ │ │ ├── location_string.go │ │ │ └── LICENSE │ │ └── copystructure │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── copier_time.go │ │ │ ├── README.md │ │ │ └── LICENSE │ ├── google │ │ └── uuid │ │ │ ├── go.mod │ │ │ ├── .travis.yml │ │ │ ├── CONTRIBUTORS │ │ │ ├── CONTRIBUTING.md │ │ │ ├── doc.go │ │ │ ├── node_js.go │ │ │ ├── README.md │ │ │ ├── marshal.go │ │ │ ├── node_net.go │ │ │ ├── version1.go │ │ │ ├── LICENSE │ │ │ ├── sql.go │ │ │ ├── hash.go │ │ │ ├── util.go │ │ │ ├── version4.go │ │ │ ├── dce.go │ │ │ ├── node.go │ │ │ └── null.go │ ├── huandu │ │ └── xstrings │ │ │ ├── go.mod │ │ │ ├── stringbuilder.go │ │ │ ├── stringbuilder_go110.go │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── doc.go │ │ │ ├── common.go │ │ │ ├── LICENSE │ │ │ ├── CONTRIBUTING.md │ │ │ └── count.go │ ├── shopspring │ │ └── decimal │ │ │ ├── go.mod │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── CHANGELOG.md │ │ │ └── LICENSE │ ├── imdario │ │ └── mergo │ │ │ ├── go.mod │ │ │ ├── .deepsource.toml │ │ │ ├── .travis.yml │ │ │ ├── go.sum │ │ │ ├── .gitignore │ │ │ ├── LICENSE │ │ │ ├── mergo.go │ │ │ └── CODE_OF_CONDUCT.md │ ├── pkg │ │ └── errors │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── appveyor.yml │ │ │ ├── LICENSE │ │ │ └── README.md │ ├── stretchr │ │ └── testify │ │ │ ├── assert │ │ │ ├── assertion_format.go.tmpl │ │ │ ├── assertion_forward.go.tmpl │ │ │ ├── errors.go │ │ │ ├── forward_assertions.go │ │ │ └── doc.go │ │ │ └── LICENSE │ ├── inconshreveable │ │ └── mousetrap │ │ │ ├── trap_others.go │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── trap_windows_1.4.go │ │ │ └── trap_windows.go │ ├── davecgh │ │ └── go-spew │ │ │ ├── LICENSE │ │ │ └── spew │ │ │ └── bypasssafe.go │ └── pmezard │ │ └── go-difflib │ │ └── LICENSE ├── gopkg.in │ ├── yaml.v2 │ │ ├── go.mod │ │ ├── .travis.yml │ │ ├── NOTICE │ │ ├── writerc.go │ │ ├── LICENSE.libyaml │ │ ├── sorter.go │ │ └── README.md │ └── yaml.v3 │ │ ├── go.mod │ │ ├── .travis.yml │ │ ├── NOTICE │ │ ├── writerc.go │ │ └── LICENSE ├── golang.org │ └── x │ │ └── crypto │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── bcrypt │ │ └── base64.go │ │ ├── PATENTS │ │ ├── LICENSE │ │ └── pbkdf2 │ │ └── pbkdf2.go └── modules.txt ├── Dockerfile ├── .gitignore ├── main.go ├── Makefile ├── go.mod ├── LICENSE ├── gosubst ├── gosubst_test.go └── gosubst.go ├── cmd └── root.go └── README.md /vendor/github.com/Masterminds/semver/v3/.gitignore: -------------------------------------------------------------------------------- 1 | _fuzz/ -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-buffruneio/.gitignore: -------------------------------------------------------------------------------- 1 | *.test -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* 2 | 3 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/sprig/v3/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | /.glide 3 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/google/uuid 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.14 2 | 3 | RUN go get github.com/mitchellh/gox 4 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/.gitignore: -------------------------------------------------------------------------------- 1 | test_program/test_program_bin 2 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/mitchellh/reflectwalk 2 | -------------------------------------------------------------------------------- /vendor/github.com/huandu/xstrings/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/huandu/xstrings 2 | 3 | go 1.12 4 | -------------------------------------------------------------------------------- /vendor/github.com/shopspring/decimal/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/shopspring/decimal 2 | 3 | go 1.13 4 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/v3/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/Masterminds/semver/v3 2 | 3 | go 1.12 4 | -------------------------------------------------------------------------------- /vendor/github.com/shopspring/decimal/.gitignore: -------------------------------------------------------------------------------- 1 | .git 2 | *.swp 3 | 4 | # IntelliJ 5 | .idea/ 6 | *.iml 7 | -------------------------------------------------------------------------------- /vendor/github.com/imdario/mergo/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/imdario/mergo 2 | 3 | go 1.13 4 | 5 | require gopkg.in/yaml.v2 v2.3.0 6 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/command_notwin.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package cobra 4 | 5 | var preExecHookFn func(*Command) 6 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/go.mod: -------------------------------------------------------------------------------- 1 | module "gopkg.in/yaml.v2" 2 | 3 | require ( 4 | "gopkg.in/check.v1" v0.0.0-20161208181325-20d25e280405 5 | ) 6 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v3/go.mod: -------------------------------------------------------------------------------- 1 | module "gopkg.in/yaml.v3" 2 | 3 | require ( 4 | "gopkg.in/check.v1" v0.0.0-20161208181325-20d25e280405 5 | ) 6 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-buffruneio/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | go: 4 | - 1.3.3 5 | - 1.4.3 6 | - 1.5.3 7 | - tip 8 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4.3 5 | - 1.5.3 6 | - tip 7 | 8 | script: 9 | - go test -v ./... 10 | -------------------------------------------------------------------------------- /vendor/github.com/huandu/xstrings/stringbuilder.go: -------------------------------------------------------------------------------- 1 | //+build go1.10 2 | 3 | package xstrings 4 | 5 | import "strings" 6 | 7 | type stringBuilder = strings.Builder 8 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/mitchellh/copystructure 2 | 3 | go 1.15 4 | 5 | require github.com/mitchellh/reflectwalk v1.0.2 6 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Paul Borman 2 | bmatsuo 3 | shawnps 4 | theory 5 | jboverfelt 6 | dsymonds 7 | cd1 8 | wallclockbuilder 9 | dansouza 10 | -------------------------------------------------------------------------------- /vendor/github.com/huandu/xstrings/stringbuilder_go110.go: -------------------------------------------------------------------------------- 1 | //+build !go1.10 2 | 3 | package xstrings 4 | 5 | import "bytes" 6 | 7 | type stringBuilder struct { 8 | bytes.Buffer 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # fail out of the script if anything here fails 3 | set -e 4 | 5 | # clear out stuff generated by test.sh 6 | rm -rf src test_program_bin toml-test 7 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/goutils/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.1 (2017-05-31) 2 | 3 | ## Fixed 4 | - #21: Fix generation of alphanumeric strings (thanks @dbarranco) 5 | 6 | # 1.0.0 (2014-04-30) 7 | 8 | - Initial release. 9 | -------------------------------------------------------------------------------- /vendor/github.com/shopspring/decimal/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.7.x 5 | - 1.12.x 6 | - 1.13.x 7 | - tip 8 | 9 | install: 10 | - go build . 11 | 12 | script: 13 | - go test -v 14 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/.mailmap: -------------------------------------------------------------------------------- 1 | Steve Francia 2 | Bjørn Erik Pedersen 3 | Fabiano Franz 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at https://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at https://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go_import_path: github.com/pkg/errors 3 | go: 4 | - 1.4.3 5 | - 1.5.4 6 | - 1.6.2 7 | - 1.7.1 8 | - tip 9 | 10 | script: 11 | - go test -v ./... 12 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/spf13/cast 2 | 3 | require ( 4 | github.com/davecgh/go-spew v1.1.1 // indirect 5 | github.com/pmezard/go-difflib v1.0.0 // indirect 6 | github.com/stretchr/testify v1.2.2 7 | ) 8 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/go.sum: -------------------------------------------------------------------------------- 1 | github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= 2 | github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= 3 | -------------------------------------------------------------------------------- /vendor/github.com/imdario/mergo/.deepsource.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | test_patterns = [ 4 | "*_test.go" 5 | ] 6 | 7 | [[analyzers]] 8 | name = "go" 9 | enabled = true 10 | 11 | [analyzers.meta] 12 | import_path = "github.com/imdario/mergo" -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/sprig/v3/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: test 2 | test: 3 | @echo "==> Running tests" 4 | GO111MODULE=on go test -v 5 | 6 | .PHONY: test-cover 7 | test-cover: 8 | @echo "==> Running Tests with coverage" 9 | GO111MODULE=on go test -cover . 10 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentFormat}} 2 | func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool { 3 | if h, ok := t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentWithoutT "a"}} 2 | func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { 3 | if h, ok := a.t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | env: 3 | - GO111MODULE=on 4 | sudo: required 5 | go: 6 | - "1.11.x" 7 | - "1.12.x" 8 | - tip 9 | os: 10 | - linux 11 | matrix: 12 | allow_failures: 13 | - go: tip 14 | fast_finish: true 15 | script: 16 | - make check 17 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/sprig/v3/network.go: -------------------------------------------------------------------------------- 1 | package sprig 2 | 3 | import ( 4 | "math/rand" 5 | "net" 6 | ) 7 | 8 | func getHostByName(name string) string { 9 | addrs, _ := net.LookupHost(name) 10 | //TODO: add error handing when release v3 comes out 11 | return addrs[rand.Intn(len(addrs))] 12 | } 13 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - "1.4.x" 5 | - "1.5.x" 6 | - "1.6.x" 7 | - "1.7.x" 8 | - "1.8.x" 9 | - "1.9.x" 10 | - "1.10.x" 11 | - "1.11.x" 12 | - "1.12.x" 13 | - "1.13.x" 14 | - "tip" 15 | 16 | go_import_path: gopkg.in/yaml.v2 17 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v3/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - "1.4.x" 5 | - "1.5.x" 6 | - "1.6.x" 7 | - "1.7.x" 8 | - "1.8.x" 9 | - "1.9.x" 10 | - "1.10.x" 11 | - "1.11.x" 12 | - "1.12.x" 13 | - "1.13.x" 14 | - "tip" 15 | 16 | go_import_path: gopkg.in/yaml.v3 17 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/README.md: -------------------------------------------------------------------------------- 1 | # reflectwalk 2 | 3 | reflectwalk is a Go library for "walking" a value in Go using reflection, 4 | in the same way a directory tree can be "walked" on the filesystem. Walking 5 | a complex structure can allow you to do manipulations on unknown structures 6 | such as those decoded from JSON. 7 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/copier_time.go: -------------------------------------------------------------------------------- 1 | package copystructure 2 | 3 | import ( 4 | "reflect" 5 | "time" 6 | ) 7 | 8 | func init() { 9 | Copiers[reflect.TypeOf(time.Time{})] = timeCopier 10 | } 11 | 12 | func timeCopier(v interface{}) (interface{}, error) { 13 | // Just... copy it. 14 | return v.(time.Time), nil 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/location.go: -------------------------------------------------------------------------------- 1 | package reflectwalk 2 | 3 | //go:generate stringer -type=Location location.go 4 | 5 | type Location uint 6 | 7 | const ( 8 | None Location = iota 9 | Map 10 | MapKey 11 | MapValue 12 | Slice 13 | SliceElem 14 | Array 15 | ArrayElem 16 | Struct 17 | StructField 18 | WalkLoc 19 | ) 20 | -------------------------------------------------------------------------------- /vendor/github.com/imdario/mergo/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | arch: 3 | - amd64 4 | - ppc64le 5 | install: 6 | - go get -t 7 | - go get golang.org/x/tools/cmd/cover 8 | - go get github.com/mattn/goveralls 9 | script: 10 | - go test -race -v ./... 11 | after_script: 12 | - $HOME/gopath/bin/goveralls -service=travis-ci -repotoken $COVERALLS_TOKEN 13 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | We definitely welcome patches and contribution to this project! 4 | 5 | ### Legal requirements 6 | 7 | In order to protect both you and ourselves, you will need to sign the 8 | [Contributor License Agreement](https://cla.developers.google.com/clas). 9 | 10 | You may have already signed it for other Google projects. 11 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/goutils/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: build-{build}.{branch} 2 | 3 | clone_folder: C:\gopath\src\github.com\Masterminds\goutils 4 | shallow_clone: true 5 | 6 | environment: 7 | GOPATH: C:\gopath 8 | 9 | platform: 10 | - x64 11 | 12 | build: off 13 | 14 | install: 15 | - go version 16 | - go env 17 | 18 | test_script: 19 | - go test -v 20 | 21 | deploy: off 22 | -------------------------------------------------------------------------------- /vendor/github.com/imdario/mergo/go.sum: -------------------------------------------------------------------------------- 1 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 2 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 3 | gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= 4 | gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 5 | -------------------------------------------------------------------------------- /vendor/github.com/huandu/xstrings/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | install: 3 | - go get golang.org/x/tools/cmd/cover 4 | - go get github.com/mattn/goveralls 5 | script: 6 | - go test -v -covermode=count -coverprofile=coverage.out 7 | - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ ! -z "$COVERALLS_TOKEN" ]; then $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN; fi' 8 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/errors.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // AnError is an error instance useful for testing. If the code does not care 8 | // about error specifics, and only needs to return the error for example, this 9 | // error should be used to make the test code more readable. 10 | var AnError = errors.New("assert.AnError general error for testing") 11 | -------------------------------------------------------------------------------- /vendor/github.com/huandu/xstrings/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | 25 | *.bench 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | _bin 10 | _dist 11 | 12 | # Architecture specific extensions/prefixes 13 | *.[568vq] 14 | [568vq].out 15 | 16 | *.cgo1.go 17 | *.cgo2.c 18 | _cgo_defun.c 19 | _cgo_gotypes.go 20 | _cgo_export.* 21 | 22 | _testmain.go 23 | 24 | *.exe 25 | *.test 26 | *.prof 27 | 28 | .DS_Store 29 | -------------------------------------------------------------------------------- /vendor/github.com/huandu/xstrings/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Huan Du. All rights reserved. 2 | // Licensed under the MIT license that can be found in the LICENSE file. 3 | 4 | // Package xstrings is to provide string algorithms which are useful but not included in `strings` package. 5 | // See project home page for details. https://github.com/huandu/xstrings 6 | // 7 | // Package xstrings assumes all strings are encoded in utf8. 8 | package xstrings 9 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: go 4 | 5 | go: 6 | - 1.6.3 7 | - 1.7.3 8 | - tip 9 | 10 | matrix: 11 | allow_failures: 12 | - go: tip 13 | install: 14 | - go get github.com/golang/lint/golint 15 | - export PATH=$GOPATH/bin:$PATH 16 | - go install ./... 17 | 18 | script: 19 | - verify/all.sh -v 20 | - go test ./... 21 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package uuid generates and inspects UUIDs. 6 | // 7 | // UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security 8 | // Services. 9 | // 10 | // A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to 11 | // maps or compared directly. 12 | package uuid 13 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/v3/.golangci.yml: -------------------------------------------------------------------------------- 1 | run: 2 | deadline: 2m 3 | 4 | linters: 5 | disable-all: true 6 | enable: 7 | - deadcode 8 | - dupl 9 | - errcheck 10 | - gofmt 11 | - goimports 12 | - golint 13 | - gosimple 14 | - govet 15 | - ineffassign 16 | - misspell 17 | - nakedret 18 | - structcheck 19 | - unused 20 | - varcheck 21 | 22 | linters-settings: 23 | gofmt: 24 | simplify: true 25 | dupl: 26 | threshold: 400 27 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/goutils/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.6 5 | - 1.7 6 | - 1.8 7 | - tip 8 | 9 | script: 10 | - go test -v 11 | 12 | notifications: 13 | webhooks: 14 | urls: 15 | - https://webhooks.gitter.im/e/06e3328629952dabe3e0 16 | on_success: change # options: [always|never|change] default: always 17 | on_failure: always # options: [always|never|change] default: always 18 | on_start: never # options: [always|never|change] default: always 19 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.5.4 4 | - 1.6.4 5 | - 1.7.4 6 | - tip 7 | matrix: 8 | allow_failures: 9 | - go: tip 10 | fast_finish: true 11 | script: 12 | - ./test.sh 13 | before_install: 14 | - go get github.com/axw/gocov/gocov 15 | - go get github.com/mattn/goveralls 16 | - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi 17 | after_success: 18 | - $HOME/gopath/bin/goveralls -service=travis-ci 19 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/sprig/v3/semver.go: -------------------------------------------------------------------------------- 1 | package sprig 2 | 3 | import ( 4 | sv2 "github.com/Masterminds/semver/v3" 5 | ) 6 | 7 | func semverCompare(constraint, version string) (bool, error) { 8 | c, err := sv2.NewConstraint(constraint) 9 | if err != nil { 10 | return false, err 11 | } 12 | 13 | v, err := sv2.NewVersion(version) 14 | if err != nil { 15 | return false, err 16 | } 17 | 18 | return c.Check(v), nil 19 | } 20 | 21 | func semver(version string) (*sv2.Version, error) { 22 | return sv2.NewVersion(version) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/sprig/v3/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/Masterminds/sprig/v3 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/Masterminds/goutils v1.1.1 7 | github.com/Masterminds/semver/v3 v3.1.1 8 | github.com/google/uuid v1.1.1 9 | github.com/huandu/xstrings v1.3.1 10 | github.com/imdario/mergo v0.3.11 11 | github.com/mitchellh/copystructure v1.0.0 12 | github.com/shopspring/decimal v1.2.0 13 | github.com/spf13/cast v1.3.1 14 | github.com/stretchr/testify v1.5.1 15 | golang.org/x/crypto v0.0.0-20200414173820-0848c9571904 16 | ) 17 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/forward_assertions.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs" 17 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 2 | github.com/davecgh/go-spew v1.1.1/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/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= 6 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 7 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/node_js.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build js 6 | 7 | package uuid 8 | 9 | // getHardwareInterface returns nil values for the JS version of the code. 10 | // This remvoves the "net" dependency, because it is not used in the browser. 11 | // Using the "net" library inflates the size of the transpiled JS code by 673k bytes. 12 | func getHardwareInterface(name string) (string, []byte) { return "", nil } 13 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/trap_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package mousetrap 4 | 5 | // StartedByExplorer returns true if the program was invoked by the user 6 | // double-clicking on the executable from explorer.exe 7 | // 8 | // It is conservative and returns false if any of the internal calls fail. 9 | // It does not guarantee that the program was run from a terminal. It only can tell you 10 | // whether it was launched from explorer.exe 11 | // 12 | // On non-Windows platforms, it always returns false. 13 | func StartedByExplorer() bool { 14 | return false 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/location_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=Location location.go"; DO NOT EDIT. 2 | 3 | package reflectwalk 4 | 5 | import "fmt" 6 | 7 | const _Location_name = "NoneMapMapKeyMapValueSliceSliceElemArrayArrayElemStructStructFieldWalkLoc" 8 | 9 | var _Location_index = [...]uint8{0, 4, 7, 13, 21, 26, 35, 40, 49, 55, 66, 73} 10 | 11 | func (i Location) String() string { 12 | if i >= Location(len(_Location_index)-1) { 13 | return fmt.Sprintf("Location(%d)", i) 14 | } 15 | return _Location_name[_Location_index[i]:_Location_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/command_win.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package cobra 4 | 5 | import ( 6 | "os" 7 | "time" 8 | 9 | "github.com/inconshreveable/mousetrap" 10 | ) 11 | 12 | var preExecHookFn = preExecHook 13 | 14 | // enables an information splash screen on Windows if the CLI is started from explorer.exe. 15 | var MousetrapHelpText string = `This is a command line tool 16 | 17 | You need to open cmd.exe and run it from there. 18 | ` 19 | 20 | func preExecHook(c *Command) { 21 | if mousetrap.StartedByExplorer() { 22 | c.Print(MousetrapHelpText) 23 | time.Sleep(5 * time.Second) 24 | os.Exit(1) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2011-2016 Canonical Ltd. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v3/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2011-2016 Canonical Ltd. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Alan Shreve 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/README.md: -------------------------------------------------------------------------------- 1 | # copystructure 2 | 3 | copystructure is a Go library for deep copying values in Go. 4 | 5 | This allows you to copy Go values that may contain reference values 6 | such as maps, slices, or pointers, and copy their data as well instead 7 | of just their references. 8 | 9 | ## Installation 10 | 11 | Standard `go get`: 12 | 13 | ``` 14 | $ go get github.com/mitchellh/copystructure 15 | ``` 16 | 17 | ## Usage & Example 18 | 19 | For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/copystructure). 20 | 21 | The `Copy` function has examples associated with it there. 22 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/v3/fuzz.go: -------------------------------------------------------------------------------- 1 | // +build gofuzz 2 | 3 | package semver 4 | 5 | func Fuzz(data []byte) int { 6 | d := string(data) 7 | 8 | // Test NewVersion 9 | _, _ = NewVersion(d) 10 | 11 | // Test StrictNewVersion 12 | _, _ = StrictNewVersion(d) 13 | 14 | // Test NewConstraint 15 | _, _ = NewConstraint(d) 16 | 17 | // The return value should be 0 normally, 1 if the priority in future tests 18 | // should be increased, and -1 if future tests should skip passing in that 19 | // data. We do not have a reason to change priority so 0 is always returned. 20 | // There are example tests that do this. 21 | return 0 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/huandu/xstrings/common.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Huan Du. All rights reserved. 2 | // Licensed under the MIT license that can be found in the LICENSE file. 3 | 4 | package xstrings 5 | 6 | const bufferMaxInitGrowSize = 2048 7 | 8 | // Lazy initialize a buffer. 9 | func allocBuffer(orig, cur string) *stringBuilder { 10 | output := &stringBuilder{} 11 | maxSize := len(orig) * 4 12 | 13 | // Avoid to reserve too much memory at once. 14 | if maxSize > bufferMaxInitGrowSize { 15 | maxSize = bufferMaxInitGrowSize 16 | } 17 | 18 | output.Grow(maxSize) 19 | output.WriteString(orig[:len(orig)-len(cur)]) 20 | return output 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | # Vim files https://github.com/github/gitignore/blob/master/Global/Vim.gitignore 23 | # swap 24 | [._]*.s[a-w][a-z] 25 | [._]s[a-w][a-z] 26 | # session 27 | Session.vim 28 | # temporary 29 | .netrwhist 30 | *~ 31 | # auto-generated tag files 32 | tags 33 | 34 | *.exe 35 | 36 | cobra.test 37 | -------------------------------------------------------------------------------- /vendor/github.com/imdario/mergo/.gitignore: -------------------------------------------------------------------------------- 1 | #### joe made this: http://goel.io/joe 2 | 3 | #### go #### 4 | # Binaries for programs and plugins 5 | *.exe 6 | *.dll 7 | *.so 8 | *.dylib 9 | 10 | # Test binary, build with `go test -c` 11 | *.test 12 | 13 | # Output of the go coverage tool, specifically when used with LiteIDE 14 | *.out 15 | 16 | # Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 17 | .glide/ 18 | 19 | #### vim #### 20 | # Swap 21 | [._]*.s[a-v][a-z] 22 | [._]*.sw[a-p] 23 | [._]s[a-v][a-z] 24 | [._]sw[a-p] 25 | 26 | # Session 27 | Session.vim 28 | 29 | # Temporary 30 | .netrwhist 31 | *~ 32 | # Auto-generated tag files 33 | tags 34 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/sprig/v3/reflect.go: -------------------------------------------------------------------------------- 1 | package sprig 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | ) 7 | 8 | // typeIs returns true if the src is the type named in target. 9 | func typeIs(target string, src interface{}) bool { 10 | return target == typeOf(src) 11 | } 12 | 13 | func typeIsLike(target string, src interface{}) bool { 14 | t := typeOf(src) 15 | return target == t || "*"+target == t 16 | } 17 | 18 | func typeOf(src interface{}) string { 19 | return fmt.Sprintf("%T", src) 20 | } 21 | 22 | func kindIs(target string, src interface{}) bool { 23 | return target == kindOf(src) 24 | } 25 | 26 | func kindOf(src interface{}) string { 27 | return reflect.ValueOf(src).Kind().String() 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | matrix: 4 | include: 5 | - go: 1.4.3 6 | env: NOVET=true # No bundled vet. 7 | - go: 1.5.4 8 | - go: 1.6.4 9 | - go: 1.7.5 10 | - go: 1.8 11 | - go: tip 12 | allow_failures: 13 | - go: tip 14 | 15 | before_install: 16 | - mkdir -p bin 17 | - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.3/shellcheck 18 | - chmod +x bin/shellcheck 19 | script: 20 | - PATH=$PATH:$PWD/bin go test -v ./... 21 | - go build 22 | - diff -u <(echo -n) <(gofmt -d -s .) 23 | - if [ -z $NOVET ]; then 24 | diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint'); 25 | fi 26 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2017 Luiz Filho 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package main 16 | 17 | import "github.com/luizbafilho/gosubst/cmd" 18 | 19 | func main() { 20 | cmd.Execute() 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/sprig/v3/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package sprig provides template functions for Go. 3 | 4 | This package contains a number of utility functions for working with data 5 | inside of Go `html/template` and `text/template` files. 6 | 7 | To add these functions, use the `template.Funcs()` method: 8 | 9 | t := templates.New("foo").Funcs(sprig.FuncMap()) 10 | 11 | Note that you should add the function map before you parse any template files. 12 | 13 | In several cases, Sprig reverses the order of arguments from the way they 14 | appear in the standard library. This is to make it easier to pipe 15 | arguments into functions. 16 | 17 | See http://masterminds.github.io/sprig/ for more detailed documentation on each of the available functions. 18 | */ 19 | package sprig 20 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/example.toml: -------------------------------------------------------------------------------- 1 | # This is a TOML document. Boom. 2 | 3 | title = "TOML Example" 4 | 5 | [owner] 6 | name = "Tom Preston-Werner" 7 | organization = "GitHub" 8 | bio = "GitHub Cofounder & CEO\nLikes tater tots and beer." 9 | dob = 1979-05-27T07:32:00Z # First class dates? Why not? 10 | 11 | [database] 12 | server = "192.168.1.1" 13 | ports = [ 8001, 8001, 8002 ] 14 | connection_max = 5000 15 | enabled = true 16 | 17 | [servers] 18 | 19 | # You can indent as you please. Tabs or spaces. TOML don't care. 20 | [servers.alpha] 21 | ip = "10.0.0.1" 22 | dc = "eqdc10" 23 | 24 | [servers.beta] 25 | ip = "10.0.0.2" 26 | dc = "eqdc10" 27 | 28 | [clients] 29 | data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it 30 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | IMAGE=gosubst-image 2 | 3 | build_image: 4 | docker build -t ${IMAGE} . 5 | 6 | build: build_image 7 | docker run -it -v $(shell pwd):/go/src/github.com/luizbafilho/gosubst -w /go/src/github.com/luizbafilho/gosubst ${IMAGE} go build -o _bin/gosubst 8 | 9 | cross_build: build_image 10 | docker run -it -v $(shell pwd):/go/src/github.com/luizbafilho/gosubst -w /go/src/github.com/luizbafilho/gosubst -e CGO_ENABLED=0 ${IMAGE} gox -output="_dist/gosubst_{{.OS}}_{{.Arch}}" 11 | 12 | test: build_image 13 | docker run -it -v $(shell pwd):/go/src/github.com/luizbafilho/gosubst -w /go/src/github.com/luizbafilho/gosubst/gosubst ${IMAGE} go test 14 | 15 | run: build_image 16 | docker run -it -v $(shell pwd):/go/src/github.com/luizbafilho/gosubst -w /go/src/github.com/luizbafilho/gosubst ${IMAGE} bash 17 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/writerc.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | // Set the writer error and return false. 4 | func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { 5 | emitter.error = yaml_WRITER_ERROR 6 | emitter.problem = problem 7 | return false 8 | } 9 | 10 | // Flush the output buffer. 11 | func yaml_emitter_flush(emitter *yaml_emitter_t) bool { 12 | if emitter.write_handler == nil { 13 | panic("write handler not set") 14 | } 15 | 16 | // Check if the buffer is empty. 17 | if emitter.buffer_pos == 0 { 18 | return true 19 | } 20 | 21 | if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { 22 | return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) 23 | } 24 | emitter.buffer_pos = 0 25 | return true 26 | } 27 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/luizbafilho/gosubst 2 | 3 | go 1.14 4 | 5 | require ( 6 | github.com/Masterminds/sprig/v3 v3.2.2 7 | github.com/google/uuid v1.3.0 // indirect 8 | github.com/huandu/xstrings v1.3.2 // indirect 9 | github.com/imdario/mergo v0.3.12 // indirect 10 | github.com/inconshreveable/mousetrap v1.0.0 // indirect 11 | github.com/mitchellh/copystructure v1.2.0 // indirect 12 | github.com/pelletier/go-buffruneio v0.1.0 // indirect 13 | github.com/pelletier/go-toml v0.4.0 14 | github.com/pkg/errors v0.8.0 15 | github.com/spf13/cobra v0.0.0-20170223131251-92ea23a837e6 16 | github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff // indirect 17 | github.com/stretchr/testify v1.6.1 18 | golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b // indirect 19 | gopkg.in/yaml.v2 v2.3.0 20 | ) 21 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: build-{build}.{branch} 2 | 3 | clone_folder: C:\gopath\src\github.com\pkg\errors 4 | shallow_clone: true # for startup speed 5 | 6 | environment: 7 | GOPATH: C:\gopath 8 | 9 | platform: 10 | - x64 11 | 12 | # http://www.appveyor.com/docs/installed-software 13 | install: 14 | # some helpful output for debugging builds 15 | - go version 16 | - go env 17 | # pre-installed MinGW at C:\MinGW is 32bit only 18 | # but MSYS2 at C:\msys64 has mingw64 19 | - set PATH=C:\msys64\mingw64\bin;%PATH% 20 | - gcc --version 21 | - g++ --version 22 | 23 | build_script: 24 | - go install -v ./... 25 | 26 | test_script: 27 | - set PATH=C:\gopath\bin;%PATH% 28 | - go test -v ./... 29 | 30 | #artifacts: 31 | # - path: '%GOPATH%\bin\*.exe' 32 | deploy: off 33 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/example-crlf.toml: -------------------------------------------------------------------------------- 1 | # This is a TOML document. Boom. 2 | 3 | title = "TOML Example" 4 | 5 | [owner] 6 | name = "Tom Preston-Werner" 7 | organization = "GitHub" 8 | bio = "GitHub Cofounder & CEO\nLikes tater tots and beer." 9 | dob = 1979-05-27T07:32:00Z # First class dates? Why not? 10 | 11 | [database] 12 | server = "192.168.1.1" 13 | ports = [ 8001, 8001, 8002 ] 14 | connection_max = 5000 15 | enabled = true 16 | 17 | [servers] 18 | 19 | # You can indent as you please. Tabs or spaces. TOML don't care. 20 | [servers.alpha] 21 | ip = "10.0.0.1" 22 | dc = "eqdc10" 23 | 24 | [servers.beta] 25 | ip = "10.0.0.2" 26 | dc = "eqdc10" 27 | 28 | [clients] 29 | data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it 30 | -------------------------------------------------------------------------------- /vendor/github.com/davecgh/go-spew/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2012-2016 Dave Collins 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/v3/collection.go: -------------------------------------------------------------------------------- 1 | package semver 2 | 3 | // Collection is a collection of Version instances and implements the sort 4 | // interface. See the sort package for more details. 5 | // https://golang.org/pkg/sort/ 6 | type Collection []*Version 7 | 8 | // Len returns the length of a collection. The number of Version instances 9 | // on the slice. 10 | func (c Collection) Len() int { 11 | return len(c) 12 | } 13 | 14 | // Less is needed for the sort interface to compare two Version objects on the 15 | // slice. If checks if one is less than the other. 16 | func (c Collection) Less(i, j int) bool { 17 | return c[i].LessThan(c[j]) 18 | } 19 | 20 | // Swap is needed for the sort interface to replace the Version objects 21 | // at two different positions in the slice. 22 | func (c Collection) Swap(i, j int) { 23 | c[i], c[j] = c[j], c[i] 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/position.go: -------------------------------------------------------------------------------- 1 | // Position support for go-toml 2 | 3 | package toml 4 | 5 | import ( 6 | "fmt" 7 | ) 8 | 9 | // Position of a document element within a TOML document. 10 | // 11 | // Line and Col are both 1-indexed positions for the element's line number and 12 | // column number, respectively. Values of zero or less will cause Invalid(), 13 | // to return true. 14 | type Position struct { 15 | Line int // line within the document 16 | Col int // column within the line 17 | } 18 | 19 | // String representation of the position. 20 | // Displays 1-indexed line and column numbers. 21 | func (p Position) String() string { 22 | return fmt.Sprintf("(%d, %d)", p.Line, p.Col) 23 | } 24 | 25 | // Invalid returns whether or not the position is valid (i.e. with negative or 26 | // null values) 27 | func (p Position) Invalid() bool { 28 | return p.Line <= 0 || p.Col <= 0 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/README.md: -------------------------------------------------------------------------------- 1 | # uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master) 2 | The uuid package generates and inspects UUIDs based on 3 | [RFC 4122](http://tools.ietf.org/html/rfc4122) 4 | and DCE 1.1: Authentication and Security Services. 5 | 6 | This package is based on the github.com/pborman/uuid package (previously named 7 | code.google.com/p/go-uuid). It differs from these earlier packages in that 8 | a UUID is a 16 byte array rather than a byte slice. One loss due to this 9 | change is the ability to represent an invalid UUID (vs a NIL UUID). 10 | 11 | ###### Install 12 | `go get github.com/google/uuid` 13 | 14 | ###### Documentation 15 | [![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid) 16 | 17 | Full `go doc` style documentation for the package can be viewed online without 18 | installing this package by using the GoDoc site here: 19 | http://pkg.go.dev/github.com/google/uuid 20 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/README.md: -------------------------------------------------------------------------------- 1 | # mousetrap 2 | 3 | mousetrap is a tiny library that answers a single question. 4 | 5 | On a Windows machine, was the process invoked by someone double clicking on 6 | the executable file while browsing in explorer? 7 | 8 | ### Motivation 9 | 10 | Windows developers unfamiliar with command line tools will often "double-click" 11 | the executable for a tool. Because most CLI tools print the help and then exit 12 | when invoked without arguments, this is often very frustrating for those users. 13 | 14 | mousetrap provides a way to detect these invocations so that you can provide 15 | more helpful behavior and instructions on how to run the CLI tool. To see what 16 | this looks like, both from an organizational and a technical perspective, see 17 | https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/ 18 | 19 | ### The interface 20 | 21 | The library exposes a single interface: 22 | 23 | func StartedByExplorer() (bool) 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/bcrypt/base64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package bcrypt 6 | 7 | import "encoding/base64" 8 | 9 | const alphabet = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 10 | 11 | var bcEncoding = base64.NewEncoding(alphabet) 12 | 13 | func base64Encode(src []byte) []byte { 14 | n := bcEncoding.EncodedLen(len(src)) 15 | dst := make([]byte, n) 16 | bcEncoding.Encode(dst, src) 17 | for dst[n-1] == '=' { 18 | n-- 19 | } 20 | return dst[:n] 21 | } 22 | 23 | func base64Decode(src []byte) ([]byte, error) { 24 | numOfEquals := 4 - (len(src) % 4) 25 | for i := 0; i < numOfEquals; i++ { 26 | src = append(src, '=') 27 | } 28 | 29 | dst := make([]byte, bcEncoding.DecodedLen(len(src))) 30 | n, err := bcEncoding.Decode(dst, src) 31 | if err != nil { 32 | return nil, err 33 | } 34 | return dst[:n], nil 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/shopspring/decimal/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Decimal v1.2.0 2 | 3 | #### BREAKING 4 | - Drop support for Go version older than 1.7 [#172](https://github.com/shopspring/decimal/pull/172) 5 | 6 | #### FEATURES 7 | - Add NewFromInt and NewFromInt32 initializers [#72](https://github.com/shopspring/decimal/pull/72) 8 | - Add support for Go modules [#157](https://github.com/shopspring/decimal/pull/157) 9 | - Add BigInt, BigFloat helper methods [#171](https://github.com/shopspring/decimal/pull/171) 10 | 11 | #### ENHANCEMENTS 12 | - Memory usage optimization [#160](https://github.com/shopspring/decimal/pull/160) 13 | - Updated travis CI golang versions [#156](https://github.com/shopspring/decimal/pull/156) 14 | - Update documentation [#173](https://github.com/shopspring/decimal/pull/173) 15 | - Improve code quality [#174](https://github.com/shopspring/decimal/pull/174) 16 | 17 | #### BUGFIXES 18 | - Revert remove insignificant digits [#159](https://github.com/shopspring/decimal/pull/159) 19 | - Remove 15 interval for RoundCash [#166](https://github.com/shopspring/decimal/pull/166) 20 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/marshal.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import "fmt" 8 | 9 | // MarshalText implements encoding.TextMarshaler. 10 | func (uuid UUID) MarshalText() ([]byte, error) { 11 | var js [36]byte 12 | encodeHex(js[:], uuid) 13 | return js[:], nil 14 | } 15 | 16 | // UnmarshalText implements encoding.TextUnmarshaler. 17 | func (uuid *UUID) UnmarshalText(data []byte) error { 18 | id, err := ParseBytes(data) 19 | if err != nil { 20 | return err 21 | } 22 | *uuid = id 23 | return nil 24 | } 25 | 26 | // MarshalBinary implements encoding.BinaryMarshaler. 27 | func (uuid UUID) MarshalBinary() ([]byte, error) { 28 | return uuid[:], nil 29 | } 30 | 31 | // UnmarshalBinary implements encoding.BinaryUnmarshaler. 32 | func (uuid *UUID) UnmarshalBinary(data []byte) error { 33 | if len(data) != 16 { 34 | return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) 35 | } 36 | copy(uuid[:], data) 37 | return nil 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/node_net.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !js 6 | 7 | package uuid 8 | 9 | import "net" 10 | 11 | var interfaces []net.Interface // cached list of interfaces 12 | 13 | // getHardwareInterface returns the name and hardware address of interface name. 14 | // If name is "" then the name and hardware address of one of the system's 15 | // interfaces is returned. If no interfaces are found (name does not exist or 16 | // there are no interfaces) then "", nil is returned. 17 | // 18 | // Only addresses of at least 6 bytes are returned. 19 | func getHardwareInterface(name string) (string, []byte) { 20 | if interfaces == nil { 21 | var err error 22 | interfaces, err = net.Interfaces() 23 | if err != nil { 24 | return "", nil 25 | } 26 | } 27 | for _, ifs := range interfaces { 28 | if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { 29 | return ifs.Name, ifs.HardwareAddr 30 | } 31 | } 32 | return "", nil 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Luiz Bezerra 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/v3/Makefile: -------------------------------------------------------------------------------- 1 | GOPATH=$(shell go env GOPATH) 2 | GOLANGCI_LINT=$(GOPATH)/bin/golangci-lint 3 | GOFUZZBUILD = $(GOPATH)/bin/go-fuzz-build 4 | GOFUZZ = $(GOPATH)/bin/go-fuzz 5 | 6 | .PHONY: lint 7 | lint: $(GOLANGCI_LINT) 8 | @echo "==> Linting codebase" 9 | @$(GOLANGCI_LINT) run 10 | 11 | .PHONY: test 12 | test: 13 | @echo "==> Running tests" 14 | GO111MODULE=on go test -v 15 | 16 | .PHONY: test-cover 17 | test-cover: 18 | @echo "==> Running Tests with coverage" 19 | GO111MODULE=on go test -cover . 20 | 21 | .PHONY: fuzz 22 | fuzz: $(GOFUZZBUILD) $(GOFUZZ) 23 | @echo "==> Fuzz testing" 24 | $(GOFUZZBUILD) 25 | $(GOFUZZ) -workdir=_fuzz 26 | 27 | $(GOLANGCI_LINT): 28 | # Install golangci-lint. The configuration for it is in the .golangci.yml 29 | # file in the root of the repository 30 | echo ${GOPATH} 31 | curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.17.1 32 | 33 | $(GOFUZZBUILD): 34 | cd / && go get -u github.com/dvyukov/go-fuzz/go-fuzz-build 35 | 36 | $(GOFUZZ): 37 | cd / && go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-dep -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/sprig/v3/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013-2020 Masterminds 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Steve Francia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/v3/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014-2019, Matt Butcher and Matt Farina 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/huandu/xstrings/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Huan Du 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 - 2016 Thomas Pelletier, Eric Anderton 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/Makefile: -------------------------------------------------------------------------------- 1 | GOVERSION := $(shell go version | cut -d ' ' -f 3 | cut -d '.' -f 2) 2 | 3 | .PHONY: check fmt lint test test-race vet test-cover-html help 4 | .DEFAULT_GOAL := help 5 | 6 | check: test-race fmt vet lint ## Run tests and linters 7 | 8 | test: ## Run tests 9 | go test ./... 10 | 11 | test-race: ## Run tests with race detector 12 | go test -race ./... 13 | 14 | fmt: ## Run gofmt linter 15 | ifeq "$(GOVERSION)" "12" 16 | @for d in `go list` ; do \ 17 | if [ "`gofmt -l -s $$GOPATH/src/$$d | tee /dev/stderr`" ]; then \ 18 | echo "^ improperly formatted go files" && echo && exit 1; \ 19 | fi \ 20 | done 21 | endif 22 | 23 | lint: ## Run golint linter 24 | @for d in `go list` ; do \ 25 | if [ "`golint $$d | tee /dev/stderr`" ]; then \ 26 | echo "^ golint errors!" && echo && exit 1; \ 27 | fi \ 28 | done 29 | 30 | vet: ## Run go vet linter 31 | @if [ "`go vet | tee /dev/stderr`" ]; then \ 32 | echo "^ go vet errors!" && echo && exit 1; \ 33 | fi 34 | 35 | test-cover-html: ## Generate test coverage report 36 | go test -coverprofile=coverage.out -covermode=count 37 | go tool cover -func=coverage.out 38 | 39 | help: 40 | @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' 41 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Dave Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | // +build go1.4 3 | 4 | package mousetrap 5 | 6 | import ( 7 | "os" 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) { 13 | snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0) 14 | if err != nil { 15 | return nil, err 16 | } 17 | defer syscall.CloseHandle(snapshot) 18 | var procEntry syscall.ProcessEntry32 19 | procEntry.Size = uint32(unsafe.Sizeof(procEntry)) 20 | if err = syscall.Process32First(snapshot, &procEntry); err != nil { 21 | return nil, err 22 | } 23 | for { 24 | if procEntry.ProcessID == uint32(pid) { 25 | return &procEntry, nil 26 | } 27 | err = syscall.Process32Next(snapshot, &procEntry) 28 | if err != nil { 29 | return nil, err 30 | } 31 | } 32 | } 33 | 34 | // StartedByExplorer returns true if the program was invoked by the user double-clicking 35 | // on the executable from explorer.exe 36 | // 37 | // It is conservative and returns false if any of the internal calls fail. 38 | // It does not guarantee that the program was run from a terminal. It only can tell you 39 | // whether it was launched from explorer.exe 40 | func StartedByExplorer() bool { 41 | pe, err := getProcessEntry(os.Getppid()) 42 | if err != nil { 43 | return false 44 | } 45 | return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:]) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/LICENSE.libyaml: -------------------------------------------------------------------------------- 1 | The following files were ported to Go from C files of libyaml, and thus 2 | are still covered by their original copyright and license: 3 | 4 | apic.go 5 | emitterc.go 6 | parserc.go 7 | readerc.go 8 | scannerc.go 9 | writerc.go 10 | yamlh.go 11 | yamlprivateh.go 12 | 13 | Copyright (c) 2006 Kirill Simonov 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/version1.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "encoding/binary" 9 | ) 10 | 11 | // NewUUID returns a Version 1 UUID based on the current NodeID and clock 12 | // sequence, and the current time. If the NodeID has not been set by SetNodeID 13 | // or SetNodeInterface then it will be set automatically. If the NodeID cannot 14 | // be set NewUUID returns nil. If clock sequence has not been set by 15 | // SetClockSequence then it will be set automatically. If GetTime fails to 16 | // return the current NewUUID returns nil and an error. 17 | // 18 | // In most cases, New should be used. 19 | func NewUUID() (UUID, error) { 20 | var uuid UUID 21 | now, seq, err := GetTime() 22 | if err != nil { 23 | return uuid, err 24 | } 25 | 26 | timeLow := uint32(now & 0xffffffff) 27 | timeMid := uint16((now >> 32) & 0xffff) 28 | timeHi := uint16((now >> 48) & 0x0fff) 29 | timeHi |= 0x1000 // Version 1 30 | 31 | binary.BigEndian.PutUint32(uuid[0:], timeLow) 32 | binary.BigEndian.PutUint16(uuid[4:], timeMid) 33 | binary.BigEndian.PutUint16(uuid[6:], timeHi) 34 | binary.BigEndian.PutUint16(uuid[8:], seq) 35 | 36 | nodeMu.Lock() 37 | if nodeID == zeroID { 38 | setNodeInterface("") 39 | } 40 | copy(uuid[10:], nodeID[:]) 41 | nodeMu.Unlock() 42 | 43 | return uuid, nil 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/huandu/xstrings/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing # 2 | 3 | Thanks for your contribution in advance. No matter what you will contribute to this project, pull request or bug report or feature discussion, it's always highly appreciated. 4 | 5 | ## New API or feature ## 6 | 7 | I want to speak more about how to add new functions to this package. 8 | 9 | Package `xstring` is a collection of useful string functions which should be implemented in Go. It's a bit subject to say which function should be included and which should not. I set up following rules in order to make it clear and as objective as possible. 10 | 11 | * Rule 1: Only string algorithm, which takes string as input, can be included. 12 | * Rule 2: If a function has been implemented in package `string`, it must not be included. 13 | * Rule 3: If a function is not language neutral, it must not be included. 14 | * Rule 4: If a function is a part of standard library in other languages, it can be included. 15 | * Rule 5: If a function is quite useful in some famous framework or library, it can be included. 16 | 17 | New function must be discussed in project issues before submitting any code. If a pull request with new functions is sent without any ref issue, it will be rejected. 18 | 19 | ## Pull request ## 20 | 21 | Pull request is always welcome. Just make sure you have run `go fmt` and all test cases passed before submit. 22 | 23 | If the pull request is to add a new API or feature, don't forget to update README.md and add new API in function list. 24 | -------------------------------------------------------------------------------- /vendor/github.com/pmezard/go-difflib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Patrick Mezard 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | The names of its contributors may not be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 18 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009,2014 Google Inc. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/doc.go: -------------------------------------------------------------------------------- 1 | // Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. 2 | // 3 | // Example Usage 4 | // 5 | // The following is a complete example using assert in a standard test function: 6 | // import ( 7 | // "testing" 8 | // "github.com/stretchr/testify/assert" 9 | // ) 10 | // 11 | // func TestSomething(t *testing.T) { 12 | // 13 | // var a string = "Hello" 14 | // var b string = "Hello" 15 | // 16 | // assert.Equal(t, a, b, "The two words should be the same.") 17 | // 18 | // } 19 | // 20 | // if you assert many times, use the format below: 21 | // 22 | // import ( 23 | // "testing" 24 | // "github.com/stretchr/testify/assert" 25 | // ) 26 | // 27 | // func TestSomething(t *testing.T) { 28 | // assert := assert.New(t) 29 | // 30 | // var a string = "Hello" 31 | // var b string = "Hello" 32 | // 33 | // assert.Equal(a, b, "The two words should be the same.") 34 | // } 35 | // 36 | // Assertions 37 | // 38 | // Assertions allow you to easily write test code, and are global funcs in the `assert` package. 39 | // All assertion functions take, as the first argument, the `*testing.T` object provided by the 40 | // testing framework. This allows the assertion funcs to write the failings and other details to 41 | // the correct place. 42 | // 43 | // Every assertion function also takes an optional string message as the final argument, 44 | // allowing custom error messages to be appended to the message the assertion method outputs. 45 | package assert 46 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /gosubst/gosubst_test.go: -------------------------------------------------------------------------------- 1 | package gosubst 2 | 3 | import ( 4 | "bytes" 5 | "os" 6 | "testing" 7 | 8 | "github.com/stretchr/testify/assert" 9 | ) 10 | 11 | func createValuesFile(t *testing.T, s string) { 12 | f, err := os.Create("/tmp/values.toml") 13 | assert.Nil(t, err) 14 | 15 | _, err = f.WriteString(s) 16 | assert.Nil(t, err) 17 | 18 | } 19 | 20 | func TestSubstRender(t *testing.T) { 21 | createValuesFile(t, "foo=\"bar\"\n") 22 | 23 | template := bytes.NewBufferString(`Testing {{.foo}}`) 24 | output := bytes.NewBuffer(nil) 25 | 26 | subst, err := NewSubst("/tmp/values.toml", "toml", template, output) 27 | assert.Nil(t, err) 28 | 29 | subst.Render() 30 | 31 | assert.Equal(t, "Testing bar", output.String()) 32 | } 33 | 34 | func TestSubstRenderEspecialChars(t *testing.T) { 35 | createValuesFile(t, "foo=\"a + b\"\n") 36 | 37 | template := bytes.NewBufferString(`Testing {{.foo}}`) 38 | output := bytes.NewBuffer(nil) 39 | 40 | subst, err := NewSubst("/tmp/values.toml", "toml", template, output) 41 | assert.Nil(t, err) 42 | 43 | subst.Render() 44 | 45 | assert.Equal(t, "Testing a + b", output.String()) 46 | } 47 | 48 | func TestSubstRender_NoValues(t *testing.T) { 49 | template := bytes.NewBufferString(`Testing {{.foo}}`) 50 | output := bytes.NewBuffer(nil) 51 | 52 | subst, err := NewSubst("", "toml", template, output) 53 | assert.Nil(t, err) 54 | 55 | subst.Render() 56 | 57 | assert.Equal(t, "Testing ", output.String()) 58 | } 59 | 60 | func TestGetenv(t *testing.T) { 61 | values := &Values{} 62 | assert.Empty(t, values.Env()["BLA"]) 63 | assert.Equal(t, os.Getenv("USER"), values.Env()["USER"]) 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Alex Ogier. All rights reserved. 2 | Copyright (c) 2012 The Go Authors. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /vendor/github.com/imdario/mergo/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Dario Castañé. All rights reserved. 2 | Copyright (c) 2012 The Go Authors. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/sql.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "database/sql/driver" 9 | "fmt" 10 | ) 11 | 12 | // Scan implements sql.Scanner so UUIDs can be read from databases transparently. 13 | // Currently, database types that map to string and []byte are supported. Please 14 | // consult database-specific driver documentation for matching types. 15 | func (uuid *UUID) Scan(src interface{}) error { 16 | switch src := src.(type) { 17 | case nil: 18 | return nil 19 | 20 | case string: 21 | // if an empty UUID comes from a table, we return a null UUID 22 | if src == "" { 23 | return nil 24 | } 25 | 26 | // see Parse for required string format 27 | u, err := Parse(src) 28 | if err != nil { 29 | return fmt.Errorf("Scan: %v", err) 30 | } 31 | 32 | *uuid = u 33 | 34 | case []byte: 35 | // if an empty UUID comes from a table, we return a null UUID 36 | if len(src) == 0 { 37 | return nil 38 | } 39 | 40 | // assumes a simple slice of bytes if 16 bytes 41 | // otherwise attempts to parse 42 | if len(src) != 16 { 43 | return uuid.Scan(string(src)) 44 | } 45 | copy((*uuid)[:], src) 46 | 47 | default: 48 | return fmt.Errorf("Scan: unable to scan type %T into UUID", src) 49 | } 50 | 51 | return nil 52 | } 53 | 54 | // Value implements sql.Valuer so that UUIDs can be written to databases 55 | // transparently. Currently, UUIDs map to strings. Please consult 56 | // database-specific driver documentation for matching types. 57 | func (uuid UUID) Value() (driver.Value, error) { 58 | return uuid.String(), nil 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/davecgh/go-spew/spew/bypasssafe.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016 Dave Collins 2 | // 3 | // Permission to use, copy, modify, and distribute this software for any 4 | // purpose with or without fee is hereby granted, provided that the above 5 | // copyright notice and this permission notice appear in all copies. 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | 15 | // NOTE: Due to the following build constraints, this file will only be compiled 16 | // when the code is running on Google App Engine, compiled by GopherJS, or 17 | // "-tags safe" is added to the go build command line. The "disableunsafe" 18 | // tag is deprecated and thus should not be used. 19 | // +build js appengine safe disableunsafe !go1.4 20 | 21 | package spew 22 | 23 | import "reflect" 24 | 25 | const ( 26 | // UnsafeDisabled is a build-time constant which specifies whether or 27 | // not access to the unsafe package is available. 28 | UnsafeDisabled = true 29 | ) 30 | 31 | // unsafeReflectValue typically converts the passed reflect.Value into a one 32 | // that bypasses the typical safety restrictions preventing access to 33 | // unaddressable and unexported data. However, doing this relies on access to 34 | // the unsafe package. This is a stub version which simply returns the passed 35 | // reflect.Value when the unsafe package is not available. 36 | func unsafeReflectValue(v reflect.Value) reflect.Value { 37 | return v 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/sprig/v3/url.go: -------------------------------------------------------------------------------- 1 | package sprig 2 | 3 | import ( 4 | "fmt" 5 | "net/url" 6 | "reflect" 7 | ) 8 | 9 | func dictGetOrEmpty(dict map[string]interface{}, key string) string { 10 | value, ok := dict[key] 11 | if !ok { 12 | return "" 13 | } 14 | tp := reflect.TypeOf(value).Kind() 15 | if tp != reflect.String { 16 | panic(fmt.Sprintf("unable to parse %s key, must be of type string, but %s found", key, tp.String())) 17 | } 18 | return reflect.ValueOf(value).String() 19 | } 20 | 21 | // parses given URL to return dict object 22 | func urlParse(v string) map[string]interface{} { 23 | dict := map[string]interface{}{} 24 | parsedURL, err := url.Parse(v) 25 | if err != nil { 26 | panic(fmt.Sprintf("unable to parse url: %s", err)) 27 | } 28 | dict["scheme"] = parsedURL.Scheme 29 | dict["host"] = parsedURL.Host 30 | dict["hostname"] = parsedURL.Hostname() 31 | dict["path"] = parsedURL.Path 32 | dict["query"] = parsedURL.RawQuery 33 | dict["opaque"] = parsedURL.Opaque 34 | dict["fragment"] = parsedURL.Fragment 35 | if parsedURL.User != nil { 36 | dict["userinfo"] = parsedURL.User.String() 37 | } else { 38 | dict["userinfo"] = "" 39 | } 40 | 41 | return dict 42 | } 43 | 44 | // join given dict to URL string 45 | func urlJoin(d map[string]interface{}) string { 46 | resURL := url.URL{ 47 | Scheme: dictGetOrEmpty(d, "scheme"), 48 | Host: dictGetOrEmpty(d, "host"), 49 | Path: dictGetOrEmpty(d, "path"), 50 | RawQuery: dictGetOrEmpty(d, "query"), 51 | Opaque: dictGetOrEmpty(d, "opaque"), 52 | Fragment: dictGetOrEmpty(d, "fragment"), 53 | } 54 | userinfo := dictGetOrEmpty(d, "userinfo") 55 | var user *url.Userinfo 56 | if userinfo != "" { 57 | tempURL, err := url.Parse(fmt.Sprintf("proto://%s@host", userinfo)) 58 | if err != nil { 59 | panic(fmt.Sprintf("unable to parse userinfo in dict: %s", err)) 60 | } 61 | user = tempURL.User 62 | } 63 | 64 | resURL.User = user 65 | return resURL.String() 66 | } 67 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/hash.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "crypto/md5" 9 | "crypto/sha1" 10 | "hash" 11 | ) 12 | 13 | // Well known namespace IDs and UUIDs 14 | var ( 15 | NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) 16 | NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) 17 | NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) 18 | NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) 19 | Nil UUID // empty UUID, all zeros 20 | ) 21 | 22 | // NewHash returns a new UUID derived from the hash of space concatenated with 23 | // data generated by h. The hash should be at least 16 byte in length. The 24 | // first 16 bytes of the hash are used to form the UUID. The version of the 25 | // UUID will be the lower 4 bits of version. NewHash is used to implement 26 | // NewMD5 and NewSHA1. 27 | func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { 28 | h.Reset() 29 | h.Write(space[:]) //nolint:errcheck 30 | h.Write(data) //nolint:errcheck 31 | s := h.Sum(nil) 32 | var uuid UUID 33 | copy(uuid[:], s) 34 | uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) 35 | uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant 36 | return uuid 37 | } 38 | 39 | // NewMD5 returns a new MD5 (Version 3) UUID based on the 40 | // supplied name space and data. It is the same as calling: 41 | // 42 | // NewHash(md5.New(), space, data, 3) 43 | func NewMD5(space UUID, data []byte) UUID { 44 | return NewHash(md5.New(), space, data, 3) 45 | } 46 | 47 | // NewSHA1 returns a new SHA1 (Version 5) UUID based on the 48 | // supplied name space and data. It is the same as calling: 49 | // 50 | // NewHash(sha1.New(), space, data, 5) 51 | func NewSHA1(space UUID, data []byte) UUID { 52 | return NewHash(sha1.New(), space, data, 5) 53 | } 54 | -------------------------------------------------------------------------------- /cmd/root.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2017 Luiz Filho 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "fmt" 19 | "log" 20 | "os" 21 | 22 | "github.com/luizbafilho/gosubst/gosubst" 23 | "github.com/spf13/cobra" 24 | ) 25 | 26 | var ( 27 | valuesFile string 28 | valuesType string 29 | tplPaths []string 30 | outPath string 31 | ) 32 | 33 | // RootCmd represents the base command when called without any subcommands 34 | var RootCmd = &cobra.Command{ 35 | Use: "gosubst", 36 | Short: "substitutes values of variables file in template files", 37 | Long: `gosubst copies stardard input to standard output replacing all variables present in values file`, 38 | Run: func(cmd *cobra.Command, args []string) { 39 | subst, err := gosubst.NewSubst(valuesFile, valuesType, os.Stdin, os.Stdout) 40 | if err != nil { 41 | log.Fatal(err) 42 | } 43 | 44 | if err := subst.Render(); err != nil { 45 | log.Fatal(err) 46 | } 47 | }, 48 | } 49 | 50 | // Execute adds all child commands to the root command sets flags appropriately. 51 | // This is called by main.main(). It only needs to happen once to the rootCmd. 52 | func Execute() { 53 | if err := RootCmd.Execute(); err != nil { 54 | fmt.Println(err) 55 | os.Exit(-1) 56 | } 57 | } 58 | 59 | func init() { 60 | RootCmd.PersistentFlags().StringVarP(&valuesFile, "values", "v", "", "values file") 61 | RootCmd.PersistentFlags().StringVar(&valuesType, "type", "yaml", "values type (toml, yaml or json)") 62 | } 63 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v3/writerc.go: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2011-2019 Canonical Ltd 3 | // Copyright (c) 2006-2010 Kirill Simonov 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | // of the Software, and to permit persons to whom the Software is furnished to do 10 | // so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | package yaml 24 | 25 | // Set the writer error and return false. 26 | func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { 27 | emitter.error = yaml_WRITER_ERROR 28 | emitter.problem = problem 29 | return false 30 | } 31 | 32 | // Flush the output buffer. 33 | func yaml_emitter_flush(emitter *yaml_emitter_t) bool { 34 | if emitter.write_handler == nil { 35 | panic("write handler not set") 36 | } 37 | 38 | // Check if the buffer is empty. 39 | if emitter.buffer_pos == 0 { 40 | return true 41 | } 42 | 43 | if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { 44 | return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) 45 | } 46 | emitter.buffer_pos = 0 47 | return true 48 | } 49 | -------------------------------------------------------------------------------- /vendor/modules.txt: -------------------------------------------------------------------------------- 1 | # github.com/Masterminds/goutils v1.1.1 2 | github.com/Masterminds/goutils 3 | # github.com/Masterminds/semver/v3 v3.1.1 4 | github.com/Masterminds/semver/v3 5 | # github.com/Masterminds/sprig/v3 v3.2.2 6 | ## explicit 7 | github.com/Masterminds/sprig/v3 8 | # github.com/davecgh/go-spew v1.1.1 9 | github.com/davecgh/go-spew/spew 10 | # github.com/google/uuid v1.3.0 11 | ## explicit 12 | github.com/google/uuid 13 | # github.com/huandu/xstrings v1.3.2 14 | ## explicit 15 | github.com/huandu/xstrings 16 | # github.com/imdario/mergo v0.3.12 17 | ## explicit 18 | github.com/imdario/mergo 19 | # github.com/inconshreveable/mousetrap v1.0.0 20 | ## explicit 21 | github.com/inconshreveable/mousetrap 22 | # github.com/mitchellh/copystructure v1.2.0 23 | ## explicit 24 | github.com/mitchellh/copystructure 25 | # github.com/mitchellh/reflectwalk v1.0.2 26 | github.com/mitchellh/reflectwalk 27 | # github.com/pelletier/go-buffruneio v0.1.0 28 | ## explicit 29 | github.com/pelletier/go-buffruneio 30 | # github.com/pelletier/go-toml v0.4.0 31 | ## explicit 32 | github.com/pelletier/go-toml 33 | # github.com/pkg/errors v0.8.0 34 | ## explicit 35 | github.com/pkg/errors 36 | # github.com/pmezard/go-difflib v1.0.0 37 | github.com/pmezard/go-difflib/difflib 38 | # github.com/shopspring/decimal v1.2.0 39 | github.com/shopspring/decimal 40 | # github.com/spf13/cast v1.3.1 41 | github.com/spf13/cast 42 | # github.com/spf13/cobra v0.0.0-20170223131251-92ea23a837e6 43 | ## explicit 44 | github.com/spf13/cobra 45 | # github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff 46 | ## explicit 47 | github.com/spf13/pflag 48 | # github.com/stretchr/testify v1.6.1 49 | ## explicit 50 | github.com/stretchr/testify/assert 51 | # golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b 52 | ## explicit 53 | golang.org/x/crypto/bcrypt 54 | golang.org/x/crypto/blowfish 55 | golang.org/x/crypto/pbkdf2 56 | golang.org/x/crypto/scrypt 57 | # gopkg.in/yaml.v2 v2.3.0 58 | ## explicit 59 | gopkg.in/yaml.v2 60 | # gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c 61 | gopkg.in/yaml.v3 62 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/util.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "io" 9 | ) 10 | 11 | // randomBits completely fills slice b with random data. 12 | func randomBits(b []byte) { 13 | if _, err := io.ReadFull(rander, b); err != nil { 14 | panic(err.Error()) // rand should never fail 15 | } 16 | } 17 | 18 | // xvalues returns the value of a byte as a hexadecimal digit or 255. 19 | var xvalues = [256]byte{ 20 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 21 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 23 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, 24 | 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, 25 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 26 | 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, 27 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 28 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 29 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 30 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 31 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 32 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 33 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 34 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 36 | } 37 | 38 | // xtob converts hex characters x1 and x2 into a byte. 39 | func xtob(x1, x2 byte) (byte, bool) { 40 | b1 := xvalues[x1] 41 | b2 := xvalues[x2] 42 | return (b1 << 4) | b2, b1 != 255 && b2 != 255 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/keysparsing.go: -------------------------------------------------------------------------------- 1 | // Parsing keys handling both bare and quoted keys. 2 | 3 | package toml 4 | 5 | import ( 6 | "bytes" 7 | "fmt" 8 | "unicode" 9 | ) 10 | 11 | func parseKey(key string) ([]string, error) { 12 | groups := []string{} 13 | var buffer bytes.Buffer 14 | inQuotes := false 15 | wasInQuotes := false 16 | escapeNext := false 17 | ignoreSpace := true 18 | expectDot := false 19 | 20 | for _, char := range key { 21 | if ignoreSpace { 22 | if char == ' ' { 23 | continue 24 | } 25 | ignoreSpace = false 26 | } 27 | if escapeNext { 28 | buffer.WriteRune(char) 29 | escapeNext = false 30 | continue 31 | } 32 | switch char { 33 | case '\\': 34 | escapeNext = true 35 | continue 36 | case '"': 37 | if inQuotes { 38 | groups = append(groups, buffer.String()) 39 | buffer.Reset() 40 | wasInQuotes = true 41 | } 42 | inQuotes = !inQuotes 43 | expectDot = false 44 | case '.': 45 | if inQuotes { 46 | buffer.WriteRune(char) 47 | } else { 48 | if !wasInQuotes { 49 | if buffer.Len() == 0 { 50 | return nil, fmt.Errorf("empty key group") 51 | } 52 | groups = append(groups, buffer.String()) 53 | buffer.Reset() 54 | } 55 | ignoreSpace = true 56 | expectDot = false 57 | wasInQuotes = false 58 | } 59 | case ' ': 60 | if inQuotes { 61 | buffer.WriteRune(char) 62 | } else { 63 | expectDot = true 64 | } 65 | default: 66 | if !inQuotes && !isValidBareChar(char) { 67 | return nil, fmt.Errorf("invalid bare character: %c", char) 68 | } 69 | if !inQuotes && expectDot { 70 | return nil, fmt.Errorf("what?") 71 | } 72 | buffer.WriteRune(char) 73 | expectDot = false 74 | } 75 | } 76 | if inQuotes { 77 | return nil, fmt.Errorf("mismatched quotes") 78 | } 79 | if escapeNext { 80 | return nil, fmt.Errorf("unfinished escape sequence") 81 | } 82 | if buffer.Len() > 0 { 83 | groups = append(groups, buffer.String()) 84 | } 85 | if len(groups) == 0 { 86 | return nil, fmt.Errorf("empty key") 87 | } 88 | return groups, nil 89 | } 90 | 91 | func isValidBareChar(r rune) bool { 92 | return isAlphanumeric(r) || r == '-' || unicode.IsNumber(r) 93 | } 94 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/sprig/v3/regex.go: -------------------------------------------------------------------------------- 1 | package sprig 2 | 3 | import ( 4 | "regexp" 5 | ) 6 | 7 | func regexMatch(regex string, s string) bool { 8 | match, _ := regexp.MatchString(regex, s) 9 | return match 10 | } 11 | 12 | func mustRegexMatch(regex string, s string) (bool, error) { 13 | return regexp.MatchString(regex, s) 14 | } 15 | 16 | func regexFindAll(regex string, s string, n int) []string { 17 | r := regexp.MustCompile(regex) 18 | return r.FindAllString(s, n) 19 | } 20 | 21 | func mustRegexFindAll(regex string, s string, n int) ([]string, error) { 22 | r, err := regexp.Compile(regex) 23 | if err != nil { 24 | return []string{}, err 25 | } 26 | return r.FindAllString(s, n), nil 27 | } 28 | 29 | func regexFind(regex string, s string) string { 30 | r := regexp.MustCompile(regex) 31 | return r.FindString(s) 32 | } 33 | 34 | func mustRegexFind(regex string, s string) (string, error) { 35 | r, err := regexp.Compile(regex) 36 | if err != nil { 37 | return "", err 38 | } 39 | return r.FindString(s), nil 40 | } 41 | 42 | func regexReplaceAll(regex string, s string, repl string) string { 43 | r := regexp.MustCompile(regex) 44 | return r.ReplaceAllString(s, repl) 45 | } 46 | 47 | func mustRegexReplaceAll(regex string, s string, repl string) (string, error) { 48 | r, err := regexp.Compile(regex) 49 | if err != nil { 50 | return "", err 51 | } 52 | return r.ReplaceAllString(s, repl), nil 53 | } 54 | 55 | func regexReplaceAllLiteral(regex string, s string, repl string) string { 56 | r := regexp.MustCompile(regex) 57 | return r.ReplaceAllLiteralString(s, repl) 58 | } 59 | 60 | func mustRegexReplaceAllLiteral(regex string, s string, repl string) (string, error) { 61 | r, err := regexp.Compile(regex) 62 | if err != nil { 63 | return "", err 64 | } 65 | return r.ReplaceAllLiteralString(s, repl), nil 66 | } 67 | 68 | func regexSplit(regex string, s string, n int) []string { 69 | r := regexp.MustCompile(regex) 70 | return r.Split(s, n) 71 | } 72 | 73 | func mustRegexSplit(regex string, s string, n int) ([]string, error) { 74 | r, err := regexp.Compile(regex) 75 | if err != nil { 76 | return []string{}, err 77 | } 78 | return r.Split(s, n), nil 79 | } 80 | 81 | func regexQuoteMeta(s string) string { 82 | return regexp.QuoteMeta(s) 83 | } 84 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v3/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | This project is covered by two different licenses: MIT and Apache. 3 | 4 | #### MIT License #### 5 | 6 | The following files were ported to Go from C files of libyaml, and thus 7 | are still covered by their original MIT license, with the additional 8 | copyright staring in 2011 when the project was ported over: 9 | 10 | apic.go emitterc.go parserc.go readerc.go scannerc.go 11 | writerc.go yamlh.go yamlprivateh.go 12 | 13 | Copyright (c) 2006-2010 Kirill Simonov 14 | Copyright (c) 2006-2011 Kirill Simonov 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy of 17 | this software and associated documentation files (the "Software"), to deal in 18 | the Software without restriction, including without limitation the rights to 19 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 20 | of the Software, and to permit persons to whom the Software is furnished to do 21 | so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all 24 | copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | SOFTWARE. 33 | 34 | ### Apache License ### 35 | 36 | All the remaining project files are covered by the Apache license: 37 | 38 | Copyright (c) 2011-2019 Canonical Ltd 39 | 40 | Licensed under the Apache License, Version 2.0 (the "License"); 41 | you may not use this file except in compliance with the License. 42 | You may obtain a copy of the License at 43 | 44 | http://www.apache.org/licenses/LICENSE-2.0 45 | 46 | Unless required by applicable law or agreed to in writing, software 47 | distributed under the License is distributed on an "AS IS" BASIS, 48 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 49 | See the License for the specific language governing permissions and 50 | limitations under the License. 51 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/version4.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import "io" 8 | 9 | // New creates a new random UUID or panics. New is equivalent to 10 | // the expression 11 | // 12 | // uuid.Must(uuid.NewRandom()) 13 | func New() UUID { 14 | return Must(NewRandom()) 15 | } 16 | 17 | // NewString creates a new random UUID and returns it as a string or panics. 18 | // NewString is equivalent to the expression 19 | // 20 | // uuid.New().String() 21 | func NewString() string { 22 | return Must(NewRandom()).String() 23 | } 24 | 25 | // NewRandom returns a Random (Version 4) UUID. 26 | // 27 | // The strength of the UUIDs is based on the strength of the crypto/rand 28 | // package. 29 | // 30 | // Uses the randomness pool if it was enabled with EnableRandPool. 31 | // 32 | // A note about uniqueness derived from the UUID Wikipedia entry: 33 | // 34 | // Randomly generated UUIDs have 122 random bits. One's annual risk of being 35 | // hit by a meteorite is estimated to be one chance in 17 billion, that 36 | // means the probability is about 0.00000000006 (6 × 10−11), 37 | // equivalent to the odds of creating a few tens of trillions of UUIDs in a 38 | // year and having one duplicate. 39 | func NewRandom() (UUID, error) { 40 | if !poolEnabled { 41 | return NewRandomFromReader(rander) 42 | } 43 | return newRandomFromPool() 44 | } 45 | 46 | // NewRandomFromReader returns a UUID based on bytes read from a given io.Reader. 47 | func NewRandomFromReader(r io.Reader) (UUID, error) { 48 | var uuid UUID 49 | _, err := io.ReadFull(r, uuid[:]) 50 | if err != nil { 51 | return Nil, err 52 | } 53 | uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 54 | uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 55 | return uuid, nil 56 | } 57 | 58 | func newRandomFromPool() (UUID, error) { 59 | var uuid UUID 60 | poolMu.Lock() 61 | if poolPos == randPoolSize { 62 | _, err := io.ReadFull(rander, pool[:]) 63 | if err != nil { 64 | poolMu.Unlock() 65 | return Nil, err 66 | } 67 | poolPos = 0 68 | } 69 | copy(uuid[:], pool[poolPos:(poolPos+16)]) 70 | poolPos += 16 71 | poolMu.Unlock() 72 | 73 | uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 74 | uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 75 | return uuid, nil 76 | } 77 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/dce.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "encoding/binary" 9 | "fmt" 10 | "os" 11 | ) 12 | 13 | // A Domain represents a Version 2 domain 14 | type Domain byte 15 | 16 | // Domain constants for DCE Security (Version 2) UUIDs. 17 | const ( 18 | Person = Domain(0) 19 | Group = Domain(1) 20 | Org = Domain(2) 21 | ) 22 | 23 | // NewDCESecurity returns a DCE Security (Version 2) UUID. 24 | // 25 | // The domain should be one of Person, Group or Org. 26 | // On a POSIX system the id should be the users UID for the Person 27 | // domain and the users GID for the Group. The meaning of id for 28 | // the domain Org or on non-POSIX systems is site defined. 29 | // 30 | // For a given domain/id pair the same token may be returned for up to 31 | // 7 minutes and 10 seconds. 32 | func NewDCESecurity(domain Domain, id uint32) (UUID, error) { 33 | uuid, err := NewUUID() 34 | if err == nil { 35 | uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 36 | uuid[9] = byte(domain) 37 | binary.BigEndian.PutUint32(uuid[0:], id) 38 | } 39 | return uuid, err 40 | } 41 | 42 | // NewDCEPerson returns a DCE Security (Version 2) UUID in the person 43 | // domain with the id returned by os.Getuid. 44 | // 45 | // NewDCESecurity(Person, uint32(os.Getuid())) 46 | func NewDCEPerson() (UUID, error) { 47 | return NewDCESecurity(Person, uint32(os.Getuid())) 48 | } 49 | 50 | // NewDCEGroup returns a DCE Security (Version 2) UUID in the group 51 | // domain with the id returned by os.Getgid. 52 | // 53 | // NewDCESecurity(Group, uint32(os.Getgid())) 54 | func NewDCEGroup() (UUID, error) { 55 | return NewDCESecurity(Group, uint32(os.Getgid())) 56 | } 57 | 58 | // Domain returns the domain for a Version 2 UUID. Domains are only defined 59 | // for Version 2 UUIDs. 60 | func (uuid UUID) Domain() Domain { 61 | return Domain(uuid[9]) 62 | } 63 | 64 | // ID returns the id for a Version 2 UUID. IDs are only defined for Version 2 65 | // UUIDs. 66 | func (uuid UUID) ID() uint32 { 67 | return binary.BigEndian.Uint32(uuid[0:4]) 68 | } 69 | 70 | func (d Domain) String() string { 71 | switch d { 72 | case Person: 73 | return "Person" 74 | case Group: 75 | return "Group" 76 | case Org: 77 | return "Org" 78 | } 79 | return fmt.Sprintf("Domain%d", int(d)) 80 | } 81 | -------------------------------------------------------------------------------- /vendor/github.com/shopspring/decimal/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Spring, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | - Based on https://github.com/oguzbilgic/fpd, which has the following license: 24 | """ 25 | The MIT License (MIT) 26 | 27 | Copyright (c) 2013 Oguz Bilgic 28 | 29 | Permission is hereby granted, free of charge, to any person obtaining a copy of 30 | this software and associated documentation files (the "Software"), to deal in 31 | the Software without restriction, including without limitation the rights to 32 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 33 | the Software, and to permit persons to whom the Software is furnished to do so, 34 | subject to the following conditions: 35 | 36 | The above copyright notice and this permission notice shall be included in all 37 | copies or substantial portions of the Software. 38 | 39 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 40 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 41 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 42 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 43 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 44 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 45 | """ 46 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/README.md: -------------------------------------------------------------------------------- 1 | # errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors) 2 | 3 | Package errors provides simple error handling primitives. 4 | 5 | `go get github.com/pkg/errors` 6 | 7 | The traditional error handling idiom in Go is roughly akin to 8 | ```go 9 | if err != nil { 10 | return err 11 | } 12 | ``` 13 | which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error. 14 | 15 | ## Adding context to an error 16 | 17 | The errors.Wrap function returns a new error that adds context to the original error. For example 18 | ```go 19 | _, err := ioutil.ReadAll(r) 20 | if err != nil { 21 | return errors.Wrap(err, "read failed") 22 | } 23 | ``` 24 | ## Retrieving the cause of an error 25 | 26 | Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`. 27 | ```go 28 | type causer interface { 29 | Cause() error 30 | } 31 | ``` 32 | `errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example: 33 | ```go 34 | switch err := errors.Cause(err).(type) { 35 | case *MyError: 36 | // handle specifically 37 | default: 38 | // unknown error 39 | } 40 | ``` 41 | 42 | [Read the package documentation for more information](https://godoc.org/github.com/pkg/errors). 43 | 44 | ## Contributing 45 | 46 | We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high. 47 | 48 | Before proposing a change, please discuss your change by raising an issue. 49 | 50 | ## Licence 51 | 52 | BSD-2-Clause 53 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-buffruneio/README.md: -------------------------------------------------------------------------------- 1 | # buffruneio 2 | 3 | [![Tests Status](https://travis-ci.org/pelletier/go-buffruneio.svg?branch=master)](https://travis-ci.org/pelletier/go-buffruneio) 4 | [![GoDoc](https://godoc.org/github.com/pelletier/go-buffruneio?status.svg)](https://godoc.org/github.com/pelletier/go-buffruneio) 5 | 6 | Buffruneio is a wrapper around bufio to provide buffered runes access with 7 | unlimited unreads. 8 | 9 | ```go 10 | import "github.com/pelletier/go-buffruneio" 11 | ``` 12 | 13 | ## Examples 14 | 15 | ```go 16 | import ( 17 | "fmt" 18 | "github.com/pelletier/go-buffruneio" 19 | "strings" 20 | ) 21 | 22 | reader := buffruneio.NewReader(strings.NewReader("abcd")) 23 | fmt.Println(reader.ReadRune()) // 'a' 24 | fmt.Println(reader.ReadRune()) // 'b' 25 | fmt.Println(reader.ReadRune()) // 'c' 26 | reader.UnreadRune() 27 | reader.UnreadRune() 28 | fmt.Println(reader.ReadRune()) // 'b' 29 | fmt.Println(reader.ReadRune()) // 'c' 30 | ``` 31 | 32 | ## Documentation 33 | 34 | The documentation and additional examples are available at 35 | [godoc.org](http://godoc.org/github.com/pelletier/go-buffruneio). 36 | 37 | ## Contribute 38 | 39 | Feel free to report bugs and patches using GitHub's pull requests system on 40 | [pelletier/go-toml](https://github.com/pelletier/go-buffruneio). Any feedback is 41 | much appreciated! 42 | 43 | ## LICENSE 44 | 45 | Copyright (c) 2016 Thomas Pelletier 46 | 47 | Permission is hereby granted, free of charge, to any person obtaining a copy of 48 | this software and associated documentation files (the "Software"), to deal in 49 | the Software without restriction, including without limitation the rights to 50 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 51 | the Software, and to permit persons to whom the Software is furnished to do so, 52 | subject to the following conditions: 53 | 54 | The above copyright notice and this permission notice shall be included in all 55 | copies or substantial portions of the Software. 56 | 57 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 58 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 59 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 60 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 61 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 62 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 63 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # fail out of the script if anything here fails 3 | set -e 4 | 5 | # set the path to the present working directory 6 | export GOPATH=`pwd` 7 | 8 | function git_clone() { 9 | path=$1 10 | branch=$2 11 | version=$3 12 | if [ ! -d "src/$path" ]; then 13 | mkdir -p src/$path 14 | git clone https://$path.git src/$path 15 | fi 16 | pushd src/$path 17 | git checkout "$branch" 18 | git reset --hard "$version" 19 | popd 20 | } 21 | 22 | go get github.com/pelletier/go-buffruneio 23 | go get github.com/davecgh/go-spew/spew 24 | 25 | # get code for BurntSushi TOML validation 26 | # pinning all to 'HEAD' for version 0.3.x work (TODO: pin to commit hash when tests stabilize) 27 | git_clone github.com/BurntSushi/toml master HEAD 28 | git_clone github.com/BurntSushi/toml-test master HEAD #was: 0.2.0 HEAD 29 | 30 | # build the BurntSushi test application 31 | go build -o toml-test github.com/BurntSushi/toml-test 32 | 33 | # vendorize the current lib for testing 34 | # NOTE: this basically mocks an install without having to go back out to github for code 35 | mkdir -p src/github.com/pelletier/go-toml/cmd 36 | cp *.go *.toml src/github.com/pelletier/go-toml 37 | cp -R cmd/* src/github.com/pelletier/go-toml/cmd 38 | go build -o test_program_bin src/github.com/pelletier/go-toml/cmd/test_program.go 39 | 40 | # Run basic unit tests 41 | go test github.com/pelletier/go-toml \ 42 | github.com/pelletier/go-toml/cmd/tomljson 43 | 44 | # run the entire BurntSushi test suite 45 | if [[ $# -eq 0 ]] ; then 46 | echo "Running all BurntSushi tests" 47 | ./toml-test ./test_program_bin | tee test_out 48 | else 49 | # run a specific test 50 | test=$1 51 | test_path='src/github.com/BurntSushi/toml-test/tests' 52 | valid_test="$test_path/valid/$test" 53 | invalid_test="$test_path/invalid/$test" 54 | 55 | if [ -e "$valid_test.toml" ]; then 56 | echo "Valid Test TOML for $test:" 57 | echo "====" 58 | cat "$valid_test.toml" 59 | 60 | echo "Valid Test JSON for $test:" 61 | echo "====" 62 | cat "$valid_test.json" 63 | 64 | echo "Go-TOML Output for $test:" 65 | echo "====" 66 | cat "$valid_test.toml" | ./test_program_bin 67 | fi 68 | 69 | if [ -e "$invalid_test.toml" ]; then 70 | echo "Invalid Test TOML for $test:" 71 | echo "====" 72 | cat "$invalid_test.toml" 73 | 74 | echo "Go-TOML Output for $test:" 75 | echo "====" 76 | echo "go-toml Output:" 77 | cat "$invalid_test.toml" | ./test_program_bin 78 | fi 79 | fi 80 | -------------------------------------------------------------------------------- /vendor/github.com/imdario/mergo/mergo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Dario Castañé. All rights reserved. 2 | // Copyright 2009 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // Based on src/pkg/reflect/deepequal.go from official 7 | // golang's stdlib. 8 | 9 | package mergo 10 | 11 | import ( 12 | "errors" 13 | "reflect" 14 | ) 15 | 16 | // Errors reported by Mergo when it finds invalid arguments. 17 | var ( 18 | ErrNilArguments = errors.New("src and dst must not be nil") 19 | ErrDifferentArgumentsTypes = errors.New("src and dst must be of same type") 20 | ErrNotSupported = errors.New("only structs and maps are supported") 21 | ErrExpectedMapAsDestination = errors.New("dst was expected to be a map") 22 | ErrExpectedStructAsDestination = errors.New("dst was expected to be a struct") 23 | ErrNonPointerAgument = errors.New("dst must be a pointer") 24 | ) 25 | 26 | // During deepMerge, must keep track of checks that are 27 | // in progress. The comparison algorithm assumes that all 28 | // checks in progress are true when it reencounters them. 29 | // Visited are stored in a map indexed by 17 * a1 + a2; 30 | type visit struct { 31 | ptr uintptr 32 | typ reflect.Type 33 | next *visit 34 | } 35 | 36 | // From src/pkg/encoding/json/encode.go. 37 | func isEmptyValue(v reflect.Value) bool { 38 | switch v.Kind() { 39 | case reflect.Array, reflect.Map, reflect.Slice, reflect.String: 40 | return v.Len() == 0 41 | case reflect.Bool: 42 | return !v.Bool() 43 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: 44 | return v.Int() == 0 45 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 46 | return v.Uint() == 0 47 | case reflect.Float32, reflect.Float64: 48 | return v.Float() == 0 49 | case reflect.Interface, reflect.Ptr: 50 | if v.IsNil() { 51 | return true 52 | } 53 | return isEmptyValue(v.Elem()) 54 | case reflect.Func: 55 | return v.IsNil() 56 | case reflect.Invalid: 57 | return true 58 | } 59 | return false 60 | } 61 | 62 | func resolveValues(dst, src interface{}) (vDst, vSrc reflect.Value, err error) { 63 | if dst == nil || src == nil { 64 | err = ErrNilArguments 65 | return 66 | } 67 | vDst = reflect.ValueOf(dst).Elem() 68 | if vDst.Kind() != reflect.Struct && vDst.Kind() != reflect.Map { 69 | err = ErrNotSupported 70 | return 71 | } 72 | vSrc = reflect.ValueOf(src) 73 | // We check if vSrc is a pointer to dereference it. 74 | if vSrc.Kind() == reflect.Ptr { 75 | vSrc = vSrc.Elem() 76 | } 77 | return 78 | } 79 | -------------------------------------------------------------------------------- /gosubst/gosubst.go: -------------------------------------------------------------------------------- 1 | package gosubst 2 | 3 | import ( 4 | "encoding/json" 5 | "io" 6 | "io/ioutil" 7 | "os" 8 | "strings" 9 | "text/template" 10 | 11 | "github.com/Masterminds/sprig/v3" 12 | "github.com/pelletier/go-toml" 13 | "github.com/pkg/errors" 14 | 15 | yaml "gopkg.in/yaml.v2" 16 | ) 17 | 18 | // Values holds data present in the values file 19 | type Values map[string]interface{} 20 | 21 | // Env exports all enviroments variable 22 | func (v *Values) Env() map[string]string { 23 | env := make(map[string]string) 24 | for _, i := range os.Environ() { 25 | sep := strings.Index(i, "=") 26 | env[i[0:sep]] = i[sep+1:] 27 | } 28 | return env 29 | } 30 | 31 | // Subst receives a values file, values type, input and renders the template replacing 32 | // all variables present in the values file sending it to the output 33 | type Subst struct { 34 | values *Values 35 | input io.Reader 36 | output io.Writer 37 | } 38 | 39 | // NewSubst substitues values 40 | func NewSubst(valuesFile string, valuesType string, input io.Reader, output io.Writer) (*Subst, error) { 41 | values, err := loadValues(valuesFile, valuesType) 42 | if err != nil { 43 | return nil, err 44 | } 45 | 46 | return &Subst{ 47 | values: &values, 48 | input: input, 49 | output: output, 50 | }, nil 51 | 52 | } 53 | 54 | // Render render template with the given values 55 | func (s Subst) Render() error { 56 | text, err := ioutil.ReadAll(s.input) 57 | if err != nil { 58 | return err 59 | } 60 | 61 | tmpl, err := template.New("base").Option("missingkey=error").Funcs(sprig.TxtFuncMap()).Parse(string(text)) 62 | if err != nil { 63 | return err 64 | } 65 | 66 | return tmpl.Execute(s.output, s.values) 67 | } 68 | 69 | func loadValues(path string, vType string) (Values, error) { 70 | var values Values 71 | 72 | if path == "" { 73 | return values, nil 74 | } 75 | 76 | file, err := ioutil.ReadFile(path) 77 | if err != nil { 78 | return nil, errors.Wrap(err, "Reading values file failed") 79 | } 80 | 81 | switch strings.ToLower(vType) { 82 | case "json": 83 | if err := json.Unmarshal(file, &values); err != nil { 84 | return nil, errors.Wrapf(err, "Parsing %s as json failed", path) 85 | } 86 | case "yaml", "yml": 87 | if err := yaml.Unmarshal(file, &values); err != nil { 88 | return nil, errors.Wrapf(err, "Parsing %s as yaml failed", path) 89 | } 90 | case "toml": 91 | tree, err := toml.Load(string(file)) 92 | if err != nil { 93 | return nil, errors.Wrapf(err, "Parsing %s as toml failed", path) 94 | } 95 | 96 | values = tree.ToMap() 97 | } 98 | 99 | return values, nil 100 | } 101 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/node.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "sync" 9 | ) 10 | 11 | var ( 12 | nodeMu sync.Mutex 13 | ifname string // name of interface being used 14 | nodeID [6]byte // hardware for version 1 UUIDs 15 | zeroID [6]byte // nodeID with only 0's 16 | ) 17 | 18 | // NodeInterface returns the name of the interface from which the NodeID was 19 | // derived. The interface "user" is returned if the NodeID was set by 20 | // SetNodeID. 21 | func NodeInterface() string { 22 | defer nodeMu.Unlock() 23 | nodeMu.Lock() 24 | return ifname 25 | } 26 | 27 | // SetNodeInterface selects the hardware address to be used for Version 1 UUIDs. 28 | // If name is "" then the first usable interface found will be used or a random 29 | // Node ID will be generated. If a named interface cannot be found then false 30 | // is returned. 31 | // 32 | // SetNodeInterface never fails when name is "". 33 | func SetNodeInterface(name string) bool { 34 | defer nodeMu.Unlock() 35 | nodeMu.Lock() 36 | return setNodeInterface(name) 37 | } 38 | 39 | func setNodeInterface(name string) bool { 40 | iname, addr := getHardwareInterface(name) // null implementation for js 41 | if iname != "" && addr != nil { 42 | ifname = iname 43 | copy(nodeID[:], addr) 44 | return true 45 | } 46 | 47 | // We found no interfaces with a valid hardware address. If name 48 | // does not specify a specific interface generate a random Node ID 49 | // (section 4.1.6) 50 | if name == "" { 51 | ifname = "random" 52 | randomBits(nodeID[:]) 53 | return true 54 | } 55 | return false 56 | } 57 | 58 | // NodeID returns a slice of a copy of the current Node ID, setting the Node ID 59 | // if not already set. 60 | func NodeID() []byte { 61 | defer nodeMu.Unlock() 62 | nodeMu.Lock() 63 | if nodeID == zeroID { 64 | setNodeInterface("") 65 | } 66 | nid := nodeID 67 | return nid[:] 68 | } 69 | 70 | // SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes 71 | // of id are used. If id is less than 6 bytes then false is returned and the 72 | // Node ID is not set. 73 | func SetNodeID(id []byte) bool { 74 | if len(id) < 6 { 75 | return false 76 | } 77 | defer nodeMu.Unlock() 78 | nodeMu.Lock() 79 | copy(nodeID[:], id) 80 | ifname = "user" 81 | return true 82 | } 83 | 84 | // NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is 85 | // not valid. The NodeID is only well defined for version 1 and 2 UUIDs. 86 | func (uuid UUID) NodeID() []byte { 87 | var node [6]byte 88 | copy(node[:], uuid[10:]) 89 | return node[:] 90 | } 91 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/token.go: -------------------------------------------------------------------------------- 1 | package toml 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | "unicode" 7 | ) 8 | 9 | // Define tokens 10 | type tokenType int 11 | 12 | const ( 13 | eof = -(iota + 1) 14 | ) 15 | 16 | const ( 17 | tokenError tokenType = iota 18 | tokenEOF 19 | tokenComment 20 | tokenKey 21 | tokenString 22 | tokenInteger 23 | tokenTrue 24 | tokenFalse 25 | tokenFloat 26 | tokenEqual 27 | tokenLeftBracket 28 | tokenRightBracket 29 | tokenLeftCurlyBrace 30 | tokenRightCurlyBrace 31 | tokenLeftParen 32 | tokenRightParen 33 | tokenDoubleLeftBracket 34 | tokenDoubleRightBracket 35 | tokenDate 36 | tokenKeyGroup 37 | tokenKeyGroupArray 38 | tokenComma 39 | tokenColon 40 | tokenDollar 41 | tokenStar 42 | tokenQuestion 43 | tokenDot 44 | tokenDotDot 45 | tokenEOL 46 | ) 47 | 48 | var tokenTypeNames = []string{ 49 | "Error", 50 | "EOF", 51 | "Comment", 52 | "Key", 53 | "String", 54 | "Integer", 55 | "True", 56 | "False", 57 | "Float", 58 | "=", 59 | "[", 60 | "]", 61 | "{", 62 | "}", 63 | "(", 64 | ")", 65 | "]]", 66 | "[[", 67 | "Date", 68 | "KeyGroup", 69 | "KeyGroupArray", 70 | ",", 71 | ":", 72 | "$", 73 | "*", 74 | "?", 75 | ".", 76 | "..", 77 | "EOL", 78 | } 79 | 80 | type token struct { 81 | Position 82 | typ tokenType 83 | val string 84 | } 85 | 86 | func (tt tokenType) String() string { 87 | idx := int(tt) 88 | if idx < len(tokenTypeNames) { 89 | return tokenTypeNames[idx] 90 | } 91 | return "Unknown" 92 | } 93 | 94 | func (t token) Int() int { 95 | if result, err := strconv.Atoi(t.val); err != nil { 96 | panic(err) 97 | } else { 98 | return result 99 | } 100 | } 101 | 102 | func (t token) String() string { 103 | switch t.typ { 104 | case tokenEOF: 105 | return "EOF" 106 | case tokenError: 107 | return t.val 108 | } 109 | 110 | return fmt.Sprintf("%q", t.val) 111 | } 112 | 113 | func isSpace(r rune) bool { 114 | return r == ' ' || r == '\t' 115 | } 116 | 117 | func isAlphanumeric(r rune) bool { 118 | return unicode.IsLetter(r) || r == '_' 119 | } 120 | 121 | func isKeyChar(r rune) bool { 122 | // Keys start with the first character that isn't whitespace or [ and end 123 | // with the last non-whitespace character before the equals sign. Keys 124 | // cannot contain a # character." 125 | return !(r == '\r' || r == '\n' || r == eof || r == '=') 126 | } 127 | 128 | func isKeyStartChar(r rune) bool { 129 | return !(isSpace(r) || r == '\r' || r == '\n' || r == eof || r == '[') 130 | } 131 | 132 | func isDigit(r rune) bool { 133 | return unicode.IsNumber(r) 134 | } 135 | 136 | func isHexDigit(r rune) bool { 137 | return isDigit(r) || 138 | r == 'A' || r == 'B' || r == 'C' || r == 'D' || r == 'E' || r == 'F' 139 | } 140 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 7 | 2898 / PKCS #5 v2.0. 8 | 9 | A key derivation function is useful when encrypting data based on a password 10 | or any other not-fully-random data. It uses a pseudorandom function to derive 11 | a secure encryption key based on the password. 12 | 13 | While v2.0 of the standard defines only one pseudorandom function to use, 14 | HMAC-SHA1, the drafted v2.1 specification allows use of all five FIPS Approved 15 | Hash Functions SHA-1, SHA-224, SHA-256, SHA-384 and SHA-512 for HMAC. To 16 | choose, you can pass the `New` functions from the different SHA packages to 17 | pbkdf2.Key. 18 | */ 19 | package pbkdf2 // import "golang.org/x/crypto/pbkdf2" 20 | 21 | import ( 22 | "crypto/hmac" 23 | "hash" 24 | ) 25 | 26 | // Key derives a key from the password, salt and iteration count, returning a 27 | // []byte of length keylen that can be used as cryptographic key. The key is 28 | // derived based on the method described as PBKDF2 with the HMAC variant using 29 | // the supplied hash function. 30 | // 31 | // For example, to use a HMAC-SHA-1 based PBKDF2 key derivation function, you 32 | // can get a derived key for e.g. AES-256 (which needs a 32-byte key) by 33 | // doing: 34 | // 35 | // dk := pbkdf2.Key([]byte("some password"), salt, 4096, 32, sha1.New) 36 | // 37 | // Remember to get a good random salt. At least 8 bytes is recommended by the 38 | // RFC. 39 | // 40 | // Using a higher iteration count will increase the cost of an exhaustive 41 | // search but will also make derivation proportionally slower. 42 | func Key(password, salt []byte, iter, keyLen int, h func() hash.Hash) []byte { 43 | prf := hmac.New(h, password) 44 | hashLen := prf.Size() 45 | numBlocks := (keyLen + hashLen - 1) / hashLen 46 | 47 | var buf [4]byte 48 | dk := make([]byte, 0, numBlocks*hashLen) 49 | U := make([]byte, hashLen) 50 | for block := 1; block <= numBlocks; block++ { 51 | // N.B.: || means concatenation, ^ means XOR 52 | // for each block T_i = U_1 ^ U_2 ^ ... ^ U_iter 53 | // U_1 = PRF(password, salt || uint(i)) 54 | prf.Reset() 55 | prf.Write(salt) 56 | buf[0] = byte(block >> 24) 57 | buf[1] = byte(block >> 16) 58 | buf[2] = byte(block >> 8) 59 | buf[3] = byte(block) 60 | prf.Write(buf[:4]) 61 | dk = prf.Sum(dk) 62 | T := dk[len(dk)-hashLen:] 63 | copy(U, T) 64 | 65 | // U_n = PRF(password, U_(n-1)) 66 | for n := 2; n <= iter; n++ { 67 | prf.Reset() 68 | prf.Write(U) 69 | U = U[:0] 70 | U = prf.Sum(U) 71 | for x := range U { 72 | T[x] ^= U[x] 73 | } 74 | } 75 | } 76 | return dk[:keyLen] 77 | } 78 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/trap_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | // +build !go1.4 3 | 4 | package mousetrap 5 | 6 | import ( 7 | "fmt" 8 | "os" 9 | "syscall" 10 | "unsafe" 11 | ) 12 | 13 | const ( 14 | // defined by the Win32 API 15 | th32cs_snapprocess uintptr = 0x2 16 | ) 17 | 18 | var ( 19 | kernel = syscall.MustLoadDLL("kernel32.dll") 20 | CreateToolhelp32Snapshot = kernel.MustFindProc("CreateToolhelp32Snapshot") 21 | Process32First = kernel.MustFindProc("Process32FirstW") 22 | Process32Next = kernel.MustFindProc("Process32NextW") 23 | ) 24 | 25 | // ProcessEntry32 structure defined by the Win32 API 26 | type processEntry32 struct { 27 | dwSize uint32 28 | cntUsage uint32 29 | th32ProcessID uint32 30 | th32DefaultHeapID int 31 | th32ModuleID uint32 32 | cntThreads uint32 33 | th32ParentProcessID uint32 34 | pcPriClassBase int32 35 | dwFlags uint32 36 | szExeFile [syscall.MAX_PATH]uint16 37 | } 38 | 39 | func getProcessEntry(pid int) (pe *processEntry32, err error) { 40 | snapshot, _, e1 := CreateToolhelp32Snapshot.Call(th32cs_snapprocess, uintptr(0)) 41 | if snapshot == uintptr(syscall.InvalidHandle) { 42 | err = fmt.Errorf("CreateToolhelp32Snapshot: %v", e1) 43 | return 44 | } 45 | defer syscall.CloseHandle(syscall.Handle(snapshot)) 46 | 47 | var processEntry processEntry32 48 | processEntry.dwSize = uint32(unsafe.Sizeof(processEntry)) 49 | ok, _, e1 := Process32First.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) 50 | if ok == 0 { 51 | err = fmt.Errorf("Process32First: %v", e1) 52 | return 53 | } 54 | 55 | for { 56 | if processEntry.th32ProcessID == uint32(pid) { 57 | pe = &processEntry 58 | return 59 | } 60 | 61 | ok, _, e1 = Process32Next.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) 62 | if ok == 0 { 63 | err = fmt.Errorf("Process32Next: %v", e1) 64 | return 65 | } 66 | } 67 | } 68 | 69 | func getppid() (pid int, err error) { 70 | pe, err := getProcessEntry(os.Getpid()) 71 | if err != nil { 72 | return 73 | } 74 | 75 | pid = int(pe.th32ParentProcessID) 76 | return 77 | } 78 | 79 | // StartedByExplorer returns true if the program was invoked by the user double-clicking 80 | // on the executable from explorer.exe 81 | // 82 | // It is conservative and returns false if any of the internal calls fail. 83 | // It does not guarantee that the program was run from a terminal. It only can tell you 84 | // whether it was launched from explorer.exe 85 | func StartedByExplorer() bool { 86 | ppid, err := getppid() 87 | if err != nil { 88 | return false 89 | } 90 | 91 | pe, err := getProcessEntry(ppid) 92 | if err != nil { 93 | return false 94 | } 95 | 96 | name := syscall.UTF16ToString(pe.szExeFile[:]) 97 | return name == "explorer.exe" 98 | } 99 | -------------------------------------------------------------------------------- /vendor/github.com/huandu/xstrings/count.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Huan Du. All rights reserved. 2 | // Licensed under the MIT license that can be found in the LICENSE file. 3 | 4 | package xstrings 5 | 6 | import ( 7 | "unicode" 8 | "unicode/utf8" 9 | ) 10 | 11 | // Len returns str's utf8 rune length. 12 | func Len(str string) int { 13 | return utf8.RuneCountInString(str) 14 | } 15 | 16 | // WordCount returns number of words in a string. 17 | // 18 | // Word is defined as a locale dependent string containing alphabetic characters, 19 | // which may also contain but not start with `'` and `-` characters. 20 | func WordCount(str string) int { 21 | var r rune 22 | var size, n int 23 | 24 | inWord := false 25 | 26 | for len(str) > 0 { 27 | r, size = utf8.DecodeRuneInString(str) 28 | 29 | switch { 30 | case isAlphabet(r): 31 | if !inWord { 32 | inWord = true 33 | n++ 34 | } 35 | 36 | case inWord && (r == '\'' || r == '-'): 37 | // Still in word. 38 | 39 | default: 40 | inWord = false 41 | } 42 | 43 | str = str[size:] 44 | } 45 | 46 | return n 47 | } 48 | 49 | const minCJKCharacter = '\u3400' 50 | 51 | // Checks r is a letter but not CJK character. 52 | func isAlphabet(r rune) bool { 53 | if !unicode.IsLetter(r) { 54 | return false 55 | } 56 | 57 | switch { 58 | // Quick check for non-CJK character. 59 | case r < minCJKCharacter: 60 | return true 61 | 62 | // Common CJK characters. 63 | case r >= '\u4E00' && r <= '\u9FCC': 64 | return false 65 | 66 | // Rare CJK characters. 67 | case r >= '\u3400' && r <= '\u4D85': 68 | return false 69 | 70 | // Rare and historic CJK characters. 71 | case r >= '\U00020000' && r <= '\U0002B81D': 72 | return false 73 | } 74 | 75 | return true 76 | } 77 | 78 | // Width returns string width in monotype font. 79 | // Multi-byte characters are usually twice the width of single byte characters. 80 | // 81 | // Algorithm comes from `mb_strwidth` in PHP. 82 | // http://php.net/manual/en/function.mb-strwidth.php 83 | func Width(str string) int { 84 | var r rune 85 | var size, n int 86 | 87 | for len(str) > 0 { 88 | r, size = utf8.DecodeRuneInString(str) 89 | n += RuneWidth(r) 90 | str = str[size:] 91 | } 92 | 93 | return n 94 | } 95 | 96 | // RuneWidth returns character width in monotype font. 97 | // Multi-byte characters are usually twice the width of single byte characters. 98 | // 99 | // Algorithm comes from `mb_strwidth` in PHP. 100 | // http://php.net/manual/en/function.mb-strwidth.php 101 | func RuneWidth(r rune) int { 102 | switch { 103 | case r == utf8.RuneError || r < '\x20': 104 | return 0 105 | 106 | case '\x20' <= r && r < '\u2000': 107 | return 1 108 | 109 | case '\u2000' <= r && r < '\uFF61': 110 | return 2 111 | 112 | case '\uFF61' <= r && r < '\uFFA0': 113 | return 1 114 | 115 | case '\uFFA0' <= r: 116 | return 2 117 | } 118 | 119 | return 0 120 | } 121 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-buffruneio/buffruneio.go: -------------------------------------------------------------------------------- 1 | // Package buffruneio is a wrapper around bufio to provide buffered runes access with unlimited unreads. 2 | package buffruneio 3 | 4 | import ( 5 | "bufio" 6 | "container/list" 7 | "errors" 8 | "io" 9 | ) 10 | 11 | // Rune to indicate end of file. 12 | const ( 13 | EOF = -(iota + 1) 14 | ) 15 | 16 | // ErrNoRuneToUnread is returned by UnreadRune() when the read index is already at the beginning of the buffer. 17 | var ErrNoRuneToUnread = errors.New("no rune to unwind") 18 | 19 | // Reader implements runes buffering for an io.Reader object. 20 | type Reader struct { 21 | buffer *list.List 22 | current *list.Element 23 | input *bufio.Reader 24 | } 25 | 26 | // NewReader returns a new Reader. 27 | func NewReader(rd io.Reader) *Reader { 28 | return &Reader{ 29 | buffer: list.New(), 30 | input: bufio.NewReader(rd), 31 | } 32 | } 33 | 34 | func (rd *Reader) feedBuffer() error { 35 | r, _, err := rd.input.ReadRune() 36 | 37 | if err != nil { 38 | if err != io.EOF { 39 | return err 40 | } 41 | r = EOF 42 | } 43 | 44 | rd.buffer.PushBack(r) 45 | if rd.current == nil { 46 | rd.current = rd.buffer.Back() 47 | } 48 | return nil 49 | } 50 | 51 | // ReadRune reads the next rune from buffer, or from the underlying reader if needed. 52 | func (rd *Reader) ReadRune() (rune, error) { 53 | if rd.current == rd.buffer.Back() || rd.current == nil { 54 | err := rd.feedBuffer() 55 | if err != nil { 56 | return EOF, err 57 | } 58 | } 59 | 60 | r := rd.current.Value 61 | rd.current = rd.current.Next() 62 | return r.(rune), nil 63 | } 64 | 65 | // UnreadRune pushes back the previously read rune in the buffer, extending it if needed. 66 | func (rd *Reader) UnreadRune() error { 67 | if rd.current == rd.buffer.Front() { 68 | return ErrNoRuneToUnread 69 | } 70 | if rd.current == nil { 71 | rd.current = rd.buffer.Back() 72 | } else { 73 | rd.current = rd.current.Prev() 74 | } 75 | return nil 76 | } 77 | 78 | // Forget removes runes stored before the current stream position index. 79 | func (rd *Reader) Forget() { 80 | if rd.current == nil { 81 | rd.current = rd.buffer.Back() 82 | } 83 | for ; rd.current != rd.buffer.Front(); rd.buffer.Remove(rd.current.Prev()) { 84 | } 85 | } 86 | 87 | // Peek returns at most the next n runes, reading from the uderlying source if 88 | // needed. Does not move the current index. It includes EOF if reached. 89 | func (rd *Reader) Peek(n int) []rune { 90 | res := make([]rune, 0, n) 91 | cursor := rd.current 92 | for i := 0; i < n; i++ { 93 | if cursor == nil { 94 | err := rd.feedBuffer() 95 | if err != nil { 96 | return res 97 | } 98 | cursor = rd.buffer.Back() 99 | } 100 | if cursor != nil { 101 | r := cursor.Value.(rune) 102 | res = append(res, r) 103 | if r == EOF { 104 | return res 105 | } 106 | cursor = cursor.Next() 107 | } 108 | } 109 | return res 110 | } 111 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gosubst 2 | 3 | `gosubst` is an `envsubst` on steroids. Receives a template file in the `stdin` replaces all variables and sends it to `stdout`. 4 | 5 | ## Installing 6 | Get the latest gosubst for your platform on the [releases](https://github.com/luizbafilho/gosubst/releases) page 7 | ``` 8 | curl -o /usr/local/bin/gosubst -sSL https://github.com/luizbafilho/gosubst/releases/download//gosubst_- 9 | chmod +x /usr/local/bin/gosubst 10 | ``` 11 | 12 | ## Usage 13 | `gosubst` copies the `stdin` to `stdout` replacing all variables. 14 | 15 | ```shell 16 | gosubst copies stardard input to standard output replacing all variables present in values file 17 | 18 | Usage: 19 | gosubst [flags] 20 | 21 | Flags: 22 | --type string values type (toml, yaml or json) (default "yaml") 23 | -v, --values string values file 24 | ``` 25 | 26 | Values file sample: 27 | ```yaml 28 | foo: "bar" 29 | baz: 30 | boo: "bla" 31 | zoo: "mee" 32 | ``` 33 | 34 | Template file sample: 35 | 36 | ``` 37 | Sample access: {{.foo}} 38 | Accessing variables: {{.baz.boo}} | {{.baz.zoo}} 39 | ``` 40 | 41 | ```shell 42 | $ gosubst -f values.yaml < template.conf 43 | 44 | Sample access: bar 45 | Accessing variables: bla | mee 46 | ``` 47 | 48 | ### Values Files 49 | The values file provides all the values to be replaced when the template is processed. `gosubst` supports `yaml`, `json` or `toml` files. 50 | 51 | ### Environment variables 52 | 53 | `gosubst` makes all environment variables available in the template. 54 | 55 | ```shell 56 | $ echo "Home path: {{.Env.HOME}}" | gosubst 57 | Home path: /home/vagrant 58 | ``` 59 | 60 | ### Template functions 61 | Given that `gosubst` uses `Go Templates` you can leverage all the power `Go` provide. Here is a small sample: 62 | 63 | ``` 64 | {{with .Account -}} 65 | Dear {{.FirstName}} {{.LastName}}, 66 | {{- end}} 67 | 68 | Below are your account statement details for period from {{.FromDate}} to {{.ToDate}}. 69 | 70 | {{if .Purchases -}} 71 | Your purchases: 72 | {{- range .Purchases }} 73 | {{ .Date}} {{ printf "%-20s" .Description }} {{.AmountInCents -}} 74 | {{- end}} 75 | {{- else}} 76 | You didn't make any purchases during the period. 77 | {{- end}} 78 | 79 | {{$note := .Account.Note -}} 80 | {{if $note -}} 81 | Note: {{$note}} 82 | {{- end}} 83 | 84 | Best Wishes, 85 | Customer Service 86 | ``` 87 | 88 | For more details: https://golang.org/pkg/text/template/#hdr-Text_and_spaces 89 | 90 | ### Helper functions 91 | `gosubst` makes available a lot of usefull functions provided by [Sprig](https://github.com/Masterminds/sprig) 92 | 93 | 94 | ```shell 95 | $ echo "generated-id: {{uuidv4}}" | gosubst 96 | generated-id: 00a315b7-c846-4751-b2ee-b50eb5359bac 97 | 98 | $ echo "generated-sha: {{sha256sum .Env.USER | trunc 7}}" | gosubst 99 | generated-sha: 4b569e8 100 | ``` 101 | 102 | Check it out all functions available: https://github.com/Masterminds/sprig#functions 103 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/null.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Google Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uuid 6 | 7 | import ( 8 | "bytes" 9 | "database/sql/driver" 10 | "encoding/json" 11 | "fmt" 12 | ) 13 | 14 | var jsonNull = []byte("null") 15 | 16 | // NullUUID represents a UUID that may be null. 17 | // NullUUID implements the SQL driver.Scanner interface so 18 | // it can be used as a scan destination: 19 | // 20 | // var u uuid.NullUUID 21 | // err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&u) 22 | // ... 23 | // if u.Valid { 24 | // // use u.UUID 25 | // } else { 26 | // // NULL value 27 | // } 28 | // 29 | type NullUUID struct { 30 | UUID UUID 31 | Valid bool // Valid is true if UUID is not NULL 32 | } 33 | 34 | // Scan implements the SQL driver.Scanner interface. 35 | func (nu *NullUUID) Scan(value interface{}) error { 36 | if value == nil { 37 | nu.UUID, nu.Valid = Nil, false 38 | return nil 39 | } 40 | 41 | err := nu.UUID.Scan(value) 42 | if err != nil { 43 | nu.Valid = false 44 | return err 45 | } 46 | 47 | nu.Valid = true 48 | return nil 49 | } 50 | 51 | // Value implements the driver Valuer interface. 52 | func (nu NullUUID) Value() (driver.Value, error) { 53 | if !nu.Valid { 54 | return nil, nil 55 | } 56 | // Delegate to UUID Value function 57 | return nu.UUID.Value() 58 | } 59 | 60 | // MarshalBinary implements encoding.BinaryMarshaler. 61 | func (nu NullUUID) MarshalBinary() ([]byte, error) { 62 | if nu.Valid { 63 | return nu.UUID[:], nil 64 | } 65 | 66 | return []byte(nil), nil 67 | } 68 | 69 | // UnmarshalBinary implements encoding.BinaryUnmarshaler. 70 | func (nu *NullUUID) UnmarshalBinary(data []byte) error { 71 | if len(data) != 16 { 72 | return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) 73 | } 74 | copy(nu.UUID[:], data) 75 | nu.Valid = true 76 | return nil 77 | } 78 | 79 | // MarshalText implements encoding.TextMarshaler. 80 | func (nu NullUUID) MarshalText() ([]byte, error) { 81 | if nu.Valid { 82 | return nu.UUID.MarshalText() 83 | } 84 | 85 | return jsonNull, nil 86 | } 87 | 88 | // UnmarshalText implements encoding.TextUnmarshaler. 89 | func (nu *NullUUID) UnmarshalText(data []byte) error { 90 | id, err := ParseBytes(data) 91 | if err != nil { 92 | nu.Valid = false 93 | return err 94 | } 95 | nu.UUID = id 96 | nu.Valid = true 97 | return nil 98 | } 99 | 100 | // MarshalJSON implements json.Marshaler. 101 | func (nu NullUUID) MarshalJSON() ([]byte, error) { 102 | if nu.Valid { 103 | return json.Marshal(nu.UUID) 104 | } 105 | 106 | return jsonNull, nil 107 | } 108 | 109 | // UnmarshalJSON implements json.Unmarshaler. 110 | func (nu *NullUUID) UnmarshalJSON(data []byte) error { 111 | if bytes.Equal(data, jsonNull) { 112 | *nu = NullUUID{} 113 | return nil // valid null UUID 114 | } 115 | err := json.Unmarshal(data, &nu.UUID) 116 | nu.Valid = err == nil 117 | return err 118 | } 119 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/int.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "strconv" 4 | 5 | // -- int Value 6 | type intValue int 7 | 8 | func newIntValue(val int, p *int) *intValue { 9 | *p = val 10 | return (*intValue)(p) 11 | } 12 | 13 | func (i *intValue) Set(s string) error { 14 | v, err := strconv.ParseInt(s, 0, 64) 15 | *i = intValue(v) 16 | return err 17 | } 18 | 19 | func (i *intValue) Type() string { 20 | return "int" 21 | } 22 | 23 | func (i *intValue) String() string { return strconv.Itoa(int(*i)) } 24 | 25 | func intConv(sval string) (interface{}, error) { 26 | return strconv.Atoi(sval) 27 | } 28 | 29 | // GetInt return the int value of a flag with the given name 30 | func (f *FlagSet) GetInt(name string) (int, error) { 31 | val, err := f.getFlagType(name, "int", intConv) 32 | if err != nil { 33 | return 0, err 34 | } 35 | return val.(int), nil 36 | } 37 | 38 | // IntVar defines an int flag with specified name, default value, and usage string. 39 | // The argument p points to an int variable in which to store the value of the flag. 40 | func (f *FlagSet) IntVar(p *int, name string, value int, usage string) { 41 | f.VarP(newIntValue(value, p), name, "", usage) 42 | } 43 | 44 | // IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash. 45 | func (f *FlagSet) IntVarP(p *int, name, shorthand string, value int, usage string) { 46 | f.VarP(newIntValue(value, p), name, shorthand, usage) 47 | } 48 | 49 | // IntVar defines an int flag with specified name, default value, and usage string. 50 | // The argument p points to an int variable in which to store the value of the flag. 51 | func IntVar(p *int, name string, value int, usage string) { 52 | CommandLine.VarP(newIntValue(value, p), name, "", usage) 53 | } 54 | 55 | // IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash. 56 | func IntVarP(p *int, name, shorthand string, value int, usage string) { 57 | CommandLine.VarP(newIntValue(value, p), name, shorthand, usage) 58 | } 59 | 60 | // Int defines an int flag with specified name, default value, and usage string. 61 | // The return value is the address of an int variable that stores the value of the flag. 62 | func (f *FlagSet) Int(name string, value int, usage string) *int { 63 | p := new(int) 64 | f.IntVarP(p, name, "", value, usage) 65 | return p 66 | } 67 | 68 | // IntP is like Int, but accepts a shorthand letter that can be used after a single dash. 69 | func (f *FlagSet) IntP(name, shorthand string, value int, usage string) *int { 70 | p := new(int) 71 | f.IntVarP(p, name, shorthand, value, usage) 72 | return p 73 | } 74 | 75 | // Int defines an int flag with specified name, default value, and usage string. 76 | // The return value is the address of an int variable that stores the value of the flag. 77 | func Int(name string, value int, usage string) *int { 78 | return CommandLine.IntP(name, "", value, usage) 79 | } 80 | 81 | // IntP is like Int, but accepts a shorthand letter that can be used after a single dash. 82 | func IntP(name, shorthand string, value int, usage string) *int { 83 | return CommandLine.IntP(name, shorthand, value, usage) 84 | } 85 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/count.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "strconv" 4 | 5 | // -- count Value 6 | type countValue int 7 | 8 | func newCountValue(val int, p *int) *countValue { 9 | *p = val 10 | return (*countValue)(p) 11 | } 12 | 13 | func (i *countValue) Set(s string) error { 14 | v, err := strconv.ParseInt(s, 0, 64) 15 | // -1 means that no specific value was passed, so increment 16 | if v == -1 { 17 | *i = countValue(*i + 1) 18 | } else { 19 | *i = countValue(v) 20 | } 21 | return err 22 | } 23 | 24 | func (i *countValue) Type() string { 25 | return "count" 26 | } 27 | 28 | func (i *countValue) String() string { return strconv.Itoa(int(*i)) } 29 | 30 | func countConv(sval string) (interface{}, error) { 31 | i, err := strconv.Atoi(sval) 32 | if err != nil { 33 | return nil, err 34 | } 35 | return i, nil 36 | } 37 | 38 | // GetCount return the int value of a flag with the given name 39 | func (f *FlagSet) GetCount(name string) (int, error) { 40 | val, err := f.getFlagType(name, "count", countConv) 41 | if err != nil { 42 | return 0, err 43 | } 44 | return val.(int), nil 45 | } 46 | 47 | // CountVar defines a count flag with specified name, default value, and usage string. 48 | // The argument p points to an int variable in which to store the value of the flag. 49 | // A count flag will add 1 to its value evey time it is found on the command line 50 | func (f *FlagSet) CountVar(p *int, name string, usage string) { 51 | f.CountVarP(p, name, "", usage) 52 | } 53 | 54 | // CountVarP is like CountVar only take a shorthand for the flag name. 55 | func (f *FlagSet) CountVarP(p *int, name, shorthand string, usage string) { 56 | flag := f.VarPF(newCountValue(0, p), name, shorthand, usage) 57 | flag.NoOptDefVal = "-1" 58 | } 59 | 60 | // CountVar like CountVar only the flag is placed on the CommandLine instead of a given flag set 61 | func CountVar(p *int, name string, usage string) { 62 | CommandLine.CountVar(p, name, usage) 63 | } 64 | 65 | // CountVarP is like CountVar only take a shorthand for the flag name. 66 | func CountVarP(p *int, name, shorthand string, usage string) { 67 | CommandLine.CountVarP(p, name, shorthand, usage) 68 | } 69 | 70 | // Count defines a count flag with specified name, default value, and usage string. 71 | // The return value is the address of an int variable that stores the value of the flag. 72 | // A count flag will add 1 to its value evey time it is found on the command line 73 | func (f *FlagSet) Count(name string, usage string) *int { 74 | p := new(int) 75 | f.CountVarP(p, name, "", usage) 76 | return p 77 | } 78 | 79 | // CountP is like Count only takes a shorthand for the flag name. 80 | func (f *FlagSet) CountP(name, shorthand string, usage string) *int { 81 | p := new(int) 82 | f.CountVarP(p, name, shorthand, usage) 83 | return p 84 | } 85 | 86 | // Count like Count only the flag is placed on the CommandLine isntead of a given flag set 87 | func Count(name string, usage string) *int { 88 | return CommandLine.CountP(name, "", usage) 89 | } 90 | 91 | // CountP is like Count only takes a shorthand for the flag name. 92 | func CountP(name, shorthand string, usage string) *int { 93 | return CommandLine.CountP(name, shorthand, usage) 94 | } 95 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/README.md: -------------------------------------------------------------------------------- 1 | cast 2 | ==== 3 | [![GoDoc](https://godoc.org/github.com/spf13/cast?status.svg)](https://godoc.org/github.com/spf13/cast) 4 | [![Build Status](https://api.travis-ci.org/spf13/cast.svg?branch=master)](https://travis-ci.org/spf13/cast) 5 | [![Go Report Card](https://goreportcard.com/badge/github.com/spf13/cast)](https://goreportcard.com/report/github.com/spf13/cast) 6 | 7 | Easy and safe casting from one type to another in Go 8 | 9 | Don’t Panic! ... Cast 10 | 11 | ## What is Cast? 12 | 13 | Cast is a library to convert between different go types in a consistent and easy way. 14 | 15 | Cast provides simple functions to easily convert a number to a string, an 16 | interface into a bool, etc. Cast does this intelligently when an obvious 17 | conversion is possible. It doesn’t make any attempts to guess what you meant, 18 | for example you can only convert a string to an int when it is a string 19 | representation of an int such as “8”. Cast was developed for use in 20 | [Hugo](http://hugo.spf13.com), a website engine which uses YAML, TOML or JSON 21 | for meta data. 22 | 23 | ## Why use Cast? 24 | 25 | When working with dynamic data in Go you often need to cast or convert the data 26 | from one type into another. Cast goes beyond just using type assertion (though 27 | it uses that when possible) to provide a very straightforward and convenient 28 | library. 29 | 30 | If you are working with interfaces to handle things like dynamic content 31 | you’ll need an easy way to convert an interface into a given type. This 32 | is the library for you. 33 | 34 | If you are taking in data from YAML, TOML or JSON or other formats which lack 35 | full types, then Cast is the library for you. 36 | 37 | ## Usage 38 | 39 | Cast provides a handful of To_____ methods. These methods will always return 40 | the desired type. **If input is provided that will not convert to that type, the 41 | 0 or nil value for that type will be returned**. 42 | 43 | Cast also provides identical methods To_____E. These return the same result as 44 | the To_____ methods, plus an additional error which tells you if it successfully 45 | converted. Using these methods you can tell the difference between when the 46 | input matched the zero value or when the conversion failed and the zero value 47 | was returned. 48 | 49 | The following examples are merely a sample of what is available. Please review 50 | the code for a complete set. 51 | 52 | ### Example ‘ToString’: 53 | 54 | cast.ToString("mayonegg") // "mayonegg" 55 | cast.ToString(8) // "8" 56 | cast.ToString(8.31) // "8.31" 57 | cast.ToString([]byte("one time")) // "one time" 58 | cast.ToString(nil) // "" 59 | 60 | var foo interface{} = "one more time" 61 | cast.ToString(foo) // "one more time" 62 | 63 | 64 | ### Example ‘ToInt’: 65 | 66 | cast.ToInt(8) // 8 67 | cast.ToInt(8.31) // 8 68 | cast.ToInt("8") // 8 69 | cast.ToInt(true) // 1 70 | cast.ToInt(false) // 0 71 | 72 | var eight interface{} = 8 73 | cast.ToInt(eight) // 8 74 | cast.ToInt(nil) // 0 75 | 76 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/golangflag.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package pflag 6 | 7 | import ( 8 | goflag "flag" 9 | "reflect" 10 | "strings" 11 | ) 12 | 13 | // flagValueWrapper implements pflag.Value around a flag.Value. The main 14 | // difference here is the addition of the Type method that returns a string 15 | // name of the type. As this is generally unknown, we approximate that with 16 | // reflection. 17 | type flagValueWrapper struct { 18 | inner goflag.Value 19 | flagType string 20 | } 21 | 22 | // We are just copying the boolFlag interface out of goflag as that is what 23 | // they use to decide if a flag should get "true" when no arg is given. 24 | type goBoolFlag interface { 25 | goflag.Value 26 | IsBoolFlag() bool 27 | } 28 | 29 | func wrapFlagValue(v goflag.Value) Value { 30 | // If the flag.Value happens to also be a pflag.Value, just use it directly. 31 | if pv, ok := v.(Value); ok { 32 | return pv 33 | } 34 | 35 | pv := &flagValueWrapper{ 36 | inner: v, 37 | } 38 | 39 | t := reflect.TypeOf(v) 40 | if t.Kind() == reflect.Interface || t.Kind() == reflect.Ptr { 41 | t = t.Elem() 42 | } 43 | 44 | pv.flagType = strings.TrimSuffix(t.Name(), "Value") 45 | return pv 46 | } 47 | 48 | func (v *flagValueWrapper) String() string { 49 | return v.inner.String() 50 | } 51 | 52 | func (v *flagValueWrapper) Set(s string) error { 53 | return v.inner.Set(s) 54 | } 55 | 56 | func (v *flagValueWrapper) Type() string { 57 | return v.flagType 58 | } 59 | 60 | // PFlagFromGoFlag will return a *pflag.Flag given a *flag.Flag 61 | // If the *flag.Flag.Name was a single character (ex: `v`) it will be accessiblei 62 | // with both `-v` and `--v` in flags. If the golang flag was more than a single 63 | // character (ex: `verbose`) it will only be accessible via `--verbose` 64 | func PFlagFromGoFlag(goflag *goflag.Flag) *Flag { 65 | // Remember the default value as a string; it won't change. 66 | flag := &Flag{ 67 | Name: goflag.Name, 68 | Usage: goflag.Usage, 69 | Value: wrapFlagValue(goflag.Value), 70 | // Looks like golang flags don't set DefValue correctly :-( 71 | //DefValue: goflag.DefValue, 72 | DefValue: goflag.Value.String(), 73 | } 74 | // Ex: if the golang flag was -v, allow both -v and --v to work 75 | if len(flag.Name) == 1 { 76 | flag.Shorthand = flag.Name 77 | } 78 | if fv, ok := goflag.Value.(goBoolFlag); ok && fv.IsBoolFlag() { 79 | flag.NoOptDefVal = "true" 80 | } 81 | return flag 82 | } 83 | 84 | // AddGoFlag will add the given *flag.Flag to the pflag.FlagSet 85 | func (f *FlagSet) AddGoFlag(goflag *goflag.Flag) { 86 | if f.Lookup(goflag.Name) != nil { 87 | return 88 | } 89 | newflag := PFlagFromGoFlag(goflag) 90 | f.AddFlag(newflag) 91 | } 92 | 93 | // AddGoFlagSet will add the given *flag.FlagSet to the pflag.FlagSet 94 | func (f *FlagSet) AddGoFlagSet(newSet *goflag.FlagSet) { 95 | if newSet == nil { 96 | return 97 | } 98 | newSet.VisitAll(func(goflag *goflag.Flag) { 99 | f.AddGoFlag(goflag) 100 | }) 101 | } 102 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/sorter.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | import ( 4 | "reflect" 5 | "unicode" 6 | ) 7 | 8 | type keyList []reflect.Value 9 | 10 | func (l keyList) Len() int { return len(l) } 11 | func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } 12 | func (l keyList) Less(i, j int) bool { 13 | a := l[i] 14 | b := l[j] 15 | ak := a.Kind() 16 | bk := b.Kind() 17 | for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() { 18 | a = a.Elem() 19 | ak = a.Kind() 20 | } 21 | for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() { 22 | b = b.Elem() 23 | bk = b.Kind() 24 | } 25 | af, aok := keyFloat(a) 26 | bf, bok := keyFloat(b) 27 | if aok && bok { 28 | if af != bf { 29 | return af < bf 30 | } 31 | if ak != bk { 32 | return ak < bk 33 | } 34 | return numLess(a, b) 35 | } 36 | if ak != reflect.String || bk != reflect.String { 37 | return ak < bk 38 | } 39 | ar, br := []rune(a.String()), []rune(b.String()) 40 | for i := 0; i < len(ar) && i < len(br); i++ { 41 | if ar[i] == br[i] { 42 | continue 43 | } 44 | al := unicode.IsLetter(ar[i]) 45 | bl := unicode.IsLetter(br[i]) 46 | if al && bl { 47 | return ar[i] < br[i] 48 | } 49 | if al || bl { 50 | return bl 51 | } 52 | var ai, bi int 53 | var an, bn int64 54 | if ar[i] == '0' || br[i] == '0' { 55 | for j := i-1; j >= 0 && unicode.IsDigit(ar[j]); j-- { 56 | if ar[j] != '0' { 57 | an = 1 58 | bn = 1 59 | break 60 | } 61 | } 62 | } 63 | for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ { 64 | an = an*10 + int64(ar[ai]-'0') 65 | } 66 | for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ { 67 | bn = bn*10 + int64(br[bi]-'0') 68 | } 69 | if an != bn { 70 | return an < bn 71 | } 72 | if ai != bi { 73 | return ai < bi 74 | } 75 | return ar[i] < br[i] 76 | } 77 | return len(ar) < len(br) 78 | } 79 | 80 | // keyFloat returns a float value for v if it is a number/bool 81 | // and whether it is a number/bool or not. 82 | func keyFloat(v reflect.Value) (f float64, ok bool) { 83 | switch v.Kind() { 84 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: 85 | return float64(v.Int()), true 86 | case reflect.Float32, reflect.Float64: 87 | return v.Float(), true 88 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 89 | return float64(v.Uint()), true 90 | case reflect.Bool: 91 | if v.Bool() { 92 | return 1, true 93 | } 94 | return 0, true 95 | } 96 | return 0, false 97 | } 98 | 99 | // numLess returns whether a < b. 100 | // a and b must necessarily have the same kind. 101 | func numLess(a, b reflect.Value) bool { 102 | switch a.Kind() { 103 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: 104 | return a.Int() < b.Int() 105 | case reflect.Float32, reflect.Float64: 106 | return a.Float() < b.Float() 107 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 108 | return a.Uint() < b.Uint() 109 | case reflect.Bool: 110 | return !a.Bool() && b.Bool() 111 | } 112 | panic("not a number") 113 | } 114 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/string.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | // -- string Value 4 | type stringValue string 5 | 6 | func newStringValue(val string, p *string) *stringValue { 7 | *p = val 8 | return (*stringValue)(p) 9 | } 10 | 11 | func (s *stringValue) Set(val string) error { 12 | *s = stringValue(val) 13 | return nil 14 | } 15 | func (s *stringValue) Type() string { 16 | return "string" 17 | } 18 | 19 | func (s *stringValue) String() string { return string(*s) } 20 | 21 | func stringConv(sval string) (interface{}, error) { 22 | return sval, nil 23 | } 24 | 25 | // GetString return the string value of a flag with the given name 26 | func (f *FlagSet) GetString(name string) (string, error) { 27 | val, err := f.getFlagType(name, "string", stringConv) 28 | if err != nil { 29 | return "", err 30 | } 31 | return val.(string), nil 32 | } 33 | 34 | // StringVar defines a string flag with specified name, default value, and usage string. 35 | // The argument p points to a string variable in which to store the value of the flag. 36 | func (f *FlagSet) StringVar(p *string, name string, value string, usage string) { 37 | f.VarP(newStringValue(value, p), name, "", usage) 38 | } 39 | 40 | // StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash. 41 | func (f *FlagSet) StringVarP(p *string, name, shorthand string, value string, usage string) { 42 | f.VarP(newStringValue(value, p), name, shorthand, usage) 43 | } 44 | 45 | // StringVar defines a string flag with specified name, default value, and usage string. 46 | // The argument p points to a string variable in which to store the value of the flag. 47 | func StringVar(p *string, name string, value string, usage string) { 48 | CommandLine.VarP(newStringValue(value, p), name, "", usage) 49 | } 50 | 51 | // StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash. 52 | func StringVarP(p *string, name, shorthand string, value string, usage string) { 53 | CommandLine.VarP(newStringValue(value, p), name, shorthand, usage) 54 | } 55 | 56 | // String defines a string flag with specified name, default value, and usage string. 57 | // The return value is the address of a string variable that stores the value of the flag. 58 | func (f *FlagSet) String(name string, value string, usage string) *string { 59 | p := new(string) 60 | f.StringVarP(p, name, "", value, usage) 61 | return p 62 | } 63 | 64 | // StringP is like String, but accepts a shorthand letter that can be used after a single dash. 65 | func (f *FlagSet) StringP(name, shorthand string, value string, usage string) *string { 66 | p := new(string) 67 | f.StringVarP(p, name, shorthand, value, usage) 68 | return p 69 | } 70 | 71 | // String defines a string flag with specified name, default value, and usage string. 72 | // The return value is the address of a string variable that stores the value of the flag. 73 | func String(name string, value string, usage string) *string { 74 | return CommandLine.StringP(name, "", value, usage) 75 | } 76 | 77 | // StringP is like String, but accepts a shorthand letter that can be used after a single dash. 78 | func StringP(name, shorthand string, value string, usage string) *string { 79 | return CommandLine.StringP(name, shorthand, value, usage) 80 | } 81 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/goutils/README.md: -------------------------------------------------------------------------------- 1 | GoUtils 2 | =========== 3 | [![Stability: Maintenance](https://masterminds.github.io/stability/maintenance.svg)](https://masterminds.github.io/stability/maintenance.html) 4 | [![GoDoc](https://godoc.org/github.com/Masterminds/goutils?status.png)](https://godoc.org/github.com/Masterminds/goutils) [![Build Status](https://travis-ci.org/Masterminds/goutils.svg?branch=master)](https://travis-ci.org/Masterminds/goutils) [![Build status](https://ci.appveyor.com/api/projects/status/sc2b1ew0m7f0aiju?svg=true)](https://ci.appveyor.com/project/mattfarina/goutils) 5 | 6 | 7 | GoUtils provides users with utility functions to manipulate strings in various ways. It is a Go implementation of some 8 | string manipulation libraries of Java Apache Commons. GoUtils includes the following Java Apache Commons classes: 9 | * WordUtils 10 | * RandomStringUtils 11 | * StringUtils (partial implementation) 12 | 13 | ## Installation 14 | If you have Go set up on your system, from the GOPATH directory within the command line/terminal, enter this: 15 | 16 | go get github.com/Masterminds/goutils 17 | 18 | If you do not have Go set up on your system, please follow the [Go installation directions from the documenation](http://golang.org/doc/install), and then follow the instructions above to install GoUtils. 19 | 20 | 21 | ## Documentation 22 | GoUtils doc is available here: [![GoDoc](https://godoc.org/github.com/Masterminds/goutils?status.png)](https://godoc.org/github.com/Masterminds/goutils) 23 | 24 | 25 | ## Usage 26 | The code snippets below show examples of how to use GoUtils. Some functions return errors while others do not. The first instance below, which does not return an error, is the `Initials` function (located within the `wordutils.go` file). 27 | 28 | package main 29 | 30 | import ( 31 | "fmt" 32 | "github.com/Masterminds/goutils" 33 | ) 34 | 35 | func main() { 36 | 37 | // EXAMPLE 1: A goutils function which returns no errors 38 | fmt.Println (goutils.Initials("John Doe Foo")) // Prints out "JDF" 39 | 40 | } 41 | Some functions return errors mainly due to illegal arguements used as parameters. The code example below illustrates how to deal with function that returns an error. In this instance, the function is the `Random` function (located within the `randomstringutils.go` file). 42 | 43 | package main 44 | 45 | import ( 46 | "fmt" 47 | "github.com/Masterminds/goutils" 48 | ) 49 | 50 | func main() { 51 | 52 | // EXAMPLE 2: A goutils function which returns an error 53 | rand1, err1 := goutils.Random (-1, 0, 0, true, true) 54 | 55 | if err1 != nil { 56 | fmt.Println(err1) // Prints out error message because -1 was entered as the first parameter in goutils.Random(...) 57 | } else { 58 | fmt.Println(rand1) 59 | } 60 | 61 | } 62 | 63 | ## License 64 | GoUtils is licensed under the Apache License, Version 2.0. Please check the LICENSE.txt file or visit http://www.apache.org/licenses/LICENSE-2.0 for a copy of the license. 65 | 66 | ## Issue Reporting 67 | Make suggestions or report issues using the Git issue tracker: https://github.com/Masterminds/goutils/issues 68 | 69 | ## Website 70 | * [GoUtils webpage](http://Masterminds.github.io/goutils/) 71 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/int64.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "strconv" 4 | 5 | // -- int64 Value 6 | type int64Value int64 7 | 8 | func newInt64Value(val int64, p *int64) *int64Value { 9 | *p = val 10 | return (*int64Value)(p) 11 | } 12 | 13 | func (i *int64Value) Set(s string) error { 14 | v, err := strconv.ParseInt(s, 0, 64) 15 | *i = int64Value(v) 16 | return err 17 | } 18 | 19 | func (i *int64Value) Type() string { 20 | return "int64" 21 | } 22 | 23 | func (i *int64Value) String() string { return strconv.FormatInt(int64(*i), 10) } 24 | 25 | func int64Conv(sval string) (interface{}, error) { 26 | return strconv.ParseInt(sval, 0, 64) 27 | } 28 | 29 | // GetInt64 return the int64 value of a flag with the given name 30 | func (f *FlagSet) GetInt64(name string) (int64, error) { 31 | val, err := f.getFlagType(name, "int64", int64Conv) 32 | if err != nil { 33 | return 0, err 34 | } 35 | return val.(int64), nil 36 | } 37 | 38 | // Int64Var defines an int64 flag with specified name, default value, and usage string. 39 | // The argument p points to an int64 variable in which to store the value of the flag. 40 | func (f *FlagSet) Int64Var(p *int64, name string, value int64, usage string) { 41 | f.VarP(newInt64Value(value, p), name, "", usage) 42 | } 43 | 44 | // Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash. 45 | func (f *FlagSet) Int64VarP(p *int64, name, shorthand string, value int64, usage string) { 46 | f.VarP(newInt64Value(value, p), name, shorthand, usage) 47 | } 48 | 49 | // Int64Var defines an int64 flag with specified name, default value, and usage string. 50 | // The argument p points to an int64 variable in which to store the value of the flag. 51 | func Int64Var(p *int64, name string, value int64, usage string) { 52 | CommandLine.VarP(newInt64Value(value, p), name, "", usage) 53 | } 54 | 55 | // Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash. 56 | func Int64VarP(p *int64, name, shorthand string, value int64, usage string) { 57 | CommandLine.VarP(newInt64Value(value, p), name, shorthand, usage) 58 | } 59 | 60 | // Int64 defines an int64 flag with specified name, default value, and usage string. 61 | // The return value is the address of an int64 variable that stores the value of the flag. 62 | func (f *FlagSet) Int64(name string, value int64, usage string) *int64 { 63 | p := new(int64) 64 | f.Int64VarP(p, name, "", value, usage) 65 | return p 66 | } 67 | 68 | // Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash. 69 | func (f *FlagSet) Int64P(name, shorthand string, value int64, usage string) *int64 { 70 | p := new(int64) 71 | f.Int64VarP(p, name, shorthand, value, usage) 72 | return p 73 | } 74 | 75 | // Int64 defines an int64 flag with specified name, default value, and usage string. 76 | // The return value is the address of an int64 variable that stores the value of the flag. 77 | func Int64(name string, value int64, usage string) *int64 { 78 | return CommandLine.Int64P(name, "", value, usage) 79 | } 80 | 81 | // Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash. 82 | func Int64P(name, shorthand string, value int64, usage string) *int64 { 83 | return CommandLine.Int64P(name, shorthand, value, usage) 84 | } 85 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/int8.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "strconv" 4 | 5 | // -- int8 Value 6 | type int8Value int8 7 | 8 | func newInt8Value(val int8, p *int8) *int8Value { 9 | *p = val 10 | return (*int8Value)(p) 11 | } 12 | 13 | func (i *int8Value) Set(s string) error { 14 | v, err := strconv.ParseInt(s, 0, 8) 15 | *i = int8Value(v) 16 | return err 17 | } 18 | 19 | func (i *int8Value) Type() string { 20 | return "int8" 21 | } 22 | 23 | func (i *int8Value) String() string { return strconv.FormatInt(int64(*i), 10) } 24 | 25 | func int8Conv(sval string) (interface{}, error) { 26 | v, err := strconv.ParseInt(sval, 0, 8) 27 | if err != nil { 28 | return 0, err 29 | } 30 | return int8(v), nil 31 | } 32 | 33 | // GetInt8 return the int8 value of a flag with the given name 34 | func (f *FlagSet) GetInt8(name string) (int8, error) { 35 | val, err := f.getFlagType(name, "int8", int8Conv) 36 | if err != nil { 37 | return 0, err 38 | } 39 | return val.(int8), nil 40 | } 41 | 42 | // Int8Var defines an int8 flag with specified name, default value, and usage string. 43 | // The argument p points to an int8 variable in which to store the value of the flag. 44 | func (f *FlagSet) Int8Var(p *int8, name string, value int8, usage string) { 45 | f.VarP(newInt8Value(value, p), name, "", usage) 46 | } 47 | 48 | // Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash. 49 | func (f *FlagSet) Int8VarP(p *int8, name, shorthand string, value int8, usage string) { 50 | f.VarP(newInt8Value(value, p), name, shorthand, usage) 51 | } 52 | 53 | // Int8Var defines an int8 flag with specified name, default value, and usage string. 54 | // The argument p points to an int8 variable in which to store the value of the flag. 55 | func Int8Var(p *int8, name string, value int8, usage string) { 56 | CommandLine.VarP(newInt8Value(value, p), name, "", usage) 57 | } 58 | 59 | // Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash. 60 | func Int8VarP(p *int8, name, shorthand string, value int8, usage string) { 61 | CommandLine.VarP(newInt8Value(value, p), name, shorthand, usage) 62 | } 63 | 64 | // Int8 defines an int8 flag with specified name, default value, and usage string. 65 | // The return value is the address of an int8 variable that stores the value of the flag. 66 | func (f *FlagSet) Int8(name string, value int8, usage string) *int8 { 67 | p := new(int8) 68 | f.Int8VarP(p, name, "", value, usage) 69 | return p 70 | } 71 | 72 | // Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash. 73 | func (f *FlagSet) Int8P(name, shorthand string, value int8, usage string) *int8 { 74 | p := new(int8) 75 | f.Int8VarP(p, name, shorthand, value, usage) 76 | return p 77 | } 78 | 79 | // Int8 defines an int8 flag with specified name, default value, and usage string. 80 | // The return value is the address of an int8 variable that stores the value of the flag. 81 | func Int8(name string, value int8, usage string) *int8 { 82 | return CommandLine.Int8P(name, "", value, usage) 83 | } 84 | 85 | // Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash. 86 | func Int8P(name, shorthand string, value int8, usage string) *int8 { 87 | return CommandLine.Int8P(name, shorthand, value, usage) 88 | } 89 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/uint.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "strconv" 4 | 5 | // -- uint Value 6 | type uintValue uint 7 | 8 | func newUintValue(val uint, p *uint) *uintValue { 9 | *p = val 10 | return (*uintValue)(p) 11 | } 12 | 13 | func (i *uintValue) Set(s string) error { 14 | v, err := strconv.ParseUint(s, 0, 64) 15 | *i = uintValue(v) 16 | return err 17 | } 18 | 19 | func (i *uintValue) Type() string { 20 | return "uint" 21 | } 22 | 23 | func (i *uintValue) String() string { return strconv.FormatUint(uint64(*i), 10) } 24 | 25 | func uintConv(sval string) (interface{}, error) { 26 | v, err := strconv.ParseUint(sval, 0, 0) 27 | if err != nil { 28 | return 0, err 29 | } 30 | return uint(v), nil 31 | } 32 | 33 | // GetUint return the uint value of a flag with the given name 34 | func (f *FlagSet) GetUint(name string) (uint, error) { 35 | val, err := f.getFlagType(name, "uint", uintConv) 36 | if err != nil { 37 | return 0, err 38 | } 39 | return val.(uint), nil 40 | } 41 | 42 | // UintVar defines a uint flag with specified name, default value, and usage string. 43 | // The argument p points to a uint variable in which to store the value of the flag. 44 | func (f *FlagSet) UintVar(p *uint, name string, value uint, usage string) { 45 | f.VarP(newUintValue(value, p), name, "", usage) 46 | } 47 | 48 | // UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash. 49 | func (f *FlagSet) UintVarP(p *uint, name, shorthand string, value uint, usage string) { 50 | f.VarP(newUintValue(value, p), name, shorthand, usage) 51 | } 52 | 53 | // UintVar defines a uint flag with specified name, default value, and usage string. 54 | // The argument p points to a uint variable in which to store the value of the flag. 55 | func UintVar(p *uint, name string, value uint, usage string) { 56 | CommandLine.VarP(newUintValue(value, p), name, "", usage) 57 | } 58 | 59 | // UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash. 60 | func UintVarP(p *uint, name, shorthand string, value uint, usage string) { 61 | CommandLine.VarP(newUintValue(value, p), name, shorthand, usage) 62 | } 63 | 64 | // Uint defines a uint flag with specified name, default value, and usage string. 65 | // The return value is the address of a uint variable that stores the value of the flag. 66 | func (f *FlagSet) Uint(name string, value uint, usage string) *uint { 67 | p := new(uint) 68 | f.UintVarP(p, name, "", value, usage) 69 | return p 70 | } 71 | 72 | // UintP is like Uint, but accepts a shorthand letter that can be used after a single dash. 73 | func (f *FlagSet) UintP(name, shorthand string, value uint, usage string) *uint { 74 | p := new(uint) 75 | f.UintVarP(p, name, shorthand, value, usage) 76 | return p 77 | } 78 | 79 | // Uint defines a uint flag with specified name, default value, and usage string. 80 | // The return value is the address of a uint variable that stores the value of the flag. 81 | func Uint(name string, value uint, usage string) *uint { 82 | return CommandLine.UintP(name, "", value, usage) 83 | } 84 | 85 | // UintP is like Uint, but accepts a shorthand letter that can be used after a single dash. 86 | func UintP(name, shorthand string, value uint, usage string) *uint { 87 | return CommandLine.UintP(name, shorthand, value, usage) 88 | } 89 | -------------------------------------------------------------------------------- /vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at i@dario.im. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/uint8.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "strconv" 4 | 5 | // -- uint8 Value 6 | type uint8Value uint8 7 | 8 | func newUint8Value(val uint8, p *uint8) *uint8Value { 9 | *p = val 10 | return (*uint8Value)(p) 11 | } 12 | 13 | func (i *uint8Value) Set(s string) error { 14 | v, err := strconv.ParseUint(s, 0, 8) 15 | *i = uint8Value(v) 16 | return err 17 | } 18 | 19 | func (i *uint8Value) Type() string { 20 | return "uint8" 21 | } 22 | 23 | func (i *uint8Value) String() string { return strconv.FormatUint(uint64(*i), 10) } 24 | 25 | func uint8Conv(sval string) (interface{}, error) { 26 | v, err := strconv.ParseUint(sval, 0, 8) 27 | if err != nil { 28 | return 0, err 29 | } 30 | return uint8(v), nil 31 | } 32 | 33 | // GetUint8 return the uint8 value of a flag with the given name 34 | func (f *FlagSet) GetUint8(name string) (uint8, error) { 35 | val, err := f.getFlagType(name, "uint8", uint8Conv) 36 | if err != nil { 37 | return 0, err 38 | } 39 | return val.(uint8), nil 40 | } 41 | 42 | // Uint8Var defines a uint8 flag with specified name, default value, and usage string. 43 | // The argument p points to a uint8 variable in which to store the value of the flag. 44 | func (f *FlagSet) Uint8Var(p *uint8, name string, value uint8, usage string) { 45 | f.VarP(newUint8Value(value, p), name, "", usage) 46 | } 47 | 48 | // Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash. 49 | func (f *FlagSet) Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) { 50 | f.VarP(newUint8Value(value, p), name, shorthand, usage) 51 | } 52 | 53 | // Uint8Var defines a uint8 flag with specified name, default value, and usage string. 54 | // The argument p points to a uint8 variable in which to store the value of the flag. 55 | func Uint8Var(p *uint8, name string, value uint8, usage string) { 56 | CommandLine.VarP(newUint8Value(value, p), name, "", usage) 57 | } 58 | 59 | // Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash. 60 | func Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) { 61 | CommandLine.VarP(newUint8Value(value, p), name, shorthand, usage) 62 | } 63 | 64 | // Uint8 defines a uint8 flag with specified name, default value, and usage string. 65 | // The return value is the address of a uint8 variable that stores the value of the flag. 66 | func (f *FlagSet) Uint8(name string, value uint8, usage string) *uint8 { 67 | p := new(uint8) 68 | f.Uint8VarP(p, name, "", value, usage) 69 | return p 70 | } 71 | 72 | // Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash. 73 | func (f *FlagSet) Uint8P(name, shorthand string, value uint8, usage string) *uint8 { 74 | p := new(uint8) 75 | f.Uint8VarP(p, name, shorthand, value, usage) 76 | return p 77 | } 78 | 79 | // Uint8 defines a uint8 flag with specified name, default value, and usage string. 80 | // The return value is the address of a uint8 variable that stores the value of the flag. 81 | func Uint8(name string, value uint8, usage string) *uint8 { 82 | return CommandLine.Uint8P(name, "", value, usage) 83 | } 84 | 85 | // Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash. 86 | func Uint8P(name, shorthand string, value uint8, usage string) *uint8 { 87 | return CommandLine.Uint8P(name, shorthand, value, usage) 88 | } 89 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/int32.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "strconv" 4 | 5 | // -- int32 Value 6 | type int32Value int32 7 | 8 | func newInt32Value(val int32, p *int32) *int32Value { 9 | *p = val 10 | return (*int32Value)(p) 11 | } 12 | 13 | func (i *int32Value) Set(s string) error { 14 | v, err := strconv.ParseInt(s, 0, 32) 15 | *i = int32Value(v) 16 | return err 17 | } 18 | 19 | func (i *int32Value) Type() string { 20 | return "int32" 21 | } 22 | 23 | func (i *int32Value) String() string { return strconv.FormatInt(int64(*i), 10) } 24 | 25 | func int32Conv(sval string) (interface{}, error) { 26 | v, err := strconv.ParseInt(sval, 0, 32) 27 | if err != nil { 28 | return 0, err 29 | } 30 | return int32(v), nil 31 | } 32 | 33 | // GetInt32 return the int32 value of a flag with the given name 34 | func (f *FlagSet) GetInt32(name string) (int32, error) { 35 | val, err := f.getFlagType(name, "int32", int32Conv) 36 | if err != nil { 37 | return 0, err 38 | } 39 | return val.(int32), nil 40 | } 41 | 42 | // Int32Var defines an int32 flag with specified name, default value, and usage string. 43 | // The argument p points to an int32 variable in which to store the value of the flag. 44 | func (f *FlagSet) Int32Var(p *int32, name string, value int32, usage string) { 45 | f.VarP(newInt32Value(value, p), name, "", usage) 46 | } 47 | 48 | // Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash. 49 | func (f *FlagSet) Int32VarP(p *int32, name, shorthand string, value int32, usage string) { 50 | f.VarP(newInt32Value(value, p), name, shorthand, usage) 51 | } 52 | 53 | // Int32Var defines an int32 flag with specified name, default value, and usage string. 54 | // The argument p points to an int32 variable in which to store the value of the flag. 55 | func Int32Var(p *int32, name string, value int32, usage string) { 56 | CommandLine.VarP(newInt32Value(value, p), name, "", usage) 57 | } 58 | 59 | // Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash. 60 | func Int32VarP(p *int32, name, shorthand string, value int32, usage string) { 61 | CommandLine.VarP(newInt32Value(value, p), name, shorthand, usage) 62 | } 63 | 64 | // Int32 defines an int32 flag with specified name, default value, and usage string. 65 | // The return value is the address of an int32 variable that stores the value of the flag. 66 | func (f *FlagSet) Int32(name string, value int32, usage string) *int32 { 67 | p := new(int32) 68 | f.Int32VarP(p, name, "", value, usage) 69 | return p 70 | } 71 | 72 | // Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash. 73 | func (f *FlagSet) Int32P(name, shorthand string, value int32, usage string) *int32 { 74 | p := new(int32) 75 | f.Int32VarP(p, name, shorthand, value, usage) 76 | return p 77 | } 78 | 79 | // Int32 defines an int32 flag with specified name, default value, and usage string. 80 | // The return value is the address of an int32 variable that stores the value of the flag. 81 | func Int32(name string, value int32, usage string) *int32 { 82 | return CommandLine.Int32P(name, "", value, usage) 83 | } 84 | 85 | // Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash. 86 | func Int32P(name, shorthand string, value int32, usage string) *int32 { 87 | return CommandLine.Int32P(name, shorthand, value, usage) 88 | } 89 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/README.md: -------------------------------------------------------------------------------- 1 | # YAML support for the Go language 2 | 3 | Introduction 4 | ------------ 5 | 6 | The yaml package enables Go programs to comfortably encode and decode YAML 7 | values. It was developed within [Canonical](https://www.canonical.com) as 8 | part of the [juju](https://juju.ubuntu.com) project, and is based on a 9 | pure Go port of the well-known [libyaml](http://pyyaml.org/wiki/LibYAML) 10 | C library to parse and generate YAML data quickly and reliably. 11 | 12 | Compatibility 13 | ------------- 14 | 15 | The yaml package supports most of YAML 1.1 and 1.2, including support for 16 | anchors, tags, map merging, etc. Multi-document unmarshalling is not yet 17 | implemented, and base-60 floats from YAML 1.1 are purposefully not 18 | supported since they're a poor design and are gone in YAML 1.2. 19 | 20 | Installation and usage 21 | ---------------------- 22 | 23 | The import path for the package is *gopkg.in/yaml.v2*. 24 | 25 | To install it, run: 26 | 27 | go get gopkg.in/yaml.v2 28 | 29 | API documentation 30 | ----------------- 31 | 32 | If opened in a browser, the import path itself leads to the API documentation: 33 | 34 | * [https://gopkg.in/yaml.v2](https://gopkg.in/yaml.v2) 35 | 36 | API stability 37 | ------------- 38 | 39 | The package API for yaml v2 will remain stable as described in [gopkg.in](https://gopkg.in). 40 | 41 | 42 | License 43 | ------- 44 | 45 | The yaml package is licensed under the Apache License 2.0. Please see the LICENSE file for details. 46 | 47 | 48 | Example 49 | ------- 50 | 51 | ```Go 52 | package main 53 | 54 | import ( 55 | "fmt" 56 | "log" 57 | 58 | "gopkg.in/yaml.v2" 59 | ) 60 | 61 | var data = ` 62 | a: Easy! 63 | b: 64 | c: 2 65 | d: [3, 4] 66 | ` 67 | 68 | // Note: struct fields must be public in order for unmarshal to 69 | // correctly populate the data. 70 | type T struct { 71 | A string 72 | B struct { 73 | RenamedC int `yaml:"c"` 74 | D []int `yaml:",flow"` 75 | } 76 | } 77 | 78 | func main() { 79 | t := T{} 80 | 81 | err := yaml.Unmarshal([]byte(data), &t) 82 | if err != nil { 83 | log.Fatalf("error: %v", err) 84 | } 85 | fmt.Printf("--- t:\n%v\n\n", t) 86 | 87 | d, err := yaml.Marshal(&t) 88 | if err != nil { 89 | log.Fatalf("error: %v", err) 90 | } 91 | fmt.Printf("--- t dump:\n%s\n\n", string(d)) 92 | 93 | m := make(map[interface{}]interface{}) 94 | 95 | err = yaml.Unmarshal([]byte(data), &m) 96 | if err != nil { 97 | log.Fatalf("error: %v", err) 98 | } 99 | fmt.Printf("--- m:\n%v\n\n", m) 100 | 101 | d, err = yaml.Marshal(&m) 102 | if err != nil { 103 | log.Fatalf("error: %v", err) 104 | } 105 | fmt.Printf("--- m dump:\n%s\n\n", string(d)) 106 | } 107 | ``` 108 | 109 | This example will generate the following output: 110 | 111 | ``` 112 | --- t: 113 | {Easy! {2 [3 4]}} 114 | 115 | --- t dump: 116 | a: Easy! 117 | b: 118 | c: 2 119 | d: [3, 4] 120 | 121 | 122 | --- m: 123 | map[a:Easy! b:map[c:2 d:[3 4]]] 124 | 125 | --- m dump: 126 | a: Easy! 127 | b: 128 | c: 2 129 | d: 130 | - 3 131 | - 4 132 | ``` 133 | 134 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/ip.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | "strings" 7 | ) 8 | 9 | // -- net.IP value 10 | type ipValue net.IP 11 | 12 | func newIPValue(val net.IP, p *net.IP) *ipValue { 13 | *p = val 14 | return (*ipValue)(p) 15 | } 16 | 17 | func (i *ipValue) String() string { return net.IP(*i).String() } 18 | func (i *ipValue) Set(s string) error { 19 | ip := net.ParseIP(strings.TrimSpace(s)) 20 | if ip == nil { 21 | return fmt.Errorf("failed to parse IP: %q", s) 22 | } 23 | *i = ipValue(ip) 24 | return nil 25 | } 26 | 27 | func (i *ipValue) Type() string { 28 | return "ip" 29 | } 30 | 31 | func ipConv(sval string) (interface{}, error) { 32 | ip := net.ParseIP(sval) 33 | if ip != nil { 34 | return ip, nil 35 | } 36 | return nil, fmt.Errorf("invalid string being converted to IP address: %s", sval) 37 | } 38 | 39 | // GetIP return the net.IP value of a flag with the given name 40 | func (f *FlagSet) GetIP(name string) (net.IP, error) { 41 | val, err := f.getFlagType(name, "ip", ipConv) 42 | if err != nil { 43 | return nil, err 44 | } 45 | return val.(net.IP), nil 46 | } 47 | 48 | // IPVar defines an net.IP flag with specified name, default value, and usage string. 49 | // The argument p points to an net.IP variable in which to store the value of the flag. 50 | func (f *FlagSet) IPVar(p *net.IP, name string, value net.IP, usage string) { 51 | f.VarP(newIPValue(value, p), name, "", usage) 52 | } 53 | 54 | // IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash. 55 | func (f *FlagSet) IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) { 56 | f.VarP(newIPValue(value, p), name, shorthand, usage) 57 | } 58 | 59 | // IPVar defines an net.IP flag with specified name, default value, and usage string. 60 | // The argument p points to an net.IP variable in which to store the value of the flag. 61 | func IPVar(p *net.IP, name string, value net.IP, usage string) { 62 | CommandLine.VarP(newIPValue(value, p), name, "", usage) 63 | } 64 | 65 | // IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash. 66 | func IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) { 67 | CommandLine.VarP(newIPValue(value, p), name, shorthand, usage) 68 | } 69 | 70 | // IP defines an net.IP flag with specified name, default value, and usage string. 71 | // The return value is the address of an net.IP variable that stores the value of the flag. 72 | func (f *FlagSet) IP(name string, value net.IP, usage string) *net.IP { 73 | p := new(net.IP) 74 | f.IPVarP(p, name, "", value, usage) 75 | return p 76 | } 77 | 78 | // IPP is like IP, but accepts a shorthand letter that can be used after a single dash. 79 | func (f *FlagSet) IPP(name, shorthand string, value net.IP, usage string) *net.IP { 80 | p := new(net.IP) 81 | f.IPVarP(p, name, shorthand, value, usage) 82 | return p 83 | } 84 | 85 | // IP defines an net.IP flag with specified name, default value, and usage string. 86 | // The return value is the address of an net.IP variable that stores the value of the flag. 87 | func IP(name string, value net.IP, usage string) *net.IP { 88 | return CommandLine.IPP(name, "", value, usage) 89 | } 90 | 91 | // IPP is like IP, but accepts a shorthand letter that can be used after a single dash. 92 | func IPP(name, shorthand string, value net.IP, usage string) *net.IP { 93 | return CommandLine.IPP(name, shorthand, value, usage) 94 | } 95 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/uint16.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "strconv" 4 | 5 | // -- uint16 value 6 | type uint16Value uint16 7 | 8 | func newUint16Value(val uint16, p *uint16) *uint16Value { 9 | *p = val 10 | return (*uint16Value)(p) 11 | } 12 | 13 | func (i *uint16Value) Set(s string) error { 14 | v, err := strconv.ParseUint(s, 0, 16) 15 | *i = uint16Value(v) 16 | return err 17 | } 18 | 19 | func (i *uint16Value) Type() string { 20 | return "uint16" 21 | } 22 | 23 | func (i *uint16Value) String() string { return strconv.FormatUint(uint64(*i), 10) } 24 | 25 | func uint16Conv(sval string) (interface{}, error) { 26 | v, err := strconv.ParseUint(sval, 0, 16) 27 | if err != nil { 28 | return 0, err 29 | } 30 | return uint16(v), nil 31 | } 32 | 33 | // GetUint16 return the uint16 value of a flag with the given name 34 | func (f *FlagSet) GetUint16(name string) (uint16, error) { 35 | val, err := f.getFlagType(name, "uint16", uint16Conv) 36 | if err != nil { 37 | return 0, err 38 | } 39 | return val.(uint16), nil 40 | } 41 | 42 | // Uint16Var defines a uint flag with specified name, default value, and usage string. 43 | // The argument p points to a uint variable in which to store the value of the flag. 44 | func (f *FlagSet) Uint16Var(p *uint16, name string, value uint16, usage string) { 45 | f.VarP(newUint16Value(value, p), name, "", usage) 46 | } 47 | 48 | // Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash. 49 | func (f *FlagSet) Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) { 50 | f.VarP(newUint16Value(value, p), name, shorthand, usage) 51 | } 52 | 53 | // Uint16Var defines a uint flag with specified name, default value, and usage string. 54 | // The argument p points to a uint variable in which to store the value of the flag. 55 | func Uint16Var(p *uint16, name string, value uint16, usage string) { 56 | CommandLine.VarP(newUint16Value(value, p), name, "", usage) 57 | } 58 | 59 | // Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash. 60 | func Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) { 61 | CommandLine.VarP(newUint16Value(value, p), name, shorthand, usage) 62 | } 63 | 64 | // Uint16 defines a uint flag with specified name, default value, and usage string. 65 | // The return value is the address of a uint variable that stores the value of the flag. 66 | func (f *FlagSet) Uint16(name string, value uint16, usage string) *uint16 { 67 | p := new(uint16) 68 | f.Uint16VarP(p, name, "", value, usage) 69 | return p 70 | } 71 | 72 | // Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash. 73 | func (f *FlagSet) Uint16P(name, shorthand string, value uint16, usage string) *uint16 { 74 | p := new(uint16) 75 | f.Uint16VarP(p, name, shorthand, value, usage) 76 | return p 77 | } 78 | 79 | // Uint16 defines a uint flag with specified name, default value, and usage string. 80 | // The return value is the address of a uint variable that stores the value of the flag. 81 | func Uint16(name string, value uint16, usage string) *uint16 { 82 | return CommandLine.Uint16P(name, "", value, usage) 83 | } 84 | 85 | // Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash. 86 | func Uint16P(name, shorthand string, value uint16, usage string) *uint16 { 87 | return CommandLine.Uint16P(name, shorthand, value, usage) 88 | } 89 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/float64.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "strconv" 4 | 5 | // -- float64 Value 6 | type float64Value float64 7 | 8 | func newFloat64Value(val float64, p *float64) *float64Value { 9 | *p = val 10 | return (*float64Value)(p) 11 | } 12 | 13 | func (f *float64Value) Set(s string) error { 14 | v, err := strconv.ParseFloat(s, 64) 15 | *f = float64Value(v) 16 | return err 17 | } 18 | 19 | func (f *float64Value) Type() string { 20 | return "float64" 21 | } 22 | 23 | func (f *float64Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 64) } 24 | 25 | func float64Conv(sval string) (interface{}, error) { 26 | return strconv.ParseFloat(sval, 64) 27 | } 28 | 29 | // GetFloat64 return the float64 value of a flag with the given name 30 | func (f *FlagSet) GetFloat64(name string) (float64, error) { 31 | val, err := f.getFlagType(name, "float64", float64Conv) 32 | if err != nil { 33 | return 0, err 34 | } 35 | return val.(float64), nil 36 | } 37 | 38 | // Float64Var defines a float64 flag with specified name, default value, and usage string. 39 | // The argument p points to a float64 variable in which to store the value of the flag. 40 | func (f *FlagSet) Float64Var(p *float64, name string, value float64, usage string) { 41 | f.VarP(newFloat64Value(value, p), name, "", usage) 42 | } 43 | 44 | // Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash. 45 | func (f *FlagSet) Float64VarP(p *float64, name, shorthand string, value float64, usage string) { 46 | f.VarP(newFloat64Value(value, p), name, shorthand, usage) 47 | } 48 | 49 | // Float64Var defines a float64 flag with specified name, default value, and usage string. 50 | // The argument p points to a float64 variable in which to store the value of the flag. 51 | func Float64Var(p *float64, name string, value float64, usage string) { 52 | CommandLine.VarP(newFloat64Value(value, p), name, "", usage) 53 | } 54 | 55 | // Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash. 56 | func Float64VarP(p *float64, name, shorthand string, value float64, usage string) { 57 | CommandLine.VarP(newFloat64Value(value, p), name, shorthand, usage) 58 | } 59 | 60 | // Float64 defines a float64 flag with specified name, default value, and usage string. 61 | // The return value is the address of a float64 variable that stores the value of the flag. 62 | func (f *FlagSet) Float64(name string, value float64, usage string) *float64 { 63 | p := new(float64) 64 | f.Float64VarP(p, name, "", value, usage) 65 | return p 66 | } 67 | 68 | // Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash. 69 | func (f *FlagSet) Float64P(name, shorthand string, value float64, usage string) *float64 { 70 | p := new(float64) 71 | f.Float64VarP(p, name, shorthand, value, usage) 72 | return p 73 | } 74 | 75 | // Float64 defines a float64 flag with specified name, default value, and usage string. 76 | // The return value is the address of a float64 variable that stores the value of the flag. 77 | func Float64(name string, value float64, usage string) *float64 { 78 | return CommandLine.Float64P(name, "", value, usage) 79 | } 80 | 81 | // Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash. 82 | func Float64P(name, shorthand string, value float64, usage string) *float64 { 83 | return CommandLine.Float64P(name, shorthand, value, usage) 84 | } 85 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/uint32.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "strconv" 4 | 5 | // -- uint32 value 6 | type uint32Value uint32 7 | 8 | func newUint32Value(val uint32, p *uint32) *uint32Value { 9 | *p = val 10 | return (*uint32Value)(p) 11 | } 12 | 13 | func (i *uint32Value) Set(s string) error { 14 | v, err := strconv.ParseUint(s, 0, 32) 15 | *i = uint32Value(v) 16 | return err 17 | } 18 | 19 | func (i *uint32Value) Type() string { 20 | return "uint32" 21 | } 22 | 23 | func (i *uint32Value) String() string { return strconv.FormatUint(uint64(*i), 10) } 24 | 25 | func uint32Conv(sval string) (interface{}, error) { 26 | v, err := strconv.ParseUint(sval, 0, 32) 27 | if err != nil { 28 | return 0, err 29 | } 30 | return uint32(v), nil 31 | } 32 | 33 | // GetUint32 return the uint32 value of a flag with the given name 34 | func (f *FlagSet) GetUint32(name string) (uint32, error) { 35 | val, err := f.getFlagType(name, "uint32", uint32Conv) 36 | if err != nil { 37 | return 0, err 38 | } 39 | return val.(uint32), nil 40 | } 41 | 42 | // Uint32Var defines a uint32 flag with specified name, default value, and usage string. 43 | // The argument p points to a uint32 variable in which to store the value of the flag. 44 | func (f *FlagSet) Uint32Var(p *uint32, name string, value uint32, usage string) { 45 | f.VarP(newUint32Value(value, p), name, "", usage) 46 | } 47 | 48 | // Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash. 49 | func (f *FlagSet) Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) { 50 | f.VarP(newUint32Value(value, p), name, shorthand, usage) 51 | } 52 | 53 | // Uint32Var defines a uint32 flag with specified name, default value, and usage string. 54 | // The argument p points to a uint32 variable in which to store the value of the flag. 55 | func Uint32Var(p *uint32, name string, value uint32, usage string) { 56 | CommandLine.VarP(newUint32Value(value, p), name, "", usage) 57 | } 58 | 59 | // Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash. 60 | func Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) { 61 | CommandLine.VarP(newUint32Value(value, p), name, shorthand, usage) 62 | } 63 | 64 | // Uint32 defines a uint32 flag with specified name, default value, and usage string. 65 | // The return value is the address of a uint32 variable that stores the value of the flag. 66 | func (f *FlagSet) Uint32(name string, value uint32, usage string) *uint32 { 67 | p := new(uint32) 68 | f.Uint32VarP(p, name, "", value, usage) 69 | return p 70 | } 71 | 72 | // Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash. 73 | func (f *FlagSet) Uint32P(name, shorthand string, value uint32, usage string) *uint32 { 74 | p := new(uint32) 75 | f.Uint32VarP(p, name, shorthand, value, usage) 76 | return p 77 | } 78 | 79 | // Uint32 defines a uint32 flag with specified name, default value, and usage string. 80 | // The return value is the address of a uint32 variable that stores the value of the flag. 81 | func Uint32(name string, value uint32, usage string) *uint32 { 82 | return CommandLine.Uint32P(name, "", value, usage) 83 | } 84 | 85 | // Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash. 86 | func Uint32P(name, shorthand string, value uint32, usage string) *uint32 { 87 | return CommandLine.Uint32P(name, shorthand, value, usage) 88 | } 89 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/uint64.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "strconv" 4 | 5 | // -- uint64 Value 6 | type uint64Value uint64 7 | 8 | func newUint64Value(val uint64, p *uint64) *uint64Value { 9 | *p = val 10 | return (*uint64Value)(p) 11 | } 12 | 13 | func (i *uint64Value) Set(s string) error { 14 | v, err := strconv.ParseUint(s, 0, 64) 15 | *i = uint64Value(v) 16 | return err 17 | } 18 | 19 | func (i *uint64Value) Type() string { 20 | return "uint64" 21 | } 22 | 23 | func (i *uint64Value) String() string { return strconv.FormatUint(uint64(*i), 10) } 24 | 25 | func uint64Conv(sval string) (interface{}, error) { 26 | v, err := strconv.ParseUint(sval, 0, 64) 27 | if err != nil { 28 | return 0, err 29 | } 30 | return uint64(v), nil 31 | } 32 | 33 | // GetUint64 return the uint64 value of a flag with the given name 34 | func (f *FlagSet) GetUint64(name string) (uint64, error) { 35 | val, err := f.getFlagType(name, "uint64", uint64Conv) 36 | if err != nil { 37 | return 0, err 38 | } 39 | return val.(uint64), nil 40 | } 41 | 42 | // Uint64Var defines a uint64 flag with specified name, default value, and usage string. 43 | // The argument p points to a uint64 variable in which to store the value of the flag. 44 | func (f *FlagSet) Uint64Var(p *uint64, name string, value uint64, usage string) { 45 | f.VarP(newUint64Value(value, p), name, "", usage) 46 | } 47 | 48 | // Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash. 49 | func (f *FlagSet) Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) { 50 | f.VarP(newUint64Value(value, p), name, shorthand, usage) 51 | } 52 | 53 | // Uint64Var defines a uint64 flag with specified name, default value, and usage string. 54 | // The argument p points to a uint64 variable in which to store the value of the flag. 55 | func Uint64Var(p *uint64, name string, value uint64, usage string) { 56 | CommandLine.VarP(newUint64Value(value, p), name, "", usage) 57 | } 58 | 59 | // Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash. 60 | func Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) { 61 | CommandLine.VarP(newUint64Value(value, p), name, shorthand, usage) 62 | } 63 | 64 | // Uint64 defines a uint64 flag with specified name, default value, and usage string. 65 | // The return value is the address of a uint64 variable that stores the value of the flag. 66 | func (f *FlagSet) Uint64(name string, value uint64, usage string) *uint64 { 67 | p := new(uint64) 68 | f.Uint64VarP(p, name, "", value, usage) 69 | return p 70 | } 71 | 72 | // Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash. 73 | func (f *FlagSet) Uint64P(name, shorthand string, value uint64, usage string) *uint64 { 74 | p := new(uint64) 75 | f.Uint64VarP(p, name, shorthand, value, usage) 76 | return p 77 | } 78 | 79 | // Uint64 defines a uint64 flag with specified name, default value, and usage string. 80 | // The return value is the address of a uint64 variable that stores the value of the flag. 81 | func Uint64(name string, value uint64, usage string) *uint64 { 82 | return CommandLine.Uint64P(name, "", value, usage) 83 | } 84 | 85 | // Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash. 86 | func Uint64P(name, shorthand string, value uint64, usage string) *uint64 { 87 | return CommandLine.Uint64P(name, shorthand, value, usage) 88 | } 89 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/bool.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "strconv" 4 | 5 | // optional interface to indicate boolean flags that can be 6 | // supplied without "=value" text 7 | type boolFlag interface { 8 | Value 9 | IsBoolFlag() bool 10 | } 11 | 12 | // -- bool Value 13 | type boolValue bool 14 | 15 | func newBoolValue(val bool, p *bool) *boolValue { 16 | *p = val 17 | return (*boolValue)(p) 18 | } 19 | 20 | func (b *boolValue) Set(s string) error { 21 | v, err := strconv.ParseBool(s) 22 | *b = boolValue(v) 23 | return err 24 | } 25 | 26 | func (b *boolValue) Type() string { 27 | return "bool" 28 | } 29 | 30 | func (b *boolValue) String() string { return strconv.FormatBool(bool(*b)) } 31 | 32 | func (b *boolValue) IsBoolFlag() bool { return true } 33 | 34 | func boolConv(sval string) (interface{}, error) { 35 | return strconv.ParseBool(sval) 36 | } 37 | 38 | // GetBool return the bool value of a flag with the given name 39 | func (f *FlagSet) GetBool(name string) (bool, error) { 40 | val, err := f.getFlagType(name, "bool", boolConv) 41 | if err != nil { 42 | return false, err 43 | } 44 | return val.(bool), nil 45 | } 46 | 47 | // BoolVar defines a bool flag with specified name, default value, and usage string. 48 | // The argument p points to a bool variable in which to store the value of the flag. 49 | func (f *FlagSet) BoolVar(p *bool, name string, value bool, usage string) { 50 | f.BoolVarP(p, name, "", value, usage) 51 | } 52 | 53 | // BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash. 54 | func (f *FlagSet) BoolVarP(p *bool, name, shorthand string, value bool, usage string) { 55 | flag := f.VarPF(newBoolValue(value, p), name, shorthand, usage) 56 | flag.NoOptDefVal = "true" 57 | } 58 | 59 | // BoolVar defines a bool flag with specified name, default value, and usage string. 60 | // The argument p points to a bool variable in which to store the value of the flag. 61 | func BoolVar(p *bool, name string, value bool, usage string) { 62 | BoolVarP(p, name, "", value, usage) 63 | } 64 | 65 | // BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash. 66 | func BoolVarP(p *bool, name, shorthand string, value bool, usage string) { 67 | flag := CommandLine.VarPF(newBoolValue(value, p), name, shorthand, usage) 68 | flag.NoOptDefVal = "true" 69 | } 70 | 71 | // Bool defines a bool flag with specified name, default value, and usage string. 72 | // The return value is the address of a bool variable that stores the value of the flag. 73 | func (f *FlagSet) Bool(name string, value bool, usage string) *bool { 74 | return f.BoolP(name, "", value, usage) 75 | } 76 | 77 | // BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash. 78 | func (f *FlagSet) BoolP(name, shorthand string, value bool, usage string) *bool { 79 | p := new(bool) 80 | f.BoolVarP(p, name, shorthand, value, usage) 81 | return p 82 | } 83 | 84 | // Bool defines a bool flag with specified name, default value, and usage string. 85 | // The return value is the address of a bool variable that stores the value of the flag. 86 | func Bool(name string, value bool, usage string) *bool { 87 | return BoolP(name, "", value, usage) 88 | } 89 | 90 | // BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash. 91 | func BoolP(name, shorthand string, value bool, usage string) *bool { 92 | b := CommandLine.BoolP(name, shorthand, value, usage) 93 | return b 94 | } 95 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/float32.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "strconv" 4 | 5 | // -- float32 Value 6 | type float32Value float32 7 | 8 | func newFloat32Value(val float32, p *float32) *float32Value { 9 | *p = val 10 | return (*float32Value)(p) 11 | } 12 | 13 | func (f *float32Value) Set(s string) error { 14 | v, err := strconv.ParseFloat(s, 32) 15 | *f = float32Value(v) 16 | return err 17 | } 18 | 19 | func (f *float32Value) Type() string { 20 | return "float32" 21 | } 22 | 23 | func (f *float32Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 32) } 24 | 25 | func float32Conv(sval string) (interface{}, error) { 26 | v, err := strconv.ParseFloat(sval, 32) 27 | if err != nil { 28 | return 0, err 29 | } 30 | return float32(v), nil 31 | } 32 | 33 | // GetFloat32 return the float32 value of a flag with the given name 34 | func (f *FlagSet) GetFloat32(name string) (float32, error) { 35 | val, err := f.getFlagType(name, "float32", float32Conv) 36 | if err != nil { 37 | return 0, err 38 | } 39 | return val.(float32), nil 40 | } 41 | 42 | // Float32Var defines a float32 flag with specified name, default value, and usage string. 43 | // The argument p points to a float32 variable in which to store the value of the flag. 44 | func (f *FlagSet) Float32Var(p *float32, name string, value float32, usage string) { 45 | f.VarP(newFloat32Value(value, p), name, "", usage) 46 | } 47 | 48 | // Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash. 49 | func (f *FlagSet) Float32VarP(p *float32, name, shorthand string, value float32, usage string) { 50 | f.VarP(newFloat32Value(value, p), name, shorthand, usage) 51 | } 52 | 53 | // Float32Var defines a float32 flag with specified name, default value, and usage string. 54 | // The argument p points to a float32 variable in which to store the value of the flag. 55 | func Float32Var(p *float32, name string, value float32, usage string) { 56 | CommandLine.VarP(newFloat32Value(value, p), name, "", usage) 57 | } 58 | 59 | // Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash. 60 | func Float32VarP(p *float32, name, shorthand string, value float32, usage string) { 61 | CommandLine.VarP(newFloat32Value(value, p), name, shorthand, usage) 62 | } 63 | 64 | // Float32 defines a float32 flag with specified name, default value, and usage string. 65 | // The return value is the address of a float32 variable that stores the value of the flag. 66 | func (f *FlagSet) Float32(name string, value float32, usage string) *float32 { 67 | p := new(float32) 68 | f.Float32VarP(p, name, "", value, usage) 69 | return p 70 | } 71 | 72 | // Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash. 73 | func (f *FlagSet) Float32P(name, shorthand string, value float32, usage string) *float32 { 74 | p := new(float32) 75 | f.Float32VarP(p, name, shorthand, value, usage) 76 | return p 77 | } 78 | 79 | // Float32 defines a float32 flag with specified name, default value, and usage string. 80 | // The return value is the address of a float32 variable that stores the value of the flag. 81 | func Float32(name string, value float32, usage string) *float32 { 82 | return CommandLine.Float32P(name, "", value, usage) 83 | } 84 | 85 | // Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash. 86 | func Float32P(name, shorthand string, value float32, usage string) *float32 { 87 | return CommandLine.Float32P(name, shorthand, value, usage) 88 | } 89 | --------------------------------------------------------------------------------