├── .github └── workflows │ └── release.yml ├── .vscode └── launch.json ├── README.md ├── go.mod ├── go.sum ├── main.go ├── pkg ├── ntlmssp │ ├── avpair.go │ ├── flags.go │ ├── negotiateflag_string.go │ └── ntlmssp.go ├── rpce │ ├── altercontext.go │ ├── auth3.go │ ├── authVerifier.go │ ├── bind.go │ ├── bind_ack.go │ ├── connectionOriented.go │ ├── fault.go │ ├── request.go │ ├── response.go │ └── structs.go ├── uuid │ ├── func.go │ ├── main │ │ └── main.go │ └── uuid.go └── wmiexec │ ├── dcom.go │ └── wmiexec.go └── vendor ├── github.com └── BurntSushi │ └── toml │ ├── .gitignore │ ├── .travis.yml │ ├── COMPATIBLE │ ├── COPYING │ ├── Makefile │ ├── README.md │ ├── decode.go │ ├── decode_meta.go │ ├── doc.go │ ├── encode.go │ ├── encoding_types.go │ ├── encoding_types_1.1.go │ ├── lex.go │ ├── parse.go │ ├── session.vim │ ├── type_check.go │ └── type_fields.go ├── go.uber.org ├── atomic │ ├── .codecov.yml │ ├── .gitignore │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── Makefile │ ├── README.md │ ├── atomic.go │ ├── error.go │ ├── go.mod │ ├── go.sum │ ├── string.go │ └── tools.go ├── multierr │ ├── .codecov.yml │ ├── .gitignore │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── Makefile │ ├── README.md │ ├── error.go │ ├── glide.yaml │ ├── go.mod │ ├── go.sum │ ├── go113.go │ └── tools.go ├── tools │ ├── LICENSE │ └── update-license │ │ ├── .gitignore │ │ ├── README.md │ │ ├── licenses.go │ │ └── main.go └── zap │ ├── .codecov.yml │ ├── .gitignore │ ├── .readme.tmpl │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ ├── FAQ.md │ ├── LICENSE.txt │ ├── Makefile │ ├── README.md │ ├── array.go │ ├── buffer │ ├── buffer.go │ └── pool.go │ ├── checklicense.sh │ ├── config.go │ ├── doc.go │ ├── encoder.go │ ├── error.go │ ├── field.go │ ├── flag.go │ ├── glide.yaml │ ├── global.go │ ├── global_go112.go │ ├── global_prego112.go │ ├── go.mod │ ├── go.sum │ ├── http_handler.go │ ├── internal │ ├── bufferpool │ │ └── bufferpool.go │ ├── color │ │ └── color.go │ └── exit │ │ └── exit.go │ ├── level.go │ ├── logger.go │ ├── options.go │ ├── sink.go │ ├── stacktrace.go │ ├── sugar.go │ ├── time.go │ ├── tools.go │ ├── writer.go │ └── zapcore │ ├── console_encoder.go │ ├── core.go │ ├── doc.go │ ├── encoder.go │ ├── entry.go │ ├── error.go │ ├── field.go │ ├── hook.go │ ├── increase_level.go │ ├── json_encoder.go │ ├── level.go │ ├── level_strings.go │ ├── marshaler.go │ ├── memory_encoder.go │ ├── sampler.go │ ├── tee.go │ └── write_syncer.go ├── golang.org └── x │ ├── crypto │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ └── md4 │ │ ├── md4.go │ │ └── md4block.go │ ├── lint │ ├── .travis.yml │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── go.mod │ ├── go.sum │ ├── golint │ │ ├── golint.go │ │ ├── import.go │ │ └── importcomment.go │ └── lint.go │ ├── text │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ ├── encoding │ │ ├── encoding.go │ │ ├── internal │ │ │ ├── identifier │ │ │ │ ├── identifier.go │ │ │ │ └── mib.go │ │ │ └── internal.go │ │ └── unicode │ │ │ ├── override.go │ │ │ └── unicode.go │ ├── internal │ │ └── utf8internal │ │ │ └── utf8internal.go │ ├── runes │ │ ├── cond.go │ │ └── runes.go │ └── transform │ │ └── transform.go │ └── tools │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ ├── go │ ├── analysis │ │ ├── analysis.go │ │ ├── diagnostic.go │ │ ├── doc.go │ │ ├── passes │ │ │ └── inspect │ │ │ │ └── inspect.go │ │ └── validate.go │ ├── ast │ │ ├── astutil │ │ │ ├── enclosing.go │ │ │ ├── imports.go │ │ │ ├── rewrite.go │ │ │ └── util.go │ │ └── inspector │ │ │ ├── inspector.go │ │ │ └── typeof.go │ ├── buildutil │ │ ├── allpackages.go │ │ ├── fakecontext.go │ │ ├── overlay.go │ │ ├── tags.go │ │ └── util.go │ ├── gcexportdata │ │ ├── gcexportdata.go │ │ └── importer.go │ ├── internal │ │ ├── gcimporter │ │ │ ├── bexport.go │ │ │ ├── bimport.go │ │ │ ├── exportdata.go │ │ │ ├── gcimporter.go │ │ │ ├── iexport.go │ │ │ ├── iimport.go │ │ │ ├── newInterface10.go │ │ │ └── newInterface11.go │ │ └── packagesdriver │ │ │ └── sizes.go │ ├── packages │ │ ├── doc.go │ │ ├── external.go │ │ ├── golist.go │ │ ├── golist_overlay.go │ │ ├── packages.go │ │ └── visit.go │ └── types │ │ ├── objectpath │ │ └── objectpath.go │ │ └── typeutil │ │ ├── callee.go │ │ ├── imports.go │ │ ├── map.go │ │ ├── methodsetcache.go │ │ └── ui.go │ └── internal │ ├── fastwalk │ ├── fastwalk.go │ ├── fastwalk_dirent_fileno.go │ ├── fastwalk_dirent_ino.go │ ├── fastwalk_dirent_namlen_bsd.go │ ├── fastwalk_dirent_namlen_linux.go │ ├── fastwalk_portable.go │ └── fastwalk_unix.go │ ├── gopathwalk │ └── walk.go │ ├── semver │ └── semver.go │ └── span │ ├── parse.go │ ├── span.go │ ├── token.go │ ├── token111.go │ ├── token112.go │ ├── uri.go │ └── utf16.go ├── honnef.co └── go │ └── tools │ ├── LICENSE │ ├── LICENSE-THIRD-PARTY │ ├── arg │ └── arg.go │ ├── cmd │ └── staticcheck │ │ ├── README.md │ │ └── staticcheck.go │ ├── config │ ├── config.go │ └── example.conf │ ├── deprecated │ └── stdlib.go │ ├── facts │ ├── deprecated.go │ ├── generated.go │ ├── purity.go │ └── token.go │ ├── functions │ ├── loops.go │ ├── pure.go │ └── terminates.go │ ├── go │ └── types │ │ └── typeutil │ │ ├── callee.go │ │ ├── identical.go │ │ ├── imports.go │ │ ├── map.go │ │ ├── methodsetcache.go │ │ └── ui.go │ ├── internal │ ├── cache │ │ ├── cache.go │ │ ├── default.go │ │ └── hash.go │ ├── passes │ │ └── buildssa │ │ │ └── buildssa.go │ ├── renameio │ │ └── renameio.go │ └── sharedcheck │ │ └── lint.go │ ├── lint │ ├── LICENSE │ ├── lint.go │ ├── lintdsl │ │ └── lintdsl.go │ ├── lintutil │ │ ├── format │ │ │ └── format.go │ │ ├── stats.go │ │ ├── stats_bsd.go │ │ ├── stats_posix.go │ │ └── util.go │ ├── runner.go │ └── stats.go │ ├── loader │ └── loader.go │ ├── printf │ ├── fuzz.go │ └── printf.go │ ├── simple │ ├── CONTRIBUTING.md │ ├── analysis.go │ ├── doc.go │ └── lint.go │ ├── ssa │ ├── LICENSE │ ├── blockopt.go │ ├── builder.go │ ├── const.go │ ├── create.go │ ├── doc.go │ ├── dom.go │ ├── emit.go │ ├── func.go │ ├── identical.go │ ├── identical_17.go │ ├── lift.go │ ├── lvalue.go │ ├── methods.go │ ├── mode.go │ ├── print.go │ ├── sanity.go │ ├── source.go │ ├── ssa.go │ ├── staticcheck.conf │ ├── testmain.go │ ├── util.go │ ├── wrappers.go │ └── write.go │ ├── ssautil │ └── ssautil.go │ ├── staticcheck │ ├── CONTRIBUTING.md │ ├── analysis.go │ ├── buildtag.go │ ├── doc.go │ ├── knowledge.go │ ├── lint.go │ ├── rules.go │ ├── structtag.go │ └── vrp │ │ ├── channel.go │ │ ├── int.go │ │ ├── slice.go │ │ ├── string.go │ │ └── vrp.go │ ├── stylecheck │ ├── analysis.go │ ├── doc.go │ ├── lint.go │ └── names.go │ ├── unused │ ├── edge.go │ ├── edgekind_string.go │ ├── implements.go │ └── unused.go │ └── version │ ├── buildinfo.go │ ├── buildinfo111.go │ └── version.go └── modules.txt /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Debug-prompt", 9 | "type": "go", 10 | "request": "launch", 11 | "mode": "auto", 12 | "program": "${workspaceFolder}", 13 | "env": {"GOOS":"darwin"}, 14 | "args": ["-target", "${input:prompt}:135", "-username", "vagrant", "-password", "vagrant"] 15 | }, 16 | { 17 | "name": "Debug-hc", 18 | "type": "go", 19 | "request": "launch", 20 | "mode": "auto", 21 | "program": "${workspaceFolder}", 22 | "env": {"GOOS":"darwin"}, 23 | "args": ["-target", "172.16.50.251:135", "-username", "vagrant", "-password", "vagrant"] 24 | } 25 | ], 26 | "inputs": [ 27 | { 28 | "type":"promptString", 29 | "id":"prompt", 30 | "description": "IP address to debug against", 31 | "default":"", 32 | } 33 | ] 34 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # goWMIExec 2 | 3 | Based on https://github.com/checkymander/Sharp-WMIExec/blob/master/Sharp-InvokeWMIExec/Program.cs 4 | 5 | Which is based on https://github.com/Kevin-Robertson/Invoke-TheHash/blob/master/Invoke-SMBExec.ps1 6 | 7 | 8 | Currently a (functional) work in progress. 9 | 10 | Features: 11 | - Can authenticate using hash-only 12 | - Don't need to install impacket 13 | - Native go and byte bashing on TCP sockets, no need to run on Windows 14 | 15 | Limitations: 16 | - Lots of static bytes. Future development will turn these into proper structures, and hopefully allow for other DCOM/COM methods to be used 17 | - Long commands won't work. Make them shorter, or create a PR to implement fragments in the Exec method. 18 | 19 | Example: 20 | `goWMIExec -target "172.16.50.202:135" -username "vagrant" -hash "e02bc503339d51f71d913c245d35b50b" -command 'C:\Windows\system32\cmd.exe /c echo test > C:\test.txt'` -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/C-Sto/goWMIExec 2 | 3 | go 1.13 4 | 5 | require ( 6 | go.uber.org/zap v1.14.0 7 | golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d 8 | golang.org/x/text v0.3.2 9 | ) 10 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "log" 6 | "os" 7 | "strings" 8 | 9 | "github.com/C-Sto/goWMIExec/pkg/wmiexec" 10 | ) 11 | 12 | func main() { 13 | 14 | var command, target, username, password, hash, domain, clientHost, binding string 15 | var resolveOnly bool 16 | flag.StringVar(&target, "target", "", "Target") 17 | flag.StringVar(&username, "username", "", "Username to auth as") 18 | flag.StringVar(&password, "password", "", "password") 19 | flag.StringVar(&hash, "hash", "", "hash") 20 | flag.StringVar(&command, "command", "", "command") 21 | flag.StringVar(&clientHost, "clientname", "", "Value to send the victim indicating client host") 22 | flag.StringVar(&binding, "binding", "", "Value to use in network binding (see output of resolve mode for potential values)") 23 | flag.BoolVar(&resolveOnly, "resolveonly", false, "Only resolve network bindings (does not require auth)") 24 | flag.Parse() 25 | 26 | if clientHost == "" { 27 | var err error 28 | clientHost, err = os.Hostname() 29 | if err != nil { 30 | panic(err) 31 | } 32 | } 33 | 34 | if target == "" || (password == "" && hash == "" && !resolveOnly) { 35 | flag.Usage() 36 | os.Exit(1) 37 | } 38 | 39 | if !strings.Contains(target, ":") { 40 | //fmt.Printf("Bad target specified, requires port (usually 135). expected: 127.0.0.1:135, got %s", target) 41 | //os.Exit(1) 42 | target = target + ":135" 43 | } 44 | 45 | //don't do auth, just get network adaptors 46 | if resolveOnly { 47 | values, err := wmiexec.GetNetworkBindings(target) 48 | if err != nil { 49 | panic(err) 50 | } 51 | log.Println("Resolved names:") 52 | for _, name := range values { 53 | log.Println("\t", name) 54 | } 55 | return 56 | } 57 | 58 | err := wmiexec.WMIExec(target, username, password, hash, domain, command, clientHost, binding, nil) 59 | if err != nil { 60 | panic(err) 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /pkg/ntlmssp/avpair.go: -------------------------------------------------------------------------------- 1 | package ntlmssp 2 | 3 | //https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/83f5e789-660d-4781-8491-5f8c6641f75e 4 | 5 | /* 6 | The AV_PAIR structure defines an attribute/value pair. 7 | Sequences of AV_PAIR structures are used in the CHALLENGE_MESSAGE (section 2.2.1.2) directly. 8 | They are also in the AUTHENTICATE_MESSAGE (section 2.2.1.3) via the NTLMv2_CLIENT_CHALLENGE (section 2.2.2.7) structure. 9 | */ 10 | 11 | type AVID uint16 12 | 13 | const ( 14 | MsvAvEOL = 0x0000 //Indicates that this is the last AV_PAIR in the list. AvLen MUST be 0. This type of information MUST be present in the AV pair list. 15 | MsvAvNbComputerName = 0x0001 //The server's NetBIOS computer name. The name MUST be in Unicode, and is not null-terminated. This type of information MUST be present in the AV_pair list. 16 | MsvAvNbDomainName = 0x0002 //The server's NetBIOS domain name. The name MUST be in Unicode, and is not null-terminated. This type of information MUST be present in the AV_pair list. 17 | MsvAvDnsComputerName = 0x0003 //The fully qualified domain name (FQDN) of the computer. The name MUST be in Unicode, and is not null-terminated. 18 | MsvAvDnsDomainName = 0x0004 //The FQDN of the domain. The name MUST be in Unicode, and is not null-terminated. 19 | MsvAvDnsTreeName = 0x0005 //The FQDN of the forest. The name MUST be in Unicode, and is not null-terminated.<13> 20 | MsvAvFlags = 0x0006 //A 32-bit value indicating server or client configuration. 0x00000001: Indicates to the client that the account authentication is constrained. 0x00000002: Indicates that the client is providing message integrity in the MIC field (section 2.2.1.3) in the AUTHENTICATE_MESSAGE.<14> 0x00000004: Indicates that the client is providing a target SPN generated from an untrusted source.<15> 21 | MsvAvTimestamp = 0x0007 //A FILETIME structure ([MS-DTYP] section 2.3.3) in little-endian byte order that contains the server local time. This structure is always sent in the CHALLENGE_MESSAGE.<16> 22 | MsvAvSingleHost = 0x0008 //A Single_Host_Data (section 2.2.2.2) structure. The Value field contains a platform-specific blob, as well as a MachineID created at computer startup to identify the calling machine.<17> 23 | MsvAvTargetName = 0x0009 //The SPN of the target server. The name MUST be in Unicode and is not null-terminated.<18> 24 | MsvAvChannelBindings = 0x000A //A channel bindings hash. The Value field contains an MD5 hash ([RFC4121] section 4.1.1.2) of a gss_channel_bindings_struct ([RFC2744] section 3.11). An all-zero value of the hash is used to indicate absence of channel bindings.<19> 25 | ) 26 | 27 | type AV_Pair struct { 28 | AvID AVID 29 | AvLen uint16 30 | Value []byte 31 | } 32 | -------------------------------------------------------------------------------- /pkg/ntlmssp/flags.go: -------------------------------------------------------------------------------- 1 | package ntlmssp 2 | 3 | //goodness me 4 | //https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/99d90ff4-957f-4c8a-80e4-5bfe5a9a9832 5 | 6 | type NegotiateFlag uint32 7 | 8 | const ( 9 | NTLMSSP_NEGOTIATE_UNICODE NegotiateFlag = 1 << iota 10 | NTLM_NEGOTIATE_OEM 11 | NTLMSSP_REQUEST_TARGET 12 | _ 13 | NTLMSSP_NEGOTIATE_SIGN 14 | NTLMSSP_NEGOTIATE_SEAL 15 | NTLMSSP_NEGOTIATE_DATAGRAM 16 | NTLMSSP_NEGOTIATE_LM_KEY 17 | _ 18 | NTLMSSP_NEGOTIATE_NTLM 19 | _ 20 | NTLMSSP_ANONYMOUS_CONNECTIONS 21 | NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED 22 | NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED 23 | _ 24 | NTLMSSP_NEGOTIATE_ALWAYS_SIGN 25 | NTLMSSP_TARGET_TYPE_DOMAIN 26 | NTLMSSP_TARGET_TYPE_SERVER 27 | _ 28 | NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY 29 | NTLMSSP_NEGOTIATE_IDENTIFY 30 | _ 31 | NTLMSSP_REQUEST_NON_NT_SESSION_KEY 32 | NTLMSSP_NEGOTIATE_TARGET_INFO 33 | _ 34 | NTLMSSP_NEGOTIATE_VERSION 35 | _ 36 | _ 37 | _ 38 | NTLMSSP_NEGOTIATE_128 39 | NTLMSSP_NEGOTIATE_KEY_EXCH 40 | NTLMSSP_NEGOTIATE_56 41 | ) 42 | 43 | //go:generate stringer -type=NegotiateFlag 44 | 45 | func Flags(n NegotiateFlag) []string { 46 | var result []string 47 | for i := 0; i <= 32; i++ { 48 | if n&(1< 0 { 36 | binary.Read(br, binary.LittleEndian, &r.AuthVerifier.AuthType) 37 | binary.Read(br, binary.LittleEndian, &r.AuthVerifier.AuthLevel) 38 | binary.Read(br, binary.LittleEndian, &r.AuthVerifier.AuthPadLength) 39 | binary.Read(br, binary.LittleEndian, &r.AuthVerifier.Reserved) 40 | binary.Read(br, binary.LittleEndian, &r.AuthVerifier.ContextID) 41 | r.AuthVerifier.AuthValue = make([]byte, r.CommonHead.AuthLength) 42 | br.Read(r.AuthVerifier.AuthValue) 43 | } 44 | return r 45 | } 46 | 47 | func (pf FaultResp) StatusString() string { 48 | return statusmap[pf.Status] 49 | } 50 | 51 | const ( 52 | AccessDenied uint32 = 5 53 | ) 54 | 55 | var statusmap = map[uint32]string{ 56 | 5: "nca_s_fault_access_denied", 57 | 0x1c00001b: "nca_s_fault_remote_no_memory", 58 | 0x1c01000b: "nca_proto_error (The RPC client or server protocol has been violated.)", 59 | 0x1c010003: "nca_unk_if (The server does not export the requested interface.)", 60 | } 61 | -------------------------------------------------------------------------------- /pkg/rpce/request.go: -------------------------------------------------------------------------------- 1 | package rpce 2 | 3 | import ( 4 | "bytes" 5 | "encoding/binary" 6 | ) 7 | 8 | type RequestReq struct { //poorly named, I'm aware 9 | CommonHead CommonHead 10 | AllocHint uint32 11 | PContextID uint16 12 | Opnum uint16 13 | StubData []byte 14 | AuthVerifier *AuthVerifier 15 | } 16 | 17 | func NewRequestReq(callID uint32, ctxID uint16, opNum uint16, data []byte, auth *AuthVerifier) RequestReq { 18 | r := RequestReq{} 19 | //todo, don't hard code ptype 20 | r.CommonHead = NewCommonHeader(0, 0x03, callID) 21 | r.PContextID = ctxID 22 | r.Opnum = opNum 23 | r.StubData = make([]byte, len(data)) 24 | copy(r.StubData, data) 25 | r.AuthVerifier = auth 26 | 27 | r.AllocHint = 0 //idfk, I guess this should be the length of the data segment? 28 | 29 | r.UpdateLengths() 30 | 31 | return r 32 | } 33 | 34 | //UpdateLengths sets the commonheader.fraglength and .authlength values based on the current state of the object. 35 | func (r *RequestReq) UpdateLengths() { 36 | r.CommonHead.FragLength = 24 //length of common header 37 | r.CommonHead.FragLength += uint16(len(r.StubData)) 38 | 39 | if r.AuthVerifier != nil { 40 | r.AuthVerifier.UpdatePadding(len(r.StubData) % 4) 41 | r.CommonHead.FragLength += uint16(r.AuthVerifier.SizeOf()) 42 | r.CommonHead.AuthLength = uint16(len(r.AuthVerifier.AuthValue)) 43 | } 44 | } 45 | 46 | func (r RequestReq) AuthBytes() []byte { 47 | 48 | buff := bytes.Buffer{} 49 | binary.Write(&buff, binary.LittleEndian, r.CommonHead) 50 | binary.Write(&buff, binary.LittleEndian, r.AllocHint) 51 | binary.Write(&buff, binary.LittleEndian, r.PContextID) 52 | binary.Write(&buff, binary.LittleEndian, r.Opnum) 53 | buff.Write(r.StubData) 54 | if r.AuthVerifier != nil { 55 | //this is a bit gross - the value is where the verifier gets put, and doesn't get included in the hashing scheme (obviously) 56 | //but the length needs to be included in the common headers. Doing this makes sure if a value is set in the auth object, it's not returned as part of the request object. 57 | buff.Write(r.AuthVerifier.Bytes()[:r.AuthVerifier.SizeOf()-r.AuthVerifier.ValueSize()]) 58 | } 59 | 60 | return buff.Bytes() 61 | } 62 | 63 | func (r RequestReq) Bytes() []byte { 64 | buff := bytes.Buffer{} 65 | 66 | binary.Write(&buff, binary.LittleEndian, r.CommonHead) 67 | binary.Write(&buff, binary.LittleEndian, r.AllocHint) 68 | binary.Write(&buff, binary.LittleEndian, r.PContextID) 69 | binary.Write(&buff, binary.LittleEndian, r.Opnum) 70 | buff.Write(r.StubData) 71 | if r.AuthVerifier != nil { 72 | buff.Write(r.AuthVerifier.Bytes()) 73 | } 74 | return buff.Bytes() 75 | } 76 | -------------------------------------------------------------------------------- /pkg/rpce/response.go: -------------------------------------------------------------------------------- 1 | package rpce 2 | 3 | import ( 4 | "bytes" 5 | "encoding/binary" 6 | ) 7 | 8 | type Response struct { 9 | CommonHead CommonHead 10 | AllocHint uint32 11 | PContID uint16 12 | CancelCount byte 13 | Reserved byte 14 | StubData []byte 15 | AuthVerifier *AuthVerifier 16 | } 17 | 18 | func ParseResponse(b []byte) Response { 19 | r := Response{} 20 | br := bytes.NewReader(b) 21 | 22 | binary.Read(br, binary.LittleEndian, &r.CommonHead) 23 | binary.Read(br, binary.LittleEndian, &r.AllocHint) 24 | binary.Read(br, binary.LittleEndian, &r.PContID) 25 | binary.Read(br, binary.LittleEndian, &r.CancelCount) 26 | binary.Read(br, binary.LittleEndian, &r.Reserved) 27 | r.StubData = make([]byte, r.CommonHead.FragLength-24) 28 | br.Read(r.StubData) 29 | 30 | return r 31 | } 32 | -------------------------------------------------------------------------------- /pkg/rpce/structs.go: -------------------------------------------------------------------------------- 1 | package rpce 2 | 3 | import ( 4 | "github.com/C-Sto/goWMIExec/pkg/uuid" 5 | ) 6 | 7 | //2.2.1.1.1 (same as rpc_if_id_t) 8 | type RPC_IF_ID struct { 9 | UUID uuid.UUID 10 | VersMajor, VersMinor uint16 11 | } 12 | 13 | type Version_t struct { 14 | Major, Minor uint16 15 | } 16 | 17 | type P_rt_versions_supported_t struct { 18 | Protocols uint8 19 | P_Protocols []Version_t 20 | } 21 | 22 | type SecurityProviders byte 23 | 24 | const ( 25 | RPC_C_AUTHN_NONE = SecurityProviders(0) 26 | RPC_C_AUTHN_GSS_NEGOTIATE = SecurityProviders(0x09) //SPNEGO 27 | RPC_C_AUTHN_WINNT = SecurityProviders(0x0a) //NTLM 28 | RPC_C_AUTHN_GSS_SCHANNEL = SecurityProviders(0x0e) //TLS 29 | RPC_C_AUTHN_GSS_KERBEROS = SecurityProviders(0x10) //Kerberos 30 | RPC_C_AUTHN_NETLOGON = SecurityProviders(0x44) 31 | RPC_C_AUTHN_DEFAULT = SecurityProviders(0xff) 32 | ) 33 | 34 | type AuthLevel uint8 35 | 36 | const ( 37 | RPC_C_AUTHN_LEVEL_DEFAULT AuthLevel = iota //0x00 Same as RPC_C_AUTHN_LEVEL_CONNECT 38 | RPC_C_AUTHN_LEVEL_NONE // 0x01 No authentication. 39 | RPC_C_AUTHN_LEVEL_CONNECT // 0x02 Authenticates the credentials of the client and server. 40 | RPC_C_AUTHN_LEVEL_CALL //0x03 Same as RPC_C_AUTHN_LEVEL_PKT. 41 | RPC_C_AUTHN_LEVEL_PKT //0x04 Same as RPC_C_AUTHN_LEVEL_CONNECT but also prevents replay attacks. 42 | RPC_C_AUTHN_LEVEL_PKT_INTEGRITY //0x05 Same as RPC_C_AUTHN_LEVEL_PKT but also verifies that none of the data transferred between the client and server has been modified. 43 | RPC_C_AUTHN_LEVEL_PKT_PRIVACY // 0x06 Same as RPC_C_AUTHN_LEVEL_PKT_INTEGRITY but also ensures that the data transferred can only be 44 | ) 45 | 46 | type Twr_t struct { 47 | TowerLength uint32 //max of 2000 48 | Tower []byte //or string? 49 | } 50 | 51 | type ErrorStatus uint32 52 | -------------------------------------------------------------------------------- /pkg/uuid/func.go: -------------------------------------------------------------------------------- 1 | package uuid 2 | 3 | import ( 4 | "encoding/hex" 5 | "strings" 6 | ) 7 | 8 | func FromString(s string) (UUID, error) { 9 | 10 | s = strings.ReplaceAll(s, "-", "") 11 | b, err := hex.DecodeString(s) 12 | if err != nil { 13 | return UUID{}, err 14 | } 15 | //8a 88 5d 04 1c eb-11 c9-9f e8 08 00 2b 10 48 60 16 | //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 17 | //8a885d04-1ceb-11c9-9fe8-08002b104860 18 | 19 | r := UUID{b[3], b[2], b[1], b[0], b[5], b[4], b[7], b[6], b[8], b[9], b[10], b[11], b[12], b[13], b[14], b[15]} 20 | //0x04, 0x5d, 0x88, 0x8a, 0xeb, 0x1c, 0xc9, 0x11, 0x9f, 0xe8, 0x08, 0x00, 0x2b, 0x10, 0x48, 0x60 21 | //3 2 1 0 5 4 7 6 8 9 10 11 12 13 14 15 22 | return r, nil 23 | } 24 | 25 | func fromStringInternalOnly(s string) UUID { 26 | b, e := FromString(s) 27 | if e != nil { 28 | panic(e) 29 | } 30 | return b 31 | } 32 | 33 | func FromBytes(b []byte) string { 34 | tmp := [16]byte{b[3], b[2], b[1], b[0], b[5], b[4], b[7], b[6], b[8], b[9], b[10], b[11], b[12], b[13], b[14], b[15]} 35 | sb := strings.Builder{} 36 | s := hex.EncodeToString(tmp[:]) 37 | sb.WriteString(s[0:8]) 38 | sb.WriteString("-") 39 | sb.WriteString(s[8:12]) 40 | sb.WriteString("-") 41 | sb.WriteString(s[12:16]) 42 | sb.WriteString("-") 43 | sb.WriteString(s[16:20]) 44 | sb.WriteString("-") 45 | sb.WriteString(s[20:]) 46 | return sb.String() 47 | } 48 | -------------------------------------------------------------------------------- /pkg/uuid/main/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/hex" 5 | "flag" 6 | "fmt" 7 | "strings" 8 | 9 | "github.com/C-Sto/goWMIExec/pkg/uuid" 10 | ) 11 | 12 | func main() { 13 | f := flag.String("test", "hexhexhex", "hex") 14 | flag.Parse() 15 | s := strings.ReplaceAll(*f, ",", "") 16 | s = strings.ReplaceAll(s, "0x", "") 17 | s = strings.ReplaceAll(s, " ", "") 18 | b, err := hex.DecodeString(s) 19 | if err != nil { 20 | panic(err) 21 | } 22 | fmt.Println(uuid.FromBytes(b)) 23 | } 24 | -------------------------------------------------------------------------------- /pkg/uuid/uuid.go: -------------------------------------------------------------------------------- 1 | package uuid 2 | 3 | type UUID [16]byte 4 | 5 | var NULL = UUID{} 6 | 7 | var NDRTransferSyntax_V2 = fromStringInternalOnly("8a885d04-1ceb-11c9-9fe8-08002b104860") 8 | 9 | //https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rpce/dca648a5-42d3-432c-9927-2f22e50fa266 10 | var NDR64TransferSyntax = fromStringInternalOnly("71710533-beba-4937-8319-b5dbef9ccc36") 11 | 12 | var BindTimeFeatureReneg = fromStringInternalOnly("6cb71c2c-9812-4540-0300-000000000000") 13 | 14 | //https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dcom/c25391af-f59e-40da-885e-cc84076673e4 15 | var IID_IRemUnknown2 = fromStringInternalOnly("00000143-0000-0000-c000-000000000046") 16 | var IID_IActivationPropertiesIn = fromStringInternalOnly("000001a2-0000-0000-c000-000000000046") 17 | var CLSID_ActivationPropertiesIn = fromStringInternalOnly("00000338-0000-0000-c000-000000000046") 18 | var CLSID_SpecialSystemProperties = fromStringInternalOnly("000001b9-0000-0000-c000-000000000046") 19 | var CLSID_InstantiationInfo = fromStringInternalOnly("000001ab-0000-0000-c000-000000000046") 20 | var CLSID_ActivationContextInfo = fromStringInternalOnly("000001a5-0000-0000-c000-000000000046") 21 | var CLSID_SecurityInfo = fromStringInternalOnly("000001a6-0000-0000-c000-000000000046") 22 | var CLSID_ServerLocationInfo = fromStringInternalOnly("000001a4-0000-0000-c000-000000000046") 23 | var CLSID_ScmRequestInfo = fromStringInternalOnly("000001aa-0000-0000-c000-000000000046") 24 | var IID_IObjectExporter = fromStringInternalOnly("99fcfec4-5260-101b-bbcb-00aa0021347a") 25 | var IID_IContext = fromStringInternalOnly("000001c0-0000-0000-c000-000000000046") 26 | var CLSID_ContextMarshaler = fromStringInternalOnly("0000033b-0000-0000-c000-000000000046") 27 | var IID_IRemoteSCMActivator = fromStringInternalOnly("000001A0-0000-0000-C000-000000000046") 28 | 29 | //https://answers.microsoft.com/en-us/windows/forum/all/the-server-8bc3f05e-d86b-11d0-a075-00c04fb68820/7500c1d2-b873-4e68-af8c-89fe7e848658 30 | var CLSID_WMIAppID = fromStringInternalOnly("8bc3f05e-d86b-11d0-a075-00c04fb68820") 31 | 32 | //https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-wmi/3485541f-6950-4e6d-98cb-1ed4bb143441 33 | //https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-wmi/485026a6-d7e0-4ef8-a44f-43e5853fff9d 34 | var CLSID_WbemLevel1Login = fromStringInternalOnly("f309ad18-d86a-11d0-a075-00c04fb68820") 35 | var IID_IWbemLoginClientID = fromStringInternalOnly("d4781cd6-e5d3-44df-ad94-930efe48a887") 36 | var IID_IWbemServices = fromStringInternalOnly("9556dc99-828c-11cf-a37e-00aa003240c7") 37 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/.gitignore: -------------------------------------------------------------------------------- 1 | TAGS 2 | tags 3 | .*.swp 4 | tomlcheck/tomlcheck 5 | toml.test 6 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.1 4 | - 1.2 5 | - 1.3 6 | - 1.4 7 | - 1.5 8 | - 1.6 9 | - tip 10 | install: 11 | - go install ./... 12 | - go get github.com/BurntSushi/toml-test 13 | script: 14 | - export PATH="$PATH:$HOME/gopath/bin" 15 | - make test 16 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/COMPATIBLE: -------------------------------------------------------------------------------- 1 | Compatible with TOML version 2 | [v0.4.0](https://github.com/toml-lang/toml/blob/v0.4.0/versions/en/toml-v0.4.0.md) 3 | 4 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/COPYING: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 TOML authors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/Makefile: -------------------------------------------------------------------------------- 1 | install: 2 | go install ./... 3 | 4 | test: install 5 | go test -v 6 | toml-test toml-test-decoder 7 | toml-test -encoder toml-test-encoder 8 | 9 | fmt: 10 | gofmt -w *.go */*.go 11 | colcheck *.go */*.go 12 | 13 | tags: 14 | find ./ -name '*.go' -print0 | xargs -0 gotags > TAGS 15 | 16 | push: 17 | git push origin master 18 | git push github master 19 | 20 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package toml provides facilities for decoding and encoding TOML configuration 3 | files via reflection. There is also support for delaying decoding with 4 | the Primitive type, and querying the set of keys in a TOML document with the 5 | MetaData type. 6 | 7 | The specification implemented: https://github.com/toml-lang/toml 8 | 9 | The sub-command github.com/BurntSushi/toml/cmd/tomlv can be used to verify 10 | whether a file is a valid TOML document. It can also be used to print the 11 | type of each key in a TOML document. 12 | 13 | Testing 14 | 15 | There are two important types of tests used for this package. The first is 16 | contained inside '*_test.go' files and uses the standard Go unit testing 17 | framework. These tests are primarily devoted to holistically testing the 18 | decoder and encoder. 19 | 20 | The second type of testing is used to verify the implementation's adherence 21 | to the TOML specification. These tests have been factored into their own 22 | project: https://github.com/BurntSushi/toml-test 23 | 24 | The reason the tests are in a separate project is so that they can be used by 25 | any implementation of TOML. Namely, it is language agnostic. 26 | */ 27 | package toml 28 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/encoding_types.go: -------------------------------------------------------------------------------- 1 | // +build go1.2 2 | 3 | package toml 4 | 5 | // In order to support Go 1.1, we define our own TextMarshaler and 6 | // TextUnmarshaler types. For Go 1.2+, we just alias them with the 7 | // standard library interfaces. 8 | 9 | import ( 10 | "encoding" 11 | ) 12 | 13 | // TextMarshaler is a synonym for encoding.TextMarshaler. It is defined here 14 | // so that Go 1.1 can be supported. 15 | type TextMarshaler encoding.TextMarshaler 16 | 17 | // TextUnmarshaler is a synonym for encoding.TextUnmarshaler. It is defined 18 | // here so that Go 1.1 can be supported. 19 | type TextUnmarshaler encoding.TextUnmarshaler 20 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/encoding_types_1.1.go: -------------------------------------------------------------------------------- 1 | // +build !go1.2 2 | 3 | package toml 4 | 5 | // These interfaces were introduced in Go 1.2, so we add them manually when 6 | // compiling for Go 1.1. 7 | 8 | // TextMarshaler is a synonym for encoding.TextMarshaler. It is defined here 9 | // so that Go 1.1 can be supported. 10 | type TextMarshaler interface { 11 | MarshalText() (text []byte, err error) 12 | } 13 | 14 | // TextUnmarshaler is a synonym for encoding.TextUnmarshaler. It is defined 15 | // here so that Go 1.1 can be supported. 16 | type TextUnmarshaler interface { 17 | UnmarshalText(text []byte) error 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/session.vim: -------------------------------------------------------------------------------- 1 | au BufWritePost *.go silent!make tags > /dev/null 2>&1 2 | -------------------------------------------------------------------------------- /vendor/github.com/BurntSushi/toml/type_check.go: -------------------------------------------------------------------------------- 1 | package toml 2 | 3 | // tomlType represents any Go type that corresponds to a TOML type. 4 | // While the first draft of the TOML spec has a simplistic type system that 5 | // probably doesn't need this level of sophistication, we seem to be militating 6 | // toward adding real composite types. 7 | type tomlType interface { 8 | typeString() string 9 | } 10 | 11 | // typeEqual accepts any two types and returns true if they are equal. 12 | func typeEqual(t1, t2 tomlType) bool { 13 | if t1 == nil || t2 == nil { 14 | return false 15 | } 16 | return t1.typeString() == t2.typeString() 17 | } 18 | 19 | func typeIsHash(t tomlType) bool { 20 | return typeEqual(t, tomlHash) || typeEqual(t, tomlArrayHash) 21 | } 22 | 23 | type tomlBaseType string 24 | 25 | func (btype tomlBaseType) typeString() string { 26 | return string(btype) 27 | } 28 | 29 | func (btype tomlBaseType) String() string { 30 | return btype.typeString() 31 | } 32 | 33 | var ( 34 | tomlInteger tomlBaseType = "Integer" 35 | tomlFloat tomlBaseType = "Float" 36 | tomlDatetime tomlBaseType = "Datetime" 37 | tomlString tomlBaseType = "String" 38 | tomlBool tomlBaseType = "Bool" 39 | tomlArray tomlBaseType = "Array" 40 | tomlHash tomlBaseType = "Hash" 41 | tomlArrayHash tomlBaseType = "ArrayHash" 42 | ) 43 | 44 | // typeOfPrimitive returns a tomlType of any primitive value in TOML. 45 | // Primitive values are: Integer, Float, Datetime, String and Bool. 46 | // 47 | // Passing a lexer item other than the following will cause a BUG message 48 | // to occur: itemString, itemBool, itemInteger, itemFloat, itemDatetime. 49 | func (p *parser) typeOfPrimitive(lexItem item) tomlType { 50 | switch lexItem.typ { 51 | case itemInteger: 52 | return tomlInteger 53 | case itemFloat: 54 | return tomlFloat 55 | case itemDatetime: 56 | return tomlDatetime 57 | case itemString: 58 | return tomlString 59 | case itemMultilineString: 60 | return tomlString 61 | case itemRawString: 62 | return tomlString 63 | case itemRawMultilineString: 64 | return tomlString 65 | case itemBool: 66 | return tomlBool 67 | } 68 | p.bug("Cannot infer primitive type of lex item '%s'.", lexItem) 69 | panic("unreachable") 70 | } 71 | 72 | // typeOfArray returns a tomlType for an array given a list of types of its 73 | // values. 74 | // 75 | // In the current spec, if an array is homogeneous, then its type is always 76 | // "Array". If the array is not homogeneous, an error is generated. 77 | func (p *parser) typeOfArray(types []tomlType) tomlType { 78 | // Empty arrays are cool. 79 | if len(types) == 0 { 80 | return tomlArray 81 | } 82 | 83 | theType := types[0] 84 | for _, t := range types[1:] { 85 | if !typeEqual(theType, t) { 86 | p.panicf("Array contains values of type '%s' and '%s', but "+ 87 | "arrays must be homogeneous.", theType, t) 88 | } 89 | } 90 | return tomlArray 91 | } 92 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | range: 80..100 3 | round: down 4 | precision: 2 5 | 6 | status: 7 | project: # measuring the overall project coverage 8 | default: # context, you can create multiple ones with custom titles 9 | enabled: yes # must be yes|true to enable this status 10 | target: 100 # specify the target coverage for each commit status 11 | # option: "auto" (must increase from parent commit or pull request base) 12 | # option: "X%" a static target percentage to hit 13 | if_not_found: success # if parent is not found report status as success, error, or failure 14 | if_ci_failed: error # if ci fails report status as success, error, or failure 15 | 16 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | .DS_Store 3 | /vendor 4 | cover.html 5 | cover.out 6 | lint.log 7 | 8 | # Binaries 9 | *.test 10 | 11 | # Profiling output 12 | *.prof 13 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | go_import_path: go.uber.org/atomic 4 | 5 | env: 6 | global: 7 | - GO111MODULE=on 8 | 9 | matrix: 10 | include: 11 | - go: 1.12.x 12 | - go: 1.13.x 13 | env: LINT=1 14 | 15 | cache: 16 | directories: 17 | - vendor 18 | 19 | before_install: 20 | - go version 21 | 22 | script: 23 | - test -z "$LINT" || make lint 24 | - make cover 25 | 26 | after_success: 27 | - bash <(curl -s https://codecov.io/bash) 28 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [1.5.0] - 2019-10-29 8 | ### Changed 9 | - With Go modules, only the `go.uber.org/atomic` import path is supported now. 10 | If you need to use the old import path, please add a `replace` directive to 11 | your `go.mod`. 12 | 13 | ## [1.4.0] - 2019-05-01 14 | ### Added 15 | - Add `atomic.Error` type for atomic operations on `error` values. 16 | 17 | ## [1.3.2] - 2018-05-02 18 | ### Added 19 | - Add `atomic.Duration` type for atomic operations on `time.Duration` values. 20 | 21 | ## [1.3.1] - 2017-11-14 22 | ### Fixed 23 | - Revert optimization for `atomic.String.Store("")` which caused data races. 24 | 25 | ## [1.3.0] - 2017-11-13 26 | ### Added 27 | - Add `atomic.Bool.CAS` for compare-and-swap semantics on bools. 28 | 29 | ### Changed 30 | - Optimize `atomic.String.Store("")` by avoiding an allocation. 31 | 32 | ## [1.2.0] - 2017-04-12 33 | ### Added 34 | - Shadow `atomic.Value` from `sync/atomic`. 35 | 36 | ## [1.1.0] - 2017-03-10 37 | ### Added 38 | - Add atomic `Float64` type. 39 | 40 | ### Changed 41 | - Support new `go.uber.org/atomic` import path. 42 | 43 | ## [1.0.0] - 2016-07-18 44 | 45 | - Initial release. 46 | 47 | [1.4.0]: https://github.com/uber-go/atomic/compare/v1.4.0...v1.5.0 48 | [1.4.0]: https://github.com/uber-go/atomic/compare/v1.3.2...v1.4.0 49 | [1.3.2]: https://github.com/uber-go/atomic/compare/v1.3.1...v1.3.2 50 | [1.3.1]: https://github.com/uber-go/atomic/compare/v1.3.0...v1.3.1 51 | [1.3.0]: https://github.com/uber-go/atomic/compare/v1.2.0...v1.3.0 52 | [1.2.0]: https://github.com/uber-go/atomic/compare/v1.1.0...v1.2.0 53 | [1.1.0]: https://github.com/uber-go/atomic/compare/v1.0.0...v1.1.0 54 | [1.0.0]: https://github.com/uber-go/atomic/releases/tag/v1.0.0 55 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Uber Technologies, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/Makefile: -------------------------------------------------------------------------------- 1 | # Directory to place `go install`ed binaries into. 2 | export GOBIN ?= $(shell pwd)/bin 3 | 4 | GOLINT = $(GOBIN)/golint 5 | 6 | GO_FILES ?= *.go 7 | 8 | .PHONY: build 9 | build: 10 | go build ./... 11 | 12 | .PHONY: test 13 | test: 14 | go test -race ./... 15 | 16 | .PHONY: gofmt 17 | gofmt: 18 | $(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX)) 19 | gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true 20 | @[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" && cat $(FMT_LOG) && false) 21 | 22 | $(GOLINT): 23 | go install golang.org/x/lint/golint 24 | 25 | .PHONY: golint 26 | golint: $(GOLINT) 27 | $(GOLINT) ./... 28 | 29 | .PHONY: lint 30 | lint: gofmt golint 31 | 32 | .PHONY: cover 33 | cover: 34 | go test -coverprofile=cover.out -coverpkg ./... -v ./... 35 | go tool cover -html=cover.out -o cover.html 36 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/README.md: -------------------------------------------------------------------------------- 1 | # atomic [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][reportcard-img]][reportcard] 2 | 3 | Simple wrappers for primitive types to enforce atomic access. 4 | 5 | ## Installation 6 | 7 | ```shell 8 | $ go get -u go.uber.org/atomic@v1 9 | ``` 10 | 11 | Note: If you are using Go modules, this package will fail to compile with the 12 | import path `github.com/uber-go/atomic`. To continue using that import path, 13 | you will have to add a `replace` directive to your `go.mod`, replacing 14 | `github.com/uber-go/atomic` with `go.uber.org/atomic`. 15 | 16 | ```shell 17 | $ go mod edit -replace github.com/uber-go/atomic=go.uber.org/atomic@v1 18 | ``` 19 | 20 | ## Usage 21 | 22 | The standard library's `sync/atomic` is powerful, but it's easy to forget which 23 | variables must be accessed atomically. `go.uber.org/atomic` preserves all the 24 | functionality of the standard library, but wraps the primitive types to 25 | provide a safer, more convenient API. 26 | 27 | ```go 28 | var atom atomic.Uint32 29 | atom.Store(42) 30 | atom.Sub(2) 31 | atom.CAS(40, 11) 32 | ``` 33 | 34 | See the [documentation][doc] for a complete API specification. 35 | 36 | ## Development Status 37 | 38 | Stable. 39 | 40 | --- 41 | 42 | Released under the [MIT License](LICENSE.txt). 43 | 44 | [doc-img]: https://godoc.org/github.com/uber-go/atomic?status.svg 45 | [doc]: https://godoc.org/go.uber.org/atomic 46 | [ci-img]: https://travis-ci.com/uber-go/atomic.svg?branch=master 47 | [ci]: https://travis-ci.com/uber-go/atomic 48 | [cov-img]: https://codecov.io/gh/uber-go/atomic/branch/master/graph/badge.svg 49 | [cov]: https://codecov.io/gh/uber-go/atomic 50 | [reportcard-img]: https://goreportcard.com/badge/go.uber.org/atomic 51 | [reportcard]: https://goreportcard.com/report/go.uber.org/atomic 52 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/error.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | package atomic 22 | 23 | // Error is an atomic type-safe wrapper around Value for errors 24 | type Error struct{ v Value } 25 | 26 | // errorHolder is non-nil holder for error object. 27 | // atomic.Value panics on saving nil object, so err object needs to be 28 | // wrapped with valid object first. 29 | type errorHolder struct{ err error } 30 | 31 | // NewError creates new atomic error object 32 | func NewError(err error) *Error { 33 | e := &Error{} 34 | if err != nil { 35 | e.Store(err) 36 | } 37 | return e 38 | } 39 | 40 | // Load atomically loads the wrapped error 41 | func (e *Error) Load() error { 42 | v := e.v.Load() 43 | if v == nil { 44 | return nil 45 | } 46 | 47 | eh := v.(errorHolder) 48 | return eh.err 49 | } 50 | 51 | // Store atomically stores error. 52 | // NOTE: a holder object is allocated on each Store call. 53 | func (e *Error) Store(err error) { 54 | e.v.Store(errorHolder{err: err}) 55 | } 56 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/go.mod: -------------------------------------------------------------------------------- 1 | module go.uber.org/atomic 2 | 3 | require ( 4 | github.com/davecgh/go-spew v1.1.1 // indirect 5 | github.com/stretchr/testify v1.3.0 6 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de 7 | golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c // indirect 8 | ) 9 | 10 | go 1.13 11 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= 2 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 3 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 4 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 5 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 6 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 7 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 8 | github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= 9 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 10 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 11 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= 12 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 13 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 14 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 15 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 16 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 17 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 18 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ= 19 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 20 | golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c h1:IGkKhmfzcztjm6gYkykvu/NiS8kaqbCWAEWWAyf8J5U= 21 | golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 22 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 23 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/string.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | package atomic 22 | 23 | // String is an atomic type-safe wrapper around Value for strings. 24 | type String struct{ v Value } 25 | 26 | // NewString creates a String. 27 | func NewString(str string) *String { 28 | s := &String{} 29 | if str != "" { 30 | s.Store(str) 31 | } 32 | return s 33 | } 34 | 35 | // Load atomically loads the wrapped string. 36 | func (s *String) Load() string { 37 | v := s.v.Load() 38 | if v == nil { 39 | return "" 40 | } 41 | return v.(string) 42 | } 43 | 44 | // Store atomically stores the passed string. 45 | // Note: Converting the string to an interface{} to store in the Value 46 | // requires an allocation. 47 | func (s *String) Store(str string) { 48 | s.v.Store(str) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/tools.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | // +build tools 22 | 23 | package atomic 24 | 25 | import ( 26 | // Tools used during development. 27 | _ "golang.org/x/lint/golint" 28 | ) 29 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | range: 80..100 3 | round: down 4 | precision: 2 5 | 6 | status: 7 | project: # measuring the overall project coverage 8 | default: # context, you can create multiple ones with custom titles 9 | enabled: yes # must be yes|true to enable this status 10 | target: 100 # specify the target coverage for each commit status 11 | # option: "auto" (must increase from parent commit or pull request base) 12 | # option: "X%" a static target percentage to hit 13 | if_not_found: success # if parent is not found report status as success, error, or failure 14 | if_ci_failed: error # if ci fails report status as success, error, or failure 15 | 16 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | cover.html 3 | cover.out 4 | /bin 5 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | go_import_path: go.uber.org/multierr 4 | 5 | env: 6 | global: 7 | - GO15VENDOREXPERIMENT=1 8 | - GO111MODULE=on 9 | 10 | go: 11 | - 1.11.x 12 | - 1.12.x 13 | - 1.13.x 14 | 15 | cache: 16 | directories: 17 | - vendor 18 | 19 | before_install: 20 | - go version 21 | 22 | script: 23 | - | 24 | set -e 25 | make lint 26 | make cover 27 | 28 | after_success: 29 | - bash <(curl -s https://codecov.io/bash) 30 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Releases 2 | ======== 3 | 4 | v1.3.0 (2019-10-29) 5 | =================== 6 | 7 | - Switch to Go modules. 8 | 9 | 10 | v1.2.0 (2019-09-26) 11 | =================== 12 | 13 | - Support extracting and matching against wrapped errors with `errors.As` 14 | and `errors.Is`. 15 | 16 | 17 | v1.1.0 (2017-06-30) 18 | =================== 19 | 20 | - Added an `Errors(error) []error` function to extract the underlying list of 21 | errors for a multierr error. 22 | 23 | 24 | v1.0.0 (2017-05-31) 25 | =================== 26 | 27 | No changes since v0.2.0. This release is committing to making no breaking 28 | changes to the current API in the 1.X series. 29 | 30 | 31 | v0.2.0 (2017-04-11) 32 | =================== 33 | 34 | - Repeatedly appending to the same error is now faster due to fewer 35 | allocations. 36 | 37 | 38 | v0.1.0 (2017-31-03) 39 | =================== 40 | 41 | - Initial release 42 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Uber Technologies, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/Makefile: -------------------------------------------------------------------------------- 1 | # Directory to put `go install`ed binaries in. 2 | export GOBIN ?= $(shell pwd)/bin 3 | 4 | GO_FILES := $(shell \ 5 | find . '(' -path '*/.*' -o -path './vendor' ')' -prune \ 6 | -o -name '*.go' -print | cut -b3-) 7 | 8 | .PHONY: build 9 | build: 10 | go build ./... 11 | 12 | .PHONY: test 13 | test: 14 | go test -race ./... 15 | 16 | .PHONY: gofmt 17 | gofmt: 18 | $(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX)) 19 | @gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true 20 | @[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" | cat - $(FMT_LOG) && false) 21 | 22 | .PHONY: golint 23 | golint: 24 | @go install golang.org/x/lint/golint 25 | @$(GOBIN)/golint ./... 26 | 27 | .PHONY: staticcheck 28 | staticcheck: 29 | @go install honnef.co/go/tools/cmd/staticcheck 30 | @$(GOBIN)/staticcheck ./... 31 | 32 | .PHONY: lint 33 | lint: gofmt golint staticcheck 34 | 35 | .PHONY: cover 36 | cover: 37 | go test -coverprofile=cover.out -coverpkg=./... -v ./... 38 | go tool cover -html=cover.out -o cover.html 39 | 40 | update-license: 41 | @go install go.uber.org/tools/update-license 42 | @$(GOBIN)/update-license $(GO_FILES) 43 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/README.md: -------------------------------------------------------------------------------- 1 | # multierr [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] 2 | 3 | `multierr` allows combining one or more Go `error`s together. 4 | 5 | ## Installation 6 | 7 | go get -u go.uber.org/multierr 8 | 9 | ## Status 10 | 11 | Stable: No breaking changes will be made before 2.0. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | Released under the [MIT License]. 16 | 17 | [MIT License]: LICENSE.txt 18 | [doc-img]: https://godoc.org/go.uber.org/multierr?status.svg 19 | [doc]: https://godoc.org/go.uber.org/multierr 20 | [ci-img]: https://travis-ci.com/uber-go/multierr.svg?branch=master 21 | [cov-img]: https://codecov.io/gh/uber-go/multierr/branch/master/graph/badge.svg 22 | [ci]: https://travis-ci.com/uber-go/multierr 23 | [cov]: https://codecov.io/gh/uber-go/multierr 24 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/glide.yaml: -------------------------------------------------------------------------------- 1 | package: go.uber.org/multierr 2 | import: 3 | - package: go.uber.org/atomic 4 | version: ^1 5 | testImport: 6 | - package: github.com/stretchr/testify 7 | subpackages: 8 | - assert 9 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/go.mod: -------------------------------------------------------------------------------- 1 | module go.uber.org/multierr 2 | 3 | go 1.12 4 | 5 | require ( 6 | github.com/stretchr/testify v1.3.0 7 | go.uber.org/atomic v1.5.0 8 | go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee 9 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de 10 | golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 // indirect 11 | honnef.co/go/tools v0.0.1-2019.2.3 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/go113.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | // +build go1.13 22 | 23 | package multierr 24 | 25 | import "errors" 26 | 27 | // As attempts to find the first error in the error list that matches the type 28 | // of the value that target points to. 29 | // 30 | // This function allows errors.As to traverse the values stored on the 31 | // multierr error. 32 | func (merr *multiError) As(target interface{}) bool { 33 | for _, err := range merr.Errors() { 34 | if errors.As(err, target) { 35 | return true 36 | } 37 | } 38 | return false 39 | } 40 | 41 | // Is attempts to match the provided error against errors in the error list. 42 | // 43 | // This function allows errors.Is to traverse the values stored on the 44 | // multierr error. 45 | func (merr *multiError) Is(target error) bool { 46 | for _, err := range merr.Errors() { 47 | if errors.Is(err, target) { 48 | return true 49 | } 50 | } 51 | return false 52 | } 53 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/tools.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | // +build tools 22 | 23 | package multierr 24 | 25 | import ( 26 | // Tools we use during development. 27 | _ "go.uber.org/tools/update-license" 28 | _ "golang.org/x/lint/golint" 29 | _ "honnef.co/go/tools/cmd/staticcheck" 30 | ) 31 | -------------------------------------------------------------------------------- /vendor/go.uber.org/tools/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Uber Technologies, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/go.uber.org/tools/update-license/.gitignore: -------------------------------------------------------------------------------- 1 | update-license 2 | -------------------------------------------------------------------------------- /vendor/go.uber.org/tools/update-license/README.md: -------------------------------------------------------------------------------- 1 | # update-license 2 | 3 | This is a small tool that updates the license header for Uber's open source Golang files. 4 | 5 | ## Installation 6 | 7 | ``` 8 | go get go.uber.org/tools/update-license 9 | ``` 10 | 11 | ## Usage 12 | 13 | ``` 14 | update-license go_files... 15 | ``` 16 | 17 | ## Further Work 18 | 19 | * Support more licenses by name (MIT, Apache 2.0, etc), file path, url (http GET) 20 | * Support custom owner (not just "Uber Technologies, Inc.") 21 | * Support more languages than go (cover go, java, js, py to start, along with LICENSE, LICENSE.txt) 22 | * Talk about removing custom logic for header comments (ie `@generated`, `Code generated by`), it probably makes more sense just to put the license at the top 23 | * Better detection support for existing licenses so they can be removed 24 | * Verbose, dry run support 25 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | range: 80..100 3 | round: down 4 | precision: 2 5 | 6 | status: 7 | project: # measuring the overall project coverage 8 | default: # context, you can create multiple ones with custom titles 9 | enabled: yes # must be yes|true to enable this status 10 | target: 95% # specify the target coverage for each commit status 11 | # option: "auto" (must increase from parent commit or pull request base) 12 | # option: "X%" a static target percentage to hit 13 | if_not_found: success # if parent is not found report status as success, error, or failure 14 | if_ci_failed: error # if ci fails report status as success, error, or failure 15 | ignore: 16 | - internal/readme/readme.go 17 | 18 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/.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 | vendor 10 | 11 | # Architecture specific extensions/prefixes 12 | *.[568vq] 13 | [568vq].out 14 | 15 | *.cgo1.go 16 | *.cgo2.c 17 | _cgo_defun.c 18 | _cgo_gotypes.go 19 | _cgo_export.* 20 | 21 | _testmain.go 22 | 23 | *.exe 24 | *.test 25 | *.prof 26 | *.pprof 27 | *.out 28 | *.log 29 | 30 | /bin 31 | cover.out 32 | cover.html 33 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | 4 | go_import_path: go.uber.org/zap 5 | env: 6 | global: 7 | - TEST_TIMEOUT_SCALE=10 8 | - GO111MODULE=on 9 | 10 | matrix: 11 | include: 12 | - go: 1.12.x 13 | - go: 1.13.x 14 | env: LINT=1 15 | 16 | script: 17 | - test -z "$LINT" || make lint 18 | - make test 19 | - make bench 20 | 21 | after_success: 22 | - make cover 23 | - bash <(curl -s https://codecov.io/bash) 24 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We'd love your help making zap the very best structured logging library in Go! 4 | 5 | If you'd like to add new exported APIs, please [open an issue][open-issue] 6 | describing your proposal — discussing API changes ahead of time makes 7 | pull request review much smoother. In your issue, pull request, and any other 8 | communications, please remember to treat your fellow contributors with 9 | respect! We take our [code of conduct](CODE_OF_CONDUCT.md) seriously. 10 | 11 | Note that you'll need to sign [Uber's Contributor License Agreement][cla] 12 | before we can accept any of your contributions. If necessary, a bot will remind 13 | you to accept the CLA when you open your pull request. 14 | 15 | ## Setup 16 | 17 | [Fork][fork], then clone the repository: 18 | 19 | ``` 20 | mkdir -p $GOPATH/src/go.uber.org 21 | cd $GOPATH/src/go.uber.org 22 | git clone git@github.com:your_github_username/zap.git 23 | cd zap 24 | git remote add upstream https://github.com/uber-go/zap.git 25 | git fetch upstream 26 | ``` 27 | 28 | Install zap's dependencies: 29 | 30 | ``` 31 | make dependencies 32 | ``` 33 | 34 | Make sure that the tests and the linters pass: 35 | 36 | ``` 37 | make test 38 | make lint 39 | ``` 40 | 41 | If you're not using the minor version of Go specified in the Makefile's 42 | `LINTABLE_MINOR_VERSIONS` variable, `make lint` doesn't do anything. This is 43 | fine, but it means that you'll only discover lint failures after you open your 44 | pull request. 45 | 46 | ## Making Changes 47 | 48 | Start by creating a new branch for your changes: 49 | 50 | ``` 51 | cd $GOPATH/src/go.uber.org/zap 52 | git checkout master 53 | git fetch upstream 54 | git rebase upstream/master 55 | git checkout -b cool_new_feature 56 | ``` 57 | 58 | Make your changes, then ensure that `make lint` and `make test` still pass. If 59 | you're satisfied with your changes, push them to your fork. 60 | 61 | ``` 62 | git push origin cool_new_feature 63 | ``` 64 | 65 | Then use the GitHub UI to open a pull request. 66 | 67 | At this point, you're waiting on us to review your changes. We *try* to respond 68 | to issues and pull requests within a few business days, and we may suggest some 69 | improvements or alternatives. Once your changes are approved, one of the 70 | project maintainers will merge them. 71 | 72 | We're much more likely to approve your changes if you: 73 | 74 | * Add tests for new functionality. 75 | * Write a [good commit message][commit-message]. 76 | * Maintain backward compatibility. 77 | 78 | [fork]: https://github.com/uber-go/zap/fork 79 | [open-issue]: https://github.com/uber-go/zap/issues/new 80 | [cla]: https://cla-assistant.io/uber-go/zap 81 | [commit-message]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html 82 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2017 Uber Technologies, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/Makefile: -------------------------------------------------------------------------------- 1 | export GOBIN ?= $(shell pwd)/bin 2 | 3 | GOLINT = $(GOBIN)/golint 4 | BENCH_FLAGS ?= -cpuprofile=cpu.pprof -memprofile=mem.pprof -benchmem 5 | 6 | # Directories containing independent Go modules. 7 | # 8 | # We track coverage only for the main module. 9 | MODULE_DIRS = . ./benchmarks 10 | 11 | # Many Go tools take file globs or directories as arguments instead of packages. 12 | GO_FILES := $(shell \ 13 | find . '(' -path '*/.*' -o -path './vendor' ')' -prune \ 14 | -o -name '*.go' -print | cut -b3-) 15 | 16 | .PHONY: all 17 | all: lint test 18 | 19 | .PHONY: lint 20 | lint: $(GOLINT) 21 | @rm -rf lint.log 22 | @echo "Checking formatting..." 23 | @gofmt -d -s $(GO_FILES) 2>&1 | tee lint.log 24 | @echo "Checking vet..." 25 | @$(foreach dir,$(MODULE_DIRS),(cd $(dir) && go vet ./... 2>&1) &&) true | tee -a lint.log 26 | @echo "Checking lint..." 27 | @$(foreach dir,$(MODULE_DIRS),(cd $(dir) && $(GOLINT) ./... 2>&1) &&) true | tee -a lint.log 28 | @echo "Checking for unresolved FIXMEs..." 29 | @git grep -i fixme | grep -v -e Makefile | tee -a lint.log 30 | @echo "Checking for license headers..." 31 | @./checklicense.sh | tee -a lint.log 32 | @[ ! -s lint.log ] 33 | 34 | $(GOLINT): 35 | go install golang.org/x/lint/golint 36 | 37 | .PHONY: test 38 | test: 39 | @$(foreach dir,$(MODULE_DIRS),(cd $(dir) && go test -race ./...) &&) true 40 | 41 | .PHONY: cover 42 | cover: 43 | go test -race -coverprofile=cover.out -coverpkg=./... ./... 44 | go tool cover -html=cover.out -o cover.html 45 | 46 | .PHONY: bench 47 | BENCH ?= . 48 | bench: 49 | @$(foreach dir,$(MODULE_DIRS), ( \ 50 | cd $(dir) && \ 51 | go list ./... | xargs -n1 go test -bench=$(BENCH) -run="^$$" $(BENCH_FLAGS) \ 52 | ) &&) true 53 | 54 | .PHONY: updatereadme 55 | updatereadme: 56 | rm -f README.md 57 | cat .readme.tmpl | go run internal/readme/readme.go > README.md 58 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/buffer/pool.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | package buffer 22 | 23 | import "sync" 24 | 25 | // A Pool is a type-safe wrapper around a sync.Pool. 26 | type Pool struct { 27 | p *sync.Pool 28 | } 29 | 30 | // NewPool constructs a new Pool. 31 | func NewPool() Pool { 32 | return Pool{p: &sync.Pool{ 33 | New: func() interface{} { 34 | return &Buffer{bs: make([]byte, 0, _size)} 35 | }, 36 | }} 37 | } 38 | 39 | // Get retrieves a Buffer from the pool, creating one if necessary. 40 | func (p Pool) Get() *Buffer { 41 | buf := p.p.Get().(*Buffer) 42 | buf.Reset() 43 | buf.pool = p 44 | return buf 45 | } 46 | 47 | func (p Pool) put(buf *Buffer) { 48 | p.p.Put(buf) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/checklicense.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | ERROR_COUNT=0 4 | while read -r file 5 | do 6 | case "$(head -1 "${file}")" in 7 | *"Copyright (c) "*" Uber Technologies, Inc.") 8 | # everything's cool 9 | ;; 10 | *) 11 | echo "$file is missing license header." 12 | (( ERROR_COUNT++ )) 13 | ;; 14 | esac 15 | done < <(git ls-files "*\.go") 16 | 17 | exit $ERROR_COUNT 18 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/encoder.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | package zap 22 | 23 | import ( 24 | "errors" 25 | "fmt" 26 | "sync" 27 | 28 | "go.uber.org/zap/zapcore" 29 | ) 30 | 31 | var ( 32 | errNoEncoderNameSpecified = errors.New("no encoder name specified") 33 | 34 | _encoderNameToConstructor = map[string]func(zapcore.EncoderConfig) (zapcore.Encoder, error){ 35 | "console": func(encoderConfig zapcore.EncoderConfig) (zapcore.Encoder, error) { 36 | return zapcore.NewConsoleEncoder(encoderConfig), nil 37 | }, 38 | "json": func(encoderConfig zapcore.EncoderConfig) (zapcore.Encoder, error) { 39 | return zapcore.NewJSONEncoder(encoderConfig), nil 40 | }, 41 | } 42 | _encoderMutex sync.RWMutex 43 | ) 44 | 45 | // RegisterEncoder registers an encoder constructor, which the Config struct 46 | // can then reference. By default, the "json" and "console" encoders are 47 | // registered. 48 | // 49 | // Attempting to register an encoder whose name is already taken returns an 50 | // error. 51 | func RegisterEncoder(name string, constructor func(zapcore.EncoderConfig) (zapcore.Encoder, error)) error { 52 | _encoderMutex.Lock() 53 | defer _encoderMutex.Unlock() 54 | if name == "" { 55 | return errNoEncoderNameSpecified 56 | } 57 | if _, ok := _encoderNameToConstructor[name]; ok { 58 | return fmt.Errorf("encoder already registered for name %q", name) 59 | } 60 | _encoderNameToConstructor[name] = constructor 61 | return nil 62 | } 63 | 64 | func newEncoder(name string, encoderConfig zapcore.EncoderConfig) (zapcore.Encoder, error) { 65 | _encoderMutex.RLock() 66 | defer _encoderMutex.RUnlock() 67 | if name == "" { 68 | return nil, errNoEncoderNameSpecified 69 | } 70 | constructor, ok := _encoderNameToConstructor[name] 71 | if !ok { 72 | return nil, fmt.Errorf("no encoder registered for name %q", name) 73 | } 74 | return constructor(encoderConfig) 75 | } 76 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/flag.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | package zap 22 | 23 | import ( 24 | "flag" 25 | 26 | "go.uber.org/zap/zapcore" 27 | ) 28 | 29 | // LevelFlag uses the standard library's flag.Var to declare a global flag 30 | // with the specified name, default, and usage guidance. The returned value is 31 | // a pointer to the value of the flag. 32 | // 33 | // If you don't want to use the flag package's global state, you can use any 34 | // non-nil *Level as a flag.Value with your own *flag.FlagSet. 35 | func LevelFlag(name string, defaultLevel zapcore.Level, usage string) *zapcore.Level { 36 | lvl := defaultLevel 37 | flag.Var(&lvl, name, usage) 38 | return &lvl 39 | } 40 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/glide.yaml: -------------------------------------------------------------------------------- 1 | package: go.uber.org/zap 2 | license: MIT 3 | import: 4 | - package: go.uber.org/atomic 5 | version: ^1 6 | - package: go.uber.org/multierr 7 | version: ^1 8 | testImport: 9 | - package: github.com/satori/go.uuid 10 | - package: github.com/sirupsen/logrus 11 | - package: github.com/apex/log 12 | subpackages: 13 | - handlers/json 14 | - package: github.com/go-kit/kit 15 | subpackages: 16 | - log 17 | - package: github.com/stretchr/testify 18 | subpackages: 19 | - assert 20 | - require 21 | - package: gopkg.in/inconshreveable/log15.v2 22 | - package: github.com/mattn/goveralls 23 | - package: github.com/pborman/uuid 24 | - package: github.com/pkg/errors 25 | - package: github.com/rs/zerolog 26 | - package: golang.org/x/tools 27 | subpackages: 28 | - cover 29 | - package: golang.org/x/lint 30 | subpackages: 31 | - golint 32 | - package: github.com/axw/gocov 33 | subpackages: 34 | - gocov 35 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/global_go112.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | // See #682 for more information. 22 | // +build go1.12 23 | 24 | package zap 25 | 26 | const _stdLogDefaultDepth = 1 27 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/global_prego112.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | // See #682 for more information. 22 | // +build !go1.12 23 | 24 | package zap 25 | 26 | const _stdLogDefaultDepth = 2 27 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/go.mod: -------------------------------------------------------------------------------- 1 | module go.uber.org/zap 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/pkg/errors v0.8.1 7 | github.com/stretchr/testify v1.4.0 8 | go.uber.org/atomic v1.5.0 9 | go.uber.org/multierr v1.3.0 10 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de 11 | ) 12 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/http_handler.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | package zap 22 | 23 | import ( 24 | "encoding/json" 25 | "fmt" 26 | "net/http" 27 | 28 | "go.uber.org/zap/zapcore" 29 | ) 30 | 31 | // ServeHTTP is a simple JSON endpoint that can report on or change the current 32 | // logging level. 33 | // 34 | // GET requests return a JSON description of the current logging level. PUT 35 | // requests change the logging level and expect a payload like: 36 | // {"level":"info"} 37 | // 38 | // It's perfectly safe to change the logging level while a program is running. 39 | func (lvl AtomicLevel) ServeHTTP(w http.ResponseWriter, r *http.Request) { 40 | type errorResponse struct { 41 | Error string `json:"error"` 42 | } 43 | type payload struct { 44 | Level *zapcore.Level `json:"level"` 45 | } 46 | 47 | enc := json.NewEncoder(w) 48 | 49 | switch r.Method { 50 | 51 | case http.MethodGet: 52 | current := lvl.Level() 53 | enc.Encode(payload{Level: ¤t}) 54 | 55 | case http.MethodPut: 56 | var req payload 57 | 58 | if errmess := func() string { 59 | if err := json.NewDecoder(r.Body).Decode(&req); err != nil { 60 | return fmt.Sprintf("Request body must be well-formed JSON: %v", err) 61 | } 62 | if req.Level == nil { 63 | return "Must specify a logging level." 64 | } 65 | return "" 66 | }(); errmess != "" { 67 | w.WriteHeader(http.StatusBadRequest) 68 | enc.Encode(errorResponse{Error: errmess}) 69 | return 70 | } 71 | 72 | lvl.SetLevel(*req.Level) 73 | enc.Encode(req) 74 | 75 | default: 76 | w.WriteHeader(http.StatusMethodNotAllowed) 77 | enc.Encode(errorResponse{ 78 | Error: "Only GET and PUT are supported.", 79 | }) 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | // Package bufferpool houses zap's shared internal buffer pool. Third-party 22 | // packages can recreate the same functionality with buffers.NewPool. 23 | package bufferpool 24 | 25 | import "go.uber.org/zap/buffer" 26 | 27 | var ( 28 | _pool = buffer.NewPool() 29 | // Get retrieves a buffer from the pool, creating one if necessary. 30 | Get = _pool.Get 31 | ) 32 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/internal/color/color.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | // Package color adds coloring functionality for TTY output. 22 | package color 23 | 24 | import "fmt" 25 | 26 | // Foreground colors. 27 | const ( 28 | Black Color = iota + 30 29 | Red 30 | Green 31 | Yellow 32 | Blue 33 | Magenta 34 | Cyan 35 | White 36 | ) 37 | 38 | // Color represents a text color. 39 | type Color uint8 40 | 41 | // Add adds the coloring to the given string. 42 | func (c Color) Add(s string) string { 43 | return fmt.Sprintf("\x1b[%dm%s\x1b[0m", uint8(c), s) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/internal/exit/exit.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | // Package exit provides stubs so that unit tests can exercise code that calls 22 | // os.Exit(1). 23 | package exit 24 | 25 | import "os" 26 | 27 | var real = func() { os.Exit(1) } 28 | 29 | // Exit normally terminates the process by calling os.Exit(1). If the package 30 | // is stubbed, it instead records a call in the testing spy. 31 | func Exit() { 32 | real() 33 | } 34 | 35 | // A StubbedExit is a testing fake for os.Exit. 36 | type StubbedExit struct { 37 | Exited bool 38 | prev func() 39 | } 40 | 41 | // Stub substitutes a fake for the call to os.Exit(1). 42 | func Stub() *StubbedExit { 43 | s := &StubbedExit{prev: real} 44 | real = s.exit 45 | return s 46 | } 47 | 48 | // WithStub runs the supplied function with Exit stubbed. It returns the stub 49 | // used, so that users can test whether the process would have crashed. 50 | func WithStub(f func()) *StubbedExit { 51 | s := Stub() 52 | defer s.Unstub() 53 | f() 54 | return s 55 | } 56 | 57 | // Unstub restores the previous exit function. 58 | func (se *StubbedExit) Unstub() { 59 | real = se.prev 60 | } 61 | 62 | func (se *StubbedExit) exit() { 63 | se.Exited = true 64 | } 65 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/time.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | package zap 22 | 23 | import "time" 24 | 25 | func timeToMillis(t time.Time) int64 { 26 | return t.UnixNano() / int64(time.Millisecond) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/tools.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | // +build tools 22 | 23 | package zap 24 | 25 | import ( 26 | // Tools we use during development. 27 | _ "golang.org/x/lint/golint" 28 | ) 29 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/zapcore/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | // Package zapcore defines and implements the low-level interfaces upon which 22 | // zap is built. By providing alternate implementations of these interfaces, 23 | // external packages can extend zap's capabilities. 24 | package zapcore // import "go.uber.org/zap/zapcore" 25 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/zapcore/hook.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | package zapcore 22 | 23 | import "go.uber.org/multierr" 24 | 25 | type hooked struct { 26 | Core 27 | funcs []func(Entry) error 28 | } 29 | 30 | // RegisterHooks wraps a Core and runs a collection of user-defined callback 31 | // hooks each time a message is logged. Execution of the callbacks is blocking. 32 | // 33 | // This offers users an easy way to register simple callbacks (e.g., metrics 34 | // collection) without implementing the full Core interface. 35 | func RegisterHooks(core Core, hooks ...func(Entry) error) Core { 36 | funcs := append([]func(Entry) error{}, hooks...) 37 | return &hooked{ 38 | Core: core, 39 | funcs: funcs, 40 | } 41 | } 42 | 43 | func (h *hooked) Check(ent Entry, ce *CheckedEntry) *CheckedEntry { 44 | // Let the wrapped Core decide whether to log this message or not. This 45 | // also gives the downstream a chance to register itself directly with the 46 | // CheckedEntry. 47 | if downstream := h.Core.Check(ent, ce); downstream != nil { 48 | return downstream.AddCore(ent, h) 49 | } 50 | return ce 51 | } 52 | 53 | func (h *hooked) With(fields []Field) Core { 54 | return &hooked{ 55 | Core: h.Core.With(fields), 56 | funcs: h.funcs, 57 | } 58 | } 59 | 60 | func (h *hooked) Write(ent Entry, _ []Field) error { 61 | // Since our downstream had a chance to register itself directly with the 62 | // CheckedMessage, we don't need to call it here. 63 | var err error 64 | for i := range h.funcs { 65 | err = multierr.Append(err, h.funcs[i](ent)) 66 | } 67 | return err 68 | } 69 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/zapcore/increase_level.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | package zapcore 22 | 23 | import "fmt" 24 | 25 | type levelFilterCore struct { 26 | Core 27 | 28 | level LevelEnabler 29 | } 30 | 31 | // NewIncreaseLevelCore creates a core that can be used to increase the level of 32 | // an existing Core. It cannot be used to decrease the logging level, as it acts 33 | // as a filter before calling the underlying core. If level decreases the log level, 34 | // an error is returned. 35 | func NewIncreaseLevelCore(core Core, level LevelEnabler) (Core, error) { 36 | for l := _maxLevel; l >= _minLevel; l-- { 37 | if !core.Enabled(l) && level.Enabled(l) { 38 | return nil, fmt.Errorf("invalid increase level, as level %q is allowed by increased level, but not by existing core", l) 39 | } 40 | } 41 | 42 | return &levelFilterCore{core, level}, nil 43 | } 44 | 45 | func (c *levelFilterCore) Enabled(lvl Level) bool { 46 | return c.level.Enabled(lvl) 47 | } 48 | 49 | func (c *levelFilterCore) Check(ent Entry, ce *CheckedEntry) *CheckedEntry { 50 | if !c.Enabled(ent.Level) { 51 | return ce 52 | } 53 | 54 | return c.Core.Check(ent, ce) 55 | } 56 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/zapcore/level_strings.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | package zapcore 22 | 23 | import "go.uber.org/zap/internal/color" 24 | 25 | var ( 26 | _levelToColor = map[Level]color.Color{ 27 | DebugLevel: color.Magenta, 28 | InfoLevel: color.Blue, 29 | WarnLevel: color.Yellow, 30 | ErrorLevel: color.Red, 31 | DPanicLevel: color.Red, 32 | PanicLevel: color.Red, 33 | FatalLevel: color.Red, 34 | } 35 | _unknownLevelColor = color.Red 36 | 37 | _levelToLowercaseColorString = make(map[Level]string, len(_levelToColor)) 38 | _levelToCapitalColorString = make(map[Level]string, len(_levelToColor)) 39 | ) 40 | 41 | func init() { 42 | for level, color := range _levelToColor { 43 | _levelToLowercaseColorString[level] = color.Add(level.String()) 44 | _levelToCapitalColorString[level] = color.Add(level.CapitalString()) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/zapcore/marshaler.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | package zapcore 22 | 23 | // ObjectMarshaler allows user-defined types to efficiently add themselves to the 24 | // logging context, and to selectively omit information which shouldn't be 25 | // included in logs (e.g., passwords). 26 | type ObjectMarshaler interface { 27 | MarshalLogObject(ObjectEncoder) error 28 | } 29 | 30 | // ObjectMarshalerFunc is a type adapter that turns a function into an 31 | // ObjectMarshaler. 32 | type ObjectMarshalerFunc func(ObjectEncoder) error 33 | 34 | // MarshalLogObject calls the underlying function. 35 | func (f ObjectMarshalerFunc) MarshalLogObject(enc ObjectEncoder) error { 36 | return f(enc) 37 | } 38 | 39 | // ArrayMarshaler allows user-defined types to efficiently add themselves to the 40 | // logging context, and to selectively omit information which shouldn't be 41 | // included in logs (e.g., passwords). 42 | type ArrayMarshaler interface { 43 | MarshalLogArray(ArrayEncoder) error 44 | } 45 | 46 | // ArrayMarshalerFunc is a type adapter that turns a function into an 47 | // ArrayMarshaler. 48 | type ArrayMarshalerFunc func(ArrayEncoder) error 49 | 50 | // MarshalLogArray calls the underlying function. 51 | func (f ArrayMarshalerFunc) MarshalLogArray(enc ArrayEncoder) error { 52 | return f(enc) 53 | } 54 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/zapcore/tee.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | package zapcore 22 | 23 | import "go.uber.org/multierr" 24 | 25 | type multiCore []Core 26 | 27 | // NewTee creates a Core that duplicates log entries into two or more 28 | // underlying Cores. 29 | // 30 | // Calling it with a single Core returns the input unchanged, and calling 31 | // it with no input returns a no-op Core. 32 | func NewTee(cores ...Core) Core { 33 | switch len(cores) { 34 | case 0: 35 | return NewNopCore() 36 | case 1: 37 | return cores[0] 38 | default: 39 | return multiCore(cores) 40 | } 41 | } 42 | 43 | func (mc multiCore) With(fields []Field) Core { 44 | clone := make(multiCore, len(mc)) 45 | for i := range mc { 46 | clone[i] = mc[i].With(fields) 47 | } 48 | return clone 49 | } 50 | 51 | func (mc multiCore) Enabled(lvl Level) bool { 52 | for i := range mc { 53 | if mc[i].Enabled(lvl) { 54 | return true 55 | } 56 | } 57 | return false 58 | } 59 | 60 | func (mc multiCore) Check(ent Entry, ce *CheckedEntry) *CheckedEntry { 61 | for i := range mc { 62 | ce = mc[i].Check(ent, ce) 63 | } 64 | return ce 65 | } 66 | 67 | func (mc multiCore) Write(ent Entry, fields []Field) error { 68 | var err error 69 | for i := range mc { 70 | err = multierr.Append(err, mc[i].Write(ent, fields)) 71 | } 72 | return err 73 | } 74 | 75 | func (mc multiCore) Sync() error { 76 | var err error 77 | for i := range mc { 78 | err = multierr.Append(err, mc[i].Sync()) 79 | } 80 | return err 81 | } 82 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at https://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at https://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/md4/md4.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 md4 implements the MD4 hash algorithm as defined in RFC 1320. 6 | // 7 | // Deprecated: MD4 is cryptographically broken and should should only be used 8 | // where compatibility with legacy systems, not security, is the goal. Instead, 9 | // use a secure hash like SHA-256 (from crypto/sha256). 10 | package md4 // import "golang.org/x/crypto/md4" 11 | 12 | import ( 13 | "crypto" 14 | "hash" 15 | ) 16 | 17 | func init() { 18 | crypto.RegisterHash(crypto.MD4, New) 19 | } 20 | 21 | // The size of an MD4 checksum in bytes. 22 | const Size = 16 23 | 24 | // The blocksize of MD4 in bytes. 25 | const BlockSize = 64 26 | 27 | const ( 28 | _Chunk = 64 29 | _Init0 = 0x67452301 30 | _Init1 = 0xEFCDAB89 31 | _Init2 = 0x98BADCFE 32 | _Init3 = 0x10325476 33 | ) 34 | 35 | // digest represents the partial evaluation of a checksum. 36 | type digest struct { 37 | s [4]uint32 38 | x [_Chunk]byte 39 | nx int 40 | len uint64 41 | } 42 | 43 | func (d *digest) Reset() { 44 | d.s[0] = _Init0 45 | d.s[1] = _Init1 46 | d.s[2] = _Init2 47 | d.s[3] = _Init3 48 | d.nx = 0 49 | d.len = 0 50 | } 51 | 52 | // New returns a new hash.Hash computing the MD4 checksum. 53 | func New() hash.Hash { 54 | d := new(digest) 55 | d.Reset() 56 | return d 57 | } 58 | 59 | func (d *digest) Size() int { return Size } 60 | 61 | func (d *digest) BlockSize() int { return BlockSize } 62 | 63 | func (d *digest) Write(p []byte) (nn int, err error) { 64 | nn = len(p) 65 | d.len += uint64(nn) 66 | if d.nx > 0 { 67 | n := len(p) 68 | if n > _Chunk-d.nx { 69 | n = _Chunk - d.nx 70 | } 71 | for i := 0; i < n; i++ { 72 | d.x[d.nx+i] = p[i] 73 | } 74 | d.nx += n 75 | if d.nx == _Chunk { 76 | _Block(d, d.x[0:]) 77 | d.nx = 0 78 | } 79 | p = p[n:] 80 | } 81 | n := _Block(d, p) 82 | p = p[n:] 83 | if len(p) > 0 { 84 | d.nx = copy(d.x[:], p) 85 | } 86 | return 87 | } 88 | 89 | func (d0 *digest) Sum(in []byte) []byte { 90 | // Make a copy of d0, so that caller can keep writing and summing. 91 | d := new(digest) 92 | *d = *d0 93 | 94 | // Padding. Add a 1 bit and 0 bits until 56 bytes mod 64. 95 | len := d.len 96 | var tmp [64]byte 97 | tmp[0] = 0x80 98 | if len%64 < 56 { 99 | d.Write(tmp[0 : 56-len%64]) 100 | } else { 101 | d.Write(tmp[0 : 64+56-len%64]) 102 | } 103 | 104 | // Length in bits. 105 | len <<= 3 106 | for i := uint(0); i < 8; i++ { 107 | tmp[i] = byte(len >> (8 * i)) 108 | } 109 | d.Write(tmp[0:8]) 110 | 111 | if d.nx != 0 { 112 | panic("d.nx != 0") 113 | } 114 | 115 | for _, s := range d.s { 116 | in = append(in, byte(s>>0)) 117 | in = append(in, byte(s>>8)) 118 | in = append(in, byte(s>>16)) 119 | in = append(in, byte(s>>24)) 120 | } 121 | return in 122 | } 123 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/md4/md4block.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 | // MD4 block step. 6 | // In its own file so that a faster assembly or C version 7 | // can be substituted easily. 8 | 9 | package md4 10 | 11 | var shift1 = []uint{3, 7, 11, 19} 12 | var shift2 = []uint{3, 5, 9, 13} 13 | var shift3 = []uint{3, 9, 11, 15} 14 | 15 | var xIndex2 = []uint{0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15} 16 | var xIndex3 = []uint{0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15} 17 | 18 | func _Block(dig *digest, p []byte) int { 19 | a := dig.s[0] 20 | b := dig.s[1] 21 | c := dig.s[2] 22 | d := dig.s[3] 23 | n := 0 24 | var X [16]uint32 25 | for len(p) >= _Chunk { 26 | aa, bb, cc, dd := a, b, c, d 27 | 28 | j := 0 29 | for i := 0; i < 16; i++ { 30 | X[i] = uint32(p[j]) | uint32(p[j+1])<<8 | uint32(p[j+2])<<16 | uint32(p[j+3])<<24 31 | j += 4 32 | } 33 | 34 | // If this needs to be made faster in the future, 35 | // the usual trick is to unroll each of these 36 | // loops by a factor of 4; that lets you replace 37 | // the shift[] lookups with constants and, 38 | // with suitable variable renaming in each 39 | // unrolled body, delete the a, b, c, d = d, a, b, c 40 | // (or you can let the optimizer do the renaming). 41 | // 42 | // The index variables are uint so that % by a power 43 | // of two can be optimized easily by a compiler. 44 | 45 | // Round 1. 46 | for i := uint(0); i < 16; i++ { 47 | x := i 48 | s := shift1[i%4] 49 | f := ((c ^ d) & b) ^ d 50 | a += f + X[x] 51 | a = a<>(32-s) 52 | a, b, c, d = d, a, b, c 53 | } 54 | 55 | // Round 2. 56 | for i := uint(0); i < 16; i++ { 57 | x := xIndex2[i] 58 | s := shift2[i%4] 59 | g := (b & c) | (b & d) | (c & d) 60 | a += g + X[x] + 0x5a827999 61 | a = a<>(32-s) 62 | a, b, c, d = d, a, b, c 63 | } 64 | 65 | // Round 3. 66 | for i := uint(0); i < 16; i++ { 67 | x := xIndex3[i] 68 | s := shift3[i%4] 69 | h := b ^ c ^ d 70 | a += h + X[x] + 0x6ed9eba1 71 | a = a<>(32-s) 72 | a, b, c, d = d, a, b, c 73 | } 74 | 75 | a += aa 76 | b += bb 77 | c += cc 78 | d += dd 79 | 80 | p = p[_Chunk:] 81 | n += _Chunk 82 | } 83 | 84 | dig.s[0] = a 85 | dig.s[1] = b 86 | dig.s[2] = c 87 | dig.s[3] = d 88 | return n 89 | } 90 | -------------------------------------------------------------------------------- /vendor/golang.org/x/lint/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | go: 4 | - 1.10.x 5 | - 1.11.x 6 | - master 7 | 8 | go_import_path: golang.org/x/lint 9 | 10 | install: 11 | - go get -t -v ./... 12 | 13 | script: 14 | - go test -v -race ./... 15 | 16 | matrix: 17 | allow_failures: 18 | - go: master 19 | fast_finish: true 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/lint/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Golint 2 | 3 | ## Before filing an issue: 4 | 5 | ### Are you having trouble building golint? 6 | 7 | Check you have the latest version of its dependencies. Run 8 | ``` 9 | go get -u golang.org/x/lint/golint 10 | ``` 11 | If you still have problems, consider searching for existing issues before filing a new issue. 12 | 13 | ## Before sending a pull request: 14 | 15 | Have you understood the purpose of golint? Make sure to carefully read `README`. 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/lint/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 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/lint/go.mod: -------------------------------------------------------------------------------- 1 | module golang.org/x/lint 2 | 3 | require golang.org/x/tools v0.0.0-20190311212946-11955173bddd 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/lint/go.sum: -------------------------------------------------------------------------------- 1 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 2 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 3 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 4 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 5 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ= 6 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 7 | -------------------------------------------------------------------------------- /vendor/golang.org/x/lint/golint/importcomment.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The Go Authors. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file or at 5 | // https://developers.google.com/open-source/licenses/bsd. 6 | 7 | // +build go1.12 8 | 9 | // Require use of the correct import path only for Go 1.12+ users, so 10 | // any breakages coincide with people updating their CI configs or 11 | // whatnot. 12 | 13 | package main // import "golang.org/x/lint/golint" 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/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/text/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/text/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/text/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/text/encoding/internal/internal.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 internal contains code that is shared among encoding implementations. 6 | package internal 7 | 8 | import ( 9 | "golang.org/x/text/encoding" 10 | "golang.org/x/text/encoding/internal/identifier" 11 | "golang.org/x/text/transform" 12 | ) 13 | 14 | // Encoding is an implementation of the Encoding interface that adds the String 15 | // and ID methods to an existing encoding. 16 | type Encoding struct { 17 | encoding.Encoding 18 | Name string 19 | MIB identifier.MIB 20 | } 21 | 22 | // _ verifies that Encoding implements identifier.Interface. 23 | var _ identifier.Interface = (*Encoding)(nil) 24 | 25 | func (e *Encoding) String() string { 26 | return e.Name 27 | } 28 | 29 | func (e *Encoding) ID() (mib identifier.MIB, other string) { 30 | return e.MIB, "" 31 | } 32 | 33 | // SimpleEncoding is an Encoding that combines two Transformers. 34 | type SimpleEncoding struct { 35 | Decoder transform.Transformer 36 | Encoder transform.Transformer 37 | } 38 | 39 | func (e *SimpleEncoding) NewDecoder() *encoding.Decoder { 40 | return &encoding.Decoder{Transformer: e.Decoder} 41 | } 42 | 43 | func (e *SimpleEncoding) NewEncoder() *encoding.Encoder { 44 | return &encoding.Encoder{Transformer: e.Encoder} 45 | } 46 | 47 | // FuncEncoding is an Encoding that combines two functions returning a new 48 | // Transformer. 49 | type FuncEncoding struct { 50 | Decoder func() transform.Transformer 51 | Encoder func() transform.Transformer 52 | } 53 | 54 | func (e FuncEncoding) NewDecoder() *encoding.Decoder { 55 | return &encoding.Decoder{Transformer: e.Decoder()} 56 | } 57 | 58 | func (e FuncEncoding) NewEncoder() *encoding.Encoder { 59 | return &encoding.Encoder{Transformer: e.Encoder()} 60 | } 61 | 62 | // A RepertoireError indicates a rune is not in the repertoire of a destination 63 | // encoding. It is associated with an encoding-specific suggested replacement 64 | // byte. 65 | type RepertoireError byte 66 | 67 | // Error implements the error interrface. 68 | func (r RepertoireError) Error() string { 69 | return "encoding: rune not supported by encoding." 70 | } 71 | 72 | // Replacement returns the replacement string associated with this error. 73 | func (r RepertoireError) Replacement() byte { return byte(r) } 74 | 75 | var ErrASCIIReplacement = RepertoireError(encoding.ASCIISub) 76 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/encoding/unicode/override.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 unicode 6 | 7 | import ( 8 | "golang.org/x/text/transform" 9 | ) 10 | 11 | // BOMOverride returns a new decoder transformer that is identical to fallback, 12 | // except that the presence of a Byte Order Mark at the start of the input 13 | // causes it to switch to the corresponding Unicode decoding. It will only 14 | // consider BOMs for UTF-8, UTF-16BE, and UTF-16LE. 15 | // 16 | // This differs from using ExpectBOM by allowing a BOM to switch to UTF-8, not 17 | // just UTF-16 variants, and allowing falling back to any encoding scheme. 18 | // 19 | // This technique is recommended by the W3C for use in HTML 5: "For 20 | // compatibility with deployed content, the byte order mark (also known as BOM) 21 | // is considered more authoritative than anything else." 22 | // http://www.w3.org/TR/encoding/#specification-hooks 23 | // 24 | // Using BOMOverride is mostly intended for use cases where the first characters 25 | // of a fallback encoding are known to not be a BOM, for example, for valid HTML 26 | // and most encodings. 27 | func BOMOverride(fallback transform.Transformer) transform.Transformer { 28 | // TODO: possibly allow a variadic argument of unicode encodings to allow 29 | // specifying details of which fallbacks are supported as well as 30 | // specifying the details of the implementations. This would also allow for 31 | // support for UTF-32, which should not be supported by default. 32 | return &bomOverride{fallback: fallback} 33 | } 34 | 35 | type bomOverride struct { 36 | fallback transform.Transformer 37 | current transform.Transformer 38 | } 39 | 40 | func (d *bomOverride) Reset() { 41 | d.current = nil 42 | d.fallback.Reset() 43 | } 44 | 45 | var ( 46 | // TODO: we could use decode functions here, instead of allocating a new 47 | // decoder on every NewDecoder as IgnoreBOM decoders can be stateless. 48 | utf16le = UTF16(LittleEndian, IgnoreBOM) 49 | utf16be = UTF16(BigEndian, IgnoreBOM) 50 | ) 51 | 52 | const utf8BOM = "\ufeff" 53 | 54 | func (d *bomOverride) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { 55 | if d.current != nil { 56 | return d.current.Transform(dst, src, atEOF) 57 | } 58 | if len(src) < 3 && !atEOF { 59 | return 0, 0, transform.ErrShortSrc 60 | } 61 | d.current = d.fallback 62 | bomSize := 0 63 | if len(src) >= 2 { 64 | if src[0] == 0xFF && src[1] == 0xFE { 65 | d.current = utf16le.NewDecoder() 66 | bomSize = 2 67 | } else if src[0] == 0xFE && src[1] == 0xFF { 68 | d.current = utf16be.NewDecoder() 69 | bomSize = 2 70 | } else if len(src) >= 3 && 71 | src[0] == utf8BOM[0] && 72 | src[1] == utf8BOM[1] && 73 | src[2] == utf8BOM[2] { 74 | d.current = transform.Nop 75 | bomSize = 3 76 | } 77 | } 78 | if bomSize < len(src) { 79 | nDst, nSrc, err = d.current.Transform(dst, src[bomSize:], atEOF) 80 | } 81 | return nDst, nSrc + bomSize, err 82 | } 83 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/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/tools/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/tools/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/tools/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/tools/go/analysis/diagnostic.go: -------------------------------------------------------------------------------- 1 | package analysis 2 | 3 | import "go/token" 4 | 5 | // A Diagnostic is a message associated with a source location or range. 6 | // 7 | // An Analyzer may return a variety of diagnostics; the optional Category, 8 | // which should be a constant, may be used to classify them. 9 | // It is primarily intended to make it easy to look up documentation. 10 | // 11 | // If End is provided, the diagnostic is specified to apply to the range between 12 | // Pos and End. 13 | type Diagnostic struct { 14 | Pos token.Pos 15 | End token.Pos // optional 16 | Category string // optional 17 | Message string 18 | 19 | // SuggestedFixes contains suggested fixes for a diagnostic which can be used to perform 20 | // edits to a file that address the diagnostic. 21 | // TODO(matloob): Should multiple SuggestedFixes be allowed for a diagnostic? 22 | // Diagnostics should not contain SuggestedFixes that overlap. 23 | // Experimental: This API is experimental and may change in the future. 24 | SuggestedFixes []SuggestedFix // optional 25 | 26 | // Experimental: This API is experimental and may change in the future. 27 | Related []RelatedInformation // optional 28 | } 29 | 30 | // RelatedInformation contains information related to a diagnostic. 31 | // For example, a diagnostic that flags duplicated declarations of a 32 | // variable may include one RelatedInformation per existing 33 | // declaration. 34 | type RelatedInformation struct { 35 | Pos token.Pos 36 | End token.Pos 37 | Message string 38 | } 39 | 40 | // A SuggestedFix is a code change associated with a Diagnostic that a user can choose 41 | // to apply to their code. Usually the SuggestedFix is meant to fix the issue flagged 42 | // by the diagnostic. 43 | // TextEdits for a SuggestedFix should not overlap. TextEdits for a SuggestedFix 44 | // should not contain edits for other packages. 45 | // Experimental: This API is experimental and may change in the future. 46 | type SuggestedFix struct { 47 | // A description for this suggested fix to be shown to a user deciding 48 | // whether to accept it. 49 | Message string 50 | TextEdits []TextEdit 51 | } 52 | 53 | // A TextEdit represents the replacement of the code between Pos and End with the new text. 54 | // Each TextEdit should apply to a single file. End should not be earlier in the file than Pos. 55 | // Experimental: This API is experimental and may change in the future. 56 | type TextEdit struct { 57 | // For a pure insertion, End can either be set to Pos or token.NoPos. 58 | Pos token.Pos 59 | End token.Pos 60 | NewText []byte 61 | } 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/analysis/passes/inspect/inspect.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 inspect defines an Analyzer that provides an AST inspector 6 | // (golang.org/x/tools/go/ast/inspect.Inspect) for the syntax trees of a 7 | // package. It is only a building block for other analyzers. 8 | // 9 | // Example of use in another analysis: 10 | // 11 | // import ( 12 | // "golang.org/x/tools/go/analysis" 13 | // "golang.org/x/tools/go/analysis/passes/inspect" 14 | // "golang.org/x/tools/go/ast/inspector" 15 | // ) 16 | // 17 | // var Analyzer = &analysis.Analyzer{ 18 | // ... 19 | // Requires: []*analysis.Analyzer{inspect.Analyzer}, 20 | // } 21 | // 22 | // func run(pass *analysis.Pass) (interface{}, error) { 23 | // inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector) 24 | // inspect.Preorder(nil, func(n ast.Node) { 25 | // ... 26 | // }) 27 | // return nil 28 | // } 29 | // 30 | package inspect 31 | 32 | import ( 33 | "reflect" 34 | 35 | "golang.org/x/tools/go/analysis" 36 | "golang.org/x/tools/go/ast/inspector" 37 | ) 38 | 39 | var Analyzer = &analysis.Analyzer{ 40 | Name: "inspect", 41 | Doc: "optimize AST traversal for later passes", 42 | Run: run, 43 | RunDespiteErrors: true, 44 | ResultType: reflect.TypeOf(new(inspector.Inspector)), 45 | } 46 | 47 | func run(pass *analysis.Pass) (interface{}, error) { 48 | return inspector.New(pass.Files), nil 49 | } 50 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/analysis/validate.go: -------------------------------------------------------------------------------- 1 | package analysis 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | "unicode" 7 | ) 8 | 9 | // Validate reports an error if any of the analyzers are misconfigured. 10 | // Checks include: 11 | // that the name is a valid identifier; 12 | // that the Requires graph is acyclic; 13 | // that analyzer fact types are unique; 14 | // that each fact type is a pointer. 15 | func Validate(analyzers []*Analyzer) error { 16 | // Map each fact type to its sole generating analyzer. 17 | factTypes := make(map[reflect.Type]*Analyzer) 18 | 19 | // Traverse the Requires graph, depth first. 20 | const ( 21 | white = iota 22 | grey 23 | black 24 | finished 25 | ) 26 | color := make(map[*Analyzer]uint8) 27 | var visit func(a *Analyzer) error 28 | visit = func(a *Analyzer) error { 29 | if a == nil { 30 | return fmt.Errorf("nil *Analyzer") 31 | } 32 | if color[a] == white { 33 | color[a] = grey 34 | 35 | // names 36 | if !validIdent(a.Name) { 37 | return fmt.Errorf("invalid analyzer name %q", a) 38 | } 39 | 40 | if a.Doc == "" { 41 | return fmt.Errorf("analyzer %q is undocumented", a) 42 | } 43 | 44 | // fact types 45 | for _, f := range a.FactTypes { 46 | if f == nil { 47 | return fmt.Errorf("analyzer %s has nil FactType", a) 48 | } 49 | t := reflect.TypeOf(f) 50 | if prev := factTypes[t]; prev != nil { 51 | return fmt.Errorf("fact type %s registered by two analyzers: %v, %v", 52 | t, a, prev) 53 | } 54 | if t.Kind() != reflect.Ptr { 55 | return fmt.Errorf("%s: fact type %s is not a pointer", a, t) 56 | } 57 | factTypes[t] = a 58 | } 59 | 60 | // recursion 61 | for i, req := range a.Requires { 62 | if err := visit(req); err != nil { 63 | return fmt.Errorf("%s.Requires[%d]: %v", a.Name, i, err) 64 | } 65 | } 66 | color[a] = black 67 | } 68 | 69 | return nil 70 | } 71 | for _, a := range analyzers { 72 | if err := visit(a); err != nil { 73 | return err 74 | } 75 | } 76 | 77 | // Reject duplicates among analyzers. 78 | // Precondition: color[a] == black. 79 | // Postcondition: color[a] == finished. 80 | for _, a := range analyzers { 81 | if color[a] == finished { 82 | return fmt.Errorf("duplicate analyzer: %s", a.Name) 83 | } 84 | color[a] = finished 85 | } 86 | 87 | return nil 88 | } 89 | 90 | func validIdent(name string) bool { 91 | for i, r := range name { 92 | if !(r == '_' || unicode.IsLetter(r) || i > 0 && unicode.IsDigit(r)) { 93 | return false 94 | } 95 | } 96 | return name != "" 97 | } 98 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/ast/astutil/util.go: -------------------------------------------------------------------------------- 1 | package astutil 2 | 3 | import "go/ast" 4 | 5 | // Unparen returns e with any enclosing parentheses stripped. 6 | func Unparen(e ast.Expr) ast.Expr { 7 | for { 8 | p, ok := e.(*ast.ParenExpr) 9 | if !ok { 10 | return e 11 | } 12 | e = p.X 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/buildutil/tags.go: -------------------------------------------------------------------------------- 1 | package buildutil 2 | 3 | // This logic was copied from stringsFlag from $GOROOT/src/cmd/go/build.go. 4 | 5 | import "fmt" 6 | 7 | const TagsFlagDoc = "a list of `build tags` to consider satisfied during the build. " + 8 | "For more information about build tags, see the description of " + 9 | "build constraints in the documentation for the go/build package" 10 | 11 | // TagsFlag is an implementation of the flag.Value and flag.Getter interfaces that parses 12 | // a flag value in the same manner as go build's -tags flag and 13 | // populates a []string slice. 14 | // 15 | // See $GOROOT/src/go/build/doc.go for description of build tags. 16 | // See $GOROOT/src/cmd/go/doc.go for description of 'go build -tags' flag. 17 | // 18 | // Example: 19 | // flag.Var((*buildutil.TagsFlag)(&build.Default.BuildTags), "tags", buildutil.TagsFlagDoc) 20 | type TagsFlag []string 21 | 22 | func (v *TagsFlag) Set(s string) error { 23 | var err error 24 | *v, err = splitQuotedFields(s) 25 | if *v == nil { 26 | *v = []string{} 27 | } 28 | return err 29 | } 30 | 31 | func (v *TagsFlag) Get() interface{} { return *v } 32 | 33 | func splitQuotedFields(s string) ([]string, error) { 34 | // Split fields allowing '' or "" around elements. 35 | // Quotes further inside the string do not count. 36 | var f []string 37 | for len(s) > 0 { 38 | for len(s) > 0 && isSpaceByte(s[0]) { 39 | s = s[1:] 40 | } 41 | if len(s) == 0 { 42 | break 43 | } 44 | // Accepted quoted string. No unescaping inside. 45 | if s[0] == '"' || s[0] == '\'' { 46 | quote := s[0] 47 | s = s[1:] 48 | i := 0 49 | for i < len(s) && s[i] != quote { 50 | i++ 51 | } 52 | if i >= len(s) { 53 | return nil, fmt.Errorf("unterminated %c string", quote) 54 | } 55 | f = append(f, s[:i]) 56 | s = s[i+1:] 57 | continue 58 | } 59 | i := 0 60 | for i < len(s) && !isSpaceByte(s[i]) { 61 | i++ 62 | } 63 | f = append(f, s[:i]) 64 | s = s[i:] 65 | } 66 | return f, nil 67 | } 68 | 69 | func (v *TagsFlag) String() string { 70 | return "" 71 | } 72 | 73 | func isSpaceByte(c byte) bool { 74 | return c == ' ' || c == '\t' || c == '\n' || c == '\r' 75 | } 76 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/gcexportdata/importer.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 | package gcexportdata 6 | 7 | import ( 8 | "fmt" 9 | "go/token" 10 | "go/types" 11 | "os" 12 | ) 13 | 14 | // NewImporter returns a new instance of the types.Importer interface 15 | // that reads type information from export data files written by gc. 16 | // The Importer also satisfies types.ImporterFrom. 17 | // 18 | // Export data files are located using "go build" workspace conventions 19 | // and the build.Default context. 20 | // 21 | // Use this importer instead of go/importer.For("gc", ...) to avoid the 22 | // version-skew problems described in the documentation of this package, 23 | // or to control the FileSet or access the imports map populated during 24 | // package loading. 25 | // 26 | func NewImporter(fset *token.FileSet, imports map[string]*types.Package) types.ImporterFrom { 27 | return importer{fset, imports} 28 | } 29 | 30 | type importer struct { 31 | fset *token.FileSet 32 | imports map[string]*types.Package 33 | } 34 | 35 | func (imp importer) Import(importPath string) (*types.Package, error) { 36 | return imp.ImportFrom(importPath, "", 0) 37 | } 38 | 39 | func (imp importer) ImportFrom(importPath, srcDir string, mode types.ImportMode) (_ *types.Package, err error) { 40 | filename, path := Find(importPath, srcDir) 41 | if filename == "" { 42 | if importPath == "unsafe" { 43 | // Even for unsafe, call Find first in case 44 | // the package was vendored. 45 | return types.Unsafe, nil 46 | } 47 | return nil, fmt.Errorf("can't find import: %s", importPath) 48 | } 49 | 50 | if pkg, ok := imp.imports[path]; ok && pkg.Complete() { 51 | return pkg, nil // cache hit 52 | } 53 | 54 | // open file 55 | f, err := os.Open(filename) 56 | if err != nil { 57 | return nil, err 58 | } 59 | defer func() { 60 | f.Close() 61 | if err != nil { 62 | // add file name to error 63 | err = fmt.Errorf("reading export data: %s: %v", filename, err) 64 | } 65 | }() 66 | 67 | r, err := NewReader(f) 68 | if err != nil { 69 | return nil, err 70 | } 71 | 72 | return Read(r, imp.fset, imp.imports, path) 73 | } 74 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This file is a copy of $GOROOT/src/go/internal/gcimporter/exportdata.go. 6 | 7 | // This file implements FindExportData. 8 | 9 | package gcimporter 10 | 11 | import ( 12 | "bufio" 13 | "fmt" 14 | "io" 15 | "strconv" 16 | "strings" 17 | ) 18 | 19 | func readGopackHeader(r *bufio.Reader) (name string, size int, err error) { 20 | // See $GOROOT/include/ar.h. 21 | hdr := make([]byte, 16+12+6+6+8+10+2) 22 | _, err = io.ReadFull(r, hdr) 23 | if err != nil { 24 | return 25 | } 26 | // leave for debugging 27 | if false { 28 | fmt.Printf("header: %s", hdr) 29 | } 30 | s := strings.TrimSpace(string(hdr[16+12+6+6+8:][:10])) 31 | size, err = strconv.Atoi(s) 32 | if err != nil || hdr[len(hdr)-2] != '`' || hdr[len(hdr)-1] != '\n' { 33 | err = fmt.Errorf("invalid archive header") 34 | return 35 | } 36 | name = strings.TrimSpace(string(hdr[:16])) 37 | return 38 | } 39 | 40 | // FindExportData positions the reader r at the beginning of the 41 | // export data section of an underlying GC-created object/archive 42 | // file by reading from it. The reader must be positioned at the 43 | // start of the file before calling this function. The hdr result 44 | // is the string before the export data, either "$$" or "$$B". 45 | // 46 | func FindExportData(r *bufio.Reader) (hdr string, err error) { 47 | // Read first line to make sure this is an object file. 48 | line, err := r.ReadSlice('\n') 49 | if err != nil { 50 | err = fmt.Errorf("can't find export data (%v)", err) 51 | return 52 | } 53 | 54 | if string(line) == "!\n" { 55 | // Archive file. Scan to __.PKGDEF. 56 | var name string 57 | if name, _, err = readGopackHeader(r); err != nil { 58 | return 59 | } 60 | 61 | // First entry should be __.PKGDEF. 62 | if name != "__.PKGDEF" { 63 | err = fmt.Errorf("go archive is missing __.PKGDEF") 64 | return 65 | } 66 | 67 | // Read first line of __.PKGDEF data, so that line 68 | // is once again the first line of the input. 69 | if line, err = r.ReadSlice('\n'); err != nil { 70 | err = fmt.Errorf("can't find export data (%v)", err) 71 | return 72 | } 73 | } 74 | 75 | // Now at __.PKGDEF in archive or still at beginning of file. 76 | // Either way, line should begin with "go object ". 77 | if !strings.HasPrefix(string(line), "go object ") { 78 | err = fmt.Errorf("not a Go object file") 79 | return 80 | } 81 | 82 | // Skip over object header to export data. 83 | // Begins after first line starting with $$. 84 | for line[0] != '$' { 85 | if line, err = r.ReadSlice('\n'); err != nil { 86 | err = fmt.Errorf("can't find export data (%v)", err) 87 | return 88 | } 89 | } 90 | hdr = string(line) 91 | 92 | return 93 | } 94 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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.11 6 | 7 | package gcimporter 8 | 9 | import "go/types" 10 | 11 | func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface { 12 | named := make([]*types.Named, len(embeddeds)) 13 | for i, e := range embeddeds { 14 | var ok bool 15 | named[i], ok = e.(*types.Named) 16 | if !ok { 17 | panic("embedding of non-defined interfaces in interfaces is not supported before Go 1.11") 18 | } 19 | } 20 | return types.NewInterface(methods, named) 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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.11 6 | 7 | package gcimporter 8 | 9 | import "go/types" 10 | 11 | func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface { 12 | return types.NewInterfaceType(methods, embeddeds) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/packages/visit.go: -------------------------------------------------------------------------------- 1 | package packages 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "sort" 7 | ) 8 | 9 | // Visit visits all the packages in the import graph whose roots are 10 | // pkgs, calling the optional pre function the first time each package 11 | // is encountered (preorder), and the optional post function after a 12 | // package's dependencies have been visited (postorder). 13 | // The boolean result of pre(pkg) determines whether 14 | // the imports of package pkg are visited. 15 | func Visit(pkgs []*Package, pre func(*Package) bool, post func(*Package)) { 16 | seen := make(map[*Package]bool) 17 | var visit func(*Package) 18 | visit = func(pkg *Package) { 19 | if !seen[pkg] { 20 | seen[pkg] = true 21 | 22 | if pre == nil || pre(pkg) { 23 | paths := make([]string, 0, len(pkg.Imports)) 24 | for path := range pkg.Imports { 25 | paths = append(paths, path) 26 | } 27 | sort.Strings(paths) // Imports is a map, this makes visit stable 28 | for _, path := range paths { 29 | visit(pkg.Imports[path]) 30 | } 31 | } 32 | 33 | if post != nil { 34 | post(pkg) 35 | } 36 | } 37 | } 38 | for _, pkg := range pkgs { 39 | visit(pkg) 40 | } 41 | } 42 | 43 | // PrintErrors prints to os.Stderr the accumulated errors of all 44 | // packages in the import graph rooted at pkgs, dependencies first. 45 | // PrintErrors returns the number of errors printed. 46 | func PrintErrors(pkgs []*Package) int { 47 | var n int 48 | Visit(pkgs, nil, func(pkg *Package) { 49 | for _, err := range pkg.Errors { 50 | fmt.Fprintln(os.Stderr, err) 51 | n++ 52 | } 53 | }) 54 | return n 55 | } 56 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/types/typeutil/callee.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 typeutil 6 | 7 | import ( 8 | "go/ast" 9 | "go/types" 10 | 11 | "golang.org/x/tools/go/ast/astutil" 12 | ) 13 | 14 | // Callee returns the named target of a function call, if any: 15 | // a function, method, builtin, or variable. 16 | func Callee(info *types.Info, call *ast.CallExpr) types.Object { 17 | var obj types.Object 18 | switch fun := astutil.Unparen(call.Fun).(type) { 19 | case *ast.Ident: 20 | obj = info.Uses[fun] // type, var, builtin, or declared func 21 | case *ast.SelectorExpr: 22 | if sel, ok := info.Selections[fun]; ok { 23 | obj = sel.Obj() // method or field 24 | } else { 25 | obj = info.Uses[fun.Sel] // qualified identifier? 26 | } 27 | } 28 | if _, ok := obj.(*types.TypeName); ok { 29 | return nil // T(x) is a conversion, not a call 30 | } 31 | return obj 32 | } 33 | 34 | // StaticCallee returns the target (function or method) of a static 35 | // function call, if any. It returns nil for calls to builtins. 36 | func StaticCallee(info *types.Info, call *ast.CallExpr) *types.Func { 37 | if f, ok := Callee(info, call).(*types.Func); ok && !interfaceMethod(f) { 38 | return f 39 | } 40 | return nil 41 | } 42 | 43 | func interfaceMethod(f *types.Func) bool { 44 | recv := f.Type().(*types.Signature).Recv() 45 | return recv != nil && types.IsInterface(recv.Type()) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/types/typeutil/imports.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 | package typeutil 6 | 7 | import "go/types" 8 | 9 | // Dependencies returns all dependencies of the specified packages. 10 | // 11 | // Dependent packages appear in topological order: if package P imports 12 | // package Q, Q appears earlier than P in the result. 13 | // The algorithm follows import statements in the order they 14 | // appear in the source code, so the result is a total order. 15 | // 16 | func Dependencies(pkgs ...*types.Package) []*types.Package { 17 | var result []*types.Package 18 | seen := make(map[*types.Package]bool) 19 | var visit func(pkgs []*types.Package) 20 | visit = func(pkgs []*types.Package) { 21 | for _, p := range pkgs { 22 | if !seen[p] { 23 | seen[p] = true 24 | visit(p.Imports()) 25 | result = append(result, p) 26 | } 27 | } 28 | } 29 | visit(pkgs) 30 | return result 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/types/typeutil/methodsetcache.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 | // This file implements a cache of method sets. 6 | 7 | package typeutil 8 | 9 | import ( 10 | "go/types" 11 | "sync" 12 | ) 13 | 14 | // A MethodSetCache records the method set of each type T for which 15 | // MethodSet(T) is called so that repeat queries are fast. 16 | // The zero value is a ready-to-use cache instance. 17 | type MethodSetCache struct { 18 | mu sync.Mutex 19 | named map[*types.Named]struct{ value, pointer *types.MethodSet } // method sets for named N and *N 20 | others map[types.Type]*types.MethodSet // all other types 21 | } 22 | 23 | // MethodSet returns the method set of type T. It is thread-safe. 24 | // 25 | // If cache is nil, this function is equivalent to types.NewMethodSet(T). 26 | // Utility functions can thus expose an optional *MethodSetCache 27 | // parameter to clients that care about performance. 28 | // 29 | func (cache *MethodSetCache) MethodSet(T types.Type) *types.MethodSet { 30 | if cache == nil { 31 | return types.NewMethodSet(T) 32 | } 33 | cache.mu.Lock() 34 | defer cache.mu.Unlock() 35 | 36 | switch T := T.(type) { 37 | case *types.Named: 38 | return cache.lookupNamed(T).value 39 | 40 | case *types.Pointer: 41 | if N, ok := T.Elem().(*types.Named); ok { 42 | return cache.lookupNamed(N).pointer 43 | } 44 | } 45 | 46 | // all other types 47 | // (The map uses pointer equivalence, not type identity.) 48 | mset := cache.others[T] 49 | if mset == nil { 50 | mset = types.NewMethodSet(T) 51 | if cache.others == nil { 52 | cache.others = make(map[types.Type]*types.MethodSet) 53 | } 54 | cache.others[T] = mset 55 | } 56 | return mset 57 | } 58 | 59 | func (cache *MethodSetCache) lookupNamed(named *types.Named) struct{ value, pointer *types.MethodSet } { 60 | if cache.named == nil { 61 | cache.named = make(map[*types.Named]struct{ value, pointer *types.MethodSet }) 62 | } 63 | // Avoid recomputing mset(*T) for each distinct Pointer 64 | // instance whose underlying type is a named type. 65 | msets, ok := cache.named[named] 66 | if !ok { 67 | msets.value = types.NewMethodSet(named) 68 | msets.pointer = types.NewMethodSet(types.NewPointer(named)) 69 | cache.named[named] = msets 70 | } 71 | return msets 72 | } 73 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/go/types/typeutil/ui.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 | package typeutil 6 | 7 | // This file defines utilities for user interfaces that display types. 8 | 9 | import "go/types" 10 | 11 | // IntuitiveMethodSet returns the intuitive method set of a type T, 12 | // which is the set of methods you can call on an addressable value of 13 | // that type. 14 | // 15 | // The result always contains MethodSet(T), and is exactly MethodSet(T) 16 | // for interface types and for pointer-to-concrete types. 17 | // For all other concrete types T, the result additionally 18 | // contains each method belonging to *T if there is no identically 19 | // named method on T itself. 20 | // 21 | // This corresponds to user intuition about method sets; 22 | // this function is intended only for user interfaces. 23 | // 24 | // The order of the result is as for types.MethodSet(T). 25 | // 26 | func IntuitiveMethodSet(T types.Type, msets *MethodSetCache) []*types.Selection { 27 | isPointerToConcrete := func(T types.Type) bool { 28 | ptr, ok := T.(*types.Pointer) 29 | return ok && !types.IsInterface(ptr.Elem()) 30 | } 31 | 32 | var result []*types.Selection 33 | mset := msets.MethodSet(T) 34 | if types.IsInterface(T) || isPointerToConcrete(T) { 35 | for i, n := 0, mset.Len(); i < n; i++ { 36 | result = append(result, mset.At(i)) 37 | } 38 | } else { 39 | // T is some other concrete type. 40 | // Report methods of T and *T, preferring those of T. 41 | pmset := msets.MethodSet(types.NewPointer(T)) 42 | for i, n := 0, pmset.Len(); i < n; i++ { 43 | meth := pmset.At(i) 44 | if m := mset.Lookup(meth.Obj().Pkg(), meth.Obj().Name()); m != nil { 45 | meth = m 46 | } 47 | result = append(result, meth) 48 | } 49 | 50 | } 51 | return result 52 | } 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.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 freebsd openbsd netbsd 6 | 7 | package fastwalk 8 | 9 | import "syscall" 10 | 11 | func direntInode(dirent *syscall.Dirent) uint64 { 12 | return uint64(dirent.Fileno) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.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 linux darwin 6 | // +build !appengine 7 | 8 | package fastwalk 9 | 10 | import "syscall" 11 | 12 | func direntInode(dirent *syscall.Dirent) uint64 { 13 | return uint64(dirent.Ino) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 freebsd openbsd netbsd 6 | 7 | package fastwalk 8 | 9 | import "syscall" 10 | 11 | func direntNamlen(dirent *syscall.Dirent) uint64 { 12 | return uint64(dirent.Namlen) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 !appengine 7 | 8 | package fastwalk 9 | 10 | import ( 11 | "bytes" 12 | "syscall" 13 | "unsafe" 14 | ) 15 | 16 | func direntNamlen(dirent *syscall.Dirent) uint64 { 17 | const fixedHdr = uint16(unsafe.Offsetof(syscall.Dirent{}.Name)) 18 | nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) 19 | const nameBufLen = uint16(len(nameBuf)) 20 | limit := dirent.Reclen - fixedHdr 21 | if limit > nameBufLen { 22 | limit = nameBufLen 23 | } 24 | nameLen := bytes.IndexByte(nameBuf[:limit], 0) 25 | if nameLen < 0 { 26 | panic("failed to find terminating 0 byte in dirent") 27 | } 28 | return uint64(nameLen) 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.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 appengine !linux,!darwin,!freebsd,!openbsd,!netbsd 6 | 7 | package fastwalk 8 | 9 | import ( 10 | "io/ioutil" 11 | "os" 12 | ) 13 | 14 | // readDir calls fn for each directory entry in dirName. 15 | // It does not descend into directories or follow symlinks. 16 | // If fn returns a non-nil error, readDir returns with that error 17 | // immediately. 18 | func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { 19 | fis, err := ioutil.ReadDir(dirName) 20 | if err != nil { 21 | return err 22 | } 23 | skipFiles := false 24 | for _, fi := range fis { 25 | if fi.Mode().IsRegular() && skipFiles { 26 | continue 27 | } 28 | if err := fn(dirName, fi.Name(), fi.Mode()&os.ModeType); err != nil { 29 | if err == SkipFiles { 30 | skipFiles = true 31 | continue 32 | } 33 | return err 34 | } 35 | } 36 | return nil 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/internal/span/token111.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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.12 6 | 7 | package span 8 | 9 | import ( 10 | "go/token" 11 | ) 12 | 13 | // lineStart is the pre-Go 1.12 version of (*token.File).LineStart. For Go 14 | // versions <= 1.11, we borrow logic from the analysisutil package. 15 | // TODO(rstambler): Delete this file when we no longer support Go 1.11. 16 | func lineStart(f *token.File, line int) token.Pos { 17 | // Use binary search to find the start offset of this line. 18 | 19 | min := 0 // inclusive 20 | max := f.Size() // exclusive 21 | for { 22 | offset := (min + max) / 2 23 | pos := f.Pos(offset) 24 | posn := f.Position(pos) 25 | if posn.Line == line { 26 | return pos - (token.Pos(posn.Column) - 1) 27 | } 28 | 29 | if min+1 >= max { 30 | return token.NoPos 31 | } 32 | 33 | if posn.Line < line { 34 | min = offset 35 | } else { 36 | max = offset 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/tools/internal/span/token112.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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.12 6 | 7 | package span 8 | 9 | import ( 10 | "go/token" 11 | ) 12 | 13 | // TODO(rstambler): Delete this file when we no longer support Go 1.11. 14 | func lineStart(f *token.File, line int) token.Pos { 15 | return f.LineStart(line) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Dominik Honnef 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/arg/arg.go: -------------------------------------------------------------------------------- 1 | package arg 2 | 3 | var args = map[string]int{ 4 | "(*encoding/json.Decoder).Decode.v": 0, 5 | "(*encoding/json.Encoder).Encode.v": 0, 6 | "(*encoding/xml.Decoder).Decode.v": 0, 7 | "(*encoding/xml.Encoder).Encode.v": 0, 8 | "(*sync.Pool).Put.x": 0, 9 | "(*text/template.Template).Parse.text": 0, 10 | "(io.Seeker).Seek.offset": 0, 11 | "(time.Time).Sub.u": 0, 12 | "append.elems": 1, 13 | "append.slice": 0, 14 | "bytes.Equal.a": 0, 15 | "bytes.Equal.b": 1, 16 | "encoding/binary.Write.data": 2, 17 | "errors.New.text": 0, 18 | "fmt.Fprintf.format": 1, 19 | "fmt.Printf.format": 0, 20 | "fmt.Sprintf.a[0]": 1, 21 | "fmt.Sprintf.format": 0, 22 | "json.Marshal.v": 0, 23 | "json.Unmarshal.v": 1, 24 | "len.v": 0, 25 | "make.size[0]": 1, 26 | "make.size[1]": 2, 27 | "make.t": 0, 28 | "net/url.Parse.rawurl": 0, 29 | "os.OpenFile.flag": 1, 30 | "os/exec.Command.name": 0, 31 | "os/signal.Notify.c": 0, 32 | "regexp.Compile.expr": 0, 33 | "runtime.SetFinalizer.finalizer": 1, 34 | "runtime.SetFinalizer.obj": 0, 35 | "sort.Sort.data": 0, 36 | "time.Parse.layout": 0, 37 | "time.Sleep.d": 0, 38 | "xml.Marshal.v": 0, 39 | "xml.Unmarshal.v": 1, 40 | } 41 | 42 | func Arg(name string) int { 43 | n, ok := args[name] 44 | if !ok { 45 | panic("unknown argument " + name) 46 | } 47 | return n 48 | } 49 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/cmd/staticcheck/README.md: -------------------------------------------------------------------------------- 1 | # staticcheck 2 | 3 | _staticcheck_ offers extensive analysis of Go code, covering a myriad 4 | of categories. It will detect bugs, suggest code simplifications, 5 | point out dead code, and more. 6 | 7 | ## Installation 8 | 9 | See [the main README](https://github.com/dominikh/go-tools#installation) for installation instructions. 10 | 11 | ## Documentation 12 | 13 | Detailed documentation can be found on 14 | [staticcheck.io](https://staticcheck.io/docs/). 15 | 16 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/cmd/staticcheck/staticcheck.go: -------------------------------------------------------------------------------- 1 | // staticcheck analyses Go code and makes it better. 2 | package main // import "honnef.co/go/tools/cmd/staticcheck" 3 | 4 | import ( 5 | "log" 6 | "os" 7 | 8 | "golang.org/x/tools/go/analysis" 9 | "honnef.co/go/tools/lint" 10 | "honnef.co/go/tools/lint/lintutil" 11 | "honnef.co/go/tools/simple" 12 | "honnef.co/go/tools/staticcheck" 13 | "honnef.co/go/tools/stylecheck" 14 | "honnef.co/go/tools/unused" 15 | ) 16 | 17 | func main() { 18 | fs := lintutil.FlagSet("staticcheck") 19 | wholeProgram := fs.Bool("unused.whole-program", false, "Run unused in whole program mode") 20 | debug := fs.String("debug.unused-graph", "", "Write unused's object graph to `file`") 21 | fs.Parse(os.Args[1:]) 22 | 23 | var cs []*analysis.Analyzer 24 | for _, v := range simple.Analyzers { 25 | cs = append(cs, v) 26 | } 27 | for _, v := range staticcheck.Analyzers { 28 | cs = append(cs, v) 29 | } 30 | for _, v := range stylecheck.Analyzers { 31 | cs = append(cs, v) 32 | } 33 | 34 | u := unused.NewChecker(*wholeProgram) 35 | if *debug != "" { 36 | f, err := os.OpenFile(*debug, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666) 37 | if err != nil { 38 | log.Fatal(err) 39 | } 40 | u.Debug = f 41 | } 42 | cums := []lint.CumulativeChecker{u} 43 | lintutil.ProcessFlagSet(cs, cums, fs) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/config/example.conf: -------------------------------------------------------------------------------- 1 | checks = ["all", "-ST1003", "-ST1014"] 2 | initialisms = ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", 3 | "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", 4 | "IP", "JSON", "QPS", "RAM", "RPC", "SLA", 5 | "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", 6 | "UDP", "UI", "GID", "UID", "UUID", "URI", 7 | "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", 8 | "XSS", "SIP", "RTP"] 9 | dot_import_whitelist = [] 10 | http_status_code_whitelist = ["200", "400", "404", "500"] 11 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/facts/generated.go: -------------------------------------------------------------------------------- 1 | package facts 2 | 3 | import ( 4 | "bufio" 5 | "bytes" 6 | "io" 7 | "os" 8 | "reflect" 9 | "strings" 10 | 11 | "golang.org/x/tools/go/analysis" 12 | ) 13 | 14 | type Generator int 15 | 16 | // A list of known generators we can detect 17 | const ( 18 | Unknown Generator = iota 19 | Goyacc 20 | Cgo 21 | Stringer 22 | ) 23 | 24 | var ( 25 | // used by cgo before Go 1.11 26 | oldCgo = []byte("// Created by cgo - DO NOT EDIT") 27 | prefix = []byte("// Code generated ") 28 | suffix = []byte(" DO NOT EDIT.") 29 | nl = []byte("\n") 30 | crnl = []byte("\r\n") 31 | ) 32 | 33 | func isGenerated(path string) (Generator, bool) { 34 | f, err := os.Open(path) 35 | if err != nil { 36 | return 0, false 37 | } 38 | defer f.Close() 39 | br := bufio.NewReader(f) 40 | for { 41 | s, err := br.ReadBytes('\n') 42 | if err != nil && err != io.EOF { 43 | return 0, false 44 | } 45 | s = bytes.TrimSuffix(s, crnl) 46 | s = bytes.TrimSuffix(s, nl) 47 | if bytes.HasPrefix(s, prefix) && bytes.HasSuffix(s, suffix) { 48 | text := string(s[len(prefix) : len(s)-len(suffix)]) 49 | switch text { 50 | case "by goyacc.": 51 | return Goyacc, true 52 | case "by cmd/cgo;": 53 | return Cgo, true 54 | } 55 | if strings.HasPrefix(text, `by "stringer `) { 56 | return Stringer, true 57 | } 58 | return Unknown, true 59 | } 60 | if bytes.Equal(s, oldCgo) { 61 | return Cgo, true 62 | } 63 | if err == io.EOF { 64 | break 65 | } 66 | } 67 | return 0, false 68 | } 69 | 70 | var Generated = &analysis.Analyzer{ 71 | Name: "isgenerated", 72 | Doc: "annotate file names that have been code generated", 73 | Run: func(pass *analysis.Pass) (interface{}, error) { 74 | m := map[string]Generator{} 75 | for _, f := range pass.Files { 76 | path := pass.Fset.PositionFor(f.Pos(), false).Filename 77 | g, ok := isGenerated(path) 78 | if ok { 79 | m[path] = g 80 | } 81 | } 82 | return m, nil 83 | }, 84 | RunDespiteErrors: true, 85 | ResultType: reflect.TypeOf(map[string]Generator{}), 86 | } 87 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/facts/token.go: -------------------------------------------------------------------------------- 1 | package facts 2 | 3 | import ( 4 | "go/ast" 5 | "go/token" 6 | "reflect" 7 | 8 | "golang.org/x/tools/go/analysis" 9 | ) 10 | 11 | var TokenFile = &analysis.Analyzer{ 12 | Name: "tokenfileanalyzer", 13 | Doc: "creates a mapping of *token.File to *ast.File", 14 | Run: func(pass *analysis.Pass) (interface{}, error) { 15 | m := map[*token.File]*ast.File{} 16 | for _, af := range pass.Files { 17 | tf := pass.Fset.File(af.Pos()) 18 | m[tf] = af 19 | } 20 | return m, nil 21 | }, 22 | RunDespiteErrors: true, 23 | ResultType: reflect.TypeOf(map[*token.File]*ast.File{}), 24 | } 25 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/functions/loops.go: -------------------------------------------------------------------------------- 1 | package functions 2 | 3 | import "honnef.co/go/tools/ssa" 4 | 5 | type Loop struct{ ssa.BlockSet } 6 | 7 | func FindLoops(fn *ssa.Function) []Loop { 8 | if fn.Blocks == nil { 9 | return nil 10 | } 11 | tree := fn.DomPreorder() 12 | var sets []Loop 13 | for _, h := range tree { 14 | for _, n := range h.Preds { 15 | if !h.Dominates(n) { 16 | continue 17 | } 18 | // n is a back-edge to h 19 | // h is the loop header 20 | if n == h { 21 | set := Loop{} 22 | set.Add(n) 23 | sets = append(sets, set) 24 | continue 25 | } 26 | set := Loop{} 27 | set.Add(h) 28 | set.Add(n) 29 | for _, b := range allPredsBut(n, h, nil) { 30 | set.Add(b) 31 | } 32 | sets = append(sets, set) 33 | } 34 | } 35 | return sets 36 | } 37 | 38 | func allPredsBut(b, but *ssa.BasicBlock, list []*ssa.BasicBlock) []*ssa.BasicBlock { 39 | outer: 40 | for _, pred := range b.Preds { 41 | if pred == but { 42 | continue 43 | } 44 | for _, p := range list { 45 | // TODO improve big-o complexity of this function 46 | if pred == p { 47 | continue outer 48 | } 49 | } 50 | list = append(list, pred) 51 | list = allPredsBut(pred, but, list) 52 | } 53 | return list 54 | } 55 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/functions/pure.go: -------------------------------------------------------------------------------- 1 | package functions 2 | 3 | import ( 4 | "honnef.co/go/tools/ssa" 5 | ) 6 | 7 | func filterDebug(instr []ssa.Instruction) []ssa.Instruction { 8 | var out []ssa.Instruction 9 | for _, ins := range instr { 10 | if _, ok := ins.(*ssa.DebugRef); !ok { 11 | out = append(out, ins) 12 | } 13 | } 14 | return out 15 | } 16 | 17 | // IsStub reports whether a function is a stub. A function is 18 | // considered a stub if it has no instructions or exactly one 19 | // instruction, which must be either returning only constant values or 20 | // a panic. 21 | func IsStub(fn *ssa.Function) bool { 22 | if len(fn.Blocks) == 0 { 23 | return true 24 | } 25 | if len(fn.Blocks) > 1 { 26 | return false 27 | } 28 | instrs := filterDebug(fn.Blocks[0].Instrs) 29 | if len(instrs) != 1 { 30 | return false 31 | } 32 | 33 | switch instrs[0].(type) { 34 | case *ssa.Return: 35 | // Since this is the only instruction, the return value must 36 | // be a constant. We consider all constants as stubs, not just 37 | // the zero value. This does not, unfortunately, cover zero 38 | // initialised structs, as these cause additional 39 | // instructions. 40 | return true 41 | case *ssa.Panic: 42 | return true 43 | default: 44 | return false 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/functions/terminates.go: -------------------------------------------------------------------------------- 1 | package functions 2 | 3 | import "honnef.co/go/tools/ssa" 4 | 5 | // Terminates reports whether fn is supposed to return, that is if it 6 | // has at least one theoretic path that returns from the function. 7 | // Explicit panics do not count as terminating. 8 | func Terminates(fn *ssa.Function) bool { 9 | if fn.Blocks == nil { 10 | // assuming that a function terminates is the conservative 11 | // choice 12 | return true 13 | } 14 | 15 | for _, block := range fn.Blocks { 16 | if len(block.Instrs) == 0 { 17 | continue 18 | } 19 | if _, ok := block.Instrs[len(block.Instrs)-1].(*ssa.Return); ok { 20 | return true 21 | } 22 | } 23 | return false 24 | } 25 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/go/types/typeutil/callee.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 typeutil 6 | 7 | import ( 8 | "go/ast" 9 | "go/types" 10 | 11 | "golang.org/x/tools/go/ast/astutil" 12 | ) 13 | 14 | // Callee returns the named target of a function call, if any: 15 | // a function, method, builtin, or variable. 16 | func Callee(info *types.Info, call *ast.CallExpr) types.Object { 17 | var obj types.Object 18 | switch fun := astutil.Unparen(call.Fun).(type) { 19 | case *ast.Ident: 20 | obj = info.Uses[fun] // type, var, builtin, or declared func 21 | case *ast.SelectorExpr: 22 | if sel, ok := info.Selections[fun]; ok { 23 | obj = sel.Obj() // method or field 24 | } else { 25 | obj = info.Uses[fun.Sel] // qualified identifier? 26 | } 27 | } 28 | if _, ok := obj.(*types.TypeName); ok { 29 | return nil // T(x) is a conversion, not a call 30 | } 31 | return obj 32 | } 33 | 34 | // StaticCallee returns the target (function or method) of a static 35 | // function call, if any. It returns nil for calls to builtins. 36 | func StaticCallee(info *types.Info, call *ast.CallExpr) *types.Func { 37 | if f, ok := Callee(info, call).(*types.Func); ok && !interfaceMethod(f) { 38 | return f 39 | } 40 | return nil 41 | } 42 | 43 | func interfaceMethod(f *types.Func) bool { 44 | recv := f.Type().(*types.Signature).Recv() 45 | return recv != nil && types.IsInterface(recv.Type()) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/go/types/typeutil/identical.go: -------------------------------------------------------------------------------- 1 | package typeutil 2 | 3 | import ( 4 | "go/types" 5 | ) 6 | 7 | // Identical reports whether x and y are identical types. 8 | // Unlike types.Identical, receivers of Signature types are not ignored. 9 | // Unlike types.Identical, interfaces are compared via pointer equality (except for the empty interface, which gets deduplicated). 10 | // Unlike types.Identical, structs are compared via pointer equality. 11 | func Identical(x, y types.Type) (ret bool) { 12 | if !types.Identical(x, y) { 13 | return false 14 | } 15 | 16 | switch x := x.(type) { 17 | case *types.Struct: 18 | y, ok := y.(*types.Struct) 19 | if !ok { 20 | // should be impossible 21 | return true 22 | } 23 | return x == y 24 | case *types.Interface: 25 | // The issue with interfaces, typeutil.Map and types.Identical 26 | // 27 | // types.Identical, when comparing two interfaces, only looks at the set 28 | // of all methods, not differentiating between implicit (embedded) and 29 | // explicit methods. 30 | // 31 | // When we see the following two types, in source order 32 | // 33 | // type I1 interface { foo() } 34 | // type I2 interface { I1 } 35 | // 36 | // then we will first correctly process I1 and its underlying type. When 37 | // we get to I2, we will see that its underlying type is identical to 38 | // that of I1 and not process it again. This, however, means that we will 39 | // not record the fact that I2 embeds I1. If only I2 is reachable via the 40 | // graph root, then I1 will not be considered used. 41 | // 42 | // We choose to be lazy and compare interfaces by their 43 | // pointers. This will obviously miss identical interfaces, 44 | // but this only has a runtime cost, it doesn't affect 45 | // correctness. 46 | y, ok := y.(*types.Interface) 47 | if !ok { 48 | // should be impossible 49 | return true 50 | } 51 | if x.NumEmbeddeds() == 0 && 52 | y.NumEmbeddeds() == 0 && 53 | x.NumMethods() == 0 && 54 | y.NumMethods() == 0 { 55 | // all truly empty interfaces are the same 56 | return true 57 | } 58 | return x == y 59 | case *types.Signature: 60 | y, ok := y.(*types.Signature) 61 | if !ok { 62 | // should be impossible 63 | return true 64 | } 65 | if x.Recv() == y.Recv() { 66 | return true 67 | } 68 | if x.Recv() == nil || y.Recv() == nil { 69 | return false 70 | } 71 | return Identical(x.Recv().Type(), y.Recv().Type()) 72 | default: 73 | return true 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/go/types/typeutil/imports.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 | package typeutil 6 | 7 | import "go/types" 8 | 9 | // Dependencies returns all dependencies of the specified packages. 10 | // 11 | // Dependent packages appear in topological order: if package P imports 12 | // package Q, Q appears earlier than P in the result. 13 | // The algorithm follows import statements in the order they 14 | // appear in the source code, so the result is a total order. 15 | // 16 | func Dependencies(pkgs ...*types.Package) []*types.Package { 17 | var result []*types.Package 18 | seen := make(map[*types.Package]bool) 19 | var visit func(pkgs []*types.Package) 20 | visit = func(pkgs []*types.Package) { 21 | for _, p := range pkgs { 22 | if !seen[p] { 23 | seen[p] = true 24 | visit(p.Imports()) 25 | result = append(result, p) 26 | } 27 | } 28 | } 29 | visit(pkgs) 30 | return result 31 | } 32 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/go/types/typeutil/methodsetcache.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 | // This file implements a cache of method sets. 6 | 7 | package typeutil 8 | 9 | import ( 10 | "go/types" 11 | "sync" 12 | ) 13 | 14 | // A MethodSetCache records the method set of each type T for which 15 | // MethodSet(T) is called so that repeat queries are fast. 16 | // The zero value is a ready-to-use cache instance. 17 | type MethodSetCache struct { 18 | mu sync.Mutex 19 | named map[*types.Named]struct{ value, pointer *types.MethodSet } // method sets for named N and *N 20 | others map[types.Type]*types.MethodSet // all other types 21 | } 22 | 23 | // MethodSet returns the method set of type T. It is thread-safe. 24 | // 25 | // If cache is nil, this function is equivalent to types.NewMethodSet(T). 26 | // Utility functions can thus expose an optional *MethodSetCache 27 | // parameter to clients that care about performance. 28 | // 29 | func (cache *MethodSetCache) MethodSet(T types.Type) *types.MethodSet { 30 | if cache == nil { 31 | return types.NewMethodSet(T) 32 | } 33 | cache.mu.Lock() 34 | defer cache.mu.Unlock() 35 | 36 | switch T := T.(type) { 37 | case *types.Named: 38 | return cache.lookupNamed(T).value 39 | 40 | case *types.Pointer: 41 | if N, ok := T.Elem().(*types.Named); ok { 42 | return cache.lookupNamed(N).pointer 43 | } 44 | } 45 | 46 | // all other types 47 | // (The map uses pointer equivalence, not type identity.) 48 | mset := cache.others[T] 49 | if mset == nil { 50 | mset = types.NewMethodSet(T) 51 | if cache.others == nil { 52 | cache.others = make(map[types.Type]*types.MethodSet) 53 | } 54 | cache.others[T] = mset 55 | } 56 | return mset 57 | } 58 | 59 | func (cache *MethodSetCache) lookupNamed(named *types.Named) struct{ value, pointer *types.MethodSet } { 60 | if cache.named == nil { 61 | cache.named = make(map[*types.Named]struct{ value, pointer *types.MethodSet }) 62 | } 63 | // Avoid recomputing mset(*T) for each distinct Pointer 64 | // instance whose underlying type is a named type. 65 | msets, ok := cache.named[named] 66 | if !ok { 67 | msets.value = types.NewMethodSet(named) 68 | msets.pointer = types.NewMethodSet(types.NewPointer(named)) 69 | cache.named[named] = msets 70 | } 71 | return msets 72 | } 73 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/go/types/typeutil/ui.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 | package typeutil 6 | 7 | // This file defines utilities for user interfaces that display types. 8 | 9 | import "go/types" 10 | 11 | // IntuitiveMethodSet returns the intuitive method set of a type T, 12 | // which is the set of methods you can call on an addressable value of 13 | // that type. 14 | // 15 | // The result always contains MethodSet(T), and is exactly MethodSet(T) 16 | // for interface types and for pointer-to-concrete types. 17 | // For all other concrete types T, the result additionally 18 | // contains each method belonging to *T if there is no identically 19 | // named method on T itself. 20 | // 21 | // This corresponds to user intuition about method sets; 22 | // this function is intended only for user interfaces. 23 | // 24 | // The order of the result is as for types.MethodSet(T). 25 | // 26 | func IntuitiveMethodSet(T types.Type, msets *MethodSetCache) []*types.Selection { 27 | isPointerToConcrete := func(T types.Type) bool { 28 | ptr, ok := T.(*types.Pointer) 29 | return ok && !types.IsInterface(ptr.Elem()) 30 | } 31 | 32 | var result []*types.Selection 33 | mset := msets.MethodSet(T) 34 | if types.IsInterface(T) || isPointerToConcrete(T) { 35 | for i, n := 0, mset.Len(); i < n; i++ { 36 | result = append(result, mset.At(i)) 37 | } 38 | } else { 39 | // T is some other concrete type. 40 | // Report methods of T and *T, preferring those of T. 41 | pmset := msets.MethodSet(types.NewPointer(T)) 42 | for i, n := 0, pmset.Len(); i < n; i++ { 43 | meth := pmset.At(i) 44 | if m := mset.Lookup(meth.Obj().Pkg(), meth.Obj().Name()); m != nil { 45 | meth = m 46 | } 47 | result = append(result, meth) 48 | } 49 | 50 | } 51 | return result 52 | } 53 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/internal/cache/default.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 cache 6 | 7 | import ( 8 | "fmt" 9 | "io/ioutil" 10 | "log" 11 | "os" 12 | "path/filepath" 13 | "sync" 14 | ) 15 | 16 | // Default returns the default cache to use. 17 | func Default() (*Cache, error) { 18 | defaultOnce.Do(initDefaultCache) 19 | return defaultCache, defaultDirErr 20 | } 21 | 22 | var ( 23 | defaultOnce sync.Once 24 | defaultCache *Cache 25 | ) 26 | 27 | // cacheREADME is a message stored in a README in the cache directory. 28 | // Because the cache lives outside the normal Go trees, we leave the 29 | // README as a courtesy to explain where it came from. 30 | const cacheREADME = `This directory holds cached build artifacts from staticcheck. 31 | ` 32 | 33 | // initDefaultCache does the work of finding the default cache 34 | // the first time Default is called. 35 | func initDefaultCache() { 36 | dir := DefaultDir() 37 | if err := os.MkdirAll(dir, 0777); err != nil { 38 | log.Fatalf("failed to initialize build cache at %s: %s\n", dir, err) 39 | } 40 | if _, err := os.Stat(filepath.Join(dir, "README")); err != nil { 41 | // Best effort. 42 | ioutil.WriteFile(filepath.Join(dir, "README"), []byte(cacheREADME), 0666) 43 | } 44 | 45 | c, err := Open(dir) 46 | if err != nil { 47 | log.Fatalf("failed to initialize build cache at %s: %s\n", dir, err) 48 | } 49 | defaultCache = c 50 | } 51 | 52 | var ( 53 | defaultDirOnce sync.Once 54 | defaultDir string 55 | defaultDirErr error 56 | ) 57 | 58 | // DefaultDir returns the effective STATICCHECK_CACHE setting. 59 | func DefaultDir() string { 60 | // Save the result of the first call to DefaultDir for later use in 61 | // initDefaultCache. cmd/go/main.go explicitly sets GOCACHE so that 62 | // subprocesses will inherit it, but that means initDefaultCache can't 63 | // otherwise distinguish between an explicit "off" and a UserCacheDir error. 64 | 65 | defaultDirOnce.Do(func() { 66 | defaultDir = os.Getenv("STATICCHECK_CACHE") 67 | if filepath.IsAbs(defaultDir) { 68 | return 69 | } 70 | if defaultDir != "" { 71 | defaultDirErr = fmt.Errorf("STATICCHECK_CACHE is not an absolute path") 72 | return 73 | } 74 | 75 | // Compute default location. 76 | dir, err := os.UserCacheDir() 77 | if err != nil { 78 | defaultDirErr = fmt.Errorf("STATICCHECK_CACHE is not defined and %v", err) 79 | return 80 | } 81 | defaultDir = filepath.Join(dir, "staticcheck") 82 | }) 83 | 84 | return defaultDir 85 | } 86 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/internal/renameio/renameio.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 renameio writes files atomically by renaming temporary files. 6 | package renameio 7 | 8 | import ( 9 | "bytes" 10 | "io" 11 | "io/ioutil" 12 | "os" 13 | "path/filepath" 14 | "runtime" 15 | "strings" 16 | "time" 17 | ) 18 | 19 | const patternSuffix = "*.tmp" 20 | 21 | // Pattern returns a glob pattern that matches the unrenamed temporary files 22 | // created when writing to filename. 23 | func Pattern(filename string) string { 24 | return filepath.Join(filepath.Dir(filename), filepath.Base(filename)+patternSuffix) 25 | } 26 | 27 | // WriteFile is like ioutil.WriteFile, but first writes data to an arbitrary 28 | // file in the same directory as filename, then renames it atomically to the 29 | // final name. 30 | // 31 | // That ensures that the final location, if it exists, is always a complete file. 32 | func WriteFile(filename string, data []byte) (err error) { 33 | return WriteToFile(filename, bytes.NewReader(data)) 34 | } 35 | 36 | // WriteToFile is a variant of WriteFile that accepts the data as an io.Reader 37 | // instead of a slice. 38 | func WriteToFile(filename string, data io.Reader) (err error) { 39 | f, err := ioutil.TempFile(filepath.Dir(filename), filepath.Base(filename)+patternSuffix) 40 | if err != nil { 41 | return err 42 | } 43 | defer func() { 44 | // Only call os.Remove on f.Name() if we failed to rename it: otherwise, 45 | // some other process may have created a new file with the same name after 46 | // that. 47 | if err != nil { 48 | f.Close() 49 | os.Remove(f.Name()) 50 | } 51 | }() 52 | 53 | if _, err := io.Copy(f, data); err != nil { 54 | return err 55 | } 56 | // Sync the file before renaming it: otherwise, after a crash the reader may 57 | // observe a 0-length file instead of the actual contents. 58 | // See https://golang.org/issue/22397#issuecomment-380831736. 59 | if err := f.Sync(); err != nil { 60 | return err 61 | } 62 | if err := f.Close(); err != nil { 63 | return err 64 | } 65 | 66 | var start time.Time 67 | for { 68 | err := os.Rename(f.Name(), filename) 69 | if err == nil || runtime.GOOS != "windows" || !strings.HasSuffix(err.Error(), "Access is denied.") { 70 | return err 71 | } 72 | 73 | // Windows seems to occasionally trigger spurious "Access is denied" errors 74 | // here (see golang.org/issue/31247). We're not sure why. It's probably 75 | // worth a little extra latency to avoid propagating the spurious errors. 76 | if start.IsZero() { 77 | start = time.Now() 78 | } else if time.Since(start) >= 500*time.Millisecond { 79 | return err 80 | } 81 | time.Sleep(5 * time.Millisecond) 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/internal/sharedcheck/lint.go: -------------------------------------------------------------------------------- 1 | package sharedcheck 2 | 3 | import ( 4 | "go/ast" 5 | "go/types" 6 | 7 | "golang.org/x/tools/go/analysis" 8 | "honnef.co/go/tools/internal/passes/buildssa" 9 | . "honnef.co/go/tools/lint/lintdsl" 10 | "honnef.co/go/tools/ssa" 11 | ) 12 | 13 | func CheckRangeStringRunes(pass *analysis.Pass) (interface{}, error) { 14 | for _, ssafn := range pass.ResultOf[buildssa.Analyzer].(*buildssa.SSA).SrcFuncs { 15 | fn := func(node ast.Node) bool { 16 | rng, ok := node.(*ast.RangeStmt) 17 | if !ok || !IsBlank(rng.Key) { 18 | return true 19 | } 20 | 21 | v, _ := ssafn.ValueForExpr(rng.X) 22 | 23 | // Check that we're converting from string to []rune 24 | val, _ := v.(*ssa.Convert) 25 | if val == nil { 26 | return true 27 | } 28 | Tsrc, ok := val.X.Type().(*types.Basic) 29 | if !ok || Tsrc.Kind() != types.String { 30 | return true 31 | } 32 | Tdst, ok := val.Type().(*types.Slice) 33 | if !ok { 34 | return true 35 | } 36 | TdstElem, ok := Tdst.Elem().(*types.Basic) 37 | if !ok || TdstElem.Kind() != types.Int32 { 38 | return true 39 | } 40 | 41 | // Check that the result of the conversion is only used to 42 | // range over 43 | refs := val.Referrers() 44 | if refs == nil { 45 | return true 46 | } 47 | 48 | // Expect two refs: one for obtaining the length of the slice, 49 | // one for accessing the elements 50 | if len(FilterDebug(*refs)) != 2 { 51 | // TODO(dh): right now, we check that only one place 52 | // refers to our slice. This will miss cases such as 53 | // ranging over the slice twice. Ideally, we'd ensure that 54 | // the slice is only used for ranging over (without 55 | // accessing the key), but that is harder to do because in 56 | // SSA form, ranging over a slice looks like an ordinary 57 | // loop with index increments and slice accesses. We'd 58 | // have to look at the associated AST node to check that 59 | // it's a range statement. 60 | return true 61 | } 62 | 63 | pass.Reportf(rng.Pos(), "should range over string, not []rune(string)") 64 | 65 | return true 66 | } 67 | Inspect(ssafn.Syntax(), fn) 68 | } 69 | return nil, nil 70 | } 71 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/lint/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 The Go Authors. All rights reserved. 2 | Copyright (c) 2016 Dominik Honnef. 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/honnef.co/go/tools/lint/lintutil/stats.go: -------------------------------------------------------------------------------- 1 | // +build !aix,!android,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 2 | 3 | package lintutil 4 | 5 | import "os" 6 | 7 | var infoSignals = []os.Signal{} 8 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/lint/lintutil/stats_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin dragonfly freebsd netbsd openbsd 2 | 3 | package lintutil 4 | 5 | import ( 6 | "os" 7 | "syscall" 8 | ) 9 | 10 | var infoSignals = []os.Signal{syscall.SIGINFO} 11 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/lint/lintutil/stats_posix.go: -------------------------------------------------------------------------------- 1 | // +build aix android linux solaris 2 | 3 | package lintutil 4 | 5 | import ( 6 | "os" 7 | "syscall" 8 | ) 9 | 10 | var infoSignals = []os.Signal{syscall.SIGUSR1} 11 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/lint/stats.go: -------------------------------------------------------------------------------- 1 | package lint 2 | 3 | const ( 4 | StateInitializing = 0 5 | StateGraph = 1 6 | StateProcessing = 2 7 | StateCumulative = 3 8 | ) 9 | 10 | type Stats struct { 11 | State uint32 12 | 13 | InitialPackages uint32 14 | TotalPackages uint32 15 | ProcessedPackages uint32 16 | ProcessedInitialPackages uint32 17 | Problems uint32 18 | ActiveWorkers uint32 19 | TotalWorkers uint32 20 | } 21 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/printf/fuzz.go: -------------------------------------------------------------------------------- 1 | // +build gofuzz 2 | 3 | package printf 4 | 5 | func Fuzz(data []byte) int { 6 | _, err := Parse(string(data)) 7 | if err == nil { 8 | return 1 9 | } 10 | return 0 11 | } 12 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/simple/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to gosimple 2 | 3 | ## Before filing an issue: 4 | 5 | ### Are you having trouble building gosimple? 6 | 7 | Check you have the latest version of its dependencies. Run 8 | ``` 9 | go get -u honnef.co/go/tools/simple 10 | ``` 11 | If you still have problems, consider searching for existing issues before filing a new issue. 12 | 13 | ## Before sending a pull request: 14 | 15 | Have you understood the purpose of gosimple? Make sure to carefully read `README`. 16 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/ssa/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | Copyright (c) 2016 Dominik Honnef. 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/honnef.co/go/tools/ssa/identical.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | package ssa 4 | 5 | import "go/types" 6 | 7 | var structTypesIdentical = types.IdenticalIgnoreTags 8 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/ssa/identical_17.go: -------------------------------------------------------------------------------- 1 | // +build !go1.8 2 | 3 | package ssa 4 | 5 | import "go/types" 6 | 7 | var structTypesIdentical = types.Identical 8 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/ssa/staticcheck.conf: -------------------------------------------------------------------------------- 1 | # ssa/... is mostly imported from upstream and we don't want to 2 | # deviate from it too much, hence disabling SA1019 3 | checks = ["inherit", "-SA1019"] 4 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/ssa/write.go: -------------------------------------------------------------------------------- 1 | package ssa 2 | 3 | func NewJump(parent *BasicBlock) *Jump { 4 | return &Jump{anInstruction{parent}} 5 | } 6 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/ssautil/ssautil.go: -------------------------------------------------------------------------------- 1 | package ssautil 2 | 3 | import ( 4 | "honnef.co/go/tools/ssa" 5 | ) 6 | 7 | func Reachable(from, to *ssa.BasicBlock) bool { 8 | if from == to { 9 | return true 10 | } 11 | if from.Dominates(to) { 12 | return true 13 | } 14 | 15 | found := false 16 | Walk(from, func(b *ssa.BasicBlock) bool { 17 | if b == to { 18 | found = true 19 | return false 20 | } 21 | return true 22 | }) 23 | return found 24 | } 25 | 26 | func Walk(b *ssa.BasicBlock, fn func(*ssa.BasicBlock) bool) { 27 | seen := map[*ssa.BasicBlock]bool{} 28 | wl := []*ssa.BasicBlock{b} 29 | for len(wl) > 0 { 30 | b := wl[len(wl)-1] 31 | wl = wl[:len(wl)-1] 32 | if seen[b] { 33 | continue 34 | } 35 | seen[b] = true 36 | if !fn(b) { 37 | continue 38 | } 39 | wl = append(wl, b.Succs...) 40 | } 41 | } 42 | 43 | func Vararg(x *ssa.Slice) ([]ssa.Value, bool) { 44 | var out []ssa.Value 45 | slice, ok := x.X.(*ssa.Alloc) 46 | if !ok || slice.Comment != "varargs" { 47 | return nil, false 48 | } 49 | for _, ref := range *slice.Referrers() { 50 | idx, ok := ref.(*ssa.IndexAddr) 51 | if !ok { 52 | continue 53 | } 54 | v := (*idx.Referrers())[0].(*ssa.Store).Val 55 | out = append(out, v) 56 | } 57 | return out, true 58 | } 59 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/staticcheck/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to staticcheck 2 | 3 | ## Before filing an issue: 4 | 5 | ### Are you having trouble building staticcheck? 6 | 7 | Check you have the latest version of its dependencies. Run 8 | ``` 9 | go get -u honnef.co/go/tools/staticcheck 10 | ``` 11 | If you still have problems, consider searching for existing issues before filing a new issue. 12 | 13 | ## Before sending a pull request: 14 | 15 | Have you understood the purpose of staticcheck? Make sure to carefully read `README`. 16 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/staticcheck/buildtag.go: -------------------------------------------------------------------------------- 1 | package staticcheck 2 | 3 | import ( 4 | "go/ast" 5 | "strings" 6 | 7 | . "honnef.co/go/tools/lint/lintdsl" 8 | ) 9 | 10 | func buildTags(f *ast.File) [][]string { 11 | var out [][]string 12 | for _, line := range strings.Split(Preamble(f), "\n") { 13 | if !strings.HasPrefix(line, "+build ") { 14 | continue 15 | } 16 | line = strings.TrimSpace(strings.TrimPrefix(line, "+build ")) 17 | fields := strings.Fields(line) 18 | out = append(out, fields) 19 | } 20 | return out 21 | } 22 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/staticcheck/knowledge.go: -------------------------------------------------------------------------------- 1 | package staticcheck 2 | 3 | import ( 4 | "reflect" 5 | 6 | "golang.org/x/tools/go/analysis" 7 | "honnef.co/go/tools/internal/passes/buildssa" 8 | "honnef.co/go/tools/ssa" 9 | "honnef.co/go/tools/staticcheck/vrp" 10 | ) 11 | 12 | var valueRangesAnalyzer = &analysis.Analyzer{ 13 | Name: "vrp", 14 | Doc: "calculate value ranges of functions", 15 | Run: func(pass *analysis.Pass) (interface{}, error) { 16 | m := map[*ssa.Function]vrp.Ranges{} 17 | for _, ssafn := range pass.ResultOf[buildssa.Analyzer].(*buildssa.SSA).SrcFuncs { 18 | vr := vrp.BuildGraph(ssafn).Solve() 19 | m[ssafn] = vr 20 | } 21 | return m, nil 22 | }, 23 | Requires: []*analysis.Analyzer{buildssa.Analyzer}, 24 | ResultType: reflect.TypeOf(map[*ssa.Function]vrp.Ranges{}), 25 | } 26 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/staticcheck/structtag.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Copyright 2019 Dominik Honnef. All rights reserved. 3 | 4 | package staticcheck 5 | 6 | import "strconv" 7 | 8 | func parseStructTag(tag string) (map[string][]string, error) { 9 | // FIXME(dh): detect missing closing quote 10 | out := map[string][]string{} 11 | 12 | for tag != "" { 13 | // Skip leading space. 14 | i := 0 15 | for i < len(tag) && tag[i] == ' ' { 16 | i++ 17 | } 18 | tag = tag[i:] 19 | if tag == "" { 20 | break 21 | } 22 | 23 | // Scan to colon. A space, a quote or a control character is a syntax error. 24 | // Strictly speaking, control chars include the range [0x7f, 0x9f], not just 25 | // [0x00, 0x1f], but in practice, we ignore the multi-byte control characters 26 | // as it is simpler to inspect the tag's bytes than the tag's runes. 27 | i = 0 28 | for i < len(tag) && tag[i] > ' ' && tag[i] != ':' && tag[i] != '"' && tag[i] != 0x7f { 29 | i++ 30 | } 31 | if i == 0 || i+1 >= len(tag) || tag[i] != ':' || tag[i+1] != '"' { 32 | break 33 | } 34 | name := string(tag[:i]) 35 | tag = tag[i+1:] 36 | 37 | // Scan quoted string to find value. 38 | i = 1 39 | for i < len(tag) && tag[i] != '"' { 40 | if tag[i] == '\\' { 41 | i++ 42 | } 43 | i++ 44 | } 45 | if i >= len(tag) { 46 | break 47 | } 48 | qvalue := string(tag[:i+1]) 49 | tag = tag[i+1:] 50 | 51 | value, err := strconv.Unquote(qvalue) 52 | if err != nil { 53 | return nil, err 54 | } 55 | out[name] = append(out[name], value) 56 | } 57 | return out, nil 58 | } 59 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/staticcheck/vrp/channel.go: -------------------------------------------------------------------------------- 1 | package vrp 2 | 3 | import ( 4 | "fmt" 5 | 6 | "honnef.co/go/tools/ssa" 7 | ) 8 | 9 | type ChannelInterval struct { 10 | Size IntInterval 11 | } 12 | 13 | func (c ChannelInterval) Union(other Range) Range { 14 | i, ok := other.(ChannelInterval) 15 | if !ok { 16 | i = ChannelInterval{EmptyIntInterval} 17 | } 18 | if c.Size.Empty() || !c.Size.IsKnown() { 19 | return i 20 | } 21 | if i.Size.Empty() || !i.Size.IsKnown() { 22 | return c 23 | } 24 | return ChannelInterval{ 25 | Size: c.Size.Union(i.Size).(IntInterval), 26 | } 27 | } 28 | 29 | func (c ChannelInterval) String() string { 30 | return c.Size.String() 31 | } 32 | 33 | func (c ChannelInterval) IsKnown() bool { 34 | return c.Size.IsKnown() 35 | } 36 | 37 | type MakeChannelConstraint struct { 38 | aConstraint 39 | Buffer ssa.Value 40 | } 41 | type ChannelChangeTypeConstraint struct { 42 | aConstraint 43 | X ssa.Value 44 | } 45 | 46 | func NewMakeChannelConstraint(buffer, y ssa.Value) Constraint { 47 | return &MakeChannelConstraint{NewConstraint(y), buffer} 48 | } 49 | func NewChannelChangeTypeConstraint(x, y ssa.Value) Constraint { 50 | return &ChannelChangeTypeConstraint{NewConstraint(y), x} 51 | } 52 | 53 | func (c *MakeChannelConstraint) Operands() []ssa.Value { return []ssa.Value{c.Buffer} } 54 | func (c *ChannelChangeTypeConstraint) Operands() []ssa.Value { return []ssa.Value{c.X} } 55 | 56 | func (c *MakeChannelConstraint) String() string { 57 | return fmt.Sprintf("%s = make(chan, %s)", c.Y().Name(), c.Buffer.Name()) 58 | } 59 | func (c *ChannelChangeTypeConstraint) String() string { 60 | return fmt.Sprintf("%s = changetype(%s)", c.Y().Name(), c.X.Name()) 61 | } 62 | 63 | func (c *MakeChannelConstraint) Eval(g *Graph) Range { 64 | i, ok := g.Range(c.Buffer).(IntInterval) 65 | if !ok { 66 | return ChannelInterval{NewIntInterval(NewZ(0), PInfinity)} 67 | } 68 | if i.Lower.Sign() == -1 { 69 | i.Lower = NewZ(0) 70 | } 71 | return ChannelInterval{i} 72 | } 73 | func (c *ChannelChangeTypeConstraint) Eval(g *Graph) Range { return g.Range(c.X) } 74 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/unused/edge.go: -------------------------------------------------------------------------------- 1 | package unused 2 | 3 | //go:generate stringer -type edgeKind 4 | type edgeKind uint64 5 | 6 | func (e edgeKind) is(o edgeKind) bool { 7 | return e&o != 0 8 | } 9 | 10 | const ( 11 | edgeAlias edgeKind = 1 << iota 12 | edgeBlankField 13 | edgeAnonymousStruct 14 | edgeCgoExported 15 | edgeConstGroup 16 | edgeElementType 17 | edgeEmbeddedInterface 18 | edgeExportedConstant 19 | edgeExportedField 20 | edgeExportedFunction 21 | edgeExportedMethod 22 | edgeExportedType 23 | edgeExportedVariable 24 | edgeExtendsExportedFields 25 | edgeExtendsExportedMethodSet 26 | edgeFieldAccess 27 | edgeFunctionArgument 28 | edgeFunctionResult 29 | edgeFunctionSignature 30 | edgeImplements 31 | edgeInstructionOperand 32 | edgeInterfaceCall 33 | edgeInterfaceMethod 34 | edgeKeyType 35 | edgeLinkname 36 | edgeMainFunction 37 | edgeNamedType 38 | edgeNetRPCRegister 39 | edgeNoCopySentinel 40 | edgeProvidesMethod 41 | edgeReceiver 42 | edgeRuntimeFunction 43 | edgeSignature 44 | edgeStructConversion 45 | edgeTestSink 46 | edgeTupleElement 47 | edgeType 48 | edgeTypeName 49 | edgeUnderlyingType 50 | edgePointerType 51 | edgeUnsafeConversion 52 | edgeUsedConstant 53 | edgeVarDecl 54 | ) 55 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/unused/implements.go: -------------------------------------------------------------------------------- 1 | package unused 2 | 3 | import "go/types" 4 | 5 | // lookupMethod returns the index of and method with matching package and name, or (-1, nil). 6 | func lookupMethod(T *types.Interface, pkg *types.Package, name string) (int, *types.Func) { 7 | if name != "_" { 8 | for i := 0; i < T.NumMethods(); i++ { 9 | m := T.Method(i) 10 | if sameId(m, pkg, name) { 11 | return i, m 12 | } 13 | } 14 | } 15 | return -1, nil 16 | } 17 | 18 | func sameId(obj types.Object, pkg *types.Package, name string) bool { 19 | // spec: 20 | // "Two identifiers are different if they are spelled differently, 21 | // or if they appear in different packages and are not exported. 22 | // Otherwise, they are the same." 23 | if name != obj.Name() { 24 | return false 25 | } 26 | // obj.Name == name 27 | if obj.Exported() { 28 | return true 29 | } 30 | // not exported, so packages must be the same (pkg == nil for 31 | // fields in Universe scope; this can only happen for types 32 | // introduced via Eval) 33 | if pkg == nil || obj.Pkg() == nil { 34 | return pkg == obj.Pkg() 35 | } 36 | // pkg != nil && obj.pkg != nil 37 | return pkg.Path() == obj.Pkg().Path() 38 | } 39 | 40 | func (g *Graph) implements(V types.Type, T *types.Interface, msV *types.MethodSet) ([]*types.Selection, bool) { 41 | // fast path for common case 42 | if T.Empty() { 43 | return nil, true 44 | } 45 | 46 | if ityp, _ := V.Underlying().(*types.Interface); ityp != nil { 47 | // TODO(dh): is this code reachable? 48 | for i := 0; i < T.NumMethods(); i++ { 49 | m := T.Method(i) 50 | _, obj := lookupMethod(ityp, m.Pkg(), m.Name()) 51 | switch { 52 | case obj == nil: 53 | return nil, false 54 | case !types.Identical(obj.Type(), m.Type()): 55 | return nil, false 56 | } 57 | } 58 | return nil, true 59 | } 60 | 61 | // A concrete type implements T if it implements all methods of T. 62 | var sels []*types.Selection 63 | for i := 0; i < T.NumMethods(); i++ { 64 | m := T.Method(i) 65 | sel := msV.Lookup(m.Pkg(), m.Name()) 66 | if sel == nil { 67 | return nil, false 68 | } 69 | 70 | f, _ := sel.Obj().(*types.Func) 71 | if f == nil { 72 | return nil, false 73 | } 74 | 75 | if !types.Identical(f.Type(), m.Type()) { 76 | return nil, false 77 | } 78 | 79 | sels = append(sels, sel) 80 | } 81 | return sels, true 82 | } 83 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/version/buildinfo.go: -------------------------------------------------------------------------------- 1 | // +build go1.12 2 | 3 | package version 4 | 5 | import ( 6 | "fmt" 7 | "runtime/debug" 8 | ) 9 | 10 | func printBuildInfo() { 11 | if info, ok := debug.ReadBuildInfo(); ok { 12 | fmt.Println("Main module:") 13 | printModule(&info.Main) 14 | fmt.Println("Dependencies:") 15 | for _, dep := range info.Deps { 16 | printModule(dep) 17 | } 18 | } else { 19 | fmt.Println("Built without Go modules") 20 | } 21 | } 22 | 23 | func buildInfoVersion() (string, bool) { 24 | info, ok := debug.ReadBuildInfo() 25 | if !ok { 26 | return "", false 27 | } 28 | if info.Main.Version == "(devel)" { 29 | return "", false 30 | } 31 | return info.Main.Version, true 32 | } 33 | 34 | func printModule(m *debug.Module) { 35 | fmt.Printf("\t%s", m.Path) 36 | if m.Version != "(devel)" { 37 | fmt.Printf("@%s", m.Version) 38 | } 39 | if m.Sum != "" { 40 | fmt.Printf(" (sum: %s)", m.Sum) 41 | } 42 | if m.Replace != nil { 43 | fmt.Printf(" (replace: %s)", m.Replace.Path) 44 | } 45 | fmt.Println() 46 | } 47 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/version/buildinfo111.go: -------------------------------------------------------------------------------- 1 | // +build !go1.12 2 | 3 | package version 4 | 5 | func printBuildInfo() {} 6 | func buildInfoVersion() (string, bool) { return "", false } 7 | -------------------------------------------------------------------------------- /vendor/honnef.co/go/tools/version/version.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | "runtime" 8 | ) 9 | 10 | const Version = "2019.2.3" 11 | 12 | // version returns a version descriptor and reports whether the 13 | // version is a known release. 14 | func version() (string, bool) { 15 | if Version != "devel" { 16 | return Version, true 17 | } 18 | v, ok := buildInfoVersion() 19 | if ok { 20 | return v, false 21 | } 22 | return "devel", false 23 | } 24 | 25 | func Print() { 26 | v, release := version() 27 | 28 | if release { 29 | fmt.Printf("%s %s\n", filepath.Base(os.Args[0]), v) 30 | } else if v == "devel" { 31 | fmt.Printf("%s (no version)\n", filepath.Base(os.Args[0])) 32 | } else { 33 | fmt.Printf("%s (devel, %s)\n", filepath.Base(os.Args[0]), v) 34 | } 35 | } 36 | 37 | func Verbose() { 38 | Print() 39 | fmt.Println() 40 | fmt.Println("Compiled with Go version:", runtime.Version()) 41 | printBuildInfo() 42 | } 43 | -------------------------------------------------------------------------------- /vendor/modules.txt: -------------------------------------------------------------------------------- 1 | # github.com/BurntSushi/toml v0.3.1 2 | github.com/BurntSushi/toml 3 | # go.uber.org/atomic v1.5.0 4 | go.uber.org/atomic 5 | # go.uber.org/multierr v1.3.0 6 | go.uber.org/multierr 7 | # go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee 8 | go.uber.org/tools/update-license 9 | # go.uber.org/zap v1.14.0 10 | go.uber.org/zap 11 | go.uber.org/zap/buffer 12 | go.uber.org/zap/internal/bufferpool 13 | go.uber.org/zap/internal/color 14 | go.uber.org/zap/internal/exit 15 | go.uber.org/zap/zapcore 16 | # golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d 17 | golang.org/x/crypto/md4 18 | # golang.org/x/lint v0.0.0-20190930215403-16217165b5de 19 | golang.org/x/lint 20 | golang.org/x/lint/golint 21 | # golang.org/x/text v0.3.2 22 | golang.org/x/text/encoding 23 | golang.org/x/text/encoding/internal 24 | golang.org/x/text/encoding/internal/identifier 25 | golang.org/x/text/encoding/unicode 26 | golang.org/x/text/internal/utf8internal 27 | golang.org/x/text/runes 28 | golang.org/x/text/transform 29 | # golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 30 | golang.org/x/tools/go/analysis 31 | golang.org/x/tools/go/analysis/passes/inspect 32 | golang.org/x/tools/go/ast/astutil 33 | golang.org/x/tools/go/ast/inspector 34 | golang.org/x/tools/go/buildutil 35 | golang.org/x/tools/go/gcexportdata 36 | golang.org/x/tools/go/internal/gcimporter 37 | golang.org/x/tools/go/internal/packagesdriver 38 | golang.org/x/tools/go/packages 39 | golang.org/x/tools/go/types/objectpath 40 | golang.org/x/tools/go/types/typeutil 41 | golang.org/x/tools/internal/fastwalk 42 | golang.org/x/tools/internal/gopathwalk 43 | golang.org/x/tools/internal/semver 44 | golang.org/x/tools/internal/span 45 | # honnef.co/go/tools v0.0.1-2019.2.3 46 | honnef.co/go/tools/arg 47 | honnef.co/go/tools/cmd/staticcheck 48 | honnef.co/go/tools/config 49 | honnef.co/go/tools/deprecated 50 | honnef.co/go/tools/facts 51 | honnef.co/go/tools/functions 52 | honnef.co/go/tools/go/types/typeutil 53 | honnef.co/go/tools/internal/cache 54 | honnef.co/go/tools/internal/passes/buildssa 55 | honnef.co/go/tools/internal/renameio 56 | honnef.co/go/tools/internal/sharedcheck 57 | honnef.co/go/tools/lint 58 | honnef.co/go/tools/lint/lintdsl 59 | honnef.co/go/tools/lint/lintutil 60 | honnef.co/go/tools/lint/lintutil/format 61 | honnef.co/go/tools/loader 62 | honnef.co/go/tools/printf 63 | honnef.co/go/tools/simple 64 | honnef.co/go/tools/ssa 65 | honnef.co/go/tools/ssautil 66 | honnef.co/go/tools/staticcheck 67 | honnef.co/go/tools/staticcheck/vrp 68 | honnef.co/go/tools/stylecheck 69 | honnef.co/go/tools/unused 70 | honnef.co/go/tools/version 71 | --------------------------------------------------------------------------------