├── .gitignore ├── LICENSE ├── README.md ├── follower ├── follower.go └── follower_test.go ├── go.mod ├── go.sum ├── main.go └── vendor ├── github.com ├── davecgh │ └── go-spew │ │ ├── LICENSE │ │ └── spew │ │ ├── bypass.go │ │ ├── bypasssafe.go │ │ ├── common.go │ │ ├── config.go │ │ ├── doc.go │ │ ├── dump.go │ │ ├── format.go │ │ └── spew.go ├── fsnotify │ └── fsnotify │ │ ├── .editorconfig │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── AUTHORS │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── fen.go │ │ ├── fsnotify.go │ │ ├── inotify.go │ │ ├── inotify_poller.go │ │ ├── kqueue.go │ │ ├── open_mode_bsd.go │ │ ├── open_mode_darwin.go │ │ └── windows.go ├── pmezard │ └── go-difflib │ │ ├── LICENSE │ │ └── difflib │ │ └── difflib.go ├── spf13 │ └── pflag │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bool.go │ │ ├── count.go │ │ ├── duration.go │ │ ├── flag.go │ │ ├── float32.go │ │ ├── float64.go │ │ ├── golangflag.go │ │ ├── int.go │ │ ├── int32.go │ │ ├── int64.go │ │ ├── int8.go │ │ ├── int_slice.go │ │ ├── ip.go │ │ ├── ipmask.go │ │ ├── ipnet.go │ │ ├── string.go │ │ ├── string_array.go │ │ ├── string_slice.go │ │ ├── uint.go │ │ ├── uint16.go │ │ ├── uint32.go │ │ ├── uint64.go │ │ └── uint8.go └── stretchr │ └── testify │ ├── LICENSE │ └── assert │ ├── assertion_compare.go │ ├── assertion_compare_can_convert.go │ ├── assertion_compare_legacy.go │ ├── assertion_format.go │ ├── assertion_format.go.tmpl │ ├── assertion_forward.go │ ├── assertion_forward.go.tmpl │ ├── assertion_order.go │ ├── assertions.go │ ├── doc.go │ ├── errors.go │ ├── forward_assertions.go │ └── http_assertions.go ├── golang.org └── x │ └── sys │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ └── unix │ ├── .gitignore │ ├── asm.s │ ├── asm_darwin_386.s │ ├── asm_darwin_amd64.s │ ├── asm_darwin_arm.s │ ├── asm_darwin_arm64.s │ ├── asm_dragonfly_amd64.s │ ├── asm_freebsd_386.s │ ├── asm_freebsd_amd64.s │ ├── asm_freebsd_arm.s │ ├── asm_linux_386.s │ ├── asm_linux_amd64.s │ ├── asm_linux_arm.s │ ├── asm_linux_arm64.s │ ├── asm_linux_mips64x.s │ ├── asm_linux_ppc64x.s │ ├── asm_linux_s390x.s │ ├── asm_netbsd_386.s │ ├── asm_netbsd_amd64.s │ ├── asm_netbsd_arm.s │ ├── asm_openbsd_386.s │ ├── asm_openbsd_amd64.s │ ├── asm_solaris_amd64.s │ ├── bluetooth_linux.go │ ├── constants.go │ ├── env_unix.go │ ├── env_unset.go │ ├── flock.go │ ├── flock_linux_32bit.go │ ├── gccgo.go │ ├── gccgo_c.c │ ├── gccgo_linux_amd64.go │ ├── gccgo_linux_sparc64.go │ ├── mkall.sh │ ├── mkerrors.sh │ ├── mksyscall.pl │ ├── mksyscall_solaris.pl │ ├── mksysctl_openbsd.pl │ ├── mksysnum_darwin.pl │ ├── mksysnum_dragonfly.pl │ ├── mksysnum_freebsd.pl │ ├── mksysnum_linux.pl │ ├── mksysnum_netbsd.pl │ ├── mksysnum_openbsd.pl │ ├── race.go │ ├── race0.go │ ├── sockcmsg_linux.go │ ├── sockcmsg_unix.go │ ├── str.go │ ├── syscall.go │ ├── syscall_bsd.go │ ├── syscall_darwin.go │ ├── syscall_darwin_386.go │ ├── syscall_darwin_amd64.go │ ├── syscall_darwin_arm.go │ ├── syscall_darwin_arm64.go │ ├── syscall_dragonfly.go │ ├── syscall_dragonfly_amd64.go │ ├── syscall_freebsd.go │ ├── syscall_freebsd_386.go │ ├── syscall_freebsd_amd64.go │ ├── syscall_freebsd_arm.go │ ├── syscall_linux.go │ ├── syscall_linux_386.go │ ├── syscall_linux_amd64.go │ ├── syscall_linux_arm.go │ ├── syscall_linux_arm64.go │ ├── syscall_linux_mips64x.go │ ├── syscall_linux_ppc64x.go │ ├── syscall_linux_s390x.go │ ├── syscall_linux_sparc64.go │ ├── syscall_netbsd.go │ ├── syscall_netbsd_386.go │ ├── syscall_netbsd_amd64.go │ ├── syscall_netbsd_arm.go │ ├── syscall_no_getwd.go │ ├── syscall_openbsd.go │ ├── syscall_openbsd_386.go │ ├── syscall_openbsd_amd64.go │ ├── syscall_solaris.go │ ├── syscall_solaris_amd64.go │ ├── syscall_unix.go │ ├── zerrors_darwin_386.go │ ├── zerrors_darwin_amd64.go │ ├── zerrors_darwin_arm.go │ ├── zerrors_darwin_arm64.go │ ├── zerrors_dragonfly_amd64.go │ ├── zerrors_freebsd_386.go │ ├── zerrors_freebsd_amd64.go │ ├── zerrors_freebsd_arm.go │ ├── zerrors_linux_386.go │ ├── zerrors_linux_amd64.go │ ├── zerrors_linux_arm.go │ ├── zerrors_linux_arm64.go │ ├── zerrors_linux_mips64.go │ ├── zerrors_linux_mips64le.go │ ├── zerrors_linux_ppc64.go │ ├── zerrors_linux_ppc64le.go │ ├── zerrors_linux_s390x.go │ ├── zerrors_linux_sparc64.go │ ├── zerrors_netbsd_386.go │ ├── zerrors_netbsd_amd64.go │ ├── zerrors_netbsd_arm.go │ ├── zerrors_openbsd_386.go │ ├── zerrors_openbsd_amd64.go │ ├── zerrors_solaris_amd64.go │ ├── zsyscall_darwin_386.go │ ├── zsyscall_darwin_amd64.go │ ├── zsyscall_darwin_arm.go │ ├── zsyscall_darwin_arm64.go │ ├── zsyscall_dragonfly_amd64.go │ ├── zsyscall_freebsd_386.go │ ├── zsyscall_freebsd_amd64.go │ ├── zsyscall_freebsd_arm.go │ ├── zsyscall_linux_386.go │ ├── zsyscall_linux_amd64.go │ ├── zsyscall_linux_arm.go │ ├── zsyscall_linux_arm64.go │ ├── zsyscall_linux_mips64.go │ ├── zsyscall_linux_mips64le.go │ ├── zsyscall_linux_ppc64.go │ ├── zsyscall_linux_ppc64le.go │ ├── zsyscall_linux_s390x.go │ ├── zsyscall_linux_sparc64.go │ ├── zsyscall_netbsd_386.go │ ├── zsyscall_netbsd_amd64.go │ ├── zsyscall_netbsd_arm.go │ ├── zsyscall_openbsd_386.go │ ├── zsyscall_openbsd_amd64.go │ ├── zsyscall_solaris_amd64.go │ ├── zsysctl_openbsd.go │ ├── zsysnum_darwin_386.go │ ├── zsysnum_darwin_amd64.go │ ├── zsysnum_darwin_arm.go │ ├── zsysnum_darwin_arm64.go │ ├── zsysnum_dragonfly_amd64.go │ ├── zsysnum_freebsd_386.go │ ├── zsysnum_freebsd_amd64.go │ ├── zsysnum_freebsd_arm.go │ ├── zsysnum_linux_386.go │ ├── zsysnum_linux_amd64.go │ ├── zsysnum_linux_arm.go │ ├── zsysnum_linux_arm64.go │ ├── zsysnum_linux_mips64.go │ ├── zsysnum_linux_mips64le.go │ ├── zsysnum_linux_ppc64.go │ ├── zsysnum_linux_ppc64le.go │ ├── zsysnum_linux_s390x.go │ ├── zsysnum_linux_sparc64.go │ ├── zsysnum_netbsd_386.go │ ├── zsysnum_netbsd_amd64.go │ ├── zsysnum_netbsd_arm.go │ ├── zsysnum_openbsd_386.go │ ├── zsysnum_openbsd_amd64.go │ ├── zsysnum_solaris_amd64.go │ ├── ztypes_darwin_386.go │ ├── ztypes_darwin_amd64.go │ ├── ztypes_darwin_arm.go │ ├── ztypes_darwin_arm64.go │ ├── ztypes_dragonfly_amd64.go │ ├── ztypes_freebsd_386.go │ ├── ztypes_freebsd_amd64.go │ ├── ztypes_freebsd_arm.go │ ├── ztypes_linux_386.go │ ├── ztypes_linux_amd64.go │ ├── ztypes_linux_arm.go │ ├── ztypes_linux_arm64.go │ ├── ztypes_linux_mips64.go │ ├── ztypes_linux_mips64le.go │ ├── ztypes_linux_ppc64.go │ ├── ztypes_linux_ppc64le.go │ ├── ztypes_linux_s390x.go │ ├── ztypes_linux_sparc64.go │ ├── ztypes_netbsd_386.go │ ├── ztypes_netbsd_amd64.go │ ├── ztypes_netbsd_arm.go │ ├── ztypes_openbsd_386.go │ ├── ztypes_openbsd_amd64.go │ └── ztypes_solaris_amd64.go ├── gopkg.in └── yaml.v3 │ ├── LICENSE │ ├── NOTICE │ ├── README.md │ ├── apic.go │ ├── decode.go │ ├── emitterc.go │ ├── encode.go │ ├── parserc.go │ ├── readerc.go │ ├── resolve.go │ ├── scannerc.go │ ├── sorter.go │ ├── writerc.go │ ├── yaml.go │ ├── yamlh.go │ └── yamlprivateh.go └── modules.txt /.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 | 24 | /build/ 25 | /pkg/ 26 | tmp 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Solarwinds, 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 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # go-tail 2 | 3 | A go package for tailing files. `go get -u github.com/papertrail/go-tail` 4 | 5 | ## Usage 6 | 7 | ### File reading follower 8 | 9 | ```go 10 | package main 11 | 12 | import ( 13 | "io" 14 | "fmt" 15 | "os" 16 | 17 | "github.com/papertrail/go-tail/follower" 18 | ) 19 | 20 | func main() { 21 | t, err := follower.New("yourlogfile.log", follower.Config{ 22 | Whence: io.SeekEnd, 23 | Offset: 0, 24 | Reopen: true, 25 | }) 26 | 27 | for line := range t.Lines() { 28 | fmt.Println(line) 29 | } 30 | 31 | if t.Err() != nil { 32 | fmt.FPrintln(os.Stderr, t.Err()) 33 | } 34 | } 35 | 36 | ``` 37 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/papertrail/go-tail 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/fsnotify/fsnotify v1.4.3-0.20161026203122-fd9ec7deca8b 7 | github.com/spf13/pflag v0.0.0-20160906134334-6fd2ff4ff8df 8 | github.com/stretchr/testify v1.8.1 9 | ) 10 | 11 | require ( 12 | github.com/davecgh/go-spew v1.1.1 // indirect 13 | github.com/pmezard/go-difflib v1.0.0 // indirect 14 | golang.org/x/sys v0.0.0-20161023150541-c200b10b5d5e // indirect 15 | gopkg.in/yaml.v3 v3.0.1 // indirect 16 | ) 17 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 2 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 3 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 4 | github.com/fsnotify/fsnotify v1.4.3-0.20161026203122-fd9ec7deca8b h1:bZQ3Z4jYxLufSFf7zo/cLJ/1WahBEMPCFsgcOjzAAzA= 5 | github.com/fsnotify/fsnotify v1.4.3-0.20161026203122-fd9ec7deca8b/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= 6 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 7 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 8 | github.com/spf13/pflag v0.0.0-20160906134334-6fd2ff4ff8df h1:i6BcnijncbnhvDqNliGST7mq6VUAw/npzYAnDWaAB+M= 9 | github.com/spf13/pflag v0.0.0-20160906134334-6fd2ff4ff8df/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= 10 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 11 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 12 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 13 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 14 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 15 | github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= 16 | github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 17 | golang.org/x/sys v0.0.0-20161023150541-c200b10b5d5e h1:uau++4dmjGy3TuvPvRbhZHY+TQVsImIxtWY5HRh9eho= 18 | golang.org/x/sys v0.0.0-20161023150541-c200b10b5d5e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 19 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 20 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 21 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 22 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 23 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 24 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "os" 7 | 8 | "github.com/papertrail/go-tail/follower" 9 | flag "github.com/spf13/pflag" 10 | ) 11 | 12 | var ( 13 | number int64 14 | follow bool 15 | reopen bool 16 | ) 17 | 18 | // "number" and "follow" are ignored for now, since the follower is the only behavior 19 | // until reading the end of the file is implemented 20 | func init() { 21 | flag.Int64VarP(&number, "number", "n", 10, "how many lines to return") 22 | flag.BoolVarP(&follow, "follow", "f", false, "follow file changes") 23 | flag.BoolVarP(&reopen, "reopen", "F", false, "implies -f and re-opens moved / truncated files") 24 | } 25 | 26 | func main() { 27 | flag.Parse() 28 | 29 | if reopen { 30 | follow = true 31 | } 32 | 33 | args := flag.Args() 34 | if len(args) == 0 { 35 | fmt.Fprintln(os.Stderr, "A file must be provided, I don't follow stdin right now") 36 | os.Exit(-1) 37 | } 38 | 39 | // printchan is an aggregate channel so that we can tail multiple files 40 | printChan := make(chan follower.Line) 41 | for _, f := range args { 42 | t, err := follower.New(f, follower.Config{ 43 | Whence: io.SeekEnd, 44 | Offset: 0, 45 | Reopen: reopen, 46 | }) 47 | if err != nil { 48 | panic(err) 49 | } 50 | 51 | go func(t *follower.Follower) { 52 | for l := range t.Lines() { 53 | printChan <- l 54 | } 55 | 56 | if err := t.Err(); err != nil { 57 | fmt.Println(err) 58 | } 59 | }(t) 60 | } 61 | 62 | for line := range printChan { 63 | fmt.Println(line.String()) 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /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/davecgh/go-spew/spew/bypass.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 not running on Google App Engine, compiled by GopherJS, and 17 | // "-tags safe" is not added to the go build command line. The "disableunsafe" 18 | // tag is deprecated and thus should not be used. 19 | // Go versions prior to 1.4 are disabled because they use a different layout 20 | // for interfaces which make the implementation of unsafeReflectValue more complex. 21 | // +build !js,!appengine,!safe,!disableunsafe,go1.4 22 | 23 | package spew 24 | 25 | import ( 26 | "reflect" 27 | "unsafe" 28 | ) 29 | 30 | const ( 31 | // UnsafeDisabled is a build-time constant which specifies whether or 32 | // not access to the unsafe package is available. 33 | UnsafeDisabled = false 34 | 35 | // ptrSize is the size of a pointer on the current arch. 36 | ptrSize = unsafe.Sizeof((*byte)(nil)) 37 | ) 38 | 39 | type flag uintptr 40 | 41 | var ( 42 | // flagRO indicates whether the value field of a reflect.Value 43 | // is read-only. 44 | flagRO flag 45 | 46 | // flagAddr indicates whether the address of the reflect.Value's 47 | // value may be taken. 48 | flagAddr flag 49 | ) 50 | 51 | // flagKindMask holds the bits that make up the kind 52 | // part of the flags field. In all the supported versions, 53 | // it is in the lower 5 bits. 54 | const flagKindMask = flag(0x1f) 55 | 56 | // Different versions of Go have used different 57 | // bit layouts for the flags type. This table 58 | // records the known combinations. 59 | var okFlags = []struct { 60 | ro, addr flag 61 | }{{ 62 | // From Go 1.4 to 1.5 63 | ro: 1 << 5, 64 | addr: 1 << 7, 65 | }, { 66 | // Up to Go tip. 67 | ro: 1<<5 | 1<<6, 68 | addr: 1 << 8, 69 | }} 70 | 71 | var flagValOffset = func() uintptr { 72 | field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") 73 | if !ok { 74 | panic("reflect.Value has no flag field") 75 | } 76 | return field.Offset 77 | }() 78 | 79 | // flagField returns a pointer to the flag field of a reflect.Value. 80 | func flagField(v *reflect.Value) *flag { 81 | return (*flag)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + flagValOffset)) 82 | } 83 | 84 | // unsafeReflectValue converts the passed reflect.Value into a one that bypasses 85 | // the typical safety restrictions preventing access to unaddressable and 86 | // unexported data. It works by digging the raw pointer to the underlying 87 | // value out of the protected value and generating a new unprotected (unsafe) 88 | // reflect.Value to it. 89 | // 90 | // This allows us to check for implementations of the Stringer and error 91 | // interfaces to be used for pretty printing ordinarily unaddressable and 92 | // inaccessible values such as unexported struct fields. 93 | func unsafeReflectValue(v reflect.Value) reflect.Value { 94 | if !v.IsValid() || (v.CanInterface() && v.CanAddr()) { 95 | return v 96 | } 97 | flagFieldPtr := flagField(&v) 98 | *flagFieldPtr &^= flagRO 99 | *flagFieldPtr |= flagAddr 100 | return v 101 | } 102 | 103 | // Sanity checks against future reflect package changes 104 | // to the type or semantics of the Value.flag field. 105 | func init() { 106 | field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") 107 | if !ok { 108 | panic("reflect.Value has no flag field") 109 | } 110 | if field.Type.Kind() != reflect.TypeOf(flag(0)).Kind() { 111 | panic("reflect.Value flag field has changed kind") 112 | } 113 | type t0 int 114 | var t struct { 115 | A t0 116 | // t0 will have flagEmbedRO set. 117 | t0 118 | // a will have flagStickyRO set 119 | a t0 120 | } 121 | vA := reflect.ValueOf(t).FieldByName("A") 122 | va := reflect.ValueOf(t).FieldByName("a") 123 | vt0 := reflect.ValueOf(t).FieldByName("t0") 124 | 125 | // Infer flagRO from the difference between the flags 126 | // for the (otherwise identical) fields in t. 127 | flagPublic := *flagField(&vA) 128 | flagWithRO := *flagField(&va) | *flagField(&vt0) 129 | flagRO = flagPublic ^ flagWithRO 130 | 131 | // Infer flagAddr from the difference between a value 132 | // taken from a pointer and not. 133 | vPtrA := reflect.ValueOf(&t).Elem().FieldByName("A") 134 | flagNoPtr := *flagField(&vA) 135 | flagPtr := *flagField(&vPtrA) 136 | flagAddr = flagNoPtr ^ flagPtr 137 | 138 | // Check that the inferred flags tally with one of the known versions. 139 | for _, f := range okFlags { 140 | if flagRO == f.ro && flagAddr == f.addr { 141 | return 142 | } 143 | } 144 | panic("reflect.Value read-only flag has changed semantics") 145 | } 146 | -------------------------------------------------------------------------------- /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/fsnotify/fsnotify/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | indent_size = 4 6 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/.gitignore: -------------------------------------------------------------------------------- 1 | # Setup a Global .gitignore for OS and editor generated files: 2 | # https://help.github.com/articles/ignoring-files 3 | # git config --global core.excludesfile ~/.gitignore_global 4 | 5 | .vagrant 6 | *.sublime-project 7 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | 4 | go: 5 | - 1.6.3 6 | - tip 7 | 8 | matrix: 9 | allow_failures: 10 | - go: tip 11 | 12 | before_script: 13 | - go get -u github.com/golang/lint/golint 14 | 15 | script: 16 | - go test -v --race ./... 17 | 18 | after_script: 19 | - test -z "$(gofmt -s -l -w . | tee /dev/stderr)" 20 | - test -z "$(golint ./... | tee /dev/stderr)" 21 | - go vet ./... 22 | 23 | os: 24 | - linux 25 | - osx 26 | 27 | notifications: 28 | email: false 29 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/AUTHORS: -------------------------------------------------------------------------------- 1 | # Names should be added to this file as 2 | # Name or Organization 3 | # The email address is not required for organizations. 4 | 5 | # You can update this list using the following command: 6 | # 7 | # $ git shortlog -se | awk '{print $2 " " $3 " " $4}' 8 | 9 | # Please keep the list sorted. 10 | 11 | Adrien Bustany 12 | Amit Krishnan 13 | Bjørn Erik Pedersen 14 | Bruno Bigras 15 | Caleb Spare 16 | Case Nelson 17 | Chris Howey 18 | Christoffer Buchholz 19 | Daniel Wagner-Hall 20 | Dave Cheney 21 | Evan Phoenix 22 | Francisco Souza 23 | Hari haran 24 | John C Barstow 25 | Kelvin Fo 26 | Ken-ichirou MATSUZAWA 27 | Matt Layher 28 | Nathan Youngman 29 | Patrick 30 | Paul Hammond 31 | Pawel Knap 32 | Pieter Droogendijk 33 | Pursuit92 34 | Riku Voipio 35 | Rob Figueiredo 36 | Slawek Ligus 37 | Soge Zhang 38 | Tiffany Jernigan 39 | Tilak Sharma 40 | Travis Cline 41 | Tudor Golubenco 42 | Yukang 43 | bronze1man 44 | debrando 45 | henrikedwards 46 | 铁哥 47 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Issues 4 | 5 | * Request features and report bugs using the [GitHub Issue Tracker](https://github.com/fsnotify/fsnotify/issues). 6 | * Please indicate the platform you are using fsnotify on. 7 | * A code example to reproduce the problem is appreciated. 8 | 9 | ## Pull Requests 10 | 11 | ### Contributor License Agreement 12 | 13 | fsnotify is derived from code in the [golang.org/x/exp](https://godoc.org/golang.org/x/exp) package and it may be included [in the standard library](https://github.com/fsnotify/fsnotify/issues/1) in the future. Therefore fsnotify carries the same [LICENSE](https://github.com/fsnotify/fsnotify/blob/master/LICENSE) as Go. Contributors retain their copyright, so you need to fill out a short form before we can accept your contribution: [Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual). 14 | 15 | Please indicate that you have signed the CLA in your pull request. 16 | 17 | ### How fsnotify is Developed 18 | 19 | * Development is done on feature branches. 20 | * Tests are run on BSD, Linux, macOS and Windows. 21 | * Pull requests are reviewed and [applied to master][am] using [hub][]. 22 | * Maintainers may modify or squash commits rather than asking contributors to. 23 | * To issue a new release, the maintainers will: 24 | * Update the CHANGELOG 25 | * Tag a version, which will become available through gopkg.in. 26 | 27 | ### How to Fork 28 | 29 | For smooth sailing, always use the original import path. Installing with `go get` makes this easy. 30 | 31 | 1. Install from GitHub (`go get -u github.com/fsnotify/fsnotify`) 32 | 2. Create your feature branch (`git checkout -b my-new-feature`) 33 | 3. Ensure everything works and the tests pass (see below) 34 | 4. Commit your changes (`git commit -am 'Add some feature'`) 35 | 36 | Contribute upstream: 37 | 38 | 1. Fork fsnotify on GitHub 39 | 2. Add your remote (`git remote add fork git@github.com:mycompany/repo.git`) 40 | 3. Push to the branch (`git push fork my-new-feature`) 41 | 4. Create a new Pull Request on GitHub 42 | 43 | This workflow is [thoroughly explained by Katrina Owen](https://splice.com/blog/contributing-open-source-git-repositories-go/). 44 | 45 | ### Testing 46 | 47 | fsnotify uses build tags to compile different code on Linux, BSD, macOS, and Windows. 48 | 49 | Before doing a pull request, please do your best to test your changes on multiple platforms, and list which platforms you were able/unable to test on. 50 | 51 | To aid in cross-platform testing there is a Vagrantfile for Linux and BSD. 52 | 53 | * Install [Vagrant](http://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/) 54 | * Setup [Vagrant Gopher](https://github.com/nathany/vagrant-gopher) in your `src` folder. 55 | * Run `vagrant up` from the project folder. You can also setup just one box with `vagrant up linux` or `vagrant up bsd` (note: the BSD box doesn't support Windows hosts at this time, and NFS may prompt for your host OS password) 56 | * Once setup, you can run the test suite on a given OS with a single command `vagrant ssh linux -c 'cd fsnotify/fsnotify; go test'`. 57 | * When you're done, you will want to halt or destroy the Vagrant boxes. 58 | 59 | Notice: fsnotify file system events won't trigger in shared folders. The tests get around this limitation by using the /tmp directory. 60 | 61 | Right now there is no equivalent solution for Windows and macOS, but there are Windows VMs [freely available from Microsoft](http://www.modern.ie/en-us/virtualization-tools#downloads). 62 | 63 | ### Maintainers 64 | 65 | Help maintaining fsnotify is welcome. To be a maintainer: 66 | 67 | * Submit a pull request and sign the CLA as above. 68 | * You must be able to run the test suite on Mac, Windows, Linux and BSD. 69 | 70 | To keep master clean, the fsnotify project uses the "apply mail" workflow outlined in Nathaniel Talbott's post ["Merge pull request" Considered Harmful][am]. This requires installing [hub][]. 71 | 72 | All code changes should be internal pull requests. 73 | 74 | Releases are tagged using [Semantic Versioning](http://semver.org/). 75 | 76 | [hub]: https://github.com/github/hub 77 | [am]: http://blog.spreedly.com/2014/06/24/merge-pull-request-considered-harmful/#.VGa5yZPF_Zs 78 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The Go Authors. All rights reserved. 2 | Copyright (c) 2012 fsnotify 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/fsnotify/fsnotify/README.md: -------------------------------------------------------------------------------- 1 | # File system notifications for Go 2 | 3 | [![GoDoc](https://godoc.org/github.com/fsnotify/fsnotify?status.svg)](https://godoc.org/github.com/fsnotify/fsnotify) [![Go Report Card](https://goreportcard.com/badge/github.com/fsnotify/fsnotify)](https://goreportcard.com/report/github.com/fsnotify/fsnotify) 4 | 5 | fsnotify utilizes [golang.org/x/sys](https://godoc.org/golang.org/x/sys) rather than `syscall` from the standard library. Ensure you have the latest version installed by running: 6 | 7 | ```console 8 | go get -u golang.org/x/sys/... 9 | ``` 10 | 11 | Cross platform: Windows, Linux, BSD and macOS. 12 | 13 | |Adapter |OS |Status | 14 | |----------|----------|----------| 15 | |inotify |Linux 2.6.27 or later, Android\*|Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify)| 16 | |kqueue |BSD, macOS, iOS\*|Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify)| 17 | |ReadDirectoryChangesW|Windows|Supported [![Build status](https://ci.appveyor.com/api/projects/status/ivwjubaih4r0udeh/branch/master?svg=true)](https://ci.appveyor.com/project/NathanYoungman/fsnotify/branch/master)| 18 | |FSEvents |macOS |[Planned](https://github.com/fsnotify/fsnotify/issues/11)| 19 | |FEN |Solaris 11 |[In Progress](https://github.com/fsnotify/fsnotify/issues/12)| 20 | |fanotify |Linux 2.6.37+ | | 21 | |USN Journals |Windows |[Maybe](https://github.com/fsnotify/fsnotify/issues/53)| 22 | |Polling |*All* |[Maybe](https://github.com/fsnotify/fsnotify/issues/9)| 23 | 24 | \* Android and iOS are untested. 25 | 26 | Please see [the documentation](https://godoc.org/github.com/fsnotify/fsnotify) for usage. Consult the [Wiki](https://github.com/fsnotify/fsnotify/wiki) for the FAQ and further information. 27 | 28 | ## API stability 29 | 30 | fsnotify is a fork of [howeyc/fsnotify](https://godoc.org/github.com/howeyc/fsnotify) with a new API as of v1.0. The API is based on [this design document](http://goo.gl/MrYxyA). 31 | 32 | All [releases](https://github.com/fsnotify/fsnotify/releases) are tagged based on [Semantic Versioning](http://semver.org/). Further API changes are [planned](https://github.com/fsnotify/fsnotify/milestones), and will be tagged with a new major revision number. 33 | 34 | Go 1.6 supports dependencies located in the `vendor/` folder. Unless you are creating a library, it is recommended that you copy fsnotify into `vendor/github.com/fsnotify/fsnotify` within your project, and likewise for `golang.org/x/sys`. 35 | 36 | ## Contributing 37 | 38 | Please refer to [CONTRIBUTING][] before opening an issue or pull request. 39 | 40 | ## Example 41 | 42 | See [example_test.go](https://github.com/fsnotify/fsnotify/blob/master/example_test.go). 43 | 44 | [contributing]: https://github.com/fsnotify/fsnotify/blob/master/CONTRIBUTING.md 45 | 46 | ## Related Projects 47 | 48 | * [notify](https://github.com/rjeczalik/notify) 49 | * [fsevents](https://github.com/fsnotify/fsevents) 50 | 51 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/fen.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 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 | // +build solaris 6 | 7 | package fsnotify 8 | 9 | import ( 10 | "errors" 11 | ) 12 | 13 | // Watcher watches a set of files, delivering events to a channel. 14 | type Watcher struct { 15 | Events chan Event 16 | Errors chan error 17 | } 18 | 19 | // NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. 20 | func NewWatcher() (*Watcher, error) { 21 | return nil, errors.New("FEN based watcher not yet supported for fsnotify\n") 22 | } 23 | 24 | // Close removes all watches and closes the events channel. 25 | func (w *Watcher) Close() error { 26 | return nil 27 | } 28 | 29 | // Add starts watching the named file or directory (non-recursively). 30 | func (w *Watcher) Add(name string) error { 31 | return nil 32 | } 33 | 34 | // Remove stops watching the the named file or directory (non-recursively). 35 | func (w *Watcher) Remove(name string) error { 36 | return nil 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/fsnotify.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 | // +build !plan9 6 | 7 | // Package fsnotify provides a platform-independent interface for file system notifications. 8 | package fsnotify 9 | 10 | import ( 11 | "bytes" 12 | "errors" 13 | "fmt" 14 | ) 15 | 16 | // Event represents a single file system notification. 17 | type Event struct { 18 | Name string // Relative path to the file or directory. 19 | Op Op // File operation that triggered the event. 20 | } 21 | 22 | // Op describes a set of file operations. 23 | type Op uint32 24 | 25 | // These are the generalized file operations that can trigger a notification. 26 | const ( 27 | Create Op = 1 << iota 28 | Write 29 | Remove 30 | Rename 31 | Chmod 32 | ) 33 | 34 | func (op Op) String() string { 35 | // Use a buffer for efficient string concatenation 36 | var buffer bytes.Buffer 37 | 38 | if op&Create == Create { 39 | buffer.WriteString("|CREATE") 40 | } 41 | if op&Remove == Remove { 42 | buffer.WriteString("|REMOVE") 43 | } 44 | if op&Write == Write { 45 | buffer.WriteString("|WRITE") 46 | } 47 | if op&Rename == Rename { 48 | buffer.WriteString("|RENAME") 49 | } 50 | if op&Chmod == Chmod { 51 | buffer.WriteString("|CHMOD") 52 | } 53 | if buffer.Len() == 0 { 54 | return "" 55 | } 56 | return buffer.String()[1:] // Strip leading pipe 57 | } 58 | 59 | // String returns a string representation of the event in the form 60 | // "file: REMOVE|WRITE|..." 61 | func (e Event) String() string { 62 | return fmt.Sprintf("%q: %s", e.Name, e.Op.String()) 63 | } 64 | 65 | // Common errors that can be reported by a watcher 66 | var ErrEventOverflow = errors.New("fsnotify queue overflow") 67 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/inotify_poller.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build linux 6 | 7 | package fsnotify 8 | 9 | import ( 10 | "errors" 11 | 12 | "golang.org/x/sys/unix" 13 | ) 14 | 15 | type fdPoller struct { 16 | fd int // File descriptor (as returned by the inotify_init() syscall) 17 | epfd int // Epoll file descriptor 18 | pipe [2]int // Pipe for waking up 19 | } 20 | 21 | func emptyPoller(fd int) *fdPoller { 22 | poller := new(fdPoller) 23 | poller.fd = fd 24 | poller.epfd = -1 25 | poller.pipe[0] = -1 26 | poller.pipe[1] = -1 27 | return poller 28 | } 29 | 30 | // Create a new inotify poller. 31 | // This creates an inotify handler, and an epoll handler. 32 | func newFdPoller(fd int) (*fdPoller, error) { 33 | var errno error 34 | poller := emptyPoller(fd) 35 | defer func() { 36 | if errno != nil { 37 | poller.close() 38 | } 39 | }() 40 | poller.fd = fd 41 | 42 | // Create epoll fd 43 | poller.epfd, errno = unix.EpollCreate1(0) 44 | if poller.epfd == -1 { 45 | return nil, errno 46 | } 47 | // Create pipe; pipe[0] is the read end, pipe[1] the write end. 48 | errno = unix.Pipe2(poller.pipe[:], unix.O_NONBLOCK) 49 | if errno != nil { 50 | return nil, errno 51 | } 52 | 53 | // Register inotify fd with epoll 54 | event := unix.EpollEvent{ 55 | Fd: int32(poller.fd), 56 | Events: unix.EPOLLIN, 57 | } 58 | errno = unix.EpollCtl(poller.epfd, unix.EPOLL_CTL_ADD, poller.fd, &event) 59 | if errno != nil { 60 | return nil, errno 61 | } 62 | 63 | // Register pipe fd with epoll 64 | event = unix.EpollEvent{ 65 | Fd: int32(poller.pipe[0]), 66 | Events: unix.EPOLLIN, 67 | } 68 | errno = unix.EpollCtl(poller.epfd, unix.EPOLL_CTL_ADD, poller.pipe[0], &event) 69 | if errno != nil { 70 | return nil, errno 71 | } 72 | 73 | return poller, nil 74 | } 75 | 76 | // Wait using epoll. 77 | // Returns true if something is ready to be read, 78 | // false if there is not. 79 | func (poller *fdPoller) wait() (bool, error) { 80 | // 3 possible events per fd, and 2 fds, makes a maximum of 6 events. 81 | // I don't know whether epoll_wait returns the number of events returned, 82 | // or the total number of events ready. 83 | // I decided to catch both by making the buffer one larger than the maximum. 84 | events := make([]unix.EpollEvent, 7) 85 | for { 86 | n, errno := unix.EpollWait(poller.epfd, events, -1) 87 | if n == -1 { 88 | if errno == unix.EINTR { 89 | continue 90 | } 91 | return false, errno 92 | } 93 | if n == 0 { 94 | // If there are no events, try again. 95 | continue 96 | } 97 | if n > 6 { 98 | // This should never happen. More events were returned than should be possible. 99 | return false, errors.New("epoll_wait returned more events than I know what to do with") 100 | } 101 | ready := events[:n] 102 | epollhup := false 103 | epollerr := false 104 | epollin := false 105 | for _, event := range ready { 106 | if event.Fd == int32(poller.fd) { 107 | if event.Events&unix.EPOLLHUP != 0 { 108 | // This should not happen, but if it does, treat it as a wakeup. 109 | epollhup = true 110 | } 111 | if event.Events&unix.EPOLLERR != 0 { 112 | // If an error is waiting on the file descriptor, we should pretend 113 | // something is ready to read, and let unix.Read pick up the error. 114 | epollerr = true 115 | } 116 | if event.Events&unix.EPOLLIN != 0 { 117 | // There is data to read. 118 | epollin = true 119 | } 120 | } 121 | if event.Fd == int32(poller.pipe[0]) { 122 | if event.Events&unix.EPOLLHUP != 0 { 123 | // Write pipe descriptor was closed, by us. This means we're closing down the 124 | // watcher, and we should wake up. 125 | } 126 | if event.Events&unix.EPOLLERR != 0 { 127 | // If an error is waiting on the pipe file descriptor. 128 | // This is an absolute mystery, and should never ever happen. 129 | return false, errors.New("Error on the pipe descriptor.") 130 | } 131 | if event.Events&unix.EPOLLIN != 0 { 132 | // This is a regular wakeup, so we have to clear the buffer. 133 | err := poller.clearWake() 134 | if err != nil { 135 | return false, err 136 | } 137 | } 138 | } 139 | } 140 | 141 | if epollhup || epollerr || epollin { 142 | return true, nil 143 | } 144 | return false, nil 145 | } 146 | } 147 | 148 | // Close the write end of the poller. 149 | func (poller *fdPoller) wake() error { 150 | buf := make([]byte, 1) 151 | n, errno := unix.Write(poller.pipe[1], buf) 152 | if n == -1 { 153 | if errno == unix.EAGAIN { 154 | // Buffer is full, poller will wake. 155 | return nil 156 | } 157 | return errno 158 | } 159 | return nil 160 | } 161 | 162 | func (poller *fdPoller) clearWake() error { 163 | // You have to be woken up a LOT in order to get to 100! 164 | buf := make([]byte, 100) 165 | n, errno := unix.Read(poller.pipe[0], buf) 166 | if n == -1 { 167 | if errno == unix.EAGAIN { 168 | // Buffer is empty, someone else cleared our wake. 169 | return nil 170 | } 171 | return errno 172 | } 173 | return nil 174 | } 175 | 176 | // Close all poller file descriptors, but not the one passed to it. 177 | func (poller *fdPoller) close() { 178 | if poller.pipe[1] != -1 { 179 | unix.Close(poller.pipe[1]) 180 | } 181 | if poller.pipe[0] != -1 { 182 | unix.Close(poller.pipe[0]) 183 | } 184 | if poller.epfd != -1 { 185 | unix.Close(poller.epfd) 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 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 | // +build freebsd openbsd netbsd dragonfly 6 | 7 | package fsnotify 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | const openMode = unix.O_NONBLOCK | unix.O_RDONLY 12 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 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 | // +build darwin 6 | 7 | package fsnotify 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | // note: this constant is not defined on BSD 12 | const openMode = unix.O_EVTONLY 13 | -------------------------------------------------------------------------------- /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/spf13/pflag/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: go 4 | 5 | go: 6 | - 1.5.4 7 | - 1.6.3 8 | - 1.7 9 | - tip 10 | 11 | matrix: 12 | allow_failures: 13 | - go: tip 14 | install: 15 | - go get github.com/golang/lint/golint 16 | - export PATH=$GOPATH/bin:$PATH 17 | - go install ./... 18 | 19 | script: 20 | - verify/all.sh -v 21 | - go test ./... 22 | -------------------------------------------------------------------------------- /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/spf13/pflag/bool.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // optional interface to indicate boolean flags that can be 9 | // supplied without "=value" text 10 | type boolFlag interface { 11 | Value 12 | IsBoolFlag() bool 13 | } 14 | 15 | // -- bool Value 16 | type boolValue bool 17 | 18 | func newBoolValue(val bool, p *bool) *boolValue { 19 | *p = val 20 | return (*boolValue)(p) 21 | } 22 | 23 | func (b *boolValue) Set(s string) error { 24 | v, err := strconv.ParseBool(s) 25 | *b = boolValue(v) 26 | return err 27 | } 28 | 29 | func (b *boolValue) Type() string { 30 | return "bool" 31 | } 32 | 33 | func (b *boolValue) String() string { return fmt.Sprintf("%v", *b) } 34 | 35 | func (b *boolValue) IsBoolFlag() bool { return true } 36 | 37 | func boolConv(sval string) (interface{}, error) { 38 | return strconv.ParseBool(sval) 39 | } 40 | 41 | // GetBool return the bool value of a flag with the given name 42 | func (f *FlagSet) GetBool(name string) (bool, error) { 43 | val, err := f.getFlagType(name, "bool", boolConv) 44 | if err != nil { 45 | return false, err 46 | } 47 | return val.(bool), nil 48 | } 49 | 50 | // BoolVar defines a bool flag with specified name, default value, and usage string. 51 | // The argument p points to a bool variable in which to store the value of the flag. 52 | func (f *FlagSet) BoolVar(p *bool, name string, value bool, usage string) { 53 | f.BoolVarP(p, name, "", value, usage) 54 | } 55 | 56 | // BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash. 57 | func (f *FlagSet) BoolVarP(p *bool, name, shorthand string, value bool, usage string) { 58 | flag := f.VarPF(newBoolValue(value, p), name, shorthand, usage) 59 | flag.NoOptDefVal = "true" 60 | } 61 | 62 | // BoolVar defines a bool flag with specified name, default value, and usage string. 63 | // The argument p points to a bool variable in which to store the value of the flag. 64 | func BoolVar(p *bool, name string, value bool, usage string) { 65 | BoolVarP(p, name, "", value, usage) 66 | } 67 | 68 | // BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash. 69 | func BoolVarP(p *bool, name, shorthand string, value bool, usage string) { 70 | flag := CommandLine.VarPF(newBoolValue(value, p), name, shorthand, usage) 71 | flag.NoOptDefVal = "true" 72 | } 73 | 74 | // Bool defines a bool flag with specified name, default value, and usage string. 75 | // The return value is the address of a bool variable that stores the value of the flag. 76 | func (f *FlagSet) Bool(name string, value bool, usage string) *bool { 77 | return f.BoolP(name, "", value, usage) 78 | } 79 | 80 | // BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash. 81 | func (f *FlagSet) BoolP(name, shorthand string, value bool, usage string) *bool { 82 | p := new(bool) 83 | f.BoolVarP(p, name, shorthand, value, usage) 84 | return p 85 | } 86 | 87 | // Bool defines a bool flag with specified name, default value, and usage string. 88 | // The return value is the address of a bool variable that stores the value of the flag. 89 | func Bool(name string, value bool, usage string) *bool { 90 | return BoolP(name, "", value, usage) 91 | } 92 | 93 | // BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash. 94 | func BoolP(name, shorthand string, value bool, usage string) *bool { 95 | b := CommandLine.BoolP(name, shorthand, value, usage) 96 | return b 97 | } 98 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/count.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // -- count Value 9 | type countValue int 10 | 11 | func newCountValue(val int, p *int) *countValue { 12 | *p = val 13 | return (*countValue)(p) 14 | } 15 | 16 | func (i *countValue) Set(s string) error { 17 | v, err := strconv.ParseInt(s, 0, 64) 18 | // -1 means that no specific value was passed, so increment 19 | if v == -1 { 20 | *i = countValue(*i + 1) 21 | } else { 22 | *i = countValue(v) 23 | } 24 | return err 25 | } 26 | 27 | func (i *countValue) Type() string { 28 | return "count" 29 | } 30 | 31 | func (i *countValue) String() string { return fmt.Sprintf("%v", *i) } 32 | 33 | func countConv(sval string) (interface{}, error) { 34 | i, err := strconv.Atoi(sval) 35 | if err != nil { 36 | return nil, err 37 | } 38 | return i, nil 39 | } 40 | 41 | // GetCount return the int value of a flag with the given name 42 | func (f *FlagSet) GetCount(name string) (int, error) { 43 | val, err := f.getFlagType(name, "count", countConv) 44 | if err != nil { 45 | return 0, err 46 | } 47 | return val.(int), nil 48 | } 49 | 50 | // CountVar defines a count flag with specified name, default value, and usage string. 51 | // The argument p points to an int variable in which to store the value of the flag. 52 | // A count flag will add 1 to its value evey time it is found on the command line 53 | func (f *FlagSet) CountVar(p *int, name string, usage string) { 54 | f.CountVarP(p, name, "", usage) 55 | } 56 | 57 | // CountVarP is like CountVar only take a shorthand for the flag name. 58 | func (f *FlagSet) CountVarP(p *int, name, shorthand string, usage string) { 59 | flag := f.VarPF(newCountValue(0, p), name, shorthand, usage) 60 | flag.NoOptDefVal = "-1" 61 | } 62 | 63 | // CountVar like CountVar only the flag is placed on the CommandLine instead of a given flag set 64 | func CountVar(p *int, name string, usage string) { 65 | CommandLine.CountVar(p, name, usage) 66 | } 67 | 68 | // CountVarP is like CountVar only take a shorthand for the flag name. 69 | func CountVarP(p *int, name, shorthand string, usage string) { 70 | CommandLine.CountVarP(p, name, shorthand, usage) 71 | } 72 | 73 | // Count defines a count flag with specified name, default value, and usage string. 74 | // The return value is the address of an int variable that stores the value of the flag. 75 | // A count flag will add 1 to its value evey time it is found on the command line 76 | func (f *FlagSet) Count(name string, usage string) *int { 77 | p := new(int) 78 | f.CountVarP(p, name, "", usage) 79 | return p 80 | } 81 | 82 | // CountP is like Count only takes a shorthand for the flag name. 83 | func (f *FlagSet) CountP(name, shorthand string, usage string) *int { 84 | p := new(int) 85 | f.CountVarP(p, name, shorthand, usage) 86 | return p 87 | } 88 | 89 | // Count like Count only the flag is placed on the CommandLine isntead of a given flag set 90 | func Count(name string, usage string) *int { 91 | return CommandLine.CountP(name, "", usage) 92 | } 93 | 94 | // CountP is like Count only takes a shorthand for the flag name. 95 | func CountP(name, shorthand string, usage string) *int { 96 | return CommandLine.CountP(name, shorthand, usage) 97 | } 98 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/duration.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | // -- time.Duration Value 8 | type durationValue time.Duration 9 | 10 | func newDurationValue(val time.Duration, p *time.Duration) *durationValue { 11 | *p = val 12 | return (*durationValue)(p) 13 | } 14 | 15 | func (d *durationValue) Set(s string) error { 16 | v, err := time.ParseDuration(s) 17 | *d = durationValue(v) 18 | return err 19 | } 20 | 21 | func (d *durationValue) Type() string { 22 | return "duration" 23 | } 24 | 25 | func (d *durationValue) String() string { return (*time.Duration)(d).String() } 26 | 27 | func durationConv(sval string) (interface{}, error) { 28 | return time.ParseDuration(sval) 29 | } 30 | 31 | // GetDuration return the duration value of a flag with the given name 32 | func (f *FlagSet) GetDuration(name string) (time.Duration, error) { 33 | val, err := f.getFlagType(name, "duration", durationConv) 34 | if err != nil { 35 | return 0, err 36 | } 37 | return val.(time.Duration), nil 38 | } 39 | 40 | // DurationVar defines a time.Duration flag with specified name, default value, and usage string. 41 | // The argument p points to a time.Duration variable in which to store the value of the flag. 42 | func (f *FlagSet) DurationVar(p *time.Duration, name string, value time.Duration, usage string) { 43 | f.VarP(newDurationValue(value, p), name, "", usage) 44 | } 45 | 46 | // DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash. 47 | func (f *FlagSet) DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) { 48 | f.VarP(newDurationValue(value, p), name, shorthand, usage) 49 | } 50 | 51 | // DurationVar defines a time.Duration flag with specified name, default value, and usage string. 52 | // The argument p points to a time.Duration variable in which to store the value of the flag. 53 | func DurationVar(p *time.Duration, name string, value time.Duration, usage string) { 54 | CommandLine.VarP(newDurationValue(value, p), name, "", usage) 55 | } 56 | 57 | // DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash. 58 | func DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) { 59 | CommandLine.VarP(newDurationValue(value, p), name, shorthand, usage) 60 | } 61 | 62 | // Duration defines a time.Duration flag with specified name, default value, and usage string. 63 | // The return value is the address of a time.Duration variable that stores the value of the flag. 64 | func (f *FlagSet) Duration(name string, value time.Duration, usage string) *time.Duration { 65 | p := new(time.Duration) 66 | f.DurationVarP(p, name, "", value, usage) 67 | return p 68 | } 69 | 70 | // DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash. 71 | func (f *FlagSet) DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration { 72 | p := new(time.Duration) 73 | f.DurationVarP(p, name, shorthand, value, usage) 74 | return p 75 | } 76 | 77 | // Duration defines a time.Duration flag with specified name, default value, and usage string. 78 | // The return value is the address of a time.Duration variable that stores the value of the flag. 79 | func Duration(name string, value time.Duration, usage string) *time.Duration { 80 | return CommandLine.DurationP(name, "", value, usage) 81 | } 82 | 83 | // DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash. 84 | func DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration { 85 | return CommandLine.DurationP(name, shorthand, value, usage) 86 | } 87 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/float32.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // -- float32 Value 9 | type float32Value float32 10 | 11 | func newFloat32Value(val float32, p *float32) *float32Value { 12 | *p = val 13 | return (*float32Value)(p) 14 | } 15 | 16 | func (f *float32Value) Set(s string) error { 17 | v, err := strconv.ParseFloat(s, 32) 18 | *f = float32Value(v) 19 | return err 20 | } 21 | 22 | func (f *float32Value) Type() string { 23 | return "float32" 24 | } 25 | 26 | func (f *float32Value) String() string { return fmt.Sprintf("%v", *f) } 27 | 28 | func float32Conv(sval string) (interface{}, error) { 29 | v, err := strconv.ParseFloat(sval, 32) 30 | if err != nil { 31 | return 0, err 32 | } 33 | return float32(v), nil 34 | } 35 | 36 | // GetFloat32 return the float32 value of a flag with the given name 37 | func (f *FlagSet) GetFloat32(name string) (float32, error) { 38 | val, err := f.getFlagType(name, "float32", float32Conv) 39 | if err != nil { 40 | return 0, err 41 | } 42 | return val.(float32), nil 43 | } 44 | 45 | // Float32Var defines a float32 flag with specified name, default value, and usage string. 46 | // The argument p points to a float32 variable in which to store the value of the flag. 47 | func (f *FlagSet) Float32Var(p *float32, name string, value float32, usage string) { 48 | f.VarP(newFloat32Value(value, p), name, "", usage) 49 | } 50 | 51 | // Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash. 52 | func (f *FlagSet) Float32VarP(p *float32, name, shorthand string, value float32, usage string) { 53 | f.VarP(newFloat32Value(value, p), name, shorthand, usage) 54 | } 55 | 56 | // Float32Var defines a float32 flag with specified name, default value, and usage string. 57 | // The argument p points to a float32 variable in which to store the value of the flag. 58 | func Float32Var(p *float32, name string, value float32, usage string) { 59 | CommandLine.VarP(newFloat32Value(value, p), name, "", usage) 60 | } 61 | 62 | // Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash. 63 | func Float32VarP(p *float32, name, shorthand string, value float32, usage string) { 64 | CommandLine.VarP(newFloat32Value(value, p), name, shorthand, usage) 65 | } 66 | 67 | // Float32 defines a float32 flag with specified name, default value, and usage string. 68 | // The return value is the address of a float32 variable that stores the value of the flag. 69 | func (f *FlagSet) Float32(name string, value float32, usage string) *float32 { 70 | p := new(float32) 71 | f.Float32VarP(p, name, "", value, usage) 72 | return p 73 | } 74 | 75 | // Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash. 76 | func (f *FlagSet) Float32P(name, shorthand string, value float32, usage string) *float32 { 77 | p := new(float32) 78 | f.Float32VarP(p, name, shorthand, value, usage) 79 | return p 80 | } 81 | 82 | // Float32 defines a float32 flag with specified name, default value, and usage string. 83 | // The return value is the address of a float32 variable that stores the value of the flag. 84 | func Float32(name string, value float32, usage string) *float32 { 85 | return CommandLine.Float32P(name, "", value, usage) 86 | } 87 | 88 | // Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash. 89 | func Float32P(name, shorthand string, value float32, usage string) *float32 { 90 | return CommandLine.Float32P(name, shorthand, value, usage) 91 | } 92 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/float64.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // -- float64 Value 9 | type float64Value float64 10 | 11 | func newFloat64Value(val float64, p *float64) *float64Value { 12 | *p = val 13 | return (*float64Value)(p) 14 | } 15 | 16 | func (f *float64Value) Set(s string) error { 17 | v, err := strconv.ParseFloat(s, 64) 18 | *f = float64Value(v) 19 | return err 20 | } 21 | 22 | func (f *float64Value) Type() string { 23 | return "float64" 24 | } 25 | 26 | func (f *float64Value) String() string { return fmt.Sprintf("%v", *f) } 27 | 28 | func float64Conv(sval string) (interface{}, error) { 29 | return strconv.ParseFloat(sval, 64) 30 | } 31 | 32 | // GetFloat64 return the float64 value of a flag with the given name 33 | func (f *FlagSet) GetFloat64(name string) (float64, error) { 34 | val, err := f.getFlagType(name, "float64", float64Conv) 35 | if err != nil { 36 | return 0, err 37 | } 38 | return val.(float64), nil 39 | } 40 | 41 | // Float64Var defines a float64 flag with specified name, default value, and usage string. 42 | // The argument p points to a float64 variable in which to store the value of the flag. 43 | func (f *FlagSet) Float64Var(p *float64, name string, value float64, usage string) { 44 | f.VarP(newFloat64Value(value, p), name, "", usage) 45 | } 46 | 47 | // Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash. 48 | func (f *FlagSet) Float64VarP(p *float64, name, shorthand string, value float64, usage string) { 49 | f.VarP(newFloat64Value(value, p), name, shorthand, usage) 50 | } 51 | 52 | // Float64Var defines a float64 flag with specified name, default value, and usage string. 53 | // The argument p points to a float64 variable in which to store the value of the flag. 54 | func Float64Var(p *float64, name string, value float64, usage string) { 55 | CommandLine.VarP(newFloat64Value(value, p), name, "", usage) 56 | } 57 | 58 | // Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash. 59 | func Float64VarP(p *float64, name, shorthand string, value float64, usage string) { 60 | CommandLine.VarP(newFloat64Value(value, p), name, shorthand, usage) 61 | } 62 | 63 | // Float64 defines a float64 flag with specified name, default value, and usage string. 64 | // The return value is the address of a float64 variable that stores the value of the flag. 65 | func (f *FlagSet) Float64(name string, value float64, usage string) *float64 { 66 | p := new(float64) 67 | f.Float64VarP(p, name, "", value, usage) 68 | return p 69 | } 70 | 71 | // Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash. 72 | func (f *FlagSet) Float64P(name, shorthand string, value float64, usage string) *float64 { 73 | p := new(float64) 74 | f.Float64VarP(p, name, shorthand, value, usage) 75 | return p 76 | } 77 | 78 | // Float64 defines a float64 flag with specified name, default value, and usage string. 79 | // The return value is the address of a float64 variable that stores the value of the flag. 80 | func Float64(name string, value float64, usage string) *float64 { 81 | return CommandLine.Float64P(name, "", value, usage) 82 | } 83 | 84 | // Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash. 85 | func Float64P(name, shorthand string, value float64, usage string) *float64 { 86 | return CommandLine.Float64P(name, shorthand, value, usage) 87 | } 88 | -------------------------------------------------------------------------------- /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 | "fmt" 10 | "reflect" 11 | "strings" 12 | ) 13 | 14 | var _ = fmt.Print 15 | 16 | // flagValueWrapper implements pflag.Value around a flag.Value. The main 17 | // difference here is the addition of the Type method that returns a string 18 | // name of the type. As this is generally unknown, we approximate that with 19 | // reflection. 20 | type flagValueWrapper struct { 21 | inner goflag.Value 22 | flagType string 23 | } 24 | 25 | // We are just copying the boolFlag interface out of goflag as that is what 26 | // they use to decide if a flag should get "true" when no arg is given. 27 | type goBoolFlag interface { 28 | goflag.Value 29 | IsBoolFlag() bool 30 | } 31 | 32 | func wrapFlagValue(v goflag.Value) Value { 33 | // If the flag.Value happens to also be a pflag.Value, just use it directly. 34 | if pv, ok := v.(Value); ok { 35 | return pv 36 | } 37 | 38 | pv := &flagValueWrapper{ 39 | inner: v, 40 | } 41 | 42 | t := reflect.TypeOf(v) 43 | if t.Kind() == reflect.Interface || t.Kind() == reflect.Ptr { 44 | t = t.Elem() 45 | } 46 | 47 | pv.flagType = strings.TrimSuffix(t.Name(), "Value") 48 | return pv 49 | } 50 | 51 | func (v *flagValueWrapper) String() string { 52 | return v.inner.String() 53 | } 54 | 55 | func (v *flagValueWrapper) Set(s string) error { 56 | return v.inner.Set(s) 57 | } 58 | 59 | func (v *flagValueWrapper) Type() string { 60 | return v.flagType 61 | } 62 | 63 | // PFlagFromGoFlag will return a *pflag.Flag given a *flag.Flag 64 | // If the *flag.Flag.Name was a single character (ex: `v`) it will be accessiblei 65 | // with both `-v` and `--v` in flags. If the golang flag was more than a single 66 | // character (ex: `verbose`) it will only be accessible via `--verbose` 67 | func PFlagFromGoFlag(goflag *goflag.Flag) *Flag { 68 | // Remember the default value as a string; it won't change. 69 | flag := &Flag{ 70 | Name: goflag.Name, 71 | Usage: goflag.Usage, 72 | Value: wrapFlagValue(goflag.Value), 73 | // Looks like golang flags don't set DefValue correctly :-( 74 | //DefValue: goflag.DefValue, 75 | DefValue: goflag.Value.String(), 76 | } 77 | // Ex: if the golang flag was -v, allow both -v and --v to work 78 | if len(flag.Name) == 1 { 79 | flag.Shorthand = flag.Name 80 | } 81 | if fv, ok := goflag.Value.(goBoolFlag); ok && fv.IsBoolFlag() { 82 | flag.NoOptDefVal = "true" 83 | } 84 | return flag 85 | } 86 | 87 | // AddGoFlag will add the given *flag.Flag to the pflag.FlagSet 88 | func (f *FlagSet) AddGoFlag(goflag *goflag.Flag) { 89 | if f.Lookup(goflag.Name) != nil { 90 | return 91 | } 92 | newflag := PFlagFromGoFlag(goflag) 93 | f.AddFlag(newflag) 94 | } 95 | 96 | // AddGoFlagSet will add the given *flag.FlagSet to the pflag.FlagSet 97 | func (f *FlagSet) AddGoFlagSet(newSet *goflag.FlagSet) { 98 | if newSet == nil { 99 | return 100 | } 101 | newSet.VisitAll(func(goflag *goflag.Flag) { 102 | f.AddGoFlag(goflag) 103 | }) 104 | } 105 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/int.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // -- int Value 9 | type intValue int 10 | 11 | func newIntValue(val int, p *int) *intValue { 12 | *p = val 13 | return (*intValue)(p) 14 | } 15 | 16 | func (i *intValue) Set(s string) error { 17 | v, err := strconv.ParseInt(s, 0, 64) 18 | *i = intValue(v) 19 | return err 20 | } 21 | 22 | func (i *intValue) Type() string { 23 | return "int" 24 | } 25 | 26 | func (i *intValue) String() string { return fmt.Sprintf("%v", *i) } 27 | 28 | func intConv(sval string) (interface{}, error) { 29 | return strconv.Atoi(sval) 30 | } 31 | 32 | // GetInt return the int value of a flag with the given name 33 | func (f *FlagSet) GetInt(name string) (int, error) { 34 | val, err := f.getFlagType(name, "int", intConv) 35 | if err != nil { 36 | return 0, err 37 | } 38 | return val.(int), nil 39 | } 40 | 41 | // IntVar defines an int flag with specified name, default value, and usage string. 42 | // The argument p points to an int variable in which to store the value of the flag. 43 | func (f *FlagSet) IntVar(p *int, name string, value int, usage string) { 44 | f.VarP(newIntValue(value, p), name, "", usage) 45 | } 46 | 47 | // IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash. 48 | func (f *FlagSet) IntVarP(p *int, name, shorthand string, value int, usage string) { 49 | f.VarP(newIntValue(value, p), name, shorthand, usage) 50 | } 51 | 52 | // IntVar defines an int flag with specified name, default value, and usage string. 53 | // The argument p points to an int variable in which to store the value of the flag. 54 | func IntVar(p *int, name string, value int, usage string) { 55 | CommandLine.VarP(newIntValue(value, p), name, "", usage) 56 | } 57 | 58 | // IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash. 59 | func IntVarP(p *int, name, shorthand string, value int, usage string) { 60 | CommandLine.VarP(newIntValue(value, p), name, shorthand, usage) 61 | } 62 | 63 | // Int defines an int flag with specified name, default value, and usage string. 64 | // The return value is the address of an int variable that stores the value of the flag. 65 | func (f *FlagSet) Int(name string, value int, usage string) *int { 66 | p := new(int) 67 | f.IntVarP(p, name, "", value, usage) 68 | return p 69 | } 70 | 71 | // IntP is like Int, but accepts a shorthand letter that can be used after a single dash. 72 | func (f *FlagSet) IntP(name, shorthand string, value int, usage string) *int { 73 | p := new(int) 74 | f.IntVarP(p, name, shorthand, value, usage) 75 | return p 76 | } 77 | 78 | // Int defines an int flag with specified name, default value, and usage string. 79 | // The return value is the address of an int variable that stores the value of the flag. 80 | func Int(name string, value int, usage string) *int { 81 | return CommandLine.IntP(name, "", value, usage) 82 | } 83 | 84 | // IntP is like Int, but accepts a shorthand letter that can be used after a single dash. 85 | func IntP(name, shorthand string, value int, usage string) *int { 86 | return CommandLine.IntP(name, shorthand, value, usage) 87 | } 88 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/int32.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // -- int32 Value 9 | type int32Value int32 10 | 11 | func newInt32Value(val int32, p *int32) *int32Value { 12 | *p = val 13 | return (*int32Value)(p) 14 | } 15 | 16 | func (i *int32Value) Set(s string) error { 17 | v, err := strconv.ParseInt(s, 0, 32) 18 | *i = int32Value(v) 19 | return err 20 | } 21 | 22 | func (i *int32Value) Type() string { 23 | return "int32" 24 | } 25 | 26 | func (i *int32Value) String() string { return fmt.Sprintf("%v", *i) } 27 | 28 | func int32Conv(sval string) (interface{}, error) { 29 | v, err := strconv.ParseInt(sval, 0, 32) 30 | if err != nil { 31 | return 0, err 32 | } 33 | return int32(v), nil 34 | } 35 | 36 | // GetInt32 return the int32 value of a flag with the given name 37 | func (f *FlagSet) GetInt32(name string) (int32, error) { 38 | val, err := f.getFlagType(name, "int32", int32Conv) 39 | if err != nil { 40 | return 0, err 41 | } 42 | return val.(int32), nil 43 | } 44 | 45 | // Int32Var defines an int32 flag with specified name, default value, and usage string. 46 | // The argument p points to an int32 variable in which to store the value of the flag. 47 | func (f *FlagSet) Int32Var(p *int32, name string, value int32, usage string) { 48 | f.VarP(newInt32Value(value, p), name, "", usage) 49 | } 50 | 51 | // Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash. 52 | func (f *FlagSet) Int32VarP(p *int32, name, shorthand string, value int32, usage string) { 53 | f.VarP(newInt32Value(value, p), name, shorthand, usage) 54 | } 55 | 56 | // Int32Var defines an int32 flag with specified name, default value, and usage string. 57 | // The argument p points to an int32 variable in which to store the value of the flag. 58 | func Int32Var(p *int32, name string, value int32, usage string) { 59 | CommandLine.VarP(newInt32Value(value, p), name, "", usage) 60 | } 61 | 62 | // Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash. 63 | func Int32VarP(p *int32, name, shorthand string, value int32, usage string) { 64 | CommandLine.VarP(newInt32Value(value, p), name, shorthand, usage) 65 | } 66 | 67 | // Int32 defines an int32 flag with specified name, default value, and usage string. 68 | // The return value is the address of an int32 variable that stores the value of the flag. 69 | func (f *FlagSet) Int32(name string, value int32, usage string) *int32 { 70 | p := new(int32) 71 | f.Int32VarP(p, name, "", value, usage) 72 | return p 73 | } 74 | 75 | // Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash. 76 | func (f *FlagSet) Int32P(name, shorthand string, value int32, usage string) *int32 { 77 | p := new(int32) 78 | f.Int32VarP(p, name, shorthand, value, usage) 79 | return p 80 | } 81 | 82 | // Int32 defines an int32 flag with specified name, default value, and usage string. 83 | // The return value is the address of an int32 variable that stores the value of the flag. 84 | func Int32(name string, value int32, usage string) *int32 { 85 | return CommandLine.Int32P(name, "", value, usage) 86 | } 87 | 88 | // Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash. 89 | func Int32P(name, shorthand string, value int32, usage string) *int32 { 90 | return CommandLine.Int32P(name, shorthand, value, usage) 91 | } 92 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/int64.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // -- int64 Value 9 | type int64Value int64 10 | 11 | func newInt64Value(val int64, p *int64) *int64Value { 12 | *p = val 13 | return (*int64Value)(p) 14 | } 15 | 16 | func (i *int64Value) Set(s string) error { 17 | v, err := strconv.ParseInt(s, 0, 64) 18 | *i = int64Value(v) 19 | return err 20 | } 21 | 22 | func (i *int64Value) Type() string { 23 | return "int64" 24 | } 25 | 26 | func (i *int64Value) String() string { return fmt.Sprintf("%v", *i) } 27 | 28 | func int64Conv(sval string) (interface{}, error) { 29 | return strconv.ParseInt(sval, 0, 64) 30 | } 31 | 32 | // GetInt64 return the int64 value of a flag with the given name 33 | func (f *FlagSet) GetInt64(name string) (int64, error) { 34 | val, err := f.getFlagType(name, "int64", int64Conv) 35 | if err != nil { 36 | return 0, err 37 | } 38 | return val.(int64), nil 39 | } 40 | 41 | // Int64Var defines an int64 flag with specified name, default value, and usage string. 42 | // The argument p points to an int64 variable in which to store the value of the flag. 43 | func (f *FlagSet) Int64Var(p *int64, name string, value int64, usage string) { 44 | f.VarP(newInt64Value(value, p), name, "", usage) 45 | } 46 | 47 | // Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash. 48 | func (f *FlagSet) Int64VarP(p *int64, name, shorthand string, value int64, usage string) { 49 | f.VarP(newInt64Value(value, p), name, shorthand, usage) 50 | } 51 | 52 | // Int64Var defines an int64 flag with specified name, default value, and usage string. 53 | // The argument p points to an int64 variable in which to store the value of the flag. 54 | func Int64Var(p *int64, name string, value int64, usage string) { 55 | CommandLine.VarP(newInt64Value(value, p), name, "", usage) 56 | } 57 | 58 | // Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash. 59 | func Int64VarP(p *int64, name, shorthand string, value int64, usage string) { 60 | CommandLine.VarP(newInt64Value(value, p), name, shorthand, usage) 61 | } 62 | 63 | // Int64 defines an int64 flag with specified name, default value, and usage string. 64 | // The return value is the address of an int64 variable that stores the value of the flag. 65 | func (f *FlagSet) Int64(name string, value int64, usage string) *int64 { 66 | p := new(int64) 67 | f.Int64VarP(p, name, "", value, usage) 68 | return p 69 | } 70 | 71 | // Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash. 72 | func (f *FlagSet) Int64P(name, shorthand string, value int64, usage string) *int64 { 73 | p := new(int64) 74 | f.Int64VarP(p, name, shorthand, value, usage) 75 | return p 76 | } 77 | 78 | // Int64 defines an int64 flag with specified name, default value, and usage string. 79 | // The return value is the address of an int64 variable that stores the value of the flag. 80 | func Int64(name string, value int64, usage string) *int64 { 81 | return CommandLine.Int64P(name, "", value, usage) 82 | } 83 | 84 | // Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash. 85 | func Int64P(name, shorthand string, value int64, usage string) *int64 { 86 | return CommandLine.Int64P(name, shorthand, value, usage) 87 | } 88 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/int8.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // -- int8 Value 9 | type int8Value int8 10 | 11 | func newInt8Value(val int8, p *int8) *int8Value { 12 | *p = val 13 | return (*int8Value)(p) 14 | } 15 | 16 | func (i *int8Value) Set(s string) error { 17 | v, err := strconv.ParseInt(s, 0, 8) 18 | *i = int8Value(v) 19 | return err 20 | } 21 | 22 | func (i *int8Value) Type() string { 23 | return "int8" 24 | } 25 | 26 | func (i *int8Value) String() string { return fmt.Sprintf("%v", *i) } 27 | 28 | func int8Conv(sval string) (interface{}, error) { 29 | v, err := strconv.ParseInt(sval, 0, 8) 30 | if err != nil { 31 | return 0, err 32 | } 33 | return int8(v), nil 34 | } 35 | 36 | // GetInt8 return the int8 value of a flag with the given name 37 | func (f *FlagSet) GetInt8(name string) (int8, error) { 38 | val, err := f.getFlagType(name, "int8", int8Conv) 39 | if err != nil { 40 | return 0, err 41 | } 42 | return val.(int8), nil 43 | } 44 | 45 | // Int8Var defines an int8 flag with specified name, default value, and usage string. 46 | // The argument p points to an int8 variable in which to store the value of the flag. 47 | func (f *FlagSet) Int8Var(p *int8, name string, value int8, usage string) { 48 | f.VarP(newInt8Value(value, p), name, "", usage) 49 | } 50 | 51 | // Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash. 52 | func (f *FlagSet) Int8VarP(p *int8, name, shorthand string, value int8, usage string) { 53 | f.VarP(newInt8Value(value, p), name, shorthand, usage) 54 | } 55 | 56 | // Int8Var defines an int8 flag with specified name, default value, and usage string. 57 | // The argument p points to an int8 variable in which to store the value of the flag. 58 | func Int8Var(p *int8, name string, value int8, usage string) { 59 | CommandLine.VarP(newInt8Value(value, p), name, "", usage) 60 | } 61 | 62 | // Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash. 63 | func Int8VarP(p *int8, name, shorthand string, value int8, usage string) { 64 | CommandLine.VarP(newInt8Value(value, p), name, shorthand, usage) 65 | } 66 | 67 | // Int8 defines an int8 flag with specified name, default value, and usage string. 68 | // The return value is the address of an int8 variable that stores the value of the flag. 69 | func (f *FlagSet) Int8(name string, value int8, usage string) *int8 { 70 | p := new(int8) 71 | f.Int8VarP(p, name, "", value, usage) 72 | return p 73 | } 74 | 75 | // Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash. 76 | func (f *FlagSet) Int8P(name, shorthand string, value int8, usage string) *int8 { 77 | p := new(int8) 78 | f.Int8VarP(p, name, shorthand, value, usage) 79 | return p 80 | } 81 | 82 | // Int8 defines an int8 flag with specified name, default value, and usage string. 83 | // The return value is the address of an int8 variable that stores the value of the flag. 84 | func Int8(name string, value int8, usage string) *int8 { 85 | return CommandLine.Int8P(name, "", value, usage) 86 | } 87 | 88 | // Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash. 89 | func Int8P(name, shorthand string, value int8, usage string) *int8 { 90 | return CommandLine.Int8P(name, shorthand, value, usage) 91 | } 92 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/int_slice.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | "strings" 7 | ) 8 | 9 | // -- intSlice Value 10 | type intSliceValue struct { 11 | value *[]int 12 | changed bool 13 | } 14 | 15 | func newIntSliceValue(val []int, p *[]int) *intSliceValue { 16 | isv := new(intSliceValue) 17 | isv.value = p 18 | *isv.value = val 19 | return isv 20 | } 21 | 22 | func (s *intSliceValue) Set(val string) error { 23 | ss := strings.Split(val, ",") 24 | out := make([]int, len(ss)) 25 | for i, d := range ss { 26 | var err error 27 | out[i], err = strconv.Atoi(d) 28 | if err != nil { 29 | return err 30 | } 31 | 32 | } 33 | if !s.changed { 34 | *s.value = out 35 | } else { 36 | *s.value = append(*s.value, out...) 37 | } 38 | s.changed = true 39 | return nil 40 | } 41 | 42 | func (s *intSliceValue) Type() string { 43 | return "intSlice" 44 | } 45 | 46 | func (s *intSliceValue) String() string { 47 | out := make([]string, len(*s.value)) 48 | for i, d := range *s.value { 49 | out[i] = fmt.Sprintf("%d", d) 50 | } 51 | return "[" + strings.Join(out, ",") + "]" 52 | } 53 | 54 | func intSliceConv(val string) (interface{}, error) { 55 | val = strings.Trim(val, "[]") 56 | // Empty string would cause a slice with one (empty) entry 57 | if len(val) == 0 { 58 | return []int{}, nil 59 | } 60 | ss := strings.Split(val, ",") 61 | out := make([]int, len(ss)) 62 | for i, d := range ss { 63 | var err error 64 | out[i], err = strconv.Atoi(d) 65 | if err != nil { 66 | return nil, err 67 | } 68 | 69 | } 70 | return out, nil 71 | } 72 | 73 | // GetIntSlice return the []int value of a flag with the given name 74 | func (f *FlagSet) GetIntSlice(name string) ([]int, error) { 75 | val, err := f.getFlagType(name, "intSlice", intSliceConv) 76 | if err != nil { 77 | return []int{}, err 78 | } 79 | return val.([]int), nil 80 | } 81 | 82 | // IntSliceVar defines a intSlice flag with specified name, default value, and usage string. 83 | // The argument p points to a []int variable in which to store the value of the flag. 84 | func (f *FlagSet) IntSliceVar(p *[]int, name string, value []int, usage string) { 85 | f.VarP(newIntSliceValue(value, p), name, "", usage) 86 | } 87 | 88 | // IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash. 89 | func (f *FlagSet) IntSliceVarP(p *[]int, name, shorthand string, value []int, usage string) { 90 | f.VarP(newIntSliceValue(value, p), name, shorthand, usage) 91 | } 92 | 93 | // IntSliceVar defines a int[] flag with specified name, default value, and usage string. 94 | // The argument p points to a int[] variable in which to store the value of the flag. 95 | func IntSliceVar(p *[]int, name string, value []int, usage string) { 96 | CommandLine.VarP(newIntSliceValue(value, p), name, "", usage) 97 | } 98 | 99 | // IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash. 100 | func IntSliceVarP(p *[]int, name, shorthand string, value []int, usage string) { 101 | CommandLine.VarP(newIntSliceValue(value, p), name, shorthand, usage) 102 | } 103 | 104 | // IntSlice defines a []int flag with specified name, default value, and usage string. 105 | // The return value is the address of a []int variable that stores the value of the flag. 106 | func (f *FlagSet) IntSlice(name string, value []int, usage string) *[]int { 107 | p := []int{} 108 | f.IntSliceVarP(&p, name, "", value, usage) 109 | return &p 110 | } 111 | 112 | // IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash. 113 | func (f *FlagSet) IntSliceP(name, shorthand string, value []int, usage string) *[]int { 114 | p := []int{} 115 | f.IntSliceVarP(&p, name, shorthand, value, usage) 116 | return &p 117 | } 118 | 119 | // IntSlice defines a []int flag with specified name, default value, and usage string. 120 | // The return value is the address of a []int variable that stores the value of the flag. 121 | func IntSlice(name string, value []int, usage string) *[]int { 122 | return CommandLine.IntSliceP(name, "", value, usage) 123 | } 124 | 125 | // IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash. 126 | func IntSliceP(name, shorthand string, value []int, usage string) *[]int { 127 | return CommandLine.IntSliceP(name, shorthand, value, usage) 128 | } 129 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/ip.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | "strings" 7 | ) 8 | 9 | var _ = strings.TrimSpace 10 | 11 | // -- net.IP value 12 | type ipValue net.IP 13 | 14 | func newIPValue(val net.IP, p *net.IP) *ipValue { 15 | *p = val 16 | return (*ipValue)(p) 17 | } 18 | 19 | func (i *ipValue) String() string { return net.IP(*i).String() } 20 | func (i *ipValue) Set(s string) error { 21 | ip := net.ParseIP(strings.TrimSpace(s)) 22 | if ip == nil { 23 | return fmt.Errorf("failed to parse IP: %q", s) 24 | } 25 | *i = ipValue(ip) 26 | return nil 27 | } 28 | 29 | func (i *ipValue) Type() string { 30 | return "ip" 31 | } 32 | 33 | func ipConv(sval string) (interface{}, error) { 34 | ip := net.ParseIP(sval) 35 | if ip != nil { 36 | return ip, nil 37 | } 38 | return nil, fmt.Errorf("invalid string being converted to IP address: %s", sval) 39 | } 40 | 41 | // GetIP return the net.IP value of a flag with the given name 42 | func (f *FlagSet) GetIP(name string) (net.IP, error) { 43 | val, err := f.getFlagType(name, "ip", ipConv) 44 | if err != nil { 45 | return nil, err 46 | } 47 | return val.(net.IP), nil 48 | } 49 | 50 | // IPVar defines an net.IP flag with specified name, default value, and usage string. 51 | // The argument p points to an net.IP variable in which to store the value of the flag. 52 | func (f *FlagSet) IPVar(p *net.IP, name string, value net.IP, usage string) { 53 | f.VarP(newIPValue(value, p), name, "", usage) 54 | } 55 | 56 | // IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash. 57 | func (f *FlagSet) IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) { 58 | f.VarP(newIPValue(value, p), name, shorthand, usage) 59 | } 60 | 61 | // IPVar defines an net.IP flag with specified name, default value, and usage string. 62 | // The argument p points to an net.IP variable in which to store the value of the flag. 63 | func IPVar(p *net.IP, name string, value net.IP, usage string) { 64 | CommandLine.VarP(newIPValue(value, p), name, "", usage) 65 | } 66 | 67 | // IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash. 68 | func IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) { 69 | CommandLine.VarP(newIPValue(value, p), name, shorthand, usage) 70 | } 71 | 72 | // IP defines an net.IP flag with specified name, default value, and usage string. 73 | // The return value is the address of an net.IP variable that stores the value of the flag. 74 | func (f *FlagSet) IP(name string, value net.IP, usage string) *net.IP { 75 | p := new(net.IP) 76 | f.IPVarP(p, name, "", value, usage) 77 | return p 78 | } 79 | 80 | // IPP is like IP, but accepts a shorthand letter that can be used after a single dash. 81 | func (f *FlagSet) IPP(name, shorthand string, value net.IP, usage string) *net.IP { 82 | p := new(net.IP) 83 | f.IPVarP(p, name, shorthand, value, usage) 84 | return p 85 | } 86 | 87 | // IP defines an net.IP flag with specified name, default value, and usage string. 88 | // The return value is the address of an net.IP variable that stores the value of the flag. 89 | func IP(name string, value net.IP, usage string) *net.IP { 90 | return CommandLine.IPP(name, "", value, usage) 91 | } 92 | 93 | // IPP is like IP, but accepts a shorthand letter that can be used after a single dash. 94 | func IPP(name, shorthand string, value net.IP, usage string) *net.IP { 95 | return CommandLine.IPP(name, shorthand, value, usage) 96 | } 97 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/ipmask.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | "strconv" 7 | ) 8 | 9 | // -- net.IPMask value 10 | type ipMaskValue net.IPMask 11 | 12 | func newIPMaskValue(val net.IPMask, p *net.IPMask) *ipMaskValue { 13 | *p = val 14 | return (*ipMaskValue)(p) 15 | } 16 | 17 | func (i *ipMaskValue) String() string { return net.IPMask(*i).String() } 18 | func (i *ipMaskValue) Set(s string) error { 19 | ip := ParseIPv4Mask(s) 20 | if ip == nil { 21 | return fmt.Errorf("failed to parse IP mask: %q", s) 22 | } 23 | *i = ipMaskValue(ip) 24 | return nil 25 | } 26 | 27 | func (i *ipMaskValue) Type() string { 28 | return "ipMask" 29 | } 30 | 31 | // ParseIPv4Mask written in IP form (e.g. 255.255.255.0). 32 | // This function should really belong to the net package. 33 | func ParseIPv4Mask(s string) net.IPMask { 34 | mask := net.ParseIP(s) 35 | if mask == nil { 36 | if len(s) != 8 { 37 | return nil 38 | } 39 | // net.IPMask.String() actually outputs things like ffffff00 40 | // so write a horrible parser for that as well :-( 41 | m := []int{} 42 | for i := 0; i < 4; i++ { 43 | b := "0x" + s[2*i:2*i+2] 44 | d, err := strconv.ParseInt(b, 0, 0) 45 | if err != nil { 46 | return nil 47 | } 48 | m = append(m, int(d)) 49 | } 50 | s := fmt.Sprintf("%d.%d.%d.%d", m[0], m[1], m[2], m[3]) 51 | mask = net.ParseIP(s) 52 | if mask == nil { 53 | return nil 54 | } 55 | } 56 | return net.IPv4Mask(mask[12], mask[13], mask[14], mask[15]) 57 | } 58 | 59 | func parseIPv4Mask(sval string) (interface{}, error) { 60 | mask := ParseIPv4Mask(sval) 61 | if mask == nil { 62 | return nil, fmt.Errorf("unable to parse %s as net.IPMask", sval) 63 | } 64 | return mask, nil 65 | } 66 | 67 | // GetIPv4Mask return the net.IPv4Mask value of a flag with the given name 68 | func (f *FlagSet) GetIPv4Mask(name string) (net.IPMask, error) { 69 | val, err := f.getFlagType(name, "ipMask", parseIPv4Mask) 70 | if err != nil { 71 | return nil, err 72 | } 73 | return val.(net.IPMask), nil 74 | } 75 | 76 | // IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string. 77 | // The argument p points to an net.IPMask variable in which to store the value of the flag. 78 | func (f *FlagSet) IPMaskVar(p *net.IPMask, name string, value net.IPMask, usage string) { 79 | f.VarP(newIPMaskValue(value, p), name, "", usage) 80 | } 81 | 82 | // IPMaskVarP is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash. 83 | func (f *FlagSet) IPMaskVarP(p *net.IPMask, name, shorthand string, value net.IPMask, usage string) { 84 | f.VarP(newIPMaskValue(value, p), name, shorthand, usage) 85 | } 86 | 87 | // IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string. 88 | // The argument p points to an net.IPMask variable in which to store the value of the flag. 89 | func IPMaskVar(p *net.IPMask, name string, value net.IPMask, usage string) { 90 | CommandLine.VarP(newIPMaskValue(value, p), name, "", usage) 91 | } 92 | 93 | // IPMaskVarP is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash. 94 | func IPMaskVarP(p *net.IPMask, name, shorthand string, value net.IPMask, usage string) { 95 | CommandLine.VarP(newIPMaskValue(value, p), name, shorthand, usage) 96 | } 97 | 98 | // IPMask defines an net.IPMask flag with specified name, default value, and usage string. 99 | // The return value is the address of an net.IPMask variable that stores the value of the flag. 100 | func (f *FlagSet) IPMask(name string, value net.IPMask, usage string) *net.IPMask { 101 | p := new(net.IPMask) 102 | f.IPMaskVarP(p, name, "", value, usage) 103 | return p 104 | } 105 | 106 | // IPMaskP is like IPMask, but accepts a shorthand letter that can be used after a single dash. 107 | func (f *FlagSet) IPMaskP(name, shorthand string, value net.IPMask, usage string) *net.IPMask { 108 | p := new(net.IPMask) 109 | f.IPMaskVarP(p, name, shorthand, value, usage) 110 | return p 111 | } 112 | 113 | // IPMask defines an net.IPMask flag with specified name, default value, and usage string. 114 | // The return value is the address of an net.IPMask variable that stores the value of the flag. 115 | func IPMask(name string, value net.IPMask, usage string) *net.IPMask { 116 | return CommandLine.IPMaskP(name, "", value, usage) 117 | } 118 | 119 | // IPMaskP is like IP, but accepts a shorthand letter that can be used after a single dash. 120 | func IPMaskP(name, shorthand string, value net.IPMask, usage string) *net.IPMask { 121 | return CommandLine.IPMaskP(name, shorthand, value, usage) 122 | } 123 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/ipnet.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | "strings" 7 | ) 8 | 9 | // IPNet adapts net.IPNet for use as a flag. 10 | type ipNetValue net.IPNet 11 | 12 | func (ipnet ipNetValue) String() string { 13 | n := net.IPNet(ipnet) 14 | return n.String() 15 | } 16 | 17 | func (ipnet *ipNetValue) Set(value string) error { 18 | _, n, err := net.ParseCIDR(strings.TrimSpace(value)) 19 | if err != nil { 20 | return err 21 | } 22 | *ipnet = ipNetValue(*n) 23 | return nil 24 | } 25 | 26 | func (*ipNetValue) Type() string { 27 | return "ipNet" 28 | } 29 | 30 | var _ = strings.TrimSpace 31 | 32 | func newIPNetValue(val net.IPNet, p *net.IPNet) *ipNetValue { 33 | *p = val 34 | return (*ipNetValue)(p) 35 | } 36 | 37 | func ipNetConv(sval string) (interface{}, error) { 38 | _, n, err := net.ParseCIDR(strings.TrimSpace(sval)) 39 | if err == nil { 40 | return *n, nil 41 | } 42 | return nil, fmt.Errorf("invalid string being converted to IPNet: %s", sval) 43 | } 44 | 45 | // GetIPNet return the net.IPNet value of a flag with the given name 46 | func (f *FlagSet) GetIPNet(name string) (net.IPNet, error) { 47 | val, err := f.getFlagType(name, "ipNet", ipNetConv) 48 | if err != nil { 49 | return net.IPNet{}, err 50 | } 51 | return val.(net.IPNet), nil 52 | } 53 | 54 | // IPNetVar defines an net.IPNet flag with specified name, default value, and usage string. 55 | // The argument p points to an net.IPNet variable in which to store the value of the flag. 56 | func (f *FlagSet) IPNetVar(p *net.IPNet, name string, value net.IPNet, usage string) { 57 | f.VarP(newIPNetValue(value, p), name, "", usage) 58 | } 59 | 60 | // IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash. 61 | func (f *FlagSet) IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) { 62 | f.VarP(newIPNetValue(value, p), name, shorthand, usage) 63 | } 64 | 65 | // IPNetVar defines an net.IPNet flag with specified name, default value, and usage string. 66 | // The argument p points to an net.IPNet variable in which to store the value of the flag. 67 | func IPNetVar(p *net.IPNet, name string, value net.IPNet, usage string) { 68 | CommandLine.VarP(newIPNetValue(value, p), name, "", usage) 69 | } 70 | 71 | // IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash. 72 | func IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) { 73 | CommandLine.VarP(newIPNetValue(value, p), name, shorthand, usage) 74 | } 75 | 76 | // IPNet defines an net.IPNet flag with specified name, default value, and usage string. 77 | // The return value is the address of an net.IPNet variable that stores the value of the flag. 78 | func (f *FlagSet) IPNet(name string, value net.IPNet, usage string) *net.IPNet { 79 | p := new(net.IPNet) 80 | f.IPNetVarP(p, name, "", value, usage) 81 | return p 82 | } 83 | 84 | // IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash. 85 | func (f *FlagSet) IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet { 86 | p := new(net.IPNet) 87 | f.IPNetVarP(p, name, shorthand, value, usage) 88 | return p 89 | } 90 | 91 | // IPNet defines an net.IPNet flag with specified name, default value, and usage string. 92 | // The return value is the address of an net.IPNet variable that stores the value of the flag. 93 | func IPNet(name string, value net.IPNet, usage string) *net.IPNet { 94 | return CommandLine.IPNetP(name, "", value, usage) 95 | } 96 | 97 | // IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash. 98 | func IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet { 99 | return CommandLine.IPNetP(name, shorthand, value, usage) 100 | } 101 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/string.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import "fmt" 4 | 5 | // -- string Value 6 | type stringValue string 7 | 8 | func newStringValue(val string, p *string) *stringValue { 9 | *p = val 10 | return (*stringValue)(p) 11 | } 12 | 13 | func (s *stringValue) Set(val string) error { 14 | *s = stringValue(val) 15 | return nil 16 | } 17 | func (s *stringValue) Type() string { 18 | return "string" 19 | } 20 | 21 | func (s *stringValue) String() string { return fmt.Sprintf("%s", *s) } 22 | 23 | func stringConv(sval string) (interface{}, error) { 24 | return sval, nil 25 | } 26 | 27 | // GetString return the string value of a flag with the given name 28 | func (f *FlagSet) GetString(name string) (string, error) { 29 | val, err := f.getFlagType(name, "string", stringConv) 30 | if err != nil { 31 | return "", err 32 | } 33 | return val.(string), nil 34 | } 35 | 36 | // StringVar defines a string flag with specified name, default value, and usage string. 37 | // The argument p points to a string variable in which to store the value of the flag. 38 | func (f *FlagSet) StringVar(p *string, name string, value string, usage string) { 39 | f.VarP(newStringValue(value, p), name, "", usage) 40 | } 41 | 42 | // StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash. 43 | func (f *FlagSet) StringVarP(p *string, name, shorthand string, value string, usage string) { 44 | f.VarP(newStringValue(value, p), name, shorthand, usage) 45 | } 46 | 47 | // StringVar defines a string flag with specified name, default value, and usage string. 48 | // The argument p points to a string variable in which to store the value of the flag. 49 | func StringVar(p *string, name string, value string, usage string) { 50 | CommandLine.VarP(newStringValue(value, p), name, "", usage) 51 | } 52 | 53 | // StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash. 54 | func StringVarP(p *string, name, shorthand string, value string, usage string) { 55 | CommandLine.VarP(newStringValue(value, p), name, shorthand, usage) 56 | } 57 | 58 | // String defines a string flag with specified name, default value, and usage string. 59 | // The return value is the address of a string variable that stores the value of the flag. 60 | func (f *FlagSet) String(name string, value string, usage string) *string { 61 | p := new(string) 62 | f.StringVarP(p, name, "", value, usage) 63 | return p 64 | } 65 | 66 | // StringP is like String, but accepts a shorthand letter that can be used after a single dash. 67 | func (f *FlagSet) StringP(name, shorthand string, value string, usage string) *string { 68 | p := new(string) 69 | f.StringVarP(p, name, shorthand, value, usage) 70 | return p 71 | } 72 | 73 | // String defines a string flag with specified name, default value, and usage string. 74 | // The return value is the address of a string variable that stores the value of the flag. 75 | func String(name string, value string, usage string) *string { 76 | return CommandLine.StringP(name, "", value, usage) 77 | } 78 | 79 | // StringP is like String, but accepts a shorthand letter that can be used after a single dash. 80 | func StringP(name, shorthand string, value string, usage string) *string { 81 | return CommandLine.StringP(name, shorthand, value, usage) 82 | } 83 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/string_array.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | var _ = fmt.Fprint 9 | 10 | // -- stringArray Value 11 | type stringArrayValue struct { 12 | value *[]string 13 | changed bool 14 | } 15 | 16 | func newStringArrayValue(val []string, p *[]string) *stringArrayValue { 17 | ssv := new(stringArrayValue) 18 | ssv.value = p 19 | *ssv.value = val 20 | return ssv 21 | } 22 | 23 | func (s *stringArrayValue) Set(val string) error { 24 | if !s.changed { 25 | *s.value = []string{val} 26 | s.changed = true 27 | } else { 28 | *s.value = append(*s.value, val) 29 | } 30 | return nil 31 | } 32 | 33 | func (s *stringArrayValue) Type() string { 34 | return "stringArray" 35 | } 36 | 37 | func (s *stringArrayValue) String() string { 38 | str, _ := writeAsCSV(*s.value) 39 | return "[" + str + "]" 40 | } 41 | 42 | func stringArrayConv(sval string) (interface{}, error) { 43 | sval = strings.Trim(sval, "[]") 44 | // An empty string would cause a array with one (empty) string 45 | if len(sval) == 0 { 46 | return []string{}, nil 47 | } 48 | return readAsCSV(sval) 49 | } 50 | 51 | // GetStringArray return the []string value of a flag with the given name 52 | func (f *FlagSet) GetStringArray(name string) ([]string, error) { 53 | val, err := f.getFlagType(name, "stringArray", stringArrayConv) 54 | if err != nil { 55 | return []string{}, err 56 | } 57 | return val.([]string), nil 58 | } 59 | 60 | // StringArrayVar defines a string flag with specified name, default value, and usage string. 61 | // The argument p points to a []string variable in which to store the values of the multiple flags. 62 | // The value of each argument will not try to be separated by comma 63 | func (f *FlagSet) StringArrayVar(p *[]string, name string, value []string, usage string) { 64 | f.VarP(newStringArrayValue(value, p), name, "", usage) 65 | } 66 | 67 | // StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash. 68 | func (f *FlagSet) StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) { 69 | f.VarP(newStringArrayValue(value, p), name, shorthand, usage) 70 | } 71 | 72 | // StringArrayVar defines a string flag with specified name, default value, and usage string. 73 | // The argument p points to a []string variable in which to store the value of the flag. 74 | // The value of each argument will not try to be separated by comma 75 | func StringArrayVar(p *[]string, name string, value []string, usage string) { 76 | CommandLine.VarP(newStringArrayValue(value, p), name, "", usage) 77 | } 78 | 79 | // StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash. 80 | func StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) { 81 | CommandLine.VarP(newStringArrayValue(value, p), name, shorthand, usage) 82 | } 83 | 84 | // StringArray defines a string flag with specified name, default value, and usage string. 85 | // The return value is the address of a []string variable that stores the value of the flag. 86 | // The value of each argument will not try to be separated by comma 87 | func (f *FlagSet) StringArray(name string, value []string, usage string) *[]string { 88 | p := []string{} 89 | f.StringArrayVarP(&p, name, "", value, usage) 90 | return &p 91 | } 92 | 93 | // StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash. 94 | func (f *FlagSet) StringArrayP(name, shorthand string, value []string, usage string) *[]string { 95 | p := []string{} 96 | f.StringArrayVarP(&p, name, shorthand, value, usage) 97 | return &p 98 | } 99 | 100 | // StringArray defines a string flag with specified name, default value, and usage string. 101 | // The return value is the address of a []string variable that stores the value of the flag. 102 | // The value of each argument will not try to be separated by comma 103 | func StringArray(name string, value []string, usage string) *[]string { 104 | return CommandLine.StringArrayP(name, "", value, usage) 105 | } 106 | 107 | // StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash. 108 | func StringArrayP(name, shorthand string, value []string, usage string) *[]string { 109 | return CommandLine.StringArrayP(name, shorthand, value, usage) 110 | } 111 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/string_slice.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "bytes" 5 | "encoding/csv" 6 | "fmt" 7 | "strings" 8 | ) 9 | 10 | var _ = fmt.Fprint 11 | 12 | // -- stringSlice Value 13 | type stringSliceValue struct { 14 | value *[]string 15 | changed bool 16 | } 17 | 18 | func newStringSliceValue(val []string, p *[]string) *stringSliceValue { 19 | ssv := new(stringSliceValue) 20 | ssv.value = p 21 | *ssv.value = val 22 | return ssv 23 | } 24 | 25 | func readAsCSV(val string) ([]string, error) { 26 | if val == "" { 27 | return []string{}, nil 28 | } 29 | stringReader := strings.NewReader(val) 30 | csvReader := csv.NewReader(stringReader) 31 | return csvReader.Read() 32 | } 33 | 34 | func writeAsCSV(vals []string) (string, error) { 35 | b := &bytes.Buffer{} 36 | w := csv.NewWriter(b) 37 | err := w.Write(vals) 38 | if err != nil { 39 | return "", err 40 | } 41 | w.Flush() 42 | return strings.TrimSuffix(b.String(), fmt.Sprintln()), nil 43 | } 44 | 45 | func (s *stringSliceValue) Set(val string) error { 46 | v, err := readAsCSV(val) 47 | if err != nil { 48 | return err 49 | } 50 | if !s.changed { 51 | *s.value = v 52 | } else { 53 | *s.value = append(*s.value, v...) 54 | } 55 | s.changed = true 56 | return nil 57 | } 58 | 59 | func (s *stringSliceValue) Type() string { 60 | return "stringSlice" 61 | } 62 | 63 | func (s *stringSliceValue) String() string { 64 | str, _ := writeAsCSV(*s.value) 65 | return "[" + str + "]" 66 | } 67 | 68 | func stringSliceConv(sval string) (interface{}, error) { 69 | sval = strings.Trim(sval, "[]") 70 | // An empty string would cause a slice with one (empty) string 71 | if len(sval) == 0 { 72 | return []string{}, nil 73 | } 74 | return readAsCSV(sval) 75 | } 76 | 77 | // GetStringSlice return the []string value of a flag with the given name 78 | func (f *FlagSet) GetStringSlice(name string) ([]string, error) { 79 | val, err := f.getFlagType(name, "stringSlice", stringSliceConv) 80 | if err != nil { 81 | return []string{}, err 82 | } 83 | return val.([]string), nil 84 | } 85 | 86 | // StringSliceVar defines a string flag with specified name, default value, and usage string. 87 | // The argument p points to a []string variable in which to store the value of the flag. 88 | func (f *FlagSet) StringSliceVar(p *[]string, name string, value []string, usage string) { 89 | f.VarP(newStringSliceValue(value, p), name, "", usage) 90 | } 91 | 92 | // StringSliceVarP is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash. 93 | func (f *FlagSet) StringSliceVarP(p *[]string, name, shorthand string, value []string, usage string) { 94 | f.VarP(newStringSliceValue(value, p), name, shorthand, usage) 95 | } 96 | 97 | // StringSliceVar defines a string flag with specified name, default value, and usage string. 98 | // The argument p points to a []string variable in which to store the value of the flag. 99 | func StringSliceVar(p *[]string, name string, value []string, usage string) { 100 | CommandLine.VarP(newStringSliceValue(value, p), name, "", usage) 101 | } 102 | 103 | // StringSliceVarP is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash. 104 | func StringSliceVarP(p *[]string, name, shorthand string, value []string, usage string) { 105 | CommandLine.VarP(newStringSliceValue(value, p), name, shorthand, usage) 106 | } 107 | 108 | // StringSlice defines a string flag with specified name, default value, and usage string. 109 | // The return value is the address of a []string variable that stores the value of the flag. 110 | func (f *FlagSet) StringSlice(name string, value []string, usage string) *[]string { 111 | p := []string{} 112 | f.StringSliceVarP(&p, name, "", value, usage) 113 | return &p 114 | } 115 | 116 | // StringSliceP is like StringSlice, but accepts a shorthand letter that can be used after a single dash. 117 | func (f *FlagSet) StringSliceP(name, shorthand string, value []string, usage string) *[]string { 118 | p := []string{} 119 | f.StringSliceVarP(&p, name, shorthand, value, usage) 120 | return &p 121 | } 122 | 123 | // StringSlice defines a string flag with specified name, default value, and usage string. 124 | // The return value is the address of a []string variable that stores the value of the flag. 125 | func StringSlice(name string, value []string, usage string) *[]string { 126 | return CommandLine.StringSliceP(name, "", value, usage) 127 | } 128 | 129 | // StringSliceP is like StringSlice, but accepts a shorthand letter that can be used after a single dash. 130 | func StringSliceP(name, shorthand string, value []string, usage string) *[]string { 131 | return CommandLine.StringSliceP(name, shorthand, value, usage) 132 | } 133 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/uint.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // -- uint Value 9 | type uintValue uint 10 | 11 | func newUintValue(val uint, p *uint) *uintValue { 12 | *p = val 13 | return (*uintValue)(p) 14 | } 15 | 16 | func (i *uintValue) Set(s string) error { 17 | v, err := strconv.ParseUint(s, 0, 64) 18 | *i = uintValue(v) 19 | return err 20 | } 21 | 22 | func (i *uintValue) Type() string { 23 | return "uint" 24 | } 25 | 26 | func (i *uintValue) String() string { return fmt.Sprintf("%v", *i) } 27 | 28 | func uintConv(sval string) (interface{}, error) { 29 | v, err := strconv.ParseUint(sval, 0, 0) 30 | if err != nil { 31 | return 0, err 32 | } 33 | return uint(v), nil 34 | } 35 | 36 | // GetUint return the uint value of a flag with the given name 37 | func (f *FlagSet) GetUint(name string) (uint, error) { 38 | val, err := f.getFlagType(name, "uint", uintConv) 39 | if err != nil { 40 | return 0, err 41 | } 42 | return val.(uint), nil 43 | } 44 | 45 | // UintVar defines a uint flag with specified name, default value, and usage string. 46 | // The argument p points to a uint variable in which to store the value of the flag. 47 | func (f *FlagSet) UintVar(p *uint, name string, value uint, usage string) { 48 | f.VarP(newUintValue(value, p), name, "", usage) 49 | } 50 | 51 | // UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash. 52 | func (f *FlagSet) UintVarP(p *uint, name, shorthand string, value uint, usage string) { 53 | f.VarP(newUintValue(value, p), name, shorthand, usage) 54 | } 55 | 56 | // UintVar defines a uint flag with specified name, default value, and usage string. 57 | // The argument p points to a uint variable in which to store the value of the flag. 58 | func UintVar(p *uint, name string, value uint, usage string) { 59 | CommandLine.VarP(newUintValue(value, p), name, "", usage) 60 | } 61 | 62 | // UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash. 63 | func UintVarP(p *uint, name, shorthand string, value uint, usage string) { 64 | CommandLine.VarP(newUintValue(value, p), name, shorthand, usage) 65 | } 66 | 67 | // Uint defines a uint flag with specified name, default value, and usage string. 68 | // The return value is the address of a uint variable that stores the value of the flag. 69 | func (f *FlagSet) Uint(name string, value uint, usage string) *uint { 70 | p := new(uint) 71 | f.UintVarP(p, name, "", value, usage) 72 | return p 73 | } 74 | 75 | // UintP is like Uint, but accepts a shorthand letter that can be used after a single dash. 76 | func (f *FlagSet) UintP(name, shorthand string, value uint, usage string) *uint { 77 | p := new(uint) 78 | f.UintVarP(p, name, shorthand, value, usage) 79 | return p 80 | } 81 | 82 | // Uint defines a uint flag with specified name, default value, and usage string. 83 | // The return value is the address of a uint variable that stores the value of the flag. 84 | func Uint(name string, value uint, usage string) *uint { 85 | return CommandLine.UintP(name, "", value, usage) 86 | } 87 | 88 | // UintP is like Uint, but accepts a shorthand letter that can be used after a single dash. 89 | func UintP(name, shorthand string, value uint, usage string) *uint { 90 | return CommandLine.UintP(name, shorthand, value, usage) 91 | } 92 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/uint16.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // -- uint16 value 9 | type uint16Value uint16 10 | 11 | func newUint16Value(val uint16, p *uint16) *uint16Value { 12 | *p = val 13 | return (*uint16Value)(p) 14 | } 15 | func (i *uint16Value) String() string { return fmt.Sprintf("%d", *i) } 16 | func (i *uint16Value) Set(s string) error { 17 | v, err := strconv.ParseUint(s, 0, 16) 18 | *i = uint16Value(v) 19 | return err 20 | } 21 | 22 | func (i *uint16Value) Type() string { 23 | return "uint16" 24 | } 25 | 26 | func uint16Conv(sval string) (interface{}, error) { 27 | v, err := strconv.ParseUint(sval, 0, 16) 28 | if err != nil { 29 | return 0, err 30 | } 31 | return uint16(v), nil 32 | } 33 | 34 | // GetUint16 return the uint16 value of a flag with the given name 35 | func (f *FlagSet) GetUint16(name string) (uint16, error) { 36 | val, err := f.getFlagType(name, "uint16", uint16Conv) 37 | if err != nil { 38 | return 0, err 39 | } 40 | return val.(uint16), nil 41 | } 42 | 43 | // Uint16Var defines a uint flag with specified name, default value, and usage string. 44 | // The argument p points to a uint variable in which to store the value of the flag. 45 | func (f *FlagSet) Uint16Var(p *uint16, name string, value uint16, usage string) { 46 | f.VarP(newUint16Value(value, p), name, "", usage) 47 | } 48 | 49 | // Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash. 50 | func (f *FlagSet) Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) { 51 | f.VarP(newUint16Value(value, p), name, shorthand, usage) 52 | } 53 | 54 | // Uint16Var defines a uint flag with specified name, default value, and usage string. 55 | // The argument p points to a uint variable in which to store the value of the flag. 56 | func Uint16Var(p *uint16, name string, value uint16, usage string) { 57 | CommandLine.VarP(newUint16Value(value, p), name, "", usage) 58 | } 59 | 60 | // Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash. 61 | func Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) { 62 | CommandLine.VarP(newUint16Value(value, p), name, shorthand, usage) 63 | } 64 | 65 | // Uint16 defines a uint flag with specified name, default value, and usage string. 66 | // The return value is the address of a uint variable that stores the value of the flag. 67 | func (f *FlagSet) Uint16(name string, value uint16, usage string) *uint16 { 68 | p := new(uint16) 69 | f.Uint16VarP(p, name, "", value, usage) 70 | return p 71 | } 72 | 73 | // Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash. 74 | func (f *FlagSet) Uint16P(name, shorthand string, value uint16, usage string) *uint16 { 75 | p := new(uint16) 76 | f.Uint16VarP(p, name, shorthand, value, usage) 77 | return p 78 | } 79 | 80 | // Uint16 defines a uint flag with specified name, default value, and usage string. 81 | // The return value is the address of a uint variable that stores the value of the flag. 82 | func Uint16(name string, value uint16, usage string) *uint16 { 83 | return CommandLine.Uint16P(name, "", value, usage) 84 | } 85 | 86 | // Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash. 87 | func Uint16P(name, shorthand string, value uint16, usage string) *uint16 { 88 | return CommandLine.Uint16P(name, shorthand, value, usage) 89 | } 90 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/uint32.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // -- uint16 value 9 | type uint32Value uint32 10 | 11 | func newUint32Value(val uint32, p *uint32) *uint32Value { 12 | *p = val 13 | return (*uint32Value)(p) 14 | } 15 | func (i *uint32Value) String() string { return fmt.Sprintf("%d", *i) } 16 | func (i *uint32Value) Set(s string) error { 17 | v, err := strconv.ParseUint(s, 0, 32) 18 | *i = uint32Value(v) 19 | return err 20 | } 21 | 22 | func (i *uint32Value) Type() string { 23 | return "uint32" 24 | } 25 | 26 | func uint32Conv(sval string) (interface{}, error) { 27 | v, err := strconv.ParseUint(sval, 0, 32) 28 | if err != nil { 29 | return 0, err 30 | } 31 | return uint32(v), nil 32 | } 33 | 34 | // GetUint32 return the uint32 value of a flag with the given name 35 | func (f *FlagSet) GetUint32(name string) (uint32, error) { 36 | val, err := f.getFlagType(name, "uint32", uint32Conv) 37 | if err != nil { 38 | return 0, err 39 | } 40 | return val.(uint32), nil 41 | } 42 | 43 | // Uint32Var defines a uint32 flag with specified name, default value, and usage string. 44 | // The argument p points to a uint32 variable in which to store the value of the flag. 45 | func (f *FlagSet) Uint32Var(p *uint32, name string, value uint32, usage string) { 46 | f.VarP(newUint32Value(value, p), name, "", usage) 47 | } 48 | 49 | // Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash. 50 | func (f *FlagSet) Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) { 51 | f.VarP(newUint32Value(value, p), name, shorthand, usage) 52 | } 53 | 54 | // Uint32Var defines a uint32 flag with specified name, default value, and usage string. 55 | // The argument p points to a uint32 variable in which to store the value of the flag. 56 | func Uint32Var(p *uint32, name string, value uint32, usage string) { 57 | CommandLine.VarP(newUint32Value(value, p), name, "", usage) 58 | } 59 | 60 | // Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash. 61 | func Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) { 62 | CommandLine.VarP(newUint32Value(value, p), name, shorthand, usage) 63 | } 64 | 65 | // Uint32 defines a uint32 flag with specified name, default value, and usage string. 66 | // The return value is the address of a uint32 variable that stores the value of the flag. 67 | func (f *FlagSet) Uint32(name string, value uint32, usage string) *uint32 { 68 | p := new(uint32) 69 | f.Uint32VarP(p, name, "", value, usage) 70 | return p 71 | } 72 | 73 | // Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash. 74 | func (f *FlagSet) Uint32P(name, shorthand string, value uint32, usage string) *uint32 { 75 | p := new(uint32) 76 | f.Uint32VarP(p, name, shorthand, value, usage) 77 | return p 78 | } 79 | 80 | // Uint32 defines a uint32 flag with specified name, default value, and usage string. 81 | // The return value is the address of a uint32 variable that stores the value of the flag. 82 | func Uint32(name string, value uint32, usage string) *uint32 { 83 | return CommandLine.Uint32P(name, "", value, usage) 84 | } 85 | 86 | // Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash. 87 | func Uint32P(name, shorthand string, value uint32, usage string) *uint32 { 88 | return CommandLine.Uint32P(name, shorthand, value, usage) 89 | } 90 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/uint64.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // -- uint64 Value 9 | type uint64Value uint64 10 | 11 | func newUint64Value(val uint64, p *uint64) *uint64Value { 12 | *p = val 13 | return (*uint64Value)(p) 14 | } 15 | 16 | func (i *uint64Value) Set(s string) error { 17 | v, err := strconv.ParseUint(s, 0, 64) 18 | *i = uint64Value(v) 19 | return err 20 | } 21 | 22 | func (i *uint64Value) Type() string { 23 | return "uint64" 24 | } 25 | 26 | func (i *uint64Value) String() string { return fmt.Sprintf("%v", *i) } 27 | 28 | func uint64Conv(sval string) (interface{}, error) { 29 | v, err := strconv.ParseUint(sval, 0, 64) 30 | if err != nil { 31 | return 0, err 32 | } 33 | return uint64(v), nil 34 | } 35 | 36 | // GetUint64 return the uint64 value of a flag with the given name 37 | func (f *FlagSet) GetUint64(name string) (uint64, error) { 38 | val, err := f.getFlagType(name, "uint64", uint64Conv) 39 | if err != nil { 40 | return 0, err 41 | } 42 | return val.(uint64), nil 43 | } 44 | 45 | // Uint64Var defines a uint64 flag with specified name, default value, and usage string. 46 | // The argument p points to a uint64 variable in which to store the value of the flag. 47 | func (f *FlagSet) Uint64Var(p *uint64, name string, value uint64, usage string) { 48 | f.VarP(newUint64Value(value, p), name, "", usage) 49 | } 50 | 51 | // Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash. 52 | func (f *FlagSet) Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) { 53 | f.VarP(newUint64Value(value, p), name, shorthand, usage) 54 | } 55 | 56 | // Uint64Var defines a uint64 flag with specified name, default value, and usage string. 57 | // The argument p points to a uint64 variable in which to store the value of the flag. 58 | func Uint64Var(p *uint64, name string, value uint64, usage string) { 59 | CommandLine.VarP(newUint64Value(value, p), name, "", usage) 60 | } 61 | 62 | // Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash. 63 | func Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) { 64 | CommandLine.VarP(newUint64Value(value, p), name, shorthand, usage) 65 | } 66 | 67 | // Uint64 defines a uint64 flag with specified name, default value, and usage string. 68 | // The return value is the address of a uint64 variable that stores the value of the flag. 69 | func (f *FlagSet) Uint64(name string, value uint64, usage string) *uint64 { 70 | p := new(uint64) 71 | f.Uint64VarP(p, name, "", value, usage) 72 | return p 73 | } 74 | 75 | // Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash. 76 | func (f *FlagSet) Uint64P(name, shorthand string, value uint64, usage string) *uint64 { 77 | p := new(uint64) 78 | f.Uint64VarP(p, name, shorthand, value, usage) 79 | return p 80 | } 81 | 82 | // Uint64 defines a uint64 flag with specified name, default value, and usage string. 83 | // The return value is the address of a uint64 variable that stores the value of the flag. 84 | func Uint64(name string, value uint64, usage string) *uint64 { 85 | return CommandLine.Uint64P(name, "", value, usage) 86 | } 87 | 88 | // Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash. 89 | func Uint64P(name, shorthand string, value uint64, usage string) *uint64 { 90 | return CommandLine.Uint64P(name, shorthand, value, usage) 91 | } 92 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/uint8.go: -------------------------------------------------------------------------------- 1 | package pflag 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // -- uint8 Value 9 | type uint8Value uint8 10 | 11 | func newUint8Value(val uint8, p *uint8) *uint8Value { 12 | *p = val 13 | return (*uint8Value)(p) 14 | } 15 | 16 | func (i *uint8Value) Set(s string) error { 17 | v, err := strconv.ParseUint(s, 0, 8) 18 | *i = uint8Value(v) 19 | return err 20 | } 21 | 22 | func (i *uint8Value) Type() string { 23 | return "uint8" 24 | } 25 | 26 | func (i *uint8Value) String() string { return fmt.Sprintf("%v", *i) } 27 | 28 | func uint8Conv(sval string) (interface{}, error) { 29 | v, err := strconv.ParseUint(sval, 0, 8) 30 | if err != nil { 31 | return 0, err 32 | } 33 | return uint8(v), nil 34 | } 35 | 36 | // GetUint8 return the uint8 value of a flag with the given name 37 | func (f *FlagSet) GetUint8(name string) (uint8, error) { 38 | val, err := f.getFlagType(name, "uint8", uint8Conv) 39 | if err != nil { 40 | return 0, err 41 | } 42 | return val.(uint8), nil 43 | } 44 | 45 | // Uint8Var defines a uint8 flag with specified name, default value, and usage string. 46 | // The argument p points to a uint8 variable in which to store the value of the flag. 47 | func (f *FlagSet) Uint8Var(p *uint8, name string, value uint8, usage string) { 48 | f.VarP(newUint8Value(value, p), name, "", usage) 49 | } 50 | 51 | // Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash. 52 | func (f *FlagSet) Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) { 53 | f.VarP(newUint8Value(value, p), name, shorthand, usage) 54 | } 55 | 56 | // Uint8Var defines a uint8 flag with specified name, default value, and usage string. 57 | // The argument p points to a uint8 variable in which to store the value of the flag. 58 | func Uint8Var(p *uint8, name string, value uint8, usage string) { 59 | CommandLine.VarP(newUint8Value(value, p), name, "", usage) 60 | } 61 | 62 | // Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash. 63 | func Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) { 64 | CommandLine.VarP(newUint8Value(value, p), name, shorthand, usage) 65 | } 66 | 67 | // Uint8 defines a uint8 flag with specified name, default value, and usage string. 68 | // The return value is the address of a uint8 variable that stores the value of the flag. 69 | func (f *FlagSet) Uint8(name string, value uint8, usage string) *uint8 { 70 | p := new(uint8) 71 | f.Uint8VarP(p, name, "", value, usage) 72 | return p 73 | } 74 | 75 | // Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash. 76 | func (f *FlagSet) Uint8P(name, shorthand string, value uint8, usage string) *uint8 { 77 | p := new(uint8) 78 | f.Uint8VarP(p, name, shorthand, value, usage) 79 | return p 80 | } 81 | 82 | // Uint8 defines a uint8 flag with specified name, default value, and usage string. 83 | // The return value is the address of a uint8 variable that stores the value of the flag. 84 | func Uint8(name string, value uint8, usage string) *uint8 { 85 | return CommandLine.Uint8P(name, "", value, usage) 86 | } 87 | 88 | // Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash. 89 | func Uint8P(name, shorthand string, value uint8, usage string) *uint8 { 90 | return CommandLine.Uint8P(name, shorthand, value, usage) 91 | } 92 | -------------------------------------------------------------------------------- /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/stretchr/testify/assert/assertion_compare_can_convert.go: -------------------------------------------------------------------------------- 1 | //go:build go1.17 2 | // +build go1.17 3 | 4 | // TODO: once support for Go 1.16 is dropped, this file can be 5 | // merged/removed with assertion_compare_go1.17_test.go and 6 | // assertion_compare_legacy.go 7 | 8 | package assert 9 | 10 | import "reflect" 11 | 12 | // Wrapper around reflect.Value.CanConvert, for compatibility 13 | // reasons. 14 | func canConvert(value reflect.Value, to reflect.Type) bool { 15 | return value.CanConvert(to) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.17 2 | // +build !go1.17 3 | 4 | // TODO: once support for Go 1.16 is dropped, this file can be 5 | // merged/removed with assertion_compare_go1.17_test.go and 6 | // assertion_compare_can_convert.go 7 | 8 | package assert 9 | 10 | import "reflect" 11 | 12 | // Older versions of Go does not have the reflect.Value.CanConvert 13 | // method. 14 | func canConvert(value reflect.Value, to reflect.Type) bool { 15 | return false 16 | } 17 | -------------------------------------------------------------------------------- /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/stretchr/testify/assert/assertion_order.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | ) 7 | 8 | // isOrdered checks that collection contains orderable elements. 9 | func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool { 10 | objKind := reflect.TypeOf(object).Kind() 11 | if objKind != reflect.Slice && objKind != reflect.Array { 12 | return false 13 | } 14 | 15 | objValue := reflect.ValueOf(object) 16 | objLen := objValue.Len() 17 | 18 | if objLen <= 1 { 19 | return true 20 | } 21 | 22 | value := objValue.Index(0) 23 | valueInterface := value.Interface() 24 | firstValueKind := value.Kind() 25 | 26 | for i := 1; i < objLen; i++ { 27 | prevValue := value 28 | prevValueInterface := valueInterface 29 | 30 | value = objValue.Index(i) 31 | valueInterface = value.Interface() 32 | 33 | compareResult, isComparable := compare(prevValueInterface, valueInterface, firstValueKind) 34 | 35 | if !isComparable { 36 | return Fail(t, fmt.Sprintf("Can not compare type \"%s\" and \"%s\"", reflect.TypeOf(value), reflect.TypeOf(prevValue)), msgAndArgs...) 37 | } 38 | 39 | if !containsValue(allowedComparesResults, compareResult) { 40 | return Fail(t, fmt.Sprintf(failMessage, prevValue, value), msgAndArgs...) 41 | } 42 | } 43 | 44 | return true 45 | } 46 | 47 | // IsIncreasing asserts that the collection is increasing 48 | // 49 | // assert.IsIncreasing(t, []int{1, 2, 3}) 50 | // assert.IsIncreasing(t, []float{1, 2}) 51 | // assert.IsIncreasing(t, []string{"a", "b"}) 52 | func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { 53 | return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) 54 | } 55 | 56 | // IsNonIncreasing asserts that the collection is not increasing 57 | // 58 | // assert.IsNonIncreasing(t, []int{2, 1, 1}) 59 | // assert.IsNonIncreasing(t, []float{2, 1}) 60 | // assert.IsNonIncreasing(t, []string{"b", "a"}) 61 | func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { 62 | return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) 63 | } 64 | 65 | // IsDecreasing asserts that the collection is decreasing 66 | // 67 | // assert.IsDecreasing(t, []int{2, 1, 0}) 68 | // assert.IsDecreasing(t, []float{2, 1}) 69 | // assert.IsDecreasing(t, []string{"b", "a"}) 70 | func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { 71 | return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) 72 | } 73 | 74 | // IsNonDecreasing asserts that the collection is not decreasing 75 | // 76 | // assert.IsNonDecreasing(t, []int{1, 1, 2}) 77 | // assert.IsNonDecreasing(t, []float{1, 2}) 78 | // assert.IsNonDecreasing(t, []string{"a", "b"}) 79 | func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { 80 | return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) 81 | } 82 | -------------------------------------------------------------------------------- /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/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/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/golang.org/x/sys/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 http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/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 http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/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 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/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/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | TEXT ·use(SB),NOSPLIT,$0 10 | RET 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-64 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-88 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-112 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-64 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-88 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_386.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for 386, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·socketcall(SB),NOSPLIT,$0-36 29 | JMP syscall·socketcall(SB) 30 | 31 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 32 | JMP syscall·rawsocketcall(SB) 33 | 34 | TEXT ·seek(SB),NOSPLIT,$0-28 35 | JMP syscall·seek(SB) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 29 | JMP syscall·gettimeofday(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | B syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | B syscall·RawSyscall6(SB) 27 | 28 | TEXT ·seek(SB),NOSPLIT,$0-32 29 | B syscall·seek(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 21 | B syscall·RawSyscall(SB) 22 | 23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 24 | B syscall·RawSyscall6(SB) 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mips64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build linux 6 | // +build mips64 mips64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | JMP syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | JMP syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 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 | // +build linux 6 | // +build ppc64 ppc64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for ppc64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 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 | // +build s390x 6 | // +build linux 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for s390x, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2013 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-64 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-64 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 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 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | ) 27 | 28 | // Socketoption Level 29 | const ( 30 | SOL_BLUETOOTH = 0x112 31 | SOL_HCI = 0x0 32 | SOL_L2CAP = 0x6 33 | SOL_RFCOMM = 0x12 34 | SOL_SCO = 0x11 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 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 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 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 | // +build go1.4 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | func Unsetenv(key string) error { 12 | // This was added in Go 1.4. 13 | return syscall.Unsetenv(key) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd openbsd netbsd dragonfly 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | // +build darwin dragonfly freebsd linux netbsd openbsd 8 | 9 | package unix 10 | 11 | import "unsafe" 12 | 13 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 14 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 15 | var fcntl64Syscall uintptr = SYS_FCNTL 16 | 17 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 18 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 19 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 20 | if errno == 0 { 21 | return nil 22 | } 23 | return errno 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build gccgo 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // We can't use the gc-syntax .s files for gccgo. On the plus side 12 | // much of the functionality can be written directly in Go. 13 | 14 | //extern gccgoRealSyscall 15 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) 16 | 17 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 18 | syscall.Entersyscall() 19 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 20 | syscall.Exitsyscall() 21 | return r, 0, syscall.Errno(errno) 22 | } 23 | 24 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 25 | syscall.Entersyscall() 26 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 27 | syscall.Exitsyscall() 28 | return r, 0, syscall.Errno(errno) 29 | } 30 | 31 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { 32 | syscall.Entersyscall() 33 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) 34 | syscall.Exitsyscall() 35 | return r, 0, syscall.Errno(errno) 36 | } 37 | 38 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 39 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 40 | return r, 0, syscall.Errno(errno) 41 | } 42 | 43 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 44 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 45 | return r, 0, syscall.Errno(errno) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build gccgo 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define _STRINGIFY2_(x) #x 12 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 13 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 14 | 15 | // Call syscall from C code because the gccgo support for calling from 16 | // Go to C does not support varargs functions. 17 | 18 | struct ret { 19 | uintptr_t r; 20 | uintptr_t err; 21 | }; 22 | 23 | struct ret 24 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 25 | { 26 | struct ret r; 27 | 28 | errno = 0; 29 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 30 | r.err = errno; 31 | return r; 32 | } 33 | 34 | // Define the use function in C so that it is not inlined. 35 | 36 | extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline)); 37 | 38 | void 39 | use(void *p __attribute__ ((unused))) 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_sparc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 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 | // +build gccgo,linux,sparc64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern sysconf 12 | func realSysconf(name int) int64 13 | 14 | func sysconf(name int) (n int64, err syscall.Errno) { 15 | r := realSysconf(name) 16 | if r < 0 { 17 | return 0, syscall.GetErrno() 18 | } 19 | return r, 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mksysnum_darwin.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 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 | # Generate system call table for Darwin from sys/syscall.h 7 | 8 | use strict; 9 | 10 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 11 | print STDERR "GOARCH or GOOS not defined in environment\n"; 12 | exit 1; 13 | } 14 | 15 | my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); 16 | 17 | print <){ 29 | if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ 30 | my $name = $1; 31 | my $num = $2; 32 | $name =~ y/a-z/A-Z/; 33 | print " SYS_$name = $num;" 34 | } 35 | } 36 | 37 | print <){ 30 | if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 30 | if(/^([0-9]+)\s+\S+\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | if($name =~ /^SYS_CAP_+/ || $name =~ /^SYS___CAP_+/){ 44 | next 45 | } 46 | 47 | print " $name = $num; // $proto\n"; 48 | 49 | # We keep Capsicum syscall numbers for FreeBSD 50 | # 9-STABLE here because we are not sure whether they 51 | # are mature and stable. 52 | if($num == 513){ 53 | print " SYS_CAP_NEW = 514 // { int cap_new(int fd, uint64_t rights); }\n"; 54 | print " SYS_CAP_GETRIGHTS = 515 // { int cap_getrights(int fd, \\\n"; 55 | print " SYS_CAP_ENTER = 516 // { int cap_enter(void); }\n"; 56 | print " SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); }\n"; 57 | } 58 | } 59 | } 60 | 61 | print < 999){ 29 | # ignore deprecated syscalls that are no longer implemented 30 | # https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/unistd.h?id=refs/heads/master#n716 31 | return; 32 | } 33 | $name =~ y/a-z/A-Z/; 34 | print " SYS_$name = $num;\n"; 35 | } 36 | 37 | my $prev; 38 | open(GCC, "gcc -E -dD $ARGV[0] |") || die "can't run gcc"; 39 | while(){ 40 | if(/^#define __NR_syscalls\s+/) { 41 | # ignore redefinitions of __NR_syscalls 42 | } 43 | elsif(/^#define __NR_(\w+)\s+([0-9]+)/){ 44 | $prev = $2; 45 | fmt($1, $2); 46 | } 47 | elsif(/^#define __NR3264_(\w+)\s+([0-9]+)/){ 48 | $prev = $2; 49 | fmt($1, $2); 50 | } 51 | elsif(/^#define __NR_(\w+)\s+\(\w+\+\s*([0-9]+)\)/){ 52 | fmt($1, $prev+$2) 53 | } 54 | } 55 | 56 | print <){ 31 | if($line =~ /^(.*)\\$/) { 32 | # Handle continuation 33 | $line = $1; 34 | $_ =~ s/^\s+//; 35 | $line .= $_; 36 | } else { 37 | # New line 38 | $line = $_; 39 | } 40 | next if $line =~ /\\$/; 41 | if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) { 42 | my $num = $1; 43 | my $proto = $6; 44 | my $compat = $8; 45 | my $name = "$7_$9"; 46 | 47 | $name = "$7_$11" if $11 ne ''; 48 | $name =~ y/a-z/A-Z/; 49 | 50 | if($compat eq '' || $compat eq '30' || $compat eq '50') { 51 | print " $name = $num; // $proto\n"; 52 | } 53 | } 54 | } 55 | 56 | print <){ 30 | if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $3; 33 | my $name = $4; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print < uint64(len(b)) { 66 | return nil, nil, EINVAL 67 | } 68 | return h, b[cmsgAlignOf(SizeofCmsghdr):h.Len], nil 69 | } 70 | 71 | // UnixRights encodes a set of open file descriptors into a socket 72 | // control message for sending to another process. 73 | func UnixRights(fds ...int) []byte { 74 | datalen := len(fds) * 4 75 | b := make([]byte, CmsgSpace(datalen)) 76 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 77 | h.Level = SOL_SOCKET 78 | h.Type = SCM_RIGHTS 79 | h.SetLen(CmsgLen(datalen)) 80 | data := cmsgData(h) 81 | for _, fd := range fds { 82 | *(*int32)(data) = int32(fd) 83 | data = unsafe.Pointer(uintptr(data) + 4) 84 | } 85 | return b 86 | } 87 | 88 | // ParseUnixRights decodes a socket control message that contains an 89 | // integer array of open file descriptors from another process. 90 | func ParseUnixRights(m *SocketControlMessage) ([]int, error) { 91 | if m.Header.Level != SOL_SOCKET { 92 | return nil, EINVAL 93 | } 94 | if m.Header.Type != SCM_RIGHTS { 95 | return nil, EINVAL 96 | } 97 | fds := make([]int, len(m.Data)>>2) 98 | for i, j := 0, 0; i < len(m.Data); i += 4 { 99 | fds[j] = int(*(*int32)(unsafe.Pointer(&m.Data[i]))) 100 | j++ 101 | } 102 | return fds, nil 103 | } 104 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/str.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 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + uitoa(uint(-val)) 12 | } 13 | return uitoa(uint(val)) 14 | } 15 | 16 | func uitoa(val uint) string { 17 | var buf [32]byte // big enough for int64 18 | i := len(buf) - 1 19 | for val >= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall.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 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Package unix contains an interface to the low-level operating system 8 | // primitives. OS details vary depending on the underlying system, and 9 | // by default, godoc will display OS-specific documentation for the current 10 | // system. If you want godoc to display OS documentation for another 11 | // system, set $GOOS and $GOARCH to the desired system. For example, if 12 | // you want to view documentation for freebsd/arm on linux/amd64, set $GOOS 13 | // to freebsd and $GOARCH to arm. 14 | // The primary use of this package is inside other packages that provide a more 15 | // portable interface to the system, such as "os", "time" and "net". Use 16 | // those packages rather than this one if you can. 17 | // For details of the functions and data types in this package consult 18 | // the manuals for the appropriate operating system. 19 | // These calls return err == nil to indicate success; otherwise 20 | // err represents an operating system error describing the failure and 21 | // holds a value of type syscall.Errno. 22 | package unix // import "golang.org/x/sys/unix" 23 | 24 | import "unsafe" 25 | 26 | // ByteSliceFromString returns a NUL-terminated slice of bytes 27 | // containing the text of s. If s contains a NUL byte at any 28 | // location, it returns (nil, EINVAL). 29 | func ByteSliceFromString(s string) ([]byte, error) { 30 | for i := 0; i < len(s); i++ { 31 | if s[i] == 0 { 32 | return nil, EINVAL 33 | } 34 | } 35 | a := make([]byte, len(s)+1) 36 | copy(a, s) 37 | return a, nil 38 | } 39 | 40 | // BytePtrFromString returns a pointer to a NUL-terminated array of 41 | // bytes containing the text of s. If s contains a NUL byte at any 42 | // location, it returns (nil, EINVAL). 43 | func BytePtrFromString(s string) (*byte, error) { 44 | a, err := ByteSliceFromString(s) 45 | if err != nil { 46 | return nil, err 47 | } 48 | return &a[0], nil 49 | } 50 | 51 | // Single-word zero for use when we need a valid pointer to 0 bytes. 52 | // See mkunix.pl. 53 | var _zero uintptr 54 | 55 | func (ts *Timespec) Unix() (sec int64, nsec int64) { 56 | return int64(ts.Sec), int64(ts.Nsec) 57 | } 58 | 59 | func (tv *Timeval) Unix() (sec int64, nsec int64) { 60 | return int64(tv.Sec), int64(tv.Usec) * 1000 61 | } 62 | 63 | func (ts *Timespec) Nano() int64 { 64 | return int64(ts.Sec)*1e9 + int64(ts.Nsec) 65 | } 66 | 67 | func (tv *Timeval) Nano() int64 { 68 | return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 69 | } 70 | 71 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 72 | 73 | // use is a no-op, but the compiler cannot see that it is. 74 | // Calling use(p) ensures that p is kept live until that point. 75 | //go:noescape 76 | func use(p unsafe.Pointer) 77 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_386.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 | // +build 386,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = int32(nsec / 1e9) 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = int32(nsec / 1e9) 28 | return 29 | } 30 | 31 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 32 | func Gettimeofday(tv *Timeval) (err error) { 33 | // The tv passed to gettimeofday must be non-nil 34 | // but is otherwise unused. The answers come back 35 | // in the two registers. 36 | sec, usec, err := gettimeofday(tv) 37 | tv.Sec = int32(sec) 38 | tv.Usec = int32(usec) 39 | return err 40 | } 41 | 42 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 43 | k.Ident = uint32(fd) 44 | k.Filter = int16(mode) 45 | k.Flags = uint16(flags) 46 | } 47 | 48 | func (iov *Iovec) SetLen(length int) { 49 | iov.Len = uint32(length) 50 | } 51 | 52 | func (msghdr *Msghdr) SetControllen(length int) { 53 | msghdr.Controllen = uint32(length) 54 | } 55 | 56 | func (cmsg *Cmsghdr) SetLen(length int) { 57 | cmsg.Len = uint32(length) 58 | } 59 | 60 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 61 | var length = uint64(count) 62 | 63 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 64 | 65 | written = int(length) 66 | 67 | if e1 != 0 { 68 | err = e1 69 | } 70 | return 71 | } 72 | 73 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 74 | 75 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 76 | // of darwin/386 the syscall is called sysctl instead of __sysctl. 77 | const SYS___SYSCTL = SYS_SYSCTL 78 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_amd64.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 | // +build amd64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) 15 | 16 | func Getpagesize() int { return 4096 } 17 | 18 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 19 | 20 | func NsecToTimespec(nsec int64) (ts Timespec) { 21 | ts.Sec = nsec / 1e9 22 | ts.Nsec = nsec % 1e9 23 | return 24 | } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = int32(nsec % 1e9 / 1e3) 29 | tv.Sec = int64(nsec / 1e9) 30 | return 31 | } 32 | 33 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 34 | func Gettimeofday(tv *Timeval) (err error) { 35 | // The tv passed to gettimeofday must be non-nil 36 | // but is otherwise unused. The answers come back 37 | // in the two registers. 38 | sec, usec, err := gettimeofday(tv) 39 | tv.Sec = sec 40 | tv.Usec = usec 41 | return err 42 | } 43 | 44 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 45 | k.Ident = uint64(fd) 46 | k.Filter = int16(mode) 47 | k.Flags = uint16(flags) 48 | } 49 | 50 | func (iov *Iovec) SetLen(length int) { 51 | iov.Len = uint64(length) 52 | } 53 | 54 | func (msghdr *Msghdr) SetControllen(length int) { 55 | msghdr.Controllen = uint32(length) 56 | } 57 | 58 | func (cmsg *Cmsghdr) SetLen(length int) { 59 | cmsg.Len = uint32(length) 60 | } 61 | 62 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 63 | var length = uint64(count) 64 | 65 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 66 | 67 | written = int(length) 68 | 69 | if e1 != 0 { 70 | err = e1 71 | } 72 | return 73 | } 74 | 75 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 76 | 77 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 78 | // of darwin/amd64 the syscall is called sysctl instead of __sysctl. 79 | const SYS___SYSCTL = SYS_SYSCTL 80 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 unix 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func Getpagesize() int { return 4096 } 13 | 14 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 15 | 16 | func NsecToTimespec(nsec int64) (ts Timespec) { 17 | ts.Sec = int32(nsec / 1e9) 18 | ts.Nsec = int32(nsec % 1e9) 19 | return 20 | } 21 | 22 | func NsecToTimeval(nsec int64) (tv Timeval) { 23 | nsec += 999 // round up to microsecond 24 | tv.Usec = int32(nsec % 1e9 / 1e3) 25 | tv.Sec = int32(nsec / 1e9) 26 | return 27 | } 28 | 29 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 30 | func Gettimeofday(tv *Timeval) (err error) { 31 | // The tv passed to gettimeofday must be non-nil 32 | // but is otherwise unused. The answers come back 33 | // in the two registers. 34 | sec, usec, err := gettimeofday(tv) 35 | tv.Sec = int32(sec) 36 | tv.Usec = int32(usec) 37 | return err 38 | } 39 | 40 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 41 | k.Ident = uint32(fd) 42 | k.Filter = int16(mode) 43 | k.Flags = uint16(flags) 44 | } 45 | 46 | func (iov *Iovec) SetLen(length int) { 47 | iov.Len = uint32(length) 48 | } 49 | 50 | func (msghdr *Msghdr) SetControllen(length int) { 51 | msghdr.Controllen = uint32(length) 52 | } 53 | 54 | func (cmsg *Cmsghdr) SetLen(length int) { 55 | cmsg.Len = uint32(length) 56 | } 57 | 58 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 59 | var length = uint64(count) 60 | 61 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 62 | 63 | written = int(length) 64 | 65 | if e1 != 0 { 66 | err = e1 67 | } 68 | return 69 | } 70 | 71 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 72 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build arm64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 16384 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = int64(nsec / 1e9) 28 | return 29 | } 30 | 31 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 32 | func Gettimeofday(tv *Timeval) (err error) { 33 | // The tv passed to gettimeofday must be non-nil 34 | // but is otherwise unused. The answers come back 35 | // in the two registers. 36 | sec, usec, err := gettimeofday(tv) 37 | tv.Sec = sec 38 | tv.Usec = usec 39 | return err 40 | } 41 | 42 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 43 | k.Ident = uint64(fd) 44 | k.Filter = int16(mode) 45 | k.Flags = uint16(flags) 46 | } 47 | 48 | func (iov *Iovec) SetLen(length int) { 49 | iov.Len = uint64(length) 50 | } 51 | 52 | func (msghdr *Msghdr) SetControllen(length int) { 53 | msghdr.Controllen = uint32(length) 54 | } 55 | 56 | func (cmsg *Cmsghdr) SetLen(length int) { 57 | cmsg.Len = uint32(length) 58 | } 59 | 60 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 61 | var length = uint64(count) 62 | 63 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 64 | 65 | written = int(length) 66 | 67 | if e1 != 0 { 68 | err = e1 69 | } 70 | return 71 | } 72 | 73 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 74 | 75 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 76 | // of darwin/arm64 the syscall is called sysctl instead of __sysctl. 77 | const SYS___SYSCTL = SYS_SYSCTL 78 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.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 | // +build amd64,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = nsec % 1e9 / 1e3 27 | tv.Sec = int64(nsec / 1e9) 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint64(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint64(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_386.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 | // +build 386,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = int32(nsec / 1e9) 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = int32(nsec / 1e9) 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint32(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint32(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.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 | // +build amd64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = nsec % 1e9 / 1e3 27 | tv.Sec = int64(nsec / 1e9) 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint64(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint64(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm.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 | // +build arm,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return ts.Sec*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = nsec / 1e9 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint32(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint32(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.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 | // +build linux 6 | // +build ppc64 ppc64le 7 | 8 | package unix 9 | 10 | //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) 11 | //sys Dup2(oldfd int, newfd int) (err error) 12 | //sys Fchown(fd int, uid int, gid int) (err error) 13 | //sys Fstat(fd int, stat *Stat_t) (err error) 14 | //sys Fstatfs(fd int, buf *Statfs_t) (err error) 15 | //sys Ftruncate(fd int, length int64) (err error) 16 | //sysnb Getegid() (egid int) 17 | //sysnb Geteuid() (euid int) 18 | //sysnb Getgid() (gid int) 19 | //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT 20 | //sysnb Getuid() (uid int) 21 | //sysnb InotifyInit() (fd int, err error) 22 | //sys Ioperm(from int, num int, on int) (err error) 23 | //sys Iopl(level int) (err error) 24 | //sys Lchown(path string, uid int, gid int) (err error) 25 | //sys Listen(s int, n int) (err error) 26 | //sys Lstat(path string, stat *Stat_t) (err error) 27 | //sys Pause() (err error) 28 | //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 29 | //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 30 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK 31 | //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) 32 | //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) 33 | //sys Setfsgid(gid int) (err error) 34 | //sys Setfsuid(uid int) (err error) 35 | //sysnb Setregid(rgid int, egid int) (err error) 36 | //sysnb Setresgid(rgid int, egid int, sgid int) (err error) 37 | //sysnb Setresuid(ruid int, euid int, suid int) (err error) 38 | //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) 39 | //sysnb Setreuid(ruid int, euid int) (err error) 40 | //sys Shutdown(fd int, how int) (err error) 41 | //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) 42 | //sys Stat(path string, stat *Stat_t) (err error) 43 | //sys Statfs(path string, buf *Statfs_t) (err error) 44 | //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) = SYS_SYNC_FILE_RANGE2 45 | //sys Truncate(path string, length int64) (err error) 46 | //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) 47 | //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) 48 | //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) 49 | //sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) 50 | //sysnb getgroups(n int, list *_Gid_t) (nn int, err error) 51 | //sysnb setgroups(n int, list *_Gid_t) (err error) 52 | //sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) 53 | //sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) 54 | //sysnb socket(domain int, typ int, proto int) (fd int, err error) 55 | //sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) 56 | //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) 57 | //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) 58 | //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) 59 | //sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) 60 | //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) 61 | //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) 62 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) 63 | 64 | func Getpagesize() int { return 65536 } 65 | 66 | //sysnb Gettimeofday(tv *Timeval) (err error) 67 | //sysnb Time(t *Time_t) (tt Time_t, err error) 68 | 69 | //sys Utime(path string, buf *Utimbuf) (err error) 70 | 71 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 72 | 73 | func NsecToTimespec(nsec int64) (ts Timespec) { 74 | ts.Sec = nsec / 1e9 75 | ts.Nsec = nsec % 1e9 76 | return 77 | } 78 | 79 | func NsecToTimeval(nsec int64) (tv Timeval) { 80 | nsec += 999 // round up to microsecond 81 | tv.Sec = nsec / 1e9 82 | tv.Usec = nsec % 1e9 / 1e3 83 | return 84 | } 85 | 86 | func (r *PtraceRegs) PC() uint64 { return r.Nip } 87 | 88 | func (r *PtraceRegs) SetPC(pc uint64) { r.Nip = pc } 89 | 90 | func (iov *Iovec) SetLen(length int) { 91 | iov.Len = uint64(length) 92 | } 93 | 94 | func (msghdr *Msghdr) SetControllen(length int) { 95 | msghdr.Controllen = uint64(length) 96 | } 97 | 98 | func (cmsg *Cmsghdr) SetLen(length int) { 99 | cmsg.Len = uint64(length) 100 | } 101 | 102 | //sysnb pipe(p *[2]_C_int) (err error) 103 | 104 | func Pipe(p []int) (err error) { 105 | if len(p) != 2 { 106 | return EINVAL 107 | } 108 | var pp [2]_C_int 109 | err = pipe(&pp) 110 | p[0] = int(pp[0]) 111 | p[1] = int(pp[1]) 112 | return 113 | } 114 | 115 | //sysnb pipe2(p *[2]_C_int, flags int) (err error) 116 | 117 | func Pipe2(p []int, flags int) (err error) { 118 | if len(p) != 2 { 119 | return EINVAL 120 | } 121 | var pp [2]_C_int 122 | err = pipe2(&pp, flags) 123 | p[0] = int(pp[0]) 124 | p[1] = int(pp[1]) 125 | return 126 | } 127 | 128 | //sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) 129 | 130 | func Poll(fds []PollFd, timeout int) (n int, err error) { 131 | if len(fds) == 0 { 132 | return poll(nil, 0, timeout) 133 | } 134 | return poll(&fds[0], len(fds), timeout) 135 | } 136 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.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 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.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 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int64(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint64(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint64(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 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 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_no_getwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 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 | // +build dragonfly freebsd netbsd openbsd 6 | 7 | package unix 8 | 9 | const ImplementsGetwd = false 10 | 11 | func Getwd() (string, error) { return "", ENOTSUP } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.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 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = int16(mode) 29 | k.Flags = uint16(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.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 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = nsec / 1e9 15 | ts.Nsec = nsec % 1e9 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = nsec % 1e9 / 1e3 22 | tv.Sec = nsec / 1e9 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint64(fd) 28 | k.Filter = int16(mode) 29 | k.Flags = uint16(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint64(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.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 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = nsec / 1e9 13 | ts.Nsec = nsec % 1e9 14 | return 15 | } 16 | 17 | func NsecToTimeval(nsec int64) (tv Timeval) { 18 | nsec += 999 // round up to microsecond 19 | tv.Usec = nsec % 1e9 / 1e3 20 | tv.Sec = int64(nsec / 1e9) 21 | return 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (cmsg *Cmsghdr) SetLen(length int) { 29 | cmsg.Len = uint32(length) 30 | } 31 | 32 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 33 | // TODO(aram): implement this, see issue 5847. 34 | panic("unimplemented") 35 | } 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 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 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | // TODO(aram): remove these before Go 1.3. 10 | const ( 11 | SYS_EXECVE = 59 12 | SYS_FCNTL = 62 13 | ) 14 | -------------------------------------------------------------------------------- /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/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/gopkg.in/yaml.v3/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.2, but preserves some behavior 16 | from 1.1 for backwards compatibility. 17 | 18 | Specifically, as of v3 of the yaml package: 19 | 20 | - YAML 1.1 bools (_yes/no, on/off_) are supported as long as they are being 21 | decoded into a typed bool value. Otherwise they behave as a string. Booleans 22 | in YAML 1.2 are _true/false_ only. 23 | - Octals encode and decode as _0777_ per YAML 1.1, rather than _0o777_ 24 | as specified in YAML 1.2, because most parsers still use the old format. 25 | Octals in the _0o777_ format are supported though, so new files work. 26 | - Does not support base-60 floats. These are gone from YAML 1.2, and were 27 | actually never supported by this package as it's clearly a poor choice. 28 | 29 | and offers backwards 30 | compatibility with YAML 1.1 in some cases. 31 | 1.2, including support for 32 | anchors, tags, map merging, etc. Multi-document unmarshalling is not yet 33 | implemented, and base-60 floats from YAML 1.1 are purposefully not 34 | supported since they're a poor design and are gone in YAML 1.2. 35 | 36 | Installation and usage 37 | ---------------------- 38 | 39 | The import path for the package is *gopkg.in/yaml.v3*. 40 | 41 | To install it, run: 42 | 43 | go get gopkg.in/yaml.v3 44 | 45 | API documentation 46 | ----------------- 47 | 48 | If opened in a browser, the import path itself leads to the API documentation: 49 | 50 | - [https://gopkg.in/yaml.v3](https://gopkg.in/yaml.v3) 51 | 52 | API stability 53 | ------------- 54 | 55 | The package API for yaml v3 will remain stable as described in [gopkg.in](https://gopkg.in). 56 | 57 | 58 | License 59 | ------- 60 | 61 | The yaml package is licensed under the MIT and Apache License 2.0 licenses. 62 | Please see the LICENSE file for details. 63 | 64 | 65 | Example 66 | ------- 67 | 68 | ```Go 69 | package main 70 | 71 | import ( 72 | "fmt" 73 | "log" 74 | 75 | "gopkg.in/yaml.v3" 76 | ) 77 | 78 | var data = ` 79 | a: Easy! 80 | b: 81 | c: 2 82 | d: [3, 4] 83 | ` 84 | 85 | // Note: struct fields must be public in order for unmarshal to 86 | // correctly populate the data. 87 | type T struct { 88 | A string 89 | B struct { 90 | RenamedC int `yaml:"c"` 91 | D []int `yaml:",flow"` 92 | } 93 | } 94 | 95 | func main() { 96 | t := T{} 97 | 98 | err := yaml.Unmarshal([]byte(data), &t) 99 | if err != nil { 100 | log.Fatalf("error: %v", err) 101 | } 102 | fmt.Printf("--- t:\n%v\n\n", t) 103 | 104 | d, err := yaml.Marshal(&t) 105 | if err != nil { 106 | log.Fatalf("error: %v", err) 107 | } 108 | fmt.Printf("--- t dump:\n%s\n\n", string(d)) 109 | 110 | m := make(map[interface{}]interface{}) 111 | 112 | err = yaml.Unmarshal([]byte(data), &m) 113 | if err != nil { 114 | log.Fatalf("error: %v", err) 115 | } 116 | fmt.Printf("--- m:\n%v\n\n", m) 117 | 118 | d, err = yaml.Marshal(&m) 119 | if err != nil { 120 | log.Fatalf("error: %v", err) 121 | } 122 | fmt.Printf("--- m dump:\n%s\n\n", string(d)) 123 | } 124 | ``` 125 | 126 | This example will generate the following output: 127 | 128 | ``` 129 | --- t: 130 | {Easy! {2 [3 4]}} 131 | 132 | --- t dump: 133 | a: Easy! 134 | b: 135 | c: 2 136 | d: [3, 4] 137 | 138 | 139 | --- m: 140 | map[a:Easy! b:map[c:2 d:[3 4]]] 141 | 142 | --- m dump: 143 | a: Easy! 144 | b: 145 | c: 2 146 | d: 147 | - 3 148 | - 4 149 | ``` 150 | 151 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v3/sorter.go: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2011-2019 Canonical Ltd 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | package yaml 17 | 18 | import ( 19 | "reflect" 20 | "unicode" 21 | ) 22 | 23 | type keyList []reflect.Value 24 | 25 | func (l keyList) Len() int { return len(l) } 26 | func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } 27 | func (l keyList) Less(i, j int) bool { 28 | a := l[i] 29 | b := l[j] 30 | ak := a.Kind() 31 | bk := b.Kind() 32 | for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() { 33 | a = a.Elem() 34 | ak = a.Kind() 35 | } 36 | for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() { 37 | b = b.Elem() 38 | bk = b.Kind() 39 | } 40 | af, aok := keyFloat(a) 41 | bf, bok := keyFloat(b) 42 | if aok && bok { 43 | if af != bf { 44 | return af < bf 45 | } 46 | if ak != bk { 47 | return ak < bk 48 | } 49 | return numLess(a, b) 50 | } 51 | if ak != reflect.String || bk != reflect.String { 52 | return ak < bk 53 | } 54 | ar, br := []rune(a.String()), []rune(b.String()) 55 | digits := false 56 | for i := 0; i < len(ar) && i < len(br); i++ { 57 | if ar[i] == br[i] { 58 | digits = unicode.IsDigit(ar[i]) 59 | continue 60 | } 61 | al := unicode.IsLetter(ar[i]) 62 | bl := unicode.IsLetter(br[i]) 63 | if al && bl { 64 | return ar[i] < br[i] 65 | } 66 | if al || bl { 67 | if digits { 68 | return al 69 | } else { 70 | return bl 71 | } 72 | } 73 | var ai, bi int 74 | var an, bn int64 75 | if ar[i] == '0' || br[i] == '0' { 76 | for j := i - 1; j >= 0 && unicode.IsDigit(ar[j]); j-- { 77 | if ar[j] != '0' { 78 | an = 1 79 | bn = 1 80 | break 81 | } 82 | } 83 | } 84 | for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ { 85 | an = an*10 + int64(ar[ai]-'0') 86 | } 87 | for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ { 88 | bn = bn*10 + int64(br[bi]-'0') 89 | } 90 | if an != bn { 91 | return an < bn 92 | } 93 | if ai != bi { 94 | return ai < bi 95 | } 96 | return ar[i] < br[i] 97 | } 98 | return len(ar) < len(br) 99 | } 100 | 101 | // keyFloat returns a float value for v if it is a number/bool 102 | // and whether it is a number/bool or not. 103 | func keyFloat(v reflect.Value) (f float64, ok bool) { 104 | switch v.Kind() { 105 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: 106 | return float64(v.Int()), true 107 | case reflect.Float32, reflect.Float64: 108 | return v.Float(), true 109 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 110 | return float64(v.Uint()), true 111 | case reflect.Bool: 112 | if v.Bool() { 113 | return 1, true 114 | } 115 | return 0, true 116 | } 117 | return 0, false 118 | } 119 | 120 | // numLess returns whether a < b. 121 | // a and b must necessarily have the same kind. 122 | func numLess(a, b reflect.Value) bool { 123 | switch a.Kind() { 124 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: 125 | return a.Int() < b.Int() 126 | case reflect.Float32, reflect.Float64: 127 | return a.Float() < b.Float() 128 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 129 | return a.Uint() < b.Uint() 130 | case reflect.Bool: 131 | return !a.Bool() && b.Bool() 132 | } 133 | panic("not a number") 134 | } 135 | -------------------------------------------------------------------------------- /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/davecgh/go-spew v1.1.1 2 | ## explicit 3 | github.com/davecgh/go-spew/spew 4 | # github.com/fsnotify/fsnotify v1.4.3-0.20161026203122-fd9ec7deca8b 5 | ## explicit 6 | github.com/fsnotify/fsnotify 7 | # github.com/pmezard/go-difflib v1.0.0 8 | ## explicit 9 | github.com/pmezard/go-difflib/difflib 10 | # github.com/spf13/pflag v0.0.0-20160906134334-6fd2ff4ff8df 11 | ## explicit 12 | github.com/spf13/pflag 13 | # github.com/stretchr/testify v1.8.1 14 | ## explicit; go 1.13 15 | github.com/stretchr/testify/assert 16 | # golang.org/x/sys v0.0.0-20161023150541-c200b10b5d5e 17 | ## explicit 18 | golang.org/x/sys/unix 19 | # gopkg.in/yaml.v3 v3.0.1 20 | ## explicit 21 | gopkg.in/yaml.v3 22 | --------------------------------------------------------------------------------