├── LICENSE ├── README.md ├── cmd └── csvql │ └── main.go ├── csvql.go ├── go.mod ├── go.sum ├── testdata ├── cities.csv └── people.csv └── vendor ├── github.com ├── golang │ └── protobuf │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── proto │ │ ├── clone.go │ │ ├── decode.go │ │ ├── discard.go │ │ ├── encode.go │ │ ├── equal.go │ │ ├── extensions.go │ │ ├── lib.go │ │ ├── message_set.go │ │ ├── pointer_reflect.go │ │ ├── pointer_unsafe.go │ │ ├── properties.go │ │ ├── table_marshal.go │ │ ├── table_merge.go │ │ ├── table_unmarshal.go │ │ ├── text.go │ │ └── text_parser.go │ │ └── ptypes │ │ ├── any.go │ │ ├── any │ │ ├── any.pb.go │ │ └── any.proto │ │ ├── doc.go │ │ ├── duration.go │ │ ├── duration │ │ ├── duration.pb.go │ │ └── duration.proto │ │ ├── timestamp.go │ │ └── timestamp │ │ ├── timestamp.pb.go │ │ └── timestamp.proto ├── mitchellh │ └── hashstructure │ │ ├── LICENSE │ │ ├── README.md │ │ ├── hashstructure.go │ │ └── include.go ├── opentracing │ └── opentracing-go │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── globaltracer.go │ │ ├── gocontext.go │ │ ├── log │ │ ├── field.go │ │ └── util.go │ │ ├── noop.go │ │ ├── propagation.go │ │ ├── span.go │ │ └── tracer.go ├── pkg │ └── errors │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── errors.go │ │ └── stack.go ├── satori │ └── go.uuid │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── codec.go │ │ ├── generator.go │ │ ├── sql.go │ │ └── uuid.go ├── sirupsen │ └── logrus │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── alt_exit.go │ │ ├── appveyor.yml │ │ ├── doc.go │ │ ├── entry.go │ │ ├── exported.go │ │ ├── formatter.go │ │ ├── hooks.go │ │ ├── json_formatter.go │ │ ├── logger.go │ │ ├── logrus.go │ │ ├── terminal_bsd.go │ │ ├── terminal_check_appengine.go │ │ ├── terminal_check_notappengine.go │ │ ├── terminal_linux.go │ │ ├── text_formatter.go │ │ └── writer.go └── spf13 │ └── cast │ ├── .gitignore │ ├── .travis.yml │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── cast.go │ └── caste.go ├── golang.org └── x │ ├── crypto │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ └── ssh │ │ └── terminal │ │ ├── terminal.go │ │ ├── util.go │ │ ├── util_bsd.go │ │ ├── util_linux.go │ │ ├── util_plan9.go │ │ ├── util_solaris.go │ │ └── util_windows.go │ ├── net │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ └── context │ │ ├── context.go │ │ ├── go17.go │ │ ├── go19.go │ │ ├── pre_go17.go │ │ └── pre_go19.go │ └── sys │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ ├── unix │ ├── .gitignore │ ├── README.md │ ├── affinity_linux.go │ ├── aliases.go │ ├── asm_darwin_386.s │ ├── asm_darwin_amd64.s │ ├── asm_darwin_arm.s │ ├── asm_darwin_arm64.s │ ├── asm_dragonfly_amd64.s │ ├── asm_freebsd_386.s │ ├── asm_freebsd_amd64.s │ ├── asm_freebsd_arm.s │ ├── asm_linux_386.s │ ├── asm_linux_amd64.s │ ├── asm_linux_arm.s │ ├── asm_linux_arm64.s │ ├── asm_linux_mips64x.s │ ├── asm_linux_mipsx.s │ ├── asm_linux_ppc64x.s │ ├── asm_linux_s390x.s │ ├── asm_netbsd_386.s │ ├── asm_netbsd_amd64.s │ ├── asm_netbsd_arm.s │ ├── asm_openbsd_386.s │ ├── asm_openbsd_amd64.s │ ├── asm_openbsd_arm.s │ ├── asm_solaris_amd64.s │ ├── bluetooth_linux.go │ ├── cap_freebsd.go │ ├── constants.go │ ├── dev_darwin.go │ ├── dev_dragonfly.go │ ├── dev_freebsd.go │ ├── dev_linux.go │ ├── dev_netbsd.go │ ├── dev_openbsd.go │ ├── dirent.go │ ├── endian_big.go │ ├── endian_little.go │ ├── env_unix.go │ ├── errors_freebsd_386.go │ ├── errors_freebsd_amd64.go │ ├── errors_freebsd_arm.go │ ├── fcntl.go │ ├── fcntl_linux_32bit.go │ ├── gccgo.go │ ├── gccgo_c.c │ ├── gccgo_linux_amd64.go │ ├── ioctl.go │ ├── mkall.sh │ ├── mkerrors.sh │ ├── mkpost.go │ ├── mksyscall.pl │ ├── mksyscall_solaris.pl │ ├── mksysctl_openbsd.pl │ ├── mksysnum_darwin.pl │ ├── mksysnum_dragonfly.pl │ ├── mksysnum_freebsd.pl │ ├── mksysnum_netbsd.pl │ ├── mksysnum_openbsd.pl │ ├── openbsd_pledge.go │ ├── pagesize_unix.go │ ├── race.go │ ├── race0.go │ ├── sockcmsg_linux.go │ ├── sockcmsg_unix.go │ ├── str.go │ ├── syscall.go │ ├── syscall_bsd.go │ ├── syscall_darwin.go │ ├── syscall_darwin_386.go │ ├── syscall_darwin_amd64.go │ ├── syscall_darwin_arm.go │ ├── syscall_darwin_arm64.go │ ├── syscall_dragonfly.go │ ├── syscall_dragonfly_amd64.go │ ├── syscall_freebsd.go │ ├── syscall_freebsd_386.go │ ├── syscall_freebsd_amd64.go │ ├── syscall_freebsd_arm.go │ ├── syscall_linux.go │ ├── syscall_linux_386.go │ ├── syscall_linux_amd64.go │ ├── syscall_linux_amd64_gc.go │ ├── syscall_linux_arm.go │ ├── syscall_linux_arm64.go │ ├── syscall_linux_gc.go │ ├── syscall_linux_gc_386.go │ ├── syscall_linux_gccgo_386.go │ ├── syscall_linux_gccgo_arm.go │ ├── syscall_linux_mips64x.go │ ├── syscall_linux_mipsx.go │ ├── syscall_linux_ppc64x.go │ ├── syscall_linux_s390x.go │ ├── syscall_linux_sparc64.go │ ├── syscall_netbsd.go │ ├── syscall_netbsd_386.go │ ├── syscall_netbsd_amd64.go │ ├── syscall_netbsd_arm.go │ ├── syscall_openbsd.go │ ├── syscall_openbsd_386.go │ ├── syscall_openbsd_amd64.go │ ├── syscall_openbsd_arm.go │ ├── syscall_solaris.go │ ├── syscall_solaris_amd64.go │ ├── syscall_unix.go │ ├── syscall_unix_gc.go │ ├── timestruct.go │ ├── types_darwin.go │ ├── types_dragonfly.go │ ├── types_freebsd.go │ ├── types_netbsd.go │ ├── types_openbsd.go │ ├── types_solaris.go │ ├── xattr_bsd.go │ ├── zerrors_darwin_386.go │ ├── zerrors_darwin_amd64.go │ ├── zerrors_darwin_arm.go │ ├── zerrors_darwin_arm64.go │ ├── zerrors_dragonfly_amd64.go │ ├── zerrors_freebsd_386.go │ ├── zerrors_freebsd_amd64.go │ ├── zerrors_freebsd_arm.go │ ├── zerrors_linux_386.go │ ├── zerrors_linux_amd64.go │ ├── zerrors_linux_arm.go │ ├── zerrors_linux_arm64.go │ ├── zerrors_linux_mips.go │ ├── zerrors_linux_mips64.go │ ├── zerrors_linux_mips64le.go │ ├── zerrors_linux_mipsle.go │ ├── zerrors_linux_ppc64.go │ ├── zerrors_linux_ppc64le.go │ ├── zerrors_linux_s390x.go │ ├── zerrors_linux_sparc64.go │ ├── zerrors_netbsd_386.go │ ├── zerrors_netbsd_amd64.go │ ├── zerrors_netbsd_arm.go │ ├── zerrors_openbsd_386.go │ ├── zerrors_openbsd_amd64.go │ ├── zerrors_openbsd_arm.go │ ├── zerrors_solaris_amd64.go │ ├── zptrace386_linux.go │ ├── zptracearm_linux.go │ ├── zptracemips_linux.go │ ├── zptracemipsle_linux.go │ ├── zsyscall_darwin_386.go │ ├── zsyscall_darwin_amd64.go │ ├── zsyscall_darwin_arm.go │ ├── zsyscall_darwin_arm64.go │ ├── zsyscall_dragonfly_amd64.go │ ├── zsyscall_freebsd_386.go │ ├── zsyscall_freebsd_amd64.go │ ├── zsyscall_freebsd_arm.go │ ├── zsyscall_linux_386.go │ ├── zsyscall_linux_amd64.go │ ├── zsyscall_linux_arm.go │ ├── zsyscall_linux_arm64.go │ ├── zsyscall_linux_mips.go │ ├── zsyscall_linux_mips64.go │ ├── zsyscall_linux_mips64le.go │ ├── zsyscall_linux_mipsle.go │ ├── zsyscall_linux_ppc64.go │ ├── zsyscall_linux_ppc64le.go │ ├── zsyscall_linux_s390x.go │ ├── zsyscall_linux_sparc64.go │ ├── zsyscall_netbsd_386.go │ ├── zsyscall_netbsd_amd64.go │ ├── zsyscall_netbsd_arm.go │ ├── zsyscall_openbsd_386.go │ ├── zsyscall_openbsd_amd64.go │ ├── zsyscall_openbsd_arm.go │ ├── zsyscall_solaris_amd64.go │ ├── zsysctl_openbsd_386.go │ ├── zsysctl_openbsd_amd64.go │ ├── zsysctl_openbsd_arm.go │ ├── zsysnum_darwin_386.go │ ├── zsysnum_darwin_amd64.go │ ├── zsysnum_darwin_arm.go │ ├── zsysnum_darwin_arm64.go │ ├── zsysnum_dragonfly_amd64.go │ ├── zsysnum_freebsd_386.go │ ├── zsysnum_freebsd_amd64.go │ ├── zsysnum_freebsd_arm.go │ ├── zsysnum_linux_386.go │ ├── zsysnum_linux_amd64.go │ ├── zsysnum_linux_arm.go │ ├── zsysnum_linux_arm64.go │ ├── zsysnum_linux_mips.go │ ├── zsysnum_linux_mips64.go │ ├── zsysnum_linux_mips64le.go │ ├── zsysnum_linux_mipsle.go │ ├── zsysnum_linux_ppc64.go │ ├── zsysnum_linux_ppc64le.go │ ├── zsysnum_linux_s390x.go │ ├── zsysnum_linux_sparc64.go │ ├── zsysnum_netbsd_386.go │ ├── zsysnum_netbsd_amd64.go │ ├── zsysnum_netbsd_arm.go │ ├── zsysnum_openbsd_386.go │ ├── zsysnum_openbsd_amd64.go │ ├── zsysnum_openbsd_arm.go │ ├── ztypes_darwin_386.go │ ├── ztypes_darwin_amd64.go │ ├── ztypes_darwin_arm.go │ ├── ztypes_darwin_arm64.go │ ├── ztypes_dragonfly_amd64.go │ ├── ztypes_freebsd_386.go │ ├── ztypes_freebsd_amd64.go │ ├── ztypes_freebsd_arm.go │ ├── ztypes_linux_386.go │ ├── ztypes_linux_amd64.go │ ├── ztypes_linux_arm.go │ ├── ztypes_linux_arm64.go │ ├── ztypes_linux_mips.go │ ├── ztypes_linux_mips64.go │ ├── ztypes_linux_mips64le.go │ ├── ztypes_linux_mipsle.go │ ├── ztypes_linux_ppc64.go │ ├── ztypes_linux_ppc64le.go │ ├── ztypes_linux_s390x.go │ ├── ztypes_linux_sparc64.go │ ├── ztypes_netbsd_386.go │ ├── ztypes_netbsd_amd64.go │ ├── ztypes_netbsd_arm.go │ ├── ztypes_openbsd_386.go │ ├── ztypes_openbsd_amd64.go │ ├── ztypes_openbsd_arm.go │ └── ztypes_solaris_amd64.go │ └── windows │ ├── aliases.go │ ├── asm_windows_386.s │ ├── asm_windows_amd64.s │ ├── dll_windows.go │ ├── env_windows.go │ ├── eventlog.go │ ├── exec_windows.go │ ├── memory_windows.go │ ├── mksyscall.go │ ├── race.go │ ├── race0.go │ ├── security_windows.go │ ├── service.go │ ├── str.go │ ├── syscall.go │ ├── syscall_windows.go │ ├── types_windows.go │ ├── types_windows_386.go │ ├── types_windows_amd64.go │ └── zsyscall_windows.go ├── google.golang.org ├── genproto │ ├── LICENSE │ └── googleapis │ │ └── rpc │ │ └── status │ │ └── status.pb.go └── grpc │ ├── AUTHORS │ ├── LICENSE │ ├── codes │ ├── code_string.go │ └── codes.go │ └── status │ ├── go16.go │ ├── go17.go │ └── status.go ├── gopkg.in └── src-d │ ├── go-errors.v1 │ ├── .gitignore │ ├── .travis.yml │ ├── DCO │ ├── LICENSE │ ├── MAINTAINERS │ ├── Makefile │ ├── README.md │ ├── doc.go │ ├── error.go │ ├── matcher.go │ └── stack.go │ ├── go-mysql-server.v0 │ ├── .gitignore │ ├── .travis.yml │ ├── CONTRIBUTING.md │ ├── DCO │ ├── LICENSE │ ├── MAINTAINERS │ ├── Makefile │ ├── README.md │ ├── SUPPORTED.md │ ├── _config.yml │ ├── engine.go │ ├── go.mod │ ├── internal │ │ └── regex │ │ │ ├── regex.go │ │ │ ├── regex_go.go │ │ │ └── regex_oniguruma.go │ ├── mem │ │ ├── database.go │ │ └── table.go │ ├── server │ │ ├── context.go │ │ ├── handler.go │ │ └── server.go │ └── sql │ │ ├── analyzer │ │ ├── aggregations.go │ │ ├── analyzer.go │ │ ├── assign_catalog.go │ │ ├── assign_indexes.go │ │ ├── batch.go │ │ ├── filters.go │ │ ├── optimization_rules.go │ │ ├── parallelize.go │ │ ├── process.go │ │ ├── pushdown.go │ │ ├── readonly.go │ │ ├── resolve_columns.go │ │ ├── resolve_database.go │ │ ├── resolve_functions.go │ │ ├── resolve_natural_joins.go │ │ ├── resolve_orderby.go │ │ ├── resolve_stars.go │ │ ├── resolve_subqueries.go │ │ ├── resolve_tables.go │ │ ├── rules.go │ │ └── validation_rules.go │ │ ├── catalog.go │ │ ├── core.go │ │ ├── expression │ │ ├── alias.go │ │ ├── arithmetic.go │ │ ├── between.go │ │ ├── boolean.go │ │ ├── common.go │ │ ├── comparison.go │ │ ├── convert.go │ │ ├── doc.go │ │ ├── function │ │ │ ├── aggregation │ │ │ │ ├── avg.go │ │ │ │ ├── count.go │ │ │ │ ├── max.go │ │ │ │ ├── min.go │ │ │ │ └── sum.go │ │ │ ├── arraylength.go │ │ │ ├── concat.go │ │ │ ├── isbinary.go │ │ │ ├── registry.go │ │ │ ├── split.go │ │ │ ├── substring.go │ │ │ ├── time.go │ │ │ └── version.go │ │ ├── get_field.go │ │ ├── isnull.go │ │ ├── literal.go │ │ ├── logic.go │ │ ├── star.go │ │ ├── tuple.go │ │ ├── unresolved.go │ │ └── walk.go │ │ ├── functionregistry.go │ │ ├── index.go │ │ ├── parse │ │ ├── describe.go │ │ ├── indexes.go │ │ ├── parse.go │ │ └── util.go │ │ ├── plan │ │ ├── common.go │ │ ├── create_index.go │ │ ├── cross_join.go │ │ ├── ddl.go │ │ ├── describe.go │ │ ├── distinct.go │ │ ├── drop_index.go │ │ ├── empty_table.go │ │ ├── exchange.go │ │ ├── filter.go │ │ ├── group_by.go │ │ ├── innerjoin.go │ │ ├── insert.go │ │ ├── limit.go │ │ ├── naturaljoin.go │ │ ├── offset.go │ │ ├── process.go │ │ ├── processlist.go │ │ ├── project.go │ │ ├── resolved_table.go │ │ ├── set.go │ │ ├── show_indexes.go │ │ ├── show_tables.go │ │ ├── sort.go │ │ ├── subqueryalias.go │ │ ├── tablealias.go │ │ ├── unresolved.go │ │ ├── values.go │ │ └── walk.go │ │ ├── processlist.go │ │ ├── row.go │ │ ├── session.go │ │ ├── treeprinter.go │ │ ├── type.go │ │ └── unresolved_database.go │ └── go-vitess.v0 │ ├── bytes2 │ └── buffer.go │ ├── cache │ └── lru_cache.go │ ├── hack │ └── hack.go │ ├── mysql │ ├── auth_server.go │ ├── auth_server_none.go │ ├── auth_server_static.go │ ├── binlog_event.go │ ├── binlog_event_common.go │ ├── binlog_event_json.go │ ├── binlog_event_make.go │ ├── binlog_event_mariadb.go │ ├── binlog_event_mysql56.go │ ├── binlog_event_rbr.go │ ├── charset.go │ ├── client.go │ ├── conn.go │ ├── conn_params.go │ ├── constants.go │ ├── doc.go │ ├── encoding.go │ ├── flavor.go │ ├── flavor_mariadb.go │ ├── flavor_mariadb_binlog_playback.go │ ├── flavor_mysql.go │ ├── gtid.go │ ├── gtid_set.go │ ├── mariadb_gtid.go │ ├── mysql56_gtid.go │ ├── mysql56_gtid_set.go │ ├── query.go │ ├── replication.go │ ├── replication_constants.go │ ├── replication_position.go │ ├── schema.go │ ├── server.go │ ├── slave_status.go │ ├── sql_error.go │ └── streaming_query.go │ ├── sqltypes │ ├── arithmetic.go │ ├── bind_variables.go │ ├── event_token.go │ ├── plan_value.go │ ├── proto3.go │ ├── query_response.go │ ├── result.go │ ├── testing.go │ ├── type.go │ └── value.go │ ├── stats │ ├── counters.go │ ├── export.go │ ├── histogram.go │ ├── multidimensional.go │ ├── rates.go │ ├── ring.go │ └── timings.go │ ├── sync2 │ ├── atomic.go │ ├── batcher.go │ ├── consolidator.go │ ├── doc.go │ └── semaphore.go │ ├── tb │ └── error.go │ └── vt │ ├── proto │ ├── binlogdata │ │ └── binlogdata.pb.go │ ├── query │ │ └── query.pb.go │ ├── replicationdata │ │ └── replicationdata.pb.go │ ├── topodata │ │ └── topodata.pb.go │ ├── vtgate │ │ └── vtgate.pb.go │ └── vtrpc │ │ └── vtrpc.pb.go │ ├── sqlparser │ ├── Makefile │ ├── analyzer.go │ ├── ast.go │ ├── comments.go │ ├── encodable.go │ ├── impossible_query.go │ ├── normalizer.go │ ├── parsed_query.go │ ├── sql.go │ ├── sql.y │ ├── token.go │ ├── tracked_buffer.go │ └── truncate_query.go │ ├── vterrors │ ├── aggregate.go │ ├── doc.go │ ├── grpc.go │ ├── proto3.go │ └── vterrors.go │ └── vttls │ └── vttls.go └── modules.txt /README.md: -------------------------------------------------------------------------------- 1 | # csvql: a SQL server for CSV files 2 | 3 | This is a quick demo I put together to show how easy it is to develop 4 | SQL servers thanks to [gopkg.in/src-d/go-mysql-server.v0](https://gopkg.in/src-d/go-mysql-server.v0). 5 | 6 | # Disclaimer 7 | 8 | This is a quick demo and is not intended to be used in production, pretty please. -------------------------------------------------------------------------------- /cmd/csvql/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "os" 6 | "path/filepath" 7 | 8 | "github.com/campoy/csvql" 9 | sqle "gopkg.in/src-d/go-mysql-server.v0" 10 | "gopkg.in/src-d/go-mysql-server.v0/server" 11 | "gopkg.in/src-d/go-vitess.v0/mysql" 12 | ) 13 | 14 | func main() { 15 | path := "." 16 | if len(os.Args) > 1 { 17 | path = os.Args[1] 18 | } 19 | path, err := filepath.Abs(path) 20 | if err != nil { 21 | log.Fatalf("could not find path: %v", err) 22 | } 23 | db, err := csvql.NewDatabase(path) 24 | if err != nil { 25 | log.Fatalf("could not create database: %v", err) 26 | } 27 | 28 | engine := sqle.NewDefault() 29 | engine.AddDatabase(db) 30 | 31 | config := server.Config{ 32 | Protocol: "tcp", 33 | Address: "localhost:3306", 34 | Auth: new(mysql.AuthServerNone), 35 | } 36 | server, err := server.NewDefaultServer(config, engine) 37 | if err != nil { 38 | log.Fatal(err) 39 | } 40 | 41 | log.Printf("starting server on %s", config.Address) 42 | log.Fatal(server.Start()) 43 | } 44 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/campoy/csvql 2 | 3 | require ( 4 | gopkg.in/src-d/go-mysql-server.v0 v0.0.0-20180919134539-fe0ac6e55ce3 5 | gopkg.in/src-d/go-vitess.v0 v0.0.0-20180222154500-2cb632cdef3c 6 | ) 7 | -------------------------------------------------------------------------------- /testdata/cities.csv: -------------------------------------------------------------------------------- 1 | name, country, population 2 | San Francisco, USA, some people 3 | Shanghai, China, way more people 4 | Madrid, Spain, lotta people -------------------------------------------------------------------------------- /testdata/people.csv: -------------------------------------------------------------------------------- 1 | first, last 2 | Francesc, Campoy 3 | Emma, Campoy 4 | Blake, Mizerany‏ 5 | Cassandra, Salisbury -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2010 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 | 29 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/ptypes/doc.go: -------------------------------------------------------------------------------- 1 | // Go support for Protocol Buffers - Google's data interchange format 2 | // 3 | // Copyright 2016 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 | /* 33 | Package ptypes contains code for interacting with well-known types. 34 | */ 35 | package ptypes 36 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/hashstructure/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/hashstructure/README.md: -------------------------------------------------------------------------------- 1 | # hashstructure [![GoDoc](https://godoc.org/github.com/mitchellh/hashstructure?status.svg)](https://godoc.org/github.com/mitchellh/hashstructure) 2 | 3 | hashstructure is a Go library for creating a unique hash value 4 | for arbitrary values in Go. 5 | 6 | This can be used to key values in a hash (for use in a map, set, etc.) 7 | that are complex. The most common use case is comparing two values without 8 | sending data across the network, caching values locally (de-dup), and so on. 9 | 10 | ## Features 11 | 12 | * Hash any arbitrary Go value, including complex types. 13 | 14 | * Tag a struct field to ignore it and not affect the hash value. 15 | 16 | * Tag a slice type struct field to treat it as a set where ordering 17 | doesn't affect the hash code but the field itself is still taken into 18 | account to create the hash value. 19 | 20 | * Optionally specify a custom hash function to optimize for speed, collision 21 | avoidance for your data set, etc. 22 | 23 | * Optionally hash the output of `.String()` on structs that implement fmt.Stringer, 24 | allowing effective hashing of time.Time 25 | 26 | ## Installation 27 | 28 | Standard `go get`: 29 | 30 | ``` 31 | $ go get github.com/mitchellh/hashstructure 32 | ``` 33 | 34 | ## Usage & Example 35 | 36 | For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/hashstructure). 37 | 38 | A quick code example is shown below: 39 | 40 | ```go 41 | type ComplexStruct struct { 42 | Name string 43 | Age uint 44 | Metadata map[string]interface{} 45 | } 46 | 47 | v := ComplexStruct{ 48 | Name: "mitchellh", 49 | Age: 64, 50 | Metadata: map[string]interface{}{ 51 | "car": true, 52 | "location": "California", 53 | "siblings": []string{"Bob", "John"}, 54 | }, 55 | } 56 | 57 | hash, err := hashstructure.Hash(v, nil) 58 | if err != nil { 59 | panic(err) 60 | } 61 | 62 | fmt.Printf("%d", hash) 63 | // Output: 64 | // 2307517237273902113 65 | ``` 66 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/hashstructure/include.go: -------------------------------------------------------------------------------- 1 | package hashstructure 2 | 3 | // Includable is an interface that can optionally be implemented by 4 | // a struct. It will be called for each field in the struct to check whether 5 | // it should be included in the hash. 6 | type Includable interface { 7 | HashInclude(field string, v interface{}) (bool, error) 8 | } 9 | 10 | // IncludableMap is an interface that can optionally be implemented by 11 | // a struct. It will be called when a map-type field is found to ask the 12 | // struct if the map item should be included in the hash. 13 | type IncludableMap interface { 14 | HashIncludeMap(field string, k, v interface{}) (bool, error) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/opentracing/opentracing-go/.gitignore: -------------------------------------------------------------------------------- 1 | # IntelliJ project files 2 | .idea/ 3 | opentracing-go.iml 4 | opentracing-go.ipr 5 | opentracing-go.iws 6 | 7 | # Test results 8 | *.cov 9 | *.html 10 | test.log 11 | 12 | # Build dir 13 | build/ 14 | -------------------------------------------------------------------------------- /vendor/github.com/opentracing/opentracing-go/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.6 5 | - 1.7 6 | - 1.8 7 | - tip 8 | 9 | install: 10 | - go get -d -t github.com/opentracing/opentracing-go/... 11 | - go get -u github.com/golang/lint/... 12 | script: 13 | - make test lint 14 | - go build ./... 15 | -------------------------------------------------------------------------------- /vendor/github.com/opentracing/opentracing-go/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Changes by Version 2 | ================== 3 | 4 | 1.1.0 (unreleased) 5 | ------------------- 6 | 7 | - Deprecate InitGlobalTracer() in favor of SetGlobalTracer() 8 | 9 | 10 | 1.0.0 (2016-09-26) 11 | ------------------- 12 | 13 | - This release implements OpenTracing Specification 1.0 (http://opentracing.io/spec) 14 | 15 | -------------------------------------------------------------------------------- /vendor/github.com/opentracing/opentracing-go/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 The OpenTracing Authors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 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/opentracing/opentracing-go/Makefile: -------------------------------------------------------------------------------- 1 | PACKAGES := . ./mocktracer/... ./ext/... 2 | 3 | .DEFAULT_GOAL := test-and-lint 4 | 5 | .PHONE: test-and-lint 6 | 7 | test-and-lint: test lint 8 | 9 | .PHONY: test 10 | test: 11 | go test -v -cover ./... 12 | 13 | cover: 14 | @rm -rf cover-all.out 15 | $(foreach pkg, $(PACKAGES), $(MAKE) cover-pkg PKG=$(pkg) || true;) 16 | @grep mode: cover.out > coverage.out 17 | @cat cover-all.out >> coverage.out 18 | go tool cover -html=coverage.out -o cover.html 19 | @rm -rf cover.out cover-all.out coverage.out 20 | 21 | cover-pkg: 22 | go test -coverprofile cover.out $(PKG) 23 | @grep -v mode: cover.out >> cover-all.out 24 | 25 | .PHONY: lint 26 | lint: 27 | go fmt ./... 28 | golint ./... 29 | @# Run again with magic to exit non-zero if golint outputs anything. 30 | @! (golint ./... | read dummy) 31 | go vet ./... 32 | 33 | -------------------------------------------------------------------------------- /vendor/github.com/opentracing/opentracing-go/globaltracer.go: -------------------------------------------------------------------------------- 1 | package opentracing 2 | 3 | var ( 4 | globalTracer Tracer = NoopTracer{} 5 | ) 6 | 7 | // SetGlobalTracer sets the [singleton] opentracing.Tracer returned by 8 | // GlobalTracer(). Those who use GlobalTracer (rather than directly manage an 9 | // opentracing.Tracer instance) should call SetGlobalTracer as early as 10 | // possible in main(), prior to calling the `StartSpan` global func below. 11 | // Prior to calling `SetGlobalTracer`, any Spans started via the `StartSpan` 12 | // (etc) globals are noops. 13 | func SetGlobalTracer(tracer Tracer) { 14 | globalTracer = tracer 15 | } 16 | 17 | // GlobalTracer returns the global singleton `Tracer` implementation. 18 | // Before `SetGlobalTracer()` is called, the `GlobalTracer()` is a noop 19 | // implementation that drops all data handed to it. 20 | func GlobalTracer() Tracer { 21 | return globalTracer 22 | } 23 | 24 | // StartSpan defers to `Tracer.StartSpan`. See `GlobalTracer()`. 25 | func StartSpan(operationName string, opts ...StartSpanOption) Span { 26 | return globalTracer.StartSpan(operationName, opts...) 27 | } 28 | 29 | // InitGlobalTracer is deprecated. Please use SetGlobalTracer. 30 | func InitGlobalTracer(tracer Tracer) { 31 | SetGlobalTracer(tracer) 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/opentracing/opentracing-go/log/util.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import "fmt" 4 | 5 | // InterleavedKVToFields converts keyValues a la Span.LogKV() to a Field slice 6 | // a la Span.LogFields(). 7 | func InterleavedKVToFields(keyValues ...interface{}) ([]Field, error) { 8 | if len(keyValues)%2 != 0 { 9 | return nil, fmt.Errorf("non-even keyValues len: %d", len(keyValues)) 10 | } 11 | fields := make([]Field, len(keyValues)/2) 12 | for i := 0; i*2 < len(keyValues); i++ { 13 | key, ok := keyValues[i*2].(string) 14 | if !ok { 15 | return nil, fmt.Errorf( 16 | "non-string key (pair #%d): %T", 17 | i, keyValues[i*2]) 18 | } 19 | switch typedVal := keyValues[i*2+1].(type) { 20 | case bool: 21 | fields[i] = Bool(key, typedVal) 22 | case string: 23 | fields[i] = String(key, typedVal) 24 | case int: 25 | fields[i] = Int(key, typedVal) 26 | case int8: 27 | fields[i] = Int32(key, int32(typedVal)) 28 | case int16: 29 | fields[i] = Int32(key, int32(typedVal)) 30 | case int32: 31 | fields[i] = Int32(key, typedVal) 32 | case int64: 33 | fields[i] = Int64(key, typedVal) 34 | case uint: 35 | fields[i] = Uint64(key, uint64(typedVal)) 36 | case uint64: 37 | fields[i] = Uint64(key, typedVal) 38 | case uint8: 39 | fields[i] = Uint32(key, uint32(typedVal)) 40 | case uint16: 41 | fields[i] = Uint32(key, uint32(typedVal)) 42 | case uint32: 43 | fields[i] = Uint32(key, typedVal) 44 | case float32: 45 | fields[i] = Float32(key, typedVal) 46 | case float64: 47 | fields[i] = Float64(key, typedVal) 48 | default: 49 | // When in doubt, coerce to a string 50 | fields[i] = String(key, fmt.Sprint(typedVal)) 51 | } 52 | } 53 | return fields, nil 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go_import_path: github.com/pkg/errors 3 | go: 4 | - 1.4.3 5 | - 1.5.4 6 | - 1.6.2 7 | - 1.7.1 8 | - tip 9 | 10 | script: 11 | - go test -v ./... 12 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Dave Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /vendor/github.com/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/satori/go.uuid/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | go: 4 | - 1.2 5 | - 1.3 6 | - 1.4 7 | - 1.5 8 | - 1.6 9 | - 1.7 10 | - 1.8 11 | - 1.9 12 | - tip 13 | matrix: 14 | allow_failures: 15 | - go: tip 16 | fast_finish: true 17 | before_install: 18 | - go get github.com/mattn/goveralls 19 | - go get golang.org/x/tools/cmd/cover 20 | script: 21 | - $HOME/gopath/bin/goveralls -service=travis-ci 22 | notifications: 23 | email: false 24 | -------------------------------------------------------------------------------- /vendor/github.com/satori/go.uuid/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013-2018 by Maxim Bublis 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/.gitignore: -------------------------------------------------------------------------------- 1 | logrus 2 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.9.x 4 | - 1.10.x 5 | env: 6 | - GOMAXPROCS=4 GORACE=halt_on_error=1 7 | install: 8 | - go get github.com/stretchr/testify/assert 9 | - go get gopkg.in/gemnasium/logrus-airbrake-hook.v2 10 | - go get golang.org/x/sys/unix 11 | - go get golang.org/x/sys/windows 12 | script: 13 | - go test -race -v ./... 14 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Simon Eskildsen 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/sirupsen/logrus/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "{build}" 2 | platform: x64 3 | clone_folder: c:\gopath\src\github.com\sirupsen\logrus 4 | environment: 5 | GOPATH: c:\gopath 6 | branches: 7 | only: 8 | - master 9 | install: 10 | - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% 11 | - go version 12 | build_script: 13 | - go get -t 14 | - go test 15 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package logrus is a structured logger for Go, completely API compatible with the standard library logger. 3 | 4 | 5 | The simplest way to use Logrus is simply the package-level exported logger: 6 | 7 | package main 8 | 9 | import ( 10 | log "github.com/sirupsen/logrus" 11 | ) 12 | 13 | func main() { 14 | log.WithFields(log.Fields{ 15 | "animal": "walrus", 16 | "number": 1, 17 | "size": 10, 18 | }).Info("A walrus appears") 19 | } 20 | 21 | Output: 22 | time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10 23 | 24 | For a full guide visit https://github.com/sirupsen/logrus 25 | */ 26 | package logrus 27 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import "time" 4 | 5 | const defaultTimestampFormat = time.RFC3339 6 | 7 | // The Formatter interface is used to implement a custom Formatter. It takes an 8 | // `Entry`. It exposes all the fields, including the default ones: 9 | // 10 | // * `entry.Data["msg"]`. The message passed from Info, Warn, Error .. 11 | // * `entry.Data["time"]`. The timestamp. 12 | // * `entry.Data["level"]. The level the entry was logged at. 13 | // 14 | // Any additional fields added with `WithField` or `WithFields` are also in 15 | // `entry.Data`. Format is expected to return an array of bytes which are then 16 | // logged to `logger.Out`. 17 | type Formatter interface { 18 | Format(*Entry) ([]byte, error) 19 | } 20 | 21 | // This is to not silently overwrite `time`, `msg` and `level` fields when 22 | // dumping it. If this code wasn't there doing: 23 | // 24 | // logrus.WithField("level", 1).Info("hello") 25 | // 26 | // Would just silently drop the user provided level. Instead with this code 27 | // it'll logged as: 28 | // 29 | // {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."} 30 | // 31 | // It's not exported because it's still using Data in an opinionated way. It's to 32 | // avoid code duplication between the two default formatters. 33 | func prefixFieldClashes(data Fields, fieldMap FieldMap) { 34 | timeKey := fieldMap.resolve(FieldKeyTime) 35 | if t, ok := data[timeKey]; ok { 36 | data["fields."+timeKey] = t 37 | delete(data, timeKey) 38 | } 39 | 40 | msgKey := fieldMap.resolve(FieldKeyMsg) 41 | if m, ok := data[msgKey]; ok { 42 | data["fields."+msgKey] = m 43 | delete(data, msgKey) 44 | } 45 | 46 | levelKey := fieldMap.resolve(FieldKeyLevel) 47 | if l, ok := data[levelKey]; ok { 48 | data["fields."+levelKey] = l 49 | delete(data, levelKey) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/hooks.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | // A hook to be fired when logging on the logging levels returned from 4 | // `Levels()` on your implementation of the interface. Note that this is not 5 | // fired in a goroutine or a channel with workers, you should handle such 6 | // functionality yourself if your call is non-blocking and you don't wish for 7 | // the logging calls for levels returned from `Levels()` to block. 8 | type Hook interface { 9 | Levels() []Level 10 | Fire(*Entry) error 11 | } 12 | 13 | // Internal type for storing the hooks on a logger instance. 14 | type LevelHooks map[Level][]Hook 15 | 16 | // Add a hook to an instance of logger. This is called with 17 | // `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface. 18 | func (hooks LevelHooks) Add(hook Hook) { 19 | for _, level := range hook.Levels() { 20 | hooks[level] = append(hooks[level], hook) 21 | } 22 | } 23 | 24 | // Fire all the hooks for the passed level. Used by `entry.log` to fire 25 | // appropriate hooks for a log entry. 26 | func (hooks LevelHooks) Fire(level Level, entry *Entry) error { 27 | for _, hook := range hooks[level] { 28 | if err := hook.Fire(entry); err != nil { 29 | return err 30 | } 31 | } 32 | 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | // +build !appengine,!gopherjs 3 | 4 | package logrus 5 | 6 | import "golang.org/x/sys/unix" 7 | 8 | const ioctlReadTermios = unix.TIOCGETA 9 | 10 | type Termios unix.Termios 11 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_check_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine gopherjs 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | ) 8 | 9 | func checkIfTerminal(w io.Writer) bool { 10 | return true 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go: -------------------------------------------------------------------------------- 1 | // +build !appengine,!gopherjs 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | "os" 8 | 9 | "golang.org/x/crypto/ssh/terminal" 10 | ) 11 | 12 | func checkIfTerminal(w io.Writer) bool { 13 | switch v := w.(type) { 14 | case *os.File: 15 | return terminal.IsTerminal(int(v.Fd())) 16 | default: 17 | return false 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_linux.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2013 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build !appengine,!gopherjs 7 | 8 | package logrus 9 | 10 | import "golang.org/x/sys/unix" 11 | 12 | const ioctlReadTermios = unix.TCGETS 13 | 14 | type Termios unix.Termios 15 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/writer.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "bufio" 5 | "io" 6 | "runtime" 7 | ) 8 | 9 | func (logger *Logger) Writer() *io.PipeWriter { 10 | return logger.WriterLevel(InfoLevel) 11 | } 12 | 13 | func (logger *Logger) WriterLevel(level Level) *io.PipeWriter { 14 | return NewEntry(logger).WriterLevel(level) 15 | } 16 | 17 | func (entry *Entry) Writer() *io.PipeWriter { 18 | return entry.WriterLevel(InfoLevel) 19 | } 20 | 21 | func (entry *Entry) WriterLevel(level Level) *io.PipeWriter { 22 | reader, writer := io.Pipe() 23 | 24 | var printFunc func(args ...interface{}) 25 | 26 | switch level { 27 | case DebugLevel: 28 | printFunc = entry.Debug 29 | case InfoLevel: 30 | printFunc = entry.Info 31 | case WarnLevel: 32 | printFunc = entry.Warn 33 | case ErrorLevel: 34 | printFunc = entry.Error 35 | case FatalLevel: 36 | printFunc = entry.Fatal 37 | case PanicLevel: 38 | printFunc = entry.Panic 39 | default: 40 | printFunc = entry.Print 41 | } 42 | 43 | go entry.writerScanner(reader, printFunc) 44 | runtime.SetFinalizer(writer, writerFinalizer) 45 | 46 | return writer 47 | } 48 | 49 | func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) { 50 | scanner := bufio.NewScanner(reader) 51 | for scanner.Scan() { 52 | printFunc(scanner.Text()) 53 | } 54 | if err := scanner.Err(); err != nil { 55 | entry.Errorf("Error while reading from Writer: %s", err) 56 | } 57 | reader.Close() 58 | } 59 | 60 | func writerFinalizer(writer *io.PipeWriter) { 61 | writer.Close() 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | 25 | *.bench 26 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: required 3 | go: 4 | - 1.7.5 5 | - 1.8 6 | - tip 7 | os: 8 | - linux 9 | matrix: 10 | allow_failures: 11 | - go: tip 12 | fast_finish: true 13 | script: 14 | - make check 15 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Steve Francia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/Makefile: -------------------------------------------------------------------------------- 1 | # A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html 2 | 3 | .PHONY: check fmt lint test test-race vet test-cover-html help 4 | .DEFAULT_GOAL := help 5 | 6 | check: test-race fmt vet lint ## Run tests and linters 7 | 8 | test: ## Run tests 9 | go test ./... 10 | 11 | test-race: ## Run tests with race detector 12 | go test -race ./... 13 | 14 | fmt: ## Run gofmt linter 15 | @for d in `go list` ; do \ 16 | if [ "`gofmt -l -s $$GOPATH/src/$$d | tee /dev/stderr`" ]; then \ 17 | echo "^ improperly formatted go files" && echo && exit 1; \ 18 | fi \ 19 | done 20 | 21 | lint: ## Run golint linter 22 | @for d in `go list` ; do \ 23 | if [ "`golint $$d | tee /dev/stderr`" ]; then \ 24 | echo "^ golint errors!" && echo && exit 1; \ 25 | fi \ 26 | done 27 | 28 | vet: ## Run go vet linter 29 | @if [ "`go vet | tee /dev/stderr`" ]; then \ 30 | echo "^ go vet errors!" && echo && exit 1; \ 31 | fi 32 | 33 | test-cover-html: ## Generate test coverage report 34 | go test -coverprofile=coverage.out -covermode=count 35 | go tool cover -func=coverage.out 36 | 37 | help: 38 | @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at https://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at https://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package terminal 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | const ioctlReadTermios = unix.TIOCGETA 12 | const ioctlWriteTermios = unix.TIOCSETA 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/ssh/terminal/util_linux.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 terminal 6 | 7 | import "golang.org/x/sys/unix" 8 | 9 | const ioctlReadTermios = unix.TCGETS 10 | const ioctlWriteTermios = unix.TCSETS 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/context/go19.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.9 6 | 7 | package context 8 | 9 | import "context" // standard library's context, as of Go 1.7 10 | 11 | // A Context carries a deadline, a cancelation signal, and other values across 12 | // API boundaries. 13 | // 14 | // Context's methods may be called by multiple goroutines simultaneously. 15 | type Context = context.Context 16 | 17 | // A CancelFunc tells an operation to abandon its work. 18 | // A CancelFunc does not wait for the work to stop. 19 | // After the first call, subsequent calls to a CancelFunc do nothing. 20 | type CancelFunc = context.CancelFunc 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | unix.test 3 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build go1.9 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | type Signal = syscall.Signal 13 | type Errno = syscall.Errno 14 | type SysProcAttr = syscall.SysProcAttr 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for 386, Linux 11 | // 12 | 13 | // See ../runtime/sys_linux_386.s for the reason why we always use int 0x80 14 | // instead of the glibc-specific "CALL 0x10(GS)". 15 | #define INVOKE_SYSCALL INT $0x80 16 | 17 | // Just jump to package syscall's implementation for all these functions. 18 | // The runtime may know about them. 19 | 20 | TEXT ·Syscall(SB),NOSPLIT,$0-28 21 | JMP syscall·Syscall(SB) 22 | 23 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 24 | JMP syscall·Syscall6(SB) 25 | 26 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 27 | CALL runtime·entersyscall(SB) 28 | MOVL trap+0(FP), AX // syscall entry 29 | MOVL a1+4(FP), BX 30 | MOVL a2+8(FP), CX 31 | MOVL a3+12(FP), DX 32 | MOVL $0, SI 33 | MOVL $0, DI 34 | INVOKE_SYSCALL 35 | MOVL AX, r1+16(FP) 36 | MOVL DX, r2+20(FP) 37 | CALL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 41 | JMP syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 44 | JMP syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 47 | MOVL trap+0(FP), AX // syscall entry 48 | MOVL a1+4(FP), BX 49 | MOVL a2+8(FP), CX 50 | MOVL a3+12(FP), DX 51 | MOVL $0, SI 52 | MOVL $0, DI 53 | INVOKE_SYSCALL 54 | MOVL AX, r1+16(FP) 55 | MOVL DX, r2+20(FP) 56 | RET 57 | 58 | TEXT ·socketcall(SB),NOSPLIT,$0-36 59 | JMP syscall·socketcall(SB) 60 | 61 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 62 | JMP syscall·rawsocketcall(SB) 63 | 64 | TEXT ·seek(SB),NOSPLIT,$0-28 65 | JMP syscall·seek(SB) 66 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 23 | CALL runtime·entersyscall(SB) 24 | MOVQ a1+8(FP), DI 25 | MOVQ a2+16(FP), SI 26 | MOVQ a3+24(FP), DX 27 | MOVQ $0, R10 28 | MOVQ $0, R8 29 | MOVQ $0, R9 30 | MOVQ trap+0(FP), AX // syscall entry 31 | SYSCALL 32 | MOVQ AX, r1+32(FP) 33 | MOVQ DX, r2+40(FP) 34 | CALL runtime·exitsyscall(SB) 35 | RET 36 | 37 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 38 | JMP syscall·RawSyscall(SB) 39 | 40 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 41 | JMP syscall·RawSyscall6(SB) 42 | 43 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 44 | MOVQ a1+8(FP), DI 45 | MOVQ a2+16(FP), SI 46 | MOVQ a3+24(FP), DX 47 | MOVQ $0, R10 48 | MOVQ $0, R8 49 | MOVQ $0, R9 50 | MOVQ trap+0(FP), AX // syscall entry 51 | SYSCALL 52 | MOVQ AX, r1+32(FP) 53 | MOVQ DX, r2+40(FP) 54 | RET 55 | 56 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 57 | JMP syscall·gettimeofday(SB) 58 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 23 | BL runtime·entersyscall(SB) 24 | MOVW trap+0(FP), R7 25 | MOVW a1+4(FP), R0 26 | MOVW a2+8(FP), R1 27 | MOVW a3+12(FP), R2 28 | MOVW $0, R3 29 | MOVW $0, R4 30 | MOVW $0, R5 31 | SWI $0 32 | MOVW R0, r1+16(FP) 33 | MOVW $0, R0 34 | MOVW R0, r2+20(FP) 35 | BL runtime·exitsyscall(SB) 36 | RET 37 | 38 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 39 | B syscall·RawSyscall(SB) 40 | 41 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 42 | B syscall·RawSyscall6(SB) 43 | 44 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 45 | MOVW trap+0(FP), R7 // syscall entry 46 | MOVW a1+4(FP), R0 47 | MOVW a2+8(FP), R1 48 | MOVW a3+12(FP), R2 49 | SWI $0 50 | MOVW R0, r1+16(FP) 51 | MOVW $0, R0 52 | MOVW R0, r2+20(FP) 53 | RET 54 | 55 | TEXT ·seek(SB),NOSPLIT,$0-28 56 | B syscall·seek(SB) 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 21 | BL runtime·entersyscall(SB) 22 | MOVD a1+8(FP), R0 23 | MOVD a2+16(FP), R1 24 | MOVD a3+24(FP), R2 25 | MOVD $0, R3 26 | MOVD $0, R4 27 | MOVD $0, R5 28 | MOVD trap+0(FP), R8 // syscall entry 29 | SVC 30 | MOVD R0, r1+32(FP) // r1 31 | MOVD R1, r2+40(FP) // r2 32 | BL runtime·exitsyscall(SB) 33 | RET 34 | 35 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 36 | B syscall·RawSyscall(SB) 37 | 38 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 39 | B syscall·RawSyscall6(SB) 40 | 41 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 42 | MOVD a1+8(FP), R0 43 | MOVD a2+16(FP), R1 44 | MOVD a3+24(FP), R2 45 | MOVD $0, R3 46 | MOVD $0, R4 47 | MOVD $0, R5 48 | MOVD trap+0(FP), R8 // syscall entry 49 | SVC 50 | MOVD R0, r1+32(FP) 51 | MOVD R1, r2+40(FP) 52 | RET 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mips64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips64 mips64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 25 | JAL runtime·entersyscall(SB) 26 | MOVV a1+8(FP), R4 27 | MOVV a2+16(FP), R5 28 | MOVV a3+24(FP), R6 29 | MOVV R0, R7 30 | MOVV R0, R8 31 | MOVV R0, R9 32 | MOVV trap+0(FP), R2 // syscall entry 33 | SYSCALL 34 | MOVV R2, r1+32(FP) 35 | MOVV R3, r2+40(FP) 36 | JAL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | JMP syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | JMP syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVV a1+8(FP), R4 47 | MOVV a2+16(FP), R5 48 | MOVV a3+24(FP), R6 49 | MOVV R0, R7 50 | MOVV R0, R8 51 | MOVV R0, R9 52 | MOVV trap+0(FP), R2 // syscall entry 53 | SYSCALL 54 | MOVV R2, r1+32(FP) 55 | MOVV R3, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mipsx.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips mipsle 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-28 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 25 | JMP syscall·Syscall9(SB) 26 | 27 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 28 | JAL runtime·entersyscall(SB) 29 | MOVW a1+4(FP), R4 30 | MOVW a2+8(FP), R5 31 | MOVW a3+12(FP), R6 32 | MOVW R0, R7 33 | MOVW trap+0(FP), R2 // syscall entry 34 | SYSCALL 35 | MOVW R2, r1+16(FP) // r1 36 | MOVW R3, r2+20(FP) // r2 37 | JAL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 41 | JMP syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 44 | JMP syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 47 | MOVW a1+4(FP), R4 48 | MOVW a2+8(FP), R5 49 | MOVW a3+12(FP), R6 50 | MOVW trap+0(FP), R2 // syscall entry 51 | SYSCALL 52 | MOVW R2, r1+16(FP) 53 | MOVW R3, r2+20(FP) 54 | RET 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64 ppc64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for ppc64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 25 | BL runtime·entersyscall(SB) 26 | MOVD a1+8(FP), R3 27 | MOVD a2+16(FP), R4 28 | MOVD a3+24(FP), R5 29 | MOVD R0, R6 30 | MOVD R0, R7 31 | MOVD R0, R8 32 | MOVD trap+0(FP), R9 // syscall entry 33 | SYSCALL R9 34 | MOVD R3, r1+32(FP) 35 | MOVD R4, r2+40(FP) 36 | BL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | BR syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | BR syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVD a1+8(FP), R3 47 | MOVD a2+16(FP), R4 48 | MOVD a3+24(FP), R5 49 | MOVD R0, R6 50 | MOVD R0, R7 51 | MOVD R0, R8 52 | MOVD trap+0(FP), R9 // syscall entry 53 | SYSCALL R9 54 | MOVD R3, r1+32(FP) 55 | MOVD R4, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build s390x 6 | // +build linux 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for s390x, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 25 | BL runtime·entersyscall(SB) 26 | MOVD a1+8(FP), R2 27 | MOVD a2+16(FP), R3 28 | MOVD a3+24(FP), R4 29 | MOVD $0, R5 30 | MOVD $0, R6 31 | MOVD $0, R7 32 | MOVD trap+0(FP), R1 // syscall entry 33 | SYSCALL 34 | MOVD R2, r1+32(FP) 35 | MOVD R3, r2+40(FP) 36 | BL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | BR syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | BR syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVD a1+8(FP), R2 47 | MOVD a2+16(FP), R3 48 | MOVD a3+24(FP), R4 49 | MOVD $0, R5 50 | MOVD $0, R6 51 | MOVD $0, R7 52 | MOVD trap+0(FP), R1 // syscall entry 53 | SYSCALL 54 | MOVD R2, r1+32(FP) 55 | MOVD R3, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | ) 27 | 28 | // Socketoption Level 29 | const ( 30 | SOL_BLUETOOTH = 0x112 31 | SOL_HCI = 0x0 32 | SOL_L2CAP = 0x6 33 | SOL_RFCOMM = 0x12 34 | SOL_SCO = 0x11 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Darwin's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a Darwin device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev >> 24) & 0xff) 13 | } 14 | 15 | // Minor returns the minor component of a Darwin device number. 16 | func Minor(dev uint64) uint32 { 17 | return uint32(dev & 0xffffff) 18 | } 19 | 20 | // Mkdev returns a Darwin device number generated from the given major and minor 21 | // components. 22 | func Mkdev(major, minor uint32) uint64 { 23 | return (uint64(major) << 24) | uint64(minor) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Dragonfly's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a DragonFlyBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a DragonFlyBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a DragonFlyBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in FreeBSD's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a FreeBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a FreeBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a FreeBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used by the Linux kernel and glibc. 7 | // 8 | // The information below is extracted and adapted from bits/sysmacros.h in the 9 | // glibc sources: 10 | // 11 | // dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's 12 | // default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major 13 | // number and m is a hex digit of the minor number. This is backward compatible 14 | // with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also 15 | // backward compatible with the Linux kernel, which for some architectures uses 16 | // 32-bit dev_t, encoded as mmmM MMmm. 17 | 18 | package unix 19 | 20 | // Major returns the major component of a Linux device number. 21 | func Major(dev uint64) uint32 { 22 | major := uint32((dev & 0x00000000000fff00) >> 8) 23 | major |= uint32((dev & 0xfffff00000000000) >> 32) 24 | return major 25 | } 26 | 27 | // Minor returns the minor component of a Linux device number. 28 | func Minor(dev uint64) uint32 { 29 | minor := uint32((dev & 0x00000000000000ff) >> 0) 30 | minor |= uint32((dev & 0x00000ffffff00000) >> 12) 31 | return minor 32 | } 33 | 34 | // Mkdev returns a Linux device number generated from the given major and minor 35 | // components. 36 | func Mkdev(major, minor uint32) uint64 { 37 | dev := (uint64(major) & 0x00000fff) << 8 38 | dev |= (uint64(major) & 0xfffff000) << 32 39 | dev |= (uint64(minor) & 0x000000ff) << 0 40 | dev |= (uint64(minor) & 0xffffff00) << 12 41 | return dev 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in NetBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a NetBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x000fff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of a NetBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xfff00000) >> 12) 19 | return minor 20 | } 21 | 22 | // Mkdev returns a NetBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x000fff00 26 | dev |= (uint64(minor) << 12) & 0xfff00000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in OpenBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of an OpenBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x0000ff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of an OpenBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xffff0000) >> 8) 19 | return minor 20 | } 21 | 22 | // Mkdev returns an OpenBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x0000ff00 26 | dev |= (uint64(minor) << 8) & 0xffff0000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dirent.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // ParseDirent parses up to max directory entries in buf, 12 | // appending the names to names. It returns the number of 13 | // bytes consumed from buf, the number of entries added 14 | // to names, and the new names slice. 15 | func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) { 16 | return syscall.ParseDirent(buf, max, names) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_big.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build ppc64 s390x mips mips64 6 | 7 | package unix 8 | 9 | const isBigEndian = true 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_little.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le 6 | 7 | package unix 8 | 9 | const isBigEndian = false 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | 29 | func Unsetenv(key string) error { 30 | return syscall.Unsetenv(key) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 12 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 13 | var fcntl64Syscall uintptr = SYS_FCNTL 14 | 15 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 16 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 17 | valptr, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(arg)) 18 | var err error 19 | if errno != 0 { 20 | err = errno 21 | } 22 | return int(valptr), err 23 | } 24 | 25 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 26 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 27 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 28 | if errno == 0 { 29 | return nil 30 | } 31 | return errno 32 | } 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm linux,mips linux,mipsle 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define _STRINGIFY2_(x) #x 12 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 13 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 14 | 15 | // Call syscall from C code because the gccgo support for calling from 16 | // Go to C does not support varargs functions. 17 | 18 | struct ret { 19 | uintptr_t r; 20 | uintptr_t err; 21 | }; 22 | 23 | struct ret 24 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 25 | { 26 | struct ret r; 27 | 28 | errno = 0; 29 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 30 | r.err = errno; 31 | return r; 32 | } 33 | 34 | uintptr_t 35 | gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 36 | { 37 | return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 38 | } 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ioctl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "runtime" 10 | 11 | // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. 12 | // 13 | // To change fd's window size, the req argument should be TIOCSWINSZ. 14 | func IoctlSetWinsize(fd int, req uint, value *Winsize) error { 15 | // TODO: if we get the chance, remove the req parameter and 16 | // hardcode TIOCSWINSZ. 17 | err := ioctlSetWinsize(fd, req, value) 18 | runtime.KeepAlive(value) 19 | return err 20 | } 21 | 22 | // IoctlSetTermios performs an ioctl on fd with a *Termios. 23 | // 24 | // The req value will usually be TCSETA or TIOCSETA. 25 | func IoctlSetTermios(fd int, req uint, value *Termios) error { 26 | // TODO: if we get the chance, remove the req parameter. 27 | err := ioctlSetTermios(fd, req, value) 28 | runtime.KeepAlive(value) 29 | return err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mksysnum_darwin.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | # 6 | # Generate system call table for Darwin from sys/syscall.h 7 | 8 | use strict; 9 | 10 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 11 | print STDERR "GOARCH or GOOS not defined in environment\n"; 12 | exit 1; 13 | } 14 | 15 | my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); 16 | 17 | print <){ 29 | if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ 30 | my $name = $1; 31 | my $num = $2; 32 | $name =~ y/a-z/A-Z/; 33 | print " SYS_$name = $num;" 34 | } 35 | } 36 | 37 | print <){ 30 | if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 30 | if(/^([0-9]+)\s+\S+\s+(?:NO)?STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 31 | if($line =~ /^(.*)\\$/) { 32 | # Handle continuation 33 | $line = $1; 34 | $_ =~ s/^\s+//; 35 | $line .= $_; 36 | } else { 37 | # New line 38 | $line = $_; 39 | } 40 | next if $line =~ /\\$/; 41 | if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) { 42 | my $num = $1; 43 | my $proto = $6; 44 | my $compat = $8; 45 | my $name = "$7_$9"; 46 | 47 | $name = "$7_$11" if $11 ne ''; 48 | $name =~ y/a-z/A-Z/; 49 | 50 | if($compat eq '' || $compat eq '13' || $compat eq '30' || $compat eq '50') { 51 | print " $name = $num; // $proto\n"; 52 | } 53 | } 54 | } 55 | 56 | print <){ 30 | if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $3; 33 | my $name = $4; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: int32(usec)} 20 | } 21 | 22 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 23 | func Gettimeofday(tv *Timeval) (err error) { 24 | // The tv passed to gettimeofday must be non-nil 25 | // but is otherwise unused. The answers come back 26 | // in the two registers. 27 | sec, usec, err := gettimeofday(tv) 28 | tv.Sec = sec 29 | tv.Usec = usec 30 | return err 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint64(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint64(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var length = uint64(count) 53 | 54 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 55 | 56 | written = int(length) 57 | 58 | if e1 != 0 { 59 | err = e1 60 | } 61 | return 62 | } 63 | 64 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 65 | 66 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 67 | // of darwin/amd64 the syscall is called sysctl instead of __sysctl. 68 | const SYS___SYSCTL = SYS_SYSCTL 69 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func setTimespec(sec, nsec int64) Timespec { 13 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 14 | } 15 | 16 | func setTimeval(sec, usec int64) Timeval { 17 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 18 | } 19 | 20 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 21 | func Gettimeofday(tv *Timeval) (err error) { 22 | // The tv passed to gettimeofday must be non-nil 23 | // but is otherwise unused. The answers come back 24 | // in the two registers. 25 | sec, usec, err := gettimeofday(tv) 26 | tv.Sec = int32(sec) 27 | tv.Usec = int32(usec) 28 | return err 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint32(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint32(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var length = uint64(count) 51 | 52 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 53 | 54 | written = int(length) 55 | 56 | if e1 != 0 { 57 | err = e1 58 | } 59 | return 60 | } 61 | 62 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 63 | 64 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 65 | // of darwin/arm the syscall is called sysctl instead of __sysctl. 66 | const SYS___SYSCTL = SYS_SYSCTL 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: int32(usec)} 20 | } 21 | 22 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 23 | func Gettimeofday(tv *Timeval) (err error) { 24 | // The tv passed to gettimeofday must be non-nil 25 | // but is otherwise unused. The answers come back 26 | // in the two registers. 27 | sec, usec, err := gettimeofday(tv) 28 | tv.Sec = sec 29 | tv.Usec = usec 30 | return err 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint64(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint64(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var length = uint64(count) 53 | 54 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 55 | 56 | written = int(length) 57 | 58 | if e1 != 0 { 59 | err = e1 60 | } 61 | return 62 | } 63 | 64 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 65 | 66 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 67 | // of darwin/arm64 the syscall is called sysctl instead of __sysctl. 68 | const SYS___SYSCTL = SYS_SYSCTL 69 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,linux 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | //go:noescape 13 | func gettimeofday(tv *Timeval) (err syscall.Errno) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo 6 | 7 | package unix 8 | 9 | // SyscallNoError may be used instead of Syscall for syscalls that don't fail. 10 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 11 | 12 | // RawSyscallNoError may be used instead of RawSyscall for syscalls that don't 13 | // fail. 14 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo,386 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // Underlying system call writes to newoffset via pointer. 12 | // Implemented in assembly to avoid allocation. 13 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 14 | 15 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 16 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,386 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | 22 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 23 | fd, _, err := Syscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 24 | return int(fd), err 25 | } 26 | 27 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 28 | fd, _, err := RawSyscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 29 | return int(fd), err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,arm 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | 35 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 36 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 37 | const SYS___SYSCTL = SYS_SYSCTL 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func (iov *Iovec) SetLen(length int) { 18 | iov.Len = uint64(length) 19 | } 20 | 21 | func (cmsg *Cmsghdr) SetLen(length int) { 22 | cmsg.Len = uint32(length) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 13 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 14 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracearm_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(arm, arm64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build arm arm64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsArm is the registers used by arm binaries. 11 | type PtraceRegsArm struct { 12 | Uregs [18]uint32 13 | } 14 | 15 | // PtraceGetRegsArm fetches the registers used by arm binaries. 16 | func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error { 17 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 18 | } 19 | 20 | // PtraceSetRegsArm sets the registers used by arm binaries. 21 | func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error { 22 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 23 | } 24 | 25 | // PtraceRegsArm64 is the registers used by arm64 binaries. 26 | type PtraceRegsArm64 struct { 27 | Regs [31]uint64 28 | Sp uint64 29 | Pc uint64 30 | Pstate uint64 31 | } 32 | 33 | // PtraceGetRegsArm64 fetches the registers used by arm64 binaries. 34 | func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error { 35 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 36 | } 37 | 38 | // PtraceSetRegsArm64 sets the registers used by arm64 binaries. 39 | func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error { 40 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracemips_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(mips, mips64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build mips mips64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsMips is the registers used by mips binaries. 11 | type PtraceRegsMips struct { 12 | Regs [32]uint64 13 | Lo uint64 14 | Hi uint64 15 | Epc uint64 16 | Badvaddr uint64 17 | Status uint64 18 | Cause uint64 19 | } 20 | 21 | // PtraceGetRegsMips fetches the registers used by mips binaries. 22 | func PtraceGetRegsMips(pid int, regsout *PtraceRegsMips) error { 23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 24 | } 25 | 26 | // PtraceSetRegsMips sets the registers used by mips binaries. 27 | func PtraceSetRegsMips(pid int, regs *PtraceRegsMips) error { 28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 29 | } 30 | 31 | // PtraceRegsMips64 is the registers used by mips64 binaries. 32 | type PtraceRegsMips64 struct { 33 | Regs [32]uint64 34 | Lo uint64 35 | Hi uint64 36 | Epc uint64 37 | Badvaddr uint64 38 | Status uint64 39 | Cause uint64 40 | } 41 | 42 | // PtraceGetRegsMips64 fetches the registers used by mips64 binaries. 43 | func PtraceGetRegsMips64(pid int, regsout *PtraceRegsMips64) error { 44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 45 | } 46 | 47 | // PtraceSetRegsMips64 sets the registers used by mips64 binaries. 48 | func PtraceSetRegsMips64(pid int, regs *PtraceRegsMips64) error { 49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracemipsle_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(mipsle, mips64le). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build mipsle mips64le 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsMipsle is the registers used by mipsle binaries. 11 | type PtraceRegsMipsle struct { 12 | Regs [32]uint64 13 | Lo uint64 14 | Hi uint64 15 | Epc uint64 16 | Badvaddr uint64 17 | Status uint64 18 | Cause uint64 19 | } 20 | 21 | // PtraceGetRegsMipsle fetches the registers used by mipsle binaries. 22 | func PtraceGetRegsMipsle(pid int, regsout *PtraceRegsMipsle) error { 23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 24 | } 25 | 26 | // PtraceSetRegsMipsle sets the registers used by mipsle binaries. 27 | func PtraceSetRegsMipsle(pid int, regs *PtraceRegsMipsle) error { 28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 29 | } 30 | 31 | // PtraceRegsMips64le is the registers used by mips64le binaries. 32 | type PtraceRegsMips64le struct { 33 | Regs [32]uint64 34 | Lo uint64 35 | Hi uint64 36 | Epc uint64 37 | Badvaddr uint64 38 | Status uint64 39 | Cause uint64 40 | } 41 | 42 | // PtraceGetRegsMips64le fetches the registers used by mips64le binaries. 43 | func PtraceGetRegsMips64le(pid int, regsout *PtraceRegsMips64le) error { 44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 45 | } 46 | 47 | // PtraceSetRegsMips64le sets the registers used by mips64le binaries. 48 | func PtraceSetRegsMips64le(pid int, regs *PtraceRegsMips64le) error { 49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | // +build go1.9 7 | 8 | package windows 9 | 10 | import "syscall" 11 | 12 | type Errno = syscall.Errno 13 | type SysProcAttr = syscall.SysProcAttr 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/asm_windows_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // 6 | // System calls for 386, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-16 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-12 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/asm_windows_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // 6 | // System calls for amd64, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-32 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-24 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/env_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Windows environment variables. 6 | 7 | package windows 8 | 9 | import "syscall" 10 | 11 | func Getenv(key string) (value string, found bool) { 12 | return syscall.Getenv(key) 13 | } 14 | 15 | func Setenv(key, value string) error { 16 | return syscall.Setenv(key, value) 17 | } 18 | 19 | func Clearenv() { 20 | syscall.Clearenv() 21 | } 22 | 23 | func Environ() []string { 24 | return syscall.Environ() 25 | } 26 | 27 | func Unsetenv(key string) error { 28 | return syscall.Unsetenv(key) 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/eventlog.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package windows 8 | 9 | const ( 10 | EVENTLOG_SUCCESS = 0 11 | EVENTLOG_ERROR_TYPE = 1 12 | EVENTLOG_WARNING_TYPE = 2 13 | EVENTLOG_INFORMATION_TYPE = 4 14 | EVENTLOG_AUDIT_SUCCESS = 8 15 | EVENTLOG_AUDIT_FAILURE = 16 16 | ) 17 | 18 | //sys RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) [failretval==0] = advapi32.RegisterEventSourceW 19 | //sys DeregisterEventSource(handle Handle) (err error) = advapi32.DeregisterEventSource 20 | //sys ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) = advapi32.ReportEventW 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/memory_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | const ( 8 | MEM_COMMIT = 0x00001000 9 | MEM_RESERVE = 0x00002000 10 | MEM_DECOMMIT = 0x00004000 11 | MEM_RELEASE = 0x00008000 12 | MEM_RESET = 0x00080000 13 | MEM_TOP_DOWN = 0x00100000 14 | MEM_WRITE_WATCH = 0x00200000 15 | MEM_PHYSICAL = 0x00400000 16 | MEM_RESET_UNDO = 0x01000000 17 | MEM_LARGE_PAGES = 0x20000000 18 | 19 | PAGE_NOACCESS = 0x01 20 | PAGE_READONLY = 0x02 21 | PAGE_READWRITE = 0x04 22 | PAGE_WRITECOPY = 0x08 23 | PAGE_EXECUTE_READ = 0x20 24 | PAGE_EXECUTE_READWRITE = 0x40 25 | PAGE_EXECUTE_WRITECOPY = 0x80 26 | ) 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/mksyscall.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | //go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go 8 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows,race 6 | 7 | package windows 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows,!race 6 | 7 | package windows 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package windows 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + itoa(-val) 12 | } 13 | var buf [32]byte // big enough for int64 14 | i := len(buf) - 1 15 | for val >= 10 { 16 | buf[i] = byte(val%10 + '0') 17 | i-- 18 | val /= 10 19 | } 20 | buf[i] = byte(val + '0') 21 | return string(buf[i:]) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_386.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 windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | Description [WSADESCRIPTION_LEN + 1]byte 11 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 12 | MaxSockets uint16 13 | MaxUdpDg uint16 14 | VendorInfo *byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Port uint16 21 | Proto *byte 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_amd64.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 windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | MaxSockets uint16 11 | MaxUdpDg uint16 12 | VendorInfo *byte 13 | Description [WSADESCRIPTION_LEN + 1]byte 14 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Proto *byte 21 | Port uint16 22 | } 23 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/AUTHORS: -------------------------------------------------------------------------------- 1 | Google Inc. 2 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/codes/code_string.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2017 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package codes 20 | 21 | import "strconv" 22 | 23 | func (c Code) String() string { 24 | switch c { 25 | case OK: 26 | return "OK" 27 | case Canceled: 28 | return "Canceled" 29 | case Unknown: 30 | return "Unknown" 31 | case InvalidArgument: 32 | return "InvalidArgument" 33 | case DeadlineExceeded: 34 | return "DeadlineExceeded" 35 | case NotFound: 36 | return "NotFound" 37 | case AlreadyExists: 38 | return "AlreadyExists" 39 | case PermissionDenied: 40 | return "PermissionDenied" 41 | case ResourceExhausted: 42 | return "ResourceExhausted" 43 | case FailedPrecondition: 44 | return "FailedPrecondition" 45 | case Aborted: 46 | return "Aborted" 47 | case OutOfRange: 48 | return "OutOfRange" 49 | case Unimplemented: 50 | return "Unimplemented" 51 | case Internal: 52 | return "Internal" 53 | case Unavailable: 54 | return "Unavailable" 55 | case DataLoss: 56 | return "DataLoss" 57 | case Unauthenticated: 58 | return "Unauthenticated" 59 | default: 60 | return "Code(" + strconv.FormatInt(int64(c), 10) + ")" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/status/go16.go: -------------------------------------------------------------------------------- 1 | // +build go1.6,!go1.7 2 | 3 | /* 4 | * 5 | * Copyright 2018 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package status 22 | 23 | import ( 24 | "golang.org/x/net/context" 25 | "google.golang.org/grpc/codes" 26 | ) 27 | 28 | // FromContextError converts a context error into a Status. It returns a 29 | // Status with codes.OK if err is nil, or a Status with codes.Unknown if err is 30 | // non-nil and not a context error. 31 | func FromContextError(err error) *Status { 32 | switch err { 33 | case nil: 34 | return New(codes.OK, "") 35 | case context.DeadlineExceeded: 36 | return New(codes.DeadlineExceeded, err.Error()) 37 | case context.Canceled: 38 | return New(codes.Canceled, err.Error()) 39 | default: 40 | return New(codes.Unknown, err.Error()) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/status/go17.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | /* 4 | * 5 | * Copyright 2018 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package status 22 | 23 | import ( 24 | "context" 25 | 26 | netctx "golang.org/x/net/context" 27 | "google.golang.org/grpc/codes" 28 | ) 29 | 30 | // FromContextError converts a context error into a Status. It returns a 31 | // Status with codes.OK if err is nil, or a Status with codes.Unknown if err is 32 | // non-nil and not a context error. 33 | func FromContextError(err error) *Status { 34 | switch err { 35 | case nil: 36 | return New(codes.OK, "") 37 | case context.DeadlineExceeded, netctx.DeadlineExceeded: 38 | return New(codes.DeadlineExceeded, err.Error()) 39 | case context.Canceled, netctx.Canceled: 40 | return New(codes.Canceled, err.Error()) 41 | default: 42 | return New(codes.Unknown, err.Error()) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-errors.v1/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-errors.v1/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.7.x 5 | - tip 6 | 7 | matrix: 8 | allow_failures: 9 | - go: tip 10 | 11 | install: 12 | - rm -rf $GOPATH/src/gopkg.in/src-d 13 | - mkdir -p $GOPATH/src/gopkg.in/src-d 14 | - ln -s $PWD $GOPATH/src/gopkg.in/src-d/go-errors.v0 15 | - cd $GOPATH/src/gopkg.in/src-d/go-errors.v0 16 | - go get -v -t ./... 17 | 18 | script: 19 | - make test 20 | 21 | after_success: 22 | - bash <(curl -s https://codecov.io/bash) 23 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-errors.v1/DCO: -------------------------------------------------------------------------------- 1 | Developer Certificate of Origin 2 | Version 1.1 3 | 4 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 5 | 660 York Street, Suite 102, 6 | San Francisco, CA 94110 USA 7 | 8 | Everyone is permitted to copy and distribute verbatim copies of this 9 | license document, but changing it is not allowed. 10 | 11 | 12 | Developer's Certificate of Origin 1.1 13 | 14 | By making a contribution to this project, I certify that: 15 | 16 | (a) The contribution was created in whole or in part by me and I 17 | have the right to submit it under the open source license 18 | indicated in the file; or 19 | 20 | (b) The contribution is based upon previous work that, to the best 21 | of my knowledge, is covered under an appropriate open source 22 | license and I have the right under that license to submit that 23 | work with modifications, whether created in whole or in part 24 | by me, under the same open source license (unless I am 25 | permitted to submit under a different license), as indicated 26 | in the file; or 27 | 28 | (c) The contribution was provided directly to me by some other 29 | person who certified (a), (b) or (c) and I have not modified 30 | it. 31 | 32 | (d) I understand and agree that this project and the contribution 33 | are public and that a record of the contribution (including all 34 | personal information I submit with it, including my sign-off) is 35 | maintained indefinitely and may be redistributed consistent with 36 | this project or the open source license(s) involved. 37 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-errors.v1/MAINTAINERS: -------------------------------------------------------------------------------- 1 | Máximo Cuadros Ortiz (@mcuadros) 2 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-errors.v1/Makefile: -------------------------------------------------------------------------------- 1 | COVERAGE_REPORT := coverage.txt 2 | COVERAGE_PROFILE := profile.out 3 | COVERAGE_MODE := atomic 4 | 5 | test: 6 | @echo "mode: $(COVERAGE_MODE)" > $(COVERAGE_REPORT); \ 7 | for dir in `find . -name "*.go" | grep -o '.*/' | sort -u`; do \ 8 | go test $$dir -coverprofile=$(COVERAGE_PROFILE) -covermode=$(COVERAGE_MODE); \ 9 | if [ $$? != 0 ]; then \ 10 | exit 2; \ 11 | fi; \ 12 | if [ -f $(COVERAGE_PROFILE) ]; then \ 13 | tail -n +2 $(COVERAGE_PROFILE) >> $(COVERAGE_REPORT); \ 14 | rm $(COVERAGE_PROFILE); \ 15 | fi; \ 16 | done; -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-errors.v1/doc.go: -------------------------------------------------------------------------------- 1 | // Yet another `errors` package, implementing errors handling primitives, 2 | // allowing error wrapping and error tracing. 3 | package errors // import "gopkg.in/src-d/go-errors.v1" 4 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-errors.v1/matcher.go: -------------------------------------------------------------------------------- 1 | package errors 2 | 3 | // Matcher matches a given error 4 | type Matcher interface { 5 | // Is returns true if the err matches 6 | Is(err error) bool 7 | } 8 | 9 | // Is check if err matches all matchers 10 | func Is(err error, matchers ...Matcher) bool { 11 | if len(matchers) == 0 { 12 | return false 13 | } 14 | 15 | for _, m := range matchers { 16 | if !m.Is(err) { 17 | return false 18 | } 19 | } 20 | 21 | return true 22 | } 23 | 24 | // Any checks if err matches any matchers 25 | func Any(err error, matchers ...Matcher) bool { 26 | if len(matchers) == 0 { 27 | return false 28 | } 29 | 30 | for _, m := range matchers { 31 | if m.Is(err) { 32 | return true 33 | } 34 | } 35 | 36 | return false 37 | } 38 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-errors.v1/stack.go: -------------------------------------------------------------------------------- 1 | package errors 2 | 3 | import ( 4 | "runtime" 5 | 6 | "github.com/pkg/errors" 7 | ) 8 | 9 | // StackTrace is stack of Frames from innermost (newest) to outermost (oldest). 10 | type StackTrace struct { 11 | errors.StackTrace 12 | } 13 | 14 | // NewStackTrace returns a new StackTrace, skipping the given number of frames, 15 | // to avoid including the caller 16 | func NewStackTrace(skip int) StackTrace { 17 | const depth = 32 18 | 19 | var pcs [depth]uintptr 20 | n := runtime.Callers(2+skip, pcs[:]) 21 | 22 | f := make(errors.StackTrace, n) 23 | for i := 0; i < n; i++ { 24 | f[i] = errors.Frame(pcs[i]) 25 | } 26 | 27 | return StackTrace{f} 28 | } 29 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | 26 | # Tpc-h tbl files 27 | benchmark/*tbl 28 | vendor 29 | Makefile.main 30 | .ci/ 31 | _example/main 32 | _example/*.exe 33 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.10.x 5 | - 1.11.x 6 | - tip 7 | 8 | go_import_path: gopkg.in/src-d/go-mysql-server.v0 9 | 10 | addons: 11 | apt: 12 | packages: 13 | - libonig-dev 14 | 15 | matrix: 16 | fast_finish: true 17 | allow_failures: 18 | - go: tip 19 | 20 | sudo: required 21 | 22 | services: 23 | - docker 24 | 25 | before_install: 26 | - docker pull pilosa/pilosa:v1.1.0 27 | - docker run -d --name pilosa -p 127.0.0.1:10101:10101 pilosa/pilosa:v1.1.0 28 | - docker ps -a 29 | 30 | install: 31 | - go get -u github.com/golang/dep/cmd/dep 32 | - touch Gopkg.toml 33 | - dep ensure -v -add "github.com/pilosa/go-pilosa@0.10.0" "github.com/pilosa/pilosa@1.1.0" "github.com/moovweb/rubex@b3d9ff6ad7d9b14f94a91c8271cd9ad9e77132e5" 34 | - make dependencies 35 | 36 | script: 37 | - make ci-script 38 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/DCO: -------------------------------------------------------------------------------- 1 | Developer Certificate of Origin 2 | Version 1.1 3 | 4 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 5 | 660 York Street, Suite 102, 6 | San Francisco, CA 94110 USA 7 | 8 | Everyone is permitted to copy and distribute verbatim copies of this 9 | license document, but changing it is not allowed. 10 | 11 | 12 | Developer's Certificate of Origin 1.1 13 | 14 | By making a contribution to this project, I certify that: 15 | 16 | (a) The contribution was created in whole or in part by me and I 17 | have the right to submit it under the open source license 18 | indicated in the file; or 19 | 20 | (b) The contribution is based upon previous work that, to the best 21 | of my knowledge, is covered under an appropriate open source 22 | license and I have the right under that license to submit that 23 | work with modifications, whether created in whole or in part 24 | by me, under the same open source license (unless I am 25 | permitted to submit under a different license), as indicated 26 | in the file; or 27 | 28 | (c) The contribution was provided directly to me by some other 29 | person who certified (a), (b) or (c) and I have not modified 30 | it. 31 | 32 | (d) I understand and agree that this project and the contribution 33 | are public and that a record of the contribution (including all 34 | personal information I submit with it, including my sign-off) is 35 | maintained indefinitely and may be redistributed consistent with 36 | this project or the open source license(s) involved. 37 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/MAINTAINERS: -------------------------------------------------------------------------------- 1 | Antonio Navarro Perez (@ajnavarro) 2 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/Makefile: -------------------------------------------------------------------------------- 1 | # Package configuration 2 | PROJECT = go-mysql-server 3 | COMMANDS = 4 | GO_TAGS = oniguruma 5 | 6 | # Including ci Makefile 7 | CI_REPOSITORY ?= https://github.com/src-d/ci.git 8 | CI_BRANCH ?= v1 9 | CI_PATH ?= .ci 10 | MAKEFILE := $(CI_PATH)/Makefile.main 11 | $(MAKEFILE): 12 | git clone --quiet --depth 1 -b $(CI_BRANCH) $(CI_REPOSITORY) $(CI_PATH); 13 | -include $(MAKEFILE) 14 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/SUPPORTED.md: -------------------------------------------------------------------------------- 1 | # Supported SQL Syntax 2 | 3 | ## Comparisson expressions 4 | - != 5 | - == 6 | - \> 7 | - < 8 | - \>= 9 | - <= 10 | - BETWEEN 11 | - IN 12 | - NOT IN 13 | - REGEXP 14 | 15 | ## Null check expressions 16 | - IS NOT NULL 17 | - IS NULL 18 | 19 | ## Grouping expressions 20 | - AVG 21 | - COUNT 22 | - MAX 23 | - MIN 24 | - SUM (always returns DOUBLE) 25 | 26 | ## Standard expressions 27 | - ALIAS (AS) 28 | - CAST/CONVERT 29 | - CREATE TABLE 30 | - DESCRIBE/DESC/EXPLAIN [table name] 31 | - DESCRIBE/DESC/EXPLAIN FORMAT=TREE [query] 32 | - DISTINCT 33 | - FILTER (WHERE) 34 | - GROUP BY 35 | - INSERT INTO 36 | - LIMIT/OFFSET 37 | - LITERAL 38 | - ORDER BY 39 | - SELECT 40 | - SHOW TABLES 41 | - SORT 42 | - STAR (*) 43 | 44 | ## Index expressions 45 | - CREATE INDEX (an index can be created using either column names or a single arbitrary expression). 46 | - DROP INDEX 47 | - SHOW {INDEXES | INDEX | KEYS} {FROM | IN} [table name] 48 | 49 | ## Join expressions 50 | - CROSS JOIN 51 | - INNER JOIN 52 | - NATURAL JOIN 53 | 54 | ## Logical expressions 55 | - AND 56 | - NOT 57 | - OR 58 | 59 | ## Arithmetic expressions 60 | - \+ 61 | - \- 62 | - \* 63 | - \\ 64 | - << 65 | - \>> 66 | - & 67 | - \| 68 | - ^ 69 | - div 70 | - % 71 | 72 | ## Subqueries 73 | - supported only as tables, not as expressions. 74 | 75 | ## Functions 76 | - ARRAY_LENGTH 77 | - CONCAT 78 | - IS_BINARY 79 | - SPLIT 80 | - SUBSTRING 81 | 82 | ## Time functions 83 | - DAY 84 | - DAYOFYEAR 85 | - HOUR 86 | - MINUTE 87 | - MONTH 88 | - SECOND 89 | - YEAR 90 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-hacker -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/go.mod: -------------------------------------------------------------------------------- 1 | module gopkg.in/src-d/go-mysql-server.v0 2 | 3 | require ( 4 | github.com/boltdb/bolt v1.3.1 5 | github.com/cespare/xxhash v1.0.0 // indirect 6 | github.com/davecgh/go-spew v1.1.1 // indirect 7 | github.com/gogo/protobuf v1.1.1 // indirect 8 | github.com/golang/protobuf v1.2.0 // indirect 9 | github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452 10 | github.com/moovweb/rubex v0.0.1 11 | github.com/opentracing/opentracing-go v1.0.2 12 | github.com/pilosa/go-pilosa v0.10.0 13 | github.com/pilosa/pilosa v1.1.0 14 | github.com/pkg/errors v0.8.0 // indirect 15 | github.com/pmezard/go-difflib v1.0.0 // indirect 16 | github.com/satori/go.uuid v1.2.0 17 | github.com/sirupsen/logrus v1.0.6 18 | github.com/spf13/cast v1.2.0 19 | github.com/stretchr/testify v1.2.2 20 | golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac // indirect 21 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d // indirect 22 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect 23 | golang.org/x/sys v0.0.0-20180824143301-4910a1d54f87 // indirect 24 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 // indirect 25 | google.golang.org/grpc v1.14.0 // indirect 26 | gopkg.in/src-d/go-errors.v1 v1.0.0 27 | gopkg.in/src-d/go-vitess.v0 v0.0.0-20180222154500-2cb632cdef3c 28 | gopkg.in/yaml.v2 v2.2.1 29 | ) 30 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/internal/regex/regex_go.go: -------------------------------------------------------------------------------- 1 | package regex 2 | 3 | import "regexp" 4 | 5 | // Go holds go regex engine Matcher. 6 | type Go struct { 7 | reg *regexp.Regexp 8 | } 9 | 10 | // Match implements Matcher interface. 11 | func (r *Go) Match(s string) bool { 12 | return r.reg.MatchString(s) 13 | } 14 | 15 | // NewGo creates a new Matcher using go regex engine. 16 | func NewGo(re string) (Matcher, error) { 17 | reg, err := regexp.Compile(re) 18 | if err != nil { 19 | return nil, err 20 | } 21 | 22 | r := Go{ 23 | reg: reg, 24 | } 25 | 26 | return &r, nil 27 | } 28 | 29 | func init() { 30 | err := Register("go", NewGo) 31 | if err != nil { 32 | panic(err.Error()) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/internal/regex/regex_oniguruma.go: -------------------------------------------------------------------------------- 1 | // +build oniguruma 2 | 3 | package regex 4 | 5 | import "github.com/moovweb/rubex" 6 | 7 | // Oniguruma holds a rubex regular expression Matcher. 8 | type Oniguruma struct { 9 | reg *rubex.Regexp 10 | } 11 | 12 | // Match implements Matcher interface. 13 | func (r *Oniguruma) Match(s string) bool { 14 | return r.reg.MatchString(s) 15 | } 16 | 17 | // NewOniguruma creates a new Matcher using oniguruma engine. 18 | func NewOniguruma(re string) (Matcher, error) { 19 | reg, err := rubex.Compile(re) 20 | if err != nil { 21 | return nil, err 22 | } 23 | 24 | r := Oniguruma{ 25 | reg: reg, 26 | } 27 | 28 | return &r, nil 29 | } 30 | 31 | func init() { 32 | err := Register("oniguruma", NewOniguruma) 33 | if err != nil { 34 | panic(err.Error()) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/mem/database.go: -------------------------------------------------------------------------------- 1 | package mem // import "gopkg.in/src-d/go-mysql-server.v0/mem" 2 | 3 | import ( 4 | "gopkg.in/src-d/go-mysql-server.v0/sql" 5 | ) 6 | 7 | // Database is an in-memory database. 8 | type Database struct { 9 | name string 10 | tables map[string]sql.Table 11 | } 12 | 13 | // NewDatabase creates a new database with the given name. 14 | func NewDatabase(name string) *Database { 15 | return &Database{ 16 | name: name, 17 | tables: map[string]sql.Table{}, 18 | } 19 | } 20 | 21 | // Name returns the database name. 22 | func (d *Database) Name() string { 23 | return d.name 24 | } 25 | 26 | // Tables returns all tables in the database. 27 | func (d *Database) Tables() map[string]sql.Table { 28 | return d.tables 29 | } 30 | 31 | // AddTable adds a new table to the database. 32 | func (d *Database) AddTable(name string, t sql.Table) { 33 | d.tables[name] = t 34 | } 35 | 36 | // Create creates a table with the given name and schema 37 | func (d *Database) Create(name string, schema sql.Schema) error { 38 | _, ok := d.tables[name] 39 | if ok { 40 | return sql.ErrTableAlreadyExists.New(name) 41 | } 42 | 43 | d.tables[name] = NewTable(name, schema) 44 | return nil 45 | } 46 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/server/server.go: -------------------------------------------------------------------------------- 1 | package server // import "gopkg.in/src-d/go-mysql-server.v0/server" 2 | 3 | import ( 4 | opentracing "github.com/opentracing/opentracing-go" 5 | "gopkg.in/src-d/go-mysql-server.v0" 6 | 7 | "gopkg.in/src-d/go-vitess.v0/mysql" 8 | ) 9 | 10 | // Server is a MySQL server for SQLe engines. 11 | type Server struct { 12 | Listener *mysql.Listener 13 | } 14 | 15 | // Config for the mysql server. 16 | type Config struct { 17 | // Protocol for the connection. 18 | Protocol string 19 | // Address of the server. 20 | Address string 21 | // Auth of the server. 22 | Auth mysql.AuthServer 23 | // Tracer to use in the server. By default, a noop tracer will be used if 24 | // no tracer is provided. 25 | Tracer opentracing.Tracer 26 | } 27 | 28 | // NewDefaultServer creates a Server with the default session builder. 29 | func NewDefaultServer(cfg Config, e *sqle.Engine) (*Server, error) { 30 | return NewServer(cfg, e, DefaultSessionBuilder) 31 | } 32 | 33 | // NewServer creates a server with the given protocol, address, authentication 34 | // details given a SQLe engine and a session builder. 35 | func NewServer(cfg Config, e *sqle.Engine, sb SessionBuilder) (*Server, error) { 36 | var tracer opentracing.Tracer 37 | if cfg.Tracer != nil { 38 | tracer = cfg.Tracer 39 | } else { 40 | tracer = opentracing.NoopTracer{} 41 | } 42 | 43 | handler := NewHandler(e, NewSessionManager(sb, tracer, cfg.Address)) 44 | l, err := mysql.NewListener(cfg.Protocol, cfg.Address, cfg.Auth, handler) 45 | if err != nil { 46 | return nil, err 47 | } 48 | 49 | return &Server{Listener: l}, nil 50 | } 51 | 52 | // Start starts accepting connections on the server. 53 | func (s *Server) Start() error { 54 | s.Listener.Accept() 55 | return nil 56 | } 57 | 58 | // Close closes the server connection. 59 | func (s *Server) Close() error { 60 | s.Listener.Close() 61 | return nil 62 | } 63 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/analyzer/assign_catalog.go: -------------------------------------------------------------------------------- 1 | package analyzer 2 | 3 | import ( 4 | "gopkg.in/src-d/go-mysql-server.v0/sql" 5 | "gopkg.in/src-d/go-mysql-server.v0/sql/plan" 6 | ) 7 | 8 | // assignCatalog sets the catalog in the required nodes. 9 | func assignCatalog(ctx *sql.Context, a *Analyzer, n sql.Node) (sql.Node, error) { 10 | if !n.Resolved() { 11 | return n, nil 12 | } 13 | 14 | span, ctx := ctx.Span("assign_catalog") 15 | defer span.Finish() 16 | 17 | switch node := n.(type) { 18 | case *plan.CreateIndex: 19 | nc := *node 20 | nc.Catalog = a.Catalog 21 | nc.CurrentDatabase = a.CurrentDatabase 22 | return &nc, nil 23 | case *plan.DropIndex: 24 | nc := *node 25 | nc.Catalog = a.Catalog 26 | nc.CurrentDatabase = a.CurrentDatabase 27 | return &nc, nil 28 | case *plan.ShowIndexes: 29 | nc := *node 30 | nc.Registry = a.Catalog.IndexRegistry 31 | return &nc, nil 32 | case *plan.ShowProcessList: 33 | nc := *node 34 | nc.Database = a.CurrentDatabase 35 | nc.ProcessList = a.Catalog.ProcessList 36 | return &nc, nil 37 | default: 38 | return n, nil 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/analyzer/filters.go: -------------------------------------------------------------------------------- 1 | package analyzer 2 | 3 | import ( 4 | "reflect" 5 | 6 | "gopkg.in/src-d/go-mysql-server.v0/sql" 7 | "gopkg.in/src-d/go-mysql-server.v0/sql/expression" 8 | ) 9 | 10 | type filters map[string][]sql.Expression 11 | 12 | func (f filters) merge(f2 filters) { 13 | for k, exprs := range f2 { 14 | f[k] = append(f[k], exprs...) 15 | } 16 | } 17 | 18 | func exprToTableFilters(expr sql.Expression) filters { 19 | filtersByTable := make(filters) 20 | for _, expr := range splitExpression(expr) { 21 | var tables []string 22 | _, _ = expr.TransformUp(func(e sql.Expression) (sql.Expression, error) { 23 | f, ok := e.(*expression.GetField) 24 | if ok { 25 | tables = append(tables, f.Table()) 26 | } 27 | 28 | return e, nil 29 | }) 30 | 31 | if len(tables) == 1 { 32 | filtersByTable[tables[0]] = append(filtersByTable[tables[0]], expr) 33 | } 34 | } 35 | 36 | return filtersByTable 37 | } 38 | 39 | func splitExpression(expr sql.Expression) []sql.Expression { 40 | and, ok := expr.(*expression.And) 41 | if !ok { 42 | return []sql.Expression{expr} 43 | } 44 | 45 | return append( 46 | splitExpression(and.Left), 47 | splitExpression(and.Right)..., 48 | ) 49 | } 50 | 51 | func getUnhandledFilters(all, handled []sql.Expression) []sql.Expression { 52 | var unhandledFilters []sql.Expression 53 | 54 | for _, f := range all { 55 | var isHandled bool 56 | for _, hf := range handled { 57 | if reflect.DeepEqual(f, hf) { 58 | isHandled = true 59 | break 60 | } 61 | } 62 | 63 | if !isHandled { 64 | unhandledFilters = append(unhandledFilters, f) 65 | } 66 | } 67 | 68 | return unhandledFilters 69 | } 70 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/analyzer/process.go: -------------------------------------------------------------------------------- 1 | package analyzer 2 | 3 | import ( 4 | "gopkg.in/src-d/go-mysql-server.v0/sql" 5 | "gopkg.in/src-d/go-mysql-server.v0/sql/plan" 6 | ) 7 | 8 | func trackProcess(ctx *sql.Context, a *Analyzer, n sql.Node) (sql.Node, error) { 9 | if !n.Resolved() { 10 | return n, nil 11 | } 12 | 13 | if _, ok := n.(*plan.QueryProcess); ok { 14 | return n, nil 15 | } 16 | 17 | var query string 18 | if x, ok := ctx.Value(sql.QueryKey).(string); ok { 19 | query = x 20 | } 21 | 22 | var typ = sql.QueryProcess 23 | if _, ok := n.(*plan.CreateIndex); ok { 24 | typ = sql.CreateIndexProcess 25 | } 26 | 27 | processList := a.Catalog.ProcessList 28 | pid := processList.AddProcess(ctx, typ, query) 29 | 30 | var seen = make(map[string]struct{}) 31 | n, err := n.TransformUp(func(n sql.Node) (sql.Node, error) { 32 | switch n := n.(type) { 33 | case *plan.ResolvedTable: 34 | if _, ok := n.Table.(*plan.ProcessTable); ok { 35 | return n, nil 36 | } 37 | 38 | name := n.Table.Name() 39 | if _, ok := seen[name]; ok { 40 | return n, nil 41 | } 42 | 43 | var total int64 = -1 44 | if counter, ok := n.Table.(sql.PartitionCounter); ok { 45 | count, err := counter.PartitionCount(ctx) 46 | if err != nil { 47 | return nil, err 48 | } 49 | total = count 50 | } 51 | processList.AddProgressItem(pid, name, total) 52 | 53 | seen[name] = struct{}{} 54 | t := plan.NewProcessTable(n.Table, func() { 55 | processList.UpdateProgress(pid, name, 1) 56 | }) 57 | 58 | return plan.NewResolvedTable(t), nil 59 | default: 60 | return n, nil 61 | } 62 | }) 63 | if err != nil { 64 | return nil, err 65 | } 66 | 67 | return plan.NewQueryProcess(n, func() { processList.Done(pid) }), nil 68 | } 69 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/analyzer/readonly.go: -------------------------------------------------------------------------------- 1 | package analyzer 2 | 3 | import ( 4 | "reflect" 5 | "strings" 6 | 7 | errors "gopkg.in/src-d/go-errors.v1" 8 | "gopkg.in/src-d/go-mysql-server.v0/sql" 9 | "gopkg.in/src-d/go-mysql-server.v0/sql/plan" 10 | ) 11 | 12 | // EnsureReadOnlyRule is a rule ensuring only read queries can be performed. 13 | const EnsureReadOnlyRule = "ensure_read_only" 14 | 15 | // ErrQueryNotAllowed is returned when the engine is in read-only mode and 16 | // there is a query with that performs any write/update operation. 17 | var ErrQueryNotAllowed = errors.NewKind("query of type %q not allowed in read-only mode") 18 | 19 | // EnsureReadOnly ensures only read queries can be performed, and returns an 20 | // error if it's not the case. 21 | func EnsureReadOnly(ctx *sql.Context, a *Analyzer, node sql.Node) (sql.Node, error) { 22 | switch node.(type) { 23 | case *plan.InsertInto, *plan.DropIndex, *plan.CreateIndex: 24 | typ := strings.Split(reflect.TypeOf(node).String(), ".")[1] 25 | return nil, ErrQueryNotAllowed.New(typ) 26 | default: 27 | return node, nil 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/analyzer/resolve_database.go: -------------------------------------------------------------------------------- 1 | package analyzer 2 | 3 | import ( 4 | "gopkg.in/src-d/go-mysql-server.v0/sql" 5 | "gopkg.in/src-d/go-mysql-server.v0/sql/plan" 6 | ) 7 | 8 | func resolveDatabase(ctx *sql.Context, a *Analyzer, n sql.Node) (sql.Node, error) { 9 | span, ctx := ctx.Span("resolve_database") 10 | defer span.Finish() 11 | 12 | a.Log("resolve database, node of type: %T", n) 13 | 14 | // TODO Database should implement node, 15 | // and ShowTables and CreateTable nodes should be binaryNodes 16 | switch v := n.(type) { 17 | case *plan.ShowIndexes: 18 | db, err := a.Catalog.Database(a.CurrentDatabase) 19 | if err != nil { 20 | return nil, err 21 | } 22 | 23 | v.Database = db 24 | case *plan.ShowTables: 25 | db, err := a.Catalog.Database(a.CurrentDatabase) 26 | if err != nil { 27 | return n, err 28 | } 29 | 30 | v.Database = db 31 | case *plan.CreateTable: 32 | db, err := a.Catalog.Database(a.CurrentDatabase) 33 | if err != nil { 34 | return n, err 35 | } 36 | 37 | v.Database = db 38 | } 39 | 40 | return n, nil 41 | } 42 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/analyzer/resolve_functions.go: -------------------------------------------------------------------------------- 1 | package analyzer 2 | 3 | import ( 4 | "gopkg.in/src-d/go-mysql-server.v0/sql" 5 | "gopkg.in/src-d/go-mysql-server.v0/sql/expression" 6 | ) 7 | 8 | func resolveFunctions(ctx *sql.Context, a *Analyzer, n sql.Node) (sql.Node, error) { 9 | span, ctx := ctx.Span("resolve_functions") 10 | defer span.Finish() 11 | 12 | a.Log("resolve functions, node of type %T", n) 13 | return n.TransformUp(func(n sql.Node) (sql.Node, error) { 14 | a.Log("transforming node of type: %T", n) 15 | if n.Resolved() { 16 | return n, nil 17 | } 18 | 19 | return n.TransformExpressionsUp(func(e sql.Expression) (sql.Expression, error) { 20 | a.Log("transforming expression of type: %T", e) 21 | if e.Resolved() { 22 | return e, nil 23 | } 24 | 25 | uf, ok := e.(*expression.UnresolvedFunction) 26 | if !ok { 27 | return e, nil 28 | } 29 | 30 | n := uf.Name() 31 | f, err := a.Catalog.Function(n) 32 | if err != nil { 33 | return nil, err 34 | } 35 | 36 | rf, err := f.Call(uf.Arguments...) 37 | if err != nil { 38 | return nil, err 39 | } 40 | 41 | a.Log("resolved function %q", n) 42 | 43 | return rf, nil 44 | }) 45 | }) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/analyzer/resolve_subqueries.go: -------------------------------------------------------------------------------- 1 | package analyzer 2 | 3 | import ( 4 | "gopkg.in/src-d/go-mysql-server.v0/sql" 5 | "gopkg.in/src-d/go-mysql-server.v0/sql/plan" 6 | ) 7 | 8 | func resolveSubqueries(ctx *sql.Context, a *Analyzer, n sql.Node) (sql.Node, error) { 9 | span, ctx := ctx.Span("resolve_subqueries") 10 | defer span.Finish() 11 | 12 | a.Log("resolving subqueries") 13 | return n.TransformUp(func(n sql.Node) (sql.Node, error) { 14 | switch n := n.(type) { 15 | case *plan.SubqueryAlias: 16 | a.Log("found subquery %q with child of type %T", n.Name(), n.Child) 17 | child, err := a.Analyze(ctx, n.Child) 18 | if err != nil { 19 | return nil, err 20 | } 21 | 22 | return plan.NewSubqueryAlias(n.Name(), child), nil 23 | default: 24 | return n, nil 25 | } 26 | }) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/analyzer/resolve_tables.go: -------------------------------------------------------------------------------- 1 | package analyzer 2 | 3 | import ( 4 | "gopkg.in/src-d/go-mysql-server.v0/mem" 5 | "gopkg.in/src-d/go-mysql-server.v0/sql" 6 | "gopkg.in/src-d/go-mysql-server.v0/sql/plan" 7 | ) 8 | 9 | const dualTableName = "dual" 10 | 11 | var dualTable = func() sql.Table { 12 | t := mem.NewTable(dualTableName, sql.Schema{ 13 | {Name: "dummy", Source: dualTableName, Type: sql.Text, Nullable: false}, 14 | }) 15 | _ = t.Insert(sql.NewEmptyContext(), sql.NewRow("x")) 16 | return t 17 | }() 18 | 19 | func resolveTables(ctx *sql.Context, a *Analyzer, n sql.Node) (sql.Node, error) { 20 | span, ctx := ctx.Span("resolve_tables") 21 | defer span.Finish() 22 | 23 | a.Log("resolve table, node of type: %T", n) 24 | return n.TransformUp(func(n sql.Node) (sql.Node, error) { 25 | a.Log("transforming node of type: %T", n) 26 | if n.Resolved() { 27 | return n, nil 28 | } 29 | 30 | t, ok := n.(*plan.UnresolvedTable) 31 | if !ok { 32 | return n, nil 33 | } 34 | 35 | name := t.Name() 36 | rt, err := a.Catalog.Table(a.CurrentDatabase, name) 37 | if err != nil { 38 | if sql.ErrTableNotFound.Is(err) && name == dualTableName { 39 | rt = dualTable 40 | name = dualTableName 41 | } else { 42 | return nil, err 43 | } 44 | } 45 | 46 | a.Log("table resolved: %q", t.Name()) 47 | 48 | return plan.NewResolvedTable(rt), nil 49 | }) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/catalog.go: -------------------------------------------------------------------------------- 1 | package sql 2 | 3 | import ( 4 | "gopkg.in/src-d/go-errors.v1" 5 | ) 6 | 7 | // ErrDatabaseNotFound is thrown when a database is not found 8 | var ErrDatabaseNotFound = errors.NewKind("database not found: %s") 9 | 10 | // Catalog holds databases, tables and functions. 11 | type Catalog struct { 12 | Databases 13 | FunctionRegistry 14 | *IndexRegistry 15 | *ProcessList 16 | } 17 | 18 | // NewCatalog returns a new empty Catalog. 19 | func NewCatalog() *Catalog { 20 | return &Catalog{ 21 | Databases: Databases{}, 22 | FunctionRegistry: NewFunctionRegistry(), 23 | IndexRegistry: NewIndexRegistry(), 24 | ProcessList: NewProcessList(), 25 | } 26 | } 27 | 28 | // Databases is a collection of Database. 29 | type Databases []Database 30 | 31 | // Database returns the Database with the given name if it exists. 32 | func (d Databases) Database(name string) (Database, error) { 33 | for _, db := range d { 34 | if db.Name() == name { 35 | return db, nil 36 | } 37 | } 38 | 39 | return nil, ErrDatabaseNotFound.New(name) 40 | } 41 | 42 | // AddDatabase adds a new database. 43 | func (d *Databases) AddDatabase(db Database) { 44 | *d = append(*d, db) 45 | } 46 | 47 | // Table returns the Table with the given name if it exists. 48 | func (d Databases) Table(dbName string, tableName string) (Table, error) { 49 | db, err := d.Database(dbName) 50 | if err != nil { 51 | return nil, err 52 | } 53 | 54 | tables := db.Tables() 55 | table, found := tables[tableName] 56 | if !found { 57 | return nil, ErrTableNotFound.New(tableName) 58 | } 59 | 60 | return table, nil 61 | } 62 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/alias.go: -------------------------------------------------------------------------------- 1 | package expression 2 | 3 | import ( 4 | "fmt" 5 | 6 | "gopkg.in/src-d/go-mysql-server.v0/sql" 7 | ) 8 | 9 | // Alias is a node that gives a name to an expression. 10 | type Alias struct { 11 | UnaryExpression 12 | name string 13 | } 14 | 15 | // NewAlias returns a new Alias node. 16 | func NewAlias(child sql.Expression, name string) *Alias { 17 | return &Alias{UnaryExpression{child}, name} 18 | } 19 | 20 | // Type returns the type of the expression. 21 | func (e *Alias) Type() sql.Type { 22 | return e.Child.Type() 23 | } 24 | 25 | // Eval implements the Expression interface. 26 | func (e *Alias) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) { 27 | return e.Child.Eval(ctx, row) 28 | } 29 | 30 | func (e *Alias) String() string { 31 | return fmt.Sprintf("%s as %s", e.Child, e.name) 32 | } 33 | 34 | // TransformUp implements the Expression interface. 35 | func (e *Alias) TransformUp(f sql.TransformExprFunc) (sql.Expression, error) { 36 | child, err := e.Child.TransformUp(f) 37 | if err != nil { 38 | return nil, err 39 | } 40 | return f(NewAlias(child, e.name)) 41 | } 42 | 43 | // Name implements the Nameable interface. 44 | func (e *Alias) Name() string { return e.name } 45 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/boolean.go: -------------------------------------------------------------------------------- 1 | package expression 2 | 3 | import ( 4 | "fmt" 5 | 6 | "gopkg.in/src-d/go-mysql-server.v0/sql" 7 | ) 8 | 9 | // Not is a node that negates an expression. 10 | type Not struct { 11 | UnaryExpression 12 | } 13 | 14 | // NewNot returns a new Not node. 15 | func NewNot(child sql.Expression) *Not { 16 | return &Not{UnaryExpression{child}} 17 | } 18 | 19 | // Type implements the Expression interface. 20 | func (e *Not) Type() sql.Type { 21 | return sql.Boolean 22 | } 23 | 24 | // Eval implements the Expression interface. 25 | func (e *Not) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) { 26 | v, err := e.Child.Eval(ctx, row) 27 | if err != nil { 28 | return nil, err 29 | } 30 | 31 | if v == nil { 32 | return nil, nil 33 | } 34 | 35 | return !v.(bool), nil 36 | } 37 | 38 | func (e *Not) String() string { 39 | return fmt.Sprintf("NOT(%s)", e.Child) 40 | } 41 | 42 | // TransformUp implements the Expression interface. 43 | func (e *Not) TransformUp(f sql.TransformExprFunc) (sql.Expression, error) { 44 | child, err := e.Child.TransformUp(f) 45 | if err != nil { 46 | return nil, err 47 | } 48 | return f(NewNot(child)) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/common.go: -------------------------------------------------------------------------------- 1 | package expression 2 | 3 | import ( 4 | "gopkg.in/src-d/go-mysql-server.v0/sql" 5 | ) 6 | 7 | // IsUnary returns whether the expression is unary or not. 8 | func IsUnary(e sql.Expression) bool { 9 | return len(e.Children()) == 1 10 | } 11 | 12 | // IsBinary returns whether the expression is binary or not. 13 | func IsBinary(e sql.Expression) bool { 14 | return len(e.Children()) == 2 15 | } 16 | 17 | // UnaryExpression is an expression that has only one children. 18 | type UnaryExpression struct { 19 | Child sql.Expression 20 | } 21 | 22 | // Children implements the Expression interface. 23 | func (p *UnaryExpression) Children() []sql.Expression { 24 | return []sql.Expression{p.Child} 25 | } 26 | 27 | // Resolved implements the Expression interface. 28 | func (p *UnaryExpression) Resolved() bool { 29 | return p.Child.Resolved() 30 | } 31 | 32 | // IsNullable returns whether the expression can be null. 33 | func (p *UnaryExpression) IsNullable() bool { 34 | return p.Child.IsNullable() 35 | } 36 | 37 | // BinaryExpression is an expression that has two children. 38 | type BinaryExpression struct { 39 | Left sql.Expression 40 | Right sql.Expression 41 | } 42 | 43 | // Children implements the Expression interface. 44 | func (p *BinaryExpression) Children() []sql.Expression { 45 | return []sql.Expression{p.Left, p.Right} 46 | } 47 | 48 | // Resolved implements the Expression interface. 49 | func (p *BinaryExpression) Resolved() bool { 50 | return p.Left.Resolved() && p.Right.Resolved() 51 | } 52 | 53 | // IsNullable returns whether the expression can be null. 54 | func (p *BinaryExpression) IsNullable() bool { 55 | return p.Left.IsNullable() || p.Right.IsNullable() 56 | } 57 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/doc.go: -------------------------------------------------------------------------------- 1 | package expression // import "gopkg.in/src-d/go-mysql-server.v0/sql/expression" 2 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/function/arraylength.go: -------------------------------------------------------------------------------- 1 | package function // import "gopkg.in/src-d/go-mysql-server.v0/sql/expression/function" 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | 7 | "gopkg.in/src-d/go-mysql-server.v0/sql" 8 | "gopkg.in/src-d/go-mysql-server.v0/sql/expression" 9 | ) 10 | 11 | // ArrayLength returns the length of an array. 12 | type ArrayLength struct { 13 | expression.UnaryExpression 14 | } 15 | 16 | // NewArrayLength creates a new ArrayLength UDF. 17 | func NewArrayLength(array sql.Expression) sql.Expression { 18 | return &ArrayLength{expression.UnaryExpression{Child: array}} 19 | } 20 | 21 | // Type implements the Expression interface. 22 | func (*ArrayLength) Type() sql.Type { 23 | return sql.Int32 24 | } 25 | 26 | func (f *ArrayLength) String() string { 27 | return fmt.Sprintf("array_length(%s)", f.Child) 28 | } 29 | 30 | // TransformUp implements the Expression interface. 31 | func (f *ArrayLength) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error) { 32 | child, err := f.Child.TransformUp(fn) 33 | if err != nil { 34 | return nil, err 35 | } 36 | return fn(NewArrayLength(child)) 37 | } 38 | 39 | // Eval implements the Expression interface. 40 | func (f *ArrayLength) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) { 41 | if !sql.IsArray(f.Child.Type()) { 42 | return nil, sql.ErrInvalidType.New(f.Child.Type().Type().String()) 43 | } 44 | 45 | child, err := f.Child.Eval(ctx, row) 46 | if err != nil { 47 | return nil, err 48 | } 49 | 50 | if child == nil { 51 | return nil, nil 52 | } 53 | 54 | array, ok := child.([]interface{}) 55 | if !ok { 56 | return nil, sql.ErrInvalidType.New(reflect.TypeOf(child)) 57 | } 58 | 59 | return int32(len(array)), nil 60 | } 61 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/function/isbinary.go: -------------------------------------------------------------------------------- 1 | package function 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | 7 | "gopkg.in/src-d/go-mysql-server.v0/sql" 8 | "gopkg.in/src-d/go-mysql-server.v0/sql/expression" 9 | ) 10 | 11 | // IsBinary is a function that returns whether a blob is binary or not. 12 | type IsBinary struct { 13 | expression.UnaryExpression 14 | } 15 | 16 | // NewIsBinary creates a new IsBinary expression. 17 | func NewIsBinary(e sql.Expression) sql.Expression { 18 | return &IsBinary{expression.UnaryExpression{Child: e}} 19 | } 20 | 21 | // Eval implements the Expression interface. 22 | func (ib *IsBinary) Eval( 23 | ctx *sql.Context, 24 | row sql.Row, 25 | ) (interface{}, error) { 26 | v, err := ib.Child.Eval(ctx, row) 27 | if err != nil { 28 | return nil, err 29 | } 30 | 31 | if v == nil { 32 | return false, nil 33 | } 34 | 35 | blob, err := sql.Blob.Convert(v) 36 | if err != nil { 37 | return nil, err 38 | } 39 | 40 | blobBytes := blob.([]byte) 41 | return isBinary(blobBytes), nil 42 | } 43 | 44 | func (ib *IsBinary) String() string { 45 | return fmt.Sprintf("IS_BINARY(%s)", ib.Child) 46 | } 47 | 48 | // TransformUp implements the Expression interface. 49 | func (ib *IsBinary) TransformUp(f sql.TransformExprFunc) (sql.Expression, error) { 50 | child, err := ib.Child.TransformUp(f) 51 | if err != nil { 52 | return nil, err 53 | } 54 | return f(NewIsBinary(child)) 55 | } 56 | 57 | // Type implements the Expression interface. 58 | func (ib *IsBinary) Type() sql.Type { 59 | return sql.Boolean 60 | } 61 | 62 | const sniffLen = 8000 63 | 64 | // isBinary detects if data is a binary value based on: 65 | // http://git.kernel.org/cgit/git/git.git/tree/xdiff-interface.c?id=HEAD#n198 66 | func isBinary(data []byte) bool { 67 | if len(data) > sniffLen { 68 | data = data[:sniffLen] 69 | } 70 | 71 | if bytes.IndexByte(data, byte(0)) == -1 { 72 | return false 73 | } 74 | 75 | return true 76 | } 77 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/function/registry.go: -------------------------------------------------------------------------------- 1 | package function 2 | 3 | import ( 4 | "gopkg.in/src-d/go-mysql-server.v0/sql" 5 | "gopkg.in/src-d/go-mysql-server.v0/sql/expression/function/aggregation" 6 | ) 7 | 8 | // Defaults is the function map with all the default functions. 9 | var Defaults = sql.Functions{ 10 | "count": sql.Function1(func(e sql.Expression) sql.Expression { 11 | return aggregation.NewCount(e) 12 | }), 13 | "min": sql.Function1(func(e sql.Expression) sql.Expression { 14 | return aggregation.NewMin(e) 15 | }), 16 | "max": sql.Function1(func(e sql.Expression) sql.Expression { 17 | return aggregation.NewMax(e) 18 | }), 19 | "avg": sql.Function1(func(e sql.Expression) sql.Expression { 20 | return aggregation.NewAvg(e) 21 | }), 22 | "sum": sql.Function1(func(e sql.Expression) sql.Expression { 23 | return aggregation.NewSum(e) 24 | }), 25 | "is_binary": sql.Function1(NewIsBinary), 26 | "substring": sql.FunctionN(NewSubstring), 27 | "year": sql.Function1(NewYear), 28 | "month": sql.Function1(NewMonth), 29 | "day": sql.Function1(NewDay), 30 | "hour": sql.Function1(NewHour), 31 | "minute": sql.Function1(NewMinute), 32 | "second": sql.Function1(NewSecond), 33 | "dayofyear": sql.Function1(NewDayOfYear), 34 | "array_length": sql.Function1(NewArrayLength), 35 | "split": sql.Function2(NewSplit), 36 | "concat": sql.FunctionN(NewConcat), 37 | } 38 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/function/version.go: -------------------------------------------------------------------------------- 1 | package function 2 | 3 | import ( 4 | "fmt" 5 | 6 | "gopkg.in/src-d/go-mysql-server.v0/sql" 7 | ) 8 | 9 | const mysqlVersion = "8.0.11" 10 | 11 | // Version is a function that returns server version. 12 | type Version string 13 | 14 | // NewVersion creates a new Version UDF. 15 | func NewVersion(versionPostfix string) func(...sql.Expression) (sql.Expression, error) { 16 | return func(...sql.Expression) (sql.Expression, error) { 17 | return Version(versionPostfix), nil 18 | } 19 | } 20 | 21 | // Type implements the Expression interface. 22 | func (f Version) Type() sql.Type { return sql.Text } 23 | 24 | // IsNullable implements the Expression interface. 25 | func (f Version) IsNullable() bool { 26 | return false 27 | } 28 | 29 | func (f Version) String() string { 30 | return "VERSION()" 31 | } 32 | 33 | // TransformUp implements the Expression interface. 34 | func (f Version) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error) { 35 | return fn(f) 36 | } 37 | 38 | // Resolved implements the Expression interface. 39 | func (f Version) Resolved() bool { 40 | return true 41 | } 42 | 43 | // Children implements the Expression interface. 44 | func (f Version) Children() []sql.Expression { return nil } 45 | 46 | // Eval implements the Expression interface. 47 | func (f Version) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) { 48 | if f == "" { 49 | return mysqlVersion, nil 50 | } 51 | 52 | return fmt.Sprintf("%s-%s", mysqlVersion, string(f)), nil 53 | } 54 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/isnull.go: -------------------------------------------------------------------------------- 1 | package expression 2 | 3 | import "gopkg.in/src-d/go-mysql-server.v0/sql" 4 | 5 | // IsNull is an expression that checks if an expression is null. 6 | type IsNull struct { 7 | UnaryExpression 8 | } 9 | 10 | // NewIsNull creates a new IsNull expression. 11 | func NewIsNull(child sql.Expression) *IsNull { 12 | return &IsNull{UnaryExpression{child}} 13 | } 14 | 15 | // Type implements the Expression interface. 16 | func (e *IsNull) Type() sql.Type { 17 | return sql.Boolean 18 | } 19 | 20 | // IsNullable implements the Expression interface. 21 | func (e *IsNull) IsNullable() bool { 22 | return false 23 | } 24 | 25 | // Eval implements the Expression interface. 26 | func (e *IsNull) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) { 27 | v, err := e.Child.Eval(ctx, row) 28 | if err != nil { 29 | return nil, err 30 | } 31 | 32 | return v == nil, nil 33 | } 34 | 35 | func (e IsNull) String() string { 36 | return e.Child.String() + " IS NULL" 37 | } 38 | 39 | // TransformUp implements the Expression interface. 40 | func (e *IsNull) TransformUp(f sql.TransformExprFunc) (sql.Expression, error) { 41 | child, err := e.Child.TransformUp(f) 42 | if err != nil { 43 | return nil, err 44 | } 45 | return f(NewIsNull(child)) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/literal.go: -------------------------------------------------------------------------------- 1 | package expression 2 | 3 | import ( 4 | "fmt" 5 | 6 | "gopkg.in/src-d/go-mysql-server.v0/sql" 7 | ) 8 | 9 | // Literal represents a literal expression (string, number, bool, ...). 10 | type Literal struct { 11 | value interface{} 12 | fieldType sql.Type 13 | } 14 | 15 | // NewLiteral creates a new Literal expression. 16 | func NewLiteral(value interface{}, fieldType sql.Type) *Literal { 17 | return &Literal{ 18 | value: value, 19 | fieldType: fieldType, 20 | } 21 | } 22 | 23 | // Resolved implements the Expression interface. 24 | func (p *Literal) Resolved() bool { 25 | return true 26 | } 27 | 28 | // IsNullable implements the Expression interface. 29 | func (p *Literal) IsNullable() bool { 30 | return p.value == nil 31 | } 32 | 33 | // Type implements the Expression interface. 34 | func (p *Literal) Type() sql.Type { 35 | return p.fieldType 36 | } 37 | 38 | // Eval implements the Expression interface. 39 | func (p *Literal) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) { 40 | return p.value, nil 41 | } 42 | 43 | func (p *Literal) String() string { 44 | switch v := p.value.(type) { 45 | case string: 46 | return fmt.Sprintf("%q", v) 47 | case []byte: 48 | return "BLOB" 49 | default: 50 | return fmt.Sprint(v) 51 | } 52 | } 53 | 54 | // TransformUp implements the Expression interface. 55 | func (p *Literal) TransformUp(f sql.TransformExprFunc) (sql.Expression, error) { 56 | n := *p 57 | return f(&n) 58 | } 59 | 60 | // Children implements the Expression interface. 61 | func (*Literal) Children() []sql.Expression { 62 | return nil 63 | } 64 | 65 | // Value returns the literal value. 66 | func (p *Literal) Value() interface{} { 67 | return p.value 68 | } 69 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/star.go: -------------------------------------------------------------------------------- 1 | package expression 2 | 3 | import ( 4 | "fmt" 5 | 6 | "gopkg.in/src-d/go-mysql-server.v0/sql" 7 | ) 8 | 9 | // Star represents the selection of all available fields. 10 | // This is just a placeholder node, it will not actually be evaluated 11 | // but converted to a series of GetFields when the query is analyzed. 12 | type Star struct { 13 | Table string 14 | } 15 | 16 | // NewStar returns a new Star expression. 17 | func NewStar() *Star { 18 | return new(Star) 19 | } 20 | 21 | // NewQualifiedStar returns a new star expression only for a specific table. 22 | func NewQualifiedStar(table string) *Star { 23 | return &Star{table} 24 | } 25 | 26 | // Resolved implements the Expression interface. 27 | func (*Star) Resolved() bool { 28 | return false 29 | } 30 | 31 | // Children implements the Expression interface. 32 | func (*Star) Children() []sql.Expression { 33 | return nil 34 | } 35 | 36 | // IsNullable implements the Expression interface. 37 | func (*Star) IsNullable() bool { 38 | panic("star is just a placeholder node, but IsNullable was called") 39 | } 40 | 41 | // Type implements the Expression interface. 42 | func (*Star) Type() sql.Type { 43 | panic("star is just a placeholder node, but Type was called") 44 | } 45 | 46 | func (s *Star) String() string { 47 | if s.Table != "" { 48 | return fmt.Sprintf("%s.*", s.Table) 49 | } 50 | return "*" 51 | } 52 | 53 | // Eval implements the Expression interface. 54 | func (*Star) Eval(ctx *sql.Context, r sql.Row) (interface{}, error) { 55 | panic("star is just a placeholder node, but Eval was called") 56 | } 57 | 58 | // TransformUp implements the Expression interface. 59 | func (s *Star) TransformUp(f sql.TransformExprFunc) (sql.Expression, error) { 60 | n := *s 61 | return f(&n) 62 | } 63 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/expression/walk.go: -------------------------------------------------------------------------------- 1 | package expression 2 | 3 | import "gopkg.in/src-d/go-mysql-server.v0/sql" 4 | 5 | // Visitor visits exprs in the plan. 6 | type Visitor interface { 7 | // Visit method is invoked for each expr encountered by Walk. 8 | // If the result Visitor is not nul, Walk visits each of the children 9 | // of the expr with that visitor, followed by a call of Visit(nil) 10 | // to the returned visitor. 11 | Visit(expr sql.Expression) Visitor 12 | } 13 | 14 | // Walk traverses the plan tree in depth-first order. It starts by calling 15 | // v.Visit(expr); expr must not be nil. If the visitor returned by 16 | // v.Visit(expr) is not nil, Walk is invoked recursively with the returned 17 | // visitor for each children of the expr, followed by a call of v.Visit(nil) 18 | // to the returned visitor. 19 | func Walk(v Visitor, expr sql.Expression) { 20 | if v = v.Visit(expr); v == nil { 21 | return 22 | } 23 | 24 | for _, child := range expr.Children() { 25 | Walk(v, child) 26 | } 27 | 28 | v.Visit(nil) 29 | } 30 | 31 | type inspector func(sql.Expression) bool 32 | 33 | func (f inspector) Visit(expr sql.Expression) Visitor { 34 | if f(expr) { 35 | return f 36 | } 37 | return nil 38 | } 39 | 40 | // Inspect traverses the plan in depth-first order: It starts by calling 41 | // f(expr); expr must not be nil. If f returns true, Inspect invokes f 42 | // recursively for each of the children of expr, followed by a call of 43 | // f(nil). 44 | func Inspect(expr sql.Expression, f func(sql.Expression) bool) { 45 | Walk(inspector(f), expr) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/parse/describe.go: -------------------------------------------------------------------------------- 1 | package parse 2 | 3 | import ( 4 | "bufio" 5 | "strings" 6 | 7 | errors "gopkg.in/src-d/go-errors.v1" 8 | "gopkg.in/src-d/go-mysql-server.v0/sql" 9 | "gopkg.in/src-d/go-mysql-server.v0/sql/plan" 10 | ) 11 | 12 | var ( 13 | errInvalidDescribeFormat = errors.NewKind("invalid format %q for DESCRIBE, supported formats: %s") 14 | describeSupportedFormats = []string{"tree"} 15 | ) 16 | 17 | func parseDescribeQuery(ctx *sql.Context, s string) (sql.Node, error) { 18 | r := bufio.NewReader(strings.NewReader(s)) 19 | 20 | var format, query string 21 | steps := []parseFunc{ 22 | oneOf("describe", "desc", "explain"), 23 | skipSpaces, 24 | expect("format"), 25 | skipSpaces, 26 | expectRune('='), 27 | skipSpaces, 28 | readIdent(&format), 29 | skipSpaces, 30 | readRemaining(&query), 31 | } 32 | 33 | for _, step := range steps { 34 | if err := step(r); err != nil { 35 | return nil, err 36 | } 37 | } 38 | 39 | if format != "tree" { 40 | return nil, errInvalidDescribeFormat.New( 41 | format, 42 | strings.Join(describeSupportedFormats, ", "), 43 | ) 44 | } 45 | 46 | child, err := Parse(ctx, query) 47 | if err != nil { 48 | return nil, err 49 | } 50 | 51 | return plan.NewDescribeQuery(format, child), nil 52 | } 53 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/plan/common.go: -------------------------------------------------------------------------------- 1 | package plan // import "gopkg.in/src-d/go-mysql-server.v0/sql/plan" 2 | 3 | import "gopkg.in/src-d/go-mysql-server.v0/sql" 4 | 5 | // IsUnary returns whether the node is unary or not. 6 | func IsUnary(node sql.Node) bool { 7 | return len(node.Children()) == 1 8 | } 9 | 10 | // IsBinary returns whether the node is binary or not. 11 | func IsBinary(node sql.Node) bool { 12 | return len(node.Children()) == 2 13 | } 14 | 15 | // UnaryNode is a node that has only one children. 16 | type UnaryNode struct { 17 | Child sql.Node 18 | } 19 | 20 | // Schema implements the Node interface. 21 | func (n *UnaryNode) Schema() sql.Schema { 22 | return n.Child.Schema() 23 | } 24 | 25 | // Resolved implements the Resolvable interface. 26 | func (n UnaryNode) Resolved() bool { 27 | return n.Child.Resolved() 28 | } 29 | 30 | // Children implements the Node interface. 31 | func (n UnaryNode) Children() []sql.Node { 32 | return []sql.Node{n.Child} 33 | } 34 | 35 | // BinaryNode is a node with two children. 36 | type BinaryNode struct { 37 | Left sql.Node 38 | Right sql.Node 39 | } 40 | 41 | // Children implements the Node interface. 42 | func (n BinaryNode) Children() []sql.Node { 43 | return []sql.Node{n.Left, n.Right} 44 | } 45 | 46 | // Resolved implements the Resolvable interface. 47 | func (n BinaryNode) Resolved() bool { 48 | return n.Left.Resolved() && n.Right.Resolved() 49 | } 50 | 51 | func expressionsResolved(exprs ...sql.Expression) bool { 52 | for _, e := range exprs { 53 | if !e.Resolved() { 54 | return false 55 | } 56 | } 57 | 58 | return true 59 | } 60 | 61 | func transformExpressionsUp( 62 | f sql.TransformExprFunc, 63 | exprs []sql.Expression, 64 | ) ([]sql.Expression, error) { 65 | 66 | var es []sql.Expression 67 | for _, e := range exprs { 68 | te, err := e.TransformUp(f) 69 | if err != nil { 70 | return nil, err 71 | } 72 | es = append(es, te) 73 | } 74 | 75 | return es, nil 76 | } 77 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/plan/empty_table.go: -------------------------------------------------------------------------------- 1 | package plan 2 | 3 | import "gopkg.in/src-d/go-mysql-server.v0/sql" 4 | 5 | // EmptyTable is a node representing an empty table. 6 | var EmptyTable = new(emptyTable) 7 | 8 | type emptyTable struct{} 9 | 10 | func (emptyTable) Schema() sql.Schema { return nil } 11 | func (emptyTable) Children() []sql.Node { return nil } 12 | func (emptyTable) Resolved() bool { return true } 13 | func (e *emptyTable) String() string { return "EmptyTable" } 14 | 15 | func (emptyTable) RowIter(ctx *sql.Context) (sql.RowIter, error) { 16 | return sql.RowsToRowIter(), nil 17 | } 18 | 19 | // TransformUp implements the Transformable interface. 20 | func (e *emptyTable) TransformUp(f sql.TransformNodeFunc) (sql.Node, error) { 21 | return f(e) 22 | } 23 | 24 | // TransformExpressionsUp implements the Transformable interface. 25 | func (e *emptyTable) TransformExpressionsUp(f sql.TransformExprFunc) (sql.Node, error) { 26 | return e, nil 27 | } 28 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/plan/subqueryalias.go: -------------------------------------------------------------------------------- 1 | package plan 2 | 3 | import ( 4 | "gopkg.in/src-d/go-mysql-server.v0/sql" 5 | ) 6 | 7 | // SubqueryAlias is a node that gives a subquery a name. 8 | type SubqueryAlias struct { 9 | UnaryNode 10 | name string 11 | schema sql.Schema 12 | } 13 | 14 | // NewSubqueryAlias creates a new SubqueryAlias node. 15 | func NewSubqueryAlias(name string, node sql.Node) *SubqueryAlias { 16 | return &SubqueryAlias{UnaryNode{Child: node}, name, nil} 17 | } 18 | 19 | // Name implements the Table interface. 20 | func (n *SubqueryAlias) Name() string { return n.name } 21 | 22 | // Schema implements the Node interface. 23 | func (n *SubqueryAlias) Schema() sql.Schema { 24 | if n.schema == nil { 25 | schema := n.Child.Schema() 26 | n.schema = make(sql.Schema, len(schema)) 27 | for i, col := range schema { 28 | c := *col 29 | c.Source = n.name 30 | n.schema[i] = &c 31 | } 32 | } 33 | return n.schema 34 | } 35 | 36 | // RowIter implements the Node interface. 37 | func (n *SubqueryAlias) RowIter(ctx *sql.Context) (sql.RowIter, error) { 38 | span, ctx := ctx.Span("plan.SubqueryAlias") 39 | iter, err := n.Child.RowIter(ctx) 40 | if err != nil { 41 | span.Finish() 42 | return nil, err 43 | } 44 | 45 | return sql.NewSpanIter(span, iter), nil 46 | } 47 | 48 | // TransformUp implements the Node interface. 49 | func (n *SubqueryAlias) TransformUp(f sql.TransformNodeFunc) (sql.Node, error) { 50 | return f(n) 51 | } 52 | 53 | // TransformExpressionsUp implements the Node interface. 54 | func (n *SubqueryAlias) TransformExpressionsUp(f sql.TransformExprFunc) (sql.Node, error) { 55 | return n, nil 56 | } 57 | 58 | func (n SubqueryAlias) String() string { 59 | pr := sql.NewTreePrinter() 60 | _ = pr.WriteNode("SubqueryAlias(%s)", n.name) 61 | _ = pr.WriteChildren(n.Child.String()) 62 | return pr.String() 63 | } 64 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/plan/unresolved.go: -------------------------------------------------------------------------------- 1 | package plan 2 | 3 | import ( 4 | "fmt" 5 | 6 | errors "gopkg.in/src-d/go-errors.v1" 7 | "gopkg.in/src-d/go-mysql-server.v0/sql" 8 | ) 9 | 10 | // ErrUnresolvedTable is thrown when a table cannot be resolved 11 | var ErrUnresolvedTable = errors.NewKind("unresolved table") 12 | 13 | // UnresolvedTable is a table that has not been resolved yet but whose name is known. 14 | type UnresolvedTable struct { 15 | // Name of the table. 16 | name string 17 | } 18 | 19 | // NewUnresolvedTable creates a new Unresolved table. 20 | func NewUnresolvedTable(name string) *UnresolvedTable { 21 | return &UnresolvedTable{name} 22 | } 23 | 24 | // Name implements the Nameable interface. 25 | func (t *UnresolvedTable) Name() string { 26 | return t.name 27 | } 28 | 29 | // Resolved implements the Resolvable interface. 30 | func (*UnresolvedTable) Resolved() bool { 31 | return false 32 | } 33 | 34 | // Children implements the Node interface. 35 | func (*UnresolvedTable) Children() []sql.Node { return nil } 36 | 37 | // Schema implements the Node interface. 38 | func (*UnresolvedTable) Schema() sql.Schema { return nil } 39 | 40 | // RowIter implements the RowIter interface. 41 | func (*UnresolvedTable) RowIter(ctx *sql.Context) (sql.RowIter, error) { 42 | return nil, ErrUnresolvedTable.New() 43 | } 44 | 45 | // TransformUp implements the Transformable interface. 46 | func (t *UnresolvedTable) TransformUp(f sql.TransformNodeFunc) (sql.Node, error) { 47 | return f(NewUnresolvedTable(t.name)) 48 | } 49 | 50 | // TransformExpressionsUp implements the Transformable interface. 51 | func (t *UnresolvedTable) TransformExpressionsUp(f sql.TransformExprFunc) (sql.Node, error) { 52 | return t, nil 53 | } 54 | 55 | func (t UnresolvedTable) String() string { 56 | return fmt.Sprintf("UnresolvedTable(%s)", t.name) 57 | } 58 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-mysql-server.v0/sql/unresolved_database.go: -------------------------------------------------------------------------------- 1 | package sql 2 | 3 | // UnresolvedDatabase is a database which has not been resolved yet. 4 | type UnresolvedDatabase struct{} 5 | 6 | // Name returns the database name, which is always "unresolved_database". 7 | func (d *UnresolvedDatabase) Name() string { 8 | return "unresolved_database" 9 | } 10 | 11 | // Tables returns the tables in the database. 12 | func (d *UnresolvedDatabase) Tables() map[string]Table { 13 | return make(map[string]Table) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-vitess.v0/mysql/conn_params.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 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 | package mysql 18 | 19 | // ConnParams contains all the parameters to use to connect to mysql. 20 | type ConnParams struct { 21 | Host string `json:"host"` 22 | Port int `json:"port"` 23 | Uname string `json:"uname"` 24 | Pass string `json:"pass"` 25 | DbName string `json:"dbname"` 26 | UnixSocket string `json:"unix_socket"` 27 | Charset string `json:"charset"` 28 | Flags uint64 `json:"flags"` 29 | 30 | // The following SSL flags are only used when flags |= 2048 31 | // is set (CapabilityClientSSL). 32 | SslCa string `json:"ssl_ca"` 33 | SslCaPath string `json:"ssl_ca_path"` 34 | SslCert string `json:"ssl_cert"` 35 | SslKey string `json:"ssl_key"` 36 | } 37 | 38 | // EnableSSL will set the right flag on the parameters. 39 | func (cp *ConnParams) EnableSSL() { 40 | cp.Flags |= CapabilityClientSSL 41 | } 42 | 43 | // SslEnabled returns if SSL is enabled. 44 | func (cp *ConnParams) SslEnabled() bool { 45 | return (cp.Flags & CapabilityClientSSL) > 0 46 | } 47 | 48 | // EnableClientFoundRows sets the flag for CLIENT_FOUND_ROWS. 49 | func (cp *ConnParams) EnableClientFoundRows() { 50 | cp.Flags |= CapabilityClientFoundRows 51 | } 52 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-vitess.v0/mysql/flavor_mariadb_binlog_playback.go: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2017 Google Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | package mysql 19 | 20 | // These two methods are isolated here so they can be easily changed 21 | // in other trees. 22 | 23 | // enableBinlogPlaybackCommand is part of the Flavor interface. 24 | func (mariadbFlavor) enableBinlogPlaybackCommand() string { 25 | return "" 26 | } 27 | 28 | // disableBinlogPlaybackCommand is part of the Flavor interface. 29 | func (mariadbFlavor) disableBinlogPlaybackCommand() string { 30 | return "" 31 | } 32 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-vitess.v0/sqltypes/event_token.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 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 agreedto 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 | package sqltypes 18 | 19 | import querypb "gopkg.in/src-d/go-vitess.v0/vt/proto/query" 20 | 21 | // EventTokenMinimum returns an event token that is guaranteed to 22 | // happen before both provided EventToken objects. Note it doesn't 23 | // parse the position, but rather only uses the timestamp. This is 24 | // meant to be used for EventToken objects coming from different 25 | // source shard. 26 | func EventTokenMinimum(ev1, ev2 *querypb.EventToken) *querypb.EventToken { 27 | if ev1 == nil || ev2 == nil { 28 | // One or the other is not set, we can't do anything. 29 | return nil 30 | } 31 | 32 | if ev1.Timestamp < ev2.Timestamp { 33 | return &querypb.EventToken{ 34 | Timestamp: ev1.Timestamp, 35 | } 36 | } 37 | return &querypb.EventToken{ 38 | Timestamp: ev2.Timestamp, 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-vitess.v0/sqltypes/query_response.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 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 agreedto 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 | package sqltypes 18 | 19 | import "reflect" 20 | 21 | // QueryResponse represents a query response for ExecuteBatch. 22 | type QueryResponse struct { 23 | QueryResult *Result 24 | QueryError error 25 | } 26 | 27 | // QueryResponsesEqual compares two arrays of QueryResponse. 28 | // They contain protos, so we cannot use reflect.DeepEqual. 29 | func QueryResponsesEqual(r1, r2 []QueryResponse) bool { 30 | if len(r1) != len(r2) { 31 | return false 32 | } 33 | for i, r := range r1 { 34 | if !r.QueryResult.Equal(r2[i].QueryResult) { 35 | return false 36 | } 37 | if !reflect.DeepEqual(r.QueryError, r2[i].QueryError) { 38 | return false 39 | } 40 | } 41 | return true 42 | } 43 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-vitess.v0/stats/multidimensional.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 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 agreedto 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 | package stats 18 | 19 | import ( 20 | "fmt" 21 | "strings" 22 | ) 23 | 24 | // MultiTracker is a CountTracker that tracks counts grouping them by 25 | // more than one dimension. 26 | type MultiTracker interface { 27 | CountTracker 28 | Labels() []string 29 | } 30 | 31 | // CounterForDimension returns a CountTracker for the provided 32 | // dimension. It will panic if the dimension isn't a legal label for 33 | // mt. 34 | func CounterForDimension(mt MultiTracker, dimension string) CountTracker { 35 | for i, lab := range mt.Labels() { 36 | if lab == dimension { 37 | return CountersFunc(func() map[string]int64 { 38 | result := make(map[string]int64) 39 | for k, v := range mt.Counts() { 40 | if k == "All" { 41 | result[k] = v 42 | continue 43 | } 44 | result[strings.Split(k, ".")[i]] += v 45 | } 46 | return result 47 | }) 48 | } 49 | } 50 | panic(fmt.Sprintf("label %v is not one of %v", dimension, mt.Labels())) 51 | 52 | } 53 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-vitess.v0/stats/ring.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 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 | package stats 18 | 19 | // Ring of int64 values 20 | // Not thread safe 21 | type RingInt64 struct { 22 | position int 23 | values []int64 24 | } 25 | 26 | func NewRingInt64(capacity int) *RingInt64 { 27 | return &RingInt64{values: make([]int64, 0, capacity)} 28 | } 29 | 30 | func (ri *RingInt64) Add(val int64) { 31 | if len(ri.values) == cap(ri.values) { 32 | ri.values[ri.position] = val 33 | ri.position = (ri.position + 1) % cap(ri.values) 34 | } else { 35 | ri.values = append(ri.values, val) 36 | } 37 | } 38 | 39 | func (ri *RingInt64) Values() (values []int64) { 40 | values = make([]int64, len(ri.values)) 41 | for i := 0; i < len(ri.values); i++ { 42 | values[i] = ri.values[(ri.position+i)%cap(ri.values)] 43 | } 44 | return values 45 | } 46 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-vitess.v0/sync2/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 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 | // Package sync2 provides extra functionality along the same lines as sync. 18 | package sync2 19 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-vitess.v0/vt/sqlparser/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Google Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | MAKEFLAGS = -s 16 | 17 | sql.go: sql.y 18 | goyacc -o sql.go sql.y 19 | gofmt -w sql.go 20 | 21 | clean: 22 | rm -f y.output sql.go 23 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-vitess.v0/vt/sqlparser/impossible_query.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 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 agreedto 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 | package sqlparser 18 | 19 | // FormatImpossibleQuery creates an impossible query in a TrackedBuffer. 20 | // An impossible query is a modified version of a query where all selects have where clauses that are 21 | // impossible for mysql to resolve. This is used in the vtgate and vttablet: 22 | // 23 | // - In the vtgate it's used for joins: if the first query returns no result, then vtgate uses the impossible 24 | // query just to fetch field info from vttablet 25 | // - In the vttablet, it's just an optimization: the field info is fetched once form MySQL, cached and reused 26 | // for subsequent queries 27 | func FormatImpossibleQuery(buf *TrackedBuffer, node SQLNode) { 28 | switch node := node.(type) { 29 | case *Select: 30 | buf.Myprintf("select %v from %v where 1 != 1", node.SelectExprs, node.From) 31 | if node.GroupBy != nil { 32 | node.GroupBy.Format(buf) 33 | } 34 | case *Union: 35 | buf.Myprintf("%v %s %v", node.Left, node.Type, node.Right) 36 | default: 37 | node.Format(buf) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-vitess.v0/vt/sqlparser/truncate_query.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 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 | package sqlparser 18 | 19 | import ( 20 | "flag" 21 | ) 22 | 23 | var ( 24 | // TruncateUILen truncate queries in debug UIs to the given length. 0 means unlimited. 25 | TruncateUILen = flag.Int("sql-max-length-ui", 512, "truncate queries in debug UIs to the given length (default 512)") 26 | 27 | // TruncateErrLen truncate queries in error logs to the given length. 0 means unlimited. 28 | TruncateErrLen = flag.Int("sql-max-length-errors", 0, "truncate queries in error logs to the given length (default unlimited)") 29 | ) 30 | 31 | func truncateQuery(query string, max int) string { 32 | sql, comments := SplitTrailingComments(query) 33 | 34 | if max == 0 || len(sql) <= max { 35 | return sql + comments 36 | } 37 | 38 | return sql[:max-12] + " [TRUNCATED]" + comments 39 | } 40 | 41 | // TruncateForUI is used when displaying queries on various Vitess status pages 42 | // to keep the pages small enough to load and render properly 43 | func TruncateForUI(query string) string { 44 | return truncateQuery(query, *TruncateUILen) 45 | } 46 | 47 | // TruncateForLog is used when displaying queries as part of error logs 48 | // to avoid overwhelming logging systems with potentially long queries and 49 | // bind value data. 50 | func TruncateForLog(query string) string { 51 | return truncateQuery(query, *TruncateErrLen) 52 | } 53 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-vitess.v0/vt/vterrors/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 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 agreedto 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 | // Package vterrors provides helpers for propagating internal errors 18 | // through the Vitess system (including across RPC boundaries) in a 19 | // structured way. 20 | package vterrors 21 | 22 | /* 23 | 24 | Vitess uses canonical error codes for error reporting. This is based 25 | on years of industry experience with error reporting. This idea is 26 | that errors should be classified into a small set of errors (10 or so) 27 | with very specific meaning. Each error has a code, and a message. When 28 | errors are passed around (even through RPCs), the code is 29 | propagated. To handle errors, only the code should be looked at (and 30 | not string-matching on the error message). 31 | 32 | Vitess defines the error codes in /proto/vtrpc.proto. Along with an 33 | RPCError message that can be used to transmit errors through RPCs, in 34 | the message payloads. These codes match the names and numbers defined 35 | by gRPC. 36 | 37 | Vitess also defines a standardized error implementation that allows 38 | you to build an error with an associated canonical code. 39 | 40 | While sending an error through gRPC, these codes are transmitted 41 | using gRPC's error propagation mechanism and decoded back to 42 | the original code on the other end. 43 | 44 | */ 45 | -------------------------------------------------------------------------------- /vendor/gopkg.in/src-d/go-vitess.v0/vt/vterrors/proto3.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 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 | package vterrors 18 | 19 | import ( 20 | vtrpcpb "gopkg.in/src-d/go-vitess.v0/vt/proto/vtrpc" 21 | ) 22 | 23 | // This file contains the necessary methods to send and receive errors 24 | // as payloads of proto3 structures. It converts vtError to and from 25 | // *vtrpcpb.RPCError. Use these methods when a RPC call can return both 26 | // data and an error. 27 | 28 | // FromVTRPC recovers a vtError from a *vtrpcpb.RPCError (which is how vtError 29 | // is transmitted across proto3 RPC boundaries). 30 | func FromVTRPC(rpcErr *vtrpcpb.RPCError) error { 31 | if rpcErr == nil { 32 | return nil 33 | } 34 | code := rpcErr.Code 35 | if code == vtrpcpb.Code_OK { 36 | code = LegacyErrorCodeToCode(rpcErr.LegacyCode) 37 | } 38 | return New(code, rpcErr.Message) 39 | } 40 | 41 | // ToVTRPC converts from vtError to a vtrpcpb.RPCError. 42 | func ToVTRPC(err error) *vtrpcpb.RPCError { 43 | if err == nil { 44 | return nil 45 | } 46 | code := Code(err) 47 | return &vtrpcpb.RPCError{ 48 | LegacyCode: CodeToLegacyErrorCode(code), 49 | Code: code, 50 | Message: err.Error(), 51 | } 52 | } 53 | --------------------------------------------------------------------------------