├── .gitignore ├── LICENSE ├── README.md ├── aviatorfakes ├── fake_executor.go ├── fake_file_store.go ├── fake_goml_client.go ├── fake_modifier.go ├── fake_spruce_client.go ├── fake_spruce_processor.go └── fake_validator.go ├── cmd └── aviator │ ├── cockpit │ └── cockpit.go │ ├── examples.go │ ├── flags.go │ ├── main.go │ └── prints.go ├── evaluator ├── evaluate.go ├── evaluate_test.go └── evaluator_suite_test.go ├── executor ├── executor.go ├── executor_suite_test.go ├── flyexecutor.go ├── flyexecutor_test.go ├── genericexecutor.go ├── genericexecutor_test.go ├── kubeexecutor.go └── kubeexecutor_test.go ├── filemanager ├── filemanager.go ├── filemanager_suite_test.go ├── filemanager_test.go └── integration │ └── fake.yml ├── go.mod ├── go.sum ├── gomlclient └── gomlclient.go ├── models.go ├── modifier ├── modifier_suite_test.go ├── modifier_test.go └── modify.go ├── printer ├── printer.go ├── printer_suite_test.go ├── printer_test.go ├── squash.go └── squash_test.go ├── processor ├── helpers.go ├── integration │ └── yamls │ │ ├── addons │ │ ├── sub1 │ │ │ ├── file1.yml │ │ │ └── file2.yml │ │ └── sub2 │ │ │ └── file1.yml │ │ ├── base.yml │ │ ├── fake.yml │ │ └── fake2.yml ├── processor.go ├── processor_suite_test.go ├── processor_test.go └── squash_processor.go ├── scripts └── build.sh ├── spruce ├── spruce.go ├── spruce_suite_test.go └── spruce_test.go ├── squasher ├── check ├── squash.go ├── squash_test.go └── squasher_suite_test.go ├── validator ├── validator.go ├── validator_suite_test.go └── validator_test.go └── vendor ├── github.com ├── JulzDiverse │ ├── mingoak │ │ ├── README.md │ │ ├── dir.go │ │ ├── file.go │ │ └── mingoak.go │ └── osenv │ │ ├── README.md │ │ └── osenv.go ├── Knetic │ └── govaluate │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CONTRIBUTORS │ │ ├── EvaluableExpression.go │ │ ├── EvaluableExpression_sql.go │ │ ├── ExpressionToken.go │ │ ├── LICENSE │ │ ├── MANUAL.md │ │ ├── OperatorSymbol.go │ │ ├── README.md │ │ ├── TokenKind.go │ │ ├── evaluationStage.go │ │ ├── expressionFunctions.go │ │ ├── expressionOutputStream.go │ │ ├── lexerState.go │ │ ├── lexerStream.go │ │ ├── parameters.go │ │ ├── parsing.go │ │ ├── sanitizedParameters.go │ │ ├── stagePlanner.go │ │ ├── test.sh │ │ └── tokenStream.go ├── geofffranks │ ├── simpleyaml │ │ ├── LICENSE │ │ ├── README.md │ │ └── simpleyaml.go │ ├── spruce │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── diff.go │ │ ├── errors.go │ │ ├── evaluator.go │ │ ├── json.go │ │ ├── log │ │ │ └── log.go │ │ ├── merge.go │ │ ├── op_calc.go │ │ ├── op_cartesian_product.go │ │ ├── op_concat.go │ │ ├── op_defer.go │ │ ├── op_empty.go │ │ ├── op_file.go │ │ ├── op_grab.go │ │ ├── op_inject.go │ │ ├── op_join.go │ │ ├── op_keys.go │ │ ├── op_null.go │ │ ├── op_param.go │ │ ├── op_prune.go │ │ ├── op_static_ips.go │ │ ├── op_vault.go │ │ └── operator.go │ └── yaml │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── LICENSE.libyaml │ │ ├── README.md │ │ ├── apic.go │ │ ├── decode.go │ │ ├── emitterc.go │ │ ├── encode.go │ │ ├── parserc.go │ │ ├── readerc.go │ │ ├── resolve.go │ │ ├── scannerc.go │ │ ├── sorter.go │ │ ├── writerc.go │ │ ├── yaml.go │ │ ├── yamlh.go │ │ └── yamlprivateh.go ├── mattn │ └── go-isatty │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── doc.go │ │ ├── isatty_bsd.go │ │ ├── isatty_others.go │ │ ├── isatty_solaris.go │ │ └── isatty_windows.go ├── onsi │ ├── ginkgo │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── config │ │ │ └── config.go │ │ ├── ginkgo_dsl.go │ │ ├── internal │ │ │ ├── codelocation │ │ │ │ └── code_location.go │ │ │ ├── containernode │ │ │ │ └── container_node.go │ │ │ ├── failer │ │ │ │ └── failer.go │ │ │ ├── leafnodes │ │ │ │ ├── benchmarker.go │ │ │ │ ├── interfaces.go │ │ │ │ ├── it_node.go │ │ │ │ ├── measure_node.go │ │ │ │ ├── runner.go │ │ │ │ ├── setup_nodes.go │ │ │ │ ├── suite_nodes.go │ │ │ │ ├── synchronized_after_suite_node.go │ │ │ │ └── synchronized_before_suite_node.go │ │ │ ├── remote │ │ │ │ ├── aggregator.go │ │ │ │ ├── forwarding_reporter.go │ │ │ │ ├── output_interceptor.go │ │ │ │ ├── output_interceptor_unix.go │ │ │ │ ├── output_interceptor_win.go │ │ │ │ ├── server.go │ │ │ │ ├── syscall_dup_linux_arm64.go │ │ │ │ ├── syscall_dup_solaris.go │ │ │ │ └── syscall_dup_unix.go │ │ │ ├── spec │ │ │ │ ├── spec.go │ │ │ │ └── specs.go │ │ │ ├── spec_iterator │ │ │ │ ├── index_computer.go │ │ │ │ ├── parallel_spec_iterator.go │ │ │ │ ├── serial_spec_iterator.go │ │ │ │ ├── sharded_parallel_spec_iterator.go │ │ │ │ └── spec_iterator.go │ │ │ ├── specrunner │ │ │ │ ├── random_id.go │ │ │ │ └── spec_runner.go │ │ │ ├── suite │ │ │ │ └── suite.go │ │ │ ├── testingtproxy │ │ │ │ └── testing_t_proxy.go │ │ │ └── writer │ │ │ │ ├── fake_writer.go │ │ │ │ └── writer.go │ │ ├── reporters │ │ │ ├── default_reporter.go │ │ │ ├── fake_reporter.go │ │ │ ├── junit_reporter.go │ │ │ ├── reporter.go │ │ │ ├── stenographer │ │ │ │ ├── console_logging.go │ │ │ │ ├── fake_stenographer.go │ │ │ │ ├── stenographer.go │ │ │ │ └── support │ │ │ │ │ ├── go-colorable │ │ │ │ │ ├── LICENSE │ │ │ │ │ ├── README.md │ │ │ │ │ ├── colorable_others.go │ │ │ │ │ ├── colorable_windows.go │ │ │ │ │ └── noncolorable.go │ │ │ │ │ └── go-isatty │ │ │ │ │ ├── LICENSE │ │ │ │ │ ├── README.md │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── isatty_appengine.go │ │ │ │ │ ├── isatty_bsd.go │ │ │ │ │ ├── isatty_linux.go │ │ │ │ │ ├── isatty_solaris.go │ │ │ │ │ └── isatty_windows.go │ │ │ └── teamcity_reporter.go │ │ └── types │ │ │ ├── code_location.go │ │ │ ├── synchronization.go │ │ │ └── types.go │ └── gomega │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── format │ │ └── format.go │ │ ├── gomega_dsl.go │ │ ├── internal │ │ ├── assertion │ │ │ └── assertion.go │ │ ├── asyncassertion │ │ │ └── async_assertion.go │ │ ├── oraclematcher │ │ │ └── oracle_matcher.go │ │ └── testingtsupport │ │ │ └── testing_t_support.go │ │ ├── matchers.go │ │ ├── matchers │ │ ├── and.go │ │ ├── assignable_to_type_of_matcher.go │ │ ├── be_a_directory.go │ │ ├── be_a_regular_file.go │ │ ├── be_an_existing_file.go │ │ ├── be_closed_matcher.go │ │ ├── be_empty_matcher.go │ │ ├── be_equivalent_to_matcher.go │ │ ├── be_false_matcher.go │ │ ├── be_identical_to.go │ │ ├── be_nil_matcher.go │ │ ├── be_numerically_matcher.go │ │ ├── be_sent_matcher.go │ │ ├── be_temporally_matcher.go │ │ ├── be_true_matcher.go │ │ ├── be_zero_matcher.go │ │ ├── consist_of.go │ │ ├── contain_element_matcher.go │ │ ├── contain_substring_matcher.go │ │ ├── equal_matcher.go │ │ ├── have_cap_matcher.go │ │ ├── have_key_matcher.go │ │ ├── have_key_with_value_matcher.go │ │ ├── have_len_matcher.go │ │ ├── have_occurred_matcher.go │ │ ├── have_prefix_matcher.go │ │ ├── have_suffix_matcher.go │ │ ├── match_error_matcher.go │ │ ├── match_json_matcher.go │ │ ├── match_regexp_matcher.go │ │ ├── match_xml_matcher.go │ │ ├── match_yaml_matcher.go │ │ ├── not.go │ │ ├── or.go │ │ ├── panic_matcher.go │ │ ├── receive_matcher.go │ │ ├── succeed_matcher.go │ │ ├── support │ │ │ └── goraph │ │ │ │ ├── bipartitegraph │ │ │ │ ├── bipartitegraph.go │ │ │ │ └── bipartitegraphmatching.go │ │ │ │ ├── edge │ │ │ │ └── edge.go │ │ │ │ ├── node │ │ │ │ └── node.go │ │ │ │ └── util │ │ │ │ └── util.go │ │ ├── type_support.go │ │ └── with_transform.go │ │ └── types │ │ └── types.go ├── pkg │ └── errors │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── errors.go │ │ └── stack.go ├── starkandwayne │ └── goutils │ │ ├── ansi │ │ └── printf.go │ │ └── tree │ │ ├── cursor.go │ │ ├── err.go │ │ ├── find.go │ │ └── tree.go └── urfave │ └── cli │ ├── .gitignore │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── app.go │ ├── appveyor.yml │ ├── category.go │ ├── cli.go │ ├── command.go │ ├── context.go │ ├── errors.go │ ├── flag-types.json │ ├── flag.go │ ├── flag_generated.go │ ├── funcs.go │ ├── generate-flag-types │ ├── help.go │ └── runtests ├── golang.org └── x │ ├── net │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ └── html │ │ ├── atom │ │ ├── atom.go │ │ └── table.go │ │ ├── charset │ │ └── charset.go │ │ ├── const.go │ │ ├── doc.go │ │ ├── doctype.go │ │ ├── entity.go │ │ ├── escape.go │ │ ├── foreign.go │ │ ├── node.go │ │ ├── parse.go │ │ ├── render.go │ │ └── token.go │ ├── sys │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ └── unix │ │ ├── .gitignore │ │ ├── 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_solaris_amd64.s │ │ ├── bluetooth_linux.go │ │ ├── constants.go │ │ ├── dirent.go │ │ ├── endian_big.go │ │ ├── endian_little.go │ │ ├── env_unix.go │ │ ├── gccgo.go │ │ ├── gccgo_c.c │ │ ├── gccgo_linux_amd64.go │ │ ├── mkall.sh │ │ ├── mkerrors.sh │ │ ├── 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_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_solaris.go │ │ ├── syscall_solaris_amd64.go │ │ ├── syscall_unix.go │ │ ├── syscall_unix_gc.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_solaris_amd64.go │ │ ├── zsyscall_darwin_386.go │ │ ├── zsyscall_darwin_amd64.go │ │ ├── zsyscall_darwin_arm.go │ │ ├── zsyscall_darwin_arm64.go │ │ ├── zsyscall_dragonfly_amd64.go │ │ ├── zsyscall_freebsd_386.go │ │ ├── zsyscall_freebsd_amd64.go │ │ ├── zsyscall_freebsd_arm.go │ │ ├── zsyscall_linux_386.go │ │ ├── zsyscall_linux_amd64.go │ │ ├── zsyscall_linux_arm.go │ │ ├── zsyscall_linux_arm64.go │ │ ├── zsyscall_linux_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_solaris_amd64.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 │ │ ├── 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_solaris_amd64.go │ └── text │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ ├── encoding │ ├── charmap │ │ ├── charmap.go │ │ └── tables.go │ ├── encoding.go │ ├── htmlindex │ │ ├── htmlindex.go │ │ ├── map.go │ │ └── tables.go │ ├── internal │ │ ├── identifier │ │ │ ├── identifier.go │ │ │ └── mib.go │ │ └── internal.go │ ├── japanese │ │ ├── all.go │ │ ├── eucjp.go │ │ ├── iso2022jp.go │ │ ├── shiftjis.go │ │ └── tables.go │ ├── korean │ │ ├── euckr.go │ │ └── tables.go │ ├── simplifiedchinese │ │ ├── all.go │ │ ├── gbk.go │ │ ├── hzgb2312.go │ │ └── tables.go │ ├── traditionalchinese │ │ ├── big5.go │ │ └── tables.go │ └── unicode │ │ ├── override.go │ │ └── unicode.go │ ├── internal │ ├── tag │ │ └── tag.go │ └── utf8internal │ │ └── utf8internal.go │ ├── language │ ├── Makefile │ ├── common.go │ ├── coverage.go │ ├── doc.go │ ├── go1_1.go │ ├── go1_2.go │ ├── index.go │ ├── language.go │ ├── lookup.go │ ├── match.go │ ├── parse.go │ ├── tables.go │ └── tags.go │ ├── runes │ ├── cond.go │ └── runes.go │ └── transform │ └── transform.go └── gopkg.in └── yaml.v2 ├── .travis.yml ├── LICENSE ├── LICENSE.libyaml ├── README.md ├── apic.go ├── decode.go ├── emitterc.go ├── encode.go ├── parserc.go ├── readerc.go ├── resolve.go ├── scannerc.go ├── sorter.go ├── writerc.go ├── yaml.go ├── yamlh.go └── yamlprivateh.go /.gitignore: -------------------------------------------------------------------------------- 1 | install.sh 2 | vendor 3 | aviator-linux-* 4 | aviator-darwin-* 5 | processor/integration/tmp 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Julian Mario Skupnjak 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 | -------------------------------------------------------------------------------- /cmd/aviator/examples.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | var mergeCombination = `... 4 | merge: 5 | - with: 6 | files: 7 | - file.yml 8 | - with_in: path/to/dir/ 9 | - with_all_in: another/dir/ 10 | ` 11 | 12 | var forEachCombination = `... 13 | for_each: for_each: 14 | files: in: path/to/dir/ 15 | - file.yml 16 | ` 17 | 18 | var withCombination = `... 19 | merge: 20 | - with: 21 | files: 22 | - file.yml 23 | skip_non_existing: true 24 | in_dir: path/to/dir/ 25 | ` 26 | 27 | var withInCombination = `... 28 | merge: 29 | - with_in: path/to/dir/ 30 | except: 31 | - file.yml 32 | regexp: ".*.(yml)" 33 | ` 34 | 35 | var withAllInCombination = `... 36 | merge: 37 | - with_all_in: path/to/dir/ 38 | except: 39 | - file.yml 40 | regexp: ".*.(yml)" 41 | ` 42 | 43 | var forEachFilesCombination = `... 44 | for_each: 45 | files: 46 | - file.yml 47 | in_dir: path/to/dir/ 48 | skip_non_existing: true 49 | ` 50 | 51 | var forEachWalkCombination = `... 52 | for_each: 53 | in: path/to/dir/ 54 | include_sub_dirs: true 55 | copy_parents: true 56 | enable_matching: true 57 | except: 58 | - filetoexcept.yml 59 | ` 60 | var mergeRegexpCombination = `... 61 | merge: 62 | - with_in: path/to/dir/ 63 | regexp: ".*.(yml)" 64 | - with_all_in: path/to/dir/ 65 | regexp: ".*.(yml)" 66 | ` 67 | 68 | var mergeExceptCombination = `... 69 | merge: 70 | - with_in: path/to/dir/ 71 | except: 72 | - file.yml 73 | - with_all_in: path/to/dir/ 74 | except: 75 | - file.yml 76 | ` 77 | 78 | var forEachRegexpCombination = `... 79 | for_each: 80 | in: path/to/dir/ 81 | regexp: ".*.(yml)" 82 | ` 83 | -------------------------------------------------------------------------------- /cmd/aviator/flags.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/urfave/cli" 4 | 5 | func setCli() *cli.App { 6 | cmd := cli.NewApp() 7 | cmd.Authors = []cli.Author{ 8 | cli.Author{ 9 | Name: "JulzDiverse", 10 | Email: "julian.skupnjak@gmail.com", 11 | }, 12 | } 13 | cmd.Name = "Aviator" 14 | cmd.Usage = "Navigate to a aviator.yml file and run aviator" 15 | cmd.Version = "1.9.0" 16 | cmd.Flags = getFlags() 17 | return cmd 18 | } 19 | 20 | func getFlags() []cli.Flag { 21 | var flags []cli.Flag 22 | flags = []cli.Flag{ 23 | cli.StringFlag{ 24 | Name: "file, f", 25 | Value: "aviator.yml", 26 | Usage: "Specifies a path to an aviator yaml", 27 | }, 28 | cli.BoolFlag{ 29 | Name: "verbose, vv", 30 | Usage: "prints warnings", 31 | }, 32 | cli.BoolFlag{ 33 | Name: "silent, s", 34 | Usage: "silent mode (no prints)", 35 | }, 36 | cli.StringSliceFlag{ 37 | Name: "var", 38 | Usage: "provides a variable to an aviator file: [key=value]", 39 | }, 40 | cli.BoolFlag{ 41 | Name: "curly-braces, b", 42 | Usage: "allow {{}} syntax in yaml files", 43 | }, 44 | cli.BoolFlag{ 45 | Name: "dry-run, d", 46 | Usage: "print files to stdout, executors will be omitted", 47 | }, 48 | } 49 | return flags 50 | } 51 | -------------------------------------------------------------------------------- /cmd/aviator/prints.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/starkandwayne/goutils/ansi" 5 | ) 6 | 7 | func printMergeCombinationError(err error) { 8 | ansi.Printf("%s\n\n", err.Error()) 9 | ansi.Printf("Use this 'merge' params, as separate array entries. Example:\n@G{%s}", mergeCombination) 10 | } 11 | 12 | func printForEachCombinationError(err error) { 13 | ansi.Printf("%s\n\n", err.Error()) 14 | ansi.Printf("Use 'for_each' either with 'files' or 'in' parameter. Example :\n@G{%s}", forEachCombination) 15 | } 16 | 17 | func printMergeWithCombinationError(err error) { 18 | ansi.Printf("%s\n\n", err.Error()) 19 | ansi.Printf("Example:\n@G{%s}", withCombination) 20 | } 21 | 22 | func printForEachFilesCombinationError(err error) { 23 | ansi.Printf("%s\n\n", err.Error()) 24 | ansi.Printf("Example:\n@G{%s}", forEachFilesCombination) 25 | } 26 | 27 | func printForEachInCombinationError(err error) { 28 | ansi.Printf("%s\n\n", err.Error()) 29 | ansi.Printf("Example:\n@G{%s}", forEachFilesCombination) 30 | } 31 | 32 | func printForEachWalkCombinationError(err error) { 33 | ansi.Printf("%s\n\n", err.Error()) 34 | ansi.Printf("Example:\n@G{%s}", forEachWalkCombination) 35 | } 36 | 37 | func printMergeRegexpCombinationError(err error) { 38 | ansi.Printf("%s\n\n", err.Error()) 39 | ansi.Printf("Example:\n@G{%s}", mergeRegexpCombination) 40 | } 41 | 42 | func printMergeExceptCombinationError(err error) { 43 | ansi.Printf("%s\n\n", err.Error()) 44 | ansi.Printf("Example:\n@G{%s}", mergeExceptCombination) 45 | } 46 | 47 | func printForEachRegexpCombinationError(err error) { 48 | ansi.Printf("%s\n\n", err.Error()) 49 | ansi.Printf("Example:\n@G{%s}", forEachRegexpCombination) 50 | } 51 | -------------------------------------------------------------------------------- /evaluator/evaluate.go: -------------------------------------------------------------------------------- 1 | package evaluator 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "fmt" 7 | "regexp" 8 | "strings" 9 | ) 10 | 11 | var variableFormatRegex = regexp.MustCompile(`\(\(\s([-\w\p{L}]+)\s\)\)`) 12 | 13 | func Evaluate(aviatorFile []byte, vars map[string]string) ([]byte, error) { 14 | var err error 15 | return variableFormatRegex.ReplaceAllFunc(aviatorFile, func(match []byte) []byte { 16 | key := string(variableFormatRegex.FindSubmatch(match)[1]) 17 | 18 | val, ok := vars[key] 19 | if !ok { 20 | err = errors.New(fmt.Sprintf("Variable (( %s )) not provided", key)) 21 | } 22 | 23 | var replace []byte 24 | if strings.Contains(val, "\n") { 25 | replace, _ = json.Marshal(val) 26 | } else { 27 | replace = []byte(val) 28 | } 29 | 30 | return []byte(replace) 31 | }), err 32 | } 33 | -------------------------------------------------------------------------------- /evaluator/evaluator_suite_test.go: -------------------------------------------------------------------------------- 1 | package evaluator_test 2 | 3 | import ( 4 | "testing" 5 | 6 | . "github.com/onsi/ginkgo" 7 | . "github.com/onsi/gomega" 8 | ) 9 | 10 | func TestEvaluator(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Evaluator Suite") 13 | } 14 | -------------------------------------------------------------------------------- /executor/executor.go: -------------------------------------------------------------------------------- 1 | package executor 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "os/exec" 7 | 8 | "github.com/pkg/errors" 9 | "github.com/starkandwayne/goutils/ansi" 10 | ) 11 | 12 | type Executor struct { 13 | silent bool 14 | } 15 | 16 | func New(silent bool) *Executor { 17 | return &Executor{ 18 | silent: silent, 19 | } 20 | } 21 | 22 | func (e *Executor) Execute(cmds []*exec.Cmd) error { 23 | for _, c := range cmds { 24 | if !e.silent { 25 | fmt.Println(stringifyCmd(c)) 26 | } 27 | err := e.execCmd(c) 28 | if err != nil { 29 | return err 30 | } 31 | if !e.silent { 32 | fmt.Println("") 33 | } 34 | } 35 | 36 | return nil 37 | } 38 | 39 | func (e *Executor) execCmd(cmd *exec.Cmd) error { 40 | if !e.silent { 41 | cmd.Stdout = os.Stdout 42 | } 43 | cmd.Stdin = os.Stdin 44 | cmd.Stderr = os.Stderr 45 | 46 | err := cmd.Run() 47 | if err != nil { 48 | return errors.Wrap(err, ansi.Sprintf("@R{Failed to run %s}", cmd.Path)) 49 | } 50 | 51 | return nil 52 | } 53 | 54 | func stringifyCmd(cmd *exec.Cmd) string { 55 | result := "" 56 | result = ansi.Sprintf("@G{AVIATOR EXECUTE:$} %s", cmd.Args[0]) 57 | for i := 1; i < len(cmd.Args); i++ { 58 | result = fmt.Sprintf("%s %s", result, cmd.Args[i]) 59 | } 60 | return result 61 | } 62 | -------------------------------------------------------------------------------- /executor/executor_suite_test.go: -------------------------------------------------------------------------------- 1 | package executor_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestExecutor(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Executor Suite") 13 | } 14 | -------------------------------------------------------------------------------- /executor/genericexecutor.go: -------------------------------------------------------------------------------- 1 | package executor 2 | 3 | import ( 4 | "os/exec" 5 | "reflect" 6 | 7 | "github.com/JulzDiverse/aviator" 8 | "github.com/pkg/errors" 9 | "github.com/starkandwayne/goutils/ansi" 10 | ) 11 | 12 | type GenericExecutor struct{} 13 | 14 | func (e GenericExecutor) Command(cfg interface{}) ([]*exec.Cmd, error) { 15 | execs, ok := cfg.([]aviator.Executable) 16 | if !ok { 17 | return []*exec.Cmd{}, errors.New(ansi.Sprintf("@R{Type Assertion failed! Cannot assert %s to %s}", reflect.TypeOf(cfg), "aviator.Exec")) 18 | } 19 | 20 | cmds := []*exec.Cmd{} 21 | for _, exe := range execs { 22 | var args []string 23 | if len(exe.GlobalOptions) > 0 { 24 | for _, globOpt := range exe.GlobalOptions { 25 | args = append(args, globOpt.Name) 26 | if globOpt.Value != "" { 27 | args = append(args, globOpt.Value) 28 | } 29 | } 30 | } 31 | 32 | command := exe.Command 33 | if command.Name != "" { 34 | args = append(args, command.Name) 35 | if len(exe.Command.Options) > 0 { 36 | for _, cmdOpt := range command.Options { 37 | args = append(args, cmdOpt.Name) 38 | if cmdOpt.Value != "" { 39 | args = append(args, cmdOpt.Value) 40 | } 41 | } 42 | } 43 | } 44 | 45 | if len(exe.Args) > 0 { 46 | for _, arg := range exe.Args { 47 | args = append(args, arg) 48 | } 49 | } 50 | 51 | cmds = append(cmds, exec.Command(exe.Executable, args...)) 52 | } 53 | 54 | return cmds, nil 55 | } 56 | -------------------------------------------------------------------------------- /executor/kubeexecutor.go: -------------------------------------------------------------------------------- 1 | package executor 2 | 3 | import ( 4 | "fmt" 5 | "os/exec" 6 | "reflect" 7 | 8 | "github.com/JulzDiverse/aviator" 9 | "github.com/pkg/errors" 10 | "github.com/starkandwayne/goutils/ansi" 11 | ) 12 | 13 | const ( 14 | kustomizeFlag = "--kustomize" 15 | forceFlag = "--force" 16 | filenameFlag = "--filename" 17 | dryRunFlag = "--dry-run" 18 | overwriteFlag = "--overwrite" 19 | validateFlag = "--validate" 20 | outputFlag = "--output" 21 | recursiveFlag = "--recursive" 22 | ) 23 | 24 | type KubeExecutor struct{} 25 | 26 | func (e KubeExecutor) Command(cfg interface{}) ([]*exec.Cmd, error) { 27 | kube, ok := cfg.(aviator.Kube) 28 | if !ok { 29 | return []*exec.Cmd{}, errors.New(ansi.Sprintf("@R{Type Assertion failed! Cannot assert %s to %s}", reflect.TypeOf(cfg), "aviator.Kube")) 30 | } 31 | 32 | apply := kube.Apply 33 | 34 | var args []string 35 | if apply.Kustomize { 36 | args = []string{ 37 | "apply", kustomizeFlag, apply.File, 38 | } 39 | } else { 40 | args = []string{ 41 | "apply", filenameFlag, apply.File, 42 | } 43 | } 44 | 45 | if apply.Recursive { 46 | args = append(args, fmt.Sprintf("%s=%s", recursiveFlag, "true")) 47 | } 48 | 49 | if apply.Force { 50 | args = append(args, forceFlag) 51 | } 52 | 53 | if apply.DryRun { 54 | args = append(args, dryRunFlag) 55 | } 56 | 57 | if apply.Overwrite { 58 | args = append(args, overwriteFlag) 59 | } 60 | 61 | if apply.Validate { 62 | args = append(args, validateFlag) 63 | } 64 | 65 | if apply.Output != "" { 66 | args = append(args, outputFlag, apply.Output) 67 | } 68 | 69 | return []*exec.Cmd{exec.Command("kubectl", args...)}, nil 70 | } 71 | -------------------------------------------------------------------------------- /filemanager/filemanager_suite_test.go: -------------------------------------------------------------------------------- 1 | package filemanager_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestFilemanager(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Filemanager Suite") 13 | } 14 | -------------------------------------------------------------------------------- /filemanager/integration/fake.yml: -------------------------------------------------------------------------------- 1 | test: test 2 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/JulzDiverse/aviator 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/JulzDiverse/goml v0.3.1-0.20171127172047-0cea11a28f6d 7 | github.com/JulzDiverse/mingoak v0.0.0-20170916100846-e826f968fdbd 8 | github.com/JulzDiverse/osenv v0.0.0-20170824043146-03a96da46df6 9 | github.com/Knetic/govaluate v3.0.1-0.20170802055603-93a54c2584a8+incompatible // indirect 10 | github.com/aws/aws-sdk-go v1.31.15 // indirect 11 | github.com/cloudfoundry-community/vaultkv v0.0.0-20200311151509-343c0e6fc506 // indirect 12 | github.com/cppforlife/go-patch v0.2.0 13 | github.com/geofffranks/simpleyaml v0.0.0-20161109204137-c9320f076de5 14 | github.com/geofffranks/spruce v1.27.0 15 | github.com/geofffranks/yaml v0.0.0-20161117152608-9f2fe4b6f295 // indirect 16 | github.com/onsi/ginkgo v1.12.0 17 | github.com/onsi/gomega v1.9.0 18 | github.com/pkg/errors v0.9.1 19 | github.com/smallfish/simpleyaml v0.0.0-20170527020626-116d8e577389 // indirect 20 | github.com/starkandwayne/goutils v0.0.0-20190115202530-896b8a6904be 21 | github.com/urfave/cli v1.19.1 22 | gopkg.in/yaml.v2 v2.3.0 23 | ) 24 | -------------------------------------------------------------------------------- /gomlclient/gomlclient.go: -------------------------------------------------------------------------------- 1 | package gomlclient 2 | 3 | import ( 4 | "github.com/JulzDiverse/goml" 5 | ) 6 | 7 | type GomlClient struct{} 8 | 9 | func New() *GomlClient { 10 | return &GomlClient{} 11 | } 12 | 13 | func (g *GomlClient) Delete(file []byte, path string) ([]byte, error) { 14 | return goml.DeleteInMemory(file, path) 15 | } 16 | 17 | func (g *GomlClient) Set(file []byte, path string, val string) ([]byte, error) { 18 | return goml.SetInMemory(file, path, val) 19 | } 20 | 21 | func (g *GomlClient) Update(file []byte, path string, val string) ([]byte, error) { 22 | if _, err := goml.GetInMemory(file, path); err == nil { 23 | return goml.SetInMemory(file, path, val) 24 | } 25 | return file, nil 26 | } 27 | -------------------------------------------------------------------------------- /modifier/modifier_suite_test.go: -------------------------------------------------------------------------------- 1 | package modifier_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestModifier(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Modifier Suite") 13 | } 14 | -------------------------------------------------------------------------------- /modifier/modify.go: -------------------------------------------------------------------------------- 1 | package modifier 2 | 3 | import ( 4 | "github.com/JulzDiverse/aviator" 5 | "github.com/JulzDiverse/aviator/gomlclient" 6 | ) 7 | 8 | type Modifier struct { 9 | goml aviator.GomlClient 10 | } 11 | 12 | func NewModifier(goml aviator.GomlClient) *Modifier { 13 | return &Modifier{ 14 | goml: goml, 15 | } 16 | } 17 | 18 | func New() *Modifier { 19 | return &Modifier{ 20 | goml: gomlclient.New(), 21 | } 22 | } 23 | 24 | func (m *Modifier) Modify(file []byte, mod aviator.Modify) ([]byte, error) { 25 | var err error 26 | modified := file 27 | if len(mod.Delete) > 0 { 28 | for _, v := range mod.Delete { 29 | if yml, err := m.goml.Delete(modified, v); err == nil { 30 | modified = yml 31 | } 32 | } 33 | } 34 | if len(mod.Set) > 0 { 35 | for _, set := range mod.Set { 36 | if yml, err := m.goml.Set(modified, set.Path, set.Value); err == nil { 37 | modified = yml 38 | } 39 | } 40 | } 41 | if len(mod.Update) > 0 { 42 | for _, update := range mod.Update { 43 | if yml, err := m.goml.Update(modified, update.Path, update.Value); err == nil { 44 | modified = yml 45 | } 46 | } 47 | } 48 | return modified, err 49 | } 50 | -------------------------------------------------------------------------------- /printer/printer.go: -------------------------------------------------------------------------------- 1 | package printer 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | 7 | "github.com/JulzDiverse/aviator" 8 | "github.com/starkandwayne/goutils/ansi" 9 | ) 10 | 11 | type Print func(string, ...interface{}) (int, error) 12 | 13 | func AnsiPrint(opts aviator.MergeConf, to string, warnings []string, verbose bool) { 14 | BeautyfulPrint(opts, to, warnings, verbose, ansi.Printf) 15 | } 16 | 17 | func BeautyfulPrint(opts aviator.MergeConf, to string, warnings []string, verbose bool, printf Print) { 18 | printf("@G{SPRUCE MERGE:}\n") 19 | if len(opts.Prune) != 0 { 20 | for _, prune := range opts.Prune { 21 | printf("\t@C{--prune} %s\n", prune) 22 | } 23 | } 24 | for _, file := range opts.Files { 25 | printf("\t%s\n", file) 26 | } 27 | printf("\t@G{to: %s}\n\n", to) 28 | if verbose && (len(warnings) > 0) { //global variable 29 | printf("\t@Y{WARNINGS:}\n") 30 | for _, w := range warnings { 31 | sl := strings.Split(w, ":") 32 | printf("\t@y{%s}:@Y{%s}\n", sl[0], sl[1]) 33 | } 34 | fmt.Println() 35 | fmt.Println() 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /printer/printer_suite_test.go: -------------------------------------------------------------------------------- 1 | package printer_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestPrinter(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Printer Suite") 13 | } 14 | -------------------------------------------------------------------------------- /printer/printer_test.go: -------------------------------------------------------------------------------- 1 | package printer_test 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "io" 7 | "os" 8 | 9 | "github.com/JulzDiverse/aviator" 10 | . "github.com/JulzDiverse/aviator/printer" 11 | 12 | . "github.com/onsi/ginkgo" 13 | . "github.com/onsi/gomega" 14 | ) 15 | 16 | var _ = Describe("Printer", func() { 17 | var ( 18 | opts aviator.MergeConf 19 | expected string 20 | warnings []string 21 | to string 22 | ) 23 | 24 | BeforeEach(func() { 25 | opts = aviator.MergeConf{ 26 | Files: []string{"file", "file2"}, 27 | Prune: []string{"props", "meta"}, 28 | } 29 | expected = `@G{SPRUCE MERGE:} 30 | @C{--prune} props 31 | @C{--prune} meta 32 | file 33 | file2 34 | @G{to: dest} 35 | 36 | @Y{WARNINGS:} 37 | @y{skipped}:@Y{x} 38 | @y{skipped}:@Y{y} 39 | 40 | 41 | ` 42 | 43 | warnings = []string{"skipped:x", "skipped:y"} 44 | to = "dest" 45 | }) 46 | 47 | Context("BeautifulPrint", func() { 48 | It("prints the expected output", func() { 49 | output := captureOutput(BeautyfulPrint, opts, to, warnings, true, fmt.Printf) 50 | Expect(output).To(Equal(expected)) 51 | }) 52 | }) 53 | }) 54 | 55 | func captureOutput(f func(aviator.MergeConf, string, []string, bool, Print), opts aviator.MergeConf, to string, warnings []string, verbose bool, printf Print) string { 56 | old := os.Stdout 57 | r, w, _ := os.Pipe() 58 | os.Stdout = w 59 | f(opts, to, warnings, verbose, printf) 60 | os.Stdout = old 61 | var buf bytes.Buffer 62 | w.Close() 63 | io.Copy(&buf, r) 64 | return buf.String() 65 | } 66 | -------------------------------------------------------------------------------- /printer/squash.go: -------------------------------------------------------------------------------- 1 | package printer 2 | 3 | import "github.com/starkandwayne/goutils/ansi" 4 | 5 | func AnsiPrintSquash(files []string, to string) { 6 | BeautyPrintSquash(files, to, ansi.Printf) 7 | } 8 | 9 | func BeautyPrintSquash(files []string, to string, printf Print) { 10 | printf("@M{SQUASH FILES:}\n") 11 | for _, f := range files { 12 | printf("\t@w{%s}\n", f) 13 | } 14 | printf("\t@M{to: %s}\n", to) 15 | } 16 | -------------------------------------------------------------------------------- /printer/squash_test.go: -------------------------------------------------------------------------------- 1 | package printer_test 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "io" 7 | "os" 8 | 9 | . "github.com/onsi/ginkgo" 10 | . "github.com/onsi/gomega" 11 | 12 | . "github.com/JulzDiverse/aviator/printer" 13 | ) 14 | 15 | var _ = Describe("Squash", func() { 16 | var ( 17 | files []string 18 | expected string 19 | to string 20 | output string 21 | ) 22 | 23 | BeforeEach(func() { 24 | files = []string{ 25 | "file1", 26 | "file2", 27 | "file3", 28 | } 29 | 30 | expected = `@M{SQUASH FILES:} 31 | @w{file1} 32 | @w{file2} 33 | @w{file3} 34 | @M{to: dest} 35 | ` 36 | to = "dest" 37 | }) 38 | 39 | JustBeforeEach(func() { 40 | output = captureOutputSquash(BeautyPrintSquash, files, to, fmt.Printf) 41 | }) 42 | 43 | Context("BeautyPrintSquash", func() { 44 | It("prints the expected output", func() { 45 | Expect(output).To(Equal(expected)) 46 | }) 47 | }) 48 | }) 49 | 50 | func captureOutputSquash(f func([]string, string, Print), files []string, to string, printf Print) string { 51 | old := os.Stdout 52 | r, w, _ := os.Pipe() 53 | os.Stdout = w 54 | f(files, to, printf) 55 | os.Stdout = old 56 | var buf bytes.Buffer 57 | w.Close() 58 | io.Copy(&buf, r) 59 | return buf.String() 60 | } 61 | -------------------------------------------------------------------------------- /processor/integration/yamls/addons/sub1/file1.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/herrjulz/aviator/1f22c66e1b0e8f5c740a48e638590a31132445f0/processor/integration/yamls/addons/sub1/file1.yml -------------------------------------------------------------------------------- /processor/integration/yamls/addons/sub1/file2.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/herrjulz/aviator/1f22c66e1b0e8f5c740a48e638590a31132445f0/processor/integration/yamls/addons/sub1/file2.yml -------------------------------------------------------------------------------- /processor/integration/yamls/addons/sub2/file1.yml: -------------------------------------------------------------------------------- 1 | some: other 2 | -------------------------------------------------------------------------------- /processor/integration/yamls/base.yml: -------------------------------------------------------------------------------- 1 | the: base 2 | -------------------------------------------------------------------------------- /processor/integration/yamls/fake.yml: -------------------------------------------------------------------------------- 1 | word: yo! 2 | -------------------------------------------------------------------------------- /processor/integration/yamls/fake2.yml: -------------------------------------------------------------------------------- 1 | another: base 2 | -------------------------------------------------------------------------------- /processor/processor_suite_test.go: -------------------------------------------------------------------------------- 1 | package processor_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestProcessor(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Processor Suite") 13 | } 14 | -------------------------------------------------------------------------------- /processor/squash_processor.go: -------------------------------------------------------------------------------- 1 | package processor 2 | 3 | import ( 4 | "path/filepath" 5 | "regexp" 6 | 7 | "github.com/JulzDiverse/aviator" 8 | ) 9 | 10 | type FileProcessor struct { 11 | Store aviator.FileStore 12 | } 13 | 14 | func (f *FileProcessor) CollectFilesFromDir(dir, regex string, ignore []string) []string { 15 | result := []string{} 16 | if dir != "" { 17 | files, _ := f.Store.ReadDir(dir) 18 | 19 | for _, f := range files { 20 | if except(ignore, f.Name()) { 21 | continue 22 | } 23 | 24 | matched, _ := regexp.MatchString(regex, f.Name()) 25 | if !f.IsDir() && matched { 26 | result = append(result, filepath.Join(resolveBraces(dir)+f.Name())) 27 | } 28 | } 29 | } 30 | return result 31 | } 32 | -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | readonly basedir="$(cd "$(dirname "$0")"/.. && pwd)" 6 | readonly cmd_dir="$basedir/cmd/aviator" 7 | 8 | readonly aviator_darwin="aviator-darwin-amd64" 9 | readonly aviator_linux="aviator-linux-amd64" 10 | readonly aviator_win="aviator-win" 11 | 12 | main(){ 13 | pushd $cmd_dir 14 | go_build "darwin" "$aviator_darwin" 15 | go_build "linux" "$aviator_linux" 16 | go_build "windows" "$aviator_win" 17 | popd 18 | 19 | get_shasum "$cmd_dir/$aviator_darwin" 20 | } 21 | 22 | go_build(){ 23 | echo "building $2..." 24 | GOOS=$1 go build -o $2 25 | } 26 | 27 | get_shasum(){ 28 | shasum -a 256 $1 29 | } 30 | 31 | main 32 | -------------------------------------------------------------------------------- /spruce/spruce_suite_test.go: -------------------------------------------------------------------------------- 1 | package spruce_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestSpruce(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Spruce Suite") 13 | } 14 | -------------------------------------------------------------------------------- /spruce/spruce_test.go: -------------------------------------------------------------------------------- 1 | package spruce_test 2 | 3 | import ( 4 | "github.com/JulzDiverse/aviator" 5 | "github.com/JulzDiverse/aviator/filemanager" 6 | . "github.com/JulzDiverse/aviator/spruce" 7 | 8 | . "github.com/onsi/ginkgo" 9 | . "github.com/onsi/gomega" 10 | ) 11 | 12 | var _ = Describe("Spruce", func() { 13 | 14 | var spruce *SpruceClient 15 | 16 | BeforeEach(func() { 17 | spruce = NewWithFileFilemanager( 18 | filemanager.Store(true, false), true, 19 | ) 20 | }) 21 | 22 | Context("CmdMergeEval", func() { 23 | It("simple merge two files", func() { 24 | opts := aviator.MergeConf{ 25 | Files: []string{ 26 | "../processor/integration/yamls/base.yml", 27 | "../processor/integration/yamls/fake.yml", 28 | }, 29 | } 30 | 31 | result, err := spruce.MergeWithOptsRaw(opts) 32 | 33 | Expect(err).To(BeNil()) 34 | value, _ := result["word"] 35 | value2, _ := result["the"] 36 | Expect(value).To(Equal("yo!")) 37 | Expect(value2).To(Equal("base")) 38 | }) 39 | 40 | It("should be able to prune", func() { 41 | opts := aviator.MergeConf{ 42 | Files: []string{ 43 | "../processor/integration/yamls/base.yml", 44 | "../processor/integration/yamls/fake.yml", 45 | }, 46 | Prune: []string{ 47 | "the", 48 | }, 49 | } 50 | 51 | result, err := spruce.MergeWithOptsRaw(opts) 52 | Expect(err).To(BeNil()) 53 | value, _ := result["the"] 54 | Expect(value).To(BeNil()) 55 | }) 56 | }) 57 | }) 58 | -------------------------------------------------------------------------------- /squasher/check: -------------------------------------------------------------------------------- 1 | --- 2 | i_am_yaml: 1 3 | --- 4 | i_am_yaml: 2 5 | -------------------------------------------------------------------------------- /squasher/squash.go: -------------------------------------------------------------------------------- 1 | package squasher 2 | 3 | import ( 4 | "bufio" 5 | "bytes" 6 | "errors" 7 | "fmt" 8 | ) 9 | 10 | func Squash(files [][]byte) ([]byte, error) { 11 | result := []byte{} 12 | if len(files) <= 1 { 13 | return nil, errors.New("zero or one file provided to squash") 14 | } 15 | 16 | for _, file := range files { 17 | bytesReader := bytes.NewReader(file) 18 | bufReader := bufio.NewReader(bytesReader) 19 | firstLine, _, _ := bufReader.ReadLine() 20 | if string(firstLine) != "---" && string(firstLine) != "" { 21 | file = append([]byte(fmt.Sprintf("---\n")), file...) 22 | } 23 | 24 | file = append(file, []byte(fmt.Sprintf("\n"))...) 25 | result = append(result, file...) 26 | } 27 | return result, nil 28 | } 29 | -------------------------------------------------------------------------------- /squasher/squasher_suite_test.go: -------------------------------------------------------------------------------- 1 | package squasher_test 2 | 3 | import ( 4 | "testing" 5 | 6 | . "github.com/onsi/ginkgo" 7 | . "github.com/onsi/gomega" 8 | ) 9 | 10 | func TestSquasher(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Squasher Suite") 13 | } 14 | -------------------------------------------------------------------------------- /validator/validator_suite_test.go: -------------------------------------------------------------------------------- 1 | package validator_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestValidator(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Validator Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/JulzDiverse/mingoak/README.md: -------------------------------------------------------------------------------- 1 | # MinGOak 2 | 3 | A lightweight, easy-to-use, in-memory file tree. 4 | 5 | --> `mingoak` implements [os.FilePath](https://golang.org/pkg/os/#FileInfo) 6 | 7 | ``` 8 | $ go get github.com/JulzDiverse/mingoak 9 | ``` 10 | 11 | ``` 12 | import github.com/JulzDiverse/mingoak 13 | ``` 14 | 15 | ## Usage 16 | 17 | ```go 18 | 19 | root := mingoak.MkRoot() 20 | 21 | root.MkDirAll("path/to/dir/") 22 | root.WriteFile("path/to/dir/file", []byte("test")) 23 | 24 | fileInfo, _ := root.ReadDir("path/to/dir") 25 | for _, v := fileInfo { 26 | pintln(v.IsDir()) //true or false 27 | println(v.Name()) //name of file/dir 28 | println(v.ModTime()) //modification time 29 | println(v.Size()) //file size 30 | } 31 | 32 | file, _ = root.ReadFile("path/to/dir/file") 33 | 34 | //Walk also works: 35 | files, _ := root.Walk("path") 36 | for _, v := files { 37 | fmt.Prinln(v) //prints the file path 38 | } 39 | ``` 40 | 41 | 42 | -------------------------------------------------------------------------------- /vendor/github.com/JulzDiverse/mingoak/dir.go: -------------------------------------------------------------------------------- 1 | package mingoak 2 | 3 | import ( 4 | "os" 5 | "time" 6 | ) 7 | 8 | type Dir struct { 9 | components map[string]os.FileInfo 10 | componentsl []os.FileInfo 11 | name string 12 | time time.Time 13 | } 14 | 15 | func (d Dir) IsDir() bool { 16 | return true 17 | } 18 | 19 | func (d Dir) Name() string { 20 | return d.name 21 | } 22 | 23 | func (d Dir) Size() int64 { 24 | return 1 25 | } 26 | 27 | func (d Dir) Mode() os.FileMode { 28 | return 777 29 | } 30 | 31 | func (d Dir) ModTime() time.Time { 32 | return d.time 33 | } 34 | 35 | func (d Dir) Sys() interface{} { 36 | return nil 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/JulzDiverse/mingoak/file.go: -------------------------------------------------------------------------------- 1 | package mingoak 2 | 3 | import ( 4 | "os" 5 | "time" 6 | ) 7 | 8 | type File struct { 9 | content []byte 10 | name string 11 | time time.Time 12 | } 13 | 14 | func (f File) IsDir() bool { 15 | return false 16 | } 17 | 18 | func (d File) Name() string { 19 | return d.name 20 | } 21 | 22 | func (d File) Size() int64 { 23 | return int64(len(d.content)) 24 | } 25 | 26 | func (d File) Mode() os.FileMode { 27 | return 777 28 | } 29 | 30 | func (d File) ModTime() time.Time { 31 | return d.time 32 | } 33 | 34 | func (d File) Sys() interface{} { 35 | return nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/JulzDiverse/osenv/README.md: -------------------------------------------------------------------------------- 1 | # osenv 2 | 3 | A copy of the Golang [`os/env.go`](https://golang.org/src/os/env.go), with the enhancement of the `os.ExpandEnv` function to return additionally an error if an environment variable was not found. 4 | -------------------------------------------------------------------------------- /vendor/github.com/Knetic/govaluate/.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 | coverage.out 25 | 26 | manual_test.go 27 | *.out 28 | *.err 29 | -------------------------------------------------------------------------------- /vendor/github.com/Knetic/govaluate/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | script: ./test.sh 4 | 5 | go: 6 | - 1.2 7 | - 1.3 8 | - 1.4 9 | - 1.5 10 | - 1.6 11 | -------------------------------------------------------------------------------- /vendor/github.com/Knetic/govaluate/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | This library was authored by George Lester, and contains contributions from: 2 | 3 | vjeantet (regex support) 4 | iasci (ternary operator) 5 | oxtoacart (parameter structures, deferred parameter retrieval) 6 | wmiller848 (bitwise operators) 7 | prashantv (optimization of bools) 8 | dpaolella (exposure of variables used in an expression) 9 | benpaxton (fix for missing type checks during literal elide process) 10 | abrander (panic-finding testing tool) 11 | xfennec (fix for dates being parsed in the current Location) 12 | bgaifullin (lifting restriction on complex/struct types) 13 | gautambt (hexadecimal literals) -------------------------------------------------------------------------------- /vendor/github.com/Knetic/govaluate/ExpressionToken.go: -------------------------------------------------------------------------------- 1 | package govaluate 2 | 3 | /* 4 | Represents a single parsed token. 5 | */ 6 | type ExpressionToken struct { 7 | Kind TokenKind 8 | Value interface{} 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/Knetic/govaluate/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2016 George Lester 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/Knetic/govaluate/TokenKind.go: -------------------------------------------------------------------------------- 1 | package govaluate 2 | 3 | /* 4 | Represents all valid types of tokens that a token can be. 5 | */ 6 | type TokenKind int 7 | 8 | const ( 9 | UNKNOWN TokenKind = iota 10 | 11 | PREFIX 12 | NUMERIC 13 | BOOLEAN 14 | STRING 15 | PATTERN 16 | TIME 17 | VARIABLE 18 | FUNCTION 19 | SEPARATOR 20 | ACCESSOR 21 | 22 | COMPARATOR 23 | LOGICALOP 24 | MODIFIER 25 | 26 | CLAUSE 27 | CLAUSE_CLOSE 28 | 29 | TERNARY 30 | ) 31 | 32 | /* 33 | GetTokenKindString returns a string that describes the given TokenKind. 34 | e.g., when passed the NUMERIC TokenKind, this returns the string "NUMERIC". 35 | */ 36 | func (kind TokenKind) String() string { 37 | 38 | switch kind { 39 | 40 | case PREFIX: 41 | return "PREFIX" 42 | case NUMERIC: 43 | return "NUMERIC" 44 | case BOOLEAN: 45 | return "BOOLEAN" 46 | case STRING: 47 | return "STRING" 48 | case PATTERN: 49 | return "PATTERN" 50 | case TIME: 51 | return "TIME" 52 | case VARIABLE: 53 | return "VARIABLE" 54 | case FUNCTION: 55 | return "FUNCTION" 56 | case SEPARATOR: 57 | return "SEPARATOR" 58 | case COMPARATOR: 59 | return "COMPARATOR" 60 | case LOGICALOP: 61 | return "LOGICALOP" 62 | case MODIFIER: 63 | return "MODIFIER" 64 | case CLAUSE: 65 | return "CLAUSE" 66 | case CLAUSE_CLOSE: 67 | return "CLAUSE_CLOSE" 68 | case TERNARY: 69 | return "TERNARY" 70 | case ACCESSOR: 71 | return "ACCESSOR" 72 | } 73 | 74 | return "UNKNOWN" 75 | } 76 | -------------------------------------------------------------------------------- /vendor/github.com/Knetic/govaluate/expressionFunctions.go: -------------------------------------------------------------------------------- 1 | package govaluate 2 | 3 | /* 4 | Represents a function that can be called from within an expression. 5 | This method must return an error if, for any reason, it is unable to produce exactly one unambiguous result. 6 | An error returned will halt execution of the expression. 7 | */ 8 | type ExpressionFunction func(arguments ...interface{}) (interface{}, error) 9 | -------------------------------------------------------------------------------- /vendor/github.com/Knetic/govaluate/expressionOutputStream.go: -------------------------------------------------------------------------------- 1 | package govaluate 2 | 3 | import ( 4 | "bytes" 5 | ) 6 | 7 | /* 8 | Holds a series of "transactions" which represent each token as it is output by an outputter (such as ToSQLQuery()). 9 | Some outputs (such as SQL) require a function call or non-c-like syntax to represent an expression. 10 | To accomplish this, this struct keeps track of each translated token as it is output, and can return and rollback those transactions. 11 | */ 12 | type expressionOutputStream struct { 13 | transactions []string 14 | } 15 | 16 | func (this *expressionOutputStream) add(transaction string) { 17 | this.transactions = append(this.transactions, transaction) 18 | } 19 | 20 | func (this *expressionOutputStream) rollback() string { 21 | 22 | index := len(this.transactions) - 1 23 | ret := this.transactions[index] 24 | 25 | this.transactions = this.transactions[:index] 26 | return ret 27 | } 28 | 29 | func (this *expressionOutputStream) createString(delimiter string) string { 30 | 31 | var retBuffer bytes.Buffer 32 | var transaction string 33 | 34 | penultimate := len(this.transactions) - 1 35 | 36 | for i := 0; i < penultimate; i++ { 37 | 38 | transaction = this.transactions[i] 39 | 40 | retBuffer.WriteString(transaction) 41 | retBuffer.WriteString(delimiter) 42 | } 43 | retBuffer.WriteString(this.transactions[penultimate]) 44 | 45 | return retBuffer.String() 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/Knetic/govaluate/lexerStream.go: -------------------------------------------------------------------------------- 1 | package govaluate 2 | 3 | type lexerStream struct { 4 | source []rune 5 | position int 6 | length int 7 | } 8 | 9 | func newLexerStream(source string) *lexerStream { 10 | 11 | var ret *lexerStream 12 | var runes []rune 13 | 14 | for _, character := range source { 15 | runes = append(runes, character) 16 | } 17 | 18 | ret = new(lexerStream) 19 | ret.source = runes 20 | ret.length = len(runes) 21 | return ret 22 | } 23 | 24 | func (this *lexerStream) readCharacter() rune { 25 | 26 | var character rune 27 | 28 | character = this.source[this.position] 29 | this.position += 1 30 | return character 31 | } 32 | 33 | func (this *lexerStream) rewind(amount int) { 34 | this.position -= amount 35 | } 36 | 37 | func (this lexerStream) canRead() bool { 38 | return this.position < this.length 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/Knetic/govaluate/parameters.go: -------------------------------------------------------------------------------- 1 | package govaluate 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | /* 8 | Parameters is a collection of named parameters that can be used by an EvaluableExpression to retrieve parameters 9 | when an expression tries to use them. 10 | */ 11 | type Parameters interface { 12 | 13 | /* 14 | Get gets the parameter of the given name, or an error if the parameter is unavailable. 15 | Failure to find the given parameter should be indicated by returning an error. 16 | */ 17 | Get(name string) (interface{}, error) 18 | } 19 | 20 | type MapParameters map[string]interface{} 21 | 22 | func (p MapParameters) Get(name string) (interface{}, error) { 23 | 24 | value, found := p[name] 25 | 26 | if !found { 27 | errorMessage := "No parameter '" + name + "' found." 28 | return nil, errors.New(errorMessage) 29 | } 30 | 31 | return value, nil 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/Knetic/govaluate/sanitizedParameters.go: -------------------------------------------------------------------------------- 1 | package govaluate 2 | 3 | // sanitizedParameters is a wrapper for Parameters that does sanitization as 4 | // parameters are accessed. 5 | type sanitizedParameters struct { 6 | orig Parameters 7 | } 8 | 9 | func (p sanitizedParameters) Get(key string) (interface{}, error) { 10 | value, err := p.orig.Get(key) 11 | if err != nil { 12 | return nil, err 13 | } 14 | 15 | // should be converted to fixed point? 16 | return castFixedPoint(value), nil 17 | } 18 | 19 | func isFixedPoint(value interface{}) bool { 20 | 21 | switch value.(type) { 22 | case uint8: 23 | return true 24 | case uint16: 25 | return true 26 | case uint32: 27 | return true 28 | case uint64: 29 | return true 30 | case int8: 31 | return true 32 | case int16: 33 | return true 34 | case int32: 35 | return true 36 | case int64: 37 | return true 38 | case int: 39 | return true 40 | } 41 | return false 42 | } 43 | 44 | func castFixedPoint(value interface{}) interface{} { 45 | switch value.(type) { 46 | case uint8: 47 | return float64(value.(uint8)) 48 | case uint16: 49 | return float64(value.(uint16)) 50 | case uint32: 51 | return float64(value.(uint32)) 52 | case uint64: 53 | return float64(value.(uint64)) 54 | case int8: 55 | return float64(value.(int8)) 56 | case int16: 57 | return float64(value.(int16)) 58 | case int32: 59 | return float64(value.(int32)) 60 | case int64: 61 | return float64(value.(int64)) 62 | case int: 63 | return float64(value.(int)) 64 | } 65 | 66 | return value 67 | } 68 | -------------------------------------------------------------------------------- /vendor/github.com/Knetic/govaluate/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script that runs tests, code coverage, and benchmarks all at once. 4 | # Builds a symlink in /tmp, mostly to avoid messing with GOPATH at the user's shell level. 5 | 6 | TEMPORARY_PATH="/tmp/govaluate_test" 7 | SRC_PATH="${TEMPORARY_PATH}/src" 8 | FULL_PATH="${TEMPORARY_PATH}/src/govaluate" 9 | 10 | # set up temporary directory 11 | rm -rf "${FULL_PATH}" 12 | mkdir -p "${SRC_PATH}" 13 | 14 | ln -s $(pwd) "${FULL_PATH}" 15 | export GOPATH="${TEMPORARY_PATH}" 16 | 17 | pushd "${TEMPORARY_PATH}/src/govaluate" 18 | 19 | # run the actual tests. 20 | export GOVALUATE_TORTURE_TEST="true" 21 | go test -bench=. -benchmem #-coverprofile coverage.out 22 | status=$? 23 | 24 | if [ "${status}" != 0 ]; 25 | then 26 | exit $status 27 | fi 28 | 29 | # coverage 30 | # disabled because travis go1.4 seems not to support it suddenly? 31 | #go tool cover -func=coverage.out 32 | 33 | popd 34 | -------------------------------------------------------------------------------- /vendor/github.com/Knetic/govaluate/tokenStream.go: -------------------------------------------------------------------------------- 1 | package govaluate 2 | 3 | type tokenStream struct { 4 | tokens []ExpressionToken 5 | index int 6 | tokenLength int 7 | } 8 | 9 | func newTokenStream(tokens []ExpressionToken) *tokenStream { 10 | 11 | var ret *tokenStream 12 | 13 | ret = new(tokenStream) 14 | ret.tokens = tokens 15 | ret.tokenLength = len(tokens) 16 | return ret 17 | } 18 | 19 | func (this *tokenStream) rewind() { 20 | this.index -= 1 21 | } 22 | 23 | func (this *tokenStream) next() ExpressionToken { 24 | 25 | var token ExpressionToken 26 | 27 | token = this.tokens[this.index] 28 | 29 | this.index += 1 30 | return token 31 | } 32 | 33 | func (this tokenStream) hasNext() bool { 34 | 35 | return this.index < this.tokenLength 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/geofffranks/simpleyaml/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, 陈小玉 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 | * Neither the name of simpleyaml nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (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/geofffranks/simpleyaml/README.md: -------------------------------------------------------------------------------- 1 | ## simpleyaml 2 | 3 | a Go package to interact with arbitrary YAML, similar as [go-simplejson](https://github.com/bitly/go-simplejson). 4 | 5 | [![GoDoc](https://godoc.org/github.com/smallfish/simpleyaml?status.svg)](http://godoc.org/github.com/smallfish/simpleyaml) 6 | 7 | #### INSTALL 8 | 9 | ```bash 10 | go get -u gopkg.in/yaml.v2 # required 11 | go get -u github.com/smallfish/simpleyaml 12 | ``` 13 | 14 | #### EXAMPLE 15 | 16 | ```go 17 | var data = []byte(` 18 | name: smallfish 19 | age: 99 20 | bool: true 21 | emails: 22 | - xxx@xx.com 23 | - yyy@yy.com 24 | bb: 25 | cc: 26 | dd: 27 | - 111 28 | - 222 29 | - 333 30 | ee: aaa 31 | `) 32 | 33 | y, err := NewYaml(data) 34 | if err != nil { 35 | // ERROR 36 | } 37 | 38 | name, err := y.Get("name").String() 39 | if err != nil { 40 | // ERROR 41 | } 42 | fmt.Println("name:", name) 43 | 44 | // y.Get("age").Int() 45 | // y.Get("bool").Bool() 46 | // y.Get("bb").Get("cc").Get("ee").String() 47 | // y.Get("bb").Get("cc").Get("ee").GetIndex(1).Int() 48 | // y.GetPath("bb", "cc", "ee").String() 49 | ``` 50 | 51 | __END__ 52 | -------------------------------------------------------------------------------- /vendor/github.com/geofffranks/spruce/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /spruce 3 | /spruce-* 4 | credentials.yml 5 | releases 6 | artifacts 7 | .svtoken 8 | *.swp 9 | .vscode -------------------------------------------------------------------------------- /vendor/github.com/geofffranks/spruce/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.13 5 | 6 | sudo: false 7 | 8 | script: 9 | - make 10 | -------------------------------------------------------------------------------- /vendor/github.com/geofffranks/spruce/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Geoff Franks 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/geofffranks/spruce/Makefile: -------------------------------------------------------------------------------- 1 | all: vet test build clitests 2 | 3 | vet: 4 | go list ./... | grep -v vendor | xargs go vet 5 | 6 | test: 7 | go list ./... | grep -v vendor | xargs go test 8 | 9 | colortest: build 10 | ./assets/color_tester 11 | 12 | clitests: build 13 | ./assets/cli_tests 14 | 15 | build: 16 | go build ./cmd/spruce 17 | -------------------------------------------------------------------------------- /vendor/github.com/geofffranks/spruce/log/log.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "strings" 7 | ) 8 | 9 | var DebugOn bool = false 10 | var TraceOn bool = false 11 | 12 | //PrintfStdErr is a configurable hook to print to error output 13 | var PrintfStdErr func(string, ...interface{}) 14 | 15 | func init() { 16 | PrintfStdErr = func(format string, args ...interface{}) { 17 | fmt.Fprintf(os.Stderr, format, args...) 18 | } 19 | } 20 | 21 | // DEBUG - Prints out a debug message 22 | func DEBUG(format string, args ...interface{}) { 23 | if DebugOn { 24 | content := fmt.Sprintf(format, args...) 25 | lines := strings.Split(content, "\n") 26 | for i, line := range lines { 27 | lines[i] = "DEBUG> " + line 28 | } 29 | content = strings.Join(lines, "\n") 30 | PrintfStdErr("%s\n", content) 31 | } 32 | } 33 | 34 | // TRACE - Prints out a trace message 35 | func TRACE(format string, args ...interface{}) { 36 | if TraceOn { 37 | content := fmt.Sprintf(format, args...) 38 | lines := strings.Split(content, "\n") 39 | for i, line := range lines { 40 | lines[i] = "-----> " + line 41 | } 42 | content = strings.Join(lines, "\n") 43 | PrintfStdErr("%s\n", content) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/geofffranks/spruce/op_defer.go: -------------------------------------------------------------------------------- 1 | package spruce 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | 7 | "github.com/starkandwayne/goutils/tree" 8 | 9 | . "github.com/geofffranks/spruce/log" 10 | ) 11 | 12 | // DeferOperator sheds the "defer" command off of (( defer args args args )) and 13 | // leaves (( args args args )) 14 | type DeferOperator struct{} 15 | 16 | // Setup doesn't do anything for Defer. We're a pretty lightweight operator. 17 | func (DeferOperator) Setup() error { 18 | return nil 19 | } 20 | 21 | // Phase gives back Param phase in this case, because we don't want any 22 | // following phases to pick up the operator post-deference 23 | func (DeferOperator) Phase() OperatorPhase { 24 | return EvalPhase 25 | } 26 | 27 | // Dependencies returns an empty slice - defer produces no deps at all. 28 | func (DeferOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, _ []*tree.Cursor) []*tree.Cursor { 29 | return nil 30 | } 31 | 32 | // Run chops off "defer" and leaves the args in double parens. Need to 33 | // reconstruct the operator string 34 | func (DeferOperator) Run(_ *Evaluator, args []*Expr) (*Response, error) { 35 | DEBUG("Running defer operator...") 36 | if len(args) == 0 { 37 | return nil, fmt.Errorf("Defer has no arguments - what are you deferring?") 38 | } 39 | 40 | components := []string{"(("} //Join these with spaces at the end 41 | 42 | for _, arg := range args { 43 | components = append(components, arg.String()) 44 | } 45 | components = append(components, "))") 46 | 47 | DEBUG("Returning from defer operator") 48 | 49 | return &Response{ 50 | Type: Replace, 51 | Value: strings.Join(components, " "), 52 | }, nil 53 | } 54 | 55 | func init() { 56 | RegisterOp("defer", DeferOperator{}) 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/geofffranks/spruce/op_empty.go: -------------------------------------------------------------------------------- 1 | package spruce 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | 7 | "github.com/starkandwayne/goutils/tree" 8 | ) 9 | 10 | // EmptyOperator allows the user to emplace an empty array, hash, or string into 11 | // the YAML datastructure. 12 | type EmptyOperator struct{} 13 | 14 | // Setup ... 15 | func (EmptyOperator) Setup() error { 16 | return nil 17 | } 18 | 19 | // Phase ... 20 | func (EmptyOperator) Phase() OperatorPhase { 21 | return EvalPhase 22 | } 23 | 24 | // Dependencies ... 25 | func (EmptyOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, _ []*tree.Cursor) []*tree.Cursor { 26 | return nil 27 | } 28 | 29 | // Run ... 30 | func (EmptyOperator) Run(ev *Evaluator, args []*Expr) (*Response, error) { 31 | if len(args) != 1 { 32 | return nil, fmt.Errorf("empty operator expects 1 argument, received %d", len(args)) 33 | } 34 | 35 | var emptyType string 36 | 37 | switch args[0].Type { 38 | case Literal: 39 | var isString bool 40 | emptyType, isString = args[0].Literal.(string) 41 | if !isString { 42 | return nil, fmt.Errorf("cannot interpret argument for empty operator") 43 | } 44 | case Reference: 45 | emptyType = strings.TrimPrefix(args[0].Reference.String(), ".") 46 | default: 47 | return nil, fmt.Errorf("cannot interpret argument for empty operator") 48 | } 49 | 50 | var value interface{} 51 | switch emptyType { 52 | case "hash", "map": 53 | value = map[string]interface{}{} 54 | case "array", "list": 55 | value = []interface{}{} 56 | case "string": 57 | value = "" 58 | default: 59 | return nil, fmt.Errorf("unknown type for empty operator: %s", emptyType) 60 | } 61 | return &Response{ 62 | Type: Replace, 63 | Value: value, 64 | }, nil 65 | } 66 | 67 | func init() { 68 | RegisterOp("empty", EmptyOperator{}) 69 | } 70 | -------------------------------------------------------------------------------- /vendor/github.com/geofffranks/spruce/op_null.go: -------------------------------------------------------------------------------- 1 | package spruce 2 | 3 | import ( 4 | "github.com/starkandwayne/goutils/ansi" 5 | "github.com/starkandwayne/goutils/tree" 6 | ) 7 | 8 | // NullOperator ... 9 | type NullOperator struct { 10 | Missing string 11 | } 12 | 13 | // Setup ... 14 | func (NullOperator) Setup() error { 15 | return nil 16 | } 17 | 18 | // Phase ... 19 | func (NullOperator) Phase() OperatorPhase { 20 | return EvalPhase 21 | } 22 | 23 | // Dependencies ... 24 | func (NullOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, _ []*tree.Cursor) []*tree.Cursor { 25 | return nil 26 | } 27 | 28 | // Run ... 29 | func (n NullOperator) Run(ev *Evaluator, _ []*Expr) (*Response, error) { 30 | return nil, ansi.Errorf("@c{(( %s ))} @R{operator not defined}", n.Missing) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/geofffranks/spruce/op_param.go: -------------------------------------------------------------------------------- 1 | package spruce 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/starkandwayne/goutils/tree" 7 | ) 8 | 9 | // ParamOperator ... 10 | type ParamOperator struct{} 11 | 12 | // Setup ... 13 | func (ParamOperator) Setup() error { 14 | return nil 15 | } 16 | 17 | // Phase ... 18 | func (ParamOperator) Phase() OperatorPhase { 19 | return ParamPhase 20 | } 21 | 22 | // Dependencies ... 23 | func (ParamOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, _ []*tree.Cursor) []*tree.Cursor { 24 | return nil 25 | } 26 | 27 | // Run ... 28 | func (ParamOperator) Run(ev *Evaluator, args []*Expr) (*Response, error) { 29 | v, _ := args[0].Evaluate(ev.Tree) // FIXME: there are lots of assumptions here... 30 | return nil, fmt.Errorf("%s", v) 31 | } 32 | 33 | func init() { 34 | RegisterOp("param", ParamOperator{}) 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/geofffranks/spruce/op_prune.go: -------------------------------------------------------------------------------- 1 | package spruce 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/starkandwayne/goutils/tree" 7 | 8 | . "github.com/geofffranks/spruce/log" 9 | ) 10 | 11 | var keysToPrune []string 12 | 13 | func addToPruneListIfNecessary(paths ...string) { 14 | for _, path := range paths { 15 | if !isIncluded(keysToPrune, path) { 16 | DEBUG("adding '%s' to the list of paths to prune", path) 17 | keysToPrune = append(keysToPrune, path) 18 | } 19 | } 20 | } 21 | 22 | func isIncluded(list []string, name string) bool { 23 | for _, entry := range list { 24 | if entry == name { 25 | return true 26 | } 27 | } 28 | 29 | return false 30 | } 31 | 32 | // PruneOperator ... 33 | type PruneOperator struct{} 34 | 35 | // Setup ... 36 | func (PruneOperator) Setup() error { 37 | return nil 38 | } 39 | 40 | // Phase ... 41 | func (PruneOperator) Phase() OperatorPhase { 42 | return EvalPhase 43 | } 44 | 45 | // Dependencies ... 46 | func (PruneOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor { 47 | return auto 48 | } 49 | 50 | // Run ... 51 | func (PruneOperator) Run(ev *Evaluator, args []*Expr) (*Response, error) { 52 | DEBUG("running (( prune ... )) operation at $.%s", ev.Here) 53 | defer DEBUG("done with (( prune ... )) operation at $.%s\n", ev.Here) 54 | 55 | addToPruneListIfNecessary(fmt.Sprintf("%s", ev.Here)) 56 | 57 | // simply replace it with nil (will be pruned at the end anyway) 58 | return &Response{ 59 | Type: Replace, 60 | Value: nil, 61 | }, nil 62 | } 63 | 64 | func init() { 65 | RegisterOp("prune", PruneOperator{}) 66 | } 67 | -------------------------------------------------------------------------------- /vendor/github.com/geofffranks/yaml/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4 5 | - 1.5 6 | - 1.6 7 | - tip 8 | 9 | go_import_path: gopkg.in/yaml.v2 10 | -------------------------------------------------------------------------------- /vendor/github.com/geofffranks/yaml/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2011-2016 Canonical Ltd. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/github.com/geofffranks/yaml/LICENSE.libyaml: -------------------------------------------------------------------------------- 1 | The following files were ported to Go from C files of libyaml, and thus 2 | are still covered by their original copyright and license: 3 | 4 | apic.go 5 | emitterc.go 6 | parserc.go 7 | readerc.go 8 | scannerc.go 9 | writerc.go 10 | yamlh.go 11 | yamlprivateh.go 12 | 13 | Copyright (c) 2006 Kirill Simonov 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | go: 4 | - 1.13.x 5 | - tip 6 | 7 | before_install: 8 | - go get -t -v ./... 9 | 10 | script: 11 | - ./go.test.sh 12 | 13 | after_success: 14 | - bash <(curl -s https://codecov.io/bash) 15 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Yasuhiro MATSUMOTO 2 | 3 | MIT License (Expat) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/README.md: -------------------------------------------------------------------------------- 1 | # go-isatty 2 | 3 | [![Godoc Reference](https://godoc.org/github.com/mattn/go-isatty?status.svg)](http://godoc.org/github.com/mattn/go-isatty) 4 | [![Codecov](https://codecov.io/gh/mattn/go-isatty/branch/master/graph/badge.svg)](https://codecov.io/gh/mattn/go-isatty) 5 | [![Coverage Status](https://coveralls.io/repos/github/mattn/go-isatty/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-isatty?branch=master) 6 | [![Go Report Card](https://goreportcard.com/badge/mattn/go-isatty)](https://goreportcard.com/report/mattn/go-isatty) 7 | 8 | isatty for golang 9 | 10 | ## Usage 11 | 12 | ```go 13 | package main 14 | 15 | import ( 16 | "fmt" 17 | "github.com/mattn/go-isatty" 18 | "os" 19 | ) 20 | 21 | func main() { 22 | if isatty.IsTerminal(os.Stdout.Fd()) { 23 | fmt.Println("Is Terminal") 24 | } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) { 25 | fmt.Println("Is Cygwin/MSYS2 Terminal") 26 | } else { 27 | fmt.Println("Is Not Terminal") 28 | } 29 | } 30 | ``` 31 | 32 | ## Installation 33 | 34 | ``` 35 | $ go get github.com/mattn/go-isatty 36 | ``` 37 | 38 | ## License 39 | 40 | MIT 41 | 42 | ## Author 43 | 44 | Yasuhiro Matsumoto (a.k.a mattn) 45 | 46 | ## Thanks 47 | 48 | * k-takata: base idea for IsCygwinTerminal 49 | 50 | https://github.com/k-takata/go-iscygpty 51 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/doc.go: -------------------------------------------------------------------------------- 1 | // Package isatty implements interface to isatty 2 | package isatty 3 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import "golang.org/x/sys/unix" 7 | 8 | // IsTerminal return true if the file descriptor is terminal. 9 | func IsTerminal(fd uintptr) bool { 10 | _, err := unix.IoctlGetTermios(int(fd), unix.TIOCGETA) 11 | return err == nil 12 | } 13 | 14 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 15 | // terminal. This is also always false on this environment. 16 | func IsCygwinTerminal(fd uintptr) bool { 17 | return false 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_others.go: -------------------------------------------------------------------------------- 1 | // +build appengine js nacl 2 | 3 | package isatty 4 | 5 | // IsTerminal returns true if the file descriptor is terminal which 6 | // is always false on js and appengine classic which is a sandboxed PaaS. 7 | func IsTerminal(fd uintptr) bool { 8 | return false 9 | } 10 | 11 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 12 | // terminal. This is also always false on this environment. 13 | func IsCygwinTerminal(fd uintptr) bool { 14 | return false 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "golang.org/x/sys/unix" 8 | ) 9 | 10 | // IsTerminal returns true if the given file descriptor is a terminal. 11 | // see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c 12 | func IsTerminal(fd uintptr) bool { 13 | var termio unix.Termio 14 | err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio) 15 | return err == nil 16 | } 17 | 18 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 19 | // terminal. This is also always false on this environment. 20 | func IsCygwinTerminal(fd uintptr) bool { 21 | return false 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | TODO 3 | tmp/**/* 4 | *.coverprofile 5 | .vscode 6 | .idea/ 7 | *.log 8 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.12.x 4 | - 1.13.x 5 | - tip 6 | 7 | cache: 8 | directories: 9 | - $GOPATH/pkg/mod 10 | 11 | # allow internal package imports, necessary for forked repositories 12 | go_import_path: github.com/onsi/ginkgo 13 | 14 | install: 15 | - GO111MODULE="off" go get -v -t ./... 16 | - GO111MODULE="off" go get golang.org/x/tools/cmd/cover 17 | - GO111MODULE="off" go get github.com/onsi/gomega 18 | - GO111MODULE="off" go install github.com/onsi/ginkgo/ginkgo 19 | - export PATH=$PATH:$HOME/gopath/bin 20 | 21 | script: 22 | - GO111MODULE="on" go mod tidy 23 | - diff -u <(echo -n) <(git diff go.mod) 24 | - diff -u <(echo -n) <(git diff go.sum) 25 | - $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --randomizeSuites --race --trace && go vet 26 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Ginkgo 2 | 3 | Your contributions to Ginkgo are essential for its long-term maintenance and improvement. 4 | 5 | - Please **open an issue first** - describe what problem you are trying to solve and give the community a forum for input and feedback ahead of investing time in writing code! 6 | - Ensure adequate test coverage: 7 | - When adding to the Ginkgo library, add unit and/or integration tests (under the `integration` folder). 8 | - When adding to the Ginkgo CLI, note that there are very few unit tests. Please add an integration test. 9 | - Update the documentation. Ginko uses `godoc` comments and documentation on the `gh-pages` branch. 10 | If relevant, please submit a docs PR to that branch alongside your code PR. 11 | 12 | Thanks for supporting Ginkgo! 13 | 14 | ## Setup 15 | 16 | Fork the repo, then: 17 | 18 | ``` 19 | go get github.com/onsi/ginkgo 20 | go get github.com/onsi/gomega/... 21 | cd $GOPATH/src/github.com/onsi/ginkgo 22 | git remote add fork git@github.com:/ginkgo.git 23 | 24 | ginkgo -r -p # ensure tests are green 25 | go vet ./... # ensure linter is happy 26 | ``` 27 | 28 | ## Making the PR 29 | - go to a new branch `git checkout -b my-feature` 30 | - make your changes 31 | - run tests and linter again (see above) 32 | - `git push fork` 33 | - open PR 🎉 34 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014 Onsi Fakhouri 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/onsi/ginkgo/internal/leafnodes/interfaces.go: -------------------------------------------------------------------------------- 1 | package leafnodes 2 | 3 | import ( 4 | "github.com/onsi/ginkgo/types" 5 | ) 6 | 7 | type BasicNode interface { 8 | Type() types.SpecComponentType 9 | Run() (types.SpecState, types.SpecFailure) 10 | CodeLocation() types.CodeLocation 11 | } 12 | 13 | type SubjectNode interface { 14 | BasicNode 15 | 16 | Text() string 17 | Flag() types.FlagType 18 | Samples() int 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/leafnodes/it_node.go: -------------------------------------------------------------------------------- 1 | package leafnodes 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/onsi/ginkgo/internal/failer" 7 | "github.com/onsi/ginkgo/types" 8 | ) 9 | 10 | type ItNode struct { 11 | runner *runner 12 | 13 | flag types.FlagType 14 | text string 15 | } 16 | 17 | func NewItNode(text string, body interface{}, flag types.FlagType, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *ItNode { 18 | return &ItNode{ 19 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeIt, componentIndex), 20 | flag: flag, 21 | text: text, 22 | } 23 | } 24 | 25 | func (node *ItNode) Run() (outcome types.SpecState, failure types.SpecFailure) { 26 | return node.runner.run() 27 | } 28 | 29 | func (node *ItNode) Type() types.SpecComponentType { 30 | return types.SpecComponentTypeIt 31 | } 32 | 33 | func (node *ItNode) Text() string { 34 | return node.text 35 | } 36 | 37 | func (node *ItNode) Flag() types.FlagType { 38 | return node.flag 39 | } 40 | 41 | func (node *ItNode) CodeLocation() types.CodeLocation { 42 | return node.runner.codeLocation 43 | } 44 | 45 | func (node *ItNode) Samples() int { 46 | return 1 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/leafnodes/measure_node.go: -------------------------------------------------------------------------------- 1 | package leafnodes 2 | 3 | import ( 4 | "reflect" 5 | 6 | "github.com/onsi/ginkgo/internal/failer" 7 | "github.com/onsi/ginkgo/types" 8 | ) 9 | 10 | type MeasureNode struct { 11 | runner *runner 12 | 13 | text string 14 | flag types.FlagType 15 | samples int 16 | benchmarker *benchmarker 17 | } 18 | 19 | func NewMeasureNode(text string, body interface{}, flag types.FlagType, codeLocation types.CodeLocation, samples int, failer *failer.Failer, componentIndex int) *MeasureNode { 20 | benchmarker := newBenchmarker() 21 | 22 | wrappedBody := func() { 23 | reflect.ValueOf(body).Call([]reflect.Value{reflect.ValueOf(benchmarker)}) 24 | } 25 | 26 | return &MeasureNode{ 27 | runner: newRunner(wrappedBody, codeLocation, 0, failer, types.SpecComponentTypeMeasure, componentIndex), 28 | 29 | text: text, 30 | flag: flag, 31 | samples: samples, 32 | benchmarker: benchmarker, 33 | } 34 | } 35 | 36 | func (node *MeasureNode) Run() (outcome types.SpecState, failure types.SpecFailure) { 37 | return node.runner.run() 38 | } 39 | 40 | func (node *MeasureNode) MeasurementsReport() map[string]*types.SpecMeasurement { 41 | return node.benchmarker.measurementsReport() 42 | } 43 | 44 | func (node *MeasureNode) Type() types.SpecComponentType { 45 | return types.SpecComponentTypeMeasure 46 | } 47 | 48 | func (node *MeasureNode) Text() string { 49 | return node.text 50 | } 51 | 52 | func (node *MeasureNode) Flag() types.FlagType { 53 | return node.flag 54 | } 55 | 56 | func (node *MeasureNode) CodeLocation() types.CodeLocation { 57 | return node.runner.codeLocation 58 | } 59 | 60 | func (node *MeasureNode) Samples() int { 61 | return node.samples 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/leafnodes/setup_nodes.go: -------------------------------------------------------------------------------- 1 | package leafnodes 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/onsi/ginkgo/internal/failer" 7 | "github.com/onsi/ginkgo/types" 8 | ) 9 | 10 | type SetupNode struct { 11 | runner *runner 12 | } 13 | 14 | func (node *SetupNode) Run() (outcome types.SpecState, failure types.SpecFailure) { 15 | return node.runner.run() 16 | } 17 | 18 | func (node *SetupNode) Type() types.SpecComponentType { 19 | return node.runner.nodeType 20 | } 21 | 22 | func (node *SetupNode) CodeLocation() types.CodeLocation { 23 | return node.runner.codeLocation 24 | } 25 | 26 | func NewBeforeEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode { 27 | return &SetupNode{ 28 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeBeforeEach, componentIndex), 29 | } 30 | } 31 | 32 | func NewAfterEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode { 33 | return &SetupNode{ 34 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeAfterEach, componentIndex), 35 | } 36 | } 37 | 38 | func NewJustBeforeEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode { 39 | return &SetupNode{ 40 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeJustBeforeEach, componentIndex), 41 | } 42 | } 43 | 44 | func NewJustAfterEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode { 45 | return &SetupNode{ 46 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeJustAfterEach, componentIndex), 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/leafnodes/suite_nodes.go: -------------------------------------------------------------------------------- 1 | package leafnodes 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/onsi/ginkgo/internal/failer" 7 | "github.com/onsi/ginkgo/types" 8 | ) 9 | 10 | type SuiteNode interface { 11 | Run(parallelNode int, parallelTotal int, syncHost string) bool 12 | Passed() bool 13 | Summary() *types.SetupSummary 14 | } 15 | 16 | type simpleSuiteNode struct { 17 | runner *runner 18 | outcome types.SpecState 19 | failure types.SpecFailure 20 | runTime time.Duration 21 | } 22 | 23 | func (node *simpleSuiteNode) Run(parallelNode int, parallelTotal int, syncHost string) bool { 24 | t := time.Now() 25 | node.outcome, node.failure = node.runner.run() 26 | node.runTime = time.Since(t) 27 | 28 | return node.outcome == types.SpecStatePassed 29 | } 30 | 31 | func (node *simpleSuiteNode) Passed() bool { 32 | return node.outcome == types.SpecStatePassed 33 | } 34 | 35 | func (node *simpleSuiteNode) Summary() *types.SetupSummary { 36 | return &types.SetupSummary{ 37 | ComponentType: node.runner.nodeType, 38 | CodeLocation: node.runner.codeLocation, 39 | State: node.outcome, 40 | RunTime: node.runTime, 41 | Failure: node.failure, 42 | } 43 | } 44 | 45 | func NewBeforeSuiteNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer) SuiteNode { 46 | return &simpleSuiteNode{ 47 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeBeforeSuite, 0), 48 | } 49 | } 50 | 51 | func NewAfterSuiteNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer) SuiteNode { 52 | return &simpleSuiteNode{ 53 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeAfterSuite, 0), 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor.go: -------------------------------------------------------------------------------- 1 | package remote 2 | 3 | import "os" 4 | 5 | /* 6 | The OutputInterceptor is used by the ForwardingReporter to 7 | intercept and capture all stdin and stderr output during a test run. 8 | */ 9 | type OutputInterceptor interface { 10 | StartInterceptingOutput() error 11 | StopInterceptingAndReturnOutput() (string, error) 12 | StreamTo(*os.File) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_win.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package remote 4 | 5 | import ( 6 | "errors" 7 | "os" 8 | ) 9 | 10 | func NewOutputInterceptor() OutputInterceptor { 11 | return &outputInterceptor{} 12 | } 13 | 14 | type outputInterceptor struct { 15 | intercepting bool 16 | } 17 | 18 | func (interceptor *outputInterceptor) StartInterceptingOutput() error { 19 | if interceptor.intercepting { 20 | return errors.New("Already intercepting output!") 21 | } 22 | interceptor.intercepting = true 23 | 24 | // not working on windows... 25 | 26 | return nil 27 | } 28 | 29 | func (interceptor *outputInterceptor) StopInterceptingAndReturnOutput() (string, error) { 30 | // not working on windows... 31 | interceptor.intercepting = false 32 | 33 | return "", nil 34 | } 35 | 36 | func (interceptor *outputInterceptor) StreamTo(*os.File) {} 37 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_linux_arm64.go: -------------------------------------------------------------------------------- 1 | // +build linux,arm64 2 | 3 | package remote 4 | 5 | import "syscall" 6 | 7 | // linux_arm64 doesn't have syscall.Dup2 which ginkgo uses, so 8 | // use the nearly identical syscall.Dup3 instead 9 | func syscallDup(oldfd int, newfd int) (err error) { 10 | return syscall.Dup3(oldfd, newfd, 0) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | 3 | package remote 4 | 5 | import "golang.org/x/sys/unix" 6 | 7 | func syscallDup(oldfd int, newfd int) (err error) { 8 | return unix.Dup2(oldfd, newfd) 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_unix.go: -------------------------------------------------------------------------------- 1 | // +build !linux !arm64 2 | // +build !linux !riscv64 3 | // +build !windows 4 | // +build !solaris 5 | 6 | package remote 7 | 8 | import "syscall" 9 | 10 | func syscallDup(oldfd int, newfd int) (err error) { 11 | return syscall.Dup2(oldfd, newfd) 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/spec_iterator/parallel_spec_iterator.go: -------------------------------------------------------------------------------- 1 | package spec_iterator 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "net/http" 7 | 8 | "github.com/onsi/ginkgo/internal/spec" 9 | ) 10 | 11 | type ParallelIterator struct { 12 | specs []*spec.Spec 13 | host string 14 | client *http.Client 15 | } 16 | 17 | func NewParallelIterator(specs []*spec.Spec, host string) *ParallelIterator { 18 | return &ParallelIterator{ 19 | specs: specs, 20 | host: host, 21 | client: &http.Client{}, 22 | } 23 | } 24 | 25 | func (s *ParallelIterator) Next() (*spec.Spec, error) { 26 | resp, err := s.client.Get(s.host + "/counter") 27 | if err != nil { 28 | return nil, err 29 | } 30 | defer resp.Body.Close() 31 | 32 | if resp.StatusCode != http.StatusOK { 33 | return nil, fmt.Errorf("unexpected status code %d", resp.StatusCode) 34 | } 35 | 36 | var counter Counter 37 | err = json.NewDecoder(resp.Body).Decode(&counter) 38 | if err != nil { 39 | return nil, err 40 | } 41 | 42 | if counter.Index >= len(s.specs) { 43 | return nil, ErrClosed 44 | } 45 | 46 | return s.specs[counter.Index], nil 47 | } 48 | 49 | func (s *ParallelIterator) NumberOfSpecsPriorToIteration() int { 50 | return len(s.specs) 51 | } 52 | 53 | func (s *ParallelIterator) NumberOfSpecsToProcessIfKnown() (int, bool) { 54 | return -1, false 55 | } 56 | 57 | func (s *ParallelIterator) NumberOfSpecsThatWillBeRunIfKnown() (int, bool) { 58 | return -1, false 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/spec_iterator/serial_spec_iterator.go: -------------------------------------------------------------------------------- 1 | package spec_iterator 2 | 3 | import ( 4 | "github.com/onsi/ginkgo/internal/spec" 5 | ) 6 | 7 | type SerialIterator struct { 8 | specs []*spec.Spec 9 | index int 10 | } 11 | 12 | func NewSerialIterator(specs []*spec.Spec) *SerialIterator { 13 | return &SerialIterator{ 14 | specs: specs, 15 | index: 0, 16 | } 17 | } 18 | 19 | func (s *SerialIterator) Next() (*spec.Spec, error) { 20 | if s.index >= len(s.specs) { 21 | return nil, ErrClosed 22 | } 23 | 24 | spec := s.specs[s.index] 25 | s.index += 1 26 | return spec, nil 27 | } 28 | 29 | func (s *SerialIterator) NumberOfSpecsPriorToIteration() int { 30 | return len(s.specs) 31 | } 32 | 33 | func (s *SerialIterator) NumberOfSpecsToProcessIfKnown() (int, bool) { 34 | return len(s.specs), true 35 | } 36 | 37 | func (s *SerialIterator) NumberOfSpecsThatWillBeRunIfKnown() (int, bool) { 38 | count := 0 39 | for _, s := range s.specs { 40 | if !s.Skipped() && !s.Pending() { 41 | count += 1 42 | } 43 | } 44 | return count, true 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/spec_iterator/sharded_parallel_spec_iterator.go: -------------------------------------------------------------------------------- 1 | package spec_iterator 2 | 3 | import "github.com/onsi/ginkgo/internal/spec" 4 | 5 | type ShardedParallelIterator struct { 6 | specs []*spec.Spec 7 | index int 8 | maxIndex int 9 | } 10 | 11 | func NewShardedParallelIterator(specs []*spec.Spec, total int, node int) *ShardedParallelIterator { 12 | startIndex, count := ParallelizedIndexRange(len(specs), total, node) 13 | 14 | return &ShardedParallelIterator{ 15 | specs: specs, 16 | index: startIndex, 17 | maxIndex: startIndex + count, 18 | } 19 | } 20 | 21 | func (s *ShardedParallelIterator) Next() (*spec.Spec, error) { 22 | if s.index >= s.maxIndex { 23 | return nil, ErrClosed 24 | } 25 | 26 | spec := s.specs[s.index] 27 | s.index += 1 28 | return spec, nil 29 | } 30 | 31 | func (s *ShardedParallelIterator) NumberOfSpecsPriorToIteration() int { 32 | return len(s.specs) 33 | } 34 | 35 | func (s *ShardedParallelIterator) NumberOfSpecsToProcessIfKnown() (int, bool) { 36 | return s.maxIndex - s.index, true 37 | } 38 | 39 | func (s *ShardedParallelIterator) NumberOfSpecsThatWillBeRunIfKnown() (int, bool) { 40 | count := 0 41 | for i := s.index; i < s.maxIndex; i += 1 { 42 | if !s.specs[i].Skipped() && !s.specs[i].Pending() { 43 | count += 1 44 | } 45 | } 46 | return count, true 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/spec_iterator/spec_iterator.go: -------------------------------------------------------------------------------- 1 | package spec_iterator 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/onsi/ginkgo/internal/spec" 7 | ) 8 | 9 | var ErrClosed = errors.New("no more specs to run") 10 | 11 | type SpecIterator interface { 12 | Next() (*spec.Spec, error) 13 | NumberOfSpecsPriorToIteration() int 14 | NumberOfSpecsToProcessIfKnown() (int, bool) 15 | NumberOfSpecsThatWillBeRunIfKnown() (int, bool) 16 | } 17 | 18 | type Counter struct { 19 | Index int `json:"index"` 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/specrunner/random_id.go: -------------------------------------------------------------------------------- 1 | package specrunner 2 | 3 | import ( 4 | "crypto/rand" 5 | "fmt" 6 | ) 7 | 8 | func randomID() string { 9 | b := make([]byte, 8) 10 | _, err := rand.Read(b) 11 | if err != nil { 12 | return "" 13 | } 14 | return fmt.Sprintf("%x-%x-%x-%x", b[0:2], b[2:4], b[4:6], b[6:8]) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/writer/fake_writer.go: -------------------------------------------------------------------------------- 1 | package writer 2 | 3 | type FakeGinkgoWriter struct { 4 | EventStream []string 5 | } 6 | 7 | func NewFake() *FakeGinkgoWriter { 8 | return &FakeGinkgoWriter{ 9 | EventStream: []string{}, 10 | } 11 | } 12 | 13 | func (writer *FakeGinkgoWriter) AddEvent(event string) { 14 | writer.EventStream = append(writer.EventStream, event) 15 | } 16 | 17 | func (writer *FakeGinkgoWriter) Truncate() { 18 | writer.EventStream = append(writer.EventStream, "TRUNCATE") 19 | } 20 | 21 | func (writer *FakeGinkgoWriter) DumpOut() { 22 | writer.EventStream = append(writer.EventStream, "DUMP") 23 | } 24 | 25 | func (writer *FakeGinkgoWriter) DumpOutWithHeader(header string) { 26 | writer.EventStream = append(writer.EventStream, "DUMP_WITH_HEADER: "+header) 27 | } 28 | 29 | func (writer *FakeGinkgoWriter) Bytes() []byte { 30 | writer.EventStream = append(writer.EventStream, "BYTES") 31 | return nil 32 | } 33 | 34 | func (writer *FakeGinkgoWriter) Write(data []byte) (n int, err error) { 35 | return 0, nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/reporter.go: -------------------------------------------------------------------------------- 1 | package reporters 2 | 3 | import ( 4 | "github.com/onsi/ginkgo/config" 5 | "github.com/onsi/ginkgo/types" 6 | ) 7 | 8 | type Reporter interface { 9 | SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary) 10 | BeforeSuiteDidRun(setupSummary *types.SetupSummary) 11 | SpecWillRun(specSummary *types.SpecSummary) 12 | SpecDidComplete(specSummary *types.SpecSummary) 13 | AfterSuiteDidRun(setupSummary *types.SetupSummary) 14 | SpecSuiteDidEnd(summary *types.SuiteSummary) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/stenographer/console_logging.go: -------------------------------------------------------------------------------- 1 | package stenographer 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | func (s *consoleStenographer) colorize(colorCode string, format string, args ...interface{}) string { 9 | var out string 10 | 11 | if len(args) > 0 { 12 | out = fmt.Sprintf(format, args...) 13 | } else { 14 | out = format 15 | } 16 | 17 | if s.color { 18 | return fmt.Sprintf("%s%s%s", colorCode, out, defaultStyle) 19 | } else { 20 | return out 21 | } 22 | } 23 | 24 | func (s *consoleStenographer) printBanner(text string, bannerCharacter string) { 25 | fmt.Fprintln(s.w, text) 26 | fmt.Fprintln(s.w, strings.Repeat(bannerCharacter, len(text))) 27 | } 28 | 29 | func (s *consoleStenographer) printNewLine() { 30 | fmt.Fprintln(s.w, "") 31 | } 32 | 33 | func (s *consoleStenographer) printDelimiter() { 34 | fmt.Fprintln(s.w, s.colorize(grayColor, "%s", strings.Repeat("-", 30))) 35 | } 36 | 37 | func (s *consoleStenographer) print(indentation int, format string, args ...interface{}) { 38 | fmt.Fprint(s.w, s.indent(indentation, format, args...)) 39 | } 40 | 41 | func (s *consoleStenographer) println(indentation int, format string, args ...interface{}) { 42 | fmt.Fprintln(s.w, s.indent(indentation, format, args...)) 43 | } 44 | 45 | func (s *consoleStenographer) indent(indentation int, format string, args ...interface{}) string { 46 | var text string 47 | 48 | if len(args) > 0 { 49 | text = fmt.Sprintf(format, args...) 50 | } else { 51 | text = format 52 | } 53 | 54 | stringArray := strings.Split(text, "\n") 55 | padding := "" 56 | if indentation >= 0 { 57 | padding = strings.Repeat(" ", indentation) 58 | } 59 | for i, s := range stringArray { 60 | stringArray[i] = fmt.Sprintf("%s%s", padding, s) 61 | } 62 | 63 | return strings.Join(stringArray, "\n") 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Yasuhiro Matsumoto 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/onsi/ginkgo/reporters/stenographer/support/go-colorable/README.md: -------------------------------------------------------------------------------- 1 | # go-colorable 2 | 3 | Colorable writer for windows. 4 | 5 | For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.) 6 | This package is possible to handle escape sequence for ansi color on windows. 7 | 8 | ## Too Bad! 9 | 10 | ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png) 11 | 12 | 13 | ## So Good! 14 | 15 | ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png) 16 | 17 | ## Usage 18 | 19 | ```go 20 | logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true}) 21 | logrus.SetOutput(colorable.NewColorableStdout()) 22 | 23 | logrus.Info("succeeded") 24 | logrus.Warn("not correct") 25 | logrus.Error("something error") 26 | logrus.Fatal("panic") 27 | ``` 28 | 29 | You can compile above code on non-windows OSs. 30 | 31 | ## Installation 32 | 33 | ``` 34 | $ go get github.com/mattn/go-colorable 35 | ``` 36 | 37 | # License 38 | 39 | MIT 40 | 41 | # Author 42 | 43 | Yasuhiro Matsumoto (a.k.a mattn) 44 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package colorable 4 | 5 | import ( 6 | "io" 7 | "os" 8 | ) 9 | 10 | func NewColorable(file *os.File) io.Writer { 11 | if file == nil { 12 | panic("nil passed instead of *os.File to NewColorable()") 13 | } 14 | 15 | return file 16 | } 17 | 18 | func NewColorableStdout() io.Writer { 19 | return os.Stdout 20 | } 21 | 22 | func NewColorableStderr() io.Writer { 23 | return os.Stderr 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/noncolorable.go: -------------------------------------------------------------------------------- 1 | package colorable 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "io" 7 | ) 8 | 9 | type NonColorable struct { 10 | out io.Writer 11 | lastbuf bytes.Buffer 12 | } 13 | 14 | func NewNonColorable(w io.Writer) io.Writer { 15 | return &NonColorable{out: w} 16 | } 17 | 18 | func (w *NonColorable) Write(data []byte) (n int, err error) { 19 | er := bytes.NewBuffer(data) 20 | loop: 21 | for { 22 | c1, _, err := er.ReadRune() 23 | if err != nil { 24 | break loop 25 | } 26 | if c1 != 0x1b { 27 | fmt.Fprint(w.out, string(c1)) 28 | continue 29 | } 30 | c2, _, err := er.ReadRune() 31 | if err != nil { 32 | w.lastbuf.WriteRune(c1) 33 | break loop 34 | } 35 | if c2 != 0x5b { 36 | w.lastbuf.WriteRune(c1) 37 | w.lastbuf.WriteRune(c2) 38 | continue 39 | } 40 | 41 | var buf bytes.Buffer 42 | for { 43 | c, _, err := er.ReadRune() 44 | if err != nil { 45 | w.lastbuf.WriteRune(c1) 46 | w.lastbuf.WriteRune(c2) 47 | w.lastbuf.Write(buf.Bytes()) 48 | break loop 49 | } 50 | if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { 51 | break 52 | } 53 | buf.Write([]byte(string(c))) 54 | } 55 | } 56 | return len(data) - w.lastbuf.Len(), nil 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Yasuhiro MATSUMOTO 2 | 3 | MIT License (Expat) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/README.md: -------------------------------------------------------------------------------- 1 | # go-isatty 2 | 3 | isatty for golang 4 | 5 | ## Usage 6 | 7 | ```go 8 | package main 9 | 10 | import ( 11 | "fmt" 12 | "github.com/mattn/go-isatty" 13 | "os" 14 | ) 15 | 16 | func main() { 17 | if isatty.IsTerminal(os.Stdout.Fd()) { 18 | fmt.Println("Is Terminal") 19 | } else { 20 | fmt.Println("Is Not Terminal") 21 | } 22 | } 23 | ``` 24 | 25 | ## Installation 26 | 27 | ``` 28 | $ go get github.com/mattn/go-isatty 29 | ``` 30 | 31 | # License 32 | 33 | MIT 34 | 35 | # Author 36 | 37 | Yasuhiro Matsumoto (a.k.a mattn) 38 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/doc.go: -------------------------------------------------------------------------------- 1 | // Package isatty implements interface to isatty 2 | package isatty 3 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package isatty 4 | 5 | // IsTerminal returns true if the file descriptor is terminal which 6 | // is always false on on appengine classic which is a sandboxed PaaS. 7 | func IsTerminal(fd uintptr) bool { 8 | return false 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | const ioctlReadTermios = syscall.TIOCGETA 12 | 13 | // IsTerminal return true if the file descriptor is terminal. 14 | func IsTerminal(fd uintptr) bool { 15 | var termios syscall.Termios 16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 17 | return err == 0 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_linux.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | const ioctlReadTermios = syscall.TCGETS 12 | 13 | // IsTerminal return true if the file descriptor is terminal. 14 | func IsTerminal(fd uintptr) bool { 15 | var termios syscall.Termios 16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 17 | return err == 0 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "golang.org/x/sys/unix" 8 | ) 9 | 10 | // IsTerminal returns true if the given file descriptor is a terminal. 11 | // see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c 12 | func IsTerminal(fd uintptr) bool { 13 | var termio unix.Termio 14 | err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio) 15 | return err == nil 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | var kernel32 = syscall.NewLazyDLL("kernel32.dll") 12 | var procGetConsoleMode = kernel32.NewProc("GetConsoleMode") 13 | 14 | // IsTerminal return true if the file descriptor is terminal. 15 | func IsTerminal(fd uintptr) bool { 16 | var st uint32 17 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) 18 | return r != 0 && e == 0 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/types/code_location.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | type CodeLocation struct { 8 | FileName string 9 | LineNumber int 10 | FullStackTrace string 11 | } 12 | 13 | func (codeLocation CodeLocation) String() string { 14 | return fmt.Sprintf("%s:%d", codeLocation.FileName, codeLocation.LineNumber) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/types/synchronization.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "encoding/json" 5 | ) 6 | 7 | type RemoteBeforeSuiteState int 8 | 9 | const ( 10 | RemoteBeforeSuiteStateInvalid RemoteBeforeSuiteState = iota 11 | 12 | RemoteBeforeSuiteStatePending 13 | RemoteBeforeSuiteStatePassed 14 | RemoteBeforeSuiteStateFailed 15 | RemoteBeforeSuiteStateDisappeared 16 | ) 17 | 18 | type RemoteBeforeSuiteData struct { 19 | Data []byte 20 | State RemoteBeforeSuiteState 21 | } 22 | 23 | func (r RemoteBeforeSuiteData) ToJSON() []byte { 24 | data, _ := json.Marshal(r) 25 | return data 26 | } 27 | 28 | type RemoteAfterSuiteData struct { 29 | CanRun bool 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.test 3 | . 4 | .idea 5 | gomega.iml 6 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.12.x 5 | - 1.13.x 6 | - gotip 7 | 8 | env: 9 | - GO111MODULE=on 10 | 11 | install: 12 | - go get -v ./... 13 | - go build ./... 14 | - go get github.com/onsi/ginkgo 15 | - go install github.com/onsi/ginkgo/ginkgo 16 | 17 | script: make test 18 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Gomega 2 | 3 | Your contributions to Gomega are essential for its long-term maintenance and improvement. To make a contribution: 4 | 5 | - Please **open an issue first** - describe what problem you are trying to solve and give the community a forum for input and feedback ahead of investing time in writing code! 6 | - Ensure adequate test coverage: 7 | - Make sure to add appropriate unit tests 8 | - Please run all tests locally (`ginkgo -r -p`) and make sure they go green before submitting the PR 9 | - Please run following linter locally `go vet ./...` and make sure output does not contain any warnings 10 | - Update the documentation. In addition to standard `godoc` comments Gomega has extensive documentation on the `gh-pages` branch. If relevant, please submit a docs PR to that branch alongside your code PR. 11 | 12 | If you're a committer, check out RELEASING.md to learn how to cut a release. 13 | 14 | Thanks for supporting Gomega! 15 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014 Onsi Fakhouri 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/onsi/gomega/README.md: -------------------------------------------------------------------------------- 1 | ![Gomega: Ginkgo's Preferred Matcher Library](http://onsi.github.io/gomega/images/gomega.png) 2 | 3 | [![Build Status](https://travis-ci.org/onsi/gomega.svg?branch=master)](https://travis-ci.org/onsi/gomega) 4 | 5 | Jump straight to the [docs](http://onsi.github.io/gomega/) to learn about Gomega, including a list of [all available matchers](http://onsi.github.io/gomega/#provided-matchers). 6 | 7 | If you have a question, comment, bug report, feature request, etc. please open a GitHub issue. 8 | 9 | ## [Ginkgo](http://github.com/onsi/ginkgo): a BDD Testing Framework for Golang 10 | 11 | Learn more about Ginkgo [here](http://onsi.github.io/ginkgo/) 12 | 13 | ## Community Matchers 14 | 15 | A collection of community matchers is available on the [wiki](https://github.com/onsi/gomega/wiki). 16 | 17 | ## License 18 | 19 | Gomega is MIT-Licensed 20 | 21 | The `ConsistOf` matcher uses [goraph](https://github.com/amitkgupta/goraph) which is embedded in the source to simplify distribution. goraph has an MIT license. 22 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/internal/oraclematcher/oracle_matcher.go: -------------------------------------------------------------------------------- 1 | package oraclematcher 2 | 3 | import "github.com/onsi/gomega/types" 4 | 5 | /* 6 | GomegaMatchers that also match the OracleMatcher interface can convey information about 7 | whether or not their result will change upon future attempts. 8 | 9 | This allows `Eventually` and `Consistently` to short circuit if success becomes impossible. 10 | 11 | For example, a process' exit code can never change. So, gexec's Exit matcher returns `true` 12 | for `MatchMayChangeInTheFuture` until the process exits, at which point it returns `false` forevermore. 13 | */ 14 | type OracleMatcher interface { 15 | MatchMayChangeInTheFuture(actual interface{}) bool 16 | } 17 | 18 | func MatchMayChangeInTheFuture(matcher types.GomegaMatcher, value interface{}) bool { 19 | oracleMatcher, ok := matcher.(OracleMatcher) 20 | if !ok { 21 | return true 22 | } 23 | 24 | return oracleMatcher.MatchMayChangeInTheFuture(value) 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support.go: -------------------------------------------------------------------------------- 1 | package testingtsupport 2 | 3 | import ( 4 | "regexp" 5 | "runtime/debug" 6 | "strings" 7 | 8 | "github.com/onsi/gomega/types" 9 | ) 10 | 11 | var StackTracePruneRE = regexp.MustCompile(`\/gomega\/|\/ginkgo\/|\/pkg\/testing\/|\/pkg\/runtime\/`) 12 | 13 | type EmptyTWithHelper struct{} 14 | 15 | func (e EmptyTWithHelper) Helper() {} 16 | 17 | type gomegaTestingT interface { 18 | Fatalf(format string, args ...interface{}) 19 | } 20 | 21 | func BuildTestingTGomegaFailWrapper(t gomegaTestingT) *types.GomegaFailWrapper { 22 | tWithHelper, hasHelper := t.(types.TWithHelper) 23 | if !hasHelper { 24 | tWithHelper = EmptyTWithHelper{} 25 | } 26 | 27 | fail := func(message string, callerSkip ...int) { 28 | if hasHelper { 29 | tWithHelper.Helper() 30 | t.Fatalf("\n%s", message) 31 | } else { 32 | skip := 2 33 | if len(callerSkip) > 0 { 34 | skip += callerSkip[0] 35 | } 36 | stackTrace := pruneStack(string(debug.Stack()), skip) 37 | t.Fatalf("\n%s\n%s\n", stackTrace, message) 38 | } 39 | } 40 | 41 | return &types.GomegaFailWrapper{ 42 | Fail: fail, 43 | TWithHelper: tWithHelper, 44 | } 45 | } 46 | 47 | func pruneStack(fullStackTrace string, skip int) string { 48 | stack := strings.Split(fullStackTrace, "\n")[1:] 49 | if len(stack) > 2*skip { 50 | stack = stack[2*skip:] 51 | } 52 | prunedStack := []string{} 53 | for i := 0; i < len(stack)/2; i++ { 54 | if !StackTracePruneRE.Match([]byte(stack[i*2])) { 55 | prunedStack = append(prunedStack, stack[i*2]) 56 | prunedStack = append(prunedStack, stack[i*2+1]) 57 | } 58 | } 59 | return strings.Join(prunedStack, "\n") 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go: -------------------------------------------------------------------------------- 1 | // untested sections: 2 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | "reflect" 8 | 9 | "github.com/onsi/gomega/format" 10 | ) 11 | 12 | type AssignableToTypeOfMatcher struct { 13 | Expected interface{} 14 | } 15 | 16 | func (matcher *AssignableToTypeOfMatcher) Match(actual interface{}) (success bool, err error) { 17 | if actual == nil && matcher.Expected == nil { 18 | return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") 19 | } else if matcher.Expected == nil { 20 | return false, fmt.Errorf("Refusing to compare type to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") 21 | } else if actual == nil { 22 | return false, nil 23 | } 24 | 25 | actualType := reflect.TypeOf(actual) 26 | expectedType := reflect.TypeOf(matcher.Expected) 27 | 28 | return actualType.AssignableTo(expectedType), nil 29 | } 30 | 31 | func (matcher *AssignableToTypeOfMatcher) FailureMessage(actual interface{}) string { 32 | return format.Message(actual, fmt.Sprintf("to be assignable to the type: %T", matcher.Expected)) 33 | } 34 | 35 | func (matcher *AssignableToTypeOfMatcher) NegatedFailureMessage(actual interface{}) string { 36 | return format.Message(actual, fmt.Sprintf("not to be assignable to the type: %T", matcher.Expected)) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_a_directory.go: -------------------------------------------------------------------------------- 1 | // untested sections: 5 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | 9 | "github.com/onsi/gomega/format" 10 | ) 11 | 12 | type notADirectoryError struct { 13 | os.FileInfo 14 | } 15 | 16 | func (t notADirectoryError) Error() string { 17 | fileInfo := os.FileInfo(t) 18 | switch { 19 | case fileInfo.Mode().IsRegular(): 20 | return "file is a regular file" 21 | default: 22 | return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String()) 23 | } 24 | } 25 | 26 | type BeADirectoryMatcher struct { 27 | expected interface{} 28 | err error 29 | } 30 | 31 | func (matcher *BeADirectoryMatcher) Match(actual interface{}) (success bool, err error) { 32 | actualFilename, ok := actual.(string) 33 | if !ok { 34 | return false, fmt.Errorf("BeADirectoryMatcher matcher expects a file path") 35 | } 36 | 37 | fileInfo, err := os.Stat(actualFilename) 38 | if err != nil { 39 | matcher.err = err 40 | return false, nil 41 | } 42 | 43 | if !fileInfo.Mode().IsDir() { 44 | matcher.err = notADirectoryError{fileInfo} 45 | return false, nil 46 | } 47 | return true, nil 48 | } 49 | 50 | func (matcher *BeADirectoryMatcher) FailureMessage(actual interface{}) (message string) { 51 | return format.Message(actual, fmt.Sprintf("to be a directory: %s", matcher.err)) 52 | } 53 | 54 | func (matcher *BeADirectoryMatcher) NegatedFailureMessage(actual interface{}) (message string) { 55 | return format.Message(actual, fmt.Sprintf("not be a directory")) 56 | } 57 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go: -------------------------------------------------------------------------------- 1 | // untested sections: 5 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | 9 | "github.com/onsi/gomega/format" 10 | ) 11 | 12 | type notARegularFileError struct { 13 | os.FileInfo 14 | } 15 | 16 | func (t notARegularFileError) Error() string { 17 | fileInfo := os.FileInfo(t) 18 | switch { 19 | case fileInfo.IsDir(): 20 | return "file is a directory" 21 | default: 22 | return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String()) 23 | } 24 | } 25 | 26 | type BeARegularFileMatcher struct { 27 | expected interface{} 28 | err error 29 | } 30 | 31 | func (matcher *BeARegularFileMatcher) Match(actual interface{}) (success bool, err error) { 32 | actualFilename, ok := actual.(string) 33 | if !ok { 34 | return false, fmt.Errorf("BeARegularFileMatcher matcher expects a file path") 35 | } 36 | 37 | fileInfo, err := os.Stat(actualFilename) 38 | if err != nil { 39 | matcher.err = err 40 | return false, nil 41 | } 42 | 43 | if !fileInfo.Mode().IsRegular() { 44 | matcher.err = notARegularFileError{fileInfo} 45 | return false, nil 46 | } 47 | return true, nil 48 | } 49 | 50 | func (matcher *BeARegularFileMatcher) FailureMessage(actual interface{}) (message string) { 51 | return format.Message(actual, fmt.Sprintf("to be a regular file: %s", matcher.err)) 52 | } 53 | 54 | func (matcher *BeARegularFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { 55 | return format.Message(actual, fmt.Sprintf("not be a regular file")) 56 | } 57 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go: -------------------------------------------------------------------------------- 1 | // untested sections: 3 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | 9 | "github.com/onsi/gomega/format" 10 | ) 11 | 12 | type BeAnExistingFileMatcher struct { 13 | expected interface{} 14 | } 15 | 16 | func (matcher *BeAnExistingFileMatcher) Match(actual interface{}) (success bool, err error) { 17 | actualFilename, ok := actual.(string) 18 | if !ok { 19 | return false, fmt.Errorf("BeAnExistingFileMatcher matcher expects a file path") 20 | } 21 | 22 | if _, err = os.Stat(actualFilename); err != nil { 23 | switch { 24 | case os.IsNotExist(err): 25 | return false, nil 26 | default: 27 | return false, err 28 | } 29 | } 30 | 31 | return true, nil 32 | } 33 | 34 | func (matcher *BeAnExistingFileMatcher) FailureMessage(actual interface{}) (message string) { 35 | return format.Message(actual, fmt.Sprintf("to exist")) 36 | } 37 | 38 | func (matcher *BeAnExistingFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { 39 | return format.Message(actual, fmt.Sprintf("not to exist")) 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go: -------------------------------------------------------------------------------- 1 | // untested sections: 2 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | "reflect" 8 | 9 | "github.com/onsi/gomega/format" 10 | ) 11 | 12 | type BeClosedMatcher struct { 13 | } 14 | 15 | func (matcher *BeClosedMatcher) Match(actual interface{}) (success bool, err error) { 16 | if !isChan(actual) { 17 | return false, fmt.Errorf("BeClosed matcher expects a channel. Got:\n%s", format.Object(actual, 1)) 18 | } 19 | 20 | channelType := reflect.TypeOf(actual) 21 | channelValue := reflect.ValueOf(actual) 22 | 23 | if channelType.ChanDir() == reflect.SendDir { 24 | return false, fmt.Errorf("BeClosed matcher cannot determine if a send-only channel is closed or open. Got:\n%s", format.Object(actual, 1)) 25 | } 26 | 27 | winnerIndex, _, open := reflect.Select([]reflect.SelectCase{ 28 | {Dir: reflect.SelectRecv, Chan: channelValue}, 29 | {Dir: reflect.SelectDefault}, 30 | }) 31 | 32 | var closed bool 33 | if winnerIndex == 0 { 34 | closed = !open 35 | } else if winnerIndex == 1 { 36 | closed = false 37 | } 38 | 39 | return closed, nil 40 | } 41 | 42 | func (matcher *BeClosedMatcher) FailureMessage(actual interface{}) (message string) { 43 | return format.Message(actual, "to be closed") 44 | } 45 | 46 | func (matcher *BeClosedMatcher) NegatedFailureMessage(actual interface{}) (message string) { 47 | return format.Message(actual, "to be open") 48 | } 49 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go: -------------------------------------------------------------------------------- 1 | // untested sections: 2 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | 8 | "github.com/onsi/gomega/format" 9 | ) 10 | 11 | type BeEmptyMatcher struct { 12 | } 13 | 14 | func (matcher *BeEmptyMatcher) Match(actual interface{}) (success bool, err error) { 15 | length, ok := lengthOf(actual) 16 | if !ok { 17 | return false, fmt.Errorf("BeEmpty matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) 18 | } 19 | 20 | return length == 0, nil 21 | } 22 | 23 | func (matcher *BeEmptyMatcher) FailureMessage(actual interface{}) (message string) { 24 | return format.Message(actual, "to be empty") 25 | } 26 | 27 | func (matcher *BeEmptyMatcher) NegatedFailureMessage(actual interface{}) (message string) { 28 | return format.Message(actual, "not to be empty") 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go: -------------------------------------------------------------------------------- 1 | // untested sections: 2 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | "reflect" 8 | 9 | "github.com/onsi/gomega/format" 10 | ) 11 | 12 | type BeEquivalentToMatcher struct { 13 | Expected interface{} 14 | } 15 | 16 | func (matcher *BeEquivalentToMatcher) Match(actual interface{}) (success bool, err error) { 17 | if actual == nil && matcher.Expected == nil { 18 | return false, fmt.Errorf("Both actual and expected must not be nil.") 19 | } 20 | 21 | convertedActual := actual 22 | 23 | if actual != nil && matcher.Expected != nil && reflect.TypeOf(actual).ConvertibleTo(reflect.TypeOf(matcher.Expected)) { 24 | convertedActual = reflect.ValueOf(actual).Convert(reflect.TypeOf(matcher.Expected)).Interface() 25 | } 26 | 27 | return reflect.DeepEqual(convertedActual, matcher.Expected), nil 28 | } 29 | 30 | func (matcher *BeEquivalentToMatcher) FailureMessage(actual interface{}) (message string) { 31 | return format.Message(actual, "to be equivalent to", matcher.Expected) 32 | } 33 | 34 | func (matcher *BeEquivalentToMatcher) NegatedFailureMessage(actual interface{}) (message string) { 35 | return format.Message(actual, "not to be equivalent to", matcher.Expected) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_false_matcher.go: -------------------------------------------------------------------------------- 1 | // untested sections: 2 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | 8 | "github.com/onsi/gomega/format" 9 | ) 10 | 11 | type BeFalseMatcher struct { 12 | } 13 | 14 | func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err error) { 15 | if !isBool(actual) { 16 | return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) 17 | } 18 | 19 | return actual == false, nil 20 | } 21 | 22 | func (matcher *BeFalseMatcher) FailureMessage(actual interface{}) (message string) { 23 | return format.Message(actual, "to be false") 24 | } 25 | 26 | func (matcher *BeFalseMatcher) NegatedFailureMessage(actual interface{}) (message string) { 27 | return format.Message(actual, "not to be false") 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_identical_to.go: -------------------------------------------------------------------------------- 1 | // untested sections: 2 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | "runtime" 8 | 9 | "github.com/onsi/gomega/format" 10 | ) 11 | 12 | type BeIdenticalToMatcher struct { 13 | Expected interface{} 14 | } 15 | 16 | func (matcher *BeIdenticalToMatcher) Match(actual interface{}) (success bool, matchErr error) { 17 | if actual == nil && matcher.Expected == nil { 18 | return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") 19 | } 20 | 21 | defer func() { 22 | if r := recover(); r != nil { 23 | if _, ok := r.(runtime.Error); ok { 24 | success = false 25 | matchErr = nil 26 | } 27 | } 28 | }() 29 | 30 | return actual == matcher.Expected, nil 31 | } 32 | 33 | func (matcher *BeIdenticalToMatcher) FailureMessage(actual interface{}) string { 34 | return format.Message(actual, "to be identical to", matcher.Expected) 35 | } 36 | 37 | func (matcher *BeIdenticalToMatcher) NegatedFailureMessage(actual interface{}) string { 38 | return format.Message(actual, "not to be identical to", matcher.Expected) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go: -------------------------------------------------------------------------------- 1 | // untested sections: 2 2 | 3 | package matchers 4 | 5 | import "github.com/onsi/gomega/format" 6 | 7 | type BeNilMatcher struct { 8 | } 9 | 10 | func (matcher *BeNilMatcher) Match(actual interface{}) (success bool, err error) { 11 | return isNil(actual), nil 12 | } 13 | 14 | func (matcher *BeNilMatcher) FailureMessage(actual interface{}) (message string) { 15 | return format.Message(actual, "to be nil") 16 | } 17 | 18 | func (matcher *BeNilMatcher) NegatedFailureMessage(actual interface{}) (message string) { 19 | return format.Message(actual, "not to be nil") 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_true_matcher.go: -------------------------------------------------------------------------------- 1 | // untested sections: 2 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | 8 | "github.com/onsi/gomega/format" 9 | ) 10 | 11 | type BeTrueMatcher struct { 12 | } 13 | 14 | func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) { 15 | if !isBool(actual) { 16 | return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) 17 | } 18 | 19 | return actual.(bool), nil 20 | } 21 | 22 | func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) { 23 | return format.Message(actual, "to be true") 24 | } 25 | 26 | func (matcher *BeTrueMatcher) NegatedFailureMessage(actual interface{}) (message string) { 27 | return format.Message(actual, "not to be true") 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "reflect" 5 | 6 | "github.com/onsi/gomega/format" 7 | ) 8 | 9 | type BeZeroMatcher struct { 10 | } 11 | 12 | func (matcher *BeZeroMatcher) Match(actual interface{}) (success bool, err error) { 13 | if actual == nil { 14 | return true, nil 15 | } 16 | zeroValue := reflect.Zero(reflect.TypeOf(actual)).Interface() 17 | 18 | return reflect.DeepEqual(zeroValue, actual), nil 19 | 20 | } 21 | 22 | func (matcher *BeZeroMatcher) FailureMessage(actual interface{}) (message string) { 23 | return format.Message(actual, "to be zero-valued") 24 | } 25 | 26 | func (matcher *BeZeroMatcher) NegatedFailureMessage(actual interface{}) (message string) { 27 | return format.Message(actual, "not to be zero-valued") 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go: -------------------------------------------------------------------------------- 1 | // untested sections: 2 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | "reflect" 8 | 9 | "github.com/onsi/gomega/format" 10 | ) 11 | 12 | type ContainElementMatcher struct { 13 | Element interface{} 14 | } 15 | 16 | func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, err error) { 17 | if !isArrayOrSlice(actual) && !isMap(actual) { 18 | return false, fmt.Errorf("ContainElement matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) 19 | } 20 | 21 | elemMatcher, elementIsMatcher := matcher.Element.(omegaMatcher) 22 | if !elementIsMatcher { 23 | elemMatcher = &EqualMatcher{Expected: matcher.Element} 24 | } 25 | 26 | value := reflect.ValueOf(actual) 27 | var valueAt func(int) interface{} 28 | if isMap(actual) { 29 | keys := value.MapKeys() 30 | valueAt = func(i int) interface{} { 31 | return value.MapIndex(keys[i]).Interface() 32 | } 33 | } else { 34 | valueAt = func(i int) interface{} { 35 | return value.Index(i).Interface() 36 | } 37 | } 38 | 39 | var lastError error 40 | for i := 0; i < value.Len(); i++ { 41 | success, err := elemMatcher.Match(valueAt(i)) 42 | if err != nil { 43 | lastError = err 44 | continue 45 | } 46 | if success { 47 | return true, nil 48 | } 49 | } 50 | 51 | return false, lastError 52 | } 53 | 54 | func (matcher *ContainElementMatcher) FailureMessage(actual interface{}) (message string) { 55 | return format.Message(actual, "to contain element matching", matcher.Element) 56 | } 57 | 58 | func (matcher *ContainElementMatcher) NegatedFailureMessage(actual interface{}) (message string) { 59 | return format.Message(actual, "not to contain element matching", matcher.Element) 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go: -------------------------------------------------------------------------------- 1 | // untested sections: 2 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | "strings" 8 | 9 | "github.com/onsi/gomega/format" 10 | ) 11 | 12 | type ContainSubstringMatcher struct { 13 | Substr string 14 | Args []interface{} 15 | } 16 | 17 | func (matcher *ContainSubstringMatcher) Match(actual interface{}) (success bool, err error) { 18 | actualString, ok := toString(actual) 19 | if !ok { 20 | return false, fmt.Errorf("ContainSubstring matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) 21 | } 22 | 23 | return strings.Contains(actualString, matcher.stringToMatch()), nil 24 | } 25 | 26 | func (matcher *ContainSubstringMatcher) stringToMatch() string { 27 | stringToMatch := matcher.Substr 28 | if len(matcher.Args) > 0 { 29 | stringToMatch = fmt.Sprintf(matcher.Substr, matcher.Args...) 30 | } 31 | return stringToMatch 32 | } 33 | 34 | func (matcher *ContainSubstringMatcher) FailureMessage(actual interface{}) (message string) { 35 | return format.Message(actual, "to contain substring", matcher.stringToMatch()) 36 | } 37 | 38 | func (matcher *ContainSubstringMatcher) NegatedFailureMessage(actual interface{}) (message string) { 39 | return format.Message(actual, "not to contain substring", matcher.stringToMatch()) 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/equal_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "reflect" 7 | 8 | "github.com/onsi/gomega/format" 9 | ) 10 | 11 | type EqualMatcher struct { 12 | Expected interface{} 13 | } 14 | 15 | func (matcher *EqualMatcher) Match(actual interface{}) (success bool, err error) { 16 | if actual == nil && matcher.Expected == nil { 17 | return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") 18 | } 19 | // Shortcut for byte slices. 20 | // Comparing long byte slices with reflect.DeepEqual is very slow, 21 | // so use bytes.Equal if actual and expected are both byte slices. 22 | if actualByteSlice, ok := actual.([]byte); ok { 23 | if expectedByteSlice, ok := matcher.Expected.([]byte); ok { 24 | return bytes.Equal(actualByteSlice, expectedByteSlice), nil 25 | } 26 | } 27 | return reflect.DeepEqual(actual, matcher.Expected), nil 28 | } 29 | 30 | func (matcher *EqualMatcher) FailureMessage(actual interface{}) (message string) { 31 | actualString, actualOK := actual.(string) 32 | expectedString, expectedOK := matcher.Expected.(string) 33 | if actualOK && expectedOK { 34 | return format.MessageWithDiff(actualString, "to equal", expectedString) 35 | } 36 | 37 | return format.Message(actual, "to equal", matcher.Expected) 38 | } 39 | 40 | func (matcher *EqualMatcher) NegatedFailureMessage(actual interface{}) (message string) { 41 | return format.Message(actual, "not to equal", matcher.Expected) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go: -------------------------------------------------------------------------------- 1 | // untested sections: 2 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | 8 | "github.com/onsi/gomega/format" 9 | ) 10 | 11 | type HaveCapMatcher struct { 12 | Count int 13 | } 14 | 15 | func (matcher *HaveCapMatcher) Match(actual interface{}) (success bool, err error) { 16 | length, ok := capOf(actual) 17 | if !ok { 18 | return false, fmt.Errorf("HaveCap matcher expects a array/channel/slice. Got:\n%s", format.Object(actual, 1)) 19 | } 20 | 21 | return length == matcher.Count, nil 22 | } 23 | 24 | func (matcher *HaveCapMatcher) FailureMessage(actual interface{}) (message string) { 25 | return fmt.Sprintf("Expected\n%s\nto have capacity %d", format.Object(actual, 1), matcher.Count) 26 | } 27 | 28 | func (matcher *HaveCapMatcher) NegatedFailureMessage(actual interface{}) (message string) { 29 | return fmt.Sprintf("Expected\n%s\nnot to have capacity %d", format.Object(actual, 1), matcher.Count) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_key_matcher.go: -------------------------------------------------------------------------------- 1 | // untested sections: 6 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | "reflect" 8 | 9 | "github.com/onsi/gomega/format" 10 | ) 11 | 12 | type HaveKeyMatcher struct { 13 | Key interface{} 14 | } 15 | 16 | func (matcher *HaveKeyMatcher) Match(actual interface{}) (success bool, err error) { 17 | if !isMap(actual) { 18 | return false, fmt.Errorf("HaveKey matcher expects a map. Got:%s", format.Object(actual, 1)) 19 | } 20 | 21 | keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher) 22 | if !keyIsMatcher { 23 | keyMatcher = &EqualMatcher{Expected: matcher.Key} 24 | } 25 | 26 | keys := reflect.ValueOf(actual).MapKeys() 27 | for i := 0; i < len(keys); i++ { 28 | success, err := keyMatcher.Match(keys[i].Interface()) 29 | if err != nil { 30 | return false, fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) 31 | } 32 | if success { 33 | return true, nil 34 | } 35 | } 36 | 37 | return false, nil 38 | } 39 | 40 | func (matcher *HaveKeyMatcher) FailureMessage(actual interface{}) (message string) { 41 | switch matcher.Key.(type) { 42 | case omegaMatcher: 43 | return format.Message(actual, "to have key matching", matcher.Key) 44 | default: 45 | return format.Message(actual, "to have key", matcher.Key) 46 | } 47 | } 48 | 49 | func (matcher *HaveKeyMatcher) NegatedFailureMessage(actual interface{}) (message string) { 50 | switch matcher.Key.(type) { 51 | case omegaMatcher: 52 | return format.Message(actual, "not to have key matching", matcher.Key) 53 | default: 54 | return format.Message(actual, "not to have key", matcher.Key) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_len_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/onsi/gomega/format" 7 | ) 8 | 9 | type HaveLenMatcher struct { 10 | Count int 11 | } 12 | 13 | func (matcher *HaveLenMatcher) Match(actual interface{}) (success bool, err error) { 14 | length, ok := lengthOf(actual) 15 | if !ok { 16 | return false, fmt.Errorf("HaveLen matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) 17 | } 18 | 19 | return length == matcher.Count, nil 20 | } 21 | 22 | func (matcher *HaveLenMatcher) FailureMessage(actual interface{}) (message string) { 23 | return fmt.Sprintf("Expected\n%s\nto have length %d", format.Object(actual, 1), matcher.Count) 24 | } 25 | 26 | func (matcher *HaveLenMatcher) NegatedFailureMessage(actual interface{}) (message string) { 27 | return fmt.Sprintf("Expected\n%s\nnot to have length %d", format.Object(actual, 1), matcher.Count) 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go: -------------------------------------------------------------------------------- 1 | // untested sections: 2 2 | 3 | package matchers 4 | 5 | import ( 6 | "fmt" 7 | 8 | "github.com/onsi/gomega/format" 9 | ) 10 | 11 | type HaveOccurredMatcher struct { 12 | } 13 | 14 | func (matcher *HaveOccurredMatcher) Match(actual interface{}) (success bool, err error) { 15 | // is purely nil? 16 | if actual == nil { 17 | return false, nil 18 | } 19 | 20 | // must be an 'error' type 21 | if !isError(actual) { 22 | return false, fmt.Errorf("Expected an error-type. Got:\n%s", format.Object(actual, 1)) 23 | } 24 | 25 | // must be non-nil (or a pointer to a non-nil) 26 | return !isNil(actual), nil 27 | } 28 | 29 | func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message string) { 30 | return fmt.Sprintf("Expected an error to have occurred. Got:\n%s", format.Object(actual, 1)) 31 | } 32 | 33 | func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) { 34 | return fmt.Sprintf("Unexpected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "occurred") 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/onsi/gomega/format" 7 | ) 8 | 9 | type HavePrefixMatcher struct { 10 | Prefix string 11 | Args []interface{} 12 | } 13 | 14 | func (matcher *HavePrefixMatcher) Match(actual interface{}) (success bool, err error) { 15 | actualString, ok := toString(actual) 16 | if !ok { 17 | return false, fmt.Errorf("HavePrefix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) 18 | } 19 | prefix := matcher.prefix() 20 | return len(actualString) >= len(prefix) && actualString[0:len(prefix)] == prefix, nil 21 | } 22 | 23 | func (matcher *HavePrefixMatcher) prefix() string { 24 | if len(matcher.Args) > 0 { 25 | return fmt.Sprintf(matcher.Prefix, matcher.Args...) 26 | } 27 | return matcher.Prefix 28 | } 29 | 30 | func (matcher *HavePrefixMatcher) FailureMessage(actual interface{}) (message string) { 31 | return format.Message(actual, "to have prefix", matcher.prefix()) 32 | } 33 | 34 | func (matcher *HavePrefixMatcher) NegatedFailureMessage(actual interface{}) (message string) { 35 | return format.Message(actual, "not to have prefix", matcher.prefix()) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/onsi/gomega/format" 7 | ) 8 | 9 | type HaveSuffixMatcher struct { 10 | Suffix string 11 | Args []interface{} 12 | } 13 | 14 | func (matcher *HaveSuffixMatcher) Match(actual interface{}) (success bool, err error) { 15 | actualString, ok := toString(actual) 16 | if !ok { 17 | return false, fmt.Errorf("HaveSuffix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) 18 | } 19 | suffix := matcher.suffix() 20 | return len(actualString) >= len(suffix) && actualString[len(actualString)-len(suffix):] == suffix, nil 21 | } 22 | 23 | func (matcher *HaveSuffixMatcher) suffix() string { 24 | if len(matcher.Args) > 0 { 25 | return fmt.Sprintf(matcher.Suffix, matcher.Args...) 26 | } 27 | return matcher.Suffix 28 | } 29 | 30 | func (matcher *HaveSuffixMatcher) FailureMessage(actual interface{}) (message string) { 31 | return format.Message(actual, "to have suffix", matcher.suffix()) 32 | } 33 | 34 | func (matcher *HaveSuffixMatcher) NegatedFailureMessage(actual interface{}) (message string) { 35 | return format.Message(actual, "not to have suffix", matcher.suffix()) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/match_error_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | 7 | "github.com/onsi/gomega/format" 8 | "golang.org/x/xerrors" 9 | ) 10 | 11 | type MatchErrorMatcher struct { 12 | Expected interface{} 13 | } 14 | 15 | func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err error) { 16 | if isNil(actual) { 17 | return false, fmt.Errorf("Expected an error, got nil") 18 | } 19 | 20 | if !isError(actual) { 21 | return false, fmt.Errorf("Expected an error. Got:\n%s", format.Object(actual, 1)) 22 | } 23 | 24 | actualErr := actual.(error) 25 | expected := matcher.Expected 26 | 27 | if isError(expected) { 28 | return reflect.DeepEqual(actualErr, expected) || xerrors.Is(actualErr, expected.(error)), nil 29 | } 30 | 31 | if isString(expected) { 32 | return actualErr.Error() == expected, nil 33 | } 34 | 35 | var subMatcher omegaMatcher 36 | var hasSubMatcher bool 37 | if expected != nil { 38 | subMatcher, hasSubMatcher = (expected).(omegaMatcher) 39 | if hasSubMatcher { 40 | return subMatcher.Match(actualErr.Error()) 41 | } 42 | } 43 | 44 | return false, fmt.Errorf( 45 | "MatchError must be passed an error, a string, or a Matcher that can match on strings. Got:\n%s", 46 | format.Object(expected, 1)) 47 | } 48 | 49 | func (matcher *MatchErrorMatcher) FailureMessage(actual interface{}) (message string) { 50 | return format.Message(actual, "to match error", matcher.Expected) 51 | } 52 | 53 | func (matcher *MatchErrorMatcher) NegatedFailureMessage(actual interface{}) (message string) { 54 | return format.Message(actual, "not to match error", matcher.Expected) 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "regexp" 6 | 7 | "github.com/onsi/gomega/format" 8 | ) 9 | 10 | type MatchRegexpMatcher struct { 11 | Regexp string 12 | Args []interface{} 13 | } 14 | 15 | func (matcher *MatchRegexpMatcher) Match(actual interface{}) (success bool, err error) { 16 | actualString, ok := toString(actual) 17 | if !ok { 18 | return false, fmt.Errorf("RegExp matcher requires a string or stringer.\nGot:%s", format.Object(actual, 1)) 19 | } 20 | 21 | match, err := regexp.Match(matcher.regexp(), []byte(actualString)) 22 | if err != nil { 23 | return false, fmt.Errorf("RegExp match failed to compile with error:\n\t%s", err.Error()) 24 | } 25 | 26 | return match, nil 27 | } 28 | 29 | func (matcher *MatchRegexpMatcher) FailureMessage(actual interface{}) (message string) { 30 | return format.Message(actual, "to match regular expression", matcher.regexp()) 31 | } 32 | 33 | func (matcher *MatchRegexpMatcher) NegatedFailureMessage(actual interface{}) (message string) { 34 | return format.Message(actual, "not to match regular expression", matcher.regexp()) 35 | } 36 | 37 | func (matcher *MatchRegexpMatcher) regexp() string { 38 | re := matcher.Regexp 39 | if len(matcher.Args) > 0 { 40 | re = fmt.Sprintf(matcher.Regexp, matcher.Args...) 41 | } 42 | return re 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/not.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "github.com/onsi/gomega/internal/oraclematcher" 5 | "github.com/onsi/gomega/types" 6 | ) 7 | 8 | type NotMatcher struct { 9 | Matcher types.GomegaMatcher 10 | } 11 | 12 | func (m *NotMatcher) Match(actual interface{}) (bool, error) { 13 | success, err := m.Matcher.Match(actual) 14 | if err != nil { 15 | return false, err 16 | } 17 | return !success, nil 18 | } 19 | 20 | func (m *NotMatcher) FailureMessage(actual interface{}) (message string) { 21 | return m.Matcher.NegatedFailureMessage(actual) // works beautifully 22 | } 23 | 24 | func (m *NotMatcher) NegatedFailureMessage(actual interface{}) (message string) { 25 | return m.Matcher.FailureMessage(actual) // works beautifully 26 | } 27 | 28 | func (m *NotMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { 29 | return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, actual) // just return m.Matcher's value 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/panic_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | 7 | "github.com/onsi/gomega/format" 8 | ) 9 | 10 | type PanicMatcher struct { 11 | object interface{} 12 | } 13 | 14 | func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error) { 15 | if actual == nil { 16 | return false, fmt.Errorf("PanicMatcher expects a non-nil actual.") 17 | } 18 | 19 | actualType := reflect.TypeOf(actual) 20 | if actualType.Kind() != reflect.Func { 21 | return false, fmt.Errorf("PanicMatcher expects a function. Got:\n%s", format.Object(actual, 1)) 22 | } 23 | if !(actualType.NumIn() == 0 && actualType.NumOut() == 0) { 24 | return false, fmt.Errorf("PanicMatcher expects a function with no arguments and no return value. Got:\n%s", format.Object(actual, 1)) 25 | } 26 | 27 | success = false 28 | defer func() { 29 | if e := recover(); e != nil { 30 | matcher.object = e 31 | success = true 32 | } 33 | }() 34 | 35 | reflect.ValueOf(actual).Call([]reflect.Value{}) 36 | 37 | return 38 | } 39 | 40 | func (matcher *PanicMatcher) FailureMessage(actual interface{}) (message string) { 41 | return format.Message(actual, "to panic") 42 | } 43 | 44 | func (matcher *PanicMatcher) NegatedFailureMessage(actual interface{}) (message string) { 45 | return format.Message(actual, fmt.Sprintf("not to panic, but panicked with\n%s", format.Object(matcher.object, 1))) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/succeed_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/onsi/gomega/format" 7 | ) 8 | 9 | type SucceedMatcher struct { 10 | } 11 | 12 | func (matcher *SucceedMatcher) Match(actual interface{}) (success bool, err error) { 13 | // is purely nil? 14 | if actual == nil { 15 | return true, nil 16 | } 17 | 18 | // must be an 'error' type 19 | if !isError(actual) { 20 | return false, fmt.Errorf("Expected an error-type. Got:\n%s", format.Object(actual, 1)) 21 | } 22 | 23 | // must be nil (or a pointer to a nil) 24 | return isNil(actual), nil 25 | } 26 | 27 | func (matcher *SucceedMatcher) FailureMessage(actual interface{}) (message string) { 28 | return fmt.Sprintf("Expected success, but got an error:\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1)) 29 | } 30 | 31 | func (matcher *SucceedMatcher) NegatedFailureMessage(actual interface{}) (message string) { 32 | return "Expected failure, but got no error." 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go: -------------------------------------------------------------------------------- 1 | package bipartitegraph 2 | 3 | import "fmt" 4 | 5 | import . "github.com/onsi/gomega/matchers/support/goraph/node" 6 | import . "github.com/onsi/gomega/matchers/support/goraph/edge" 7 | 8 | type BipartiteGraph struct { 9 | Left NodeOrderedSet 10 | Right NodeOrderedSet 11 | Edges EdgeSet 12 | } 13 | 14 | func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(interface{}, interface{}) (bool, error)) (*BipartiteGraph, error) { 15 | left := NodeOrderedSet{} 16 | for i, v := range leftValues { 17 | left = append(left, Node{ID: i, Value: v}) 18 | } 19 | 20 | right := NodeOrderedSet{} 21 | for j, v := range rightValues { 22 | right = append(right, Node{ID: j + len(left), Value: v}) 23 | } 24 | 25 | edges := EdgeSet{} 26 | for i, leftValue := range leftValues { 27 | for j, rightValue := range rightValues { 28 | neighbours, err := neighbours(leftValue, rightValue) 29 | if err != nil { 30 | return nil, fmt.Errorf("error determining adjacency for %v and %v: %s", leftValue, rightValue, err.Error()) 31 | } 32 | 33 | if neighbours { 34 | edges = append(edges, Edge{Node1: left[i].ID, Node2: right[j].ID}) 35 | } 36 | } 37 | } 38 | 39 | return &BipartiteGraph{left, right, edges}, nil 40 | } 41 | 42 | // FreeLeftRight returns left node values and right node values 43 | // of the BipartiteGraph's nodes which are not part of the given edges. 44 | func (bg *BipartiteGraph) FreeLeftRight(edges EdgeSet) (leftValues, rightValues []interface{}) { 45 | for _, node := range bg.Left { 46 | if edges.Free(node) { 47 | leftValues = append(leftValues, node.Value) 48 | } 49 | } 50 | for _, node := range bg.Right { 51 | if edges.Free(node) { 52 | rightValues = append(rightValues, node.Value) 53 | } 54 | } 55 | return 56 | } 57 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go: -------------------------------------------------------------------------------- 1 | package edge 2 | 3 | import . "github.com/onsi/gomega/matchers/support/goraph/node" 4 | 5 | type Edge struct { 6 | Node1 int 7 | Node2 int 8 | } 9 | 10 | type EdgeSet []Edge 11 | 12 | func (ec EdgeSet) Free(node Node) bool { 13 | for _, e := range ec { 14 | if e.Node1 == node.ID || e.Node2 == node.ID { 15 | return false 16 | } 17 | } 18 | 19 | return true 20 | } 21 | 22 | func (ec EdgeSet) Contains(edge Edge) bool { 23 | for _, e := range ec { 24 | if e == edge { 25 | return true 26 | } 27 | } 28 | 29 | return false 30 | } 31 | 32 | func (ec EdgeSet) FindByNodes(node1, node2 Node) (Edge, bool) { 33 | for _, e := range ec { 34 | if (e.Node1 == node1.ID && e.Node2 == node2.ID) || (e.Node1 == node2.ID && e.Node2 == node1.ID) { 35 | return e, true 36 | } 37 | } 38 | 39 | return Edge{}, false 40 | } 41 | 42 | func (ec EdgeSet) SymmetricDifference(ec2 EdgeSet) EdgeSet { 43 | edgesToInclude := make(map[Edge]bool) 44 | 45 | for _, e := range ec { 46 | edgesToInclude[e] = true 47 | } 48 | 49 | for _, e := range ec2 { 50 | edgesToInclude[e] = !edgesToInclude[e] 51 | } 52 | 53 | result := EdgeSet{} 54 | for e, include := range edgesToInclude { 55 | if include { 56 | result = append(result, e) 57 | } 58 | } 59 | 60 | return result 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | type Node struct { 4 | ID int 5 | Value interface{} 6 | } 7 | 8 | type NodeOrderedSet []Node 9 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/support/goraph/util/util.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import "math" 4 | 5 | func Odd(n int) bool { 6 | return math.Mod(float64(n), 2.0) == 1.0 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/types/types.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | type TWithHelper interface { 4 | Helper() 5 | } 6 | 7 | type GomegaFailHandler func(message string, callerSkip ...int) 8 | 9 | type GomegaFailWrapper struct { 10 | Fail GomegaFailHandler 11 | TWithHelper TWithHelper 12 | } 13 | 14 | //A simple *testing.T interface wrapper 15 | type GomegaTestingT interface { 16 | Fatalf(format string, args ...interface{}) 17 | } 18 | 19 | //All Gomega matchers must implement the GomegaMatcher interface 20 | // 21 | //For details on writing custom matchers, check out: http://onsi.github.io/gomega/#adding-your-own-matchers 22 | type GomegaMatcher interface { 23 | Match(actual interface{}) (success bool, err error) 24 | FailureMessage(actual interface{}) (message string) 25 | NegatedFailureMessage(actual interface{}) (message string) 26 | } 27 | -------------------------------------------------------------------------------- /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.11.x 5 | - 1.12.x 6 | - 1.13.x 7 | - tip 8 | 9 | script: 10 | - make check 11 | -------------------------------------------------------------------------------- /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/starkandwayne/goutils/tree/err.go: -------------------------------------------------------------------------------- 1 | package tree 2 | 3 | import ( 4 | "fmt" 5 | "github.com/starkandwayne/goutils/ansi" 6 | "strings" 7 | ) 8 | 9 | // SyntaxError ... 10 | type SyntaxError struct { 11 | Problem string 12 | Position int 13 | } 14 | 15 | // Error ... 16 | func (e SyntaxError) Error() string { 17 | return fmt.Sprintf("syntax error: %s at position %d", e.Problem, e.Position) 18 | } 19 | 20 | // TypeMismatchError ... 21 | type TypeMismatchError struct { 22 | Path []string 23 | Wanted string 24 | Got string 25 | Value interface{} 26 | } 27 | 28 | // Error ... 29 | func (e TypeMismatchError) Error() string { 30 | if e.Got == "" { 31 | return ansi.Sprintf("@c{%s} @R{is not} @m{%s}", strings.Join(e.Path, "."), e.Wanted) 32 | } 33 | if e.Value != nil { 34 | return ansi.Sprintf("@c{$.%s} @R{[=%v] is %s (not} @m{%s}@R{)}", strings.Join(e.Path, "."), e.Value, e.Got, e.Wanted) 35 | } 36 | return ansi.Sprintf("@C{$.%s} @R{is %s (not} @m{%s}@R{)}", strings.Join(e.Path, "."), e.Got, e.Wanted) 37 | } 38 | 39 | // NotFoundError ... 40 | type NotFoundError struct { 41 | Path []string 42 | } 43 | 44 | // Error ... 45 | func (e NotFoundError) Error() string { 46 | return ansi.Sprintf("@R{`}@c{$.%s}@R{` could not be found in the datastructure}", strings.Join(e.Path, ".")) 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/starkandwayne/goutils/tree/tree.go: -------------------------------------------------------------------------------- 1 | package tree 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "io" 7 | "strings" 8 | ) 9 | 10 | type Node struct { 11 | Name string 12 | Sub []Node 13 | } 14 | 15 | func New(name string, sub ...Node) Node { 16 | return Node{ 17 | Name: name, 18 | Sub: sub, 19 | } 20 | } 21 | 22 | func (n Node) render(out io.Writer, prefix string, tail bool) { 23 | interim := "├── " 24 | if tail { 25 | interim = "└── " 26 | } 27 | nkids := len(n.Sub) 28 | 29 | ss := strings.Split(strings.Trim(n.Name, "\n"), "\n") 30 | for _, s := range ss { 31 | fmt.Fprintf(out, "%s%s%s\n", prefix, interim, s) 32 | interim = "│ " 33 | if tail { 34 | interim = " " 35 | } 36 | } 37 | 38 | for i, c := range n.Sub { 39 | c.render(out, prefix+interim, i == nkids-1) 40 | } 41 | } 42 | 43 | func (n *Node) Append(child Node) { 44 | n.Sub = append(n.Sub, child) 45 | } 46 | 47 | func (n Node) Draw() string { 48 | var out bytes.Buffer 49 | fmt.Fprintf(&out, ".\n") 50 | n.render(&out, "", true) 51 | return out.String() 52 | } 53 | 54 | func (n Node) flatten(prefix, sep string) []string { 55 | ss := make([]string, 0) 56 | if len(n.Sub) == 0 { 57 | return append(ss, fmt.Sprintf("%s%s", prefix, n.Name)) 58 | } 59 | for _, k := range n.Sub { 60 | for _, s := range k.flatten(prefix+n.Name+sep, sep) { 61 | ss = append(ss, s) 62 | } 63 | } 64 | return ss 65 | } 66 | 67 | func (n Node) Paths(sep string) []string { 68 | return n.flatten("", sep) 69 | } 70 | 71 | func (n Node) PathSegments() [][]string { 72 | if len(n.Sub) == 0 { 73 | return [][]string{[]string{n.Name}} 74 | } 75 | paths := make([][]string, 0) 76 | for _, child := range n.Sub { 77 | for _, segments := range child.PathSegments() { 78 | segments := append([]string{n.Name}, segments...) 79 | paths = append(paths, segments) 80 | } 81 | } 82 | return paths 83 | } 84 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/.gitignore: -------------------------------------------------------------------------------- 1 | *.coverprofile 2 | node_modules/ 3 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | sudo: false 4 | 5 | cache: 6 | directories: 7 | - node_modules 8 | 9 | go: 10 | - 1.2.x 11 | - 1.3.x 12 | - 1.4.2 13 | - 1.5.x 14 | - 1.6.x 15 | - 1.7.x 16 | - master 17 | 18 | matrix: 19 | allow_failures: 20 | - go: master 21 | include: 22 | - go: 1.6.x 23 | os: osx 24 | - go: 1.7.x 25 | os: osx 26 | 27 | before_script: 28 | - go get github.com/urfave/gfmrun/... || true 29 | - go get golang.org/x/tools/... || true 30 | - if [ ! -f node_modules/.bin/markdown-toc ] ; then 31 | npm install markdown-toc ; 32 | fi 33 | 34 | script: 35 | - ./runtests gen 36 | - ./runtests vet 37 | - ./runtests test 38 | - ./runtests gfmrun 39 | - ./runtests toc 40 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Jeremy Saenz & Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "{build}" 2 | 3 | os: Windows Server 2012 R2 4 | 5 | clone_folder: c:\gopath\src\github.com\urfave\cli 6 | 7 | environment: 8 | GOPATH: C:\gopath 9 | GOVERSION: 1.6 10 | PYTHON: C:\Python27-x64 11 | PYTHON_VERSION: 2.7.x 12 | PYTHON_ARCH: 64 13 | 14 | install: 15 | - set PATH=%GOPATH%\bin;C:\go\bin;%PATH% 16 | - go version 17 | - go env 18 | - go get github.com/urfave/gfmrun/... 19 | - go get -v -t ./... 20 | 21 | build_script: 22 | - python runtests vet 23 | - python runtests test 24 | - python runtests gfmrun 25 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/category.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | // CommandCategories is a slice of *CommandCategory. 4 | type CommandCategories []*CommandCategory 5 | 6 | // CommandCategory is a category containing commands. 7 | type CommandCategory struct { 8 | Name string 9 | Commands Commands 10 | } 11 | 12 | func (c CommandCategories) Less(i, j int) bool { 13 | return c[i].Name < c[j].Name 14 | } 15 | 16 | func (c CommandCategories) Len() int { 17 | return len(c) 18 | } 19 | 20 | func (c CommandCategories) Swap(i, j int) { 21 | c[i], c[j] = c[j], c[i] 22 | } 23 | 24 | // AddCommand adds a command to a category. 25 | func (c CommandCategories) AddCommand(category string, command Command) CommandCategories { 26 | for _, commandCategory := range c { 27 | if commandCategory.Name == category { 28 | commandCategory.Commands = append(commandCategory.Commands, command) 29 | return c 30 | } 31 | } 32 | return append(c, &CommandCategory{Name: category, Commands: []Command{command}}) 33 | } 34 | 35 | // VisibleCommands returns a slice of the Commands with Hidden=false 36 | func (c *CommandCategory) VisibleCommands() []Command { 37 | ret := []Command{} 38 | for _, command := range c.Commands { 39 | if !command.Hidden { 40 | ret = append(ret, command) 41 | } 42 | } 43 | return ret 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/cli.go: -------------------------------------------------------------------------------- 1 | // Package cli provides a minimal framework for creating and organizing command line 2 | // Go applications. cli is designed to be easy to understand and write, the most simple 3 | // cli application can be written as follows: 4 | // func main() { 5 | // cli.NewApp().Run(os.Args) 6 | // } 7 | // 8 | // Of course this application does not do much, so let's make this an actual application: 9 | // func main() { 10 | // app := cli.NewApp() 11 | // app.Name = "greet" 12 | // app.Usage = "say a greeting" 13 | // app.Action = func(c *cli.Context) error { 14 | // println("Greetings") 15 | // } 16 | // 17 | // app.Run(os.Args) 18 | // } 19 | package cli 20 | 21 | //go:generate python ./generate-flag-types cli -i flag-types.json -o flag_generated.go 22 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/funcs.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | // BashCompleteFunc is an action to execute when the bash-completion flag is set 4 | type BashCompleteFunc func(*Context) 5 | 6 | // BeforeFunc is an action to execute before any subcommands are run, but after 7 | // the context is ready if a non-nil error is returned, no subcommands are run 8 | type BeforeFunc func(*Context) error 9 | 10 | // AfterFunc is an action to execute after any subcommands are run, but after the 11 | // subcommand has finished it is run even if Action() panics 12 | type AfterFunc func(*Context) error 13 | 14 | // ActionFunc is the action to execute when no subcommands are specified 15 | type ActionFunc func(*Context) error 16 | 17 | // CommandNotFoundFunc is executed if the proper command cannot be found 18 | type CommandNotFoundFunc func(*Context, string) 19 | 20 | // OnUsageErrorFunc is executed if an usage error occurs. This is useful for displaying 21 | // customized usage error messages. This function is able to replace the 22 | // original error messages. If this function is not set, the "Incorrect usage" 23 | // is displayed and the execution is interrupted. 24 | type OnUsageErrorFunc func(context *Context, err error, isSubcommand bool) error 25 | 26 | // FlagStringFunc is used by the help generation to display a flag, which is 27 | // expected to be a single line. 28 | type FlagStringFunc func(Flag) string 29 | -------------------------------------------------------------------------------- /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/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/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 ·SyscallNoError(SB),NOSPLIT,$0-48 19 | BL runtime·entersyscall(SB) 20 | MOVD a1+8(FP), R3 21 | MOVD a2+16(FP), R4 22 | MOVD a3+24(FP), R5 23 | MOVD R0, R6 24 | MOVD R0, R7 25 | MOVD R0, R8 26 | MOVD trap+0(FP), R9 // syscall entry 27 | SYSCALL R9 28 | MOVD R3, r1+32(FP) 29 | MOVD R4, r2+40(FP) 30 | BL runtime·exitsyscall(SB) 31 | RET 32 | 33 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 34 | MOVD a1+8(FP), R3 35 | MOVD a2+16(FP), R4 36 | MOVD a3+24(FP), R5 37 | MOVD R0, R6 38 | MOVD R0, R7 39 | MOVD R0, R8 40 | MOVD trap+0(FP), R9 // syscall entry 41 | SYSCALL R9 42 | MOVD R3, r1+32(FP) 43 | MOVD R4, r2+40(FP) 44 | RET 45 | -------------------------------------------------------------------------------- /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_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 | HCI_CHANNEL_LOGGING = 4 27 | ) 28 | 29 | // Socketoption Level 30 | const ( 31 | SOL_BLUETOOTH = 0x112 32 | SOL_HCI = 0x0 33 | SOL_L2CAP = 0x6 34 | SOL_RFCOMM = 0x12 35 | SOL_SCO = 0x11 36 | ) 37 | -------------------------------------------------------------------------------- /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 aix 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/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 riscv64 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 aix 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/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 | // +build !aix 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #define _STRINGIFY2_(x) #x 13 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 14 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 15 | 16 | // Call syscall from C code because the gccgo support for calling from 17 | // Go to C does not support varargs functions. 18 | 19 | struct ret { 20 | uintptr_t r; 21 | uintptr_t err; 22 | }; 23 | 24 | struct ret 25 | 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) 26 | { 27 | struct ret r; 28 | 29 | errno = 0; 30 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 31 | r.err = errno; 32 | return r; 33 | } 34 | 35 | uintptr_t 36 | 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) 37 | { 38 | return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 39 | } 40 | -------------------------------------------------------------------------------- /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/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 darwin,race linux,race freebsd,race 6 | 7 | package unix 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/unix/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 aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly 6 | 7 | package unix 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/unix/sockcmsg_linux.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 | // Socket control messages 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // UnixCredentials encodes credentials into a socket control message 12 | // for sending to another process. This can be used for 13 | // authentication. 14 | func UnixCredentials(ucred *Ucred) []byte { 15 | b := make([]byte, CmsgSpace(SizeofUcred)) 16 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 17 | h.Level = SOL_SOCKET 18 | h.Type = SCM_CREDENTIALS 19 | h.SetLen(CmsgLen(SizeofUcred)) 20 | *(*Ucred)(h.data(0)) = *ucred 21 | return b 22 | } 23 | 24 | // ParseUnixCredentials decodes a socket control message that contains 25 | // credentials in a Ucred structure. To receive such a message, the 26 | // SO_PASSCRED option must be enabled on the socket. 27 | func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) { 28 | if m.Header.Level != SOL_SOCKET { 29 | return nil, EINVAL 30 | } 31 | if m.Header.Type != SCM_CREDENTIALS { 32 | return nil, EINVAL 33 | } 34 | ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0])) 35 | return &ucred, nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + uitoa(uint(-val)) 12 | } 13 | return uitoa(uint(val)) 14 | } 15 | 16 | func uitoa(val uint) string { 17 | var buf [32]byte // big enough for int64 18 | i := len(buf) - 1 19 | for val >= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_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 | ) 10 | 11 | func ptrace(request int, pid int, addr uintptr, data uintptr) error { 12 | return ENOTSUP 13 | } 14 | 15 | func setTimespec(sec, nsec int64) Timespec { 16 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 17 | } 18 | 19 | func setTimeval(sec, usec int64) Timeval { 20 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 21 | } 22 | 23 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 24 | k.Ident = uint32(fd) 25 | k.Filter = int16(mode) 26 | k.Flags = uint16(flags) 27 | } 28 | 29 | func (iov *Iovec) SetLen(length int) { 30 | iov.Len = uint32(length) 31 | } 32 | 33 | func (msghdr *Msghdr) SetControllen(length int) { 34 | msghdr.Controllen = uint32(length) 35 | } 36 | 37 | func (msghdr *Msghdr) SetIovlen(length int) { 38 | msghdr.Iovlen = int32(length) 39 | } 40 | 41 | func (cmsg *Cmsghdr) SetLen(length int) { 42 | cmsg.Len = uint32(length) 43 | } 44 | 45 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 46 | 47 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 48 | // of darwin/arm the syscall is called sysctl instead of __sysctl. 49 | const SYS___SYSCTL = SYS_SYSCTL 50 | 51 | //sys Fstat(fd int, stat *Stat_t) (err error) 52 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) 53 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) 54 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT 55 | //sys Lstat(path string, stat *Stat_t) (err error) 56 | //sys Stat(path string, stat *Stat_t) (err error) 57 | //sys Statfs(path string, stat *Statfs_t) (err error) 58 | -------------------------------------------------------------------------------- /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 (msghdr *Msghdr) SetIovlen(length int) { 37 | msghdr.Iovlen = int32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | 44 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 45 | var writtenOut uint64 = 0 46 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 47 | 48 | written = int(writtenOut) 49 | 50 | if e1 != 0 { 51 | err = e1 52 | } 53 | return 54 | } 55 | 56 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 57 | -------------------------------------------------------------------------------- /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_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 (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /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 (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /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 (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /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 (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = uint32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | 39 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 40 | // of openbsd/386 the syscall is called sysctl instead of __sysctl. 41 | const SYS___SYSCTL = SYS_SYSCTL 42 | -------------------------------------------------------------------------------- /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 (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = uint32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | 39 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 40 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 41 | const SYS___SYSCTL = SYS_SYSCTL 42 | -------------------------------------------------------------------------------- /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 (msghdr *Msghdr) SetIovlen(length int) { 22 | msghdr.Iovlen = int32(length) 23 | } 24 | 25 | func (cmsg *Cmsghdr) SetLen(length int) { 26 | cmsg.Len = uint32(length) 27 | } 28 | -------------------------------------------------------------------------------- /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,!ppc64le,!ppc64 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/text/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/encoding/japanese/all.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 japanese 6 | 7 | import ( 8 | "golang.org/x/text/encoding" 9 | ) 10 | 11 | // All is a list of all defined encodings in this package. 12 | var All = []encoding.Encoding{EUCJP, ISO2022JP, ShiftJIS} 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/encoding/simplifiedchinese/all.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 simplifiedchinese 6 | 7 | import ( 8 | "golang.org/x/text/encoding" 9 | ) 10 | 11 | // All is a list of all defined encodings in this package. 12 | var All = []encoding.Encoding{GB18030, GBK, HZGB2312} 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/Makefile: -------------------------------------------------------------------------------- 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 | CLEANFILES+=maketables 6 | 7 | maketables: maketables.go 8 | go build $^ 9 | 10 | tables: maketables 11 | ./maketables > tables.go 12 | gofmt -w -s tables.go 13 | 14 | # Build (but do not run) maketables during testing, 15 | # just to make sure it still compiles. 16 | testshort: maketables 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/common.go: -------------------------------------------------------------------------------- 1 | // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. 2 | 3 | package language 4 | 5 | // This file contains code common to the maketables.go and the package code. 6 | 7 | // langAliasType is the type of an alias in langAliasMap. 8 | type langAliasType int8 9 | 10 | const ( 11 | langDeprecated langAliasType = iota 12 | langMacro 13 | langLegacy 14 | 15 | langAliasTypeUnknown langAliasType = -1 16 | ) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/go1_1.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 !go1.2 6 | 7 | package language 8 | 9 | import "sort" 10 | 11 | func sortStable(s sort.Interface) { 12 | ss := stableSort{ 13 | s: s, 14 | pos: make([]int, s.Len()), 15 | } 16 | for i := range ss.pos { 17 | ss.pos[i] = i 18 | } 19 | sort.Sort(&ss) 20 | } 21 | 22 | type stableSort struct { 23 | s sort.Interface 24 | pos []int 25 | } 26 | 27 | func (s *stableSort) Len() int { 28 | return len(s.pos) 29 | } 30 | 31 | func (s *stableSort) Less(i, j int) bool { 32 | return s.s.Less(i, j) || !s.s.Less(j, i) && s.pos[i] < s.pos[j] 33 | } 34 | 35 | func (s *stableSort) Swap(i, j int) { 36 | s.s.Swap(i, j) 37 | s.pos[i], s.pos[j] = s.pos[j], s.pos[i] 38 | } 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/go1_2.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 go1.2 6 | 7 | package language 8 | 9 | import "sort" 10 | 11 | var sortStable = sort.Stable 12 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - "1.4.x" 5 | - "1.5.x" 6 | - "1.6.x" 7 | - "1.7.x" 8 | - "1.8.x" 9 | - "1.9.x" 10 | - "1.10.x" 11 | - "1.11.x" 12 | - "1.12.x" 13 | - "1.13.x" 14 | - "tip" 15 | 16 | go_import_path: gopkg.in/yaml.v2 17 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/LICENSE.libyaml: -------------------------------------------------------------------------------- 1 | The following files were ported to Go from C files of libyaml, and thus 2 | are still covered by their original copyright and license: 3 | 4 | apic.go 5 | emitterc.go 6 | parserc.go 7 | readerc.go 8 | scannerc.go 9 | writerc.go 10 | yamlh.go 11 | yamlprivateh.go 12 | 13 | Copyright (c) 2006 Kirill Simonov 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/writerc.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | // Set the writer error and return false. 4 | func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { 5 | emitter.error = yaml_WRITER_ERROR 6 | emitter.problem = problem 7 | return false 8 | } 9 | 10 | // Flush the output buffer. 11 | func yaml_emitter_flush(emitter *yaml_emitter_t) bool { 12 | if emitter.write_handler == nil { 13 | panic("write handler not set") 14 | } 15 | 16 | // Check if the buffer is empty. 17 | if emitter.buffer_pos == 0 { 18 | return true 19 | } 20 | 21 | if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { 22 | return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) 23 | } 24 | emitter.buffer_pos = 0 25 | return true 26 | } 27 | --------------------------------------------------------------------------------