├── src
└── github.com
│ ├── vendor
│ └── json-iterator
│ └── go-benchmark
│ ├── testobject
│ ├── GoUnusedProtection__.go
│ └── TestObject-consts.go
│ ├── with_10_int_fields
│ ├── GoUnusedProtection__.go
│ ├── TestObject.thrift
│ ├── Pb.proto
│ └── TestObject-consts.go
│ ├── TestObject.thrift
│ ├── with_10_string_fields
│ ├── pb.go
│ └── benchmark_test.go
│ ├── with_10_double_fields
│ └── Pb.proto
│ ├── Pb.proto
│ ├── benchmark_large_payload_test.go
│ ├── benchmark_medium_payload_test.go
│ ├── large_file_test.go
│ ├── pb_test.go
│ └── benchmark_small_payload_test.go
├── large.png
├── medium.png
├── small.png
├── .gitignore
├── govendor
└── src
│ └── github.com
│ └── kardianos
│ └── govendor
│ ├── internal
│ ├── vfilepath
│ │ ├── switch.go
│ │ ├── prefix.go
│ │ ├── stub.go
│ │ ├── prefix_test.go
│ │ └── walk.go
│ ├── vos
│ │ ├── switch.go
│ │ └── stub.go
│ └── pathos
│ │ └── path_test.go
│ ├── vendor
│ ├── github.com
│ │ ├── google
│ │ │ └── shlex
│ │ │ │ └── README
│ │ ├── dchest
│ │ │ └── safefile
│ │ │ │ ├── rename.go
│ │ │ │ ├── appveyor.yml
│ │ │ │ ├── README.md
│ │ │ │ ├── LICENSE
│ │ │ │ └── rename_nonatomic.go
│ │ ├── Bowery
│ │ │ └── prompt
│ │ │ │ ├── term_linux.go
│ │ │ │ ├── term_bsd.go
│ │ │ │ ├── keys_unix.go
│ │ │ │ ├── keys.go
│ │ │ │ ├── keys_windows.go
│ │ │ │ ├── ansi_unix.go
│ │ │ │ ├── LICENSE
│ │ │ │ ├── buffer_unix.go
│ │ │ │ ├── README.md
│ │ │ │ └── prompt.go
│ │ └── pkg
│ │ │ └── errors
│ │ │ ├── appveyor.yml
│ │ │ ├── LICENSE
│ │ │ └── README.md
│ ├── golang.org
│ │ └── x
│ │ │ └── tools
│ │ │ ├── go
│ │ │ └── vcs
│ │ │ │ ├── env.go
│ │ │ │ ├── http.go
│ │ │ │ └── discovery.go
│ │ │ ├── PATENTS
│ │ │ └── LICENSE
│ └── vendor.json
│ ├── help
│ ├── version.go
│ ├── gen-license.template
│ └── msg.go
│ ├── context
│ ├── syslist.go
│ ├── license_test.go
│ ├── version_test.go
│ ├── version.go
│ ├── vendorFile.go
│ ├── err.go
│ └── get.go
│ ├── appveyor.yml
│ ├── migrate
│ ├── gb.go
│ ├── gdm_test.go
│ ├── gdm.go
│ └── glock.go
│ ├── run
│ ├── sync.go
│ └── shell.go
│ ├── vcs
│ ├── svn_test.go
│ ├── git.go
│ ├── svn.go
│ ├── bzr.go
│ ├── hg.go
│ └── vcs.go
│ ├── pkgspec
│ └── pkg.go
│ ├── main.go
│ ├── .travis.yml
│ ├── LICENSE
│ └── doc
│ ├── faq.md
│ └── dev-guide.md
├── large-file.png
├── vendor
├── github.com
│ ├── json-iterator
│ │ └── go
│ ├── ugorji
│ │ └── go
│ │ │ ├── codec
│ │ │ ├── prebuild.go
│ │ │ ├── gen_17.go
│ │ │ ├── gen_16.go
│ │ │ ├── gen_15.go
│ │ │ ├── decode_go14.go
│ │ │ ├── decode_go.go
│ │ │ ├── helper_not_unsafe.go
│ │ │ ├── fast-path.not.go
│ │ │ └── helper_unsafe.go
│ │ │ └── LICENSE
│ ├── mailru
│ │ └── easyjson
│ │ │ ├── tests
│ │ │ ├── nothing.go
│ │ │ ├── snake.go
│ │ │ ├── omitempty.go
│ │ │ ├── errors.go
│ │ │ ├── nested_easy.go
│ │ │ └── named_type.go
│ │ │ ├── benchmark
│ │ │ └── ujson.sh
│ │ │ ├── jlexer
│ │ │ ├── error.go
│ │ │ ├── bytestostr_nounsafe.go
│ │ │ └── bytestostr.go
│ │ │ ├── parser
│ │ │ ├── parser_unix.go
│ │ │ ├── parser_windows.go
│ │ │ └── parser.go
│ │ │ ├── LICENSE
│ │ │ ├── raw.go
│ │ │ ├── opt
│ │ │ ├── opts.go
│ │ │ ├── gotemplate_Int.go
│ │ │ ├── gotemplate_Bool.go
│ │ │ ├── gotemplate_Int8.go
│ │ │ ├── gotemplate_Uint.go
│ │ │ ├── gotemplate_Int16.go
│ │ │ ├── gotemplate_Int32.go
│ │ │ ├── gotemplate_Int64.go
│ │ │ ├── gotemplate_Uint8.go
│ │ │ ├── gotemplate_String.go
│ │ │ ├── gotemplate_Uint16.go
│ │ │ ├── gotemplate_Uint32.go
│ │ │ ├── gotemplate_Uint64.go
│ │ │ ├── optional
│ │ │ │ └── opt.go
│ │ │ ├── gotemplate_Float32.go
│ │ │ └── gotemplate_Float64.go
│ │ │ ├── Makefile
│ │ │ └── helpers.go
│ ├── pquerna
│ │ └── ffjson
│ │ │ ├── NOTICE
│ │ │ └── fflib
│ │ │ └── v1
│ │ │ ├── buffer_nopool.go
│ │ │ ├── reader_scan_generic.go
│ │ │ └── bytenum.go
│ ├── buger
│ │ └── jsonparser
│ │ │ ├── Dockerfile
│ │ │ ├── bytes_safe.go
│ │ │ ├── bytes.go
│ │ │ ├── bytes_unsafe.go
│ │ │ ├── LICENSE
│ │ │ └── Makefile
│ ├── golang
│ │ └── protobuf
│ │ │ ├── LICENSE
│ │ │ └── proto
│ │ │ └── Makefile
│ └── gogo
│ │ └── protobuf
│ │ ├── proto
│ │ ├── lib_gogo.go
│ │ ├── Makefile
│ │ └── text_gogo.go
│ │ └── LICENSE
└── git.apache.org
│ └── thrift.git
│ ├── NOTICE
│ └── lib
│ └── go
│ └── thrift
│ ├── protocol_factory.go
│ ├── processor.go
│ ├── messagetype.go
│ ├── server.go
│ ├── server_transport.go
│ ├── http_transport.go
│ ├── transport_factory.go
│ ├── exception.go
│ ├── deserializer.go
│ ├── type.go
│ ├── processor_factory.go
│ ├── transport.go
│ ├── rich_transport.go
│ ├── field.go
│ ├── serializer.go
│ ├── pointerize.go
│ ├── protocol_exception.go
│ ├── memory_buffer.go
│ ├── transport_exception.go
│ └── buffered_transport.go
└── LICENSE
/src/github.com/vendor:
--------------------------------------------------------------------------------
1 | ../../vendor
--------------------------------------------------------------------------------
/large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/json-iterator/go-benchmark/HEAD/large.png
--------------------------------------------------------------------------------
/medium.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/json-iterator/go-benchmark/HEAD/medium.png
--------------------------------------------------------------------------------
/small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/json-iterator/go-benchmark/HEAD/small.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | /govendor/bin
3 | /govendor/pkg
4 | /pkg
5 | /output
6 | /.cache
7 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/internal/vfilepath/switch.go:
--------------------------------------------------------------------------------
1 | package vfilepath
2 |
--------------------------------------------------------------------------------
/large-file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/json-iterator/go-benchmark/HEAD/large-file.png
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go:
--------------------------------------------------------------------------------
1 | /home/xiaoju/workspace/jsoniter/src/github.com/json-iterator/go
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/prebuild.go:
--------------------------------------------------------------------------------
1 | package codec
2 |
3 | //go:generate bash prebuild.sh
4 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/tests/nothing.go:
--------------------------------------------------------------------------------
1 | package tests
2 |
3 | // No structs in this file
4 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/google/shlex/README:
--------------------------------------------------------------------------------
1 | go-shlex is a simple lexer for go that supports shell-style quoting,
2 | commenting, and escaping.
3 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/NOTICE:
--------------------------------------------------------------------------------
1 | Apache Thrift
2 | Copyright 2006-2010 The Apache Software Foundation.
3 |
4 | This product includes software developed at
5 | The Apache Software Foundation (http://www.apache.org/).
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/internal/vos/switch.go:
--------------------------------------------------------------------------------
1 | package vos
2 |
3 | import (
4 | "log"
5 | )
6 |
7 | const debugLog = false
8 |
9 | func l(fname, path string) {
10 | if debugLog {
11 | log.Println(fname, path)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/testobject/GoUnusedProtection__.go:
--------------------------------------------------------------------------------
1 | // Autogenerated by Thrift Compiler (0.10.0)
2 | // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
3 |
4 | package testobject
5 |
6 | var GoUnusedProtection__ int;
7 |
8 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/help/version.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 help
6 |
7 | var version = "v1.0.8"
8 |
--------------------------------------------------------------------------------
/vendor/github.com/pquerna/ffjson/NOTICE:
--------------------------------------------------------------------------------
1 | ffjson
2 | Copyright (c) 2014, Paul Querna
3 |
4 | This product includes software developed by
5 | Paul Querna (http://paul.querna.org/).
6 |
7 | Portions of this software were developed as
8 | part of Go, Copyright (c) 2012 The Go Authors.
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/dchest/safefile/rename.go:
--------------------------------------------------------------------------------
1 | // +build !plan9,!windows windows,go1.5
2 |
3 | package safefile
4 |
5 | import "os"
6 |
7 | func rename(oldname, newname string) error {
8 | return os.Rename(oldname, newname)
9 | }
10 |
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/with_10_int_fields/GoUnusedProtection__.go:
--------------------------------------------------------------------------------
1 | // Autogenerated by Thrift Compiler (0.10.0)
2 | // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
3 |
4 | package with_10_int_fields
5 |
6 | var GoUnusedProtection__ int;
7 |
8 |
--------------------------------------------------------------------------------
/vendor/github.com/pquerna/ffjson/fflib/v1/buffer_nopool.go:
--------------------------------------------------------------------------------
1 | // +build !go1.3
2 |
3 | package v1
4 |
5 | // Stub version of buffer_pool.go for Go 1.2, which doesn't have sync.Pool.
6 |
7 | func Pool(b []byte) {}
8 |
9 | func makeSlice(n int) []byte {
10 | return make([]byte, n)
11 | }
12 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/Bowery/prompt/term_linux.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013-2015 Bowery, Inc.
2 |
3 | package prompt
4 |
5 | import (
6 | "syscall"
7 | )
8 |
9 | const (
10 | tcgets = syscall.TCGETS
11 | tcsets = syscall.TCSETS
12 | tcsetsf = 0x5404
13 | )
14 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/gen_17.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build go1.7
5 |
6 | package codec
7 |
8 | func init() {
9 | genCheckVendor = true
10 | }
11 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/tests/snake.go:
--------------------------------------------------------------------------------
1 | package tests
2 |
3 | //easyjson:json
4 | type SnakeStruct struct {
5 | WeirdHTTPStuff bool
6 | CustomNamedField string `json:"cUsToM"`
7 | }
8 |
9 | var snakeStructValue SnakeStruct
10 | var snakeStructString = `{"weird_http_stuff":false,"cUsToM":""}`
11 |
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/with_10_int_fields/TestObject.thrift:
--------------------------------------------------------------------------------
1 | struct ThriftTestObject
2 | {
3 | 1: i32 field1
4 | 2: i32 field2
5 | 3: i32 field3
6 | 4: i32 field4
7 | 5: i32 field5
8 | 6: i32 field6
9 | 7: i32 field7
10 | 8: i32 field8
11 | 9: i32 field9
12 | 10: i32 field10
13 | }
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/TestObject.thrift:
--------------------------------------------------------------------------------
1 | struct ThriftTestObject
2 | {
3 | 1: string field1
4 | 2: string field2
5 | 3: string field3
6 | 4: string field4
7 | 5: string field5
8 | 6: string field6
9 | 7: string field7
10 | 8: string field8
11 | 9: string field9
12 | 10: string field10
13 | }
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/help/gen-license.template:
--------------------------------------------------------------------------------
1 | // Machine generated; DO NOT EDIT.
2 |
3 | package help
4 |
5 | var msgGovendorLicenses = `{{range $index, $t := .}}{{if ne $index 0}}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 | {{end}}{{.Filename}} - {{.Path}}
7 | {{.Text}}{{end}}
8 | `
9 |
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/with_10_string_fields/pb.go:
--------------------------------------------------------------------------------
1 | package with_10_string_fields
2 |
3 | type PbTestObject struct {
4 | Field1 string
5 | Field2 string
6 | Field3 string
7 | Field4 string
8 | Field5 string
9 | Field6 string
10 | Field7 string
11 | Field8 string
12 | Field9 string
13 | Field10 string
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/gen_16.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build go1.6
5 |
6 | package codec
7 |
8 | import "os"
9 |
10 | func init() {
11 | genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") != "0"
12 | }
13 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/gen_15.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build go1.5,!go1.6
5 |
6 | package codec
7 |
8 | import "os"
9 |
10 | func init() {
11 | genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") == "1"
12 | }
13 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/Bowery/prompt/term_bsd.go:
--------------------------------------------------------------------------------
1 | // +build darwin freebsd openbsd netbsd dragonfly
2 |
3 | // Copyright 2013-2015 Bowery, Inc.
4 |
5 | package prompt
6 |
7 | import (
8 | "syscall"
9 | )
10 |
11 | const (
12 | tcgets = syscall.TIOCGETA
13 | tcsets = syscall.TIOCSETA
14 | tcsetsf = syscall.TIOCSETAF
15 | )
16 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/internal/vfilepath/prefix.go:
--------------------------------------------------------------------------------
1 | package vfilepath
2 |
3 | import "strings"
4 |
5 | func HasPrefixDir(path string, prefix string) bool {
6 | return strings.HasPrefix(makeDirPath(path), makeDirPath(prefix))
7 | }
8 |
9 | func makeDirPath(path string) string {
10 | if path != "/" {
11 | path += "/"
12 | }
13 | return path
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/tests/omitempty.go:
--------------------------------------------------------------------------------
1 | package tests
2 |
3 | //easyjson:json
4 | type OmitEmptyDefault struct {
5 | Field string
6 | Str string
7 | Str1 string `json:"s,!omitempty"`
8 | Str2 string `json:",!omitempty"`
9 | }
10 |
11 | var omitEmptyDefaultValue = OmitEmptyDefault{Field: "test"}
12 | var omitEmptyDefaultString = `{"Field":"test","s":"","Str2":""}`
13 |
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/with_10_double_fields/Pb.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | option optimize_for = SPEED;
3 | message PbTestObject {
4 | int32 field1 = 1;
5 | int32 field2 = 2;
6 | int32 field3 = 3;
7 | int32 field4 = 4;
8 | int32 field5 = 5;
9 | int32 field6 = 6;
10 | int32 field7 = 7;
11 | int32 field8 = 8;
12 | int32 field9 = 9;
13 | int32 field10 = 10;
14 | }
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/with_10_int_fields/Pb.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | option optimize_for = SPEED;
3 | message PbTestObject {
4 | int32 field1 = 1;
5 | int32 field2 = 2;
6 | int32 field3 = 3;
7 | int32 field4 = 4;
8 | int32 field5 = 5;
9 | int32 field6 = 6;
10 | int32 field7 = 7;
11 | int32 field8 = 8;
12 | int32 field9 = 9;
13 | int32 field10 = 10;
14 | }
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/benchmark/ujson.sh:
--------------------------------------------------------------------------------
1 | #/bin/bash
2 |
3 | echo -n "Python ujson module, DECODE: "
4 | python -m timeit -s "import ujson; data = open('`dirname $0`/example.json', 'r').read()" 'ujson.loads(data)'
5 |
6 | echo -n "Python ujson module, ENCODE: "
7 | python -m timeit -s "import ujson; data = open('`dirname $0`/example.json', 'r').read(); obj = ujson.loads(data)" 'ujson.dumps(obj)'
8 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/Bowery/prompt/keys_unix.go:
--------------------------------------------------------------------------------
1 | // +build linux darwin freebsd openbsd netbsd dragonfly
2 |
3 | // Copyright 2013-2015 Bowery, Inc.
4 |
5 | package prompt
6 |
7 | const mvToCol = "\u001b[0G\u001b[%dC"
8 |
9 | var (
10 | mvLeftEdge = []byte("\u001b[0G")
11 | clsScreen = []byte("\u001b[H\u001b[2J")
12 | delRight = []byte("\u001b[0K")
13 | )
14 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/internal/vfilepath/stub.go:
--------------------------------------------------------------------------------
1 | package vfilepath
2 |
3 | import (
4 | "path/filepath"
5 | )
6 |
7 | func Split(path string) (string, string) {
8 | return filepath.Split(path)
9 | }
10 |
11 | func Join(parts ...string) string {
12 | return filepath.Join(parts...)
13 | }
14 |
15 | func EvalSymlinks(path string) (string, error) {
16 | return filepath.EvalSymlinks(path)
17 | }
18 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/decode_go14.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build !go1.5
5 |
6 | package codec
7 |
8 | import "reflect"
9 |
10 | const reflectArrayOfSupported = false
11 |
12 | func reflectArrayOf(rvn reflect.Value) (rvn2 reflect.Value) {
13 | panic("reflect.ArrayOf unsupported")
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/jlexer/error.go:
--------------------------------------------------------------------------------
1 | package jlexer
2 |
3 | import "fmt"
4 |
5 | // LexerError implements the error interface and represents all possible errors that can be
6 | // generated during parsing the JSON data.
7 | type LexerError struct {
8 | Reason string
9 | Offset int
10 | Data string
11 | }
12 |
13 | func (l *LexerError) Error() string {
14 | return fmt.Sprintf("parse error: %s near offset %d of '%s'", l.Reason, l.Offset, l.Data)
15 | }
16 |
--------------------------------------------------------------------------------
/vendor/github.com/buger/jsonparser/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM golang:1.6
2 |
3 | RUN go get github.com/Jeffail/gabs
4 | RUN go get github.com/bitly/go-simplejson
5 | RUN go get github.com/pquerna/ffjson
6 | RUN go get github.com/antonholmquist/jason
7 | RUN go get github.com/mreiferson/go-ujson
8 | RUN go get -tags=unsafe -u github.com/ugorji/go/codec
9 | RUN go get github.com/mailru/easyjson
10 |
11 | WORKDIR /go/src/github.com/buger/jsonparser
12 | ADD . /go/src/github.com/buger/jsonparser
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go:
--------------------------------------------------------------------------------
1 | // This file is included to the build if any of the buildtags below
2 | // are defined. Refer to README notes for more details.
3 |
4 | //+build easyjson_nounsafe appengine
5 |
6 | package jlexer
7 |
8 | // bytesToStr creates a string normally from []byte
9 | //
10 | // Note that this method is roughly 1.5x slower than using the 'unsafe' method.
11 | func bytesToStr(data []byte) string {
12 | return string(data)
13 | }
14 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/decode_go.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build go1.5
5 |
6 | package codec
7 |
8 | import "reflect"
9 |
10 | const reflectArrayOfSupported = true
11 |
12 | func reflectArrayOf(rvn reflect.Value) (rvn2 reflect.Value) {
13 | rvn2 = reflect.New(reflect.ArrayOf(rvn.Len(), intfTyp)).Elem()
14 | reflect.Copy(rvn2, rvn)
15 | return
16 | }
17 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/context/syslist.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package context
6 |
7 | const goosList = "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows "
8 | const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc s390 s390x sparc sparc64 "
9 |
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/Pb.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | package go_benchmark;
4 | option optimize_for = SPEED;
5 | message PbTestObject {
6 | string field1 = 1;
7 | string field2 = 2;
8 | string field3 = 3;
9 | string field4 = 4;
10 | string field5 = 5;
11 | string field6 = 6;
12 | string field7 = 7;
13 | string field8 = 8;
14 | string field9 = 9;
15 | string field10 = 10;
16 | }
17 |
18 |
19 | message With2Fields {
20 | string field1 = 1;
21 | string field2 = 2;
22 | }
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/testobject/TestObject-consts.go:
--------------------------------------------------------------------------------
1 | // Autogenerated by Thrift Compiler (0.10.0)
2 | // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
3 |
4 | package testobject
5 |
6 | import (
7 | "bytes"
8 | "fmt"
9 | "git.apache.org/thrift.git/lib/go/thrift"
10 | )
11 |
12 | // (needed to ensure safety because of naive import list construction.)
13 | var _ = thrift.ZERO
14 | var _ = fmt.Printf
15 | var _ = bytes.Equal
16 |
17 |
18 | func init() {
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/with_10_int_fields/TestObject-consts.go:
--------------------------------------------------------------------------------
1 | // Autogenerated by Thrift Compiler (0.10.0)
2 | // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
3 |
4 | package with_10_int_fields
5 |
6 | import (
7 | "bytes"
8 | "fmt"
9 | "git.apache.org/thrift.git/lib/go/thrift"
10 | )
11 |
12 | // (needed to ensure safety because of naive import list construction.)
13 | var _ = thrift.ZERO
14 | var _ = fmt.Printf
15 | var _ = bytes.Equal
16 |
17 |
18 | func init() {
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/vendor/github.com/buger/jsonparser/bytes_safe.go:
--------------------------------------------------------------------------------
1 | // +build appengine appenginevm
2 |
3 | package jsonparser
4 |
5 | import (
6 | "strconv"
7 | )
8 |
9 | // See fastbytes_unsafe.go for explanation on why *[]byte is used (signatures must be consistent with those in that file)
10 |
11 | func equalStr(b *[]byte, s string) bool {
12 | return string(*b) == s
13 | }
14 |
15 | func parseFloat(b *[]byte) (float64, error) {
16 | return strconv.ParseFloat(string(*b), 64)
17 | }
18 |
19 | func bytesToString(b *[]byte) string {
20 | return string(*b)
21 | }
22 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/dchest/safefile/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: "{build}"
2 |
3 | os: Windows Server 2012 R2
4 |
5 | clone_folder: c:\projects\src\github.com\dchest\safefile
6 |
7 | environment:
8 | PATH: c:\projects\bin;%PATH%
9 | GOPATH: c:\projects
10 | NOTIFY_TIMEOUT: 5s
11 |
12 | install:
13 | - go version
14 | - go get golang.org/x/tools/cmd/vet
15 | - go get -v -t ./...
16 |
17 | build_script:
18 | - go tool vet -all .
19 | - go build ./...
20 | - go test -v -race ./...
21 |
22 | test: off
23 |
24 | deploy: off
25 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/tests/errors.go:
--------------------------------------------------------------------------------
1 | package tests
2 |
3 | //easyjson:json
4 | type ErrorIntSlice []int
5 |
6 | //easyjson:json
7 | type ErrorBoolSlice []bool
8 |
9 | //easyjson:json
10 | type ErrorUintSlice []uint
11 |
12 | //easyjson:json
13 | type ErrorStruct struct {
14 | Int int `json:"int"`
15 | String string `json:"string"`
16 | Slice []int `json:"slice"`
17 | IntSlice []int `json:"int_slice"`
18 | }
19 |
20 | type ErrorNestedStruct struct {
21 | ErrorStruct ErrorStruct `json:"error_struct"`
22 | Int int `json:"int"`
23 | }
24 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/context/license_test.go:
--------------------------------------------------------------------------------
1 | package context
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | func TestGetLastVendorRoot(t *testing.T) {
8 | tt := []struct {
9 | From string
10 | To string
11 | }{
12 | {
13 | From: "/foo/bar/bean",
14 | To: "/foo/bar/bean",
15 | },
16 | {
17 | From: "/foo/bar/bean/vendor/fox/vax/bax",
18 | To: "/fox/vax/bax",
19 | },
20 | }
21 | for _, item := range tt {
22 | got := getLastVendorRoot(item.From)
23 | if got != item.To {
24 | t.Errorf("Want: %q, Got: %q", item.To, got)
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/Bowery/prompt/keys.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013-2015 Bowery, Inc.
2 |
3 | package prompt
4 |
5 | // Line ending in raw mode.
6 | var crlf = []byte("\r\n")
7 |
8 | const (
9 | backKey = '\u007f'
10 | escKey = '\u001B'
11 | spaceKey = '\u0020'
12 | )
13 |
14 | const (
15 | ctrlA = iota + 1
16 | ctrlB
17 | ctrlC
18 | ctrlD
19 | ctrlE
20 | ctrlF
21 | ctrlG
22 | ctrlH
23 | tabKey
24 | ctrlJ
25 | ctrlK
26 | ctrlL
27 | returnKey
28 | ctrlN
29 | ctrlO
30 | ctrlP
31 | ctrlQ
32 | ctrlR
33 | ctrlS
34 | ctrlT
35 | ctrlU
36 | ctrlV
37 | ctrlW
38 | ctrlX
39 | ctrlY
40 | ctrlZ
41 | )
42 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: "{build}"
2 |
3 | os: Windows Server 2012 R2
4 |
5 | environment:
6 | GOPATH: c:\gopath
7 | GOVERSION: 1.7
8 |
9 | clone_folder: c:\gopath\src\github.com\kardianos\govendor
10 |
11 | install:
12 | - mkdir c:\tmp
13 | - set TMP=C:\tmp
14 | - go version
15 | - set PATH=%GOPATH%\bin;c:\go\bin;%PATH%
16 | - rmdir c:\go /s /q
17 | - appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-amd64.zip
18 | - 7z x go%GOVERSION%.windows-amd64.zip -y -oC:\ > NUL
19 | - go version
20 | - go env
21 |
22 | build_script:
23 | - go test -i ./...
24 | - go test ./...
25 |
--------------------------------------------------------------------------------
/vendor/github.com/buger/jsonparser/bytes.go:
--------------------------------------------------------------------------------
1 | package jsonparser
2 |
3 | // About 3x faster then strconv.ParseInt because does not check for range error and support only base 10, which is enough for JSON
4 | func parseInt(bytes []byte) (v int64, ok bool) {
5 | if len(bytes) == 0 {
6 | return 0, false
7 | }
8 |
9 | var neg bool = false
10 | if bytes[0] == '-' {
11 | neg = true
12 | bytes = bytes[1:]
13 | }
14 |
15 | for _, c := range bytes {
16 | if c >= '0' && c <= '9' {
17 | v = (10 * v) + int64(c-'0')
18 | } else {
19 | return 0, false
20 | }
21 | }
22 |
23 | if neg {
24 | return -v, true
25 | } else {
26 | return v, true
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/tests/nested_easy.go:
--------------------------------------------------------------------------------
1 | package tests
2 |
3 | import (
4 | "github.com/mailru/easyjson"
5 | "github.com/mailru/easyjson/jwriter"
6 | )
7 |
8 | //easyjson:json
9 | type NestedInterfaces struct {
10 | Value interface{}
11 | Slice []interface{}
12 | Map map[string]interface{}
13 | }
14 |
15 | type NestedEasyMarshaler struct {
16 | EasilyMarshaled bool
17 | }
18 |
19 | var _ easyjson.Marshaler = &NestedEasyMarshaler{}
20 |
21 | func (i *NestedEasyMarshaler) MarshalEasyJSON(w *jwriter.Writer) {
22 | // We use this method only to indicate that easyjson.Marshaler
23 | // interface was really used while encoding.
24 | i.EasilyMarshaled = true
25 | }
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/tests/named_type.go:
--------------------------------------------------------------------------------
1 | package tests
2 |
3 | //easyjson:json
4 | type NamedType struct {
5 | Inner struct {
6 | // easyjson is mistakenly naming the type of this field 'tests.MyString' in the generated output
7 | // something about a named type inside an anonmymous type is triggering this bug
8 | Field MyString `tag:"value"`
9 | Field2 int "tag:\"value with ` in it\""
10 | }
11 | }
12 |
13 | type MyString string
14 |
15 | var namedTypeValue NamedType
16 |
17 | func init() {
18 | namedTypeValue.Inner.Field = "test"
19 | namedTypeValue.Inner.Field2 = 123
20 | }
21 |
22 | var namedTypeValueString = `{"Inner":{"Field":"test","Field2":123}}`
23 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/Bowery/prompt/keys_windows.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013-2015 Bowery, Inc.
2 |
3 | package prompt
4 |
5 | const (
6 | f1Key = 0x70 + iota
7 | f2Key
8 | f3Key
9 | f4Key
10 | f5Key
11 | f6Key
12 | f7Key
13 | f8Key
14 | f9Key
15 | f10Key
16 | f11Key
17 | f12Key
18 |
19 | homeKey = 0x24
20 | endKey = 0x23
21 | upKey = 0x26
22 | downKey = 0x28
23 | rightKey = 0x27
24 | leftKey = 0x25
25 | insertKey = 0x2d
26 | pgupKey = 0x21
27 | pgdownKey = 0x22
28 | deleteKey = 0x2e
29 | leftAltKey = 0x2
30 | rightAltKey = 0x1
31 | leftCtrlKey = 0x8
32 | rightCtrlKey = 0x4
33 | shiftKey = 0x10
34 | )
35 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/parser/parser_unix.go:
--------------------------------------------------------------------------------
1 | // +build !windows
2 |
3 | package parser
4 |
5 | import (
6 | "fmt"
7 | "os"
8 | "path"
9 | "strings"
10 | )
11 |
12 | func getPkgPath(fname string, isDir bool) (string, error) {
13 | if !path.IsAbs(fname) {
14 | pwd, err := os.Getwd()
15 | if err != nil {
16 | return "", err
17 | }
18 | fname = path.Join(pwd, fname)
19 | }
20 |
21 | for _, p := range strings.Split(os.Getenv("GOPATH"), ":") {
22 | prefix := path.Join(p, "src") + "/"
23 | if rel := strings.TrimPrefix(fname, prefix); rel != fname {
24 | if !isDir {
25 | return path.Dir(rel), nil
26 | } else {
27 | return path.Clean(rel), nil
28 | }
29 | }
30 | }
31 |
32 | return "", fmt.Errorf("file '%v' is not in GOPATH", fname)
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go:
--------------------------------------------------------------------------------
1 | // +build !unsafe
2 |
3 | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
4 | // Use of this source code is governed by a MIT license found in the LICENSE file.
5 |
6 | package codec
7 |
8 | // stringView returns a view of the []byte as a string.
9 | // In unsafe mode, it doesn't incur allocation and copying caused by conversion.
10 | // In regular safe mode, it is an allocation and copy.
11 | func stringView(v []byte) string {
12 | return string(v)
13 | }
14 |
15 | // bytesView returns a view of the string as a []byte.
16 | // In unsafe mode, it doesn't incur allocation and copying caused by conversion.
17 | // In regular safe mode, it is an allocation and copy.
18 | func bytesView(v string) []byte {
19 | return []byte(v)
20 | }
21 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/Bowery/prompt/ansi_unix.go:
--------------------------------------------------------------------------------
1 | // +build linux darwin freebsd openbsd netbsd dragonfly
2 |
3 | // Copyright 2013-2015 Bowery, Inc.
4 |
5 | package prompt
6 |
7 | import (
8 | "os"
9 | )
10 |
11 | // AnsiReader is an io.Reader that wraps an *os.File.
12 | type AnsiReader struct {
13 | *os.File
14 | }
15 |
16 | // NewAnsiReader creates a AnsiReader from the given input file.
17 | func NewAnsiReader(in *os.File) *AnsiReader {
18 | return &AnsiReader{File: in}
19 | }
20 |
21 | // AnsiWriter is an io.Writer that wraps an *os.File.
22 | type AnsiWriter struct {
23 | *os.File
24 | }
25 |
26 | // NewAnsiWriter creates a AnsiWriter from the given output file.
27 | func NewAnsiWriter(out *os.File) *AnsiWriter {
28 | return &AnsiWriter{File: out}
29 | }
30 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/context/version_test.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 context
6 |
7 | import (
8 | "testing"
9 | )
10 |
11 | func TestIsVersion(t *testing.T) {
12 | list := []struct {
13 | Text string
14 | IsVersion bool
15 | }{
16 | {"10", true},
17 | {"86811224500e65b549265b273109f2166a35fe63", false},
18 | {"v1", true},
19 | {"v1.2-beta", true},
20 | {"1", true},
21 | {"3242", false},
22 | {"2ea995a", false},
23 | }
24 |
25 | for _, item := range list {
26 | is := isVersion(item.Text)
27 | if is != item.IsVersion {
28 | t.Errorf("For %q, got %v, want %v", item.Text, is, item.IsVersion)
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/migrate/gb.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 migrate
6 |
7 | import (
8 | "errors"
9 | "path/filepath"
10 | )
11 |
12 | func init() {
13 | register("gb", sysGb{})
14 | }
15 |
16 | type sysGb struct{}
17 |
18 | func (sys sysGb) Check(root string) (system, error) {
19 | if hasDirs(root, "src", filepath.Join("vendor", "src")) {
20 | return sys, nil
21 | }
22 | return nil, nil
23 | }
24 | func (sysGb) Migrate(root string) error {
25 | // Move files from "src" to first GOPATH.
26 | // Move vendor files from "vendor/src" to "vendor".
27 | // Translate "vendor/manifest" to vendor.json file.
28 | return errors.New("Migrate gb not implemented")
29 | }
30 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/pkg/errors/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: build-{build}.{branch}
2 |
3 | clone_folder: C:\gopath\src\github.com\pkg\errors
4 | shallow_clone: true # for startup speed
5 |
6 | environment:
7 | GOPATH: C:\gopath
8 |
9 | platform:
10 | - x64
11 |
12 | # http://www.appveyor.com/docs/installed-software
13 | install:
14 | # some helpful output for debugging builds
15 | - go version
16 | - go env
17 | # pre-installed MinGW at C:\MinGW is 32bit only
18 | # but MSYS2 at C:\msys64 has mingw64
19 | - set PATH=C:\msys64\mingw64\bin;%PATH%
20 | - gcc --version
21 | - g++ --version
22 |
23 | build_script:
24 | - go install -v ./...
25 |
26 | test_script:
27 | - set PATH=C:\gopath\bin;%PATH%
28 | - go test -v ./...
29 |
30 | #artifacts:
31 | # - path: '%GOPATH%\bin\*.exe'
32 | deploy: off
33 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go:
--------------------------------------------------------------------------------
1 | // This file will only be included to the build if neither
2 | // easyjson_nounsafe nor appengine build tag is set. See README notes
3 | // for more details.
4 |
5 | //+build !easyjson_nounsafe
6 | //+build !appengine
7 |
8 | package jlexer
9 |
10 | import (
11 | "reflect"
12 | "unsafe"
13 | )
14 |
15 | // bytesToStr creates a string pointing at the slice to avoid copying.
16 | //
17 | // Warning: the string returned by the function should be used with care, as the whole input data
18 | // chunk may be either blocked from being freed by GC because of a single string or the buffer.Data
19 | // may be garbage-collected even when the string exists.
20 | func bytesToStr(data []byte) string {
21 | h := (*reflect.SliceHeader)(unsafe.Pointer(&data))
22 | shdr := reflect.StringHeader{Data: h.Data, Len: h.Len}
23 | return *(*string)(unsafe.Pointer(&shdr))
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/parser/parser_windows.go:
--------------------------------------------------------------------------------
1 | package parser
2 |
3 | import (
4 | "fmt"
5 | "os"
6 | "path"
7 | "strings"
8 | )
9 |
10 | func normalizePath(path string) string {
11 | return strings.Replace(path, "\\", "/", -1)
12 | }
13 |
14 | func getPkgPath(fname string, isDir bool) (string, error) {
15 | if !path.IsAbs(fname) {
16 | pwd, err := os.Getwd()
17 | if err != nil {
18 | return "", err
19 | }
20 | fname = path.Join(pwd, fname)
21 | }
22 |
23 | fname = normalizePath(fname)
24 |
25 | for _, p := range strings.Split(os.Getenv("GOPATH"), ";") {
26 | prefix := path.Join(normalizePath(p), "src") + "/"
27 | if rel := strings.TrimPrefix(fname, prefix); rel != fname {
28 | if !isDir {
29 | return path.Dir(rel), nil
30 | } else {
31 | return path.Clean(rel), nil
32 | }
33 | }
34 | }
35 |
36 | return "", fmt.Errorf("file '%v' is not in GOPATH", fname)
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/github.com/pquerna/ffjson/fflib/v1/reader_scan_generic.go:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Paul Querna
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 |
18 | package v1
19 |
20 | func scanString(s []byte, j int) (int, byte) {
21 | for {
22 | if j >= len(s) {
23 | return j, 0
24 | }
25 |
26 | c := s[j]
27 | j++
28 | if byteLookupTable[c]&sliceStringMask == 0 {
29 | continue
30 | }
31 |
32 | return j, c
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/run/sync.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 run
6 |
7 | import (
8 | "flag"
9 | "io"
10 |
11 | "github.com/kardianos/govendor/context"
12 | "github.com/kardianos/govendor/help"
13 | )
14 |
15 | func (r *runner) Sync(w io.Writer, subCmdArgs []string) (help.HelpMessage, error) {
16 | flags := flag.NewFlagSet("sync", flag.ContinueOnError)
17 | insecure := flags.Bool("insecure", false, "allow insecure network updates")
18 | dryrun := flags.Bool("n", false, "dry run, print what would be done")
19 | flags.SetOutput(nullWriter{})
20 | err := flags.Parse(subCmdArgs)
21 | if err != nil {
22 | return help.MsgSync, err
23 | }
24 | ctx, err := r.NewContextWD(context.RootVendor)
25 | if err != nil {
26 | return help.MsgSync, err
27 | }
28 | ctx.Insecure = *insecure
29 | if *dryrun {
30 | ctx.Logger = w
31 | }
32 | return help.MsgNone, ctx.Sync(*dryrun)
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016 Mail.Ru Group
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol_factory.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | // Factory interface for constructing protocol instances.
23 | type TProtocolFactory interface {
24 | GetProtocol(trans TTransport) TProtocol
25 | }
26 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 json-iterator
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vendor/github.com/buger/jsonparser/bytes_unsafe.go:
--------------------------------------------------------------------------------
1 | // +build !appengine,!appenginevm
2 |
3 | package jsonparser
4 |
5 | import (
6 | "strconv"
7 | "unsafe"
8 | )
9 |
10 | //
11 | // The reason for using *[]byte rather than []byte in parameters is an optimization. As of Go 1.6,
12 | // the compiler cannot perfectly inline the function when using a non-pointer slice. That is,
13 | // the non-pointer []byte parameter version is slower than if its function body is manually
14 | // inlined, whereas the pointer []byte version is equally fast to the manually inlined
15 | // version. Instruction count in assembly taken from "go tool compile" confirms this difference.
16 | //
17 | // TODO: Remove hack after Go 1.7 release
18 | //
19 | func equalStr(b *[]byte, s string) bool {
20 | return *(*string)(unsafe.Pointer(b)) == s
21 | }
22 |
23 | func parseFloat(b *[]byte) (float64, error) {
24 | return strconv.ParseFloat(*(*string)(unsafe.Pointer(b)), 64)
25 | }
26 |
27 | // A hack until issue golang/go#2632 is fixed.
28 | // See: https://github.com/golang/go/issues/2632
29 | func bytesToString(b *[]byte) string {
30 | return *(*string)(unsafe.Pointer(b))
31 | }
32 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/context/version.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 context
6 |
7 | import (
8 | "strconv"
9 | "unicode"
10 | )
11 |
12 | // IsVersion returns true if the string is a version.
13 | func isVersion(s string) bool {
14 | hasPunct := false
15 | onlyNumber := true
16 | onlyHexLetter := true
17 | for _, r := range s {
18 | isNumber := unicode.IsNumber(r)
19 | isLetter := unicode.IsLetter(r)
20 |
21 | hasPunct = hasPunct || unicode.IsPunct(r)
22 | onlyNumber = onlyNumber && isNumber
23 |
24 | if isLetter {
25 | low := unicode.ToLower(r)
26 | onlyHexLetter = onlyHexLetter && low <= 'f'
27 | }
28 | }
29 | if hasPunct {
30 | return true
31 | }
32 | if onlyHexLetter == false {
33 | return true
34 | }
35 |
36 | num, err := strconv.ParseInt(s, 10, 64)
37 | if err == nil {
38 | if num > 100 {
39 | return false // numeric revision.
40 | }
41 | }
42 |
43 | if len(s) > 5 && onlyHexLetter {
44 | return false // hex revision
45 | }
46 | return true
47 | }
48 |
--------------------------------------------------------------------------------
/vendor/github.com/buger/jsonparser/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Leonid Bugaev
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vendor/github.com/buger/jsonparser/Makefile:
--------------------------------------------------------------------------------
1 | SOURCE = parser.go
2 | CONTAINER = jsonparser
3 | SOURCE_PATH = /go/src/github.com/buger/jsonparser
4 | BENCHMARK = JsonParser
5 | BENCHTIME = 5s
6 | TEST = .
7 | DRUN = docker run -v `pwd`:$(SOURCE_PATH) -i -t $(CONTAINER)
8 |
9 | build:
10 | docker build -t $(CONTAINER) .
11 |
12 | race:
13 | $(DRUN) --env GORACE="halt_on_error=1" go test ./. $(ARGS) -v -race -timeout 15s
14 |
15 | bench:
16 | $(DRUN) go test $(LDFLAGS) -test.benchmem -bench $(BENCHMARK) ./benchmark/ $(ARGS) -benchtime $(BENCHTIME) -v
17 |
18 | bench_local:
19 | $(DRUN) go test $(LDFLAGS) -test.benchmem -bench . $(ARGS) -benchtime $(BENCHTIME) -v
20 |
21 | profile:
22 | $(DRUN) go test $(LDFLAGS) -test.benchmem -bench $(BENCHMARK) ./benchmark/ $(ARGS) -memprofile mem.mprof -v
23 | $(DRUN) go test $(LDFLAGS) -test.benchmem -bench $(BENCHMARK) ./benchmark/ $(ARGS) -cpuprofile cpu.out -v
24 | $(DRUN) go test $(LDFLAGS) -test.benchmem -bench $(BENCHMARK) ./benchmark/ $(ARGS) -c
25 |
26 | test:
27 | $(DRUN) go test $(LDFLAGS) ./ -run $(TEST) -timeout 10s $(ARGS) -v
28 |
29 | fmt:
30 | $(DRUN) go fmt ./...
31 |
32 | vet:
33 | $(DRUN) go vet ./.
34 |
35 | bash:
36 | $(DRUN) /bin/bash
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/internal/vfilepath/prefix_test.go:
--------------------------------------------------------------------------------
1 | package vfilepath
2 |
3 | import "testing"
4 |
5 | func TestHasPrefixDirTrue(t *testing.T) {
6 | tests := []struct {
7 | path string
8 | prefix string
9 | }{
10 | {
11 | path: "/",
12 | prefix: "/",
13 | },
14 | {
15 | path: "/foo",
16 | prefix: "/",
17 | },
18 | {
19 | path: "/foo",
20 | prefix: "/foo",
21 | },
22 | {
23 | path: "/foo/bar",
24 | prefix: "/foo",
25 | },
26 | {
27 | path: "foo/bar",
28 | prefix: "foo",
29 | },
30 | }
31 |
32 | for _, test := range tests {
33 | if !HasPrefixDir(test.path, test.prefix) {
34 | t.Errorf("%s should have %s as prefix", test.path, test.prefix)
35 | }
36 | }
37 | }
38 |
39 | func TestHasPrefixDirFalse(t *testing.T) {
40 | tests := []struct {
41 | path string
42 | prefix string
43 | }{
44 | {
45 | path: "/",
46 | prefix: "/foo",
47 | },
48 | {
49 | path: "/foo-bar",
50 | prefix: "/foo",
51 | },
52 | }
53 |
54 | for _, test := range tests {
55 | if HasPrefixDir(test.path, test.prefix) {
56 | t.Errorf("%s should not have %s as prefix", test.path, test.prefix)
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2012-2015 Ugorji Nwoke.
4 | All rights reserved.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | SOFTWARE.
23 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vcs/svn_test.go:
--------------------------------------------------------------------------------
1 | package vcs
2 |
3 | import "testing"
4 |
5 | func TestSVNInfo(t *testing.T) {
6 | var err error
7 | var info = &VcsInfo{}
8 | var output = []byte(`
9 |
10 |
14 | http://svn.apache.org/repos/asf/lenya/trunk
15 | ^/lenya/trunk
16 |
17 | http://svn.apache.org/repos/asf
18 | 13f79535-47bb-0310-9956-ffa450edef68
19 |
20 |
21 | /home/daniel/src/test/test-svn/trunk
22 | normal
23 | infinity
24 |
25 |
27 | florent
28 | 2011-09-26T09:07:59.663459Z
29 |
30 |
31 |
32 | `)
33 |
34 | svn := VcsSvn{}
35 | err = svn.parseInfo(output, info)
36 | if err != nil {
37 | t.Fatal(err)
38 | }
39 | if info.Revision != "1175731" {
40 | t.Error("revision inforrect")
41 | }
42 | if info.RevisionTime.Year() != 2011 {
43 | t.Error("time incorrect")
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/Bowery/prompt/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013-2015 Bowery, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/fast-path.not.go:
--------------------------------------------------------------------------------
1 | // +build notfastpath
2 |
3 | package codec
4 |
5 | import "reflect"
6 |
7 | const fastpathEnabled = false
8 |
9 | // The generated fast-path code is very large, and adds a few seconds to the build time.
10 | // This causes test execution, execution of small tools which use codec, etc
11 | // to take a long time.
12 | //
13 | // To mitigate, we now support the notfastpath tag.
14 | // This tag disables fastpath during build, allowing for faster build, test execution,
15 | // short-program runs, etc.
16 |
17 | func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return false }
18 | func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false }
19 | func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false }
20 | func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false }
21 |
22 | type fastpathT struct{}
23 | type fastpathE struct {
24 | rtid uintptr
25 | rt reflect.Type
26 | encfn func(*encFnInfo, reflect.Value)
27 | decfn func(*decFnInfo, reflect.Value)
28 | }
29 | type fastpathA [0]fastpathE
30 |
31 | func (x fastpathA) index(rtid uintptr) int { return -1 }
32 |
33 | var fastpathAV fastpathA
34 | var fastpathTV fastpathT
35 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/processor.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | // A processor is a generic object which operates upon an input stream and
23 | // writes to some output stream.
24 | type TProcessor interface {
25 | Process(in, out TProtocol) (bool, TException)
26 | }
27 |
28 | type TProcessorFunction interface {
29 | Process(seqId int32, in, out TProtocol) (bool, TException)
30 | }
31 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/messagetype.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | // Message type constants in the Thrift protocol.
23 | type TMessageType int32
24 |
25 | const (
26 | INVALID_TMESSAGE_TYPE TMessageType = 0
27 | CALL TMessageType = 1
28 | REPLY TMessageType = 2
29 | EXCEPTION TMessageType = 3
30 | ONEWAY TMessageType = 4
31 | )
32 |
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/with_10_string_fields/benchmark_test.go:
--------------------------------------------------------------------------------
1 | package with_10_string_fields
2 |
3 | import (
4 | "testing"
5 | "github.com/mailru/easyjson/jwriter"
6 | "bytes"
7 | "github.com/json-iterator/go"
8 | )
9 |
10 | func Benchmark_easyjson(b *testing.B) {
11 | str := "Twitter for Mac"
12 | obj := PbTestObject{str, str, str, str, str, str, str, str, str, str}
13 | //obj := PbTestObject{112, 1, 1, 1, 1, 1, 1, 1, 1, 1}
14 | b.ReportAllocs()
15 | buf := &bytes.Buffer{}
16 | for i := 0; i < b.N; i++ {
17 | writer := &jwriter.Writer{}
18 | obj.MarshalEasyJSON(writer)
19 | buf.Reset()
20 | writer.DumpTo(buf)
21 | }
22 | }
23 |
24 | func Benchmark_jsoniter(b *testing.B) {
25 | str := "Twitter for Mac"
26 | obj := PbTestObject{str, str, str, str, str, str, str, str, str, str}
27 | //obj := PbTestObject{112, 1, 1, 1, 1, 1, 1, 1, 1, 1}
28 | b.ReportAllocs()
29 | stream := jsoniter.NewStream(nil, 512)
30 | for i := 0; i < b.N; i++ {
31 | stream.Reset(nil)
32 | stream.WriteVal(obj)
33 | if stream.Error != nil {
34 | b.Error(stream.Error)
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/pkgspec/pkg.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 pkgspec defines a schema that contains the path, origin, version
6 | // and other properties.
7 | package pkgspec
8 |
9 | import "bytes"
10 |
11 | type Pkg struct {
12 | Path string
13 | FilePath string
14 | Origin string
15 | IncludeTree bool
16 | MatchTree bool
17 | HasVersion bool
18 | HasOrigin bool
19 | Version string
20 |
21 | Uncommitted bool
22 | }
23 |
24 | func (pkg *Pkg) String() string {
25 | buf := &bytes.Buffer{}
26 | buf.WriteString(pkg.Path)
27 | if pkg.IncludeTree {
28 | buf.WriteString(TreeIncludeSuffix)
29 | } else if pkg.MatchTree {
30 | buf.WriteString(TreeMatchSuffix)
31 | }
32 | if len(pkg.Origin) > 0 {
33 | buf.WriteString(originMatch)
34 | buf.WriteString(pkg.Origin)
35 | }
36 | if pkg.HasVersion {
37 | buf.WriteString(versionMatch)
38 | if len(pkg.Version) > 0 {
39 | buf.WriteString(pkg.Version)
40 | }
41 | }
42 | return buf.String()
43 | }
44 |
45 | func (pkg *Pkg) PathOrigin() string {
46 | if len(pkg.Origin) > 0 {
47 | return pkg.Origin
48 | }
49 | return pkg.Path
50 | }
51 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/golang.org/x/tools/go/vcs/env.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package vcs
6 |
7 | import (
8 | "os"
9 | "strings"
10 | )
11 |
12 | // envForDir returns a copy of the environment
13 | // suitable for running in the given directory.
14 | // The environment is the current process's environment
15 | // but with an updated $PWD, so that an os.Getwd in the
16 | // child will be faster.
17 | func envForDir(dir string) []string {
18 | env := os.Environ()
19 | // Internally we only use rooted paths, so dir is rooted.
20 | // Even if dir is not rooted, no harm done.
21 | return mergeEnvLists([]string{"PWD=" + dir}, env)
22 | }
23 |
24 | // mergeEnvLists merges the two environment lists such that
25 | // variables with the same name in "in" replace those in "out".
26 | func mergeEnvLists(in, out []string) []string {
27 | NextVar:
28 | for _, inkv := range in {
29 | k := strings.SplitAfterN(inkv, "=", 2)[0]
30 | for i, outkv := range out {
31 | if strings.HasPrefix(outkv, k) {
32 | out[i] = inkv
33 | continue NextVar
34 | }
35 | }
36 | out = append(out, inkv)
37 | }
38 | return out
39 | }
40 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/vendor.json:
--------------------------------------------------------------------------------
1 | {
2 | "comment": "",
3 | "ignore": "test",
4 | "package": [
5 | {
6 | "checksumSHA1": "rcwA7Jmo3eZ4bEQb8mTI78haZfc=",
7 | "path": "github.com/Bowery/prompt",
8 | "revision": "d43c2707a6c5a152a344c64bb4fed657e2908a81",
9 | "revisionTime": "2016-08-08T16:52:56Z"
10 | },
11 | {
12 | "checksumSHA1": "6VGFARaK8zd23IAiDf7a+gglC8k=",
13 | "path": "github.com/dchest/safefile",
14 | "revision": "855e8d98f1852d48dde521e0522408d1fe7e836a",
15 | "revisionTime": "2015-10-22T12:31:44+02:00"
16 | },
17 | {
18 | "checksumSHA1": "3VJcSYFds0zeIO5opOs0AoKm3Mw=",
19 | "path": "github.com/google/shlex",
20 | "revision": "6f45313302b9c56850fc17f99e40caebce98c716",
21 | "revisionTime": "2015-01-27T13:39:51Z"
22 | },
23 | {
24 | "checksumSHA1": "GcaTbmmzSGqTb2X6qnNtmDyew1Q=",
25 | "path": "github.com/pkg/errors",
26 | "revision": "a2d6902c6d2a2f194eb3fb474981ab7867c81505",
27 | "revisionTime": "2016-06-27T22:23:52Z"
28 | },
29 | {
30 | "checksumSHA1": "uwKP1AVzd+lrTMlXVFjZXXHzB7U=",
31 | "path": "golang.org/x/tools/go/vcs",
32 | "revision": "1727758746e7a08feaaceb9366d1468498ac2ac2",
33 | "revisionTime": "2016-06-24T22:27:06Z"
34 | }
35 | ],
36 | "rootPath": "github.com/kardianos/govendor"
37 | }
38 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/help/msg.go:
--------------------------------------------------------------------------------
1 | package help
2 |
3 | type HelpMessage byte
4 |
5 | const (
6 | MsgNone HelpMessage = iota
7 | MsgFull
8 | MsgInit
9 | MsgList
10 | MsgAdd
11 | MsgUpdate
12 | MsgRemove
13 | MsgFetch
14 | MsgStatus
15 | MsgSync
16 | MsgMigrate
17 | MsgGet
18 | MsgLicense
19 | MsgShell
20 | MsgGovendorLicense
21 | MsgGovendorVersion
22 | )
23 |
24 | func (msg HelpMessage) String() string {
25 | msgText := ""
26 | switch msg {
27 | default:
28 | panic("Unknown message type")
29 | case MsgNone:
30 | case MsgFull:
31 | msgText = helpFull
32 | case MsgInit:
33 | msgText = helpInit
34 | case MsgList:
35 | msgText = helpList
36 | case MsgAdd:
37 | msgText = helpAdd
38 | case MsgUpdate:
39 | msgText = helpUpdate
40 | case MsgRemove:
41 | msgText = helpRemove
42 | case MsgFetch:
43 | msgText = helpFetch
44 | case MsgStatus:
45 | msgText = helpStatus
46 | case MsgSync:
47 | msgText = helpSync
48 | case MsgMigrate:
49 | msgText = helpMigrate
50 | case MsgGet:
51 | msgText = helpGet
52 | case MsgLicense:
53 | msgText = helpLicense
54 | case MsgShell:
55 | msgText = helpShell
56 | case MsgGovendorLicense:
57 | msgText = msgGovendorLicenses
58 | case MsgGovendorVersion:
59 | msgText = msgGovendorVersion
60 | }
61 | return msgText
62 | }
63 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/dchest/safefile/README.md:
--------------------------------------------------------------------------------
1 | # safefile
2 |
3 | [](https://travis-ci.org/dchest/safefile) [](https://ci.appveyor.com/project/dchest/safefile)
4 |
5 | Go package safefile implements safe "atomic" saving of files.
6 |
7 | Instead of truncating and overwriting the destination file, it creates a
8 | temporary file in the same directory, writes to it, and then renames the
9 | temporary file to the original name when calling Commit.
10 |
11 |
12 | ### Installation
13 |
14 | ```
15 | $ go get github.com/dchest/safefile
16 | ```
17 |
18 | ### Documentation
19 |
20 |
21 |
22 | ### Example
23 |
24 | ```go
25 | f, err := safefile.Create("/home/ken/report.txt", 0644)
26 | if err != nil {
27 | // ...
28 | }
29 | // Created temporary file /home/ken/sf-ppcyksu5hyw2mfec.tmp
30 |
31 | defer f.Close()
32 |
33 | _, err = io.WriteString(f, "Hello world")
34 | if err != nil {
35 | // ...
36 | }
37 | // Wrote "Hello world" to /home/ken/sf-ppcyksu5hyw2mfec.tmp
38 |
39 | err = f.Commit()
40 | if err != nil {
41 | // ...
42 | }
43 | // Renamed /home/ken/sf-ppcyksu5hyw2mfec.tmp to /home/ken/report.txt
44 | ```
45 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/raw.go:
--------------------------------------------------------------------------------
1 | package easyjson
2 |
3 | import (
4 | "github.com/mailru/easyjson/jlexer"
5 | "github.com/mailru/easyjson/jwriter"
6 | )
7 |
8 | // RawMessage is a raw piece of JSON (number, string, bool, object, array or
9 | // null) that is extracted without parsing and output as is during marshaling.
10 | type RawMessage []byte
11 |
12 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
13 | func (v *RawMessage) MarshalEasyJSON(w *jwriter.Writer) {
14 | if len(*v) == 0 {
15 | w.RawString("null")
16 | } else {
17 | w.Raw(*v, nil)
18 | }
19 | }
20 |
21 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
22 | func (v *RawMessage) UnmarshalEasyJSON(l *jlexer.Lexer) {
23 | *v = RawMessage(l.Raw())
24 | }
25 |
26 | // UnmarshalJSON implements encoding/json.Unmarshaler interface.
27 | func (v *RawMessage) UnmarshalJSON(data []byte) error {
28 | *v = data
29 | return nil
30 | }
31 |
32 | var nullBytes = []byte("null")
33 |
34 | // MarshalJSON implements encoding/json.Marshaler interface.
35 | func (v RawMessage) MarshalJSON() ([]byte, error) {
36 | if len(v) == 0 {
37 | return nullBytes, nil
38 | }
39 | return v, nil
40 | }
41 |
42 | // IsDefined is required for integration with omitempty easyjson logic.
43 | func (v *RawMessage) IsDefined() bool {
44 | return len(*v) > 0
45 | }
46 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/main.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 | // vendor tool to copy external source code from GOPATH or remote location to the
6 | // local vendor folder. See README.md for usage.
7 | package main
8 |
9 | import (
10 | "bytes"
11 | "flag"
12 | "fmt"
13 | "io"
14 | "os"
15 | "strings"
16 |
17 | "github.com/kardianos/govendor/cliprompt"
18 | "github.com/kardianos/govendor/help"
19 | "github.com/kardianos/govendor/run"
20 | )
21 |
22 | func main() {
23 | prompt := &cliprompt.Prompt{}
24 |
25 | allArgs := os.Args
26 |
27 | if allArgs[len(allArgs)-1] == "-" {
28 | stdin := &bytes.Buffer{}
29 | if _, err := io.Copy(stdin, os.Stdin); err == nil {
30 | stdinArgs := strings.Fields(stdin.String())
31 | allArgs = append(allArgs[:len(allArgs)-1], stdinArgs...)
32 | }
33 | }
34 |
35 | msg, err := run.Run(os.Stdout, allArgs, prompt)
36 | if err == flag.ErrHelp {
37 | err = nil
38 | }
39 | if err != nil {
40 | fmt.Fprintf(os.Stderr, "Error: %+v\n", err)
41 | }
42 | msgText := msg.String()
43 | if len(msgText) > 0 {
44 | fmt.Fprint(os.Stderr, msgText)
45 | }
46 | if err != nil {
47 | os.Exit(2)
48 | }
49 | if msg != help.MsgNone {
50 | os.Exit(1)
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vcs/git.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 vcs
6 |
7 | import (
8 | "os/exec"
9 | "path/filepath"
10 | "strings"
11 | "time"
12 |
13 | os "github.com/kardianos/govendor/internal/vos"
14 | )
15 |
16 | type VcsGit struct{}
17 |
18 | func (VcsGit) Find(dir string) (*VcsInfo, error) {
19 | fi, err := os.Stat(filepath.Join(dir, ".git"))
20 | if err != nil {
21 | if os.IsNotExist(err) {
22 | return nil, nil
23 | }
24 | return nil, err
25 | }
26 | if fi.IsDir() == false {
27 | return nil, nil
28 | }
29 |
30 | // Get info.
31 | info := &VcsInfo{}
32 |
33 | cmd := exec.Command("git", "status", "--short")
34 | cmd.Dir = dir
35 | err = cmd.Run()
36 | if err != nil {
37 | info.Dirty = true
38 | }
39 |
40 | cmd = exec.Command("git", "show", "--pretty=format:%H@%ai", "-s")
41 | cmd.Dir = dir
42 | output, err := cmd.CombinedOutput()
43 | if err != nil {
44 | return nil, err
45 | }
46 | line := strings.TrimSpace(string(output))
47 | ss := strings.Split(line, "@")
48 | info.Revision = ss[0]
49 | tm, err := time.Parse("2006-01-02 15:04:05 -0700", ss[1])
50 | if err != nil {
51 | return nil, err
52 | }
53 | info.RevisionTime = &tm
54 | return info, nil
55 | }
56 |
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/benchmark_large_payload_test.go:
--------------------------------------------------------------------------------
1 | package go_benchmark
2 |
3 | import (
4 | "testing"
5 | "github.com/buger/jsonparser"
6 | "github.com/json-iterator/go"
7 | "encoding/json"
8 | )
9 |
10 | func BenchmarkJsonParserLarge(b *testing.B) {
11 | b.ReportAllocs()
12 | for i := 0; i < b.N; i++ {
13 | count := 0
14 | jsonparser.ArrayEach(largeFixture, func(value []byte, dataType jsonparser.ValueType, offset int, err error) {
15 | count++
16 | }, "topics", "topics")
17 | }
18 | }
19 |
20 | func BenchmarkJsoniterLarge(b *testing.B) {
21 | iter := jsoniter.ParseBytes(largeFixture)
22 | b.ReportAllocs()
23 | b.ResetTimer()
24 | for i := 0; i < b.N; i++ {
25 | iter.ResetBytes(largeFixture)
26 | count := 0
27 | for field := iter.ReadObject(); field != ""; field = iter.ReadObject() {
28 | if "topics" != field {
29 | iter.Skip()
30 | continue
31 | }
32 | for field := iter.ReadObject(); field != ""; field = iter.ReadObject() {
33 | if "topics" != field {
34 | iter.Skip()
35 | continue
36 | }
37 | for iter.ReadArray() {
38 | iter.Skip()
39 | count++
40 | }
41 | break
42 | }
43 | break
44 | }
45 | }
46 | }
47 |
48 | func BenchmarkEncodingJsonLarge(b *testing.B) {
49 | b.ReportAllocs()
50 | for i := 0; i < b.N; i++ {
51 | payload := &LargePayload{}
52 | json.Unmarshal(largeFixture, payload)
53 | }
54 | }
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/opts.go:
--------------------------------------------------------------------------------
1 | package opt
2 |
3 | //go:generate sed -i "s/\\+build none/generated by gotemplate/" optional/opt.go
4 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Int(int)
5 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Uint(uint)
6 |
7 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Int8(int8)
8 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Int16(int16)
9 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Int32(int32)
10 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Int64(int64)
11 |
12 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Uint8(uint8)
13 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Uint16(uint16)
14 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Uint32(uint32)
15 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Uint64(uint64)
16 |
17 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Float32(float32)
18 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Float64(float64)
19 |
20 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Bool(bool)
21 | //go:generate gotemplate "github.com/mailru/easyjson/opt/optional" String(string)
22 | //go:generate sed -i "s/generated by gotemplate/+build none/" optional/opt.go
23 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/helper_unsafe.go:
--------------------------------------------------------------------------------
1 | // +build unsafe
2 |
3 | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
4 | // Use of this source code is governed by a MIT license found in the LICENSE file.
5 |
6 | package codec
7 |
8 | import (
9 | "unsafe"
10 | )
11 |
12 | // This file has unsafe variants of some helper methods.
13 |
14 | type unsafeString struct {
15 | Data uintptr
16 | Len int
17 | }
18 |
19 | type unsafeSlice struct {
20 | Data uintptr
21 | Len int
22 | Cap int
23 | }
24 |
25 | // stringView returns a view of the []byte as a string.
26 | // In unsafe mode, it doesn't incur allocation and copying caused by conversion.
27 | // In regular safe mode, it is an allocation and copy.
28 | func stringView(v []byte) string {
29 | if len(v) == 0 {
30 | return ""
31 | }
32 |
33 | bx := (*unsafeSlice)(unsafe.Pointer(&v))
34 | sx := unsafeString{bx.Data, bx.Len}
35 | return *(*string)(unsafe.Pointer(&sx))
36 | }
37 |
38 | // bytesView returns a view of the string as a []byte.
39 | // In unsafe mode, it doesn't incur allocation and copying caused by conversion.
40 | // In regular safe mode, it is an allocation and copy.
41 | func bytesView(v string) []byte {
42 | if len(v) == 0 {
43 | return zeroByteSlice
44 | }
45 |
46 | sx := (*unsafeString)(unsafe.Pointer(&v))
47 | bx := unsafeSlice{sx.Data, sx.Len, sx.Len}
48 | return *(*[]byte)(unsafe.Pointer(&bx))
49 | }
50 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/migrate/gdm_test.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 migrate
6 |
7 | import (
8 | "reflect"
9 | "strings"
10 | "testing"
11 |
12 | "github.com/kardianos/govendor/vendorfile"
13 | )
14 |
15 | var gdmFile = `co1/pk1 9fc824c70f713ea0f058a07b49a4c563ef2a3b98
16 | co1/pk2 a4eecd407cf4129fc902ece859a0114e4cf1a7f4
17 | co1/pk3 345426c77237ece5dab0e1605c3e4b35c3f54757`
18 |
19 | var gdmPackages = []*vendorfile.Package{
20 | &vendorfile.Package{
21 | Add: true,
22 | Path: "co1/pk1",
23 | Revision: "9fc824c70f713ea0f058a07b49a4c563ef2a3b98",
24 | Tree: true,
25 | },
26 | &vendorfile.Package{
27 | Add: true,
28 | Path: "co1/pk2",
29 | Revision: "a4eecd407cf4129fc902ece859a0114e4cf1a7f4",
30 | Tree: true,
31 | },
32 | &vendorfile.Package{
33 | Add: true,
34 | Path: "co1/pk3",
35 | Revision: "345426c77237ece5dab0e1605c3e4b35c3f54757",
36 | Tree: true,
37 | },
38 | }
39 |
40 | func TestParseGDM(t *testing.T) {
41 | gdm := sysGdm{}
42 | pkgs, err := gdm.parseGdmFile(strings.NewReader(gdmFile))
43 | if err != nil {
44 | t.Fatal(err)
45 | }
46 |
47 | if !reflect.DeepEqual(gdmPackages, pkgs) {
48 | t.Fatalf("expected parsed gdmFile to match gdmPackages")
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/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 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/pkg/errors/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015, Dave Cheney
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/server.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | type TServer interface {
23 | ProcessorFactory() TProcessorFactory
24 | ServerTransport() TServerTransport
25 | InputTransportFactory() TTransportFactory
26 | OutputTransportFactory() TTransportFactory
27 | InputProtocolFactory() TProtocolFactory
28 | OutputProtocolFactory() TProtocolFactory
29 |
30 | // Starts the server
31 | Serve() error
32 | // Stops the server. This is optional on a per-implementation basis. Not
33 | // all servers are required to be cleanly stoppable.
34 | Stop() error
35 | }
36 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/internal/vos/stub.go:
--------------------------------------------------------------------------------
1 | package vos
2 |
3 | import (
4 | "os"
5 | "time"
6 | )
7 |
8 | type FileInfo os.FileInfo
9 |
10 | func Stat(name string) (FileInfo, error) {
11 | l("stat", name)
12 | fi, err := os.Stat(name)
13 | return FileInfo(fi), err
14 | }
15 | func Lstat(name string) (FileInfo, error) {
16 | l("lstat", name)
17 | fi, err := os.Lstat(name)
18 | return FileInfo(fi), err
19 | }
20 | func IsNotExist(err error) bool {
21 | return os.IsNotExist(err)
22 | }
23 |
24 | func Getwd() (string, error) {
25 | return os.Getwd()
26 | }
27 |
28 | func Getenv(key string) string {
29 | return os.Getenv(key)
30 | }
31 |
32 | func Open(name string) (*os.File, error) {
33 | l("open", name)
34 | return os.Open(name)
35 | }
36 |
37 | func MkdirAll(path string, perm os.FileMode) error {
38 | l("mkdirall", path)
39 | return os.MkdirAll(path, perm)
40 | }
41 |
42 | func Remove(name string) error {
43 | l("remove", name)
44 | return os.Remove(name)
45 | }
46 | func RemoveAll(name string) error {
47 | l("removeall", name)
48 | return os.RemoveAll(name)
49 | }
50 | func Create(name string) (*os.File, error) {
51 | l("create", name)
52 | return os.Create(name)
53 | }
54 | func Chmod(name string, mode os.FileMode) error {
55 | l("chmod", name)
56 | return os.Chmod(name, mode)
57 | }
58 | func Chtimes(name string, atime, mtime time.Time) error {
59 | l("chtimes", name)
60 | return os.Chtimes(name, atime, mtime)
61 | }
62 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/dchest/safefile/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013 Dmitry Chestnykh
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions
6 | are met:
7 |
8 | * Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above
12 | copyright notice, this list of conditions and the following
13 | disclaimer in the documentation and/or other materials
14 | provided with the distribution.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/server_transport.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | // Server transport. Object which provides client transports.
23 | type TServerTransport interface {
24 | Listen() error
25 | Accept() (TTransport, error)
26 | Close() error
27 |
28 | // Optional method implementation. This signals to the server transport
29 | // that it should break out of any accept() or listen() that it is currently
30 | // blocked on. This method, if implemented, MUST be thread safe, as it may
31 | // be called from a different thread context than the other TServerTransport
32 | // methods.
33 | Interrupt() error
34 | }
35 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | go: 1.7
3 | install:
4 | before_deploy:
5 | - GOOS=linux GOARCH=amd64 go build -o govendor_linux_amd64
6 | - GOOS=linux GOARCH=386 go build -o govendor_linux_386
7 | - GOOS=linux GOARCH=arm go build -o govendor_linux_arm
8 | - GOOS=darwin GOARCH=amd64 go build -o govendor_darwin_amd64
9 | - GOOS=windows GOARCH=amd64 go build -o govendor_windows_amd64.exe
10 | - GOOS=windows GOARCH=386 go build -o govendor_windows_386.exe
11 | deploy:
12 | skip_cleanup: true
13 | provider: releases
14 | api_key:
15 | secure: pRyZ9BkbDmgJUAd+pxPcuhels+3wuYgPCwKrH0C5Urrn8goO2ABaVDD4dbz96I0ecLcE2qDmFl/GpPtlhhLwngWBnpUdWS/M6imoubneZ+NneRVfnGSNUeDrZf8vVcGV9N6lpfDktIRb51XBCYaLcKvpHtpYjZtSbm+ENWddBz2wX2OUPHnO1lxdrDj4bpLBnzoNDucLO+zF+s6yjyHgC7eTkocfC+ywLm+zyE1zjKFJeAecWZgPACdOTKD/Nh4hY2vAo8Il37Ju4sCVWYrJYerrMzCJJsxGUGu5+jJBlIKLluTePbrvjAvTBa+HXcxHu2vpZlezPShczaiQYe0yMkkl4c90pzllWuWCpNRLFJvHsdvi7OxRMyfdccg9cppxvtqVLZsaIFmhI7VOm49Yd9LyHnbt/hfBchxQSaUEoVNx9AS8exZx/uH2oyhmFom1K+tQBhaMBUnP9kesiJ9YeUwS9YK+ubE/MU8e4X7IorxyekaiuqtYVisLhkoaUlJYcYcmdu41mLeqbZ8sqxFCbXWbOblKirsWi8BR+lh84qgyRjXSwmiyO7e/TyvfeEVXfOQPlq7YqfJpHg2Bfwza4H4p9YsFsjO6cWAPsvHJWy8HcB6/hmfLEWktHU01MM4TE/Ajanzt/LjR8SMm9lMyC4fSY8D1gVPWpr2gM2GA8gY=
16 | file:
17 | - govendor_linux_amd64
18 | - govendor_linux_386
19 | - govendor_linux_arm
20 | - govendor_darwin_amd64
21 | - govendor_windows_amd64.exe
22 | - govendor_windows_386.exe
23 | on:
24 | tags: true
25 | repo: kardianos/govendor
26 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vcs/svn.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 vcs
6 |
7 | import (
8 | "encoding/xml"
9 | "os/exec"
10 | "path/filepath"
11 | "time"
12 |
13 | os "github.com/kardianos/govendor/internal/vos"
14 | )
15 |
16 | type VcsSvn struct{}
17 |
18 | func (svn VcsSvn) Find(dir string) (*VcsInfo, error) {
19 | fi, err := os.Stat(filepath.Join(dir, ".svn"))
20 | if err != nil {
21 | if os.IsNotExist(err) {
22 | return nil, nil
23 | }
24 | return nil, err
25 | }
26 | if fi.IsDir() == false {
27 | return nil, nil
28 | }
29 |
30 | // Get info.
31 | info := &VcsInfo{}
32 |
33 | cmd := exec.Command("svn", "info", "--xml")
34 | cmd.Dir = dir
35 | output, err := cmd.CombinedOutput()
36 | if err != nil {
37 | return nil, err
38 | }
39 |
40 | return info, svn.parseInfo(output, info)
41 | }
42 | func (svn VcsSvn) parseInfo(output []byte, info *VcsInfo) error {
43 | var err error
44 | XX := struct {
45 | Commit struct {
46 | Revision string `xml:"revision,attr"`
47 | RevisionTime string `xml:"date"`
48 | } `xml:"entry>commit"`
49 | }{}
50 | err = xml.Unmarshal(output, &XX)
51 | if err != nil {
52 | return err
53 | }
54 | info.Revision = XX.Commit.Revision
55 | tm, err := time.Parse(time.RFC3339, XX.Commit.RevisionTime)
56 | if err == nil {
57 | info.RevisionTime = &tm
58 | }
59 | return nil
60 | }
61 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/http_transport.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | import "net/http"
23 |
24 | // NewThriftHandlerFunc is a function that create a ready to use Apache Thrift Handler function
25 | func NewThriftHandlerFunc(processor TProcessor,
26 | inPfactory, outPfactory TProtocolFactory) func(w http.ResponseWriter, r *http.Request) {
27 |
28 | return func(w http.ResponseWriter, r *http.Request) {
29 | w.Header().Add("Content-Type", "application/x-thrift")
30 |
31 | transport := NewStreamTransport(r.Body, w)
32 | processor.Process(inPfactory.GetProtocol(transport), outPfactory.GetProtocol(transport))
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/run/shell.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 run
6 |
7 | import (
8 | "flag"
9 | "fmt"
10 | "io"
11 | "os"
12 |
13 | "github.com/kardianos/govendor/help"
14 |
15 | "github.com/Bowery/prompt"
16 | "github.com/google/shlex"
17 | )
18 |
19 | func (r *runner) Shell(w io.Writer, subCmdArgs []string) (help.HelpMessage, error) {
20 | flags := flag.NewFlagSet("shell", flag.ContinueOnError)
21 | flags.SetOutput(nullWriter{})
22 | err := flags.Parse(subCmdArgs)
23 | if err != nil {
24 | return help.MsgShell, err
25 | }
26 |
27 | out := os.Stdout
28 |
29 | for {
30 | line, err := prompt.Basic("> ", false)
31 | if err != nil {
32 | break
33 | }
34 | args, err := shlex.Split(line)
35 | if err != nil {
36 | fmt.Fprintf(out, "%v", err.Error())
37 | }
38 | if len(args) == 0 {
39 | continue
40 | }
41 | cmd := args[0]
42 | next := make([]string, 0, len(args)+1)
43 | next = append(next, "govendor")
44 | args = append(next, args...)
45 | switch cmd {
46 | case "exit", "q", "quit", "/q":
47 | return help.MsgNone, nil
48 | case "shell":
49 | continue
50 | }
51 | msg, err := r.run(out, args, nil)
52 | if err != nil {
53 | fmt.Fprintf(out, "%v", err.Error())
54 | }
55 | msgText := msg.String()
56 | if len(msgText) > 0 {
57 | fmt.Fprintf(out, "%s\tType \"exit\" to exit.\n", msgText)
58 | }
59 | }
60 |
61 | return help.MsgNone, nil
62 | }
63 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015 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/git.apache.org/thrift.git/lib/go/thrift/transport_factory.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | // Factory class used to create wrapped instance of Transports.
23 | // This is used primarily in servers, which get Transports from
24 | // a ServerTransport and then may want to mutate them (i.e. create
25 | // a BufferedTransport from the underlying base transport)
26 | type TTransportFactory interface {
27 | GetTransport(trans TTransport) TTransport
28 | }
29 |
30 | type tTransportFactory struct{}
31 |
32 | // Return a wrapped instance of the base Transport.
33 | func (p *tTransportFactory) GetTransport(trans TTransport) TTransport {
34 | return trans
35 | }
36 |
37 | func NewTTransportFactory() TTransportFactory {
38 | return &tTransportFactory{}
39 | }
40 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/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 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vcs/bzr.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 vcs
6 |
7 | import (
8 | "os/exec"
9 | "path/filepath"
10 | "strings"
11 | "time"
12 |
13 | os "github.com/kardianos/govendor/internal/vos"
14 | )
15 |
16 | type VcsBzr struct{}
17 |
18 | func (VcsBzr) Find(dir string) (*VcsInfo, error) {
19 | fi, err := os.Stat(filepath.Join(dir, ".bzr"))
20 | if err != nil {
21 | if os.IsNotExist(err) {
22 | return nil, nil
23 | }
24 | return nil, err
25 | }
26 | if fi.IsDir() == false {
27 | return nil, nil
28 | }
29 |
30 | // Get info.
31 | info := &VcsInfo{}
32 |
33 | cmd := exec.Command("bzr", "status")
34 | cmd.Dir = dir
35 | output, err := cmd.CombinedOutput()
36 | if err != nil {
37 | return nil, err
38 | }
39 | if string(output) != "" {
40 | info.Dirty = true
41 | }
42 |
43 | cmd = exec.Command("bzr", "log", "-r-1")
44 | cmd.Dir = dir
45 | output, err = cmd.CombinedOutput()
46 | if err != nil {
47 | return nil, err
48 | }
49 | for _, line := range strings.Split(string(output), "\n") {
50 | if strings.HasPrefix(line, "revno:") {
51 | info.Revision = strings.Split(strings.TrimSpace(strings.TrimPrefix(line, "revno:")), " ")[0]
52 | } else if strings.HasPrefix(line, "timestamp:") {
53 | tm, err := time.Parse("Mon 2006-01-02 15:04:05 -0700", strings.TrimSpace(strings.TrimPrefix(line, "timestamp:")))
54 | if err != nil {
55 | return nil, err
56 | }
57 | info.RevisionTime = &tm
58 | }
59 | }
60 | return info, nil
61 | }
62 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/exception.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | import (
23 | "errors"
24 | )
25 |
26 | // Generic Thrift exception
27 | type TException interface {
28 | error
29 | }
30 |
31 | // Prepends additional information to an error without losing the Thrift exception interface
32 | func PrependError(prepend string, err error) error {
33 | if t, ok := err.(TTransportException); ok {
34 | return NewTTransportException(t.TypeId(), prepend+t.Error())
35 | }
36 | if t, ok := err.(TProtocolException); ok {
37 | return NewTProtocolExceptionWithType(t.TypeId(), errors.New(prepend+err.Error()))
38 | }
39 | if t, ok := err.(TApplicationException); ok {
40 | return NewTApplicationException(t.TypeId(), prepend+t.Error())
41 | }
42 |
43 | return errors.New(prepend + err.Error())
44 | }
45 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/Bowery/prompt/buffer_unix.go:
--------------------------------------------------------------------------------
1 | // +build linux darwin freebsd openbsd netbsd dragonfly
2 |
3 | // Copyright 2013-2015 Bowery, Inc.
4 |
5 | package prompt
6 |
7 | import (
8 | "fmt"
9 | )
10 |
11 | // Refresh rewrites the prompt and buffer.
12 | func (buf *Buffer) Refresh() error {
13 | // If we're not echoing just write prompt.
14 | if !buf.Echo {
15 | _, err := buf.Out.Write(mvLeftEdge)
16 | if err != nil {
17 | return err
18 | }
19 |
20 | _, err = buf.Out.Write([]byte(buf.Prompt))
21 | if err != nil {
22 | return err
23 | }
24 |
25 | _, err = buf.Out.Write(delRight)
26 | return err
27 | }
28 |
29 | prLen := len(buf.Prompt)
30 | start := 0
31 | size := buf.size
32 | pos := buf.pos
33 |
34 | // Get slice range that should be visible.
35 | for prLen+pos >= buf.Cols {
36 | start++
37 | size--
38 | pos--
39 | }
40 | for prLen+size > buf.Cols {
41 | size--
42 | }
43 |
44 | _, err := buf.Out.Write(mvLeftEdge)
45 | if err != nil {
46 | return err
47 | }
48 |
49 | _, err = buf.Out.Write([]byte(buf.Prompt))
50 | if err != nil {
51 | return err
52 | }
53 |
54 | _, err = buf.Out.Write(toBytes(buf.data[start : size+start]))
55 | if err != nil {
56 | return err
57 | }
58 |
59 | _, err = buf.Out.Write(delRight)
60 | if err != nil {
61 | return err
62 | }
63 |
64 | _, err = buf.Out.Write([]byte(fmt.Sprintf(mvToCol, pos+prLen)))
65 | return err
66 | }
67 |
68 | // ClsScreen clears the screen and refreshes.
69 | func (buf *Buffer) ClsScreen() error {
70 | _, err := buf.Out.Write(clsScreen)
71 | if err != nil {
72 | return err
73 | }
74 |
75 | return buf.Refresh()
76 | }
77 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/Bowery/prompt/README.md:
--------------------------------------------------------------------------------
1 | # Prompt
2 |
3 | [](https://circleci.com/gh/Bowery/prompt/tree/master)
4 |
5 | [](https://godoc.org/github.com/Bowery/prompt)
6 |
7 | Prompt is a cross platform line-editing prompting library. Read the GoDoc page
8 | for more info and for API details.
9 |
10 | ## Features
11 | - Keyboard shortcuts in prompts
12 | - History support
13 | - Secure password prompt
14 | - Custom prompt support
15 | - Fallback prompt for unsupported terminals
16 | - ANSI conversion for Windows
17 |
18 | ## Todo
19 | - Multi-line prompt as a Terminal option
20 | - Make refresh less jittery on Windows([possible reason](https://github.com/Bowery/prompt/blob/master/output_windows.go#L108))
21 | - Add support for BSD systems
22 | - Multi-byte character support on Windows
23 | - `AnsiWriter` should execute the equivalent ANSI escape code functionality on Windows
24 | - Support for more ANSI escape codes on Windows.
25 | - More keyboard shortcuts from Readlines shortcut list
26 |
27 | ## Contributing
28 |
29 | Make sure Go is setup and running the latest release version, and make sure your `GOPATH` is setup properly.
30 |
31 | Follow the guidelines [here](https://guides.github.com/activities/contributing-to-open-source/#contributing).
32 |
33 | Please be sure to `gofmt` any code before doing commits. You can simply run `gofmt -w .` to format all the code in the directory.
34 |
35 | ## License
36 |
37 | Prompt is MIT licensed, details can be found [here](https://raw.githubusercontent.com/Bowery/prompt/master/LICENSE).
38 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/dchest/safefile/rename_nonatomic.go:
--------------------------------------------------------------------------------
1 | // +build plan9 windows,!go1.5
2 |
3 | // os.Rename on Windows before Go 1.5 and Plan 9 will not overwrite existing
4 | // files, thus we cannot guarantee atomic saving of file by doing rename.
5 | // We will have to do some voodoo to minimize data loss on those systems.
6 |
7 | package safefile
8 |
9 | import (
10 | "os"
11 | "path/filepath"
12 | )
13 |
14 | func rename(oldname, newname string) error {
15 | err := os.Rename(oldname, newname)
16 | if err != nil {
17 | // If newname exists ("original"), we will try renaming it to a
18 | // new temporary name, then renaming oldname to the newname,
19 | // and deleting the renamed original. If system crashes between
20 | // renaming and deleting, the original file will still be available
21 | // under the temporary name, so users can manually recover data.
22 | // (No automatic recovery is possible because after crash the
23 | // temporary name is not known.)
24 | var origtmp string
25 | for {
26 | origtmp, err = makeTempName(newname, filepath.Base(newname))
27 | if err != nil {
28 | return err
29 | }
30 | _, err = os.Stat(origtmp)
31 | if err == nil {
32 | continue // most likely will never happen
33 | }
34 | break
35 | }
36 | err = os.Rename(newname, origtmp)
37 | if err != nil {
38 | return err
39 | }
40 | err = os.Rename(oldname, newname)
41 | if err != nil {
42 | // Rename still fails, try to revert original rename,
43 | // ignoring errors.
44 | os.Rename(origtmp, newname)
45 | return err
46 | }
47 | // Rename succeeded, now delete original file.
48 | os.Remove(origtmp)
49 | }
50 | return nil
51 | }
52 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/LICENSE:
--------------------------------------------------------------------------------
1 | Go support for Protocol Buffers - Google's data interchange format
2 |
3 | Copyright 2010 The Go Authors. All rights reserved.
4 | https://github.com/golang/protobuf
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are
8 | met:
9 |
10 | * Redistributions of source code must retain the above copyright
11 | notice, this list of conditions and the following disclaimer.
12 | * Redistributions in binary form must reproduce the above
13 | copyright notice, this list of conditions and the following disclaimer
14 | in the documentation and/or other materials provided with the
15 | distribution.
16 | * Neither the name of Google Inc. nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vcs/hg.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 vcs
6 |
7 | import (
8 | "os/exec"
9 | "path/filepath"
10 | "strings"
11 | "time"
12 |
13 | os "github.com/kardianos/govendor/internal/vos"
14 | )
15 |
16 | type VcsHg struct{}
17 |
18 | func (VcsHg) Find(dir string) (*VcsInfo, error) {
19 | fi, err := os.Stat(filepath.Join(dir, ".hg"))
20 | if err != nil {
21 | if os.IsNotExist(err) {
22 | return nil, nil
23 | }
24 | return nil, err
25 | }
26 | if fi.IsDir() == false {
27 | return nil, nil
28 | }
29 |
30 | // Get info.
31 | info := &VcsInfo{}
32 |
33 | cmd := exec.Command("hg", "identify", "-i")
34 | cmd.Dir = dir
35 | output, err := cmd.CombinedOutput()
36 | if err != nil {
37 | return nil, err
38 | }
39 | rev := strings.TrimSpace(string(output))
40 | if strings.HasSuffix(rev, "+") {
41 | info.Dirty = true
42 | rev = strings.TrimSuffix(rev, "+")
43 | }
44 |
45 | cmd = exec.Command("hg", "log", "-r", rev)
46 | cmd.Dir = dir
47 | output, err = cmd.CombinedOutput()
48 | if err != nil {
49 | return nil, err
50 | }
51 | for _, line := range strings.Split(string(output), "\n") {
52 | if strings.HasPrefix(line, "changeset:") {
53 | ss := strings.Split(line, ":")
54 | info.Revision = strings.TrimSpace(ss[len(ss)-1])
55 | }
56 | if strings.HasPrefix(line, "date:") {
57 | line = strings.TrimPrefix(line, "date:")
58 | tm, err := time.Parse("Mon Jan 02 15:04:05 2006 -0700", strings.TrimSpace(line))
59 | if err == nil {
60 | info.RevisionTime = &tm
61 | }
62 | }
63 | }
64 | return info, nil
65 | }
66 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/Makefile:
--------------------------------------------------------------------------------
1 | PKG=github.com/mailru/easyjson
2 | GOPATH:=$(PWD)/.root:$(GOPATH)
3 | export GOPATH
4 |
5 | all: test
6 |
7 | .root/src/$(PKG):
8 | mkdir -p $@
9 | for i in $$PWD/* ; do ln -s $$i $@/`basename $$i` ; done
10 |
11 | root: .root/src/$(PKG)
12 |
13 | clean:
14 | rm -rf .root
15 |
16 | build:
17 | go build -i -o .root/bin/easyjson $(PKG)/easyjson
18 |
19 | generate: root build
20 | .root/bin/easyjson -stubs \
21 | .root/src/$(PKG)/tests/snake.go \
22 | .root/src/$(PKG)/tests/data.go \
23 | .root/src/$(PKG)/tests/omitempty.go \
24 | .root/src/$(PKG)/tests/nothing.go \
25 | .root/src/$(PKG)/tests/named_type.go
26 |
27 | .root/bin/easyjson -all .root/src/$(PKG)/tests/data.go
28 | .root/bin/easyjson -all .root/src/$(PKG)/tests/nothing.go
29 | .root/bin/easyjson -all .root/src/$(PKG)/tests/errors.go
30 | .root/bin/easyjson -snake_case .root/src/$(PKG)/tests/snake.go
31 | .root/bin/easyjson -omit_empty .root/src/$(PKG)/tests/omitempty.go
32 | .root/bin/easyjson -build_tags=use_easyjson .root/src/$(PKG)/benchmark/data.go
33 | .root/bin/easyjson .root/src/$(PKG)/tests/nested_easy.go
34 | .root/bin/easyjson .root/src/$(PKG)/tests/named_type.go
35 |
36 | test: generate root
37 | go test \
38 | $(PKG)/tests \
39 | $(PKG)/jlexer \
40 | $(PKG)/gen \
41 | $(PKG)/buffer
42 | go test -benchmem -tags use_easyjson -bench . $(PKG)/benchmark
43 | golint -set_exit_status .root/src/$(PKG)/tests/*_easyjson.go
44 |
45 | bench-other: generate root
46 | @go test -benchmem -bench . $(PKG)/benchmark
47 | @go test -benchmem -tags use_ffjson -bench . $(PKG)/benchmark
48 | @go test -benchmem -tags use_codec -bench . $(PKG)/benchmark
49 |
50 | bench-python:
51 | benchmark/ujson.sh
52 |
53 |
54 | .PHONY: root clean generate test build
55 |
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/benchmark_medium_payload_test.go:
--------------------------------------------------------------------------------
1 | package go_benchmark
2 |
3 | import (
4 | "testing"
5 | "github.com/json-iterator/go"
6 | "encoding/json"
7 | "github.com/mailru/easyjson/jlexer"
8 | "bytes"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | /*
13 | encoding/json
14 | */
15 | func BenchmarkDecodeStdStructMedium(b *testing.B) {
16 | b.ReportAllocs()
17 | var data MediumPayload
18 | for i := 0; i < b.N; i++ {
19 | json.Unmarshal(mediumFixture, &data)
20 | }
21 | }
22 |
23 | func BenchmarkEncodeStdStructMedium(b *testing.B) {
24 | var data MediumPayload
25 | json.Unmarshal(mediumFixture, &data)
26 | b.ReportAllocs()
27 | for i := 0; i < b.N; i++ {
28 | json.Marshal(data)
29 | }
30 | }
31 |
32 | func BenchmarkDecodeJsoniterStructMedium(b *testing.B) {
33 | b.ReportAllocs()
34 | var data MediumPayload
35 | for i := 0; i < b.N; i++ {
36 | jsoniter.Unmarshal(mediumFixture, &data)
37 | }
38 | }
39 |
40 | func BenchmarkEncodeJsoniterStructMedium(b *testing.B) {
41 | var data MediumPayload
42 | jsoniter.Unmarshal(mediumFixture, &data)
43 | b.ReportAllocs()
44 | for i := 0; i < b.N; i++ {
45 | jsoniter.Marshal(data)
46 | }
47 | }
48 |
49 | func BenchmarkDecodeEasyJsonMedium(b *testing.B) {
50 | b.ReportAllocs()
51 | var data MediumPayload
52 | for i := 0; i < b.N; i++ {
53 | lexer := &jlexer.Lexer{Data: mediumFixture}
54 | data.UnmarshalEasyJSON(lexer)
55 | }
56 | }
57 |
58 | func BenchmarkEncodeEasyJsonMedium(b *testing.B) {
59 | var data MediumPayload
60 | lexer := &jlexer.Lexer{Data: mediumFixture}
61 | data.UnmarshalEasyJSON(lexer)
62 | b.ReportAllocs()
63 | buf := &bytes.Buffer{}
64 | for i := 0; i < b.N; i++ {
65 | writer := &jwriter.Writer{}
66 | data.MarshalEasyJSON(writer)
67 | buf.Reset()
68 | writer.DumpTo(buf)
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/migrate/gdm.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 migrate
6 |
7 | import (
8 | "fmt"
9 | "io"
10 | "os"
11 | "path/filepath"
12 |
13 | "github.com/kardianos/govendor/context"
14 | "github.com/kardianos/govendor/vendorfile"
15 | )
16 |
17 | func init() {
18 | register("gdm", sysGdm{})
19 | }
20 |
21 | type sysGdm struct{}
22 |
23 | func (sys sysGdm) Check(root string) (system, error) {
24 | if hasFiles(root, "Godeps") {
25 | return sys, nil
26 | }
27 | return nil, nil
28 | }
29 |
30 | func (sys sysGdm) Migrate(root string) error {
31 | gdmFilePath := filepath.Join(root, "Godeps")
32 |
33 | ctx, err := context.NewContext(root, filepath.Join("vendor", "vendor.json"), "vendor", false)
34 | if err != nil {
35 | return err
36 | }
37 | ctx.VendorFile.Ignore = "test"
38 |
39 | f, err := os.Open(gdmFilePath)
40 | if err != nil {
41 | return err
42 | }
43 | defer f.Close()
44 |
45 | pkgs, err := sys.parseGdmFile(f)
46 | if err != nil {
47 | return err
48 | }
49 | ctx.VendorFile.Package = pkgs
50 |
51 | if err := ctx.WriteVendorFile(); err != nil {
52 | return err
53 | }
54 |
55 | return os.RemoveAll(gdmFilePath)
56 | }
57 |
58 | func (sysGdm) parseGdmFile(r io.Reader) ([]*vendorfile.Package, error) {
59 | var pkgs []*vendorfile.Package
60 | for {
61 | var path, rev string
62 | if _, err := fmt.Fscanf(r, "%s %s\n", &path, &rev); err != nil {
63 | if err == io.EOF {
64 | break
65 | }
66 | return nil, err
67 | }
68 |
69 | pkgs = append(pkgs, &vendorfile.Package{
70 | Add: true,
71 | Path: path,
72 | Revision: rev,
73 | Tree: true,
74 | })
75 | }
76 |
77 | return pkgs, nil
78 | }
79 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/deserializer.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | type TDeserializer struct {
23 | Transport TTransport
24 | Protocol TProtocol
25 | }
26 |
27 | func NewTDeserializer() *TDeserializer {
28 | var transport TTransport
29 | transport = NewTMemoryBufferLen(1024)
30 |
31 | protocol := NewTBinaryProtocolFactoryDefault().GetProtocol(transport)
32 |
33 | return &TDeserializer{
34 | transport,
35 | protocol}
36 | }
37 |
38 | func (t *TDeserializer) ReadString(msg TStruct, s string) (err error) {
39 | err = nil
40 | if _, err = t.Transport.Write([]byte(s)); err != nil {
41 | return
42 | }
43 | if err = msg.Read(t.Protocol); err != nil {
44 | return
45 | }
46 | return
47 | }
48 |
49 | func (t *TDeserializer) Read(msg TStruct, b []byte) (err error) {
50 | err = nil
51 | if _, err = t.Transport.Write(b); err != nil {
52 | return
53 | }
54 | if err = msg.Read(t.Protocol); err != nil {
55 | return
56 | }
57 | return
58 | }
59 |
--------------------------------------------------------------------------------
/vendor/github.com/gogo/protobuf/proto/lib_gogo.go:
--------------------------------------------------------------------------------
1 | // Protocol Buffers for Go with Gadgets
2 | //
3 | // Copyright (c) 2013, The GoGo Authors. All rights reserved.
4 | // http://github.com/gogo/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
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 |
29 | package proto
30 |
31 | import (
32 | "encoding/json"
33 | "strconv"
34 | )
35 |
36 | func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) {
37 | s, ok := m[value]
38 | if !ok {
39 | s = strconv.Itoa(int(value))
40 | }
41 | return json.Marshal(s)
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/github.com/gogo/protobuf/LICENSE:
--------------------------------------------------------------------------------
1 | Protocol Buffers for Go with Gadgets
2 |
3 | Copyright (c) 2013, The GoGo Authors. All rights reserved.
4 | http://github.com/gogo/protobuf
5 |
6 | Go support for Protocol Buffers - Google's data interchange format
7 |
8 | Copyright 2010 The Go Authors. All rights reserved.
9 | https://github.com/golang/protobuf
10 |
11 | Redistribution and use in source and binary forms, with or without
12 | modification, are permitted provided that the following conditions are
13 | met:
14 |
15 | * Redistributions of source code must retain the above copyright
16 | notice, this list of conditions and the following disclaimer.
17 | * Redistributions in binary form must reproduce the above
18 | copyright notice, this list of conditions and the following disclaimer
19 | in the documentation and/or other materials provided with the
20 | distribution.
21 | * Neither the name of Google Inc. nor the names of its
22 | contributors may be used to endorse or promote products derived from
23 | this software without specific prior written permission.
24 |
25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 |
37 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/type.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | // Type constants in the Thrift protocol
23 | type TType byte
24 |
25 | const (
26 | STOP = 0
27 | VOID = 1
28 | BOOL = 2
29 | BYTE = 3
30 | I08 = 3
31 | DOUBLE = 4
32 | I16 = 6
33 | I32 = 8
34 | I64 = 10
35 | STRING = 11
36 | UTF7 = 11
37 | STRUCT = 12
38 | MAP = 13
39 | SET = 14
40 | LIST = 15
41 | UTF8 = 16
42 | UTF16 = 17
43 | //BINARY = 18 wrong and unusued
44 | )
45 |
46 | var typeNames = map[int]string{
47 | STOP: "STOP",
48 | VOID: "VOID",
49 | BOOL: "BOOL",
50 | BYTE: "BYTE",
51 | DOUBLE: "DOUBLE",
52 | I16: "I16",
53 | I32: "I32",
54 | I64: "I64",
55 | STRING: "STRING",
56 | STRUCT: "STRUCT",
57 | MAP: "MAP",
58 | SET: "SET",
59 | LIST: "LIST",
60 | UTF8: "UTF8",
61 | UTF16: "UTF16",
62 | }
63 |
64 | func (p TType) String() string {
65 | if s, ok := typeNames[int(p)]; ok {
66 | return s
67 | }
68 | return "Unknown"
69 | }
70 |
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/large_file_test.go:
--------------------------------------------------------------------------------
1 | package go_benchmark
2 |
3 | import (
4 | "testing"
5 | "github.com/json-iterator/go"
6 | "os"
7 | "encoding/json"
8 | "github.com/buger/jsonparser"
9 | "io/ioutil"
10 | )
11 |
12 | func Test_jsonparser_skip(t *testing.T) {
13 | file, _ := os.Open("/tmp/large-file.json")
14 | bytes, _ := ioutil.ReadAll(file)
15 | file.Close()
16 | total := 0
17 | jsonparser.ArrayEach(bytes, func(value []byte, dataType jsonparser.ValueType, offset int, err error) {
18 | total++
19 | })
20 | if total != 11351 {
21 | t.Fatal(total)
22 | }
23 | }
24 |
25 | func Test_jsoniter_skip(t *testing.T) {
26 | for i := 0; i < 100; i++ {
27 | file, _ := os.Open("/tmp/large-file.json")
28 | iter := jsoniter.Parse(file, 4096)
29 | total := 0
30 | for iter.ReadArray() {
31 | iter.Skip()
32 | total++
33 | }
34 | file.Close()
35 | if total != 11351 {
36 | t.Fatal(total)
37 | }
38 | }
39 | }
40 |
41 | func Benchmark_jsonparser(b *testing.B) {
42 | b.ReportAllocs()
43 | for n := 0; n < b.N; n++ {
44 | file, _ := os.Open("/tmp/large-file.json")
45 | bytes, _ := ioutil.ReadAll(file)
46 | file.Close()
47 | total := 0
48 | jsonparser.ArrayEach(bytes, func(value []byte, dataType jsonparser.ValueType, offset int, err error) {
49 | total++
50 | })
51 | }
52 | }
53 |
54 | func Benchmark_stardard_lib(b *testing.B) {
55 | b.ReportAllocs()
56 | for n := 0; n < b.N; n++ {
57 | file, _ := os.Open("/tmp/large-file.json")
58 | result := []struct{}{}
59 | decoder := json.NewDecoder(file)
60 | decoder.Decode(&result)
61 | file.Close()
62 | }
63 | }
64 |
65 | func Benchmark_jsoniter(b *testing.B) {
66 | b.ReportAllocs()
67 | for n := 0; n < b.N; n++ {
68 | file, _ := os.Open("/tmp/large-file.json")
69 | iter := jsoniter.Parse(file, 4096)
70 | for iter.ReadArray() {
71 | iter.Skip()
72 | }
73 | file.Close()
74 | }
75 | }
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/doc/faq.md:
--------------------------------------------------------------------------------
1 | # govendor FAQ
2 |
3 | #### Q: How do I test only my packages?
4 | A: Run `govendor test +local`.
5 |
6 | #### Q: How do I build install all my vendor packages?
7 | A: Run `govendor install +vendor,^program`.
8 |
9 | #### Q: How do I pull all my dependencies from network remotes?
10 | A: Run `govendor fetch +out`.
11 |
12 | #### Q: I have a working program with dependencies in $GOPATH. I want to vendor now.
13 | A: Run `govendor add +external`.
14 |
15 | #### Q: I have copied dependencies into "vendor". I want to update from $GOPATH.
16 | A: Run `govendor update +vendor`.
17 |
18 | #### Q: I'm getting missing packages from `appengine` but I don't care about `appengine`. How do I ignore these packages?
19 | A: Edit the `vendor/vendor.json` file. Update the "ignore" field to include "appengine".
20 | If you are already ignoring tests, it will look like: `"ignore": "test appengine",`.
21 |
22 | #### Q: I have modified a package in $GOPATH and I want to try the changes in vendor without committing them.
23 | A: Run `govendor update -uncommitted `.
24 |
25 | #### Q: I've forked a package and I haven't upstreamed the changes yet. What should I do?
26 | A: Assuming you've pushed your changes to an accessable repository, run
27 | `govendor fetch github.com/normal/pkg::github.com/myfork/pkg`. This will
28 | fetch from "myfork" but place package in "normal".
29 |
30 | #### Q: I have C files or HTML resources in sub-folders. How do I ensure they are copied as well?
31 | A: Run either `govendor fetch github.com/dep/pkg/^` or `govendor add github.com/dep/pkg/^`.
32 | This is the same as using the `-tree` argument.
33 |
34 | #### Q: How do I prevent vendor source from being checked in?
35 | A: Add `vendor/*/` to your ignore file.
36 |
37 | #### Q: How do I populate the vendor folder if it has not been checked in?
38 | A: Run `govendor sync`.
39 |
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/pb_test.go:
--------------------------------------------------------------------------------
1 | package go_benchmark
2 |
3 | import (
4 | "testing"
5 | "github.com/golang/protobuf/proto"
6 | "github.com/json-iterator/go"
7 | "encoding/json"
8 | "github.com/json-iterator/go-benchmark/testobject"
9 | "git.apache.org/thrift.git/lib/go/thrift"
10 | )
11 |
12 | func Benchmark_protobuf(b *testing.B) {
13 | b.ReportAllocs()
14 | //obj := PbTestObject{"1","2","3","4","5","6","7","8","9","10"}
15 | obj := With2Fields{"1", "2"}
16 | data, _ := proto.Marshal(&obj)
17 | for i := 0; i < b.N; i++ {
18 | proto.Unmarshal(data, &obj)
19 | }
20 | }
21 |
22 | func Benchmark_jsoniter2(b *testing.B) {
23 | b.ReportAllocs()
24 | obj := PbTestObject{"1","2","3","4","5","6","7","8","9","10"}
25 | //obj := With2Fields{"1", "2"}
26 | data, _ := jsoniter.Marshal(&obj)
27 | //buf := &bytes.Buffer{}
28 | //stream := jsoniter.NewStream(buf, 4096)
29 | iter := jsoniter.NewIterator()
30 | for i := 0; i < b.N; i++ {
31 | iter.ResetBytes(data)
32 | iter.ReadVal(&obj)
33 | }
34 | }
35 |
36 | func Benchmark_json_marshal(b *testing.B) {
37 | b.ReportAllocs()
38 | obj := With2Fields{"1", "2"}
39 | data, _ := jsoniter.Marshal(&obj)
40 | for i := 0; i < b.N; i++ {
41 | json.Unmarshal(data, &obj)
42 | }
43 | }
44 |
45 | func Benchmark_thrift(b *testing.B) {
46 | b.ReportAllocs()
47 | obj := testobject.NewThriftTestObject()
48 | obj.Field1 = "1"
49 | obj.Field2 = "2"
50 | obj.Field3 = "3"
51 | obj.Field4 = "4"
52 | obj.Field5 = "5"
53 | obj.Field6 = "6"
54 | obj.Field7 = "7"
55 | obj.Field8 = "8"
56 | obj.Field9 = "9"
57 | obj.Field10 = "10"
58 | buf := thrift.NewTMemoryBuffer()
59 | protocolFactory := &thrift.TCompactProtocolFactory{}
60 | protocol := protocolFactory.GetProtocol(buf)
61 | buf.Reset()
62 | obj.Write(protocol)
63 | data := buf.Bytes()
64 | for i := 0; i < b.N; i++ {
65 | buf.Reset()
66 | buf.Write(data)
67 | obj.Read(protocol)
68 | }
69 | }
70 |
71 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/processor_factory.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | // The default processor factory just returns a singleton
23 | // instance.
24 | type TProcessorFactory interface {
25 | GetProcessor(trans TTransport) TProcessor
26 | }
27 |
28 | type tProcessorFactory struct {
29 | processor TProcessor
30 | }
31 |
32 | func NewTProcessorFactory(p TProcessor) TProcessorFactory {
33 | return &tProcessorFactory{processor: p}
34 | }
35 |
36 | func (p *tProcessorFactory) GetProcessor(trans TTransport) TProcessor {
37 | return p.processor
38 | }
39 |
40 | /**
41 | * The default processor factory just returns a singleton
42 | * instance.
43 | */
44 | type TProcessorFunctionFactory interface {
45 | GetProcessorFunction(trans TTransport) TProcessorFunction
46 | }
47 |
48 | type tProcessorFunctionFactory struct {
49 | processor TProcessorFunction
50 | }
51 |
52 | func NewTProcessorFunctionFactory(p TProcessorFunction) TProcessorFunctionFactory {
53 | return &tProcessorFunctionFactory{processor: p}
54 | }
55 |
56 | func (p *tProcessorFunctionFactory) GetProcessorFunction(trans TTransport) TProcessorFunction {
57 | return p.processor
58 | }
59 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/transport.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | import (
23 | "errors"
24 | "io"
25 | )
26 |
27 | var errTransportInterrupted = errors.New("Transport Interrupted")
28 |
29 | type Flusher interface {
30 | Flush() (err error)
31 | }
32 |
33 | type ReadSizeProvider interface {
34 | RemainingBytes() (num_bytes uint64)
35 | }
36 |
37 |
38 | // Encapsulates the I/O layer
39 | type TTransport interface {
40 | io.ReadWriteCloser
41 | Flusher
42 | ReadSizeProvider
43 |
44 | // Opens the transport for communication
45 | Open() error
46 |
47 | // Returns true if the transport is open
48 | IsOpen() bool
49 | }
50 |
51 | type stringWriter interface {
52 | WriteString(s string) (n int, err error)
53 | }
54 |
55 |
56 | // This is "enchanced" transport with extra capabilities. You need to use one of these
57 | // to construct protocol.
58 | // Notably, TSocket does not implement this interface, and it is always a mistake to use
59 | // TSocket directly in protocol.
60 | type TRichTransport interface {
61 | io.ReadWriter
62 | io.ByteReader
63 | io.ByteWriter
64 | stringWriter
65 | Flusher
66 | ReadSizeProvider
67 | }
68 |
69 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vcs/vcs.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 vcs gets version control information from the file system.
6 | package vcs
7 |
8 | import (
9 | "path/filepath"
10 | "sync"
11 | "time"
12 |
13 | "github.com/kardianos/govendor/internal/pathos"
14 | )
15 |
16 | // VcsInfo returns information about a given repo.
17 | type VcsInfo struct {
18 | Dirty bool
19 | Revision string
20 | RevisionTime *time.Time
21 | }
22 |
23 | // Vcs represents a version control system.
24 | type Vcs interface {
25 | // Return nil VcsInfo if unable to determine VCS from directory.
26 | Find(dir string) (*VcsInfo, error)
27 | }
28 |
29 | var vcsRegistry = []Vcs{
30 | VcsGit{},
31 | VcsHg{},
32 | VcsSvn{},
33 | VcsBzr{},
34 | }
35 | var registerSync = sync.Mutex{}
36 |
37 | // RegisterVCS adds a new VCS to use.
38 | func RegisterVCS(vcs Vcs) {
39 | registerSync.Lock()
40 | defer registerSync.Unlock()
41 |
42 | vcsRegistry = append(vcsRegistry, vcs)
43 | }
44 |
45 | const looplimit = 10000
46 |
47 | // FindVcs determines the version control information given a package dir and
48 | // lowest root dir.
49 | func FindVcs(root, packageDir string) (info *VcsInfo, err error) {
50 | if !filepath.IsAbs(root) {
51 | return nil, nil
52 | }
53 | if !filepath.IsAbs(packageDir) {
54 | return nil, nil
55 | }
56 | path := packageDir
57 | for i := 0; i <= looplimit; i++ {
58 | for _, vcs := range vcsRegistry {
59 | info, err = vcs.Find(path)
60 | if err != nil {
61 | return nil, err
62 | }
63 | if info != nil {
64 | return info, nil
65 | }
66 | }
67 |
68 | nextPath := filepath.Clean(filepath.Join(path, ".."))
69 | // Check for root.
70 | if nextPath == path {
71 | return nil, nil
72 | }
73 | if pathos.FileHasPrefix(nextPath, root) == false {
74 | return nil, nil
75 | }
76 | path = nextPath
77 | }
78 | panic("loop limit")
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/parser/parser.go:
--------------------------------------------------------------------------------
1 | package parser
2 |
3 | import (
4 | "go/ast"
5 | "go/parser"
6 | "go/token"
7 | "strings"
8 | )
9 |
10 | const structComment = "easyjson:json"
11 |
12 | type Parser struct {
13 | PkgPath string
14 | PkgName string
15 | StructNames []string
16 | AllStructs bool
17 | }
18 |
19 | type visitor struct {
20 | *Parser
21 |
22 | name string
23 | explicit bool
24 | }
25 |
26 | func (p *Parser) needType(comments string) bool {
27 | for _, v := range strings.Split(comments, "\n") {
28 | if strings.HasPrefix(v, structComment) {
29 | return true
30 | }
31 | }
32 | return false
33 | }
34 |
35 | func (v *visitor) Visit(n ast.Node) (w ast.Visitor) {
36 | switch n := n.(type) {
37 | case *ast.Package:
38 | return v
39 | case *ast.File:
40 | v.PkgName = n.Name.String()
41 | return v
42 |
43 | case *ast.GenDecl:
44 | v.explicit = v.needType(n.Doc.Text())
45 |
46 | if !v.explicit && !v.AllStructs {
47 | return nil
48 | }
49 | return v
50 | case *ast.TypeSpec:
51 | v.name = n.Name.String()
52 |
53 | // Allow to specify non-structs explicitly independent of '-all' flag.
54 | if v.explicit {
55 | v.StructNames = append(v.StructNames, v.name)
56 | return nil
57 | }
58 | return v
59 | case *ast.StructType:
60 | v.StructNames = append(v.StructNames, v.name)
61 | return nil
62 | }
63 | return nil
64 | }
65 |
66 | func (p *Parser) Parse(fname string, isDir bool) error {
67 | var err error
68 | if p.PkgPath, err = getPkgPath(fname, isDir); err != nil {
69 | return err
70 | }
71 |
72 | fset := token.NewFileSet()
73 | if isDir {
74 | packages, err := parser.ParseDir(fset, fname, nil, parser.ParseComments)
75 | if err != nil {
76 | return err
77 | }
78 |
79 | for _, pckg := range packages {
80 | ast.Walk(&visitor{Parser: p}, pckg)
81 | }
82 | } else {
83 | f, err := parser.ParseFile(fset, fname, nil, parser.ParseComments)
84 | if err != nil {
85 | return err
86 | }
87 |
88 | ast.Walk(&visitor{Parser: p}, f)
89 | }
90 | return nil
91 | }
92 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_Int.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type Int struct {
16 | V int
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OInt(v int) Int {
22 | return Int{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v Int) Get(deflt int) int {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v Int) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.Int(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *Int) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = Int{}
47 | } else {
48 | v.V = l.Int()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *Int) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *Int) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v Int) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v Int) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/context/vendorFile.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 context
6 |
7 | import (
8 | "bytes"
9 | ros "os"
10 | "path/filepath"
11 | "strings"
12 |
13 | "github.com/dchest/safefile"
14 | "github.com/kardianos/govendor/vendorfile"
15 |
16 | os "github.com/kardianos/govendor/internal/vos"
17 | )
18 |
19 | // WriteVendorFile writes the current vendor file to the context location.
20 | func (ctx *Context) WriteVendorFile() (err error) {
21 | perm := ros.FileMode(0666)
22 | fi, err := os.Stat(ctx.VendorFilePath)
23 | if err == nil {
24 | perm = fi.Mode()
25 | }
26 |
27 | ctx.VendorFile.RootPath = ctx.RootImportPath
28 |
29 | buf := &bytes.Buffer{}
30 | err = ctx.VendorFile.Marshal(buf)
31 | if err != nil {
32 | return
33 | }
34 | err = buf.WriteByte('\n')
35 | if err != nil {
36 | return
37 | }
38 | dir, _ := filepath.Split(ctx.VendorFilePath)
39 | err = os.MkdirAll(dir, 0777)
40 | if err != nil {
41 | return
42 | }
43 |
44 | for i := range ctx.VendorFile.Package {
45 | vp := ctx.VendorFile.Package[i]
46 | vp.Add = false
47 | }
48 |
49 | err = safefile.WriteFile(ctx.VendorFilePath, buf.Bytes(), perm)
50 | if err == nil {
51 | for _, vp := range ctx.VendorFile.Package {
52 | vp.Add = false
53 | }
54 | }
55 |
56 | return
57 | }
58 |
59 | func readVendorFile(vendorRoot, vendorFilePath string) (*vendorfile.File, error) {
60 | vf := &vendorfile.File{}
61 | f, err := os.Open(vendorFilePath)
62 | if err != nil {
63 | return nil, err
64 | }
65 | defer f.Close()
66 |
67 | err = vf.Unmarshal(f)
68 | if err != nil {
69 | return nil, err
70 | }
71 | // Remove any existing origin field if the prefix matches the
72 | // context package root. This fixes a previous bug introduced in the file,
73 | // that is now fixed.
74 | for _, row := range vf.Package {
75 | row.Origin = strings.TrimPrefix(row.Origin, vendorRoot)
76 | }
77 |
78 | return vf, nil
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_Bool.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type Bool struct {
16 | V bool
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OBool(v bool) Bool {
22 | return Bool{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v Bool) Get(deflt bool) bool {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v Bool) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.Bool(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *Bool) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = Bool{}
47 | } else {
48 | v.V = l.Bool()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *Bool) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *Bool) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v Bool) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v Bool) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_Int8.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type Int8 struct {
16 | V int8
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OInt8(v int8) Int8 {
22 | return Int8{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v Int8) Get(deflt int8) int8 {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v Int8) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.Int8(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *Int8) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = Int8{}
47 | } else {
48 | v.V = l.Int8()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *Int8) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *Int8) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v Int8) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v Int8) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_Uint.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type Uint struct {
16 | V uint
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OUint(v uint) Uint {
22 | return Uint{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v Uint) Get(deflt uint) uint {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v Uint) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.Uint(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *Uint) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = Uint{}
47 | } else {
48 | v.V = l.Uint()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *Uint) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *Uint) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v Uint) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v Uint) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_Int16.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type Int16 struct {
16 | V int16
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OInt16(v int16) Int16 {
22 | return Int16{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v Int16) Get(deflt int16) int16 {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v Int16) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.Int16(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *Int16) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = Int16{}
47 | } else {
48 | v.V = l.Int16()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *Int16) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *Int16) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v Int16) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v Int16) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_Int32.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type Int32 struct {
16 | V int32
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OInt32(v int32) Int32 {
22 | return Int32{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v Int32) Get(deflt int32) int32 {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v Int32) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.Int32(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *Int32) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = Int32{}
47 | } else {
48 | v.V = l.Int32()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *Int32) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *Int32) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v Int32) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v Int32) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_Int64.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type Int64 struct {
16 | V int64
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OInt64(v int64) Int64 {
22 | return Int64{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v Int64) Get(deflt int64) int64 {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v Int64) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.Int64(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *Int64) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = Int64{}
47 | } else {
48 | v.V = l.Int64()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *Int64) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *Int64) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v Int64) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v Int64) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_Uint8.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type Uint8 struct {
16 | V uint8
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OUint8(v uint8) Uint8 {
22 | return Uint8{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v Uint8) Get(deflt uint8) uint8 {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v Uint8) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.Uint8(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *Uint8) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = Uint8{}
47 | } else {
48 | v.V = l.Uint8()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *Uint8) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *Uint8) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v Uint8) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v Uint8) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/rich_transport.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | import "io"
23 |
24 | type RichTransport struct {
25 | TTransport
26 | }
27 |
28 | // Wraps Transport to provide TRichTransport interface
29 | func NewTRichTransport(trans TTransport) *RichTransport {
30 | return &RichTransport{trans}
31 | }
32 |
33 | func (r *RichTransport) ReadByte() (c byte, err error) {
34 | return readByte(r.TTransport)
35 | }
36 |
37 | func (r *RichTransport) WriteByte(c byte) error {
38 | return writeByte(r.TTransport, c)
39 | }
40 |
41 | func (r *RichTransport) WriteString(s string) (n int, err error) {
42 | return r.Write([]byte(s))
43 | }
44 |
45 | func (r *RichTransport) RemainingBytes() (num_bytes uint64) {
46 | return r.TTransport.RemainingBytes()
47 | }
48 |
49 | func readByte(r io.Reader) (c byte, err error) {
50 | v := [1]byte{0}
51 | n, err := r.Read(v[0:1])
52 | if n > 0 && (err == nil || err == io.EOF) {
53 | return v[0], nil
54 | }
55 | if n > 0 && err != nil {
56 | return v[0], err
57 | }
58 | if err != nil {
59 | return 0, err
60 | }
61 | return v[0], nil
62 | }
63 |
64 | func writeByte(w io.Writer, c byte) error {
65 | v := [1]byte{c}
66 | _, err := w.Write(v[0:1])
67 | return err
68 | }
69 |
70 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_String.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type String struct {
16 | V string
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OString(v string) String {
22 | return String{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v String) Get(deflt string) string {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v String) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.String(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *String) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = String{}
47 | } else {
48 | v.V = l.String()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *String) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *String) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v String) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v String) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_Uint16.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type Uint16 struct {
16 | V uint16
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OUint16(v uint16) Uint16 {
22 | return Uint16{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v Uint16) Get(deflt uint16) uint16 {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v Uint16) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.Uint16(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *Uint16) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = Uint16{}
47 | } else {
48 | v.V = l.Uint16()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *Uint16) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *Uint16) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v Uint16) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v Uint16) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_Uint32.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type Uint32 struct {
16 | V uint32
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OUint32(v uint32) Uint32 {
22 | return Uint32{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v Uint32) Get(deflt uint32) uint32 {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v Uint32) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.Uint32(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *Uint32) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = Uint32{}
47 | } else {
48 | v.V = l.Uint32()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *Uint32) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *Uint32) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v Uint32) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v Uint32) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_Uint64.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type Uint64 struct {
16 | V uint64
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OUint64(v uint64) Uint64 {
22 | return Uint64{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v Uint64) Get(deflt uint64) uint64 {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v Uint64) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.Uint64(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *Uint64) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = Uint64{}
47 | } else {
48 | v.V = l.Uint64()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *Uint64) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *Uint64) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v Uint64) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v Uint64) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/field.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | // Helper class that encapsulates field metadata.
23 | type field struct {
24 | name string
25 | typeId TType
26 | id int
27 | }
28 |
29 | func newField(n string, t TType, i int) *field {
30 | return &field{name: n, typeId: t, id: i}
31 | }
32 |
33 | func (p *field) Name() string {
34 | if p == nil {
35 | return ""
36 | }
37 | return p.name
38 | }
39 |
40 | func (p *field) TypeId() TType {
41 | if p == nil {
42 | return TType(VOID)
43 | }
44 | return p.typeId
45 | }
46 |
47 | func (p *field) Id() int {
48 | if p == nil {
49 | return -1
50 | }
51 | return p.id
52 | }
53 |
54 | func (p *field) String() string {
55 | if p == nil {
56 | return ""
57 | }
58 | return ""
59 | }
60 |
61 | var ANONYMOUS_FIELD *field
62 |
63 | type fieldSlice []field
64 |
65 | func (p fieldSlice) Len() int {
66 | return len(p)
67 | }
68 |
69 | func (p fieldSlice) Less(i, j int) bool {
70 | return p[i].Id() < p[j].Id()
71 | }
72 |
73 | func (p fieldSlice) Swap(i, j int) {
74 | p[i], p[j] = p[j], p[i]
75 | }
76 |
77 | func init() {
78 | ANONYMOUS_FIELD = newField("", STOP, 0)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/proto/Makefile:
--------------------------------------------------------------------------------
1 | # Go support for Protocol Buffers - Google's data interchange format
2 | #
3 | # Copyright 2010 The Go Authors. All rights reserved.
4 | # https://github.com/golang/protobuf
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | install:
33 | go install
34 |
35 | test: install generate-test-pbs
36 | go test
37 |
38 |
39 | generate-test-pbs:
40 | make install
41 | make -C testdata
42 | protoc --go_out=Mtestdata/test.proto=github.com/golang/protobuf/proto/testdata,Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any:. proto3_proto/proto3.proto
43 | make
44 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/optional/opt.go:
--------------------------------------------------------------------------------
1 | // +build none
2 |
3 | package optional
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 | type A int
14 |
15 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
16 | type Optional struct {
17 | V A
18 | Defined bool
19 | }
20 |
21 | // Creates an optional type with a given value.
22 | func OOptional(v A) Optional {
23 | return Optional{V: v, Defined: true}
24 | }
25 |
26 | // Get returns the value or given default in the case the value is undefined.
27 | func (v Optional) Get(deflt A) A {
28 | if !v.Defined {
29 | return deflt
30 | }
31 | return v.V
32 | }
33 |
34 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
35 | func (v Optional) MarshalEasyJSON(w *jwriter.Writer) {
36 | if v.Defined {
37 | w.Optional(v.V)
38 | } else {
39 | w.RawString("null")
40 | }
41 | }
42 |
43 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
44 | func (v *Optional) UnmarshalEasyJSON(l *jlexer.Lexer) {
45 | if l.IsNull() {
46 | l.Skip()
47 | *v = Optional{}
48 | } else {
49 | v.V = l.Optional()
50 | v.Defined = true
51 | }
52 | }
53 |
54 | // MarshalJSON implements a standard json marshaler interface.
55 | func (v *Optional) MarshalJSON() ([]byte, error) {
56 | w := jwriter.Writer{}
57 | v.MarshalEasyJSON(&w)
58 | return w.Buffer.BuildBytes(), w.Error
59 | }
60 |
61 | // MarshalJSON implements a standard json marshaler interface.
62 | func (v *Optional) UnmarshalJSON(data []byte) error {
63 | l := jlexer.Lexer{}
64 | v.UnmarshalEasyJSON(&l)
65 | return l.Error()
66 | }
67 |
68 | // IsDefined returns whether the value is defined, a function is required so that it can
69 | // be used in an interface.
70 | func (v Optional) IsDefined() bool {
71 | return v.Defined
72 | }
73 |
74 | // String implements a stringer interface using fmt.Sprint for the value.
75 | func (v Optional) String() string {
76 | if !v.Defined {
77 | return ""
78 | }
79 | return fmt.Sprint(v.V)
80 | }
81 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_Float32.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type Float32 struct {
16 | V float32
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OFloat32(v float32) Float32 {
22 | return Float32{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v Float32) Get(deflt float32) float32 {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v Float32) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.Float32(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *Float32) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = Float32{}
47 | } else {
48 | v.V = l.Float32()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *Float32) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *Float32) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v Float32) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v Float32) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/opt/gotemplate_Float64.go:
--------------------------------------------------------------------------------
1 | // generated by gotemplate
2 |
3 | package opt
4 |
5 | import (
6 | "fmt"
7 |
8 | "github.com/mailru/easyjson/jlexer"
9 | "github.com/mailru/easyjson/jwriter"
10 | )
11 |
12 | // template type Optional(A)
13 |
14 | // A 'gotemplate'-based type for providing optional semantics without using pointers.
15 | type Float64 struct {
16 | V float64
17 | Defined bool
18 | }
19 |
20 | // Creates an optional type with a given value.
21 | func OFloat64(v float64) Float64 {
22 | return Float64{V: v, Defined: true}
23 | }
24 |
25 | // Get returns the value or given default in the case the value is undefined.
26 | func (v Float64) Get(deflt float64) float64 {
27 | if !v.Defined {
28 | return deflt
29 | }
30 | return v.V
31 | }
32 |
33 | // MarshalEasyJSON does JSON marshaling using easyjson interface.
34 | func (v Float64) MarshalEasyJSON(w *jwriter.Writer) {
35 | if v.Defined {
36 | w.Float64(v.V)
37 | } else {
38 | w.RawString("null")
39 | }
40 | }
41 |
42 | // UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
43 | func (v *Float64) UnmarshalEasyJSON(l *jlexer.Lexer) {
44 | if l.IsNull() {
45 | l.Skip()
46 | *v = Float64{}
47 | } else {
48 | v.V = l.Float64()
49 | v.Defined = true
50 | }
51 | }
52 |
53 | // MarshalJSON implements a standard json marshaler interface.
54 | func (v *Float64) MarshalJSON() ([]byte, error) {
55 | w := jwriter.Writer{}
56 | v.MarshalEasyJSON(&w)
57 | return w.Buffer.BuildBytes(), w.Error
58 | }
59 |
60 | // MarshalJSON implements a standard json marshaler interface.
61 | func (v *Float64) UnmarshalJSON(data []byte) error {
62 | l := jlexer.Lexer{}
63 | v.UnmarshalEasyJSON(&l)
64 | return l.Error()
65 | }
66 |
67 | // IsDefined returns whether the value is defined, a function is required so that it can
68 | // be used in an interface.
69 | func (v Float64) IsDefined() bool {
70 | return v.Defined
71 | }
72 |
73 | // String implements a stringer interface using fmt.Sprint for the value.
74 | func (v Float64) String() string {
75 | if !v.Defined {
76 | return ""
77 | }
78 | return fmt.Sprint(v.V)
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/serializer.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | type TSerializer struct {
23 | Transport *TMemoryBuffer
24 | Protocol TProtocol
25 | }
26 |
27 | type TStruct interface {
28 | Write(p TProtocol) error
29 | Read(p TProtocol) error
30 | }
31 |
32 | func NewTSerializer() *TSerializer {
33 | transport := NewTMemoryBufferLen(1024)
34 | protocol := NewTBinaryProtocolFactoryDefault().GetProtocol(transport)
35 |
36 | return &TSerializer{
37 | transport,
38 | protocol}
39 | }
40 |
41 | func (t *TSerializer) WriteString(msg TStruct) (s string, err error) {
42 | t.Transport.Reset()
43 |
44 | if err = msg.Write(t.Protocol); err != nil {
45 | return
46 | }
47 |
48 | if err = t.Protocol.Flush(); err != nil {
49 | return
50 | }
51 | if err = t.Transport.Flush(); err != nil {
52 | return
53 | }
54 |
55 | return t.Transport.String(), nil
56 | }
57 |
58 | func (t *TSerializer) Write(msg TStruct) (b []byte, err error) {
59 | t.Transport.Reset()
60 |
61 | if err = msg.Write(t.Protocol); err != nil {
62 | return
63 | }
64 |
65 | if err = t.Protocol.Flush(); err != nil {
66 | return
67 | }
68 |
69 | if err = t.Transport.Flush(); err != nil {
70 | return
71 | }
72 |
73 | b = append(b, t.Transport.Bytes()...)
74 | return
75 | }
76 |
--------------------------------------------------------------------------------
/vendor/github.com/gogo/protobuf/proto/Makefile:
--------------------------------------------------------------------------------
1 | # Go support for Protocol Buffers - Google's data interchange format
2 | #
3 | # Copyright 2010 The Go Authors. All rights reserved.
4 | # https://github.com/golang/protobuf
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | install:
33 | go install
34 |
35 | test: install generate-test-pbs
36 | go test
37 |
38 |
39 | generate-test-pbs:
40 | make install
41 | make -C testdata
42 | protoc-min-version --version="3.0.0" --proto_path=.:../../../../:../protobuf --gogo_out=Mtestdata/test.proto=github.com/gogo/protobuf/proto/testdata,Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types:. proto3_proto/proto3.proto
43 | make
44 |
--------------------------------------------------------------------------------
/vendor/github.com/gogo/protobuf/proto/text_gogo.go:
--------------------------------------------------------------------------------
1 | // Protocol Buffers for Go with Gadgets
2 | //
3 | // Copyright (c) 2013, The GoGo Authors. All rights reserved.
4 | // http://github.com/gogo/protobuf
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
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 |
29 | package proto
30 |
31 | import (
32 | "fmt"
33 | "reflect"
34 | )
35 |
36 | func (tm *TextMarshaler) writeEnum(w *textWriter, v reflect.Value, props *Properties) error {
37 | m, ok := enumStringMaps[props.Enum]
38 | if !ok {
39 | if err := tm.writeAny(w, v, props); err != nil {
40 | return err
41 | }
42 | }
43 | key := int32(0)
44 | if v.Kind() == reflect.Ptr {
45 | key = int32(v.Elem().Int())
46 | } else {
47 | key = int32(v.Int())
48 | }
49 | s, ok := m[key]
50 | if !ok {
51 | if err := tm.writeAny(w, v, props); err != nil {
52 | return err
53 | }
54 | }
55 | _, err := fmt.Fprint(w, s)
56 | return err
57 | }
58 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/internal/pathos/path_test.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 pathos
6 |
7 | import (
8 | "testing"
9 | )
10 |
11 | func TestTrimCommonSuffix(t *testing.T) {
12 | list := []struct {
13 | slash rune
14 | base, suffix string
15 | result, common string
16 | }{
17 | {slash: '/', base: "/a/b/c", suffix: "/x/y/b/c", result: "/a", common: "b/c"},
18 | {slash: '/', base: "/arg/borish/client", suffix: "fooish/client", result: "/arg/borish", common: "client"},
19 | {slash: '/', base: "/tmp/vendor_272718190/src/co2/go/pk1/", suffix: "co2/go/pk1", result: "/tmp/vendor_272718190/src", common: "co2/go/pk1"},
20 | {slash: '/', base: "/home/daniel/code/go/src/.cache/govendor/github.com/raphael/goa", suffix: "github.com/raphael/goa", result: "/home/daniel/code/go/src/.cache/govendor", common: "github.com/raphael/goa"},
21 | {slash: '\\', base: `d:\bob\alice\noob`, suffix: `c:\tmp\foo\alice\noob`, result: `d:\bob`, common: `alice\noob`},
22 | }
23 |
24 | for _, item := range list {
25 | slashSep = item.slash
26 | got, common := TrimCommonSuffix(item.base, item.suffix)
27 | if got != item.result || common != item.common {
28 | t.Errorf("For %#v got %q, common: %q", item, got, common)
29 | }
30 | }
31 | }
32 |
33 | func TestGoEnv(t *testing.T) {
34 | list := []struct {
35 | line string
36 | name string
37 | result string
38 | ok bool
39 | }{
40 | {`set GOROOT=C:\Foo\Bar`, "GOROOT", `C:\Foo\Bar`, true},
41 | {`set GOPATH=C:\Foo\Bar`, "GOROOT", ``, false},
42 | {`set GOROOT=`, "GOROOT", ``, true},
43 | {`GOROOT="/foo/bar"`, "GOROOT", `/foo/bar`, true},
44 | {`GOPATH="/foo/bar"`, "GOROOT", ``, false},
45 | {`GOROOT=""`, "GOROOT", ``, true},
46 | }
47 |
48 | for index, item := range list {
49 | result, ok := GoEnv(item.name, item.line)
50 | if ok != item.ok {
51 | t.Errorf("index %d line %#v expected ok %t but got %t", index, item, item.ok, ok)
52 | }
53 | if result != item.result {
54 | t.Errorf("index %d line %#v expected result %q but got %q", index, item, item.result, result)
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/pointerize.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | ///////////////////////////////////////////////////////////////////////////////
23 | // This file is home to helpers that convert from various base types to
24 | // respective pointer types. This is necessary because Go does not permit
25 | // references to constants, nor can a pointer type to base type be allocated
26 | // and initialized in a single expression.
27 | //
28 | // E.g., this is not allowed:
29 | //
30 | // var ip *int = &5
31 | //
32 | // But this *is* allowed:
33 | //
34 | // func IntPtr(i int) *int { return &i }
35 | // var ip *int = IntPtr(5)
36 | //
37 | // Since pointers to base types are commonplace as [optional] fields in
38 | // exported thrift structs, we factor such helpers here.
39 | ///////////////////////////////////////////////////////////////////////////////
40 |
41 | func Float32Ptr(v float32) *float32 { return &v }
42 | func Float64Ptr(v float64) *float64 { return &v }
43 | func IntPtr(v int) *int { return &v }
44 | func Int32Ptr(v int32) *int32 { return &v }
45 | func Int64Ptr(v int64) *int64 { return &v }
46 | func StringPtr(v string) *string { return &v }
47 | func Uint32Ptr(v uint32) *uint32 { return &v }
48 | func Uint64Ptr(v uint64) *uint64 { return &v }
49 | func BoolPtr(v bool) *bool { return &v }
50 | func ByteSlicePtr(v []byte) *[]byte { return &v }
51 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol_exception.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | import (
23 | "encoding/base64"
24 | )
25 |
26 | // Thrift Protocol exception
27 | type TProtocolException interface {
28 | TException
29 | TypeId() int
30 | }
31 |
32 | const (
33 | UNKNOWN_PROTOCOL_EXCEPTION = 0
34 | INVALID_DATA = 1
35 | NEGATIVE_SIZE = 2
36 | SIZE_LIMIT = 3
37 | BAD_VERSION = 4
38 | NOT_IMPLEMENTED = 5
39 | DEPTH_LIMIT = 6
40 | )
41 |
42 | type tProtocolException struct {
43 | typeId int
44 | message string
45 | }
46 |
47 | func (p *tProtocolException) TypeId() int {
48 | return p.typeId
49 | }
50 |
51 | func (p *tProtocolException) String() string {
52 | return p.message
53 | }
54 |
55 | func (p *tProtocolException) Error() string {
56 | return p.message
57 | }
58 |
59 | func NewTProtocolException(err error) TProtocolException {
60 | if err == nil {
61 | return nil
62 | }
63 | if e,ok := err.(TProtocolException); ok {
64 | return e
65 | }
66 | if _, ok := err.(base64.CorruptInputError); ok {
67 | return &tProtocolException{INVALID_DATA, err.Error()}
68 | }
69 | return &tProtocolException{UNKNOWN_PROTOCOL_EXCEPTION, err.Error()}
70 | }
71 |
72 | func NewTProtocolExceptionWithType(errType int, err error) TProtocolException {
73 | if err == nil {
74 | return nil
75 | }
76 | return &tProtocolException{errType, err.Error()}
77 | }
78 |
79 |
--------------------------------------------------------------------------------
/vendor/github.com/pquerna/ffjson/fflib/v1/bytenum.go:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014 Paul Querna
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 |
18 | /* Portions of this file are on Go stdlib's strconv/iota.go */
19 | // Copyright 2009 The Go Authors. All rights reserved.
20 | // Use of this source code is governed by a BSD-style
21 | // license that can be found in the LICENSE file.
22 |
23 | package v1
24 |
25 | import (
26 | "github.com/pquerna/ffjson/fflib/v1/internal"
27 | )
28 |
29 | func ParseFloat(s []byte, bitSize int) (f float64, err error) {
30 | return internal.ParseFloat(s, bitSize)
31 | }
32 |
33 | // ParseUint is like ParseInt but for unsigned numbers, and oeprating on []byte
34 | func ParseUint(s []byte, base int, bitSize int) (n uint64, err error) {
35 | if len(s) == 1 {
36 | switch s[0] {
37 | case '0':
38 | return 0, nil
39 | case '1':
40 | return 1, nil
41 | case '2':
42 | return 2, nil
43 | case '3':
44 | return 3, nil
45 | case '4':
46 | return 4, nil
47 | case '5':
48 | return 5, nil
49 | case '6':
50 | return 6, nil
51 | case '7':
52 | return 7, nil
53 | case '8':
54 | return 8, nil
55 | case '9':
56 | return 9, nil
57 | }
58 | }
59 | return internal.ParseUint(s, base, bitSize)
60 | }
61 |
62 | func ParseInt(s []byte, base int, bitSize int) (i int64, err error) {
63 | if len(s) == 1 {
64 | switch s[0] {
65 | case '0':
66 | return 0, nil
67 | case '1':
68 | return 1, nil
69 | case '2':
70 | return 2, nil
71 | case '3':
72 | return 3, nil
73 | case '4':
74 | return 4, nil
75 | case '5':
76 | return 5, nil
77 | case '6':
78 | return 6, nil
79 | case '7':
80 | return 7, nil
81 | case '8':
82 | return 8, nil
83 | case '9':
84 | return 9, nil
85 | }
86 | }
87 | return internal.ParseInt(s, base, bitSize)
88 | }
89 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/migrate/glock.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 migrate
6 |
7 | import (
8 | "io/ioutil"
9 | "os"
10 | "path/filepath"
11 | "strings"
12 |
13 | "github.com/kardianos/govendor/context"
14 | "github.com/kardianos/govendor/pkgspec"
15 | )
16 |
17 | func init() {
18 | register("glock", sysGlock{})
19 | }
20 |
21 | type sysGlock struct{}
22 |
23 | func (sys sysGlock) Check(root string) (system, error) {
24 | if hasFiles(root, "GLOCKFILE") {
25 | return sys, nil
26 | }
27 | return nil, nil
28 | }
29 | func (sysGlock) Migrate(root string) error {
30 | err := os.MkdirAll(filepath.Join(root, "vendor"), 0777)
31 | if err != nil {
32 | return err
33 | }
34 | filebytes, err := ioutil.ReadFile(filepath.Join(root, "GLOCKFILE"))
35 | if err != nil {
36 | return err
37 | }
38 | lines := strings.Split(string(filebytes), "\n")
39 | for i, l := range lines {
40 | lines[i] = strings.TrimSpace(l)
41 | }
42 |
43 | /*
44 | vf := &vendorfile.File{}
45 | vf.Package = make([]*vendorfile.Package, 0, len(lines))
46 | */
47 | ctx, err := context.NewContext(root, filepath.Join("vendor", "vendor.json"), "vendor", false)
48 | if err != nil {
49 | return err
50 | }
51 |
52 | const cmdPrefix = "cmd "
53 |
54 | for _, l := range lines {
55 | if len(l) == 0 {
56 | continue
57 | }
58 | isCmd := strings.HasPrefix(l, cmdPrefix)
59 | if isCmd {
60 | continue
61 | }
62 | field := strings.Fields(l)
63 | if len(field) < 2 {
64 | continue
65 | }
66 | ps, err := pkgspec.Parse("", field[0]+"@"+field[1])
67 | if err != nil {
68 | return err
69 | }
70 | ps.IncludeTree = true
71 | err = ctx.ModifyImport(ps, context.Fetch)
72 | if err != nil {
73 | return err
74 | }
75 | }
76 | for _, l := range lines {
77 | if len(l) == 0 {
78 | continue
79 | }
80 | isCmd := strings.HasPrefix(l, cmdPrefix)
81 | if !isCmd {
82 | continue
83 | }
84 | path := strings.TrimPrefix(l, cmdPrefix)
85 | ps, err := pkgspec.Parse("", path)
86 | if err != nil {
87 | return err
88 | }
89 | err = ctx.ModifyImport(ps, context.Fetch)
90 | if err != nil {
91 | return err
92 | }
93 | }
94 | err = ctx.WriteVendorFile()
95 | os.Remove(filepath.Join(root, "GLOCKFILE"))
96 | return err
97 | }
98 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/memory_buffer.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | import (
23 | "bytes"
24 | )
25 |
26 | // Memory buffer-based implementation of the TTransport interface.
27 | type TMemoryBuffer struct {
28 | *bytes.Buffer
29 | size int
30 | }
31 |
32 | type TMemoryBufferTransportFactory struct {
33 | size int
34 | }
35 |
36 | func (p *TMemoryBufferTransportFactory) GetTransport(trans TTransport) TTransport {
37 | if trans != nil {
38 | t, ok := trans.(*TMemoryBuffer)
39 | if ok && t.size > 0 {
40 | return NewTMemoryBufferLen(t.size)
41 | }
42 | }
43 | return NewTMemoryBufferLen(p.size)
44 | }
45 |
46 | func NewTMemoryBufferTransportFactory(size int) *TMemoryBufferTransportFactory {
47 | return &TMemoryBufferTransportFactory{size: size}
48 | }
49 |
50 | func NewTMemoryBuffer() *TMemoryBuffer {
51 | return &TMemoryBuffer{Buffer: &bytes.Buffer{}, size: 0}
52 | }
53 |
54 | func NewTMemoryBufferLen(size int) *TMemoryBuffer {
55 | buf := make([]byte, 0, size)
56 | return &TMemoryBuffer{Buffer: bytes.NewBuffer(buf), size: size}
57 | }
58 |
59 | func (p *TMemoryBuffer) IsOpen() bool {
60 | return true
61 | }
62 |
63 | func (p *TMemoryBuffer) Open() error {
64 | return nil
65 | }
66 |
67 | func (p *TMemoryBuffer) Close() error {
68 | p.Buffer.Reset()
69 | return nil
70 | }
71 |
72 | // Flushing a memory buffer is a no-op
73 | func (p *TMemoryBuffer) Flush() error {
74 | return nil
75 | }
76 |
77 | func (p *TMemoryBuffer) RemainingBytes() (num_bytes uint64) {
78 | return uint64(p.Buffer.Len())
79 | }
80 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/doc/dev-guide.md:
--------------------------------------------------------------------------------
1 | # Go Developer Guide
2 |
3 | * Always check-in the "vendor/vendor.json" file
4 | * Do not check-in vendor sources if you expect an external package to import it.
5 | * Do check-in vendor sources for main packages.
6 | * Main packages should vendor their own common dependencies.
7 | * Release with semver, do not break compatibility within a major version.
8 | * If you choose to release with tags or branches, keep them up-to-date.
9 |
10 | ## Always check in the "vendor/vendor.json" file
11 |
12 | You can add the ignore rule `vendor/*/` to ignore source files.
13 | This way a consumer of your package has a chance at reproducing your package tests
14 | if something appears to break later.
15 |
16 |
17 | ## Do not check-in vendor sources if you expect an external package to import it
18 |
19 | The way `go get` currently works is to download repositories into $GOPATH without
20 | modification. This is fine, but if a "library" repository contains a vendor folder,
21 | it is likely it will be unable to be used unless the consumers also vendor
22 | the dependencies.
23 |
24 | ## Do check-in vendor sources for main packages
25 |
26 | Reproducible builds are important. Repositories can and do disappear.
27 | Pull them into your own repository under the vendor folder. Your
28 | maintainers 15 years from now will thank you.
29 |
30 | ## Release with semver, do not break compatibility within a major version
31 |
32 | Release with semver: `v..[-]`.
33 |
34 | * Increment major: break existing API.
35 | * Increment minor: add API, no breaks to existing API.
36 | * Increment patch: no api changes, bug fixes.
37 | * Tag pre-release: use to prepare for a later release with the same numbers.
38 |
39 | `govendor` will also handle path prefixes, for example `ssh-v1.0.2-beta1`
40 | can be used in govendor with `govendor fetch my/util/ssh@ssh-v1`.
41 |
42 |
43 | ## If you choose to release with tags or branches, keep them up-to-date
44 |
45 | It is completely plausible to do work in branches, then only merge the branch
46 | to master when the branch is stable. This effectively releases software.
47 |
48 | If you choose to also tag revisions or release to a dedicated branch (like a
49 | branch named "v1"), ensure HEAD never gets too far ahead of the release.
50 | If it does so it renders the release obsolete and it stops being used.
51 |
52 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/internal/vfilepath/walk.go:
--------------------------------------------------------------------------------
1 | package vfilepath
2 |
3 | import (
4 | "path/filepath"
5 | "sort"
6 |
7 | os "github.com/kardianos/govendor/internal/vos"
8 | )
9 |
10 | // SkipDir is used as a return value from WalkFuncs to indicate that
11 | // the directory named in the call is to be skipped. It is not returned
12 | // as an error by any function.
13 | var SkipDir = filepath.SkipDir
14 |
15 | type WalkFunc func(path string, info os.FileInfo, err error) error
16 |
17 | // walk recursively descends path, calling w.
18 | func walk(path string, info os.FileInfo, walkFn WalkFunc) error {
19 | err := walkFn(path, info, nil)
20 | if err != nil {
21 | if info.IsDir() && err == SkipDir {
22 | return nil
23 | }
24 | return err
25 | }
26 |
27 | if !info.IsDir() {
28 | return nil
29 | }
30 |
31 | names, err := readDirNames(path)
32 | if err != nil {
33 | return walkFn(path, info, err)
34 | }
35 |
36 | for _, name := range names {
37 | filename := filepath.Join(path, name)
38 | fileInfo, err := os.Lstat(filename)
39 | if err != nil {
40 | if err := walkFn(filename, fileInfo, err); err != nil && err != SkipDir {
41 | return err
42 | }
43 | } else {
44 | err = walk(filename, fileInfo, walkFn)
45 | if err != nil {
46 | if !fileInfo.IsDir() || err != SkipDir {
47 | return err
48 | }
49 | }
50 | }
51 | }
52 | return nil
53 | }
54 |
55 | // readDirNames reads the directory named by dirname and returns
56 | // a sorted list of directory entries.
57 | func readDirNames(dirname string) ([]string, error) {
58 | f, err := os.Open(dirname)
59 | if err != nil {
60 | return nil, err
61 | }
62 | names, err := f.Readdirnames(-1)
63 | f.Close()
64 | if err != nil {
65 | return nil, err
66 | }
67 | sort.Strings(names)
68 | return names, nil
69 | }
70 |
71 | // Walk walks the file tree rooted at root, calling walkFn for each file or
72 | // directory in the tree, including root. All errors that arise visiting files
73 | // and directories are filtered by walkFn. The files are walked in lexical
74 | // order, which makes the output deterministic but means that for very
75 | // large directories Walk can be inefficient.
76 | // Walk does not follow symbolic links.
77 | func Walk(root string, walkFn WalkFunc) error {
78 | info, err := os.Lstat(root)
79 | if err != nil {
80 | return walkFn(root, nil, err)
81 | }
82 | return walk(root, info, walkFn)
83 | }
84 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/golang.org/x/tools/go/vcs/http.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package vcs
6 |
7 | import (
8 | "fmt"
9 | "io"
10 | "io/ioutil"
11 | "log"
12 | "net/http"
13 | "net/url"
14 | )
15 |
16 | // httpClient is the default HTTP client, but a variable so it can be
17 | // changed by tests, without modifying http.DefaultClient.
18 | var httpClient = http.DefaultClient
19 |
20 | // httpGET returns the data from an HTTP GET request for the given URL.
21 | func httpGET(url string) ([]byte, error) {
22 | resp, err := httpClient.Get(url)
23 | if err != nil {
24 | return nil, err
25 | }
26 | defer resp.Body.Close()
27 | if resp.StatusCode != 200 {
28 | return nil, fmt.Errorf("%s: %s", url, resp.Status)
29 | }
30 | b, err := ioutil.ReadAll(resp.Body)
31 | if err != nil {
32 | return nil, fmt.Errorf("%s: %v", url, err)
33 | }
34 | return b, nil
35 | }
36 |
37 | // httpsOrHTTP returns the body of either the importPath's
38 | // https resource or, if unavailable, the http resource.
39 | func httpsOrHTTP(importPath string) (urlStr string, body io.ReadCloser, err error) {
40 | fetch := func(scheme string) (urlStr string, res *http.Response, err error) {
41 | u, err := url.Parse(scheme + "://" + importPath)
42 | if err != nil {
43 | return "", nil, err
44 | }
45 | u.RawQuery = "go-get=1"
46 | urlStr = u.String()
47 | if Verbose {
48 | log.Printf("Fetching %s", urlStr)
49 | }
50 | res, err = httpClient.Get(urlStr)
51 | return
52 | }
53 | closeBody := func(res *http.Response) {
54 | if res != nil {
55 | res.Body.Close()
56 | }
57 | }
58 | urlStr, res, err := fetch("https")
59 | if err != nil || res.StatusCode != 200 {
60 | if Verbose {
61 | if err != nil {
62 | log.Printf("https fetch failed.")
63 | } else {
64 | log.Printf("ignoring https fetch with status code %d", res.StatusCode)
65 | }
66 | }
67 | closeBody(res)
68 | urlStr, res, err = fetch("http")
69 | }
70 | if err != nil {
71 | closeBody(res)
72 | return "", nil, err
73 | }
74 | // Note: accepting a non-200 OK here, so people can serve a
75 | // meta import in their http 404 page.
76 | if Verbose {
77 | log.Printf("Parsing meta tags from %s (status code %d)", urlStr, res.StatusCode)
78 | }
79 | return urlStr, res.Body, nil
80 | }
81 |
--------------------------------------------------------------------------------
/src/github.com/json-iterator/go-benchmark/benchmark_small_payload_test.go:
--------------------------------------------------------------------------------
1 | package go_benchmark
2 |
3 | import (
4 | "testing"
5 | "github.com/buger/jsonparser"
6 | "github.com/json-iterator/go"
7 | "encoding/json"
8 | "github.com/mailru/easyjson/jlexer"
9 | )
10 |
11 | func BenchmarkJsonParserSmall(b *testing.B) {
12 | b.ReportAllocs()
13 | paths := [][]string{
14 | []string{"uuid"},
15 | []string{"tz"},
16 | []string{"ua"},
17 | []string{"st"},
18 | }
19 |
20 | b.ResetTimer()
21 | for i := 0; i < b.N; i++ {
22 | var data SmallPayload
23 |
24 | jsonparser.EachKey(smallFixture, func(idx int, value []byte, vt jsonparser.ValueType, err error) {
25 | switch idx {
26 | case 0:
27 | data.Uuid, _ = jsonparser.ParseString(value)
28 | case 1:
29 | v, _ := jsonparser.ParseInt(value)
30 | data.Tz = int(v)
31 | case 2:
32 | data.Ua, _ = jsonparser.ParseString(value)
33 | case 3:
34 | v, _ := jsonparser.ParseInt(value)
35 | data.St = int(v)
36 | }
37 | }, paths...)
38 |
39 | }
40 | }
41 |
42 | func BenchmarkJsnoiterPullSmall(b *testing.B) {
43 | b.ReportAllocs()
44 | iter := jsoniter.ParseBytes(smallFixture)
45 | b.ResetTimer()
46 | for i := 0; i < b.N; i++ {
47 | var data SmallPayload
48 | iter.ResetBytes(smallFixture)
49 | for field := iter.ReadObject(); field != ""; field = iter.ReadObject() {
50 | switch field {
51 | case "uuid":
52 | data.Uuid = iter.ReadString()
53 | case "tz":
54 | data.Tz = iter.ReadInt()
55 | case "ua":
56 | data.Ua = iter.ReadString()
57 | case "st":
58 | data.St = iter.ReadInt()
59 | default:
60 | iter.Skip()
61 | }
62 | }
63 | }
64 | }
65 |
66 | func BenchmarkJsnoiterReflectSmall(b *testing.B) {
67 | iter := jsoniter.ParseBytes(smallFixture)
68 | b.ReportAllocs()
69 | b.ResetTimer()
70 | for i := 0; i < b.N; i++ {
71 | var data SmallPayload
72 | iter.ResetBytes(smallFixture)
73 | jsoniter.Unmarshal(smallFixture, &data)
74 | }
75 | }
76 |
77 | /*
78 | encoding/json
79 | */
80 | func BenchmarkEncodingJsonStructSmall(b *testing.B) {
81 | b.ReportAllocs()
82 | for i := 0; i < b.N; i++ {
83 | var data SmallPayload
84 | json.Unmarshal(smallFixture, &data)
85 | }
86 | }
87 |
88 | func BenchmarkEasyJsonSmall(b *testing.B) {
89 | b.ReportAllocs()
90 | for i := 0; i < b.N; i++ {
91 | lexer := &jlexer.Lexer{Data: smallFixture}
92 | data := new(SmallPayload)
93 | data.UnmarshalEasyJSON(lexer)
94 | }
95 | }
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/context/err.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 context
6 |
7 | import (
8 | "errors"
9 | "fmt"
10 | )
11 |
12 | var (
13 | // ErrMissingGOROOT returns if the GOROOT was not found.
14 | ErrMissingGOROOT = errors.New("Unable to determine GOROOT.")
15 | // ErrMissingGOPATH returns if no GOPATH was found.
16 | ErrMissingGOPATH = errors.New("Missing GOPATH. Check your environment variable GOPATH.")
17 | )
18 |
19 | // ErrNotInGOPATH returns if not currently in the GOPATH.
20 | type ErrNotInGOPATH struct {
21 | Missing string
22 | }
23 |
24 | func (err ErrNotInGOPATH) Error() string {
25 | return fmt.Sprintf("Package %q not a go package or not in GOPATH.", err.Missing)
26 | }
27 |
28 | // ErrDirtyPackage returns if package is in dirty version control.
29 | type ErrDirtyPackage struct {
30 | ImportPath string
31 | }
32 |
33 | func (err ErrDirtyPackage) Error() string {
34 | return fmt.Sprintf("Package %q has uncommitted changes in the vcs.", err.ImportPath)
35 | }
36 |
37 | // ErrPackageExists returns if package already exists.
38 | type ErrPackageExists struct {
39 | Package string
40 | }
41 |
42 | func (err ErrPackageExists) Error() string {
43 | return fmt.Sprintf("Package %q already in vendor.", err.Package)
44 | }
45 |
46 | // ErrMissingVendorFile returns if package already exists.
47 | type ErrMissingVendorFile struct {
48 | Path string
49 | }
50 |
51 | func (err ErrMissingVendorFile) Error() string {
52 | return fmt.Sprintf("Vendor file at %q not found.", err.Path)
53 | }
54 |
55 | // ErrOldVersion returns if vendor file is not in the vendor folder.
56 | type ErrOldVersion struct {
57 | Message string
58 | }
59 |
60 | func (err ErrOldVersion) Error() string {
61 | return fmt.Sprintf("The vendor file or is old. %s", err.Message)
62 | }
63 |
64 | type ErrTreeChildren struct {
65 | path string
66 | children []*Package
67 | }
68 |
69 | func (err ErrTreeChildren) Error() string {
70 | return fmt.Sprintf("Cannot have a sub-tree %q contain sub-packages %q", err.path, err.children)
71 | }
72 |
73 | type ErrTreeParents struct {
74 | path string
75 | parents []string
76 | }
77 |
78 | func (err ErrTreeParents) Error() string {
79 | return fmt.Sprintf("Cannot add package %q which is already found in sub-tree %q", err.path, err.parents)
80 | }
81 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/pkg/errors/README.md:
--------------------------------------------------------------------------------
1 | # errors [](https://travis-ci.org/pkg/errors) [](https://ci.appveyor.com/project/davecheney/errors/branch/master) [](http://godoc.org/github.com/pkg/errors) [](https://goreportcard.com/report/github.com/pkg/errors)
2 |
3 | Package errors provides simple error handling primitives.
4 |
5 | The traditional error handling idiom in Go is roughly akin to
6 | ```go
7 | if err != nil {
8 | return err
9 | }
10 | ```
11 | which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error.
12 |
13 | ## Adding context to an error
14 |
15 | The errors.Wrap function returns a new error that adds context to the original error. For example
16 | ```go
17 | _, err := ioutil.ReadAll(r)
18 | if err != nil {
19 | return errors.Wrap(err, "read failed")
20 | }
21 | ```
22 | ## Retrieving the cause of an error
23 |
24 | Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`.
25 | ```go
26 | type causer interface {
27 | Cause() error
28 | }
29 | ```
30 | `errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example:
31 | ```go
32 | switch err := errors.Cause(err).(type) {
33 | case *MyError:
34 | // handle specifically
35 | default:
36 | // unknown error
37 | }
38 | ```
39 |
40 | [Read the package documentation for more information](https://godoc.org/github.com/pkg/errors).
41 |
42 | ## Contributing
43 |
44 | We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high.
45 |
46 | Before proposing a change, please discuss your change by raising an issue.
47 |
48 | ## Licence
49 |
50 | BSD-2-Clause
51 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/transport_exception.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | import (
23 | "errors"
24 | "io"
25 | )
26 |
27 | type timeoutable interface {
28 | Timeout() bool
29 | }
30 |
31 | // Thrift Transport exception
32 | type TTransportException interface {
33 | TException
34 | TypeId() int
35 | Err() error
36 | }
37 |
38 | const (
39 | UNKNOWN_TRANSPORT_EXCEPTION = 0
40 | NOT_OPEN = 1
41 | ALREADY_OPEN = 2
42 | TIMED_OUT = 3
43 | END_OF_FILE = 4
44 | )
45 |
46 | type tTransportException struct {
47 | typeId int
48 | err error
49 | }
50 |
51 | func (p *tTransportException) TypeId() int {
52 | return p.typeId
53 | }
54 |
55 | func (p *tTransportException) Error() string {
56 | return p.err.Error()
57 | }
58 |
59 | func (p *tTransportException) Err() error {
60 | return p.err
61 | }
62 |
63 | func NewTTransportException(t int, e string) TTransportException {
64 | return &tTransportException{typeId: t, err: errors.New(e)}
65 | }
66 |
67 | func NewTTransportExceptionFromError(e error) TTransportException {
68 | if e == nil {
69 | return nil
70 | }
71 |
72 | if t, ok := e.(TTransportException); ok {
73 | return t
74 | }
75 |
76 | switch v := e.(type) {
77 | case TTransportException:
78 | return v
79 | case timeoutable:
80 | if v.Timeout() {
81 | return &tTransportException{typeId: TIMED_OUT, err: e}
82 | }
83 | }
84 |
85 | if e == io.EOF {
86 | return &tTransportException{typeId: END_OF_FILE, err: e}
87 | }
88 |
89 | return &tTransportException{typeId: UNKNOWN_TRANSPORT_EXCEPTION, err: e}
90 | }
91 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/golang.org/x/tools/go/vcs/discovery.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package vcs
6 |
7 | import (
8 | "encoding/xml"
9 | "fmt"
10 | "io"
11 | "strings"
12 | )
13 |
14 | // charsetReader returns a reader for the given charset. Currently
15 | // it only supports UTF-8 and ASCII. Otherwise, it returns a meaningful
16 | // error which is printed by go get, so the user can find why the package
17 | // wasn't downloaded if the encoding is not supported. Note that, in
18 | // order to reduce potential errors, ASCII is treated as UTF-8 (i.e. characters
19 | // greater than 0x7f are not rejected).
20 | func charsetReader(charset string, input io.Reader) (io.Reader, error) {
21 | switch strings.ToLower(charset) {
22 | case "ascii":
23 | return input, nil
24 | default:
25 | return nil, fmt.Errorf("can't decode XML document using charset %q", charset)
26 | }
27 | }
28 |
29 | // parseMetaGoImports returns meta imports from the HTML in r.
30 | // Parsing ends at the end of the section or the beginning of the .
31 | func parseMetaGoImports(r io.Reader) (imports []metaImport, err error) {
32 | d := xml.NewDecoder(r)
33 | d.CharsetReader = charsetReader
34 | d.Strict = false
35 | var t xml.Token
36 | for {
37 | t, err = d.Token()
38 | if err != nil {
39 | if err == io.EOF || len(imports) > 0 {
40 | err = nil
41 | }
42 | return
43 | }
44 | if e, ok := t.(xml.StartElement); ok && strings.EqualFold(e.Name.Local, "body") {
45 | return
46 | }
47 | if e, ok := t.(xml.EndElement); ok && strings.EqualFold(e.Name.Local, "head") {
48 | return
49 | }
50 | e, ok := t.(xml.StartElement)
51 | if !ok || !strings.EqualFold(e.Name.Local, "meta") {
52 | continue
53 | }
54 | if attrValue(e.Attr, "name") != "go-import" {
55 | continue
56 | }
57 | if f := strings.Fields(attrValue(e.Attr, "content")); len(f) == 3 {
58 | imports = append(imports, metaImport{
59 | Prefix: f[0],
60 | VCS: f[1],
61 | RepoRoot: f[2],
62 | })
63 | }
64 | }
65 | }
66 |
67 | // attrValue returns the attribute value for the case-insensitive key
68 | // `name', or the empty string if nothing is found.
69 | func attrValue(attrs []xml.Attr, name string) string {
70 | for _, a := range attrs {
71 | if strings.EqualFold(a.Name.Local, name) {
72 | return a.Value
73 | }
74 | }
75 | return ""
76 | }
77 |
--------------------------------------------------------------------------------
/vendor/github.com/mailru/easyjson/helpers.go:
--------------------------------------------------------------------------------
1 | // Package easyjson contains marshaler/unmarshaler interfaces and helper functions.
2 | package easyjson
3 |
4 | import (
5 | "io"
6 | "io/ioutil"
7 | "net/http"
8 | "strconv"
9 |
10 | "github.com/mailru/easyjson/jlexer"
11 | "github.com/mailru/easyjson/jwriter"
12 | )
13 |
14 | // Marshaler is an easyjson-compatible marshaler interface.
15 | type Marshaler interface {
16 | MarshalEasyJSON(w *jwriter.Writer)
17 | }
18 |
19 | // Marshaler is an easyjson-compatible unmarshaler interface.
20 | type Unmarshaler interface {
21 | UnmarshalEasyJSON(w *jlexer.Lexer)
22 | }
23 |
24 | // Optional defines an undefined-test method for a type to integrate with 'omitempty' logic.
25 | type Optional interface {
26 | IsDefined() bool
27 | }
28 |
29 | // Marshal returns data as a single byte slice. Method is suboptimal as the data is likely to be copied
30 | // from a chain of smaller chunks.
31 | func Marshal(v Marshaler) ([]byte, error) {
32 | w := jwriter.Writer{}
33 | v.MarshalEasyJSON(&w)
34 | return w.BuildBytes()
35 | }
36 |
37 | // MarshalToWriter marshals the data to an io.Writer.
38 | func MarshalToWriter(v Marshaler, w io.Writer) (written int, err error) {
39 | jw := jwriter.Writer{}
40 | v.MarshalEasyJSON(&jw)
41 | return jw.DumpTo(w)
42 | }
43 |
44 | // MarshalToHTTPResponseWriter sets Content-Length and Content-Type headers for the
45 | // http.ResponseWriter, and send the data to the writer. started will be equal to
46 | // false if an error occurred before any http.ResponseWriter methods were actually
47 | // invoked (in this case a 500 reply is possible).
48 | func MarshalToHTTPResponseWriter(v Marshaler, w http.ResponseWriter) (started bool, written int, err error) {
49 | jw := jwriter.Writer{}
50 | v.MarshalEasyJSON(&jw)
51 | if jw.Error != nil {
52 | return false, 0, jw.Error
53 | }
54 | w.Header().Set("Content-Type", "application/json")
55 | w.Header().Set("Content-Length", strconv.Itoa(jw.Size()))
56 |
57 | started = true
58 | written, err = jw.DumpTo(w)
59 | return
60 | }
61 |
62 | // Unmarshal decodes the JSON in data into the object.
63 | func Unmarshal(data []byte, v Unmarshaler) error {
64 | l := jlexer.Lexer{Data: data}
65 | v.UnmarshalEasyJSON(&l)
66 | return l.Error()
67 | }
68 |
69 | // UnmarshalFromReader reads all the data in the reader and decodes as JSON into the object.
70 | func UnmarshalFromReader(r io.Reader, v Unmarshaler) error {
71 | data, err := ioutil.ReadAll(r)
72 | if err != nil {
73 | return err
74 | }
75 | l := jlexer.Lexer{Data: data}
76 | v.UnmarshalEasyJSON(&l)
77 | return l.Error()
78 | }
79 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/vendor/github.com/Bowery/prompt/prompt.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013-2015 Bowery, Inc.
2 |
3 | // Package prompt implements a cross platform line-editing prompt. It also
4 | // provides routines to use ANSI escape sequences across platforms for
5 | // terminal connected io.Readers/io.Writers.
6 | //
7 | // If os.Stdin isn't connected to a terminal or (on Unix)if the terminal
8 | // doesn't support the ANSI escape sequences needed a fallback prompt is
9 | // provided that doesn't do line-editing. Unix terminals that are not supported
10 | // will have the TERM environment variable set to either "dumb" or "cons25".
11 | //
12 | // The keyboard shortcuts are similar to those found in the Readline library:
13 | //
14 | // - Enter / CTRL+D
15 | // - End the line.
16 | // - CTRL+C
17 | // - End the line, return error `ErrCTRLC`.
18 | // - Backspace
19 | // - Remove the character to the left.
20 | // - CTRL+L
21 | // - Clear the screen(keeping the current lines content).
22 | // - Home / End
23 | // - Jump to the beginning/end of the line.
24 | // - Up arrow / Down arrow
25 | // - Go back and forward in the history.
26 | // - Left arrow / Right arrow
27 | // - Move left/right one character.
28 | // - Delete
29 | // - Remove the character to the right.
30 | package prompt
31 |
32 | // Basic is a wrapper around Terminal.Basic.
33 | func Basic(prefix string, required bool) (string, error) {
34 | term, err := NewTerminal()
35 | if err != nil {
36 | return "", err
37 | }
38 | defer term.Close()
39 |
40 | return term.Basic(prefix, required)
41 | }
42 |
43 | // BasicDefault is a wrapper around Terminal.BasicDefault.
44 | func BasicDefault(prefix, def string) (string, error) {
45 | term, err := NewTerminal()
46 | if err != nil {
47 | return "", err
48 | }
49 | defer term.Close()
50 |
51 | return term.BasicDefault(prefix, def)
52 | }
53 |
54 | // Ask is a wrapper around Terminal.Ask.
55 | func Ask(question string) (bool, error) {
56 | term, err := NewTerminal()
57 | if err != nil {
58 | return false, err
59 | }
60 | defer term.Close()
61 |
62 | return term.Ask(question)
63 | }
64 |
65 | // Custom is a wrapper around Terminal.Custom.
66 | func Custom(prefix string, test func(string) (string, bool)) (string, error) {
67 | term, err := NewTerminal()
68 | if err != nil {
69 | return "", err
70 | }
71 | defer term.Close()
72 |
73 | return term.Custom(prefix, test)
74 | }
75 |
76 | // Password is a wrapper around Terminal.Password.
77 | func Password(prefix string) (string, error) {
78 | term, err := NewTerminal()
79 | if err != nil {
80 | return "", err
81 | }
82 | defer term.Close()
83 |
84 | return term.Password(prefix)
85 | }
86 |
--------------------------------------------------------------------------------
/govendor/src/github.com/kardianos/govendor/context/get.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 context
6 |
7 | import (
8 | "fmt"
9 | "io"
10 | "os"
11 | "path/filepath"
12 |
13 | "github.com/kardianos/govendor/pkgspec"
14 | "golang.org/x/tools/go/vcs"
15 | )
16 |
17 | func Get(logger io.Writer, pkgspecName string, insecure bool) error {
18 | // Get the GOPATHs.
19 | all := os.Getenv("GOPATH")
20 | if len(all) == 0 {
21 | return ErrMissingGOPATH
22 | }
23 | gopathList := filepath.SplitList(all)
24 | gopath := gopathList[0]
25 |
26 | cwd, err := os.Getwd()
27 | if err != nil {
28 | return err
29 | }
30 | ps, err := pkgspec.Parse(cwd, pkgspecName)
31 | if err != nil {
32 | return err
33 | }
34 | return get(logger, filepath.Join(gopath, "src"), ps, insecure)
35 | }
36 |
37 | func get(logger io.Writer, gopath string, ps *pkgspec.Pkg, insecure bool) error {
38 | pkgDir := filepath.Join(gopath, ps.Path)
39 | sysVcsCmd, repoRoot, err := vcs.FromDir(pkgDir, gopath)
40 | var vcsCmd *VCSCmd
41 | repoRootDir := filepath.Join(gopath, repoRoot)
42 | if err != nil {
43 | rr, err := vcs.RepoRootForImportPath(ps.PathOrigin(), false)
44 | if err != nil {
45 | return err
46 | }
47 | if !insecure && !vcsIsSecure(rr.Repo) {
48 | return fmt.Errorf("repo remote not secure")
49 | }
50 |
51 | vcsCmd = updateVcsCmd(rr.VCS)
52 | repoRoot = rr.Root
53 | repoRootDir = filepath.Join(gopath, repoRoot)
54 |
55 | err = vcsCmd.Create(repoRootDir, rr.Repo)
56 | if err != nil {
57 | return fmt.Errorf("failed to create repo %q in %q %v", rr.Repo, repoRootDir, err)
58 | }
59 |
60 | } else {
61 | vcsCmd = updateVcsCmd(sysVcsCmd)
62 | err = vcsCmd.Download(repoRootDir)
63 | if err != nil {
64 | return fmt.Errorf("failed to download repo into %q %v", repoRootDir, err)
65 | }
66 | }
67 | err = os.MkdirAll(filepath.Join(repoRootDir, "vendor"), 0777)
68 | if err != nil {
69 | return err
70 | }
71 | ctx, err := NewContext(repoRootDir, filepath.Join("vendor", vendorFilename), "vendor", false)
72 | if err != nil {
73 | return err
74 | }
75 | ctx.Insecure = insecure
76 | ctx.Logger = logger
77 | statusList, err := ctx.Status()
78 | if err != nil {
79 | return err
80 | }
81 | added := make(map[string]bool, len(statusList))
82 | for _, item := range statusList {
83 | switch item.Status.Location {
84 | case LocationExternal, LocationNotFound:
85 | if added[item.Pkg.Path] {
86 | continue
87 | }
88 | ctx.ModifyImport(item.Pkg, Fetch)
89 | added[item.Pkg.Path] = true
90 | }
91 | }
92 | defer ctx.WriteVendorFile()
93 | return ctx.Alter()
94 | }
95 |
--------------------------------------------------------------------------------
/vendor/git.apache.org/thrift.git/lib/go/thrift/buffered_transport.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package thrift
21 |
22 | import (
23 | "bufio"
24 | )
25 |
26 | type TBufferedTransportFactory struct {
27 | size int
28 | }
29 |
30 | type TBufferedTransport struct {
31 | bufio.ReadWriter
32 | tp TTransport
33 | }
34 |
35 | func (p *TBufferedTransportFactory) GetTransport(trans TTransport) TTransport {
36 | return NewTBufferedTransport(trans, p.size)
37 | }
38 |
39 | func NewTBufferedTransportFactory(bufferSize int) *TBufferedTransportFactory {
40 | return &TBufferedTransportFactory{size: bufferSize}
41 | }
42 |
43 | func NewTBufferedTransport(trans TTransport, bufferSize int) *TBufferedTransport {
44 | return &TBufferedTransport{
45 | ReadWriter: bufio.ReadWriter{
46 | Reader: bufio.NewReaderSize(trans, bufferSize),
47 | Writer: bufio.NewWriterSize(trans, bufferSize),
48 | },
49 | tp: trans,
50 | }
51 | }
52 |
53 | func (p *TBufferedTransport) IsOpen() bool {
54 | return p.tp.IsOpen()
55 | }
56 |
57 | func (p *TBufferedTransport) Open() (err error) {
58 | return p.tp.Open()
59 | }
60 |
61 | func (p *TBufferedTransport) Close() (err error) {
62 | return p.tp.Close()
63 | }
64 |
65 | func (p *TBufferedTransport) Read(b []byte) (int, error) {
66 | n, err := p.ReadWriter.Read(b)
67 | if err != nil {
68 | p.ReadWriter.Reader.Reset(p.tp)
69 | }
70 | return n, err
71 | }
72 |
73 | func (p *TBufferedTransport) Write(b []byte) (int, error) {
74 | n, err := p.ReadWriter.Write(b)
75 | if err != nil {
76 | p.ReadWriter.Writer.Reset(p.tp)
77 | }
78 | return n, err
79 | }
80 |
81 | func (p *TBufferedTransport) Flush() error {
82 | if err := p.ReadWriter.Flush(); err != nil {
83 | p.ReadWriter.Writer.Reset(p.tp)
84 | return err
85 | }
86 | return p.tp.Flush()
87 | }
88 |
89 | func (p *TBufferedTransport) RemainingBytes() (num_bytes uint64) {
90 | return p.tp.RemainingBytes()
91 | }
92 |
--------------------------------------------------------------------------------