├── .dockerignore ├── .github └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .pullapprove.yml ├── .travis.yml ├── CHANGELOG.md ├── Dockerfile.godep ├── Dockerfile.linux ├── Dockerfile.test ├── Godeps ├── Godeps.json └── Readme ├── LICENSE ├── MIGRATING.md ├── Makefile ├── README.md ├── RELEASE_NOTES.md ├── aws ├── cloudformation │ ├── cloud_formation.go │ └── describe_stack_events.go ├── ec2 │ └── ec2.go ├── elb │ └── elb.go └── util │ ├── cfn_sort.go │ ├── get_stacks.go │ ├── suite_test.go │ ├── util.go │ └── util_test.go ├── aws_session └── aws_session.go ├── cfn ├── README.md ├── auto_scaling │ ├── auto_scaling_group.go │ └── launch_configuration.go ├── cfn.go ├── cloudformation │ ├── wait_condition.go │ └── wait_condition_handle.go ├── elastic_load_balancing │ └── load_balancer.go ├── iam │ ├── instance_profile.go │ └── role.go ├── stack_states.go └── types.go ├── cfn_template ├── README.md ├── auto_scaling.go ├── ec2.go └── mappings.go ├── commands ├── bootstrap │ ├── elb.go │ ├── iam.go │ └── s3.go ├── build │ ├── clean.go │ ├── hook.go │ ├── notify.go │ ├── pack.go │ ├── promote.go │ ├── provision.go │ └── prune.go ├── commands.go ├── dev │ ├── create_stack.go │ ├── sync_stack.go │ └── update.go ├── gen │ └── docs.go ├── help │ ├── aws_network.go │ ├── debug.go │ └── issue.go └── host │ ├── daemon.go │ ├── docker.go │ ├── haproxy.go │ ├── rsyslog.go │ ├── secrets.go │ ├── signal.go │ └── svc_payload.go ├── conf ├── README.md ├── conf.go ├── environment.go ├── region.go └── validate.go ├── constants └── constants.go ├── daemon ├── .dockerignore ├── .gitignore ├── CHANGELOG.md ├── Makefile ├── README.md ├── api │ ├── aws.go │ ├── misc.go │ └── routes.go ├── config │ └── config.go ├── daemon.go ├── elb_registration │ └── elb_registration.go ├── flags │ └── flags.go ├── http │ └── status.go ├── identity │ └── identity.go ├── main │ └── main.go ├── middleware │ ├── context.go │ ├── log.go │ ├── profile.go │ ├── types.go │ └── version.go └── wait_handle │ └── wait_handle.go ├── developing.md ├── docker └── util │ ├── suite_test.go │ ├── util.go │ └── util_test.go ├── docs ├── detailed_design │ ├── cfn-customization.md │ ├── ci-cd-integration.md │ ├── components.md │ ├── config-reference.md │ ├── container-config.md │ ├── deployment-hooks.md │ ├── docker-builder-pattern.md │ ├── hooks │ │ ├── ec2-bootstrap.md │ │ ├── post-pack.md │ │ ├── post-promote.md │ │ ├── post-provision.md │ │ ├── post-prune.md │ │ ├── pre-pack.md │ │ ├── pre-promote.md │ │ ├── pre-provision.md │ │ └── pre-prune.md │ ├── hotswap.md │ ├── platform-service.md │ ├── security.md │ ├── service-payload.md │ └── versions.md ├── faq.md ├── readme.md └── troubleshoot.md ├── files ├── README.md ├── cloud-init.json ├── gen │ └── files.go ├── haproxy.cfg ├── limits.conf ├── logrotate-porter ├── motd ├── pamd.crond ├── porter_bootstrap ├── porter_get_secrets ├── porter_hotswap ├── rsyslog-porter.conf └── rsyslog.conf ├── hook └── hook.go ├── logger └── logger.go ├── main.go ├── promote └── promote.go ├── provision ├── README.md ├── api.go ├── ensure_resources.go ├── map_resource.go ├── map_resource_test.go ├── pack.go ├── stack_creator.go ├── stack_creator_secrets.go └── suite_test.go ├── provision_state └── provision_state.go ├── prune └── prune.go ├── release_porter ├── sample_project ├── .dockerignore ├── .gitignore ├── .porter │ ├── cloudformation.json │ └── config ├── Dockerfile ├── Dockerfile.build ├── main.go └── readme.md ├── secrets ├── download.go ├── secrets.go ├── secrets_test.go └── suite_test.go ├── stdin └── stdin.go ├── testintegration ├── .dockerignore ├── .gitignore ├── .porter │ └── config ├── Dockerfile ├── Dockerfile.cmd ├── Dockerfile.inet ├── Dockerfile.inet.build ├── GoCD.json ├── Locust.json ├── cis_ami.json ├── hooks │ ├── ec2-bootstrap │ ├── ec2-bootstrap.cmd │ ├── post-pack-fail │ ├── post-pack-fail.cmd │ ├── pre-pack │ ├── pre-pack.cmd │ ├── user-defined │ └── user-defined.cmd ├── load.py ├── main.go ├── plugins │ ├── post-pack │ ├── post-pack.cmd │ ├── user-defined │ └── user-defined.cmd ├── promote_loop.sh ├── readme.md ├── sample_test.go ├── secrets.env-file └── vpc.json ├── util ├── ignore.go ├── retry.go ├── retry_test.go └── suite_test.go └── vendor ├── github.com ├── armon │ └── go-radix │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ └── radix.go ├── aws │ └── aws-sdk-go │ │ ├── LICENSE.txt │ │ ├── NOTICE.txt │ │ ├── aws │ │ ├── awserr │ │ │ ├── error.go │ │ │ └── types.go │ │ ├── awsutil │ │ │ ├── copy.go │ │ │ ├── equal.go │ │ │ ├── path_value.go │ │ │ ├── prettify.go │ │ │ └── string_value.go │ │ ├── client │ │ │ ├── client.go │ │ │ ├── default_retryer.go │ │ │ └── metadata │ │ │ │ └── client_info.go │ │ ├── config.go │ │ ├── convert_types.go │ │ ├── corehandlers │ │ │ ├── handlers.go │ │ │ └── param_validator.go │ │ ├── credentials │ │ │ ├── chain_provider.go │ │ │ ├── credentials.go │ │ │ ├── ec2rolecreds │ │ │ │ └── ec2_role_provider.go │ │ │ ├── endpointcreds │ │ │ │ └── provider.go │ │ │ ├── env_provider.go │ │ │ ├── example.ini │ │ │ ├── shared_credentials_provider.go │ │ │ ├── static_provider.go │ │ │ └── stscreds │ │ │ │ └── assume_role_provider.go │ │ ├── defaults │ │ │ └── defaults.go │ │ ├── ec2metadata │ │ │ ├── api.go │ │ │ └── service.go │ │ ├── endpoints │ │ │ ├── decode.go │ │ │ ├── defaults.go │ │ │ ├── doc.go │ │ │ ├── endpoints.go │ │ │ ├── v3model.go │ │ │ └── v3model_codegen.go │ │ ├── errors.go │ │ ├── logger.go │ │ ├── request │ │ │ ├── handlers.go │ │ │ ├── http_request.go │ │ │ ├── offset_reader.go │ │ │ ├── request.go │ │ │ ├── request_1_7.go │ │ │ ├── request_1_8.go │ │ │ ├── request_pagination.go │ │ │ ├── retryer.go │ │ │ └── validation.go │ │ ├── session │ │ │ ├── doc.go │ │ │ ├── env_config.go │ │ │ ├── session.go │ │ │ └── shared_config.go │ │ ├── signer │ │ │ └── v4 │ │ │ │ ├── header_rules.go │ │ │ │ ├── uri_path.go │ │ │ │ └── v4.go │ │ ├── types.go │ │ └── version.go │ │ ├── private │ │ ├── protocol │ │ │ ├── ec2query │ │ │ │ ├── build.go │ │ │ │ └── unmarshal.go │ │ │ ├── idempotency.go │ │ │ ├── query │ │ │ │ ├── build.go │ │ │ │ ├── queryutil │ │ │ │ │ └── queryutil.go │ │ │ │ ├── unmarshal.go │ │ │ │ └── unmarshal_error.go │ │ │ ├── rest │ │ │ │ ├── build.go │ │ │ │ ├── payload.go │ │ │ │ └── unmarshal.go │ │ │ ├── restxml │ │ │ │ └── restxml.go │ │ │ ├── unmarshal.go │ │ │ └── xml │ │ │ │ └── xmlutil │ │ │ │ ├── build.go │ │ │ │ ├── unmarshal.go │ │ │ │ └── xml_to_struct.go │ │ └── waiter │ │ │ └── waiter.go │ │ └── service │ │ ├── autoscaling │ │ ├── api.go │ │ ├── errors.go │ │ ├── service.go │ │ └── waiters.go │ │ ├── cloudformation │ │ ├── api.go │ │ ├── errors.go │ │ ├── service.go │ │ └── waiters.go │ │ ├── ec2 │ │ ├── api.go │ │ ├── customizations.go │ │ ├── errors.go │ │ ├── service.go │ │ └── waiters.go │ │ ├── elb │ │ ├── api.go │ │ ├── errors.go │ │ ├── service.go │ │ └── waiters.go │ │ ├── iam │ │ ├── api.go │ │ ├── errors.go │ │ ├── service.go │ │ └── waiters.go │ │ ├── s3 │ │ ├── api.go │ │ ├── bucket_location.go │ │ ├── content_md5.go │ │ ├── customizations.go │ │ ├── errors.go │ │ ├── host_style_bucket.go │ │ ├── platform_handlers.go │ │ ├── platform_handlers_go1.6.go │ │ ├── s3iface │ │ │ └── interface.go │ │ ├── s3manager │ │ │ ├── doc.go │ │ │ ├── download.go │ │ │ └── upload.go │ │ ├── service.go │ │ ├── sse.go │ │ ├── statusok_error.go │ │ ├── unmarshal_error.go │ │ └── waiters.go │ │ ├── sqs │ │ ├── api.go │ │ ├── checksums.go │ │ ├── customizations.go │ │ ├── errors.go │ │ └── service.go │ │ └── sts │ │ ├── api.go │ │ ├── customizations.go │ │ ├── errors.go │ │ └── service.go ├── go-ini │ └── ini │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── README_ZH.md │ │ ├── ini.go │ │ ├── key.go │ │ ├── parser.go │ │ ├── section.go │ │ └── struct.go ├── jmespath │ └── go-jmespath │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── api.go │ │ ├── astnodetype_string.go │ │ ├── compliance │ │ ├── basic.json │ │ ├── boolean.json │ │ ├── current.json │ │ ├── escape.json │ │ ├── filters.json │ │ ├── functions.json │ │ ├── identifiers.json │ │ ├── indices.json │ │ ├── literal.json │ │ ├── multiselect.json │ │ ├── ormatch.json │ │ ├── pipe.json │ │ ├── slice.json │ │ ├── syntax.json │ │ ├── unicode.json │ │ └── wildcard.json │ │ ├── functions.go │ │ ├── fuzz │ │ └── jmespath.go │ │ ├── interpreter.go │ │ ├── lexer.go │ │ ├── parser.go │ │ ├── toktype_string.go │ │ └── util.go ├── julienschmidt │ └── httprouter │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── path.go │ │ ├── router.go │ │ └── tree.go ├── mattn │ ├── go-colorable │ │ ├── LICENSE │ │ ├── README.md │ │ ├── colorable_others.go │ │ └── colorable_windows.go │ └── go-isatty │ │ ├── LICENSE │ │ ├── README.md │ │ ├── doc.go │ │ ├── isatty_appengine.go │ │ ├── isatty_bsd.go │ │ ├── isatty_linux.go │ │ ├── isatty_solaris.go │ │ └── isatty_windows.go ├── onsi │ ├── ginkgo │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── config │ │ │ └── config.go │ │ ├── extensions │ │ │ └── table │ │ │ │ ├── table.go │ │ │ │ └── table_entry.go │ │ ├── ginkgo │ │ │ ├── bootstrap_command.go │ │ │ ├── build_command.go │ │ │ ├── convert │ │ │ │ ├── ginkgo_ast_nodes.go │ │ │ │ ├── import.go │ │ │ │ ├── package_rewriter.go │ │ │ │ ├── test_finder.go │ │ │ │ ├── testfile_rewriter.go │ │ │ │ └── testing_t_rewriter.go │ │ │ ├── convert_command.go │ │ │ ├── generate_command.go │ │ │ ├── help_command.go │ │ │ ├── interrupthandler │ │ │ │ ├── interrupt_handler.go │ │ │ │ ├── sigquit_swallower_unix.go │ │ │ │ └── sigquit_swallower_windows.go │ │ │ ├── main.go │ │ │ ├── nodot │ │ │ │ └── nodot.go │ │ │ ├── nodot_command.go │ │ │ ├── notifications.go │ │ │ ├── run_command.go │ │ │ ├── run_watch_and_build_command_flags.go │ │ │ ├── suite_runner.go │ │ │ ├── testrunner │ │ │ │ ├── log_writer.go │ │ │ │ ├── run_result.go │ │ │ │ └── test_runner.go │ │ │ ├── testsuite │ │ │ │ └── test_suite.go │ │ │ ├── unfocus_command.go │ │ │ ├── version_command.go │ │ │ ├── watch │ │ │ │ ├── delta.go │ │ │ │ ├── delta_tracker.go │ │ │ │ ├── dependencies.go │ │ │ │ ├── package_hash.go │ │ │ │ ├── package_hashes.go │ │ │ │ └── suite.go │ │ │ └── watch_command.go │ │ ├── ginkgo_dsl.go │ │ ├── integration │ │ │ └── integration.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_unix.go │ │ │ ├── spec │ │ │ │ ├── index_computer.go │ │ │ │ ├── spec.go │ │ │ │ └── specs.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 │ │ │ └── teamcity_reporter.go │ │ └── types │ │ │ ├── code_location.go │ │ │ ├── synchronization.go │ │ │ └── types.go │ └── gomega │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.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_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 ├── pborman │ └── uuid │ │ ├── .travis.yml │ │ ├── CONTRIBUTING.md │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dce.go │ │ ├── doc.go │ │ ├── hash.go │ │ ├── json.go │ │ ├── node.go │ │ ├── sql.go │ │ ├── time.go │ │ ├── util.go │ │ ├── uuid.go │ │ ├── version1.go │ │ └── version4.go └── phylake │ └── go-cli │ ├── .travis.yml │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── cli.go │ ├── cmd │ ├── default.go │ ├── readme.md │ └── root.go │ └── example │ └── main.go ├── golang.org └── x │ ├── net │ ├── LICENSE │ ├── PATENTS │ └── context │ │ ├── context.go │ │ └── ctxhttp │ │ ├── cancelreq.go │ │ ├── cancelreq_go14.go │ │ └── ctxhttp.go │ └── sys │ ├── LICENSE │ ├── PATENTS │ └── unix │ ├── .gitignore │ ├── bluetooth_linux.go │ ├── constants.go │ ├── env_unix.go │ ├── env_unset.go │ ├── flock.go │ ├── flock_linux_32bit.go │ ├── gccgo.go │ ├── gccgo_c.c │ ├── gccgo_linux_amd64.go │ ├── mkall.sh │ ├── mkerrors.sh │ ├── mkpost.go │ ├── mksyscall.pl │ ├── mksyscall_solaris.pl │ ├── mksysctl_openbsd.pl │ ├── mksysnum_darwin.pl │ ├── mksysnum_dragonfly.pl │ ├── mksysnum_freebsd.pl │ ├── mksysnum_linux.pl │ ├── mksysnum_netbsd.pl │ ├── mksysnum_openbsd.pl │ ├── race.go │ ├── race0.go │ ├── sockcmsg_linux.go │ ├── sockcmsg_unix.go │ ├── str.go │ ├── syscall.go │ ├── syscall_bsd.go │ ├── syscall_darwin.go │ ├── syscall_darwin_386.go │ ├── syscall_darwin_amd64.go │ ├── syscall_darwin_arm.go │ ├── syscall_darwin_arm64.go │ ├── syscall_dragonfly.go │ ├── syscall_dragonfly_amd64.go │ ├── syscall_freebsd.go │ ├── syscall_freebsd_386.go │ ├── syscall_freebsd_amd64.go │ ├── syscall_freebsd_arm.go │ ├── syscall_linux.go │ ├── syscall_linux_386.go │ ├── syscall_linux_amd64.go │ ├── syscall_linux_arm.go │ ├── syscall_linux_arm64.go │ ├── syscall_linux_mips64x.go │ ├── syscall_linux_ppc64x.go │ ├── syscall_linux_s390x.go │ ├── syscall_netbsd.go │ ├── syscall_netbsd_386.go │ ├── syscall_netbsd_amd64.go │ ├── syscall_netbsd_arm.go │ ├── syscall_no_getwd.go │ ├── syscall_openbsd.go │ ├── syscall_openbsd_386.go │ ├── syscall_openbsd_amd64.go │ ├── syscall_solaris.go │ ├── syscall_solaris_amd64.go │ ├── syscall_unix.go │ ├── types_darwin.go │ ├── types_dragonfly.go │ ├── types_freebsd.go │ ├── types_linux.go │ ├── types_netbsd.go │ ├── types_openbsd.go │ ├── types_solaris.go │ ├── zerrors_darwin_386.go │ ├── zerrors_darwin_amd64.go │ ├── zerrors_darwin_arm.go │ ├── zerrors_darwin_arm64.go │ ├── zerrors_dragonfly_amd64.go │ ├── zerrors_freebsd_386.go │ ├── zerrors_freebsd_amd64.go │ ├── zerrors_freebsd_arm.go │ ├── zerrors_linux_386.go │ ├── zerrors_linux_amd64.go │ ├── zerrors_linux_arm.go │ ├── zerrors_linux_arm64.go │ ├── zerrors_linux_mips64.go │ ├── zerrors_linux_mips64le.go │ ├── zerrors_linux_ppc64.go │ ├── zerrors_linux_ppc64le.go │ ├── zerrors_linux_s390x.go │ ├── zerrors_netbsd_386.go │ ├── zerrors_netbsd_amd64.go │ ├── zerrors_netbsd_arm.go │ ├── zerrors_openbsd_386.go │ ├── zerrors_openbsd_amd64.go │ ├── zerrors_solaris_amd64.go │ ├── zsyscall_darwin_386.go │ ├── zsyscall_darwin_amd64.go │ ├── zsyscall_darwin_arm.go │ ├── zsyscall_darwin_arm64.go │ ├── zsyscall_dragonfly_amd64.go │ ├── zsyscall_freebsd_386.go │ ├── zsyscall_freebsd_amd64.go │ ├── zsyscall_freebsd_arm.go │ ├── zsyscall_linux_386.go │ ├── zsyscall_linux_amd64.go │ ├── zsyscall_linux_arm.go │ ├── zsyscall_linux_arm64.go │ ├── zsyscall_linux_mips64.go │ ├── zsyscall_linux_mips64le.go │ ├── zsyscall_linux_ppc64.go │ ├── zsyscall_linux_ppc64le.go │ ├── zsyscall_linux_s390x.go │ ├── zsyscall_netbsd_386.go │ ├── zsyscall_netbsd_amd64.go │ ├── zsyscall_netbsd_arm.go │ ├── zsyscall_openbsd_386.go │ ├── zsyscall_openbsd_amd64.go │ ├── zsyscall_solaris_amd64.go │ ├── zsysctl_openbsd.go │ ├── zsysnum_darwin_386.go │ ├── zsysnum_darwin_amd64.go │ ├── zsysnum_darwin_arm.go │ ├── zsysnum_darwin_arm64.go │ ├── zsysnum_dragonfly_amd64.go │ ├── zsysnum_freebsd_386.go │ ├── zsysnum_freebsd_amd64.go │ ├── zsysnum_freebsd_arm.go │ ├── zsysnum_linux_386.go │ ├── zsysnum_linux_amd64.go │ ├── zsysnum_linux_arm.go │ ├── zsysnum_linux_arm64.go │ ├── zsysnum_linux_mips64.go │ ├── zsysnum_linux_mips64le.go │ ├── zsysnum_linux_ppc64.go │ ├── zsysnum_linux_ppc64le.go │ ├── zsysnum_linux_s390x.go │ ├── zsysnum_netbsd_386.go │ ├── zsysnum_netbsd_amd64.go │ ├── zsysnum_netbsd_arm.go │ ├── zsysnum_openbsd_386.go │ ├── zsysnum_openbsd_amd64.go │ ├── zsysnum_solaris_amd64.go │ ├── ztypes_darwin_386.go │ ├── ztypes_darwin_amd64.go │ ├── ztypes_darwin_arm.go │ ├── ztypes_darwin_arm64.go │ ├── ztypes_dragonfly_amd64.go │ ├── ztypes_freebsd_386.go │ ├── ztypes_freebsd_amd64.go │ ├── ztypes_freebsd_arm.go │ ├── ztypes_linux_386.go │ ├── ztypes_linux_amd64.go │ ├── ztypes_linux_arm.go │ ├── ztypes_linux_arm64.go │ ├── ztypes_linux_mips64.go │ ├── ztypes_linux_mips64le.go │ ├── ztypes_linux_ppc64.go │ ├── ztypes_linux_ppc64le.go │ ├── ztypes_linux_s390x.go │ ├── ztypes_netbsd_386.go │ ├── ztypes_netbsd_amd64.go │ ├── ztypes_netbsd_arm.go │ ├── ztypes_openbsd_386.go │ ├── ztypes_openbsd_amd64.go │ └── ztypes_solaris_amd64.go └── gopkg.in ├── inconshreveable └── log15.v2 │ ├── .travis.yml │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── README.md │ ├── RELEASING.md │ ├── doc.go │ ├── format.go │ ├── handler.go │ ├── handler_appengine.go │ ├── handler_other.go │ ├── logger.go │ ├── root.go │ ├── stack │ ├── stack.go │ ├── stack_pool.go │ └── stack_pool_chan.go │ ├── syslog.go │ └── term │ ├── LICENSE │ ├── terminal_appengine.go │ ├── terminal_darwin.go │ ├── terminal_freebsd.go │ ├── terminal_linux.go │ ├── terminal_notwindows.go │ ├── terminal_openbsd.go │ └── terminal_windows.go └── 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 /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .porter 3 | bin 4 | testintegration 5 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Changelog 2 | 3 | Fill this in and update CHANGELOG.md 4 | 5 | ## Issues fixed or closed 6 | 7 | ## Questions (open the PR then click the check boxes) 8 | 9 | Did you update the documentation related to your changes? 10 | 11 | - [ ] Yes 12 | - [ ] My changes were not already documented 13 | 14 | Did you run `make` _before_ committing code and opening this PR? 15 | 16 | - [ ] Yes 17 | - [ ] I didn't change any code 18 | 19 | Did you run `porter create-stack` and `porter sync-stack` to verify provisioning 20 | works? 21 | 22 | - [ ] Yes 23 | - [ ] N/A 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | 26 | # porter entries 27 | bin 28 | *_generated.go 29 | # sed -i 30 | *.go-e 31 | -------------------------------------------------------------------------------- /.pullapprove.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | always_pending: 4 | title_regex: '(WIP|wip)' 5 | explanation: 'This PR is a work in progress...' 6 | 7 | group_defaults: 8 | approve_by_comment: 9 | enabled: true 10 | approve_regex: '^(Approved|:shipit:|:\+1:)' 11 | conditions: 12 | files: 13 | - "*.go" # only review source 14 | - ".pullapprove.yml" # and this file 15 | 16 | groups: 17 | owner: 18 | required: 1 19 | users: 20 | - phylake 21 | reset_on_push: 22 | enabled: true 23 | reset_on_reopened: 24 | enabled: true 25 | reviewers: 26 | required: 1 27 | users: 28 | - davepersing 29 | - gregoryfischer 30 | - jfieber 31 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.6 5 | 6 | before_install: 7 | - go get github.com/onsi/ginkgo/ginkgo 8 | - go get github.com/onsi/gomega 9 | - make generate 10 | 11 | script: 12 | - GOPATH=$PWD/vendor:$GOPATH ginkgo -r 13 | -------------------------------------------------------------------------------- /Dockerfile.godep: -------------------------------------------------------------------------------- 1 | FROM golang:1.8.7 2 | 3 | RUN go get github.com/tools/godep 4 | -------------------------------------------------------------------------------- /Dockerfile.linux: -------------------------------------------------------------------------------- 1 | FROM golang:1.8.7 2 | 3 | ADD . /go/src/github.com/adobe-platform/porter 4 | WORKDIR /go/src/github.com/adobe-platform/porter 5 | 6 | # Recompile everything and create a static binary 7 | ENV CGO_ENABLED=0 8 | CMD go build -v -a --installsuffix cgo -ldflags '-s' -o /host/porter 9 | -------------------------------------------------------------------------------- /Dockerfile.test: -------------------------------------------------------------------------------- 1 | FROM golang:1.8.7 2 | 3 | RUN go get github.com/onsi/ginkgo/ginkgo 4 | RUN go get github.com/onsi/gomega 5 | 6 | ADD . /go/src/github.com/adobe-platform/porter 7 | WORKDIR /go/src/github.com/adobe-platform/porter 8 | 9 | CMD ginkgo -r -p 10 | -------------------------------------------------------------------------------- /Godeps/Readme: -------------------------------------------------------------------------------- 1 | This directory tree is generated automatically by godep. 2 | 3 | Please do not edit. 4 | 5 | See https://github.com/tools/godep for more information. 6 | -------------------------------------------------------------------------------- /aws/util/cfn_sort.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package util 13 | 14 | import "github.com/aws/aws-sdk-go/service/cloudformation" 15 | 16 | // ByDate sorts Stacks by creation date 17 | type ByDate []*cloudformation.Stack 18 | 19 | func (s ByDate) Len() int { return len(s) } 20 | 21 | func (s ByDate) Swap(i, j int) { s[i], s[j] = s[j], s[i] } 22 | 23 | func (s ByDate) Less(i, j int) bool { 24 | return s[i].CreationTime.Before(*s[j].CreationTime) 25 | } 26 | -------------------------------------------------------------------------------- /aws/util/suite_test.go: -------------------------------------------------------------------------------- 1 | package util_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestSuite(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "AWS Util Suite") 13 | } 14 | -------------------------------------------------------------------------------- /aws/util/util.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package util 13 | 14 | import "github.com/adobe-platform/porter/constants" 15 | 16 | // ValidRegion validates the input an actual AWS region 17 | func ValidRegion(region string) bool { 18 | _, exists := constants.AwsRegions[region] 19 | return exists 20 | } 21 | -------------------------------------------------------------------------------- /aws/util/util_test.go: -------------------------------------------------------------------------------- 1 | package util_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "github.com/adobe-platform/porter/aws/util" 8 | ) 9 | 10 | var _ = Describe("AWS util", func() { 11 | 12 | It("ValidRegion validates regions", func() { 13 | usWest2IsValid := util.ValidRegion("us-west-2") 14 | Expect(usWest2IsValid).To(BeTrue()) 15 | 16 | somethingElse := util.ValidRegion("not a region") 17 | Expect(somethingElse).To(BeFalse()) 18 | }) 19 | 20 | }) 21 | -------------------------------------------------------------------------------- /cfn/README.md: -------------------------------------------------------------------------------- 1 | cfn 2 | === 3 | 4 | This package contains struct definitions for [AWS Resource Types](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) 5 | 6 | **Don't put anything else here.** 7 | 8 | ## Organization 9 | 10 | For a resource type `AWS::ResourceGroup::ResourceName` you can find a lowercase 11 | version of the ResourceGroup as a package, and the lowercase version of 12 | ResourceName as a file. 13 | 14 | ``` 15 | cfn 16 | └── resource_group 17 |    └── resource_name.go 18 | ``` 19 | -------------------------------------------------------------------------------- /cfn/cloudformation/wait_condition.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package cloudformation 13 | 14 | import "github.com/adobe-platform/porter/cfn" 15 | 16 | type ( 17 | WaitCondition struct { 18 | cfn.Resource 19 | 20 | Properties struct { 21 | Handle string 22 | Count string 23 | Timeout string 24 | } 25 | } 26 | ) 27 | 28 | func NewWaitCondition() WaitCondition { 29 | return WaitCondition{ 30 | Resource: cfn.Resource{ 31 | Type: "AWS::CloudFormation::WaitCondition", 32 | }, 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /cfn/cloudformation/wait_condition_handle.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package cloudformation 13 | 14 | import "github.com/adobe-platform/porter/cfn" 15 | 16 | type ( 17 | WaitConditionHandle struct { 18 | cfn.Resource 19 | } 20 | ) 21 | 22 | func NewWaitConditionHandle() WaitConditionHandle { 23 | return WaitConditionHandle{ 24 | Resource: cfn.Resource{ 25 | Type: "AWS::CloudFormation::WaitConditionHandle", 26 | }, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /cfn/iam/instance_profile.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package iam 13 | 14 | import "github.com/adobe-platform/porter/cfn" 15 | 16 | type ( 17 | InstanceProfile struct { 18 | cfn.Resource 19 | 20 | Properties struct { 21 | Path string `json:"Path"` 22 | Roles []Role `json:"Roles"` 23 | } `json:"Properties"` 24 | } 25 | ) 26 | 27 | func NewInstanceProfile() InstanceProfile { 28 | return InstanceProfile{ 29 | Resource: cfn.Resource{ 30 | Type: "AWS::IAM::InstanceProfile", 31 | }, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /cfn_template/README.md: -------------------------------------------------------------------------------- 1 | cfn_template 2 | ============ 3 | 4 | The cfn_template package utilizes the `cfn` and `text/template` packages. 5 | 6 | Its only purpose is to be the `data` for a call to [`template.Execute`](http://golang.org/pkg/text/template/#Template.Execute) 7 | -------------------------------------------------------------------------------- /commands/build/clean.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package build 13 | 14 | import ( 15 | "os/exec" 16 | 17 | "github.com/adobe-platform/porter/constants" 18 | "github.com/phylake/go-cli" 19 | ) 20 | 21 | type CleanCmd struct{} 22 | 23 | func (recv *CleanCmd) Name() string { 24 | return "clean" 25 | } 26 | 27 | func (recv *CleanCmd) ShortHelp() string { 28 | return "Remove porter temporary files" 29 | } 30 | 31 | func (recv *CleanCmd) LongHelp() string { 32 | return "" 33 | } 34 | 35 | func (recv *CleanCmd) SubCommands() []cli.Command { 36 | return nil 37 | } 38 | 39 | func (recv *CleanCmd) Execute(args []string) bool { 40 | err := exec.Command("rm", "-fr", constants.TempDir).Run() 41 | if err != nil { 42 | panic(err) 43 | } 44 | return true 45 | } 46 | -------------------------------------------------------------------------------- /commands/dev/update.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package dev 13 | 14 | import ( 15 | "github.com/phylake/go-cli" 16 | ) 17 | 18 | type UpdateCLICmd struct{} 19 | 20 | func (recv *UpdateCLICmd) Name() string { 21 | return "update" 22 | } 23 | 24 | func (recv *UpdateCLICmd) ShortHelp() string { 25 | return "Update the CLI" 26 | } 27 | 28 | func (recv *UpdateCLICmd) LongHelp() string { 29 | return `Downloads the latest version of the CLI` 30 | } 31 | 32 | func (recv *UpdateCLICmd) SubCommands() []cli.Command { 33 | return nil 34 | } 35 | 36 | func (recv *UpdateCLICmd) Execute(args []string) bool { 37 | // TODO 38 | return false 39 | } 40 | -------------------------------------------------------------------------------- /commands/help/issue.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package help 13 | 14 | import ( 15 | "github.com/phylake/go-cli" 16 | "github.com/phylake/go-cli/cmd" 17 | ) 18 | 19 | const issueLongHelp = `Please report all bugs, enhancement requests, etc. at 20 | https://github.com/adobe-platform/porter/issues 21 | 22 | We would appreciate it if you take the time to see if your issue has already 23 | been filed before creating a new one.` 24 | 25 | var Issue cli.Command 26 | 27 | func init() { 28 | Issue = &cmd.Default{ 29 | NameStr: "issue", 30 | ShortHelpStr: "How to report an issue", 31 | LongHelpStr: issueLongHelp, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /conf/README.md: -------------------------------------------------------------------------------- 1 | conf 2 | ==== 3 | 4 | Why not call this thing `config`? Because you end up calling your variables 5 | something weird like `cfg` or `conf`. 6 | 7 | It's better to have an abbreviated package name than abbreviated variables. 8 | -------------------------------------------------------------------------------- /daemon/.dockerignore: -------------------------------------------------------------------------------- 1 | # This ignore only benefits the Dockerfile.build context 2 | # Our application's context is a tar stream we specify 3 | 4 | *.md 5 | *.js 6 | *.sh 7 | *.gz 8 | *.docker 9 | 10 | node_modules 11 | -------------------------------------------------------------------------------- /daemon/.gitignore: -------------------------------------------------------------------------------- 1 | .MANIFEST.json 2 | *.gz 3 | .provisioning_directives.json 4 | node_modules 5 | *.log 6 | *.docker 7 | -------------------------------------------------------------------------------- /daemon/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2015/07/28 : 1.0 2 | 3 | - FEATURE: enable `~/apps/.provisioning_directives.json` to override real feature data and be updated in real time without provisioning a new stack 4 | - FEATURE: get instance identity API `GET /config/identity` 5 | - FEATURE: get feature sets API `GET /config/features` 6 | - FEATURE: get features in set API `GET /config/features/:feature_set` 7 | - FEATURE: get features in set for user API `GET /config/features/:feature_set/:user_id` 8 | - FEATURE: set key API `PUT /keys/*key` 9 | - FEATURE: get key API `GET /keys/*key` 10 | - FEATURE: watch key API `GET /watchkeys/*key` 11 | - PERFORMANCE: feature data caching so clients don't have to 12 | -------------------------------------------------------------------------------- /daemon/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: default builder build run test clean \ 2 | start_cluster login godeps_reset \ 3 | 4 | DOCKERIP := $$(docker-machine ip dev 2> /dev/null) 5 | 6 | default: run 7 | 8 | builder: 9 | go fmt ./... 10 | docker build -t porterd-builder -f Dockerfile.build . 11 | 12 | build: builder 13 | docker run -e LOCAL=true --rm porterd-builder > builder.docker 14 | docker build -t porterd - < builder.docker 15 | 16 | run: build start_cluster 17 | docker run \ 18 | -it --rm \ 19 | -p 9000:9000 \ 20 | -e LOCAL_DEV=true \ 21 | --link etcd-proxy:etcd \ 22 | --add-host dockerhost:$(DOCKERIP) \ 23 | porterd -p 9000 24 | 25 | test: 26 | go fmt ./... 27 | docker build -t porterd-test -f Dockerfile.test . 28 | docker run -it --rm \ 29 | -e LOCAL_DEV=true \ 30 | -e TEST=true \ 31 | porterd-test 32 | 33 | clean: 34 | - rm -fr porterd 35 | - rm -fr .provisioning_directives.json 36 | - rm -fr .MANIFEST.json 37 | - rm -fr *.gz 38 | - rm -fr *.docker 39 | 40 | start_cluster: 41 | ./scripts/start_cluster 42 | 43 | # Login to the builder container. 44 | # This is useful to run go and godep commands (e.g. to add a 3rd-party lib) 45 | login: builder 46 | docker run -it --rm \ 47 | -v $$(pwd):/go/src/github.com/adobe-platform/porter/daemon \ 48 | porterd-builder \ 49 | bash 50 | 51 | # blow out any changes to the Godeps folder 52 | godeps_reset: 53 | git reset -- Godeps vendor 54 | git checkout -- Godeps vendor 55 | git clean -df Godeps vendor 56 | -------------------------------------------------------------------------------- /daemon/README.md: -------------------------------------------------------------------------------- 1 | porterd 2 | ======= 3 | 4 | porterd is a HTTP service that runs on your EC2 instance 5 | 6 | Connecting to porterd 7 | --------------------- 8 | 9 | The following environment variables are available in your service's docker 10 | container. 11 | 12 | ``` 13 | PORTERD_TCP_ADDR 14 | PORTERD_TCP_PORT 15 | ``` 16 | 17 | This command from *inside* the container (not on the host) should return a 200 18 | response 19 | ``` 20 | curl -i "http://$PORTERD_TCP_ADDR:$PORTERD_TCP_PORT/health" 21 | ``` 22 | 23 | Logging 24 | ------- 25 | 26 | porterd generates a request id for every request. The key is `RequestId` and 27 | the value is a 28 | [UUIDv4](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29) 29 | 30 | Both the key and value can be overridden using headers. 31 | 32 | To just override the value with your own request id use `X-Request-Id` 33 | 34 | To override the key and value use `X-Request-Id-Key` and `X-Request-Id-Value` 35 | -------------------------------------------------------------------------------- /daemon/api/misc.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package api 13 | 14 | import ( 15 | "context" 16 | "fmt" 17 | "net/http" 18 | "os" 19 | 20 | "github.com/adobe-platform/porter/daemon/flags" 21 | ) 22 | 23 | func EnvHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) { 24 | for _, env := range os.Environ() { 25 | w.Write([]byte(env + "\n")) 26 | } 27 | } 28 | 29 | func FlagHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) { 30 | 31 | w.Write([]byte(fmt.Sprintf("environment %s\n", flags.Environment))) 32 | } 33 | 34 | func PanicHandler(w http.ResponseWriter, r *http.Request) { 35 | 36 | w.Write([]byte("panicking")) 37 | w.WriteHeader(500) 38 | 39 | go func() { 40 | 41 | panic("intentional panic called") 42 | }() 43 | } 44 | -------------------------------------------------------------------------------- /daemon/daemon.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package daemon 13 | 14 | import ( 15 | "net/http" 16 | 17 | "github.com/adobe-platform/porter/constants" 18 | "github.com/adobe-platform/porter/daemon/api" 19 | "github.com/adobe-platform/porter/daemon/config" 20 | "github.com/adobe-platform/porter/daemon/elb_registration" 21 | "github.com/adobe-platform/porter/daemon/wait_handle" 22 | "github.com/adobe-platform/porter/logger" 23 | ) 24 | 25 | func Run() { 26 | config.Init() 27 | 28 | go wait_handle.Call() 29 | go elb_registration.Call() 30 | 31 | log := logger.Daemon() 32 | 33 | router := api.NewRouter() 34 | 35 | log.Info("porterd listing on port " + constants.PorterDaemonBindPort) 36 | if err := http.ListenAndServe(":"+constants.PorterDaemonBindPort, router); err != nil { 37 | log.Crit("Failed to start service", "Error", err) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /daemon/flags/flags.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package flags 13 | 14 | var ( 15 | Environment string 16 | ServiceName string 17 | HealthCheckMethod string 18 | HealthCheckPath string 19 | ) 20 | -------------------------------------------------------------------------------- /daemon/http/status.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package http 13 | 14 | import ( 15 | "net/http" 16 | ) 17 | 18 | func S400(w http.ResponseWriter) { 19 | http.Error(w, http.StatusText(400), 400) 20 | } 21 | 22 | func S401(w http.ResponseWriter) { 23 | http.Error(w, http.StatusText(401), 401) 24 | } 25 | 26 | func S404(w http.ResponseWriter) { 27 | http.Error(w, http.StatusText(404), 404) 28 | } 29 | 30 | func S408(w http.ResponseWriter) { 31 | http.Error(w, http.StatusText(408), 408) 32 | } 33 | 34 | func S500(w http.ResponseWriter) { 35 | http.Error(w, http.StatusText(500), 500) 36 | } 37 | -------------------------------------------------------------------------------- /daemon/main/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package main 13 | 14 | import ( 15 | "flag" 16 | "fmt" 17 | "net/http" 18 | "os" 19 | "runtime" 20 | 21 | "github.com/adobe-platform/porter/daemon/api" 22 | "github.com/adobe-platform/porter/daemon/flags" 23 | "github.com/adobe-platform/porter/logger" 24 | ) 25 | 26 | var packageLogger = logger.New("main") 27 | 28 | func main() { 29 | 30 | flag.Parse() 31 | 32 | runtime.GOMAXPROCS(runtime.NumCPU()) 33 | 34 | for _, kvp := range os.Environ() { 35 | packageLogger.Debug("env", "kvp", kvp) 36 | } 37 | 38 | router := api.NewRouter() 39 | 40 | packageLogger.Info("f5waves listing on port " + flags.Port) 41 | if err := http.ListenAndServe(fmt.Sprintf(":%s", flags.Port), router); err != nil { 42 | packageLogger.Crit("Failed to start service", "Error", err) 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /daemon/middleware/log.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package middleware 13 | 14 | import "github.com/adobe-platform/porter/logger" 15 | 16 | var packageLogger = logger.Daemon("package", "middleware") 17 | -------------------------------------------------------------------------------- /daemon/middleware/profile.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package middleware 13 | 14 | import ( 15 | "context" 16 | "net/http" 17 | "time" 18 | ) 19 | 20 | func Profile(hdl Handle) Handle { 21 | 22 | return func(ctx context.Context, w http.ResponseWriter, r *http.Request) { 23 | log := GetRequestLog(ctx) 24 | t0 := time.Now() 25 | 26 | hdl(ctx, w, r) 27 | 28 | t1 := time.Now() 29 | log.Info("Profile", "Duration", t1.Sub(t0)) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /daemon/middleware/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package middleware 13 | 14 | import ( 15 | "context" 16 | "net/http" 17 | ) 18 | 19 | type Handle func(ctx context.Context, w http.ResponseWriter, r *http.Request) 20 | -------------------------------------------------------------------------------- /daemon/middleware/version.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package middleware 13 | 14 | import ( 15 | "context" 16 | "net/http" 17 | 18 | "github.com/adobe-platform/porter/constants" 19 | ) 20 | 21 | func VersionHeader(hdl Handle) Handle { 22 | 23 | return func(ctx context.Context, w http.ResponseWriter, r *http.Request) { 24 | 25 | w.Header().Set("porterd-version", constants.Version) 26 | 27 | hdl(ctx, w, r) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /docker/util/suite_test.go: -------------------------------------------------------------------------------- 1 | package util_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestSuite(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Docker Util Suite") 13 | } 14 | -------------------------------------------------------------------------------- /docker/util/util.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "bufio" 5 | "io" 6 | "regexp" 7 | "strings" 8 | ) 9 | 10 | var validKvp = regexp.MustCompile(`^[a-zA-Z0-9_]+=.*$`) 11 | 12 | // CleanEnvFile scrubs comments and removes invalid key-value pairs 13 | func CleanEnvFile(contents string) string { 14 | lines := strings.Split(contents, "\n") 15 | cleanedLines := []string{} 16 | for _, line := range lines { 17 | if validKvp.MatchString(line) { 18 | cleanedLines = append(cleanedLines, line) 19 | } 20 | } 21 | return strings.Join(cleanedLines, "\n") 22 | } 23 | 24 | func NetworkNameToId(input io.Reader) (map[string]string, error) { 25 | output := make(map[string]string) 26 | scanner := bufio.NewScanner(input) 27 | scanner.Split(bufio.ScanWords) 28 | var i int 29 | for scanner.Scan() { 30 | if i > 3 && (i-1)%3 == 0 { 31 | containerId := scanner.Text() 32 | scanner.Scan() 33 | name := scanner.Text() 34 | output[name] = containerId 35 | i += 2 36 | } else { 37 | i++ 38 | } 39 | } 40 | 41 | err := scanner.Err() 42 | if err != nil { 43 | return nil, err 44 | } 45 | 46 | return output, nil 47 | } 48 | -------------------------------------------------------------------------------- /docs/detailed_design/hooks/post-pack.md: -------------------------------------------------------------------------------- 1 | post-pack 2 | ========= 3 | 4 | Use Cases 5 | --------- 6 | 7 | - Clean up test or build artifacts 8 | - `rm -fr .git` if it's not longer needed to reduce artifact copying 9 | 10 | Lifecycle 11 | --------- 12 | 13 | This hook runs only once during `porter build pack` after packaging succeeds. 14 | 15 | Environment 16 | ----------- 17 | 18 | [Standard](../deployment-hooks.md#standard-environment-variables) 19 | and [Custom](../deployment-hooks.md#custom-environment-variables) 20 | environment variables 21 | -------------------------------------------------------------------------------- /docs/detailed_design/hooks/post-promote.md: -------------------------------------------------------------------------------- 1 | post-promote 2 | ============ 3 | 4 | Use cases 5 | --------- 6 | 7 | - Build notifications 8 | - Running integration tests against the DNS of the ELB that instances were 9 | promoted into. This is a best practice to catch errors related to security 10 | groups and other possible mismatches between the provisioned ELB and the ELB 11 | into which instances were promoted. 12 | 13 | Lifecycle 14 | --------- 15 | 16 | This hook is called from `porter build promote` **for each** region 17 | **after all** regions are promoted 18 | (as opposed to after each region is promoted) 19 | 20 | Environment 21 | ----------- 22 | 23 | [Standard](../deployment-hooks.md#standard-environment-variables) 24 | and [Custom](../deployment-hooks.md#custom-environment-variables) 25 | environment variables 26 | 27 | ``` 28 | PORTER_ENVIRONMENT 29 | AWS_REGION 30 | ``` 31 | 32 | `AWS_DEFAULT_REGION` `AWS_ACCESS_KEY_ID` `AWS_SECRET_ACCESS_KEY` 33 | `AWS_SESSION_TOKEN` `AWS_SECURITY_TOKEN` are available to enable AWS SDKs to 34 | make API calls and are the credentials of the assumed role. 35 | 36 | `AWS_CLOUDFORMATION_STACKID` is known after provisioning and is set by porter. 37 | 38 | `AWS_ELASTICLOADBALANCING_LOADBALANCER_DNS` is the DNS of the provisioned ELB 39 | (which may be an empty string if the ELB is internal). This is not the DNS of 40 | the ELB that instances were promoted into. 41 | -------------------------------------------------------------------------------- /docs/detailed_design/hooks/post-provision.md: -------------------------------------------------------------------------------- 1 | post-provision 2 | ============== 3 | 4 | Use cases 5 | --------- 6 | 7 | - Build notifications 8 | 9 | Lifecycle 10 | --------- 11 | 12 | This hook is called from `porter build provision` **for each** region 13 | **after all** regions are provisioned 14 | (as opposed to after each region is provisioned) 15 | 16 | Environment 17 | ----------- 18 | 19 | [Standard](../deployment-hooks.md#standard-environment-variables) 20 | and [Custom](../deployment-hooks.md#custom-environment-variables) 21 | environment variables 22 | 23 | ``` 24 | PORTER_ENVIRONMENT 25 | AWS_REGION 26 | ``` 27 | 28 | `AWS_DEFAULT_REGION` `AWS_ACCESS_KEY_ID` `AWS_SECRET_ACCESS_KEY` 29 | `AWS_SESSION_TOKEN` `AWS_SECURITY_TOKEN` are available to enable AWS SDKs to 30 | make API calls and are the credentials of the assumed role. 31 | 32 | `AWS_CLOUDFORMATION_STACKID` is known after provisioning and is set by porter. 33 | 34 | `AWS_ELASTICLOADBALANCING_LOADBALANCER_DNS` is the DNS of the provisioned ELB 35 | (which may be an empty string if the ELB is internal). 36 | -------------------------------------------------------------------------------- /docs/detailed_design/hooks/post-prune.md: -------------------------------------------------------------------------------- 1 | post-prune 2 | ========== 3 | 4 | Use cases 5 | --------- 6 | 7 | - Additional cleanup that may or may not be associated with the pruned stack 8 | 9 | Lifecycle 10 | --------- 11 | 12 | This hook is called from `porter build prune` **for each** region 13 | **after all** regions are pruned 14 | (as opposed to after each region is pruned) 15 | 16 | Environment 17 | ----------- 18 | 19 | [Standard](../deployment-hooks.md#standard-environment-variables) 20 | and [Custom](../deployment-hooks.md#custom-environment-variables) 21 | environment variables 22 | 23 | ``` 24 | PORTER_ENVIRONMENT 25 | AWS_REGION 26 | ``` 27 | 28 | `AWS_DEFAULT_REGION` `AWS_ACCESS_KEY_ID` `AWS_SECRET_ACCESS_KEY` 29 | `AWS_SESSION_TOKEN` `AWS_SECURITY_TOKEN` are available to enable AWS SDKs to 30 | make API calls and are the credentials of the assumed role. 31 | 32 | `AWS_CLOUDFORMATION_STACKID` is known after provisioning and is set by porter. 33 | 34 | `AWS_ELASTICLOADBALANCING_LOADBALANCER_DNS` is the DNS of the provisioned ELB 35 | (which may be an empty string if the ELB is internal). This is not the DNS of 36 | the ELB that instances were promoted into. 37 | 38 | Additional environment variables can be injected by prefixing them with 39 | `PORTER_` as noted in [deployment hooks](../deployment-hooks.md#hook-environment) 40 | -------------------------------------------------------------------------------- /docs/detailed_design/hooks/pre-promote.md: -------------------------------------------------------------------------------- 1 | pre-promote 2 | =========== 3 | 4 | Use Cases 5 | --------- 6 | 7 | - Running integration tests against the provisioned stack's ELB 8 | 9 | Lifecycle 10 | --------- 11 | 12 | This hook is called from `porter build promote` **for each** region 13 | **before any** regions are promoted 14 | (as opposed to before each region is promoted) 15 | 16 | Environment 17 | ----------- 18 | 19 | [Standard](../deployment-hooks.md#standard-environment-variables) 20 | and [Custom](../deployment-hooks.md#custom-environment-variables) 21 | environment variables 22 | 23 | ``` 24 | PORTER_ENVIRONMENT 25 | AWS_REGION 26 | ``` 27 | 28 | `AWS_DEFAULT_REGION` `AWS_ACCESS_KEY_ID` `AWS_SECRET_ACCESS_KEY` 29 | `AWS_SESSION_TOKEN` `AWS_SECURITY_TOKEN` are available to enable AWS SDKs to 30 | make API calls and are the credentials of the assumed role. 31 | 32 | `AWS_CLOUDFORMATION_STACKID` is known after provisioning and is set by porter. 33 | 34 | `AWS_ELASTICLOADBALANCING_LOADBALANCER_DNS` is the DNS of the provisioned ELB 35 | (which may be an empty string if the ELB is internal). 36 | -------------------------------------------------------------------------------- /docs/detailed_design/hooks/pre-prune.md: -------------------------------------------------------------------------------- 1 | pre-prune 2 | ========= 3 | 4 | Lifecycle 5 | --------- 6 | 7 | This hook is called from `porter build prune` **for each** region 8 | **before any** regions are pruned 9 | (as opposed to before each region is pruned) 10 | 11 | Environment 12 | ----------- 13 | 14 | [Standard](../deployment-hooks.md#standard-environment-variables) 15 | and [Custom](../deployment-hooks.md#custom-environment-variables) 16 | environment variables 17 | 18 | ``` 19 | PORTER_ENVIRONMENT 20 | AWS_REGION 21 | ``` 22 | 23 | `AWS_DEFAULT_REGION` `AWS_ACCESS_KEY_ID` `AWS_SECRET_ACCESS_KEY` 24 | `AWS_SESSION_TOKEN` `AWS_SECURITY_TOKEN` are available to enable AWS SDKs to 25 | make API calls and are the credentials of the assumed role. 26 | 27 | `AWS_CLOUDFORMATION_STACKID` is known after provisioning and is set by porter. 28 | 29 | `AWS_ELASTICLOADBALANCING_LOADBALANCER_DNS` is the DNS of the provisioned ELB 30 | (which may be an empty string if the ELB is internal). This is not the DNS of 31 | the ELB that instances were promoted into. 32 | -------------------------------------------------------------------------------- /docs/detailed_design/versions.md: -------------------------------------------------------------------------------- 1 | Versioning 2 | ========== 3 | 4 | It's important that the software services deploy on remains stable over time and 5 | that building on new software is intentional. `porter` ensures version locking 6 | of all software except security updates on Amazon Linux AMI using 7 | [`repo_upgrade: security`](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonLinuxAMIBasics.html#security-updates) 8 | (the default) and [`repo_releasever: 2016.03`](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonLinuxAMIBasics.html#RepoConfig) 9 | 10 | Checkout `/var/log/cloud-init-output.log` to see what security patches have been 11 | applied to the host. 12 | 13 | Versions 14 | -------- 15 | 16 | Here is the version list of software actively used by porter. 17 | Packages such as cfn-hup, yum, and cloud-init are excluded. 18 | 19 | Refer to the [Amazon Linux AMI release notes](https://aws.amazon.com/amazon-linux-ami/2016.03-release-notes/) 20 | for additional package information 21 | 22 | | Software | Version | 23 | |------------------------|---------| 24 | | Amazon Linux AMI | 2016.03 | 25 | | docker | 1.11.2 | 26 | | sysstat | 9.0.4 | 27 | | rsyslogd | 5.8.10 | 28 | | HA-Proxy | 1.5.2 | 29 | | porter (Go) | 1.7.3 | 30 | | porterd (Go) | 1.7.3 | 31 | | curl | 7.40.0 | 32 | | wget | 1.16.1 | 33 | -------------------------------------------------------------------------------- /docs/faq.md: -------------------------------------------------------------------------------- 1 | FAQ 2 | === 3 | 4 | ### Resiliency concerns 5 | 6 | > I ran `docker kill` and my container didn't restart. What gives? 7 | 8 | Porter starts containers with `--restart=on-failure:5`. It would be pathological 9 | for docker to ignore its own kill command. Exit the container with a non-zero 10 | exit code (e.g. `exit 1`, throw an exception) and you'll see that containers 11 | _are_ restarted. 12 | 13 | > I rebooted my instance and it didn't work 14 | 15 | Reboot isn't a real-world failure case. `cloud-init` doesn't run on an instance 16 | reboot so none of porter's commands are invoked as they are during normal 17 | instance initialization. Terminate your instance and you'll see that everything 18 | works as you expect it to. 19 | -------------------------------------------------------------------------------- /files/README.md: -------------------------------------------------------------------------------- 1 | files 2 | ===== 3 | 4 | All non-Golang content that needs to be packaged as part of the binary goes here 5 | -------------------------------------------------------------------------------- /files/cloud-init.json: -------------------------------------------------------------------------------- 1 | { 2 | "Fn::Join": [ 3 | "", 4 | [ 5 | "#cloud-config\n", 6 | "\n", 7 | "# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonLinuxAMIBasics.html#security-updates\n", 8 | "repo_upgrade: security\n", 9 | "\n", 10 | "# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonLinuxAMIBasics.html#RepoConfig\n", 11 | "repo_releasever: 2018.03\n", 12 | "\n", 13 | "packages:\n", 14 | " - haproxy-1.5.2\n", 15 | " - docker-18.03.1ce\n", 16 | " - sysstat-9.0.4\n", 17 | "\n", 18 | "runcmd:\n", 19 | " - echo running cfn-init -c bootstrap\n", 20 | " - /opt/aws/bin/cfn-init -c bootstrap", 21 | " --region ", { "Ref": "AWS::Region" }, 22 | " --stack ", { "Ref": "AWS::StackId" }, 23 | " -r {{ .LogicalId }}\n", 24 | "\n", 25 | " - echo running porter_bootstrap\n", 26 | " - AWS_REGION=", { "Ref": "AWS::Region" }, 27 | " AWS_STACKID=", { "Ref": "AWS::StackId" }, 28 | " /usr/bin/porter_bootstrap\n" 29 | ] 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /files/logrotate-porter: -------------------------------------------------------------------------------- 1 | /var/log/porter.log 2 | { 3 | size 100M 4 | nodateext 5 | rotate 4 6 | missingok 7 | notifempty 8 | compress 9 | delaycompress 10 | nosharedscripts 11 | postrotate 12 | /bin/kill -HUP $(cat /var/run/syslogd.pid 2> /dev/null) 2> /dev/null || true 13 | endscript 14 | } 15 | -------------------------------------------------------------------------------- /files/motd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cat << EOF 3 | 4 | Linux performance commands http://nflx.it/1PXHO3h 5 | uptime 6 | dmesg | tail 7 | vmstat 1 8 | mpstat -P ALL 1 9 | pidstat 1 10 | iostat -xz 1 11 | free -m 12 | sar -n DEV 1 13 | sar -n TCP,ETCP 1 14 | top 15 | 16 | Log paths (in order) 17 | /var/log/cloud-init-output.log 18 | /var/log/cfn-init-cmd.log 19 | /var/log/porter.log 20 | EOF 21 | -------------------------------------------------------------------------------- /files/pamd.crond: -------------------------------------------------------------------------------- 1 | # 2 | # The PAM configuration file for the cron daemon 3 | # 4 | # 5 | # No PAM authentication called, auth modules not needed 6 | account required pam_access.so 7 | account sufficient pam_succeed_if.so uid = 0 8 | account include password-auth 9 | session required pam_loginuid.so 10 | session include password-auth 11 | auth include password-auth 12 | -------------------------------------------------------------------------------- /files/porter_get_secrets: -------------------------------------------------------------------------------- 1 | {{ if .LogDebug -}} 2 | export LOG_DEBUG=1 3 | {{- end }} 4 | 5 | porter host svc-payload --get \ 6 | -b {{ .ServicePayloadBucket }} \ 7 | -k {{ .ServicePayloadKey }} \ 8 | -s {{ .ServicePayloadChecksum }} \ 9 | -l {{ .ServicePayloadHostPath }} \ 10 | -r {{ .Region }} 11 | 12 | tar -xzOf {{ .ServicePayloadHostPath }} ./{{ .ServicePayloadConfigPath }} \ 13 | | porter host secrets --get -e {{ .Environment }} -r {{ .Region }} 14 | -------------------------------------------------------------------------------- /files/porter_hotswap: -------------------------------------------------------------------------------- 1 | {{ if .LogDebug -}} 2 | export LOG_DEBUG=1 3 | {{- end }} 4 | 5 | echo "downloading service payload" 6 | porter host svc-payload --get \ 7 | -b {{ .ServicePayloadBucket }} \ 8 | -k {{ .ServicePayloadKey }} \ 9 | -s {{ .ServicePayloadChecksum }} \ 10 | -l {{ .ServicePayloadHostPath }} \ 11 | -r {{ .Region }} 12 | 13 | PAYLOAD_DIR={{ .ServicePayloadHostDir }} 14 | PAYLOAD_PATH={{ .ServicePayloadHostPath }} 15 | PAYLOAD_CONFIG_PATH={{ .ServicePayloadConfigPath }} 16 | 17 | tar -xz -C $PAYLOAD_DIR -f $PAYLOAD_PATH ./$PAYLOAD_CONFIG_PATH 18 | 19 | export CONFIG_PATH="$PAYLOAD_DIR/$PAYLOAD_CONFIG_PATH" 20 | 21 | {{ if not .RegistryDeployment -}} 22 | # load all the containers in this tar 23 | echo "loading containers" 24 | {{ range $imageName := .ImageNames -}} 25 | tar -xzOf $PAYLOAD_PATH ./{{ $imageName }}.docker | docker load 26 | {{ end -}} 27 | {{ end -}} 28 | 29 | echo "starting containers" 30 | porter host docker --start -e {{ .Environment }} -r {{ .Region }} \ 31 | | porter host haproxy -e {{ .Environment }} -r {{ .Region }} 32 | 33 | echo "cleaning containers" 34 | porter host docker --clean -e {{ .Environment }} -r {{ .Region }} 35 | 36 | porter host signal --hotswap-complete -r {{ .Region }} 37 | -------------------------------------------------------------------------------- /files/rsyslog-porter.conf: -------------------------------------------------------------------------------- 1 | # log porter generated messages to a local file which will be read by local 2 | # splunkd agent 3 | 4 | # http://www.rsyslog.com/doc/rsconf1_filecreatemode.html 5 | $umask 0000 6 | 7 | # Allow 8k messages to prevent truncation of JSON log statements 8 | $MaxMessageSize 8k 9 | 10 | # Rate limiting properties -- see http://www.rsyslog.com/tag/rate-limiting/ 11 | # defaults: rate limit a process that sends more than 200 messages in 5 seconds 12 | # override rate limiting behavior to allow a process to log 5000 messages per second. 13 | $SystemLogRateLimitBurst 5000 14 | $SystemLogRateLimitInterval 1 15 | 16 | # 17 | # Use traditional timestamp format. 18 | # To enable high precision timestamps, comment out the following line. 19 | # http://www.rsyslog.com/doc/v8-stable/configuration/templates.html#reserved-template-names 20 | $ActionFileDefaultTemplate RSYSLOG_FileFormat 21 | 22 | # Create and log to local file. Use default permissions 0644 23 | daemon.* /var/log/porter.log 24 | 25 | # Don't log anywhere else 26 | & stop 27 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package main 13 | 14 | import ( 15 | "flag" 16 | "net/http" 17 | "time" 18 | 19 | "github.com/adobe-platform/porter/commands" 20 | "github.com/phylake/go-cli" 21 | ) 22 | 23 | func main() { 24 | 25 | http.DefaultClient = &http.Client{ 26 | Timeout: 20 * time.Minute, 27 | } 28 | 29 | var err error 30 | cliDriver := cli.New(flag.ExitOnError) 31 | 32 | if err = cliDriver.RegisterRoot(commands.GetRootCommand()); err != nil { 33 | panic(err) 34 | } 35 | 36 | if err = cliDriver.ParseInput(); err != nil { 37 | panic(err) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /provision/README.md: -------------------------------------------------------------------------------- 1 | provision 2 | ========= 3 | 4 | All the things that need to happen to create disposable AWS infrastructure 5 | -------------------------------------------------------------------------------- /provision/map_resource_test.go: -------------------------------------------------------------------------------- 1 | package provision_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | _ "github.com/adobe-platform/porter/provision" 8 | ) 9 | 10 | var _ = Describe("Map resources", func() { 11 | 12 | It("runs", func() { 13 | Expect(nil).To(BeNil()) 14 | }) 15 | 16 | }) 17 | -------------------------------------------------------------------------------- /provision/suite_test.go: -------------------------------------------------------------------------------- 1 | package provision_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestSuite(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Provision Suite") 13 | } 14 | -------------------------------------------------------------------------------- /provision_state/provision_state.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | 13 | // This is here to avoid the import cycle provision -> hook -> provision 14 | package provision_state 15 | 16 | type ( 17 | Stack struct { 18 | Name string 19 | Hotswap bool 20 | Environment string 21 | Regions map[string]*Region 22 | } 23 | 24 | Region struct { 25 | StackId string 26 | ProvisionedELBName string 27 | 28 | // info on currently promoted stack 29 | AsgDesired int `json:"-"` 30 | } 31 | ) 32 | -------------------------------------------------------------------------------- /sample_project/.dockerignore: -------------------------------------------------------------------------------- 1 | .porter-tmp 2 | -------------------------------------------------------------------------------- /sample_project/.gitignore: -------------------------------------------------------------------------------- 1 | .porter-tmp 2 | -------------------------------------------------------------------------------- /sample_project/.porter/cloudformation.json: -------------------------------------------------------------------------------- 1 | { 2 | "Resources": { 3 | "AutoScalingLaunchConfiguration": { 4 | "Type": "AWS::AutoScaling::LaunchConfiguration", 5 | "Properties": { 6 | "SecurityGroups": [ 7 | { 8 | "Ref": "SSHSecurityGroup" 9 | } 10 | ] 11 | } 12 | }, 13 | "SSHSecurityGroup": { 14 | "Properties": { 15 | "GroupDescription": "SSH Access", 16 | "SecurityGroupIngress": [ 17 | { 18 | "CidrIp": "0.0.0.0/0", 19 | "FromPort": 22, 20 | "IpProtocol": "tcp", 21 | "ToPort": 22 22 | } 23 | ] 24 | }, 25 | "Type": "AWS::EC2::SecurityGroup" 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /sample_project/Dockerfile: -------------------------------------------------------------------------------- 1 | # Includes root CA certs for SSL 2 | FROM centurylink/ca-certs 3 | 4 | ADD main / 5 | 6 | EXPOSE 3000 7 | 8 | ENTRYPOINT ["/main"] 9 | -------------------------------------------------------------------------------- /sample_project/Dockerfile.build: -------------------------------------------------------------------------------- 1 | FROM golang:1.9.2 2 | 3 | ADD . /go/src/github.com/adobe-platform/sample_project 4 | WORKDIR /go/src/github.com/adobe-platform/sample_project 5 | 6 | # Recompile everything and create a static binary 7 | ENV CGO_ENABLED=0 8 | RUN go build -v -a --installsuffix cgo -ldflags '-s' -o main 9 | 10 | # Produce the docker context 11 | CMD ["tar", "-c", "main", "Dockerfile"] 12 | -------------------------------------------------------------------------------- /sample_project/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | ) 7 | 8 | func Handler(w http.ResponseWriter, r *http.Request) { 9 | w.Write([]byte("Hello world\n")) 10 | } 11 | 12 | func main() { 13 | 14 | http.HandleFunc("/", Handler) 15 | http.HandleFunc("/health", Handler) 16 | 17 | port := "3000" 18 | fmt.Println("listening on " + port) 19 | http.ListenAndServe(":"+port, nil) 20 | } 21 | -------------------------------------------------------------------------------- /sample_project/readme.md: -------------------------------------------------------------------------------- 1 | sample project 2 | ============== 3 | 4 | This is a "Hello world" HTTP project demonstrating the 5 | [platform-service interface](../docs/detailed_design/platform-service.md) 6 | 7 | This sample project consists of a single file, `main.go` 8 | 9 | Its integration with porter consists of `.porter/config` and 2 Dockerfiles. 10 | 11 | Having trouble with this project? [Troubleshoot it](../docs/troubleshoot.md) 12 | -------------------------------------------------------------------------------- /secrets/secrets_test.go: -------------------------------------------------------------------------------- 1 | package secrets_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "github.com/adobe-platform/porter/secrets" 8 | ) 9 | 10 | var _ = Describe("Secrets", func() { 11 | 12 | It("Encrypt/decrypt flow works", func() { 13 | 14 | symmetricKey, err := secrets.GenerateKey() 15 | Expect(err).To(BeNil()) 16 | 17 | payload := []byte("Super secret message") 18 | encPayload, err := secrets.Encrypt(payload, symmetricKey) 19 | Expect(err).To(BeNil()) 20 | 21 | originalPayload, err := secrets.Decrypt(encPayload, symmetricKey) 22 | Expect(err).To(BeNil()) 23 | 24 | Expect(originalPayload).To(Equal(payload)) 25 | }) 26 | 27 | }) 28 | -------------------------------------------------------------------------------- /secrets/suite_test.go: -------------------------------------------------------------------------------- 1 | package secrets_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestSuite(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Secrets Suite") 13 | } 14 | -------------------------------------------------------------------------------- /stdin/stdin.go: -------------------------------------------------------------------------------- 1 | package stdin 2 | 3 | import ( 4 | "errors" 5 | "io/ioutil" 6 | "os" 7 | "sync" 8 | ) 9 | 10 | var ( 11 | stdinErr error 12 | stdinBytes []byte 13 | stdinLock sync.RWMutex 14 | ) 15 | 16 | // GetBytes returns the contents of os.Stdin which can only be read once 17 | func GetBytes() ([]byte, error) { 18 | stdinLock.RLock() 19 | 20 | if stdinBytes == nil { 21 | stdinLock.RUnlock() 22 | 23 | stdinLock.Lock() 24 | defer stdinLock.Unlock() 25 | 26 | // Multiple readers could be at stdinLock.Lock() 27 | // Check condition again 28 | if stdinBytes == nil { 29 | stdinBytes, stdinErr = readStdin() 30 | } 31 | } else { 32 | stdinLock.RUnlock() 33 | } 34 | 35 | return stdinBytes, stdinErr 36 | } 37 | 38 | func readStdin() ([]byte, error) { 39 | 40 | stat, err := os.Stdin.Stat() 41 | if err != nil { 42 | return nil, err 43 | } 44 | 45 | if (stat.Mode() & os.ModeCharDevice) != 0 { 46 | err = errors.New("os.Stdin is not a valid character device") 47 | return nil, err 48 | } 49 | 50 | return ioutil.ReadAll(os.Stdin) 51 | } 52 | -------------------------------------------------------------------------------- /testintegration/.dockerignore: -------------------------------------------------------------------------------- 1 | .porter-tmp 2 | -------------------------------------------------------------------------------- /testintegration/.gitignore: -------------------------------------------------------------------------------- 1 | .porter-tmp 2 | create_stack 3 | update_stack 4 | create_locust 5 | -------------------------------------------------------------------------------- /testintegration/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | ADD ec2-bootstrap.cmd / 4 | RUN chmod 544 /ec2-bootstrap.cmd 5 | 6 | # TODO generate config 7 | CMD /ec2-bootstrap.cmd 8 | -------------------------------------------------------------------------------- /testintegration/Dockerfile.cmd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "DEV_MODE $DEV_MODE" 1>&2 4 | -------------------------------------------------------------------------------- /testintegration/Dockerfile.inet: -------------------------------------------------------------------------------- 1 | # Includes root CA certs for SSL 2 | FROM centurylink/ca-certs 3 | 4 | ADD main / 5 | 6 | EXPOSE 3000 7 | # EXPOSE 4000 8 | 9 | ENTRYPOINT ["/main"] 10 | -------------------------------------------------------------------------------- /testintegration/Dockerfile.inet.build: -------------------------------------------------------------------------------- 1 | FROM golang:1.9.2 2 | 3 | ADD . /go/src/github.com/adobe-platform/porter_test 4 | WORKDIR /go/src/github.com/adobe-platform/porter_test 5 | 6 | # Recompile everything and create a static binary 7 | ENV CGO_ENABLED=0 8 | RUN go build -v -a --installsuffix cgo -ldflags '-s' -o main 9 | 10 | # Produce the docker context 11 | CMD ["tar", "-c", "main", "Dockerfile.inet"] 12 | -------------------------------------------------------------------------------- /testintegration/cis_ami.json: -------------------------------------------------------------------------------- 1 | { 2 | \"Resources\": { 3 | \"AutoScalingLaunchConfiguration\": { 4 | \"Type\": \"AWS::AutoScaling::LaunchConfiguration\", 5 | \"Properties\": { 6 | \"SecurityGroups\": [ 7 | { 8 | \"Ref\": \"SSHSecurityGroup\" 9 | } 10 | ], 11 | \"ImageId\": \"ami-6442af04\" 12 | } 13 | }, 14 | \"SSHSecurityGroup\": { 15 | \"Properties\": { 16 | \"GroupDescription\": \"SSH Access\", 17 | \"SecurityGroupIngress\": [ 18 | { 19 | \"CidrIp\": \"$EXTERNAL_ACCESS_CIDR\", 20 | \"FromPort\": 22, 21 | \"IpProtocol\": \"tcp\", 22 | \"ToPort\": 22 23 | } 24 | ] 25 | }, 26 | \"Type\": \"AWS::EC2::SecurityGroup\" 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /testintegration/hooks/ec2-bootstrap: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | ADD ec2-bootstrap.cmd / 4 | RUN chmod 544 /ec2-bootstrap.cmd 5 | 6 | # TODO generate config 7 | CMD /ec2-bootstrap.cmd 8 | -------------------------------------------------------------------------------- /testintegration/hooks/ec2-bootstrap.cmd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "DEV_MODE $DEV_MODE" 1>&2 4 | 5 | if [[ $PORTER_ENVIRONMENT = 'CustomVPC' ]]; then 6 | 7 | cat <<'EOF' 8 | SECRET=$(porter_get_secrets) 9 | [[ $SECRET = 'hi' ]] || exit 1 10 | EOF 11 | 12 | fi 13 | 14 | if [[ $TCPDUMP = '1' ]]; then 15 | 16 | cat <<'EOF' 17 | cat <<'DOCKER_POST_RUN' > /usr/bin/porter_docker_post_run 18 | #!/bin/bash 19 | 20 | HOST_PORT=$1 21 | if [[ -z "$HOST_PORT" ]]; then 22 | exit 2 23 | fi 24 | IMAGE_NAME=tcpdump-$HOST_PORT 25 | 26 | cat <<'DOCKERFILE' | docker build -t $IMAGE_NAME - 27 | FROM ubuntu:16.04 28 | 29 | RUN apt-get update 30 | RUN apt-get install -y tcpdump 31 | 32 | CMD tcpdump -w /host/tcpdump.$PORT -n -s 100 -i lo port $PORT 33 | DOCKERFILE 34 | 35 | docker run -d \ 36 | -v /home/ec2-user:/host \ 37 | --net=host \ 38 | --privileged \ 39 | -e PORT=$HOST_PORT \ 40 | $IMAGE_NAME 41 | done 42 | 43 | DOCKER_POST_RUN 44 | chmod 755 /usr/bin/porter_docker_post_run 45 | EOF 46 | 47 | fi 48 | -------------------------------------------------------------------------------- /testintegration/hooks/post-pack-fail: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | ADD post-pack-fail.cmd / 4 | RUN chmod 544 /post-pack-fail.cmd 5 | 6 | WORKDIR /repo_root 7 | 8 | CMD /post-pack-fail.cmd 9 | -------------------------------------------------------------------------------- /testintegration/hooks/post-pack-fail.cmd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "pack failed" 4 | -------------------------------------------------------------------------------- /testintegration/hooks/pre-pack: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y tree 5 | 6 | ADD pre-pack.cmd / 7 | RUN chmod 544 /pre-pack.cmd 8 | 9 | WORKDIR /repo_root 10 | 11 | CMD /pre-pack.cmd 12 | -------------------------------------------------------------------------------- /testintegration/hooks/pre-pack.cmd: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | render_template() { 4 | eval "echo \"$(cat $1)\"" 5 | } 6 | 7 | env 8 | tree -a . 9 | 10 | CONF=$(render_template .porter/config) 11 | echo "$CONF" 12 | echo "$CONF" > .porter/config 13 | 14 | CIS_AMI_JSON=$(render_template cis_ami.json) 15 | echo "$CIS_AMI_JSON" 16 | echo "$CIS_AMI_JSON" > cis_ami.json 17 | 18 | VPC_JSON=$(render_template vpc.json) 19 | echo "$VPC_JSON" 20 | echo "$VPC_JSON" > vpc.json 21 | -------------------------------------------------------------------------------- /testintegration/hooks/user-defined: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y tree 5 | 6 | ADD user-defined.cmd / 7 | RUN chmod 544 /user-defined.cmd 8 | 9 | WORKDIR /repo_root 10 | 11 | CMD /user-defined.cmd 12 | -------------------------------------------------------------------------------- /testintegration/hooks/user-defined.cmd: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | tree -a . 4 | 5 | echo $PORTER_SERVICE_NAME 6 | echo $PORTER_SERVICE_VERSION 7 | -------------------------------------------------------------------------------- /testintegration/load.py: -------------------------------------------------------------------------------- 1 | from locust import HttpLocust, TaskSet 2 | import random 3 | 4 | 5 | def empty(l): 6 | l.client.request('GET', '/empty') 7 | 8 | 9 | def rand_latency(l): 10 | ms = '{}ms'.format(random.randrange(1, 1000)) 11 | l.client.request('GET', '/load', None, False, headers={'X-Response-Time': ms}) 12 | 13 | 14 | def no_keep_alive(l): 15 | l.client.request('GET', '/hello', None, False, headers={'Connection': 'close'}) 16 | 17 | 18 | class UserBehavior(TaskSet): 19 | # tasks = {rand_latency:1, no_keep_alive:1} 20 | tasks = [empty] 21 | 22 | 23 | class WebsiteUser(HttpLocust): 24 | task_set = UserBehavior 25 | -------------------------------------------------------------------------------- /testintegration/plugins/post-pack: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | ADD post-pack.cmd / 4 | RUN chmod 544 /post-pack.cmd 5 | 6 | CMD /post-pack.cmd 7 | -------------------------------------------------------------------------------- /testintegration/plugins/post-pack.cmd: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | env 3 | 4 | if [[ -z "$OLD_STYLE_HOOK_ENV" ]]; then 5 | echo "OLD_STYLE_HOOK_ENV is broken" 6 | exit 1 7 | fi 8 | -------------------------------------------------------------------------------- /testintegration/plugins/user-defined: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y tree 5 | 6 | ADD user-defined.cmd / 7 | RUN chmod 544 /user-defined.cmd 8 | 9 | WORKDIR /repo_root 10 | 11 | CMD /user-defined.cmd 12 | -------------------------------------------------------------------------------- /testintegration/plugins/user-defined.cmd: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | tree -a . 4 | 5 | echo $PORTER_SERVICE_NAME 6 | echo $PORTER_SERVICE_VERSION 7 | -------------------------------------------------------------------------------- /testintegration/promote_loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | porter build pack 4 | porter build provision -e private 5 | mv .porter-tmp/provision_receipt.json .porter-tmp/provision_receipt.json2 6 | porter build provision -e private 7 | 8 | while [[ 1 ]]; do 9 | porter build promote --elb live --provision-receipt .porter-tmp/provision_receipt.json 10 | porter build promote --elb live --provision-receipt .porter-tmp/provision_receipt.json2 11 | done 12 | -------------------------------------------------------------------------------- /testintegration/readme.md: -------------------------------------------------------------------------------- 1 | porter test 2 | =========== 3 | 4 | This is a project we use to develop on porter and exercises all of the features 5 | of porter so its config is more complex than a simple "Hello world HTTP" 6 | project. 7 | -------------------------------------------------------------------------------- /testintegration/sample_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "testing" 6 | ) 7 | 8 | func TestSample(t *testing.T) { 9 | flag.Parse() 10 | } 11 | -------------------------------------------------------------------------------- /testintegration/secrets.env-file: -------------------------------------------------------------------------------- 1 | # comment on CUSTOM_SECRET 2 | CUSTOM_SECRET=foo 3 | -------------------------------------------------------------------------------- /testintegration/vpc.json: -------------------------------------------------------------------------------- 1 | { 2 | \"Resources\": { 3 | \"AutoScalingLaunchConfiguration\": { 4 | \"Type\": \"AWS::AutoScaling::LaunchConfiguration\", 5 | \"Properties\": { 6 | \"SecurityGroups\": [ 7 | { 8 | \"Ref\": \"SSHSecurityGroup\" 9 | } 10 | ] 11 | } 12 | }, 13 | \"SSHSecurityGroup\": { 14 | \"Properties\": { 15 | \"GroupDescription\": \"SSH Access\", 16 | \"SecurityGroupIngress\": [ 17 | { 18 | \"CidrIp\": \"$EXTERNAL_ACCESS_CIDR\", 19 | \"FromPort\": 22, 20 | \"IpProtocol\": \"tcp\", 21 | \"ToPort\": 22 22 | } 23 | ] 24 | }, 25 | \"Type\": \"AWS::EC2::SecurityGroup\" 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /util/suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) 2016-2018 Adobe. All rights reserved. 3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. You may obtain a copy 5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under 8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS 9 | * OF ANY KIND, either express or implied. See the License for the specific language 10 | * governing permissions and limitations under the License. 11 | */ 12 | package util_test 13 | 14 | import ( 15 | . "github.com/onsi/ginkgo" 16 | . "github.com/onsi/gomega" 17 | 18 | "testing" 19 | ) 20 | 21 | func TestSuite(t *testing.T) { 22 | RegisterFailHandler(Fail) 23 | RunSpecs(t, "Util Suite") 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/armon/go-radix/.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 | -------------------------------------------------------------------------------- /vendor/github.com/armon/go-radix/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - tip 4 | -------------------------------------------------------------------------------- /vendor/github.com/armon/go-radix/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Armon Dadgar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | 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, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/armon/go-radix/README.md: -------------------------------------------------------------------------------- 1 | go-radix [![Build Status](https://travis-ci.org/armon/go-radix.png)](https://travis-ci.org/armon/go-radix) 2 | ========= 3 | 4 | Provides the `radix` package that implements a [radix tree](http://en.wikipedia.org/wiki/Radix_tree). 5 | The package only provides a single `Tree` implementation, optimized for sparse nodes. 6 | 7 | As a radix tree, it provides the following: 8 | * O(k) operations. In many cases, this can be faster than a hash table since 9 | the hash function is an O(k) operation, and hash tables have very poor cache locality. 10 | * Minimum / Maximum value lookups 11 | * Ordered iteration 12 | 13 | For an immutable variant, see [go-immutable-radix](https://github.com/hashicorp/go-immutable-radix). 14 | 15 | Documentation 16 | ============= 17 | 18 | The full documentation is available on [Godoc](http://godoc.org/github.com/armon/go-radix). 19 | 20 | Example 21 | ======= 22 | 23 | Below is a simple example of usage 24 | 25 | ```go 26 | // Create a tree 27 | r := radix.New() 28 | r.Insert("foo", 1) 29 | r.Insert("bar", 2) 30 | r.Insert("foobar", 2) 31 | 32 | // Find the longest prefix match 33 | m, _, _ := r.LongestPrefix("foozip") 34 | if m != "foo" { 35 | panic("should be foo") 36 | } 37 | ``` 38 | 39 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/NOTICE.txt: -------------------------------------------------------------------------------- 1 | AWS SDK for Go 2 | Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | Copyright 2014-2015 Stripe, Inc. 4 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go: -------------------------------------------------------------------------------- 1 | package awsutil 2 | 3 | import ( 4 | "reflect" 5 | ) 6 | 7 | // DeepEqual returns if the two values are deeply equal like reflect.DeepEqual. 8 | // In addition to this, this method will also dereference the input values if 9 | // possible so the DeepEqual performed will not fail if one parameter is a 10 | // pointer and the other is not. 11 | // 12 | // DeepEqual will not perform indirection of nested values of the input parameters. 13 | func DeepEqual(a, b interface{}) bool { 14 | ra := reflect.Indirect(reflect.ValueOf(a)) 15 | rb := reflect.Indirect(reflect.ValueOf(b)) 16 | 17 | if raValid, rbValid := ra.IsValid(), rb.IsValid(); !raValid && !rbValid { 18 | // If the elements are both nil, and of the same type the are equal 19 | // If they are of different types they are not equal 20 | return reflect.TypeOf(a) == reflect.TypeOf(b) 21 | } else if raValid != rbValid { 22 | // Both values must be valid to be equal 23 | return false 24 | } 25 | 26 | return reflect.DeepEqual(ra.Interface(), rb.Interface()) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | // ClientInfo wraps immutable data from the client.Client structure. 4 | type ClientInfo struct { 5 | ServiceName string 6 | APIVersion string 7 | Endpoint string 8 | SigningName string 9 | SigningRegion string 10 | JSONVersion string 11 | TargetPrefix string 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go: -------------------------------------------------------------------------------- 1 | package corehandlers 2 | 3 | import "github.com/aws/aws-sdk-go/aws/request" 4 | 5 | // ValidateParametersHandler is a request handler to validate the input parameters. 6 | // Validating parameters only has meaning if done prior to the request being sent. 7 | var ValidateParametersHandler = request.NamedHandler{Name: "core.ValidateParametersHandler", Fn: func(r *request.Request) { 8 | if !r.ParamsFilled() { 9 | return 10 | } 11 | 12 | if v, ok := r.Params.(request.Validator); ok { 13 | if err := v.Validate(); err != nil { 14 | r.Error = err 15 | } 16 | } 17 | }} 18 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini: -------------------------------------------------------------------------------- 1 | [default] 2 | aws_access_key_id = accessKey 3 | aws_secret_access_key = secret 4 | aws_session_token = token 5 | 6 | [no_token] 7 | aws_access_key_id = accessKey 8 | aws_secret_access_key = secret 9 | 10 | [with_colon] 11 | aws_access_key_id: accessKey 12 | aws_secret_access_key: secret 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/errors.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import "github.com/aws/aws-sdk-go/aws/awserr" 4 | 5 | var ( 6 | // ErrMissingRegion is an error that is returned if region configuration is 7 | // not found. 8 | // 9 | // @readonly 10 | ErrMissingRegion = awserr.New("MissingRegion", "could not find region configuration", nil) 11 | 12 | // ErrMissingEndpoint is an error that is returned if an endpoint cannot be 13 | // resolved for a service. 14 | // 15 | // @readonly 16 | ErrMissingEndpoint = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) 17 | ) 18 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "io" 5 | "net/http" 6 | "net/url" 7 | ) 8 | 9 | func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { 10 | req := new(http.Request) 11 | *req = *r 12 | req.URL = &url.URL{} 13 | *req.URL = *r.URL 14 | req.Body = body 15 | 16 | req.Header = http.Header{} 17 | for k, v := range r.Header { 18 | for _, vv := range v { 19 | req.Header.Add(k, vv) 20 | } 21 | } 22 | 23 | return req 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "io" 5 | "sync" 6 | ) 7 | 8 | // offsetReader is a thread-safe io.ReadCloser to prevent racing 9 | // with retrying requests 10 | type offsetReader struct { 11 | buf io.ReadSeeker 12 | lock sync.Mutex 13 | closed bool 14 | } 15 | 16 | func newOffsetReader(buf io.ReadSeeker, offset int64) *offsetReader { 17 | reader := &offsetReader{} 18 | buf.Seek(offset, 0) 19 | 20 | reader.buf = buf 21 | return reader 22 | } 23 | 24 | // Close will close the instance of the offset reader's access to 25 | // the underlying io.ReadSeeker. 26 | func (o *offsetReader) Close() error { 27 | o.lock.Lock() 28 | defer o.lock.Unlock() 29 | o.closed = true 30 | return nil 31 | } 32 | 33 | // Read is a thread-safe read of the underlying io.ReadSeeker 34 | func (o *offsetReader) Read(p []byte) (int, error) { 35 | o.lock.Lock() 36 | defer o.lock.Unlock() 37 | 38 | if o.closed { 39 | return 0, io.EOF 40 | } 41 | 42 | return o.buf.Read(p) 43 | } 44 | 45 | // Seek is a thread-safe seeking operation. 46 | func (o *offsetReader) Seek(offset int64, whence int) (int64, error) { 47 | o.lock.Lock() 48 | defer o.lock.Unlock() 49 | 50 | return o.buf.Seek(offset, whence) 51 | } 52 | 53 | // CloseAndCopy will return a new offsetReader with a copy of the old buffer 54 | // and close the old buffer. 55 | func (o *offsetReader) CloseAndCopy(offset int64) *offsetReader { 56 | o.Close() 57 | return newOffsetReader(o.buf, offset) 58 | } 59 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go: -------------------------------------------------------------------------------- 1 | // +build !go1.8 2 | 3 | package request 4 | 5 | import "io" 6 | 7 | // NoBody is an io.ReadCloser with no bytes. Read always returns EOF 8 | // and Close always returns nil. It can be used in an outgoing client 9 | // request to explicitly signal that a request has zero bytes. 10 | // An alternative, however, is to simply set Request.Body to nil. 11 | // 12 | // Copy of Go 1.8 NoBody type from net/http/http.go 13 | type noBody struct{} 14 | 15 | func (noBody) Read([]byte) (int, error) { return 0, io.EOF } 16 | func (noBody) Close() error { return nil } 17 | func (noBody) WriteTo(io.Writer) (int64, error) { return 0, nil } 18 | 19 | // Is an empty reader that will trigger the Go HTTP client to not include 20 | // and body in the HTTP request. 21 | var noBodyReader = noBody{} 22 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | package request 4 | 5 | import "net/http" 6 | 7 | // Is a http.NoBody reader instructing Go HTTP client to not include 8 | // and body in the HTTP request. 9 | var noBodyReader = http.NoBody 10 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go: -------------------------------------------------------------------------------- 1 | // +build go1.5 2 | 3 | package v4 4 | 5 | import ( 6 | "net/url" 7 | "strings" 8 | ) 9 | 10 | func getURIPath(u *url.URL) string { 11 | var uri string 12 | 13 | if len(u.Opaque) > 0 { 14 | uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/") 15 | } else { 16 | uri = u.EscapedPath() 17 | } 18 | 19 | if len(uri) == 0 { 20 | uri = "/" 21 | } 22 | 23 | return uri 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/version.go: -------------------------------------------------------------------------------- 1 | // Package aws provides core functionality for making requests to AWS services. 2 | package aws 3 | 4 | // SDKName is the name of this AWS SDK 5 | const SDKName = "aws-sdk-go" 6 | 7 | // SDKVersion is the version of this SDK 8 | const SDKVersion = "1.6.27" 9 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go: -------------------------------------------------------------------------------- 1 | // Package ec2query provides serialization of AWS EC2 requests and responses. 2 | package ec2query 3 | 4 | //go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/ec2.json build_test.go 5 | 6 | import ( 7 | "net/url" 8 | 9 | "github.com/aws/aws-sdk-go/aws/awserr" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | "github.com/aws/aws-sdk-go/private/protocol/query/queryutil" 12 | ) 13 | 14 | // BuildHandler is a named request handler for building ec2query protocol requests 15 | var BuildHandler = request.NamedHandler{Name: "awssdk.ec2query.Build", Fn: Build} 16 | 17 | // Build builds a request for the EC2 protocol. 18 | func Build(r *request.Request) { 19 | body := url.Values{ 20 | "Action": {r.Operation.Name}, 21 | "Version": {r.ClientInfo.APIVersion}, 22 | } 23 | if err := queryutil.Parse(body, r.Params, true); err != nil { 24 | r.Error = awserr.New("SerializationError", "failed encoding EC2 Query request", err) 25 | } 26 | 27 | if r.ExpireTime == 0 { 28 | r.HTTPRequest.Method = "POST" 29 | r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") 30 | r.SetBufferBody([]byte(body.Encode())) 31 | } else { // This is a pre-signed request 32 | r.HTTPRequest.Method = "GET" 33 | r.HTTPRequest.URL.RawQuery = body.Encode() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go: -------------------------------------------------------------------------------- 1 | // Package query provides serialization of AWS query requests, and responses. 2 | package query 3 | 4 | //go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/query.json build_test.go 5 | 6 | import ( 7 | "net/url" 8 | 9 | "github.com/aws/aws-sdk-go/aws/awserr" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | "github.com/aws/aws-sdk-go/private/protocol/query/queryutil" 12 | ) 13 | 14 | // BuildHandler is a named request handler for building query protocol requests 15 | var BuildHandler = request.NamedHandler{Name: "awssdk.query.Build", Fn: Build} 16 | 17 | // Build builds a request for an AWS Query service. 18 | func Build(r *request.Request) { 19 | body := url.Values{ 20 | "Action": {r.Operation.Name}, 21 | "Version": {r.ClientInfo.APIVersion}, 22 | } 23 | if err := queryutil.Parse(body, r.Params, false); err != nil { 24 | r.Error = awserr.New("SerializationError", "failed encoding Query request", err) 25 | return 26 | } 27 | 28 | if r.ExpireTime == 0 { 29 | r.HTTPRequest.Method = "POST" 30 | r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") 31 | r.SetBufferBody([]byte(body.Encode())) 32 | } else { // This is a pre-signed request 33 | r.HTTPRequest.Method = "GET" 34 | r.HTTPRequest.URL.RawQuery = body.Encode() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | //go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go 4 | 5 | import ( 6 | "encoding/xml" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" 11 | ) 12 | 13 | // UnmarshalHandler is a named request handler for unmarshaling query protocol requests 14 | var UnmarshalHandler = request.NamedHandler{Name: "awssdk.query.Unmarshal", Fn: Unmarshal} 15 | 16 | // UnmarshalMetaHandler is a named request handler for unmarshaling query protocol request metadata 17 | var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalMeta", Fn: UnmarshalMeta} 18 | 19 | // Unmarshal unmarshals a response for an AWS Query service. 20 | func Unmarshal(r *request.Request) { 21 | defer r.HTTPResponse.Body.Close() 22 | if r.DataFilled() { 23 | decoder := xml.NewDecoder(r.HTTPResponse.Body) 24 | err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result") 25 | if err != nil { 26 | r.Error = awserr.New("SerializationError", "failed decoding Query response", err) 27 | return 28 | } 29 | } 30 | } 31 | 32 | // UnmarshalMeta unmarshals header response values for an AWS Query service. 33 | func UnmarshalMeta(r *request.Request) { 34 | r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go: -------------------------------------------------------------------------------- 1 | package rest 2 | 3 | import "reflect" 4 | 5 | // PayloadMember returns the payload field member of i if there is one, or nil. 6 | func PayloadMember(i interface{}) interface{} { 7 | if i == nil { 8 | return nil 9 | } 10 | 11 | v := reflect.ValueOf(i).Elem() 12 | if !v.IsValid() { 13 | return nil 14 | } 15 | if field, ok := v.Type().FieldByName("_"); ok { 16 | if payloadName := field.Tag.Get("payload"); payloadName != "" { 17 | field, _ := v.Type().FieldByName(payloadName) 18 | if field.Tag.Get("type") != "structure" { 19 | return nil 20 | } 21 | 22 | payload := v.FieldByName(payloadName) 23 | if payload.IsValid() || (payload.Kind() == reflect.Ptr && !payload.IsNil()) { 24 | return payload.Interface() 25 | } 26 | } 27 | } 28 | return nil 29 | } 30 | 31 | // PayloadType returns the type of a payload field member of i if there is one, or "". 32 | func PayloadType(i interface{}) string { 33 | v := reflect.Indirect(reflect.ValueOf(i)) 34 | if !v.IsValid() { 35 | return "" 36 | } 37 | if field, ok := v.Type().FieldByName("_"); ok { 38 | if payloadName := field.Tag.Get("payload"); payloadName != "" { 39 | if member, ok := v.Type().FieldByName(payloadName); ok { 40 | return member.Tag.Get("type") 41 | } 42 | } 43 | } 44 | return "" 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "io" 5 | "io/ioutil" 6 | 7 | "github.com/aws/aws-sdk-go/aws/request" 8 | ) 9 | 10 | // UnmarshalDiscardBodyHandler is a named request handler to empty and close a response's body 11 | var UnmarshalDiscardBodyHandler = request.NamedHandler{Name: "awssdk.shared.UnmarshalDiscardBody", Fn: UnmarshalDiscardBody} 12 | 13 | // UnmarshalDiscardBody is a request handler to empty a response's body and closing it. 14 | func UnmarshalDiscardBody(r *request.Request) { 15 | if r.HTTPResponse == nil || r.HTTPResponse.Body == nil { 16 | return 17 | } 18 | 19 | io.Copy(ioutil.Discard, r.HTTPResponse.Body) 20 | r.HTTPResponse.Body.Close() 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/ec2/errors.go: -------------------------------------------------------------------------------- 1 | // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. 2 | 3 | package ec2 4 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "io/ioutil" 5 | "regexp" 6 | 7 | "github.com/aws/aws-sdk-go/aws" 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/awsutil" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | ) 12 | 13 | var reBucketLocation = regexp.MustCompile(`>([^<>]+)<\/Location`) 14 | 15 | func buildGetBucketLocation(r *request.Request) { 16 | if r.DataFilled() { 17 | out := r.Data.(*GetBucketLocationOutput) 18 | b, err := ioutil.ReadAll(r.HTTPResponse.Body) 19 | if err != nil { 20 | r.Error = awserr.New("SerializationError", "failed reading response body", err) 21 | return 22 | } 23 | 24 | match := reBucketLocation.FindSubmatch(b) 25 | if len(match) > 1 { 26 | loc := string(match[1]) 27 | out.LocationConstraint = &loc 28 | } 29 | } 30 | } 31 | 32 | func populateLocationConstraint(r *request.Request) { 33 | if r.ParamsFilled() && aws.StringValue(r.Config.Region) != "us-east-1" { 34 | in := r.Params.(*CreateBucketInput) 35 | if in.CreateBucketConfiguration == nil { 36 | r.Params = awsutil.CopyOf(r.Params) 37 | in = r.Params.(*CreateBucketInput) 38 | in.CreateBucketConfiguration = &CreateBucketConfiguration{ 39 | LocationConstraint: r.Config.Region, 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/content_md5.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/base64" 6 | "io" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | ) 11 | 12 | // contentMD5 computes and sets the HTTP Content-MD5 header for requests that 13 | // require it. 14 | func contentMD5(r *request.Request) { 15 | h := md5.New() 16 | 17 | // hash the body. seek back to the first position after reading to reset 18 | // the body for transmission. copy errors may be assumed to be from the 19 | // body. 20 | _, err := io.Copy(h, r.Body) 21 | if err != nil { 22 | r.Error = awserr.New("ContentMD5", "failed to read body", err) 23 | return 24 | } 25 | _, err = r.Body.Seek(0, 0) 26 | if err != nil { 27 | r.Error = awserr.New("ContentMD5", "failed to seek body", err) 28 | return 29 | } 30 | 31 | // encode the md5 checksum in base64 and set the request header. 32 | sum := h.Sum(nil) 33 | sum64 := make([]byte, base64.StdEncoding.EncodedLen(len(sum))) 34 | base64.StdEncoding.Encode(sum64, sum) 35 | r.HTTPRequest.Header.Set("Content-MD5", string(sum64)) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go: -------------------------------------------------------------------------------- 1 | // +build !go1.6 2 | 3 | package s3 4 | 5 | import "github.com/aws/aws-sdk-go/aws/request" 6 | 7 | func platformRequestHandlers(r *request.Request) { 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go: -------------------------------------------------------------------------------- 1 | // +build go1.6 2 | 3 | package s3 4 | 5 | import ( 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/request" 8 | ) 9 | 10 | func platformRequestHandlers(r *request.Request) { 11 | if r.Operation.HTTPMethod == "PUT" { 12 | // 100-Continue should only be used on put requests. 13 | r.Handlers.Sign.PushBack(add100Continue) 14 | } 15 | } 16 | 17 | func add100Continue(r *request.Request) { 18 | if aws.BoolValue(r.Config.S3Disable100Continue) { 19 | return 20 | } 21 | if r.HTTPRequest.ContentLength < 1024*1024*2 { 22 | // Ignore requests smaller than 2MB. This helps prevent delaying 23 | // requests unnecessarily. 24 | return 25 | } 26 | 27 | r.HTTPRequest.Header.Set("Expect", "100-Continue") 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/doc.go: -------------------------------------------------------------------------------- 1 | // Package s3manager provides utilities to upload and download objects from 2 | // S3 concurrently. Helpful for when working with large objects. 3 | package s3manager 4 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/sse.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/base64" 6 | 7 | "github.com/aws/aws-sdk-go/aws/awserr" 8 | "github.com/aws/aws-sdk-go/aws/awsutil" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | ) 11 | 12 | var errSSERequiresSSL = awserr.New("ConfigError", "cannot send SSE keys over HTTP.", nil) 13 | 14 | func validateSSERequiresSSL(r *request.Request) { 15 | if r.HTTPRequest.URL.Scheme != "https" { 16 | p, _ := awsutil.ValuesAtPath(r.Params, "SSECustomerKey||CopySourceSSECustomerKey") 17 | if len(p) > 0 { 18 | r.Error = errSSERequiresSSL 19 | } 20 | } 21 | } 22 | 23 | func computeSSEKeys(r *request.Request) { 24 | headers := []string{ 25 | "x-amz-server-side-encryption-customer-key", 26 | "x-amz-copy-source-server-side-encryption-customer-key", 27 | } 28 | 29 | for _, h := range headers { 30 | md5h := h + "-md5" 31 | if key := r.HTTPRequest.Header.Get(h); key != "" { 32 | // Base64-encode the value 33 | b64v := base64.StdEncoding.EncodeToString([]byte(key)) 34 | r.HTTPRequest.Header.Set(h, b64v) 35 | 36 | // Add MD5 if it wasn't computed 37 | if r.HTTPRequest.Header.Get(md5h) == "" { 38 | sum := md5.Sum([]byte(key)) 39 | b64sum := base64.StdEncoding.EncodeToString(sum[:]) 40 | r.HTTPRequest.Header.Set(md5h, b64sum) 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "bytes" 5 | "io/ioutil" 6 | "net/http" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | ) 11 | 12 | func copyMultipartStatusOKUnmarhsalError(r *request.Request) { 13 | b, err := ioutil.ReadAll(r.HTTPResponse.Body) 14 | if err != nil { 15 | r.Error = awserr.New("SerializationError", "unable to read response body", err) 16 | return 17 | } 18 | body := bytes.NewReader(b) 19 | r.HTTPResponse.Body = ioutil.NopCloser(body) 20 | defer body.Seek(0, 0) 21 | 22 | if body.Len() == 0 { 23 | // If there is no body don't attempt to parse the body. 24 | return 25 | } 26 | 27 | unmarshalError(r) 28 | if err, ok := r.Error.(awserr.Error); ok && err != nil { 29 | if err.Code() == "SerializationError" { 30 | r.Error = nil 31 | return 32 | } 33 | r.HTTPResponse.StatusCode = http.StatusServiceUnavailable 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sqs/customizations.go: -------------------------------------------------------------------------------- 1 | package sqs 2 | 3 | import "github.com/aws/aws-sdk-go/aws/request" 4 | 5 | func init() { 6 | initRequest = func(r *request.Request) { 7 | setupChecksumValidation(r) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go: -------------------------------------------------------------------------------- 1 | package sts 2 | 3 | import "github.com/aws/aws-sdk-go/aws/request" 4 | 5 | func init() { 6 | initRequest = func(r *request.Request) { 7 | switch r.Operation.Name { 8 | case opAssumeRoleWithSAML, opAssumeRoleWithWebIdentity: 9 | r.Handlers.Sign.Clear() // these operations are unsigned 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/go-ini/ini/.gitignore: -------------------------------------------------------------------------------- 1 | testdata/conf_out.ini 2 | ini.sublime-project 3 | ini.sublime-workspace 4 | testdata/conf_reflect.ini 5 | -------------------------------------------------------------------------------- /vendor/github.com/go-ini/ini/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build test bench vet 2 | 3 | build: vet bench 4 | 5 | test: 6 | go test -v -cover -race 7 | 8 | bench: 9 | go test -v -cover -race -test.bench=. -test.benchmem 10 | 11 | vet: 12 | go vet 13 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/.gitignore: -------------------------------------------------------------------------------- 1 | jpgo 2 | jmespath-fuzz.zip 3 | cpu.out 4 | go-jmespath.test 5 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | sudo: false 4 | 5 | go: 6 | - 1.4 7 | 8 | install: go get -v -t ./... 9 | script: make test 10 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015 James Saryerwinnie 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/jmespath/go-jmespath/Makefile: -------------------------------------------------------------------------------- 1 | 2 | CMD = jpgo 3 | 4 | help: 5 | @echo "Please use \`make ' where is one of" 6 | @echo " test to run all the tests" 7 | @echo " build to build the library and jp executable" 8 | @echo " generate to run codegen" 9 | 10 | 11 | generate: 12 | go generate ./... 13 | 14 | build: 15 | rm -f $(CMD) 16 | go build ./... 17 | rm -f cmd/$(CMD)/$(CMD) && cd cmd/$(CMD)/ && go build ./... 18 | mv cmd/$(CMD)/$(CMD) . 19 | 20 | test: 21 | go test -v ./... 22 | 23 | check: 24 | go vet ./... 25 | @echo "golint ./..." 26 | @lint=`golint ./...`; \ 27 | lint=`echo "$$lint" | grep -v "astnodetype_string.go" | grep -v "toktype_string.go"`; \ 28 | echo "$$lint"; \ 29 | if [ "$$lint" != "" ]; then exit 1; fi 30 | 31 | htmlc: 32 | go test -coverprofile="/tmp/jpcov" && go tool cover -html="/tmp/jpcov" && unlink /tmp/jpcov 33 | 34 | buildfuzz: 35 | go-fuzz-build github.com/jmespath/go-jmespath/fuzz 36 | 37 | fuzz: buildfuzz 38 | go-fuzz -bin=./jmespath-fuzz.zip -workdir=fuzz/testdata 39 | 40 | bench: 41 | go test -bench . -cpuprofile cpu.out 42 | 43 | pprof-cpu: 44 | go tool pprof ./go-jmespath.test ./cpu.out 45 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/README.md: -------------------------------------------------------------------------------- 1 | # go-jmespath - A JMESPath implementation in Go 2 | 3 | [![Build Status](https://img.shields.io/travis/jmespath/go-jmespath.svg)](https://travis-ci.org/jmespath/go-jmespath) 4 | 5 | 6 | 7 | See http://jmespath.org for more info. 8 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/astnodetype_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type astNodeType; DO NOT EDIT 2 | 3 | package jmespath 4 | 5 | import "fmt" 6 | 7 | const _astNodeType_name = "ASTEmptyASTComparatorASTCurrentNodeASTExpRefASTFunctionExpressionASTFieldASTFilterProjectionASTFlattenASTIdentityASTIndexASTIndexExpressionASTKeyValPairASTLiteralASTMultiSelectHashASTMultiSelectListASTOrExpressionASTAndExpressionASTNotExpressionASTPipeASTProjectionASTSubexpressionASTSliceASTValueProjection" 8 | 9 | var _astNodeType_index = [...]uint16{0, 8, 21, 35, 44, 65, 73, 92, 102, 113, 121, 139, 152, 162, 180, 198, 213, 229, 245, 252, 265, 281, 289, 307} 10 | 11 | func (i astNodeType) String() string { 12 | if i < 0 || i >= astNodeType(len(_astNodeType_index)-1) { 13 | return fmt.Sprintf("astNodeType(%d)", i) 14 | } 15 | return _astNodeType_name[_astNodeType_index[i]:_astNodeType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/compliance/current.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "given": { 4 | "foo": [{"name": "a"}, {"name": "b"}], 5 | "bar": {"baz": "qux"} 6 | }, 7 | "cases": [ 8 | { 9 | "expression": "@", 10 | "result": { 11 | "foo": [{"name": "a"}, {"name": "b"}], 12 | "bar": {"baz": "qux"} 13 | } 14 | }, 15 | { 16 | "expression": "@.bar", 17 | "result": {"baz": "qux"} 18 | }, 19 | { 20 | "expression": "@.foo[0]", 21 | "result": {"name": "a"} 22 | } 23 | ] 24 | } 25 | ] 26 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/compliance/escape.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "given": { 3 | "foo.bar": "dot", 4 | "foo bar": "space", 5 | "foo\nbar": "newline", 6 | "foo\"bar": "doublequote", 7 | "c:\\\\windows\\path": "windows", 8 | "/unix/path": "unix", 9 | "\"\"\"": "threequotes", 10 | "bar": {"baz": "qux"} 11 | }, 12 | "cases": [ 13 | { 14 | "expression": "\"foo.bar\"", 15 | "result": "dot" 16 | }, 17 | { 18 | "expression": "\"foo bar\"", 19 | "result": "space" 20 | }, 21 | { 22 | "expression": "\"foo\\nbar\"", 23 | "result": "newline" 24 | }, 25 | { 26 | "expression": "\"foo\\\"bar\"", 27 | "result": "doublequote" 28 | }, 29 | { 30 | "expression": "\"c:\\\\\\\\windows\\\\path\"", 31 | "result": "windows" 32 | }, 33 | { 34 | "expression": "\"/unix/path\"", 35 | "result": "unix" 36 | }, 37 | { 38 | "expression": "\"\\\"\\\"\\\"\"", 39 | "result": "threequotes" 40 | }, 41 | { 42 | "expression": "\"bar\".\"baz\"", 43 | "result": "qux" 44 | } 45 | ] 46 | }] 47 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/compliance/unicode.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "given": {"foo": [{"✓": "✓"}, {"✓": "✗"}]}, 4 | "cases": [ 5 | { 6 | "expression": "foo[].\"✓\"", 7 | "result": ["✓", "✗"] 8 | } 9 | ] 10 | }, 11 | { 12 | "given": {"☯": true}, 13 | "cases": [ 14 | { 15 | "expression": "\"☯\"", 16 | "result": true 17 | } 18 | ] 19 | }, 20 | { 21 | "given": {"♪♫•*¨*•.¸¸❤¸¸.•*¨*•♫♪": true}, 22 | "cases": [ 23 | { 24 | "expression": "\"♪♫•*¨*•.¸¸❤¸¸.•*¨*•♫♪\"", 25 | "result": true 26 | } 27 | ] 28 | }, 29 | { 30 | "given": {"☃": true}, 31 | "cases": [ 32 | { 33 | "expression": "\"☃\"", 34 | "result": true 35 | } 36 | ] 37 | } 38 | ] 39 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/fuzz/jmespath.go: -------------------------------------------------------------------------------- 1 | package jmespath 2 | 3 | import "github.com/jmespath/go-jmespath" 4 | 5 | // Fuzz will fuzz test the JMESPath parser. 6 | func Fuzz(data []byte) int { 7 | p := jmespath.NewParser() 8 | _, err := p.Parse(string(data)) 9 | if err != nil { 10 | return 1 11 | } 12 | return 0 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/toktype_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type=tokType; DO NOT EDIT 2 | 3 | package jmespath 4 | 5 | import "fmt" 6 | 7 | const _tokType_name = "tUnknowntStartDottFiltertFlattentLparentRparentLbrackettRbrackettLbracetRbracetOrtPipetNumbertUnquotedIdentifiertQuotedIdentifiertCommatColontLTtLTEtGTtGTEtEQtNEtJSONLiteraltStringLiteraltCurrenttExpreftAndtNottEOF" 8 | 9 | var _tokType_index = [...]uint8{0, 8, 13, 17, 24, 32, 39, 46, 55, 64, 71, 78, 81, 86, 93, 112, 129, 135, 141, 144, 148, 151, 155, 158, 161, 173, 187, 195, 202, 206, 210, 214} 10 | 11 | func (i tokType) String() string { 12 | if i < 0 || i >= tokType(len(_tokType_index)-1) { 13 | return fmt.Sprintf("tokType(%d)", i) 14 | } 15 | return _tokType_name[_tokType_index[i]:_tokType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/julienschmidt/httprouter/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | go: 4 | - 1.1 5 | - 1.2 6 | - 1.3 7 | - 1.4 8 | - 1.5 9 | - 1.6 10 | - tip 11 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/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/mattn/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/mattn/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/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 | 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/mattn/go-isatty/doc.go: -------------------------------------------------------------------------------- 1 | // Package isatty implements interface to isatty 2 | package isatty 3 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/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/mattn/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/mattn/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/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 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/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/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | TODO 3 | tmp/**/* 4 | *.coverprofile -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.4 4 | - 1.5 5 | - 1.6 6 | - tip 7 | 8 | install: 9 | - go get -v -t ./... 10 | - go get golang.org/x/tools/cmd/cover 11 | - go get github.com/onsi/gomega 12 | - go install github.com/onsi/ginkgo/ginkgo 13 | - export PATH=$PATH:$HOME/gopath/bin 14 | 15 | script: $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --randomizeSuites --race --trace 16 | -------------------------------------------------------------------------------- /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/ginkgo/convert_command.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "github.com/onsi/ginkgo/ginkgo/convert" 7 | "os" 8 | ) 9 | 10 | func BuildConvertCommand() *Command { 11 | return &Command{ 12 | Name: "convert", 13 | FlagSet: flag.NewFlagSet("convert", flag.ExitOnError), 14 | UsageCommand: "ginkgo convert /path/to/package", 15 | Usage: []string{ 16 | "Convert the package at the passed in path from an XUnit-style test to a Ginkgo-style test", 17 | }, 18 | Command: convertPackage, 19 | } 20 | } 21 | 22 | func convertPackage(args []string, additionalArgs []string) { 23 | if len(args) != 1 { 24 | println(fmt.Sprintf("usage: ginkgo convert /path/to/your/package")) 25 | os.Exit(1) 26 | } 27 | 28 | defer func() { 29 | err := recover() 30 | if err != nil { 31 | switch err := err.(type) { 32 | case error: 33 | println(err.Error()) 34 | case string: 35 | println(err) 36 | default: 37 | println(fmt.Sprintf("unexpected error: %#v", err)) 38 | } 39 | os.Exit(1) 40 | } 41 | }() 42 | 43 | convert.RewritePackage(args[0]) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/help_command.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | ) 7 | 8 | func BuildHelpCommand() *Command { 9 | return &Command{ 10 | Name: "help", 11 | FlagSet: flag.NewFlagSet("help", flag.ExitOnError), 12 | UsageCommand: "ginkgo help ", 13 | Usage: []string{ 14 | "Print usage information. If a command is passed in, print usage information just for that command.", 15 | }, 16 | Command: printHelp, 17 | } 18 | } 19 | 20 | func printHelp(args []string, additionalArgs []string) { 21 | if len(args) == 0 { 22 | usage() 23 | } else { 24 | command, found := commandMatching(args[0]) 25 | if !found { 26 | complainAndQuit(fmt.Sprintf("Unknown command: %s", args[0])) 27 | } 28 | 29 | usageForCommand(command, true) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/interrupt_handler.go: -------------------------------------------------------------------------------- 1 | package interrupthandler 2 | 3 | import ( 4 | "os" 5 | "os/signal" 6 | "sync" 7 | "syscall" 8 | ) 9 | 10 | type InterruptHandler struct { 11 | interruptCount int 12 | lock *sync.Mutex 13 | C chan bool 14 | } 15 | 16 | func NewInterruptHandler() *InterruptHandler { 17 | h := &InterruptHandler{ 18 | lock: &sync.Mutex{}, 19 | C: make(chan bool, 0), 20 | } 21 | 22 | go h.handleInterrupt() 23 | SwallowSigQuit() 24 | 25 | return h 26 | } 27 | 28 | func (h *InterruptHandler) WasInterrupted() bool { 29 | h.lock.Lock() 30 | defer h.lock.Unlock() 31 | 32 | return h.interruptCount > 0 33 | } 34 | 35 | func (h *InterruptHandler) handleInterrupt() { 36 | c := make(chan os.Signal, 1) 37 | signal.Notify(c, os.Interrupt, syscall.SIGTERM) 38 | 39 | <-c 40 | signal.Stop(c) 41 | 42 | h.lock.Lock() 43 | h.interruptCount++ 44 | if h.interruptCount == 1 { 45 | close(h.C) 46 | } else if h.interruptCount > 5 { 47 | os.Exit(1) 48 | } 49 | h.lock.Unlock() 50 | 51 | go h.handleInterrupt() 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/sigquit_swallower_unix.go: -------------------------------------------------------------------------------- 1 | // +build freebsd openbsd netbsd dragonfly darwin linux 2 | 3 | package interrupthandler 4 | 5 | import ( 6 | "os" 7 | "os/signal" 8 | "syscall" 9 | ) 10 | 11 | func SwallowSigQuit() { 12 | c := make(chan os.Signal, 1024) 13 | signal.Notify(c, syscall.SIGQUIT) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/sigquit_swallower_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package interrupthandler 4 | 5 | func SwallowSigQuit() { 6 | //noop 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/testrunner/log_writer.go: -------------------------------------------------------------------------------- 1 | package testrunner 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "io" 7 | "log" 8 | "strings" 9 | "sync" 10 | ) 11 | 12 | type logWriter struct { 13 | buffer *bytes.Buffer 14 | lock *sync.Mutex 15 | log *log.Logger 16 | } 17 | 18 | func newLogWriter(target io.Writer, node int) *logWriter { 19 | return &logWriter{ 20 | buffer: &bytes.Buffer{}, 21 | lock: &sync.Mutex{}, 22 | log: log.New(target, fmt.Sprintf("[%d] ", node), 0), 23 | } 24 | } 25 | 26 | func (w *logWriter) Write(data []byte) (n int, err error) { 27 | w.lock.Lock() 28 | defer w.lock.Unlock() 29 | 30 | w.buffer.Write(data) 31 | contents := w.buffer.String() 32 | 33 | lines := strings.Split(contents, "\n") 34 | for _, line := range lines[0 : len(lines)-1] { 35 | w.log.Println(line) 36 | } 37 | 38 | w.buffer.Reset() 39 | w.buffer.Write([]byte(lines[len(lines)-1])) 40 | return len(data), nil 41 | } 42 | 43 | func (w *logWriter) Close() error { 44 | w.lock.Lock() 45 | defer w.lock.Unlock() 46 | 47 | if w.buffer.Len() > 0 { 48 | w.log.Println(w.buffer.String()) 49 | } 50 | 51 | return nil 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/testrunner/run_result.go: -------------------------------------------------------------------------------- 1 | package testrunner 2 | 3 | type RunResult struct { 4 | Passed bool 5 | HasProgrammaticFocus bool 6 | } 7 | 8 | func PassingRunResult() RunResult { 9 | return RunResult{ 10 | Passed: true, 11 | HasProgrammaticFocus: false, 12 | } 13 | } 14 | 15 | func FailingRunResult() RunResult { 16 | return RunResult{ 17 | Passed: false, 18 | HasProgrammaticFocus: false, 19 | } 20 | } 21 | 22 | func (r RunResult) Merge(o RunResult) RunResult { 23 | return RunResult{ 24 | Passed: r.Passed && o.Passed, 25 | HasProgrammaticFocus: r.HasProgrammaticFocus || o.HasProgrammaticFocus, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/unfocus_command.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "os/exec" 7 | ) 8 | 9 | func BuildUnfocusCommand() *Command { 10 | return &Command{ 11 | Name: "unfocus", 12 | AltName: "blur", 13 | FlagSet: flag.NewFlagSet("unfocus", flag.ExitOnError), 14 | UsageCommand: "ginkgo unfocus (or ginkgo blur)", 15 | Usage: []string{ 16 | "Recursively unfocuses any focused tests under the current directory", 17 | }, 18 | Command: unfocusSpecs, 19 | } 20 | } 21 | 22 | func unfocusSpecs([]string, []string) { 23 | unfocus("Describe") 24 | unfocus("Context") 25 | unfocus("It") 26 | unfocus("Measure") 27 | unfocus("DescribeTable") 28 | unfocus("Entry") 29 | } 30 | 31 | func unfocus(component string) { 32 | fmt.Printf("Removing F%s...\n", component) 33 | cmd := exec.Command("gofmt", fmt.Sprintf("-r=F%s -> %s", component, component), "-w", ".") 34 | out, _ := cmd.CombinedOutput() 35 | if string(out) != "" { 36 | println(string(out)) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/version_command.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "github.com/onsi/ginkgo/config" 7 | ) 8 | 9 | func BuildVersionCommand() *Command { 10 | return &Command{ 11 | Name: "version", 12 | FlagSet: flag.NewFlagSet("version", flag.ExitOnError), 13 | UsageCommand: "ginkgo version", 14 | Usage: []string{ 15 | "Print Ginkgo's version", 16 | }, 17 | Command: printVersion, 18 | } 19 | } 20 | 21 | func printVersion([]string, []string) { 22 | fmt.Printf("Ginkgo Version %s\n", config.VERSION) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/watch/delta.go: -------------------------------------------------------------------------------- 1 | package watch 2 | 3 | import "sort" 4 | 5 | type Delta struct { 6 | ModifiedPackages []string 7 | 8 | NewSuites []*Suite 9 | RemovedSuites []*Suite 10 | modifiedSuites []*Suite 11 | } 12 | 13 | type DescendingByDelta []*Suite 14 | 15 | func (a DescendingByDelta) Len() int { return len(a) } 16 | func (a DescendingByDelta) Swap(i, j int) { a[i], a[j] = a[j], a[i] } 17 | func (a DescendingByDelta) Less(i, j int) bool { return a[i].Delta() > a[j].Delta() } 18 | 19 | func (d Delta) ModifiedSuites() []*Suite { 20 | sort.Sort(DescendingByDelta(d.modifiedSuites)) 21 | return d.modifiedSuites 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/integration/integration.go: -------------------------------------------------------------------------------- 1 | package integration 2 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go: -------------------------------------------------------------------------------- 1 | package codelocation 2 | 3 | import ( 4 | "regexp" 5 | "runtime" 6 | "runtime/debug" 7 | "strings" 8 | 9 | "github.com/onsi/ginkgo/types" 10 | ) 11 | 12 | func New(skip int) types.CodeLocation { 13 | _, file, line, _ := runtime.Caller(skip + 1) 14 | stackTrace := PruneStack(string(debug.Stack()), skip) 15 | return types.CodeLocation{FileName: file, LineNumber: line, FullStackTrace: stackTrace} 16 | } 17 | 18 | func PruneStack(fullStackTrace string, skip int) string { 19 | stack := strings.Split(fullStackTrace, "\n") 20 | if len(stack) > 2*(skip+1) { 21 | stack = stack[2*(skip+1):] 22 | } 23 | prunedStack := []string{} 24 | re := regexp.MustCompile(`\/ginkgo\/|\/pkg\/testing\/|\/pkg\/runtime\/`) 25 | for i := 0; i < len(stack)/2; i++ { 26 | if !re.Match([]byte(stack[i*2])) { 27 | prunedStack = append(prunedStack, stack[i*2]) 28 | prunedStack = append(prunedStack, stack[i*2+1]) 29 | } 30 | } 31 | return strings.Join(prunedStack, "\n") 32 | } 33 | -------------------------------------------------------------------------------- /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 | "github.com/onsi/ginkgo/internal/failer" 5 | "github.com/onsi/ginkgo/types" 6 | "time" 7 | ) 8 | 9 | type ItNode struct { 10 | runner *runner 11 | 12 | flag types.FlagType 13 | text string 14 | } 15 | 16 | func NewItNode(text string, body interface{}, flag types.FlagType, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *ItNode { 17 | return &ItNode{ 18 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeIt, componentIndex), 19 | flag: flag, 20 | text: text, 21 | } 22 | } 23 | 24 | func (node *ItNode) Run() (outcome types.SpecState, failure types.SpecFailure) { 25 | return node.runner.run() 26 | } 27 | 28 | func (node *ItNode) Type() types.SpecComponentType { 29 | return types.SpecComponentTypeIt 30 | } 31 | 32 | func (node *ItNode) Text() string { 33 | return node.text 34 | } 35 | 36 | func (node *ItNode) Flag() types.FlagType { 37 | return node.flag 38 | } 39 | 40 | func (node *ItNode) CodeLocation() types.CodeLocation { 41 | return node.runner.codeLocation 42 | } 43 | 44 | func (node *ItNode) Samples() int { 45 | return 1 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor.go: -------------------------------------------------------------------------------- 1 | package remote 2 | 3 | /* 4 | The OutputInterceptor is used by the ForwardingReporter to 5 | intercept and capture all stdin and stderr output during a test run. 6 | */ 7 | type OutputInterceptor interface { 8 | StartInterceptingOutput() error 9 | StopInterceptingAndReturnOutput() (string, error) 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_win.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package remote 4 | 5 | import ( 6 | "errors" 7 | ) 8 | 9 | func NewOutputInterceptor() OutputInterceptor { 10 | return &outputInterceptor{} 11 | } 12 | 13 | type outputInterceptor struct { 14 | intercepting bool 15 | } 16 | 17 | func (interceptor *outputInterceptor) StartInterceptingOutput() error { 18 | if interceptor.intercepting { 19 | return errors.New("Already intercepting output!") 20 | } 21 | interceptor.intercepting = true 22 | 23 | // not working on windows... 24 | 25 | return nil 26 | } 27 | 28 | func (interceptor *outputInterceptor) StopInterceptingAndReturnOutput() (string, error) { 29 | // not working on windows... 30 | interceptor.intercepting = false 31 | 32 | return "", nil 33 | } 34 | -------------------------------------------------------------------------------- /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_unix.go: -------------------------------------------------------------------------------- 1 | // +build !linux !arm64 2 | // +build !windows 3 | 4 | package remote 5 | 6 | import "syscall" 7 | 8 | func syscallDup(oldfd int, newfd int) (err error) { 9 | return syscall.Dup2(oldfd, newfd) 10 | } 11 | -------------------------------------------------------------------------------- /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) Write(data []byte) (n int, err error) { 30 | return 0, nil 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/writer/writer.go: -------------------------------------------------------------------------------- 1 | package writer 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | "sync" 7 | ) 8 | 9 | type WriterInterface interface { 10 | io.Writer 11 | 12 | Truncate() 13 | DumpOut() 14 | DumpOutWithHeader(header string) 15 | } 16 | 17 | type Writer struct { 18 | buffer *bytes.Buffer 19 | outWriter io.Writer 20 | lock *sync.Mutex 21 | stream bool 22 | } 23 | 24 | func New(outWriter io.Writer) *Writer { 25 | return &Writer{ 26 | buffer: &bytes.Buffer{}, 27 | lock: &sync.Mutex{}, 28 | outWriter: outWriter, 29 | stream: true, 30 | } 31 | } 32 | 33 | func (w *Writer) SetStream(stream bool) { 34 | w.lock.Lock() 35 | defer w.lock.Unlock() 36 | w.stream = stream 37 | } 38 | 39 | func (w *Writer) Write(b []byte) (n int, err error) { 40 | w.lock.Lock() 41 | defer w.lock.Unlock() 42 | 43 | if w.stream { 44 | return w.outWriter.Write(b) 45 | } else { 46 | return w.buffer.Write(b) 47 | } 48 | } 49 | 50 | func (w *Writer) Truncate() { 51 | w.lock.Lock() 52 | defer w.lock.Unlock() 53 | w.buffer.Reset() 54 | } 55 | 56 | func (w *Writer) DumpOut() { 57 | w.lock.Lock() 58 | defer w.lock.Unlock() 59 | if !w.stream { 60 | w.buffer.WriteTo(w.outWriter) 61 | } 62 | } 63 | 64 | func (w *Writer) DumpOutWithHeader(header string) { 65 | w.lock.Lock() 66 | defer w.lock.Unlock() 67 | if !w.stream && w.buffer.Len() > 0 { 68 | w.outWriter.Write([]byte(header)) 69 | w.buffer.WriteTo(w.outWriter) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /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/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 | go: 3 | - 1.5 4 | - tip 5 | 6 | install: 7 | - go get -v ./... 8 | - go get github.com/onsi/ginkgo 9 | - go install github.com/onsi/ginkgo/ginkgo 10 | 11 | script: $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --failOnPending --randomizeSuites --race 12 | -------------------------------------------------------------------------------- /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.png)](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 | To discuss Gomega and get updates, join the [google group](https://groups.google.com/d/forum/ginkgo-and-gomega). 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 | ## License 14 | 15 | Gomega is MIT-Licensed 16 | 17 | The `ConsistOf` matcher uses [goraph](https://github.com/amitkgupta/goraph) which is embedded in the source to simplify distribution. goraph has an MIT license. 18 | -------------------------------------------------------------------------------- /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 | type gomegaTestingT interface { 12 | Errorf(format string, args ...interface{}) 13 | } 14 | 15 | func BuildTestingTGomegaFailHandler(t gomegaTestingT) types.GomegaFailHandler { 16 | return func(message string, callerSkip ...int) { 17 | skip := 1 18 | if len(callerSkip) > 0 { 19 | skip = callerSkip[0] 20 | } 21 | stackTrace := pruneStack(string(debug.Stack()), skip) 22 | t.Errorf("\n%s\n%s", stackTrace, message) 23 | } 24 | } 25 | 26 | func pruneStack(fullStackTrace string, skip int) string { 27 | stack := strings.Split(fullStackTrace, "\n") 28 | if len(stack) > 2*(skip+1) { 29 | stack = stack[2*(skip+1):] 30 | } 31 | prunedStack := []string{} 32 | re := regexp.MustCompile(`\/ginkgo\/|\/pkg\/testing\/|\/pkg\/runtime\/`) 33 | for i := 0; i < len(stack)/2; i++ { 34 | if !re.Match([]byte(stack[i*2])) { 35 | prunedStack = append(prunedStack, stack[i*2]) 36 | prunedStack = append(prunedStack, stack[i*2+1]) 37 | } 38 | } 39 | return strings.Join(prunedStack, "\n") 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | 7 | "github.com/onsi/gomega/format" 8 | ) 9 | 10 | type AssignableToTypeOfMatcher struct { 11 | Expected interface{} 12 | } 13 | 14 | func (matcher *AssignableToTypeOfMatcher) Match(actual interface{}) (success bool, err error) { 15 | if actual == nil || matcher.Expected == nil { 16 | 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.") 17 | } 18 | 19 | actualType := reflect.TypeOf(actual) 20 | expectedType := reflect.TypeOf(matcher.Expected) 21 | 22 | return actualType.AssignableTo(expectedType), nil 23 | } 24 | 25 | func (matcher *AssignableToTypeOfMatcher) FailureMessage(actual interface{}) string { 26 | return format.Message(actual, fmt.Sprintf("to be assignable to the type: %T", matcher.Expected)) 27 | } 28 | 29 | func (matcher *AssignableToTypeOfMatcher) NegatedFailureMessage(actual interface{}) string { 30 | return format.Message(actual, fmt.Sprintf("not to be assignable to the type: %T", matcher.Expected)) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_a_directory.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/onsi/gomega/format" 8 | ) 9 | 10 | type notADirectoryError struct { 11 | os.FileInfo 12 | } 13 | 14 | func (t notADirectoryError) Error() string { 15 | fileInfo := os.FileInfo(t) 16 | switch { 17 | case fileInfo.Mode().IsRegular(): 18 | return "file is a regular file" 19 | default: 20 | return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String()) 21 | } 22 | } 23 | 24 | type BeADirectoryMatcher struct { 25 | expected interface{} 26 | err error 27 | } 28 | 29 | func (matcher *BeADirectoryMatcher) Match(actual interface{}) (success bool, err error) { 30 | actualFilename, ok := actual.(string) 31 | if !ok { 32 | return false, fmt.Errorf("BeADirectoryMatcher matcher expects a file path") 33 | } 34 | 35 | fileInfo, err := os.Stat(actualFilename) 36 | if err != nil { 37 | matcher.err = err 38 | return false, nil 39 | } 40 | 41 | if !fileInfo.Mode().IsDir() { 42 | matcher.err = notADirectoryError{fileInfo} 43 | return false, nil 44 | } 45 | return true, nil 46 | } 47 | 48 | func (matcher *BeADirectoryMatcher) FailureMessage(actual interface{}) (message string) { 49 | return format.Message(actual, fmt.Sprintf("to be a directory: %s", matcher.err)) 50 | } 51 | 52 | func (matcher *BeADirectoryMatcher) NegatedFailureMessage(actual interface{}) (message string) { 53 | return format.Message(actual, fmt.Sprintf("not be a directory")) 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/onsi/gomega/format" 8 | ) 9 | 10 | type notARegularFileError struct { 11 | os.FileInfo 12 | } 13 | 14 | func (t notARegularFileError) Error() string { 15 | fileInfo := os.FileInfo(t) 16 | switch { 17 | case fileInfo.IsDir(): 18 | return "file is a directory" 19 | default: 20 | return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String()) 21 | } 22 | } 23 | 24 | type BeARegularFileMatcher struct { 25 | expected interface{} 26 | err error 27 | } 28 | 29 | func (matcher *BeARegularFileMatcher) Match(actual interface{}) (success bool, err error) { 30 | actualFilename, ok := actual.(string) 31 | if !ok { 32 | return false, fmt.Errorf("BeARegularFileMatcher matcher expects a file path") 33 | } 34 | 35 | fileInfo, err := os.Stat(actualFilename) 36 | if err != nil { 37 | matcher.err = err 38 | return false, nil 39 | } 40 | 41 | if !fileInfo.Mode().IsRegular() { 42 | matcher.err = notARegularFileError{fileInfo} 43 | return false, nil 44 | } 45 | return true, nil 46 | } 47 | 48 | func (matcher *BeARegularFileMatcher) FailureMessage(actual interface{}) (message string) { 49 | return format.Message(actual, fmt.Sprintf("to be a regular file: %s", matcher.err)) 50 | } 51 | 52 | func (matcher *BeARegularFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { 53 | return format.Message(actual, fmt.Sprintf("not be a regular file")) 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/onsi/gomega/format" 8 | ) 9 | 10 | type BeAnExistingFileMatcher struct { 11 | expected interface{} 12 | } 13 | 14 | func (matcher *BeAnExistingFileMatcher) Match(actual interface{}) (success bool, err error) { 15 | actualFilename, ok := actual.(string) 16 | if !ok { 17 | return false, fmt.Errorf("BeAnExistingFileMatcher matcher expects a file path") 18 | } 19 | 20 | if _, err = os.Stat(actualFilename); err != nil { 21 | switch { 22 | case os.IsNotExist(err): 23 | return false, nil 24 | default: 25 | return false, err 26 | } 27 | } 28 | 29 | return true, nil 30 | } 31 | 32 | func (matcher *BeAnExistingFileMatcher) FailureMessage(actual interface{}) (message string) { 33 | return format.Message(actual, fmt.Sprintf("to exist")) 34 | } 35 | 36 | func (matcher *BeAnExistingFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { 37 | return format.Message(actual, fmt.Sprintf("not to exist")) 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "reflect" 7 | ) 8 | 9 | type BeClosedMatcher struct { 10 | } 11 | 12 | func (matcher *BeClosedMatcher) Match(actual interface{}) (success bool, err error) { 13 | if !isChan(actual) { 14 | return false, fmt.Errorf("BeClosed matcher expects a channel. Got:\n%s", format.Object(actual, 1)) 15 | } 16 | 17 | channelType := reflect.TypeOf(actual) 18 | channelValue := reflect.ValueOf(actual) 19 | 20 | if channelType.ChanDir() == reflect.SendDir { 21 | return false, fmt.Errorf("BeClosed matcher cannot determine if a send-only channel is closed or open. Got:\n%s", format.Object(actual, 1)) 22 | } 23 | 24 | winnerIndex, _, open := reflect.Select([]reflect.SelectCase{ 25 | {Dir: reflect.SelectRecv, Chan: channelValue}, 26 | {Dir: reflect.SelectDefault}, 27 | }) 28 | 29 | var closed bool 30 | if winnerIndex == 0 { 31 | closed = !open 32 | } else if winnerIndex == 1 { 33 | closed = false 34 | } 35 | 36 | return closed, nil 37 | } 38 | 39 | func (matcher *BeClosedMatcher) FailureMessage(actual interface{}) (message string) { 40 | return format.Message(actual, "to be closed") 41 | } 42 | 43 | func (matcher *BeClosedMatcher) NegatedFailureMessage(actual interface{}) (message string) { 44 | return format.Message(actual, "to be open") 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | ) 7 | 8 | type BeEmptyMatcher struct { 9 | } 10 | 11 | func (matcher *BeEmptyMatcher) Match(actual interface{}) (success bool, err error) { 12 | length, ok := lengthOf(actual) 13 | if !ok { 14 | return false, fmt.Errorf("BeEmpty matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) 15 | } 16 | 17 | return length == 0, nil 18 | } 19 | 20 | func (matcher *BeEmptyMatcher) FailureMessage(actual interface{}) (message string) { 21 | return format.Message(actual, "to be empty") 22 | } 23 | 24 | func (matcher *BeEmptyMatcher) NegatedFailureMessage(actual interface{}) (message string) { 25 | return format.Message(actual, "not to be empty") 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "reflect" 7 | ) 8 | 9 | type BeEquivalentToMatcher struct { 10 | Expected interface{} 11 | } 12 | 13 | func (matcher *BeEquivalentToMatcher) Match(actual interface{}) (success bool, err error) { 14 | if actual == nil && matcher.Expected == nil { 15 | return false, fmt.Errorf("Both actual and expected must not be nil.") 16 | } 17 | 18 | convertedActual := actual 19 | 20 | if actual != nil && matcher.Expected != nil && reflect.TypeOf(actual).ConvertibleTo(reflect.TypeOf(matcher.Expected)) { 21 | convertedActual = reflect.ValueOf(actual).Convert(reflect.TypeOf(matcher.Expected)).Interface() 22 | } 23 | 24 | return reflect.DeepEqual(convertedActual, matcher.Expected), nil 25 | } 26 | 27 | func (matcher *BeEquivalentToMatcher) FailureMessage(actual interface{}) (message string) { 28 | return format.Message(actual, "to be equivalent to", matcher.Expected) 29 | } 30 | 31 | func (matcher *BeEquivalentToMatcher) NegatedFailureMessage(actual interface{}) (message string) { 32 | return format.Message(actual, "not to be equivalent to", matcher.Expected) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_false_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | ) 7 | 8 | type BeFalseMatcher struct { 9 | } 10 | 11 | func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err error) { 12 | if !isBool(actual) { 13 | return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) 14 | } 15 | 16 | return actual == false, nil 17 | } 18 | 19 | func (matcher *BeFalseMatcher) FailureMessage(actual interface{}) (message string) { 20 | return format.Message(actual, "to be false") 21 | } 22 | 23 | func (matcher *BeFalseMatcher) NegatedFailureMessage(actual interface{}) (message string) { 24 | return format.Message(actual, "not to be false") 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_identical_to.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "runtime" 6 | 7 | "github.com/onsi/gomega/format" 8 | ) 9 | 10 | type BeIdenticalToMatcher struct { 11 | Expected interface{} 12 | } 13 | 14 | func (matcher *BeIdenticalToMatcher) Match(actual interface{}) (success bool, matchErr error) { 15 | if actual == nil && matcher.Expected == nil { 16 | 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.") 17 | } 18 | 19 | defer func() { 20 | if r := recover(); r != nil { 21 | if _, ok := r.(runtime.Error); ok { 22 | success = false 23 | matchErr = nil 24 | } 25 | } 26 | }() 27 | 28 | return actual == matcher.Expected, nil 29 | } 30 | 31 | func (matcher *BeIdenticalToMatcher) FailureMessage(actual interface{}) string { 32 | return format.Message(actual, "to be identical to", matcher.Expected) 33 | } 34 | 35 | func (matcher *BeIdenticalToMatcher) NegatedFailureMessage(actual interface{}) string { 36 | return format.Message(actual, "not to be identical to", matcher.Expected) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import "github.com/onsi/gomega/format" 4 | 5 | type BeNilMatcher struct { 6 | } 7 | 8 | func (matcher *BeNilMatcher) Match(actual interface{}) (success bool, err error) { 9 | return isNil(actual), nil 10 | } 11 | 12 | func (matcher *BeNilMatcher) FailureMessage(actual interface{}) (message string) { 13 | return format.Message(actual, "to be nil") 14 | } 15 | 16 | func (matcher *BeNilMatcher) NegatedFailureMessage(actual interface{}) (message string) { 17 | return format.Message(actual, "not to be nil") 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_true_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | ) 7 | 8 | type BeTrueMatcher struct { 9 | } 10 | 11 | func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) { 12 | if !isBool(actual) { 13 | return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) 14 | } 15 | 16 | return actual.(bool), nil 17 | } 18 | 19 | func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) { 20 | return format.Message(actual, "to be true") 21 | } 22 | 23 | func (matcher *BeTrueMatcher) NegatedFailureMessage(actual interface{}) (message string) { 24 | return format.Message(actual, "not to be true") 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "github.com/onsi/gomega/format" 5 | "reflect" 6 | ) 7 | 8 | type BeZeroMatcher struct { 9 | } 10 | 11 | func (matcher *BeZeroMatcher) Match(actual interface{}) (success bool, err error) { 12 | if actual == nil { 13 | return true, nil 14 | } 15 | zeroValue := reflect.Zero(reflect.TypeOf(actual)).Interface() 16 | 17 | return reflect.DeepEqual(zeroValue, actual), nil 18 | 19 | } 20 | 21 | func (matcher *BeZeroMatcher) FailureMessage(actual interface{}) (message string) { 22 | return format.Message(actual, "to be zero-valued") 23 | } 24 | 25 | func (matcher *BeZeroMatcher) NegatedFailureMessage(actual interface{}) (message string) { 26 | return format.Message(actual, "not to be zero-valued") 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "strings" 7 | ) 8 | 9 | type ContainSubstringMatcher struct { 10 | Substr string 11 | Args []interface{} 12 | } 13 | 14 | func (matcher *ContainSubstringMatcher) Match(actual interface{}) (success bool, err error) { 15 | actualString, ok := toString(actual) 16 | if !ok { 17 | return false, fmt.Errorf("ContainSubstring matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) 18 | } 19 | 20 | return strings.Contains(actualString, matcher.stringToMatch()), nil 21 | } 22 | 23 | func (matcher *ContainSubstringMatcher) stringToMatch() string { 24 | stringToMatch := matcher.Substr 25 | if len(matcher.Args) > 0 { 26 | stringToMatch = fmt.Sprintf(matcher.Substr, matcher.Args...) 27 | } 28 | return stringToMatch 29 | } 30 | 31 | func (matcher *ContainSubstringMatcher) FailureMessage(actual interface{}) (message string) { 32 | return format.Message(actual, "to contain substring", matcher.stringToMatch()) 33 | } 34 | 35 | func (matcher *ContainSubstringMatcher) NegatedFailureMessage(actual interface{}) (message string) { 36 | return format.Message(actual, "not to contain substring", matcher.stringToMatch()) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/equal_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | 7 | "github.com/onsi/gomega/format" 8 | ) 9 | 10 | type EqualMatcher struct { 11 | Expected interface{} 12 | } 13 | 14 | func (matcher *EqualMatcher) Match(actual interface{}) (success bool, err error) { 15 | if actual == nil && matcher.Expected == nil { 16 | 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.") 17 | } 18 | return reflect.DeepEqual(actual, matcher.Expected), nil 19 | } 20 | 21 | func (matcher *EqualMatcher) FailureMessage(actual interface{}) (message string) { 22 | return format.Message(actual, "to equal", matcher.Expected) 23 | } 24 | 25 | func (matcher *EqualMatcher) NegatedFailureMessage(actual interface{}) (message string) { 26 | return format.Message(actual, "not to equal", matcher.Expected) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/onsi/gomega/format" 7 | ) 8 | 9 | type HaveCapMatcher struct { 10 | Count int 11 | } 12 | 13 | func (matcher *HaveCapMatcher) Match(actual interface{}) (success bool, err error) { 14 | length, ok := capOf(actual) 15 | if !ok { 16 | return false, fmt.Errorf("HaveCap matcher expects a array/channel/slice. Got:\n%s", format.Object(actual, 1)) 17 | } 18 | 19 | return length == matcher.Count, nil 20 | } 21 | 22 | func (matcher *HaveCapMatcher) FailureMessage(actual interface{}) (message string) { 23 | return fmt.Sprintf("Expected\n%s\nto have capacity %d", format.Object(actual, 1), matcher.Count) 24 | } 25 | 26 | func (matcher *HaveCapMatcher) NegatedFailureMessage(actual interface{}) (message string) { 27 | return fmt.Sprintf("Expected\n%s\nnot to have capacity %d", format.Object(actual, 1), matcher.Count) 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_len_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | ) 7 | 8 | type HaveLenMatcher struct { 9 | Count int 10 | } 11 | 12 | func (matcher *HaveLenMatcher) Match(actual interface{}) (success bool, err error) { 13 | length, ok := lengthOf(actual) 14 | if !ok { 15 | return false, fmt.Errorf("HaveLen matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) 16 | } 17 | 18 | return length == matcher.Count, nil 19 | } 20 | 21 | func (matcher *HaveLenMatcher) FailureMessage(actual interface{}) (message string) { 22 | return fmt.Sprintf("Expected\n%s\nto have length %d", format.Object(actual, 1), matcher.Count) 23 | } 24 | 25 | func (matcher *HaveLenMatcher) NegatedFailureMessage(actual interface{}) (message string) { 26 | return fmt.Sprintf("Expected\n%s\nnot to have length %d", format.Object(actual, 1), matcher.Count) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/onsi/gomega/format" 7 | ) 8 | 9 | type HaveOccurredMatcher struct { 10 | } 11 | 12 | func (matcher *HaveOccurredMatcher) Match(actual interface{}) (success bool, err error) { 13 | // is purely nil? 14 | if actual == nil { 15 | return false, 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 non-nil (or a pointer to a non-nil) 24 | return !isNil(actual), nil 25 | } 26 | 27 | func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message string) { 28 | return fmt.Sprintf("Expected an error to have occurred. Got:\n%s", format.Object(actual, 1)) 29 | } 30 | 31 | func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) { 32 | return fmt.Sprintf("Expected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "not to have occurred") 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | ) 7 | 8 | type HavePrefixMatcher struct { 9 | Prefix string 10 | Args []interface{} 11 | } 12 | 13 | func (matcher *HavePrefixMatcher) Match(actual interface{}) (success bool, err error) { 14 | actualString, ok := toString(actual) 15 | if !ok { 16 | return false, fmt.Errorf("HavePrefix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) 17 | } 18 | prefix := matcher.prefix() 19 | return len(actualString) >= len(prefix) && actualString[0:len(prefix)] == prefix, nil 20 | } 21 | 22 | func (matcher *HavePrefixMatcher) prefix() string { 23 | if len(matcher.Args) > 0 { 24 | return fmt.Sprintf(matcher.Prefix, matcher.Args...) 25 | } 26 | return matcher.Prefix 27 | } 28 | 29 | func (matcher *HavePrefixMatcher) FailureMessage(actual interface{}) (message string) { 30 | return format.Message(actual, "to have prefix", matcher.prefix()) 31 | } 32 | 33 | func (matcher *HavePrefixMatcher) NegatedFailureMessage(actual interface{}) (message string) { 34 | return format.Message(actual, "not to have prefix", matcher.prefix()) 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | ) 7 | 8 | type HaveSuffixMatcher struct { 9 | Suffix string 10 | Args []interface{} 11 | } 12 | 13 | func (matcher *HaveSuffixMatcher) Match(actual interface{}) (success bool, err error) { 14 | actualString, ok := toString(actual) 15 | if !ok { 16 | return false, fmt.Errorf("HaveSuffix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) 17 | } 18 | suffix := matcher.suffix() 19 | return len(actualString) >= len(suffix) && actualString[len(actualString)-len(suffix):] == suffix, nil 20 | } 21 | 22 | func (matcher *HaveSuffixMatcher) suffix() string { 23 | if len(matcher.Args) > 0 { 24 | return fmt.Sprintf(matcher.Suffix, matcher.Args...) 25 | } 26 | return matcher.Suffix 27 | } 28 | 29 | func (matcher *HaveSuffixMatcher) FailureMessage(actual interface{}) (message string) { 30 | return format.Message(actual, "to have suffix", matcher.suffix()) 31 | } 32 | 33 | func (matcher *HaveSuffixMatcher) NegatedFailureMessage(actual interface{}) (message string) { 34 | return format.Message(actual, "not to have suffix", matcher.suffix()) 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "regexp" 7 | ) 8 | 9 | type MatchRegexpMatcher struct { 10 | Regexp string 11 | Args []interface{} 12 | } 13 | 14 | func (matcher *MatchRegexpMatcher) Match(actual interface{}) (success bool, err error) { 15 | actualString, ok := toString(actual) 16 | if !ok { 17 | return false, fmt.Errorf("RegExp matcher requires a string or stringer.\nGot:%s", format.Object(actual, 1)) 18 | } 19 | 20 | match, err := regexp.Match(matcher.regexp(), []byte(actualString)) 21 | if err != nil { 22 | return false, fmt.Errorf("RegExp match failed to compile with error:\n\t%s", err.Error()) 23 | } 24 | 25 | return match, nil 26 | } 27 | 28 | func (matcher *MatchRegexpMatcher) FailureMessage(actual interface{}) (message string) { 29 | return format.Message(actual, "to match regular expression", matcher.regexp()) 30 | } 31 | 32 | func (matcher *MatchRegexpMatcher) NegatedFailureMessage(actual interface{}) (message string) { 33 | return format.Message(actual, "not to match regular expression", matcher.regexp()) 34 | } 35 | 36 | func (matcher *MatchRegexpMatcher) regexp() string { 37 | re := matcher.Regexp 38 | if len(matcher.Args) > 0 { 39 | re = fmt.Sprintf(matcher.Regexp, matcher.Args...) 40 | } 41 | return re 42 | } 43 | -------------------------------------------------------------------------------- /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 | "github.com/onsi/gomega/format" 6 | "reflect" 7 | ) 8 | 9 | type PanicMatcher struct{} 10 | 11 | func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error) { 12 | if actual == nil { 13 | return false, fmt.Errorf("PanicMatcher expects a non-nil actual.") 14 | } 15 | 16 | actualType := reflect.TypeOf(actual) 17 | if actualType.Kind() != reflect.Func { 18 | return false, fmt.Errorf("PanicMatcher expects a function. Got:\n%s", format.Object(actual, 1)) 19 | } 20 | if !(actualType.NumIn() == 0 && actualType.NumOut() == 0) { 21 | return false, fmt.Errorf("PanicMatcher expects a function with no arguments and no return value. Got:\n%s", format.Object(actual, 1)) 22 | } 23 | 24 | success = false 25 | defer func() { 26 | if e := recover(); e != nil { 27 | success = true 28 | } 29 | }() 30 | 31 | reflect.ValueOf(actual).Call([]reflect.Value{}) 32 | 33 | return 34 | } 35 | 36 | func (matcher *PanicMatcher) FailureMessage(actual interface{}) (message string) { 37 | return format.Message(actual, "to panic") 38 | } 39 | 40 | func (matcher *PanicMatcher) NegatedFailureMessage(actual interface{}) (message string) { 41 | return format.Message(actual, "not to panic") 42 | } 43 | -------------------------------------------------------------------------------- /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 "errors" 4 | import "fmt" 5 | 6 | import . "github.com/onsi/gomega/matchers/support/goraph/node" 7 | import . "github.com/onsi/gomega/matchers/support/goraph/edge" 8 | 9 | type BipartiteGraph struct { 10 | Left NodeOrderedSet 11 | Right NodeOrderedSet 12 | Edges EdgeSet 13 | } 14 | 15 | func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(interface{}, interface{}) (bool, error)) (*BipartiteGraph, error) { 16 | left := NodeOrderedSet{} 17 | for i := range leftValues { 18 | left = append(left, Node{i}) 19 | } 20 | 21 | right := NodeOrderedSet{} 22 | for j := range rightValues { 23 | right = append(right, Node{j + len(left)}) 24 | } 25 | 26 | edges := EdgeSet{} 27 | for i, leftValue := range leftValues { 28 | for j, rightValue := range rightValues { 29 | neighbours, err := neighbours(leftValue, rightValue) 30 | if err != nil { 31 | return nil, errors.New(fmt.Sprintf("error determining adjacency for %v and %v: %s", leftValue, rightValue, err.Error())) 32 | } 33 | 34 | if neighbours { 35 | edges = append(edges, Edge{left[i], right[j]}) 36 | } 37 | } 38 | } 39 | 40 | return &BipartiteGraph{left, right, edges}, nil 41 | } 42 | -------------------------------------------------------------------------------- /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 Node 7 | Node2 Node 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 || e.Node2 == node { 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 && e.Node2 == node2) || (e.Node1 == node2 && e.Node2 == node1) { 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 | } 6 | 7 | type NodeOrderedSet []Node 8 | -------------------------------------------------------------------------------- /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 GomegaFailHandler func(message string, callerSkip ...int) 4 | 5 | //A simple *testing.T interface wrapper 6 | type GomegaTestingT interface { 7 | Errorf(format string, args ...interface{}) 8 | } 9 | 10 | //All Gomega matchers must implement the GomegaMatcher interface 11 | // 12 | //For details on writing custom matchers, check out: http://onsi.github.io/gomega/#adding_your_own_matchers 13 | type GomegaMatcher interface { 14 | Match(actual interface{}) (success bool, err error) 15 | FailureMessage(actual interface{}) (message string) 16 | NegatedFailureMessage(actual interface{}) (message string) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4.3 5 | - 1.5.3 6 | - release 7 | - tip 8 | 9 | script: 10 | - go test -v ./... 11 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | We definitely welcome patches and contribution to this project! 4 | 5 | ### Legal requirements 6 | 7 | In order to protect both you and ourselves, you will need to sign the 8 | [Contributor License Agreement](https://cla.developers.google.com/clas). 9 | 10 | You may have already signed it for other Google projects. 11 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Paul Borman 2 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/README.md: -------------------------------------------------------------------------------- 1 | This project was automatically exported from code.google.com/p/go-uuid 2 | 3 | # uuid ![build status](https://travis-ci.org/pborman/uuid.svg?branch=master) 4 | The uuid package generates and inspects UUIDs based on [RFC 412](http://tools.ietf.org/html/rfc4122) and DCE 1.1: Authentication and Security Services. 5 | 6 | ###### Install 7 | `go get github.com/pborman/uuid` 8 | 9 | ###### Documentation 10 | [![GoDoc](https://godoc.org/github.com/pborman/uuid?status.svg)](http://godoc.org/github.com/pborman/uuid) 11 | 12 | Full `go doc` style documentation for the package can be viewed online without installing this package by using the GoDoc site here: 13 | http://godoc.org/github.com/pborman/uuid 14 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. 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 | // The uuid package generates and inspects UUIDs. 6 | // 7 | // UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security Services. 8 | package uuid 9 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/json.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Google Inc. 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 uuid 6 | 7 | import "errors" 8 | 9 | func (u UUID) MarshalJSON() ([]byte, error) { 10 | if len(u) != 16 { 11 | return []byte(`""`), nil 12 | } 13 | var js [38]byte 14 | js[0] = '"' 15 | encodeHex(js[1:], u) 16 | js[37] = '"' 17 | return js[:], nil 18 | } 19 | 20 | func (u *UUID) UnmarshalJSON(data []byte) error { 21 | if string(data) == `""` { 22 | return nil 23 | } 24 | if data[0] != '"' { 25 | return errors.New("invalid UUID format") 26 | } 27 | data = data[1 : len(data)-1] 28 | uu := Parse(string(data)) 29 | if uu == nil { 30 | return errors.New("invalid UUID format") 31 | } 32 | *u = uu 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/version1.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. 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 uuid 6 | 7 | import ( 8 | "encoding/binary" 9 | ) 10 | 11 | // NewUUID returns a Version 1 UUID based on the current NodeID and clock 12 | // sequence, and the current time. If the NodeID has not been set by SetNodeID 13 | // or SetNodeInterface then it will be set automatically. If the NodeID cannot 14 | // be set NewUUID returns nil. If clock sequence has not been set by 15 | // SetClockSequence then it will be set automatically. If GetTime fails to 16 | // return the current NewUUID returns nil. 17 | func NewUUID() UUID { 18 | if nodeID == nil { 19 | SetNodeInterface("") 20 | } 21 | 22 | now, seq, err := GetTime() 23 | if err != nil { 24 | return nil 25 | } 26 | 27 | uuid := make([]byte, 16) 28 | 29 | time_low := uint32(now & 0xffffffff) 30 | time_mid := uint16((now >> 32) & 0xffff) 31 | time_hi := uint16((now >> 48) & 0x0fff) 32 | time_hi |= 0x1000 // Version 1 33 | 34 | binary.BigEndian.PutUint32(uuid[0:], time_low) 35 | binary.BigEndian.PutUint16(uuid[4:], time_mid) 36 | binary.BigEndian.PutUint16(uuid[6:], time_hi) 37 | binary.BigEndian.PutUint16(uuid[8:], seq) 38 | copy(uuid[10:], nodeID) 39 | 40 | return uuid 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/pborman/uuid/version4.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. 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 uuid 6 | 7 | // Random returns a Random (Version 4) UUID or panics. 8 | // 9 | // The strength of the UUIDs is based on the strength of the crypto/rand 10 | // package. 11 | // 12 | // A note about uniqueness derived from from the UUID Wikipedia entry: 13 | // 14 | // Randomly generated UUIDs have 122 random bits. One's annual risk of being 15 | // hit by a meteorite is estimated to be one chance in 17 billion, that 16 | // means the probability is about 0.00000000006 (6 × 10−11), 17 | // equivalent to the odds of creating a few tens of trillions of UUIDs in a 18 | // year and having one duplicate. 19 | func NewRandom() UUID { 20 | uuid := make([]byte, 16) 21 | randomBits([]byte(uuid)) 22 | uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 23 | uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 24 | return uuid 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/phylake/go-cli/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.3 5 | - 1.4 6 | - 1.5 7 | 8 | before_install: 9 | - go get -t ./... 10 | - go get github.com/onsi/ginkgo/ginkgo 11 | 12 | script: 13 | - ginkgo -r -p -race 14 | -------------------------------------------------------------------------------- /vendor/github.com/phylake/go-cli/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: test 2 | 3 | test: 4 | go fmt ./... 5 | ginkgo -r -p -race 6 | -------------------------------------------------------------------------------- /vendor/github.com/phylake/go-cli/README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/phylake/go-cli.svg?branch=master)](https://travis-ci.org/phylake/go-cli) [![godoc reference](https://godoc.org/github.com/phylake/go-cli?status.png)](https://godoc.org/github.com/phylake/go-cli) 2 | 3 | # go-cli 4 | 5 | A minimalist framework for CLIs containing nested commands. 6 | 7 | There's a surprising amount of entirely uninteresting code needed to create a 8 | human and machine friendly CLI such as 9 | 10 | - ensuring proper exit codes on invalid input 11 | - calculating sub-command list padding 12 | - parsing `os.Args` so each command is passed only the arguments scoped to it 13 | 14 | [See the example](example/main.go) 15 | -------------------------------------------------------------------------------- /vendor/github.com/phylake/go-cli/cmd/default.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import "github.com/phylake/go-cli" 4 | 5 | // Default is the default implementation of cli.Command. 6 | // 7 | // It simply returns struct fields to satisfy the interface. 8 | type Default struct { 9 | NameStr string 10 | ShortHelpStr string 11 | LongHelpStr string 12 | ExecuteFunc func([]string) bool 13 | SubCommandList []cli.Command 14 | } 15 | 16 | func (cmd *Default) Name() string { 17 | return cmd.NameStr 18 | } 19 | 20 | func (cmd *Default) ShortHelp() string { 21 | return cmd.ShortHelpStr 22 | } 23 | 24 | func (cmd *Default) LongHelp() string { 25 | return cmd.LongHelpStr 26 | } 27 | 28 | func (cmd *Default) Execute(args []string) bool { 29 | if cmd.ExecuteFunc != nil { 30 | return cmd.ExecuteFunc(args) 31 | } 32 | return false 33 | } 34 | 35 | func (cmd *Default) SubCommands() []cli.Command { 36 | return cmd.SubCommandList 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/phylake/go-cli/cmd/readme.md: -------------------------------------------------------------------------------- 1 | [![godoc reference](https://godoc.org/github.com/phylake/go-cli/cmd?status.png)](https://godoc.org/github.com/phylake/go-cli/cmd) 2 | -------------------------------------------------------------------------------- /vendor/github.com/phylake/go-cli/cmd/root.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import "github.com/phylake/go-cli" 4 | 5 | // Root implements cli.Command. 6 | // 7 | // It represents the command to your CLI with no arguments and has only a help 8 | // string and a list of sub commands. 9 | type Root struct { 10 | Help string 11 | SubCommandList []cli.Command 12 | } 13 | 14 | func (cmd *Root) Name() string { 15 | return "" 16 | } 17 | 18 | // There's no short help for the root command 19 | func (cmd *Root) ShortHelp() string { 20 | return "" 21 | } 22 | 23 | func (cmd *Root) LongHelp() string { 24 | return cmd.Help 25 | } 26 | 27 | // The root command isn't run because a call to the CLI with no arguments should 28 | // print out the Help string 29 | func (cmd *Root) Execute([]string) bool { 30 | return false 31 | } 32 | 33 | func (cmd *Root) SubCommands() []cli.Command { 34 | return cmd.SubCommandList 35 | } 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/context/ctxhttp/cancelreq.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 go1.5 6 | 7 | package ctxhttp 8 | 9 | import "net/http" 10 | 11 | func canceler(client *http.Client, req *http.Request) func() { 12 | // TODO(djd): Respect any existing value of req.Cancel. 13 | ch := make(chan struct{}) 14 | req.Cancel = ch 15 | 16 | return func() { 17 | close(ch) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/context/ctxhttp/cancelreq_go14.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 !go1.5 6 | 7 | package ctxhttp 8 | 9 | import "net/http" 10 | 11 | type requestCanceler interface { 12 | CancelRequest(*http.Request) 13 | } 14 | 15 | func canceler(client *http.Client, req *http.Request) func() { 16 | rc, ok := client.Transport.(requestCanceler) 17 | if !ok { 18 | return func() {} 19 | } 20 | return func() { 21 | rc.CancelRequest(req) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | ) 27 | 28 | // Socketoption Level 29 | const ( 30 | SOL_BLUETOOTH = 0x112 31 | SOL_HCI = 0x0 32 | SOL_L2CAP = 0x6 33 | SOL_RFCOMM = 0x12 34 | SOL_SCO = 0x11 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.4 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | func Unsetenv(key string) error { 12 | // This was added in Go 1.4. 13 | return syscall.Unsetenv(key) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd openbsd netbsd dragonfly 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | // +build darwin dragonfly freebsd linux netbsd openbsd 8 | 9 | package unix 10 | 11 | import "unsafe" 12 | 13 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 14 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 15 | var fcntl64Syscall uintptr = SYS_FCNTL 16 | 17 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 18 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 19 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 20 | if errno == 0 { 21 | return nil 22 | } 23 | return errno 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define _STRINGIFY2_(x) #x 12 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 13 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 14 | 15 | // Call syscall from C code because the gccgo support for calling from 16 | // Go to C does not support varargs functions. 17 | 18 | struct ret { 19 | uintptr_t r; 20 | uintptr_t err; 21 | }; 22 | 23 | struct ret 24 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 25 | { 26 | struct ret r; 27 | 28 | errno = 0; 29 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 30 | r.err = errno; 31 | return r; 32 | } 33 | 34 | // Define the use function in C so that it is not inlined. 35 | 36 | extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline)); 37 | 38 | void 39 | use(void *p __attribute__ ((unused))) 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mksysnum_darwin.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | # 6 | # Generate system call table for Darwin from sys/syscall.h 7 | 8 | use strict; 9 | 10 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 11 | print STDERR "GOARCH or GOOS not defined in environment\n"; 12 | exit 1; 13 | } 14 | 15 | my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); 16 | 17 | print <){ 29 | if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ 30 | my $name = $1; 31 | my $num = $2; 32 | $name =~ y/a-z/A-Z/; 33 | print " SYS_$name = $num;" 34 | } 35 | } 36 | 37 | print <){ 30 | if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print < 999){ 29 | # ignore deprecated syscalls that are no longer implemented 30 | # https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/unistd.h?id=refs/heads/master#n716 31 | return; 32 | } 33 | $name =~ y/a-z/A-Z/; 34 | print " SYS_$name = $num;\n"; 35 | } 36 | 37 | my $prev; 38 | open(GCC, "gcc -E -dD $ARGV[0] |") || die "can't run gcc"; 39 | while(){ 40 | if(/^#define __NR_syscalls\s+/) { 41 | # ignore redefinitions of __NR_syscalls 42 | } 43 | elsif(/^#define __NR_(\w+)\s+([0-9]+)/){ 44 | $prev = $2; 45 | fmt($1, $2); 46 | } 47 | elsif(/^#define __NR3264_(\w+)\s+([0-9]+)/){ 48 | $prev = $2; 49 | fmt($1, $2); 50 | } 51 | elsif(/^#define __NR_(\w+)\s+\(\w+\+\s*([0-9]+)\)/){ 52 | fmt($1, $prev+$2) 53 | } 54 | } 55 | 56 | print <){ 31 | if($line =~ /^(.*)\\$/) { 32 | # Handle continuation 33 | $line = $1; 34 | $_ =~ s/^\s+//; 35 | $line .= $_; 36 | } else { 37 | # New line 38 | $line = $_; 39 | } 40 | next if $line =~ /\\$/; 41 | if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) { 42 | my $num = $1; 43 | my $proto = $6; 44 | my $compat = $8; 45 | my $name = "$7_$9"; 46 | 47 | $name = "$7_$11" if $11 ne ''; 48 | $name =~ y/a-z/A-Z/; 49 | 50 | if($compat eq '' || $compat eq '30' || $compat eq '50') { 51 | print " $name = $num; // $proto\n"; 52 | } 53 | } 54 | } 55 | 56 | print <){ 30 | if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $3; 33 | my $name = $4; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <= 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_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int64(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint64(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint64(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_no_getwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly freebsd netbsd openbsd 6 | 7 | package unix 8 | 9 | const ImplementsGetwd = false 10 | 11 | func Getwd() (string, error) { return "", ENOTSUP } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = int16(mode) 29 | k.Flags = uint16(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = nsec / 1e9 15 | ts.Nsec = nsec % 1e9 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = nsec % 1e9 / 1e3 22 | tv.Sec = nsec / 1e9 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint64(fd) 28 | k.Filter = int16(mode) 29 | k.Flags = uint16(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint64(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = nsec / 1e9 13 | ts.Nsec = nsec % 1e9 14 | return 15 | } 16 | 17 | func NsecToTimeval(nsec int64) (tv Timeval) { 18 | nsec += 999 // round up to microsecond 19 | tv.Usec = nsec % 1e9 / 1e3 20 | tv.Sec = int64(nsec / 1e9) 21 | return 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (cmsg *Cmsghdr) SetLen(length int) { 29 | cmsg.Len = uint32(length) 30 | } 31 | 32 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 33 | // TODO(aram): implement this, see issue 5847. 34 | panic("unimplemented") 35 | } 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | // TODO(aram): remove these before Go 1.3. 10 | const ( 11 | SYS_EXECVE = 59 12 | SYS_FCNTL = 62 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.0 5 | - 1.1 6 | - 1.2 7 | - 1.3 8 | - release 9 | - tip 10 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Contributors to log15: 2 | 3 | - Aaron L 4 | - Alan Shreve 5 | - Chris Hines 6 | - Ciaran Downey 7 | - Dmitry Chestnykh 8 | - Evan Shaw 9 | - Péter Szilágyi 10 | - Trevor Gattis 11 | - Vincent Vanackere 12 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Alan Shreve 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/RELEASING.md: -------------------------------------------------------------------------------- 1 | # log15's release strategy 2 | 3 | log15 uses gopkg.in to manage versioning releases so that consumers who don't vendor dependencies can rely upon a stable API. 4 | 5 | ## Master 6 | 7 | Master is considered to have no API stability guarantee, so merging new code that passes tests into master is always okay. 8 | 9 | ## Releasing a new API-compatible version 10 | 11 | The process to release a new API-compatible version is described below. For the purposes of this example, we'll assume you're trying to release a new version of v2 12 | 13 | 1. `git checkout v2` 14 | 1. `git merge master` 15 | 1. Audit the code for any imports of sub-packages. Modify any import references from `github.com/inconshrevealbe/log15/` -> `gopkg.in/inconshreveable/log15.v2/` 16 | 1. `git commit` 17 | 1. `git tag`, find the latest tag of the style v2.X. 18 | 1. `git tag v2.X+1` If the last version was v2.6, you would run `git tag v2.7` 19 | 1. `git push --tags git@github.com:inconshreveable/log15.git v2` 20 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/handler_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package log15 4 | 5 | import "sync" 6 | 7 | // swapHandler wraps another handler that may be swapped out 8 | // dynamically at runtime in a thread-safe fashion. 9 | type swapHandler struct { 10 | handler interface{} 11 | lock sync.RWMutex 12 | } 13 | 14 | func (h *swapHandler) Log(r *Record) error { 15 | h.lock.RLock() 16 | defer h.lock.RUnlock() 17 | 18 | return h.handler.(Handler).Log(r) 19 | } 20 | 21 | func (h *swapHandler) Swap(newHandler Handler) { 22 | h.lock.Lock() 23 | defer h.lock.Unlock() 24 | 25 | h.handler = newHandler 26 | } 27 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/handler_other.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | 3 | package log15 4 | 5 | import ( 6 | "sync/atomic" 7 | "unsafe" 8 | ) 9 | 10 | // swapHandler wraps another handler that may be swapped out 11 | // dynamically at runtime in a thread-safe fashion. 12 | type swapHandler struct { 13 | handler unsafe.Pointer 14 | } 15 | 16 | func (h *swapHandler) Log(r *Record) error { 17 | return (*(*Handler)(atomic.LoadPointer(&h.handler))).Log(r) 18 | } 19 | 20 | func (h *swapHandler) Swap(newHandler Handler) { 21 | atomic.StorePointer(&h.handler, unsafe.Pointer(&newHandler)) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/stack/stack_pool.go: -------------------------------------------------------------------------------- 1 | // +build go1.3 2 | 3 | package stack 4 | 5 | import ( 6 | "sync" 7 | ) 8 | 9 | var pcStackPool = sync.Pool{ 10 | New: func() interface{} { return make([]uintptr, 1000) }, 11 | } 12 | 13 | func poolBuf() []uintptr { 14 | return pcStackPool.Get().([]uintptr) 15 | } 16 | 17 | func putPoolBuf(p []uintptr) { 18 | pcStackPool.Put(p) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/stack/stack_pool_chan.go: -------------------------------------------------------------------------------- 1 | // +build !go1.3 appengine 2 | 3 | package stack 4 | 5 | const ( 6 | stackPoolSize = 64 7 | ) 8 | 9 | var ( 10 | pcStackPool = make(chan []uintptr, stackPoolSize) 11 | ) 12 | 13 | func poolBuf() []uintptr { 14 | select { 15 | case p := <-pcStackPool: 16 | return p 17 | default: 18 | return make([]uintptr, 1000) 19 | } 20 | } 21 | 22 | func putPoolBuf(p []uintptr) { 23 | select { 24 | case pcStackPool <- p: 25 | default: 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/term/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Simon Eskildsen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/term/terminal_appengine.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2013 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build appengine 7 | 8 | package term 9 | 10 | // IsTty always returns false on AppEngine. 11 | func IsTty(fd uintptr) bool { 12 | return false 13 | } 14 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/term/terminal_darwin.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2013 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package term 7 | 8 | import "syscall" 9 | 10 | const ioctlReadTermios = syscall.TIOCGETA 11 | 12 | type Termios syscall.Termios 13 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/term/terminal_freebsd.go: -------------------------------------------------------------------------------- 1 | package term 2 | 3 | import ( 4 | "syscall" 5 | ) 6 | 7 | const ioctlReadTermios = syscall.TIOCGETA 8 | 9 | // Go 1.2 doesn't include Termios for FreeBSD. This should be added in 1.3 and this could be merged with terminal_darwin. 10 | type Termios struct { 11 | Iflag uint32 12 | Oflag uint32 13 | Cflag uint32 14 | Lflag uint32 15 | Cc [20]uint8 16 | Ispeed uint32 17 | Ospeed uint32 18 | } 19 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/term/terminal_linux.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2013 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build !appengine 7 | 8 | package term 9 | 10 | import "syscall" 11 | 12 | const ioctlReadTermios = syscall.TCGETS 13 | 14 | type Termios syscall.Termios 15 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/term/terminal_notwindows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build linux,!appengine darwin freebsd openbsd 7 | 8 | package term 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | // IsTty returns true if the given file descriptor is a terminal. 16 | func IsTty(fd uintptr) bool { 17 | var termios Termios 18 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 19 | return err == 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/term/terminal_openbsd.go: -------------------------------------------------------------------------------- 1 | package term 2 | 3 | import "syscall" 4 | 5 | const ioctlReadTermios = syscall.TIOCGETA 6 | 7 | type Termios syscall.Termios 8 | -------------------------------------------------------------------------------- /vendor/gopkg.in/inconshreveable/log15.v2/term/terminal_windows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build windows 7 | 8 | package term 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | var kernel32 = syscall.NewLazyDLL("kernel32.dll") 16 | 17 | var ( 18 | procGetConsoleMode = kernel32.NewProc("GetConsoleMode") 19 | ) 20 | 21 | // IsTty returns true if the given file descriptor is a terminal. 22 | func IsTty(fd uintptr) bool { 23 | var st uint32 24 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) 25 | return r != 0 && e == 0 26 | } 27 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/.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/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 | --------------------------------------------------------------------------------