From 1d691cd8d6d13efac0411d250ad0694bb99b915e Mon Sep 17 00:00:00 2001 From: Ivan Mikushin Date: Thu, 26 Nov 2015 17:37:01 +0500 Subject: [PATCH] move dependencies to vendor --- Godeps/Godeps.json | 416 --- .../logrus/hooks/airbrake/airbrake.go | 54 - .../Sirupsen/logrus/text_formatter.go | 124 - .../Sirupsen/logrus/text_formatter_test.go | 33 - .../docker/distribution/Godeps/Readme | 5 - .../autogen/dockerversion/dockerversion.go | 12 - .../docker/libcompose/docker/container.go | 508 --- .../docker/libcompose/docker/convert.go | 141 - .../docker/libcompose/docker/functions.go | 49 - .../docker/libcompose/docker/labels.go | 47 - .../docker/libcompose/logger/null.go | 14 - .../docker/libcompose/logger/types.go | 24 - .../docker/libcompose/project/empty.go | 56 - .../docker/libcompose/project/listener.go | 75 - .../docker/libcompose/project/project_test.go | 21 - .../docker/libcompose/project/types.go | 271 -- .../docker/libcompose/project/types_yaml.go | 250 -- .../fsouza/go-dockerclient/.dockerignore | 2 - .../fsouza/go-dockerclient/.travis.yml | 10 - .../fsouza/go-dockerclient/Dockerfile.1_3 | 10 - .../fsouza/go-dockerclient/Dockerfile.1_4 | 10 - .../fsouza/go-dockerclient/Makefile | 52 - .../go-dockerclient/codeship-services.yml | 24 - .../fsouza/go-dockerclient/codeship-steps.yml | 8 - .../go-dockerclient/testing/bin/fmtpolice | 42 - .../testing/data/.dockerignore | 3 - .../go-dockerclient/testing/data/Dockerfile | 15 - .../go-dockerclient/testing/data/barfile | 0 .../go-dockerclient/testing/data/ca.pem | 18 - .../go-dockerclient/testing/data/cert.pem | 18 - .../testing/data/dockerfile.tar | Bin 2560 -> 0 bytes .../go-dockerclient/testing/data/foofile | 0 .../go-dockerclient/testing/data/key.pem | 27 - .../go-dockerclient/testing/data/server.pem | 18 - .../testing/data/serverkey.pem | 27 - .../go-dockerclient/testing/data/symlink | 1 - .../fsouza/go-dockerclient/testing/server.go | 945 ----- .../go-dockerclient/testing/server_test.go | 1593 -------- .../github.com/Sirupsen/logrus/CHANGELOG.md | 21 - .../Sirupsen/logrus/terminal_freebsd.go | 20 - .../docker/docker/pkg/archive/diff.go | 168 - .../docker/docker/pkg/ioutils/readers.go | 227 -- .../docker/docker/pkg/stdcopy/stdcopy_test.go | 85 - .../docker/docker/pkg/system/filesys.go | 11 - .../docker/docker/pkg/system/stat.go | 46 - .../docker/pkg/system/stat_unsupported.go | 17 - .../docker/docker/pkg/system/stat_windows.go | 36 - .../docker/docker/pkg/system/utimes_linux.go | 28 - .../github.com/samalba/dockerclient/README.md | 98 - .../github.com/samalba/dockerclient/auth.go | 38 - .../samalba/dockerclient/auth_test.go | 15 - .../samalba/dockerclient/dockerclient.go | 714 ---- .../samalba/dockerclient/dockerclient_test.go | 240 -- .../samalba/dockerclient/engine_mock_test.go | 245 -- .../samalba/dockerclient/example_responses.go | 13 - .../samalba/dockerclient/examples/events.go | 39 - .../dockerclient/examples/stats/stats.go | 43 - .../samalba/dockerclient/interface.go | 46 - .../samalba/dockerclient/mockclient/mock.go | 162 - .../dockerclient/mockclient/mock_test.go | 32 - .../github.com/samalba/dockerclient/types.go | 444 --- .../github.com/samalba/dockerclient/utils.go | 33 - .../github.com/Sirupsen/logrus/.gitignore | 0 .../github.com/Sirupsen/logrus/.travis.yml | 0 .../github.com/Sirupsen/logrus/CHANGELOG.md | 47 + .../github.com/Sirupsen/logrus/LICENSE | 0 .../github.com/Sirupsen/logrus/README.md | 10 +- vendor/github.com/Sirupsen/logrus/doc.go | 26 + vendor/github.com/Sirupsen/logrus/entry.go | 264 ++ .../github.com/Sirupsen/logrus/entry_test.go | 77 + .../Sirupsen/logrus/examples/basic/basic.go | 10 + .../Sirupsen/logrus/examples/hook/hook.go | 7 +- vendor/github.com/Sirupsen/logrus/exported.go | 193 + .../github.com/Sirupsen/logrus/formatter.go | 0 .../Sirupsen/logrus/formatter_bench_test.go | 10 + .../logrus/formatters/logstash/logstash.go | 56 + .../formatters/logstash/logstash_test.go | 52 + .../github.com/Sirupsen/logrus/hook_test.go | 0 .../github.com/Sirupsen/logrus/hooks.go | 6 +- .../logrus/hooks/airbrake/airbrake.go | 54 + .../logrus/hooks/airbrake/airbrake_test.go | 133 + .../Sirupsen/logrus/hooks/bugsnag/bugsnag.go | 68 + .../logrus/hooks/bugsnag/bugsnag_test.go | 64 + .../logrus/hooks/papertrail/README.md | 0 .../logrus/hooks/papertrail/papertrail.go | 0 .../hooks/papertrail/papertrail_test.go | 0 .../Sirupsen/logrus/hooks/sentry/README.md | 111 + .../Sirupsen/logrus/hooks/sentry/sentry.go | 137 + .../logrus/hooks/sentry/sentry_test.go | 154 + .../Sirupsen/logrus/hooks/syslog/README.md | 0 .../Sirupsen/logrus/hooks/syslog/syslog.go | 0 .../logrus/hooks/syslog/syslog_test.go | 0 .../Sirupsen/logrus/json_formatter.go | 0 .../Sirupsen/logrus/json_formatter_test.go | 0 vendor/github.com/Sirupsen/logrus/logger.go | 206 + vendor/github.com/Sirupsen/logrus/logrus.go | 98 + .../github.com/Sirupsen/logrus/logrus_test.go | 2 +- .../Sirupsen/logrus/terminal_bsd.go | 1 + .../Sirupsen/logrus/terminal_linux.go | 0 .../Sirupsen/logrus/terminal_notwindows.go | 2 +- .../Sirupsen/logrus/terminal_windows.go | 0 .../Sirupsen/logrus/text_formatter.go | 159 + .../Sirupsen/logrus/text_formatter_test.go | 0 .../github.com/Sirupsen/logrus/writer.go | 0 .../candiedyaml/.gitignore | 1 + .../candiedyaml/.travis.yml | 12 + .../candiedyaml/LICENSE | 203 + .../candiedyaml/README.md | 55 + .../cloudfoundry-incubator/candiedyaml/api.go | 834 +++++ .../candiedyaml/candiedyaml_suite_test.go | 27 + .../candiedyaml/decode.go | 622 +++ .../candiedyaml/decode_test.go | 906 +++++ .../candiedyaml/emitter.go | 2072 ++++++++++ .../candiedyaml/encode.go | 395 ++ .../candiedyaml/encode_test.go | 618 +++ .../candiedyaml/libyaml-LICENSE | 19 + .../candiedyaml/parser.go | 1230 ++++++ .../candiedyaml/parser_test.go | 81 + .../candiedyaml/reader.go | 465 +++ .../candiedyaml/reader_test.go | 291 ++ .../candiedyaml/resolver.go | 449 +++ .../candiedyaml/resolver_test.go | 665 ++++ .../candiedyaml/run_parser.go | 62 + .../candiedyaml/scanner.go | 3318 +++++++++++++++++ .../candiedyaml/scanner_test.go | 80 + .../candiedyaml/tags.go | 343 ++ .../candiedyaml/writer.go | 128 + .../candiedyaml/yaml_definesh.go | 22 + .../candiedyaml/yaml_privateh.go | 891 +++++ .../candiedyaml/yamlh.go | 953 +++++ .../github.com/codegangsta/cli/.travis.yml | 0 .../github.com/codegangsta/cli/LICENSE | 0 .../github.com/codegangsta/cli/README.md | 0 .../github.com/codegangsta/cli/app.go | 0 .../github.com/codegangsta/cli/app_test.go | 0 .../cli/autocomplete/bash_autocomplete | 0 .../cli/autocomplete/zsh_autocomplete | 0 .../github.com/codegangsta/cli/cli.go | 0 .../github.com/codegangsta/cli/cli_test.go | 0 .../github.com/codegangsta/cli/command.go | 0 .../codegangsta/cli/command_test.go | 0 .../github.com/codegangsta/cli/context.go | 0 .../codegangsta/cli/context_test.go | 0 .../github.com/codegangsta/cli/flag.go | 0 .../github.com/codegangsta/cli/flag_test.go | 0 .../github.com/codegangsta/cli/help.go | 0 .../codegangsta/cli/helpers_test.go | 0 .../coreos/coreos-cloudinit/.gitignore | 4 + .../coreos/coreos-cloudinit/.travis.yml | 17 + .../coreos/coreos-cloudinit/CONTRIBUTING.md | 68 + vendor/github.com/coreos/coreos-cloudinit/DCO | 36 + .../coreos/coreos-cloudinit}/LICENSE | 0 .../coreos/coreos-cloudinit/MAINTAINERS | 3 + .../github.com/coreos/coreos-cloudinit/NOTICE | 5 + .../coreos/coreos-cloudinit/README.md | 79 + .../github.com/coreos/coreos-cloudinit/build | 14 + .../coreos/coreos-cloudinit/config/config.go | 0 .../coreos-cloudinit/config/config_test.go | 0 .../coreos/coreos-cloudinit/config/decode.go | 0 .../coreos-cloudinit/config/etc_hosts.go | 0 .../coreos/coreos-cloudinit/config/etcd.go | 0 .../coreos/coreos-cloudinit/config/file.go | 0 .../coreos-cloudinit/config/file_test.go | 0 .../coreos/coreos-cloudinit/config/flannel.go | 0 .../coreos/coreos-cloudinit/config/fleet.go | 0 .../coreos-cloudinit/config/locksmith.go | 0 .../coreos/coreos-cloudinit/config/oem.go | 0 .../coreos/coreos-cloudinit/config/script.go | 0 .../coreos/coreos-cloudinit/config/unit.go | 0 .../coreos-cloudinit/config/unit_test.go | 0 .../coreos/coreos-cloudinit/config/update.go | 0 .../coreos-cloudinit/config/update_test.go | 0 .../coreos/coreos-cloudinit/config/user.go | 0 .../config/validate/context.go | 0 .../config/validate/context_test.go | 0 .../coreos-cloudinit/config/validate/node.go | 0 .../config/validate/node_test.go | 0 .../config/validate/report.go | 0 .../config/validate/report_test.go | 0 .../coreos-cloudinit/config/validate/rules.go | 0 .../config/validate/rules_test.go | 0 .../config/validate/validate.go | 0 .../config/validate/validate_test.go | 0 .../coreos-cloudinit/coreos-cloudinit.go | 364 ++ .../coreos-cloudinit/coreos-cloudinit_test.go | 89 + .../github.com/coreos/coreos-cloudinit/cover | 27 + .../datasource/configdrive/configdrive.go | 0 .../configdrive/configdrive_test.go | 0 .../coreos-cloudinit/datasource/datasource.go | 0 .../coreos-cloudinit/datasource/file/file.go | 0 .../metadata/cloudsigma/server_context.go | 0 .../cloudsigma/server_context_test.go | 0 .../metadata/digitalocean/metadata.go | 0 .../metadata/digitalocean/metadata_test.go | 0 .../datasource/metadata/ec2/metadata.go | 0 .../datasource/metadata/ec2/metadata_test.go | 0 .../datasource/metadata/metadata.go | 0 .../datasource/metadata/metadata_test.go | 0 .../datasource/metadata/test/test.go | 0 .../datasource/proc_cmdline/proc_cmdline.go | 0 .../proc_cmdline/proc_cmdline_test.go | 0 .../datasource/test/filesystem.go | 0 .../datasource/test/filesystem_test.go | 0 .../coreos-cloudinit/datasource/url/url.go | 0 .../datasource/waagent/waagent.go | 0 .../datasource/waagent/waagent_test.go | 0 .../coreos-cloudinit/initialize/config.go | 0 .../initialize/config_test.go | 0 .../coreos/coreos-cloudinit/initialize/env.go | 0 .../coreos-cloudinit/initialize/env_test.go | 0 .../coreos-cloudinit/initialize/github.go | 0 .../coreos-cloudinit/initialize/ssh_keys.go | 0 .../initialize/ssh_keys_test.go | 0 .../coreos-cloudinit/initialize/user_data.go | 0 .../initialize/user_data_test.go | 0 .../coreos-cloudinit/initialize/workspace.go | 0 .../coreos/coreos-cloudinit/network/debian.go | 0 .../coreos-cloudinit/network/debian_test.go | 0 .../coreos-cloudinit/network/digitalocean.go | 0 .../network/digitalocean_test.go | 0 .../coreos-cloudinit/network/interface.go | 0 .../network/interface_test.go | 0 .../coreos/coreos-cloudinit/network/stanza.go | 0 .../coreos-cloudinit/network/stanza_test.go | 0 .../coreos-cloudinit/pkg/http_client.go | 0 .../coreos-cloudinit/pkg/http_client_test.go | 0 .../coreos/coreos-cloudinit/system/env.go | 0 .../coreos-cloudinit/system/env_file.go | 0 .../coreos-cloudinit/system/env_file_test.go | 0 .../coreos-cloudinit/system/env_test.go | 0 .../coreos-cloudinit/system/etc_hosts.go | 0 .../coreos-cloudinit/system/etc_hosts_test.go | 0 .../coreos/coreos-cloudinit/system/etcd.go | 0 .../coreos-cloudinit/system/etcd_test.go | 0 .../coreos/coreos-cloudinit/system/file.go | 0 .../coreos-cloudinit/system/file_test.go | 0 .../coreos/coreos-cloudinit/system/flannel.go | 0 .../coreos-cloudinit/system/flannel_test.go | 0 .../coreos/coreos-cloudinit/system/fleet.go | 0 .../coreos-cloudinit/system/fleet_test.go | 0 .../coreos-cloudinit/system/locksmith.go | 0 .../coreos-cloudinit/system/locksmith_test.go | 0 .../coreos-cloudinit/system/networkd.go | 0 .../coreos/coreos-cloudinit/system/oem.go | 0 .../coreos-cloudinit/system/oem_test.go | 0 .../coreos/coreos-cloudinit/system/ssh_key.go | 0 .../coreos/coreos-cloudinit/system/systemd.go | 0 .../coreos-cloudinit/system/systemd_test.go | 0 .../coreos/coreos-cloudinit/system/unit.go | 0 .../coreos-cloudinit/system/unit_test.go | 0 .../coreos/coreos-cloudinit/system/update.go | 0 .../coreos-cloudinit/system/update_test.go | 0 .../coreos/coreos-cloudinit/system/user.go | 0 .../github.com/coreos/coreos-cloudinit/test | 66 + .../github.com/coreos/go-systemd/.travis.yml | 8 + vendor/github.com/coreos/go-systemd/LICENSE | 191 + vendor/github.com/coreos/go-systemd/README.md | 44 + .../github.com/coreos/go-systemd/dbus/dbus.go | 0 .../coreos/go-systemd/dbus/dbus_test.go | 0 .../coreos/go-systemd/dbus/methods.go | 0 .../coreos/go-systemd/dbus/methods_test.go | 0 .../coreos/go-systemd/dbus/properties.go | 0 .../github.com/coreos/go-systemd/dbus/set.go | 0 .../coreos/go-systemd/dbus/set_test.go | 0 .../coreos/go-systemd/dbus/subscription.go | 0 .../go-systemd/dbus/subscription_set.go | 0 .../go-systemd/dbus/subscription_set_test.go | 0 .../go-systemd/dbus/subscription_test.go | 0 vendor/github.com/coreos/go-systemd/test | 3 + .../github.com/coreos/yaml/LICENSE | 0 .../github.com/coreos/yaml/LICENSE.libyaml | 0 .../github.com/coreos/yaml/README.md | 0 .../github.com/coreos/yaml/apic.go | 0 .../github.com/coreos/yaml/decode.go | 0 .../github.com/coreos/yaml/decode_test.go | 0 .../github.com/coreos/yaml/emitterc.go | 0 .../github.com/coreos/yaml/encode.go | 0 .../github.com/coreos/yaml/encode_test.go | 0 .../github.com/coreos/yaml/parserc.go | 0 .../github.com/coreos/yaml/readerc.go | 0 .../github.com/coreos/yaml/resolve.go | 0 .../github.com/coreos/yaml/scannerc.go | 0 .../github.com/coreos/yaml/sorter.go | 0 .../github.com/coreos/yaml/suite_test.go | 0 .../github.com/coreos/yaml/writerc.go | 0 .../github.com/coreos/yaml/yaml.go | 0 .../github.com/coreos/yaml/yamlh.go | 0 .../github.com/coreos/yaml/yamlprivateh.go | 0 .../github.com/docker/distribution/.drone.yml | 0 .../github.com/docker/distribution/.gitignore | 0 .../github.com/docker/distribution/.mailmap | 0 .../github.com/docker/distribution/AUTHORS | 0 .../docker/distribution/CONTRIBUTING.md | 0 .../github.com/docker/distribution/Dockerfile | 0 .../docker/distribution/Godeps/Godeps.json | 0 .../docker/distribution/Godeps}/Readme | 0 .../Godeps}/_workspace/.gitignore | 0 .../github.com/AdRoll/goamz/aws/attempt.go | 74 + .../AdRoll/goamz/aws/attempt_test.go | 57 + .../src/github.com/AdRoll/goamz/aws/aws.go | 629 ++++ .../github.com/AdRoll/goamz/aws/aws_test.go | 140 + .../src/github.com/AdRoll/goamz/aws/client.go | 124 + .../AdRoll/goamz/aws/export_test.go | 29 + .../github.com/AdRoll/goamz/aws/regions.go | 265 ++ .../src/github.com/AdRoll/goamz/aws/retry.go | 136 + .../github.com/AdRoll/goamz/aws/retry_test.go | 303 ++ .../src/github.com/AdRoll/goamz/aws/sign.go | 402 ++ .../github.com/AdRoll/goamz/aws/sign_test.go | 569 +++ .../AdRoll/goamz/cloudfront/cloudfront.go | 143 + .../goamz/cloudfront/cloudfront_test.go | 52 + .../AdRoll/goamz/cloudfront/testdata/key.pub | 6 + .../github.com/AdRoll/goamz/s3/export_test.go | 27 + .../github.com/AdRoll/goamz/s3/lifecycle.go | 202 + .../AdRoll/goamz/s3/lifecycle_test.go | 205 + .../src/github.com/AdRoll/goamz/s3/multi.go | 502 +++ .../github.com/AdRoll/goamz/s3/multi_test.go | 440 +++ .../AdRoll/goamz/s3/responses_test.go | 248 ++ .../src/github.com/AdRoll/goamz/s3/s3.go | 1293 +++++++ .../src/github.com/AdRoll/goamz/s3/s3_test.go | 502 +++ .../github.com/AdRoll/goamz/s3/s3i_test.go | 603 +++ .../github.com/AdRoll/goamz/s3/s3t_test.go | 87 + .../AdRoll/goamz/s3/s3test/server.go | 928 +++++ .../src/github.com/AdRoll/goamz/s3/sign.go | 120 + .../github.com/AdRoll/goamz/s3/sign_test.go | 148 + .../Azure/azure-sdk-for-go/.gitignore | 29 + .../Azure/azure-sdk-for-go/.travis.yml | 19 + .../github.com/Azure/azure-sdk-for-go/LICENSE | 0 .../Azure/azure-sdk-for-go/README.md | 88 + .../Azure/azure-sdk-for-go/storage/blob.go | 858 +++++ .../azure-sdk-for-go/storage/blob_test.go | 625 ++++ .../Azure/azure-sdk-for-go/storage/client.go | 359 ++ .../azure-sdk-for-go/storage/client_test.go | 156 + .../Azure/azure-sdk-for-go/storage/queue.go | 230 ++ .../azure-sdk-for-go/storage/queue_test.go | 91 + .../Azure/azure-sdk-for-go/storage/util.go | 71 + .../azure-sdk-for-go/storage/util_test.go | 69 + .../src/github.com/Sirupsen/logrus/.gitignore | 1 + .../github.com/Sirupsen/logrus/.travis.yml | 8 + .../github.com/Sirupsen/logrus/CHANGELOG.md | 7 + .../src}/github.com/Sirupsen/logrus/LICENSE | 0 .../src/github.com/Sirupsen/logrus/README.md | 110 +- .../src/github.com/Sirupsen/logrus/entry.go | 0 .../github.com/Sirupsen/logrus/entry_test.go | 0 .../Sirupsen/logrus/examples/basic/basic.go | 50 + .../Sirupsen/logrus/examples/hook/hook.go | 30 + .../github.com/Sirupsen/logrus/exported.go | 0 .../github.com/Sirupsen/logrus/formatter.go | 4 + .../Sirupsen/logrus/formatter_bench_test.go | 0 .../logrus/formatters/logstash/logstash.go | 56 + .../formatters/logstash/logstash_test.go | 52 + .../github.com/Sirupsen/logrus/hook_test.go | 2 +- .../src/github.com/Sirupsen/logrus/hooks.go | 0 .../logrus/hooks/airbrake/airbrake.go | 54 + .../logrus/hooks/airbrake/airbrake_test.go | 133 + .../Sirupsen/logrus/hooks/bugsnag/bugsnag.go | 68 + .../logrus/hooks/bugsnag/bugsnag_test.go | 64 + .../logrus/hooks/papertrail/README.md | 28 + .../logrus/hooks/papertrail/papertrail.go | 55 + .../hooks/papertrail/papertrail_test.go | 26 + .../Sirupsen/logrus/hooks/sentry/README.md | 2 +- .../Sirupsen/logrus/hooks/sentry/sentry.go | 0 .../logrus/hooks/sentry/sentry_test.go | 0 .../Sirupsen/logrus/hooks/syslog/README.md | 20 + .../Sirupsen/logrus/hooks/syslog/syslog.go | 59 + .../logrus/hooks/syslog/syslog_test.go | 26 + .../Sirupsen/logrus/json_formatter.go | 22 +- .../Sirupsen/logrus/json_formatter_test.go | 120 + .../src}/github.com/Sirupsen/logrus/logger.go | 5 +- .../src/github.com/Sirupsen/logrus/logrus.go | 0 .../github.com/Sirupsen/logrus/logrus_test.go | 18 + .../Sirupsen/logrus/terminal_darwin.go | 0 .../Sirupsen/logrus/terminal_freebsd.go | 0 .../Sirupsen/logrus/terminal_linux.go | 0 .../Sirupsen/logrus/terminal_notwindows.go | 0 .../Sirupsen/logrus/terminal_openbsd.go | 0 .../Sirupsen/logrus/terminal_windows.go | 0 .../Sirupsen/logrus/text_formatter.go | 4 +- .../Sirupsen/logrus/text_formatter_test.go | 61 + .../src/github.com/Sirupsen/logrus/writer.go | 2 +- .../github.com/bugsnag/bugsnag-go/.travis.yml | 13 + .../github.com/bugsnag/bugsnag-go/LICENSE.txt | 20 + .../github.com/bugsnag/bugsnag-go/README.md | 489 +++ .../bugsnag/bugsnag-go/appengine.go | 76 + .../github.com/bugsnag/bugsnag-go/bugsnag.go | 131 + .../bugsnag/bugsnag-go/bugsnag_test.go | 461 +++ .../bugsnag/bugsnag-go/configuration.go | 159 + .../bugsnag/bugsnag-go/configuration_test.go | 58 + .../src/github.com/bugsnag/bugsnag-go/doc.go | 69 + .../bugsnag/bugsnag-go/errors/README.md | 6 + .../bugsnag/bugsnag-go/errors/error.go | 90 + .../bugsnag/bugsnag-go/errors/error_test.go | 117 + .../bugsnag/bugsnag-go/errors/parse_panic.go | 127 + .../bugsnag-go/errors/parse_panic_test.go | 142 + .../bugsnag/bugsnag-go/errors/stackframe.go | 97 + .../github.com/bugsnag/bugsnag-go/event.go | 134 + .../bugsnag/bugsnag-go/json_tags.go | 43 + .../github.com/bugsnag/bugsnag-go/metadata.go | 185 + .../bugsnag/bugsnag-go/metadata_test.go | 182 + .../bugsnag/bugsnag-go/middleware.go | 96 + .../bugsnag/bugsnag-go/middleware_test.go | 88 + .../github.com/bugsnag/bugsnag-go/notifier.go | 95 + .../bugsnag/bugsnag-go/panicwrap.go | 27 + .../bugsnag/bugsnag-go/panicwrap_test.go | 79 + .../github.com/bugsnag/bugsnag-go/payload.go | 96 + .../bugsnag/bugsnag-go/revel/bugsnagrevel.go | 60 + .../src/github.com/bugsnag/osext/LICENSE | 20 + .../src/github.com/bugsnag/osext/osext.go | 32 + .../github.com/bugsnag/osext/osext_plan9.go | 16 + .../github.com/bugsnag/osext/osext_procfs.go | 25 + .../github.com/bugsnag/osext/osext_sysctl.go | 64 + .../github.com/bugsnag/osext/osext_test.go | 79 + .../github.com/bugsnag/osext/osext_windows.go | 34 + .../src/github.com/bugsnag/panicwrap/LICENSE | 21 + .../github.com/bugsnag/panicwrap/README.md | 101 + .../github.com/bugsnag/panicwrap/monitor.go | 63 + .../bugsnag/panicwrap/monitor_windows.go | 7 + .../github.com/bugsnag/panicwrap/panicwrap.go | 339 ++ .../bugsnag/panicwrap/panicwrap_test.go | 360 ++ .../github.com/codegangsta/cli/.travis.yml | 6 + .../src/github.com/codegangsta/cli/LICENSE | 21 + .../src/github.com/codegangsta/cli/README.md | 298 ++ .../src/github.com/codegangsta/cli/app.go | 275 ++ .../github.com/codegangsta/cli/app_test.go | 554 +++ .../cli/autocomplete/bash_autocomplete | 13 + .../cli/autocomplete/zsh_autocomplete | 5 + .../src/github.com/codegangsta/cli/cli.go | 19 + .../github.com/codegangsta/cli/cli_test.go | 100 + .../src/github.com/codegangsta/cli/command.go | 156 + .../codegangsta/cli/command_test.go | 49 + .../src/github.com/codegangsta/cli/context.go | 339 ++ .../codegangsta/cli/context_test.go | 99 + .../src/github.com/codegangsta/cli/flag.go | 454 +++ .../github.com/codegangsta/cli/flag_test.go | 742 ++++ .../src/github.com/codegangsta/cli/help.go | 211 ++ .../codegangsta/cli/helpers_test.go | 19 + .../denverdino/aliyungo/oss/client.go | 1265 +++++++ .../denverdino/aliyungo/oss/client_test.go | 211 ++ .../denverdino/aliyungo/oss/config_test.go | 14 + .../denverdino/aliyungo/oss/export.go | 23 + .../denverdino/aliyungo/oss/multi.go | 464 +++ .../denverdino/aliyungo/oss/multi_test.go | 161 + .../denverdino/aliyungo/oss/regions.go | 53 + .../denverdino/aliyungo/oss/signature.go | 105 + .../denverdino/aliyungo/util/attempt.go | 76 + .../denverdino/aliyungo/util/attempt_test.go | 90 + .../denverdino/aliyungo/util/encoding.go | 123 + .../denverdino/aliyungo/util/encoding_test.go | 52 + .../denverdino/aliyungo/util/iso6801.go | 62 + .../denverdino/aliyungo/util/iso6801_test.go | 50 + .../denverdino/aliyungo/util/signature.go | 40 + .../aliyungo/util/signature_test.go | 14 + .../denverdino/aliyungo/util/util.go | 134 + .../denverdino/aliyungo/util/util_test.go | 43 + .../docker/pkg/tarsum/builder_context.go | 20 + .../docker/pkg/tarsum/builder_context_test.go | 0 .../docker/docker/pkg/tarsum/fileinfosums.go | 116 + .../docker/pkg/tarsum/fileinfosums_test.go | 0 .../docker/docker/pkg/tarsum/tarsum.go | 276 ++ .../docker/docker/pkg/tarsum/tarsum_spec.md | 225 ++ .../docker/docker/pkg/tarsum/tarsum_test.go | 0 .../json | 0 .../layer.tar | Bin .../json | 0 .../layer.tar | Bin .../tarsum/testdata/collision/collision-0.tar | Bin .../tarsum/testdata/collision/collision-1.tar | Bin .../tarsum/testdata/collision/collision-2.tar | Bin .../tarsum/testdata/collision/collision-3.tar | Bin .../docker/pkg/tarsum/testdata/xattr/json | 0 .../pkg/tarsum/testdata/xattr/layer.tar | Bin .../docker/docker/pkg/tarsum/versioning.go | 150 + .../docker/pkg/tarsum/versioning_test.go | 0 .../docker/docker/pkg/tarsum/writercloser.go | 0 .../docker/libtrust/CONTRIBUTING.md | 0 .../src/github.com/docker/libtrust/LICENSE | 0 .../github.com/docker/libtrust/MAINTAINERS | 0 .../src/github.com/docker/libtrust/README.md | 0 .../docker/libtrust/certificates.go | 0 .../docker/libtrust/certificates_test.go | 0 .../src/github.com/docker/libtrust/doc.go | 0 .../src/github.com/docker/libtrust/ec_key.go | 0 .../github.com/docker/libtrust/ec_key_test.go | 0 .../src/github.com/docker/libtrust/filter.go | 0 .../github.com/docker/libtrust/filter_test.go | 0 .../src/github.com/docker/libtrust/hash.go | 0 .../github.com/docker/libtrust/jsonsign.go | 0 .../docker/libtrust/jsonsign_test.go | 0 .../src/github.com/docker/libtrust/key.go | 0 .../github.com/docker/libtrust/key_files.go | 0 .../docker/libtrust/key_files_test.go | 0 .../github.com/docker/libtrust/key_manager.go | 0 .../github.com/docker/libtrust/key_test.go | 0 .../src/github.com/docker/libtrust/rsa_key.go | 0 .../docker/libtrust/rsa_key_test.go | 0 .../docker/libtrust/testutil/certificates.go | 0 .../docker/libtrust/tlsdemo/README.md | 0 .../docker/libtrust/tlsdemo/client.go | 0 .../docker/libtrust/tlsdemo/gencert.go | 0 .../docker/libtrust/tlsdemo/genkeys.go | 0 .../docker/libtrust/tlsdemo/server.go | 0 .../docker/libtrust/trustgraph/graph.go | 0 .../libtrust/trustgraph/memory_graph.go | 0 .../libtrust/trustgraph/memory_graph_test.go | 0 .../docker/libtrust/trustgraph/statement.go | 0 .../libtrust/trustgraph/statement_test.go | 0 .../src/github.com/docker/libtrust/util.go | 361 ++ .../github.com/docker/libtrust/util_test.go | 23 + .../garyburd/redigo/internal/commandinfo.go | 45 + .../redigo/internal/redistest/testdb.go | 65 + .../github.com/garyburd/redigo/redis/conn.go | 455 +++ .../garyburd/redigo/redis/conn_test.go | 542 +++ .../github.com/garyburd/redigo/redis/doc.go | 169 + .../github.com/garyburd/redigo/redis/log.go | 117 + .../github.com/garyburd/redigo/redis/pool.go | 389 ++ .../garyburd/redigo/redis/pool_test.go | 674 ++++ .../garyburd/redigo/redis/pubsub.go | 129 + .../garyburd/redigo/redis/pubsub_test.go | 143 + .../github.com/garyburd/redigo/redis/redis.go | 44 + .../github.com/garyburd/redigo/redis/reply.go | 312 ++ .../garyburd/redigo/redis/reply_test.go | 166 + .../github.com/garyburd/redigo/redis/scan.go | 513 +++ .../garyburd/redigo/redis/scan_test.go | 412 ++ .../garyburd/redigo/redis/script.go | 86 + .../garyburd/redigo/redis/script_test.go | 93 + .../garyburd/redigo/redis/test_test.go | 38 + .../redigo/redis/zpop_example_test.go | 113 + .../github.com/gorilla/context}/.travis.yml | 0 .../src}/github.com/gorilla/context/LICENSE | 0 .../src}/github.com/gorilla/context/README.md | 0 .../github.com/gorilla/context/context.go | 0 .../gorilla/context/context_test.go | 161 + .../src}/github.com/gorilla/context/doc.go | 0 .../github.com/gorilla/handlers}/.travis.yml | 3 + .../src/github.com/gorilla/handlers/README.md | 52 + .../github.com/gorilla/handlers/compress.go | 84 + .../gorilla/handlers/compress_test.go | 65 + .../github.com/gorilla/handlers/handlers.go | 378 ++ .../gorilla/handlers/handlers_test.go | 305 ++ .../src/github.com/gorilla/mux/.travis.yml | 7 + .../src}/github.com/gorilla/mux/LICENSE | 0 .../src}/github.com/gorilla/mux/README.md | 0 .../src}/github.com/gorilla/mux/bench_test.go | 0 .../src}/github.com/gorilla/mux/doc.go | 10 +- .../src}/github.com/gorilla/mux/mux.go | 15 +- .../src}/github.com/gorilla/mux/mux_test.go | 71 +- .../src}/github.com/gorilla/mux/old_test.go | 0 .../src}/github.com/gorilla/mux/regexp.go | 6 +- .../src/github.com/gorilla/mux/route.go | 524 +++ .../mitchellh/mapstructure/.travis.yml | 7 + .../github.com/mitchellh/mapstructure/LICENSE | 21 + .../mitchellh/mapstructure/README.md | 46 + .../mitchellh/mapstructure/decode_hooks.go | 151 + .../mapstructure/decode_hooks_test.go | 229 ++ .../mitchellh/mapstructure/error.go | 50 + .../mitchellh/mapstructure/mapstructure.go | 746 ++++ .../mapstructure_benchmark_test.go | 243 ++ .../mapstructure/mapstructure_bugs_test.go | 47 + .../mapstructure_examples_test.go | 203 + .../mapstructure/mapstructure_test.go | 954 +++++ .../src/github.com/ncw/swift/.gitignore | 4 + .../src/github.com/ncw/swift/.travis.yml | 10 + .../src/github.com/ncw/swift/COPYING | 20 + .../src/github.com/ncw/swift/README.md | 128 + .../src/github.com/ncw/swift/auth.go | 283 ++ .../src/github.com/ncw/swift/auth_v3.go | 207 + .../github.com/ncw/swift/compatibility_1_0.go | 28 + .../github.com/ncw/swift/compatibility_1_1.go | 24 + .../src/github.com/ncw/swift/doc.go | 19 + .../src/github.com/ncw/swift/example_test.go | 97 + .../src/github.com/ncw/swift/meta.go | 174 + .../src/github.com/ncw/swift/meta_test.go | 213 ++ .../src/github.com/ncw/swift/notes.txt | 55 + .../src/github.com/ncw/swift/rs/rs.go | 83 + .../src/github.com/ncw/swift/rs/rs_test.go | 96 + .../src/github.com/ncw/swift/swift.go | 1841 +++++++++ .../ncw/swift/swift_internal_test.go | 409 ++ .../src/github.com/ncw/swift/swift_test.go | 1472 ++++++++ .../github.com/ncw/swift/swifttest/server.go | 885 +++++ .../github.com/ncw/swift/timeout_reader.go | 57 + .../ncw/swift/timeout_reader_test.go | 107 + .../github.com/ncw/swift/watchdog_reader.go | 34 + .../ncw/swift/watchdog_reader_test.go | 61 + .../github.com/noahdesu/go-ceph/rados/conn.go | 300 ++ .../github.com/noahdesu/go-ceph/rados/doc.go | 4 + .../noahdesu/go-ceph/rados/ioctx.go | 547 +++ .../noahdesu/go-ceph/rados/rados.go | 54 + .../noahdesu/go-ceph/rados/rados_test.go | 703 ++++ .../github.com/stevvooe/resumable/.gitignore | 24 + .../src/github.com/stevvooe/resumable/LICENSE | 28 + .../github.com/stevvooe/resumable/README.md | 6 + .../stevvooe/resumable/resumable.go | 43 + .../stevvooe/resumable/sha256/resume.go | 53 + .../stevvooe/resumable/sha256/sha256.go | 193 + .../stevvooe/resumable/sha256/sha256_test.go | 176 + .../stevvooe/resumable/sha256/sha256block.go | 128 + .../resumable/sha256/sha256block_386.s | 283 ++ .../resumable/sha256/sha256block_amd64.s | 256 ++ .../resumable/sha256/sha256block_decl.go | 11 + .../resumable/sha256/sha256resume_test.go | 74 + .../stevvooe/resumable/sha512/resume.go | 53 + .../stevvooe/resumable/sha512/sha512.go | 198 + .../stevvooe/resumable/sha512/sha512_test.go | 176 + .../stevvooe/resumable/sha512/sha512block.go | 144 + .../resumable/sha512/sha512block_amd64.s | 273 ++ .../resumable/sha512/sha512block_decl.go | 11 + .../resumable/sha512/sha512resume_test.go | 74 + .../yvasiyarov/go-metrics/.gitignore | 9 + .../github.com/yvasiyarov/go-metrics/LICENSE | 29 + .../yvasiyarov/go-metrics/README.md | 104 + .../cmd/metrics-bench/metrics-bench.go | 20 + .../cmd/metrics-example/metrics-example.go | 154 + .../go-metrics/cmd/never-read/never-read.go | 22 + .../yvasiyarov/go-metrics/counter.go | 112 + .../yvasiyarov/go-metrics/counter_test.go | 77 + .../github.com/yvasiyarov/go-metrics/debug.go | 76 + .../yvasiyarov/go-metrics/debug_test.go | 48 + .../github.com/yvasiyarov/go-metrics/ewma.go | 118 + .../yvasiyarov/go-metrics/ewma_test.go | 225 ++ .../github.com/yvasiyarov/go-metrics/gauge.go | 84 + .../yvasiyarov/go-metrics/gauge_float64.go | 91 + .../go-metrics/gauge_float64_test.go | 38 + .../yvasiyarov/go-metrics/gauge_test.go | 37 + .../yvasiyarov/go-metrics/graphite.go | 104 + .../yvasiyarov/go-metrics/graphite_test.go | 22 + .../yvasiyarov/go-metrics/healthcheck.go | 61 + .../yvasiyarov/go-metrics/histogram.go | 192 + .../yvasiyarov/go-metrics/histogram_test.go | 95 + .../go-metrics/influxdb/influxdb.go | 114 + .../github.com/yvasiyarov/go-metrics/json.go | 83 + .../yvasiyarov/go-metrics/json_test.go | 28 + .../yvasiyarov/go-metrics/librato/client.go | 102 + .../yvasiyarov/go-metrics/librato/librato.go | 244 ++ .../github.com/yvasiyarov/go-metrics/log.go | 70 + .../yvasiyarov/go-metrics/memory.md | 285 ++ .../github.com/yvasiyarov/go-metrics/meter.go | 233 ++ .../yvasiyarov/go-metrics/meter_test.go | 60 + .../yvasiyarov/go-metrics/metrics.go | 13 + .../yvasiyarov/go-metrics/metrics_test.go | 107 + .../yvasiyarov/go-metrics/opentsdb.go | 119 + .../yvasiyarov/go-metrics/opentsdb_test.go | 22 + .../yvasiyarov/go-metrics/registry.go | 168 + .../yvasiyarov/go-metrics/registry_test.go | 118 + .../yvasiyarov/go-metrics/runtime.go | 200 + .../yvasiyarov/go-metrics/runtime_cgo.go | 9 + .../yvasiyarov/go-metrics/runtime_no_cgo.go | 7 + .../yvasiyarov/go-metrics/runtime_test.go | 78 + .../yvasiyarov/go-metrics/sample.go | 568 +++ .../yvasiyarov/go-metrics/sample_test.go | 352 ++ .../yvasiyarov/go-metrics/stathat/stathat.go | 69 + .../yvasiyarov/go-metrics/syslog.go | 78 + .../github.com/yvasiyarov/go-metrics/timer.go | 299 ++ .../yvasiyarov/go-metrics/timer_test.go | 81 + .../yvasiyarov/go-metrics/writer.go | 100 + .../yvasiyarov/go-metrics/writer_test.go | 22 + .../github.com/yvasiyarov/gorelic/.gitignore | 4 + .../github.com/yvasiyarov/gorelic/.travis.yml | 1 + .../src/github.com/yvasiyarov/gorelic/LICENSE | 24 + .../github.com/yvasiyarov/gorelic/README.md | 119 + .../github.com/yvasiyarov/gorelic/agent.go | 137 + .../src/github.com/yvasiyarov/gorelic/doc.go | 2 + .../yvasiyarov/gorelic/examples/example1.go | 52 + .../gorelic/examples/example_web.go | 63 + .../yvasiyarov/gorelic/gc_metrics.go | 65 + .../yvasiyarov/gorelic/gometrica.go | 105 + .../yvasiyarov/gorelic/http_metrics.go | 194 + .../yvasiyarov/gorelic/memory_metrics.go | 110 + .../github.com/yvasiyarov/gorelic/nut.json | 15 + .../yvasiyarov/gorelic/runtime_metrics.go | 196 + .../newrelic_platform_go/.travis.yml | 1 + .../yvasiyarov/newrelic_platform_go/LICENSE | 24 + .../yvasiyarov/newrelic_platform_go/README.md | 11 + .../yvasiyarov/newrelic_platform_go/agent.go | 27 + .../newrelic_platform_go/component.go | 71 + .../yvasiyarov/newrelic_platform_go/doc.go | 2 + .../examples/wave_plugin.go | 72 + .../newrelic_platform_go/metrica.go | 42 + .../yvasiyarov/newrelic_platform_go/nut.json | 15 + .../yvasiyarov/newrelic_platform_go/plugin.go | 194 + .../src/golang.org/x/crypto/bcrypt/base64.go | 35 + .../src/golang.org/x/crypto/bcrypt/bcrypt.go | 294 ++ .../golang.org/x/crypto/bcrypt/bcrypt_test.go | 226 ++ .../src/golang.org/x/crypto/blowfish/block.go | 159 + .../x/crypto/blowfish/blowfish_test.go | 274 ++ .../golang.org/x/crypto/blowfish/cipher.go | 91 + .../src/golang.org/x/crypto/blowfish/const.go | 199 + .../src/golang.org/x/net/context/context.go | 432 +++ .../golang.org/x/net/context/context_test.go | 553 +++ .../x/net/context/withtimeout_test.go | 0 .../src/gopkg.in/check.v1/.gitignore | 4 + .../_workspace/src/gopkg.in/check.v1/LICENSE | 25 + .../src/gopkg.in/check.v1/README.md | 20 + .../_workspace/src/gopkg.in/check.v1/TODO | 2 + .../src/gopkg.in/check.v1/benchmark.go | 163 + .../src/gopkg.in/check.v1/benchmark_test.go | 91 + .../src/gopkg.in/check.v1/bootstrap_test.go | 82 + .../_workspace/src/gopkg.in/check.v1/check.go | 945 +++++ .../src/gopkg.in/check.v1/check_test.go | 207 + .../src/gopkg.in/check.v1/checkers.go | 458 +++ .../src/gopkg.in/check.v1/checkers_test.go | 272 ++ .../src/gopkg.in/check.v1/export_test.go | 9 + .../src/gopkg.in/check.v1/fixture_test.go | 484 +++ .../src/gopkg.in/check.v1/foundation_test.go | 335 ++ .../src/gopkg.in/check.v1/helpers.go | 231 ++ .../src/gopkg.in/check.v1/helpers_test.go | 519 +++ .../src/gopkg.in/check.v1/printer.go | 168 + .../src/gopkg.in/check.v1/printer_test.go | 104 + .../_workspace/src/gopkg.in/check.v1/run.go | 175 + .../src/gopkg.in/check.v1/run_test.go | 419 +++ .../_workspace/src/gopkg.in/yaml.v2/LICENSE | 0 .../src/gopkg.in/yaml.v2/LICENSE.libyaml | 0 .../_workspace/src/gopkg.in/yaml.v2/README.md | 2 - .../_workspace/src/gopkg.in/yaml.v2/apic.go | 0 .../_workspace/src/gopkg.in/yaml.v2/decode.go | 16 - .../src/gopkg.in/yaml.v2/decode_test.go | 9 - .../src/gopkg.in/yaml.v2/emitterc.go | 0 .../_workspace/src/gopkg.in/yaml.v2/encode.go | 17 - .../src/gopkg.in/yaml.v2/encode_test.go | 15 - .../src/gopkg.in/yaml.v2/parserc.go | 0 .../src/gopkg.in/yaml.v2/readerc.go | 0 .../src/gopkg.in/yaml.v2/resolve.go | 0 .../src/gopkg.in/yaml.v2/scannerc.go | 0 .../_workspace/src/gopkg.in/yaml.v2/sorter.go | 0 .../src/gopkg.in/yaml.v2/suite_test.go | 0 .../src/gopkg.in/yaml.v2/writerc.go | 0 .../_workspace/src/gopkg.in/yaml.v2/yaml.go | 26 +- .../_workspace/src/gopkg.in/yaml.v2/yamlh.go | 0 .../src/gopkg.in/yaml.v2/yamlprivateh.go | 0 .../github.com/docker/distribution}/LICENSE | 2 +- .../docker/distribution/MAINTAINERS | 0 .../github.com/docker/distribution/Makefile | 0 .../github.com/docker/distribution/README.md | 0 .../github.com/docker/distribution/ROADMAP.md | 0 .../github.com/docker/distribution/blobs.go | 0 .../github.com/docker/distribution/circle.yml | 0 .../docker/distribution/cmd/dist/list.go | 0 .../docker/distribution/cmd/dist/main.go | 0 .../docker/distribution/cmd/dist/pull.go | 0 .../docker/distribution/cmd/dist/push.go | 0 .../registry-api-descriptor-template/main.go | 0 .../cmd/registry/config-cache.yml | 0 .../distribution/cmd/registry/config-dev.yml | 0 .../cmd/registry/config-example.yml | 0 .../docker/distribution/cmd/registry/main.go | 0 .../docker/distribution/cmd/registry/rados.go | 0 .../configuration/configuration.go | 0 .../configuration/configuration_test.go | 0 .../distribution/configuration/parser.go | 0 .../docker/distribution/context/context.go | 0 .../docker/distribution/context/doc.go | 0 .../docker/distribution/context/http.go | 0 .../docker/distribution/context/http_test.go | 0 .../docker/distribution/context/logger.go | 0 .../docker/distribution/context/trace.go | 0 .../docker/distribution/context/trace_test.go | 0 .../docker/distribution/context/util.go | 0 .../distribution/contrib/apache/README.MD | 0 .../distribution/contrib/apache/apache.conf | 0 .../distribution/contrib/ceph/ci-setup.sh | 0 .../distribution/contrib/compose/README.md | 0 .../contrib/compose/docker-compose.yml | 0 .../contrib/compose/nginx/Dockerfile | 0 .../compose/nginx/docker-registry-v2.conf | 0 .../compose/nginx/docker-registry.conf | 0 .../contrib/compose/nginx/nginx.conf | 0 .../contrib/compose/nginx/registry.conf | 0 .../contrib/docker-integration/Dockerfile | 0 .../contrib/docker-integration/README.md | 0 .../docker-integration/docker-compose.yml | 0 .../docker-integration/install_certs.sh | 0 .../docker-integration/nginx/Dockerfile | 0 .../nginx/docker-registry-v2.conf | 0 .../nginx/docker-registry.conf | 0 .../docker-integration/nginx/nginx.conf | 0 .../nginx/registry-basic.conf | 0 .../nginx/registry-noauth.conf | 0 .../docker-integration/nginx/registry.conf | 0 .../docker-integration/nginx/test.passwd | 0 .../contrib/docker-integration/run.sh | 0 .../docker-integration/run_multiversion.sh | 0 .../contrib/docker-integration/test_runner.sh | 0 .../contrib/docker-integration/tls.bats | 0 .../docker/distribution/digest/digest.go | 0 .../docker/distribution/digest/digest_test.go | 0 .../docker/distribution/digest/digester.go | 0 .../digest/digester_resumable_test.go | 0 .../docker/distribution/digest/doc.go | 0 .../docker/distribution/digest/set.go | 0 .../docker/distribution/digest/set_test.go | 0 .../docker/distribution/digest/tarsum.go | 0 .../docker/distribution/digest/tarsum_test.go | 0 .../docker/distribution/digest/verifiers.go | 0 .../distribution/digest/verifiers_test.go | 0 .../github.com/docker/distribution/doc.go | 0 .../docker/distribution/docs/Dockerfile | 0 .../docker/distribution/docs/Makefile | 0 .../docker/distribution/docs/architecture.md | 0 .../distribution/docs/authentication.md | 0 .../docker/distribution/docs/building.md | 0 .../docker/distribution/docs/configuration.md | 0 .../docker/distribution/docs/deploying.md | 0 .../docker/distribution/docs/glossary.md | 0 .../docker/distribution/docs/help.md | 0 .../docs/images/notifications.gliffy | 0 .../docs/images/notifications.png | Bin .../docs/images/notifications.svg | 0 .../distribution/docs/images/registry.gliffy | 0 .../distribution/docs/images/registry.png | Bin .../distribution/docs/images/registry.svg | 0 .../docker/distribution/docs/index.md | 0 .../docker/distribution/docs/introduction.md | 0 .../docker/distribution/docs/migration.md | 0 .../docker/distribution/docs/mirror.md | 0 .../docker/distribution/docs/mkdocs.yml | 0 .../docker/distribution/docs/notifications.md | 0 .../distribution/docs/osx-setup-guide.md | 0 .../docs/osx/com.docker.registry.plist | 0 .../docker/distribution/docs/osx/config.yml | 0 .../docker/distribution/docs/spec/api.md | 0 .../docker/distribution/docs/spec/api.md.tmpl | 0 .../distribution/docs/spec/auth/token.md | 0 .../distribution/docs/spec/implementations.md | 0 .../docker/distribution/docs/spec/json.md | 0 .../distribution/docs/spec/manifest-v2-1.md | 0 .../docs/storage-drivers/azure.md | 0 .../docs/storage-drivers/filesystem.md | 0 .../docs/storage-drivers/inmemory.md | 0 .../distribution/docs/storage-drivers/oss.md | 0 .../docs/storage-drivers/rados.md | 0 .../distribution/docs/storage-drivers/s3.md | 0 .../docs/storage-drivers/swift.md | 0 .../distribution/docs/storagedrivers.md | 0 .../github.com/docker/distribution/errors.go | 0 .../docker/distribution/health/api/api.go | 0 .../distribution/health/api/api_test.go | 0 .../distribution/health/checks/checks.go | 0 .../distribution/health/checks/checks_test.go | 0 .../docker/distribution/health/doc.go | 0 .../docker/distribution/health/health.go | 0 .../docker/distribution/health/health_test.go | 0 .../docker/distribution/manifest/manifest.go | 0 .../distribution/manifest/manifest_test.go | 0 .../docker/distribution/manifest/sign.go | 0 .../docker/distribution/manifest/verify.go | 0 .../distribution/notifications/bridge.go | 0 .../distribution/notifications/bridge_test.go | 0 .../distribution/notifications/endpoint.go | 0 .../distribution/notifications/event.go | 0 .../distribution/notifications/event_test.go | 0 .../docker/distribution/notifications/http.go | 0 .../distribution/notifications/http_test.go | 0 .../distribution/notifications/listener.go | 0 .../notifications/listener_test.go | 0 .../distribution/notifications/metrics.go | 0 .../distribution/notifications/sinks.go | 0 .../distribution/notifications/sinks_test.go | 0 .../distribution/project/dev-image/Dockerfile | 0 .../distribution/project/hooks/README.md | 0 .../project/hooks/configure-hooks.sh | 0 .../distribution/project/hooks/pre-commit | 0 .../docker/distribution/registry.go | 0 .../registry/api/errcode/errors.go | 0 .../registry/api/errcode/errors_test.go | 0 .../registry/api/errcode/handler.go | 0 .../registry/api/errcode/register.go | 0 .../registry/api/v2/descriptors.go | 0 .../distribution/registry/api/v2/doc.go | 0 .../distribution/registry/api/v2/errors.go | 0 .../distribution/registry/api/v2/names.go | 0 .../registry/api/v2/names_test.go | 0 .../distribution/registry/api/v2/routes.go | 0 .../registry/api/v2/routes_test.go | 0 .../distribution/registry/api/v2/urls.go | 0 .../distribution/registry/api/v2/urls_test.go | 0 .../docker/distribution/registry/auth/auth.go | 0 .../registry/auth/htpasswd/access.go | 0 .../registry/auth/htpasswd/access_test.go | 0 .../registry/auth/htpasswd/htpasswd.go | 0 .../registry/auth/htpasswd/htpasswd_test.go | 0 .../registry/auth/silly/access.go | 0 .../registry/auth/silly/access_test.go | 0 .../registry/auth/token/accesscontroller.go | 0 .../registry/auth/token/stringset.go | 0 .../distribution/registry/auth/token/token.go | 0 .../registry/auth/token/token_test.go | 0 .../distribution/registry/auth/token/util.go | 0 .../registry/client/auth/api_version.go | 0 .../registry/client/auth/authchallenge.go | 0 .../client/auth/authchallenge_test.go | 0 .../registry/client/auth/session.go | 0 .../registry/client/auth/session_test.go | 0 .../registry/client/blob_writer.go | 0 .../registry/client/blob_writer_test.go | 0 .../distribution/registry/client/errors.go | 0 .../registry/client/repository.go | 0 .../registry/client/repository_test.go | 0 .../registry/client/transport/http_reader.go | 0 .../registry/client/transport/transport.go | 0 .../docker/distribution/registry/doc.go | 0 .../registry/handlers/api_test.go | 0 .../distribution/registry/handlers/app.go | 0 .../registry/handlers/app_test.go | 0 .../registry/handlers/basicauth.go | 0 .../registry/handlers/basicauth_prego14.go | 0 .../distribution/registry/handlers/blob.go | 0 .../registry/handlers/blobupload.go | 0 .../distribution/registry/handlers/catalog.go | 0 .../distribution/registry/handlers/context.go | 0 .../distribution/registry/handlers/helpers.go | 0 .../distribution/registry/handlers/hmac.go | 0 .../registry/handlers/hmac_test.go | 0 .../distribution/registry/handlers/hooks.go | 0 .../distribution/registry/handlers/images.go | 0 .../distribution/registry/handlers/mail.go | 0 .../distribution/registry/handlers/tags.go | 0 .../registry/listener/listener.go | 0 .../middleware/registry/middleware.go | 0 .../middleware/repository/middleware.go | 0 .../distribution/registry/proxy/proxyauth.go | 0 .../registry/proxy/proxyblobstore.go | 0 .../registry/proxy/proxyblobstore_test.go | 0 .../registry/proxy/proxymanifeststore.go | 0 .../registry/proxy/proxymanifeststore_test.go | 0 .../registry/proxy/proxymetrics.go | 0 .../registry/proxy/proxyregistry.go | 0 .../registry/proxy/scheduler/scheduler.go | 0 .../proxy/scheduler/scheduler_test.go | 0 .../registry/storage/blob_test.go | 0 .../registry/storage/blobcachemetrics.go | 0 .../registry/storage/blobserver.go | 0 .../registry/storage/blobstore.go | 0 .../registry/storage/blobwriter.go | 0 .../storage/blobwriter_nonresumable.go | 0 .../registry/storage/blobwriter_resumable.go | 0 .../registry/storage/cache/cache.go | 0 .../cache/cachedblobdescriptorstore.go | 0 .../registry/storage/cache/memory/memory.go | 0 .../storage/cache/memory/memory_test.go | 0 .../registry/storage/cache/redis/redis.go | 0 .../storage/cache/redis/redis_test.go | 0 .../registry/storage/cache/suite.go | 0 .../distribution/registry/storage/catalog.go | 0 .../registry/storage/catalog_test.go | 0 .../distribution/registry/storage/doc.go | 0 .../registry/storage/driver/azure/azure.go | 0 .../storage/driver/azure/azure_test.go | 0 .../storage/driver/azure/blockblob.go | 0 .../storage/driver/azure/blockblob_test.go | 0 .../registry/storage/driver/azure/blockid.go | 0 .../storage/driver/azure/blockid_test.go | 0 .../storage/driver/azure/randomwriter.go | 0 .../storage/driver/azure/randomwriter_test.go | 0 .../storage/driver/azure/zerofillwriter.go | 0 .../driver/azure/zerofillwriter_test.go | 0 .../registry/storage/driver/base/base.go | 0 .../storage/driver/factory/factory.go | 0 .../registry/storage/driver/fileinfo.go | 0 .../storage/driver/filesystem/driver.go | 0 .../storage/driver/filesystem/driver_test.go | 0 .../storage/driver/inmemory/driver.go | 0 .../storage/driver/inmemory/driver_test.go | 0 .../registry/storage/driver/inmemory/mfs.go | 0 .../middleware/cloudfront/middleware.go | 0 .../driver/middleware/storagemiddleware.go | 0 .../registry/storage/driver/oss/doc.go | 0 .../registry/storage/driver/oss/oss.go | 0 .../registry/storage/driver/oss/oss_test.go | 0 .../registry/storage/driver/rados/doc.go | 0 .../registry/storage/driver/rados/rados.go | 0 .../storage/driver/rados/rados_test.go | 0 .../registry/storage/driver/s3/s3.go | 0 .../registry/storage/driver/s3/s3_test.go | 0 .../registry/storage/driver/storagedriver.go | 0 .../registry/storage/driver/swift/swift.go | 0 .../storage/driver/swift/swift_test.go | 0 .../storage/driver/testsuites/testsuites.go | 0 .../registry/storage/filereader.go | 0 .../registry/storage/filereader_test.go | 0 .../registry/storage/filewriter.go | 0 .../registry/storage/filewriter_test.go | 0 .../registry/storage/linkedblobstore.go | 0 .../registry/storage/manifeststore.go | 0 .../registry/storage/manifeststore_test.go | 0 .../distribution/registry/storage/paths.go | 0 .../registry/storage/paths_test.go | 0 .../registry/storage/purgeuploads.go | 0 .../registry/storage/purgeuploads_test.go | 0 .../distribution/registry/storage/registry.go | 0 .../registry/storage/revisionstore.go | 0 .../registry/storage/signaturestore.go | 0 .../distribution/registry/storage/tagstore.go | 0 .../distribution/registry/storage/util.go | 0 .../distribution/registry/storage/vacuum.go | 0 .../distribution/registry/storage/walk.go | 0 .../registry/storage/walk_test.go | 0 .../docker/distribution/testutil/handler.go | 0 .../docker/distribution/testutil/tarfile.go | 0 .../docker/distribution/uuid/uuid.go | 0 .../docker/distribution/uuid/uuid_test.go | 0 .../docker/distribution/version/print.go | 0 .../docker/distribution/version/version.go | 0 .../docker/distribution/version/version.sh | 0 vendor/github.com/docker/docker/.dockerignore | 2 + vendor/github.com/docker/docker/.gitignore | 37 + vendor/github.com/docker/docker/.mailmap | 171 + vendor/github.com/docker/docker/AUTHORS | 1033 +++++ vendor/github.com/docker/docker/CHANGELOG.md | 1716 +++++++++ .../github.com/docker/docker/CONTRIBUTING.md | 435 +++ vendor/github.com/docker/docker/Dockerfile | 217 ++ .../docker/docker/Dockerfile.simple | 34 + vendor/github.com/docker/docker/LICENSE | 191 + vendor/github.com/docker/docker/MAINTAINERS | 618 +++ vendor/github.com/docker/docker/Makefile | 80 + vendor/github.com/docker/docker/NOTICE | 19 + vendor/github.com/docker/docker/README.md | 295 ++ vendor/github.com/docker/docker/ROADMAP.md | 183 + vendor/github.com/docker/docker/VERSION | 1 + .../github.com/docker/docker/api/README.md | 0 .../docker/docker/api/api_unit_test.go | 0 .../docker/docker/api/client/attach.go | 0 .../docker/docker/api/client/build.go | 0 .../docker/docker/api/client/cli.go | 0 .../docker/docker/api/client/client.go | 0 .../docker/docker/api/client/commit.go | 0 .../github.com/docker/docker/api/client/cp.go | 0 .../docker/docker/api/client/create.go | 0 .../docker/docker/api/client/diff.go | 0 .../docker/docker/api/client/events.go | 0 .../docker/docker/api/client/exec.go | 0 .../docker/docker/api/client/export.go | 0 .../docker/docker/api/client/hijack.go | 0 .../docker/docker/api/client/history.go | 0 .../docker/docker/api/client/images.go | 0 .../docker/docker/api/client/import.go | 0 .../docker/docker/api/client/info.go | 0 .../docker/docker/api/client/inspect.go | 0 .../docker/docker/api/client/kill.go | 0 .../docker/docker/api/client/load.go | 0 .../docker/docker/api/client/login.go | 0 .../docker/docker/api/client/logout.go | 0 .../docker/docker/api/client/logs.go | 0 .../docker/docker/api/client/network.go | 0 .../docker/docker/api/client/pause.go | 0 .../docker/docker/api/client/port.go | 0 .../github.com/docker/docker/api/client/ps.go | 0 .../docker/docker/api/client/ps/custom.go | 0 .../docker/api/client/ps/custom_test.go | 0 .../docker/docker/api/client/ps/formatter.go | 0 .../docker/docker/api/client/pull.go | 0 .../docker/docker/api/client/push.go | 0 .../docker/docker/api/client/rename.go | 0 .../docker/docker/api/client/restart.go | 0 .../github.com/docker/docker/api/client/rm.go | 0 .../docker/docker/api/client/rmi.go | 0 .../docker/docker/api/client/run.go | 0 .../docker/docker/api/client/save.go | 0 .../docker/docker/api/client/search.go | 0 .../docker/docker/api/client/service.go | 0 .../docker/docker/api/client/start.go | 0 .../docker/docker/api/client/stats.go | 0 .../docker/api/client/stats_unit_test.go | 0 .../docker/docker/api/client/stop.go | 0 .../docker/docker/api/client/tag.go | 0 .../docker/docker/api/client/top.go | 0 .../docker/docker/api/client/trust.go | 0 .../docker/docker/api/client/unpause.go | 0 .../docker/docker/api/client/utils.go | 0 .../docker/docker/api/client/version.go | 0 .../docker/docker/api/client/wait.go | 0 .../github.com/docker/docker/api/common.go | 0 .../docker/docker/api/server/form.go | 0 .../docker/docker/api/server/form_test.go | 0 .../docker/docker/api/server/profiler.go | 0 .../docker/docker/api/server/server.go | 0 .../docker/api/server/server_experimental.go | 0 .../docker/api/server/server_linux_test.go | 0 .../docker/docker/api/server/server_stub.go | 0 .../docker/docker/api/server/server_unix.go | 0 .../docker/api/server/server_windows.go | 0 .../docker/docker/api/types/stats.go | 0 .../docker/docker/api/types/types.go | 0 .../docker/docker/cliconfig/config.go | 0 .../docker/docker/cliconfig/config_test.go | 0 .../github.com/docker/docker/daemon/README.md | 10 + .../docker/docker/daemon/archive.go | 292 ++ .../docker/docker/daemon/archive_unix.go | 19 + .../docker/docker/daemon/archive_windows.go | 10 + .../github.com/docker/docker/daemon/attach.go | 50 + .../docker/docker/daemon/changes.go | 13 + .../github.com/docker/docker/daemon/commit.go | 60 + .../github.com/docker/docker/daemon/config.go | 58 + .../docker/daemon/config_experimental.go | 10 + .../docker/docker/daemon/config_stub.go | 8 + .../docker/docker/daemon/config_unix.go | 82 + .../docker/docker/daemon/config_windows.go | 41 + .../docker/docker/daemon/container.go | 1134 ++++++ .../docker/daemon/container_unit_test.go | 33 + .../docker/docker/daemon/container_unix.go | 1209 ++++++ .../docker/docker/daemon/container_windows.go | 211 ++ .../github.com/docker/docker/daemon/create.go | 120 + .../docker/docker/daemon/create_unix.go | 60 + .../docker/docker/daemon/create_windows.go | 10 + .../github.com/docker/docker/daemon/daemon.go | 969 +++++ .../docker/docker/daemon/daemon_aufs.go | 21 + .../docker/docker/daemon/daemon_btrfs.go | 7 + .../docker/daemon/daemon_devicemapper.go | 7 + .../docker/docker/daemon/daemon_no_aufs.go | 11 + .../docker/docker/daemon/daemon_overlay.go | 7 + .../docker/docker/daemon/daemon_test.go | 549 +++ .../docker/docker/daemon/daemon_unix.go | 558 +++ .../docker/docker/daemon/daemon_windows.go | 182 + .../docker/docker/daemon/daemon_zfs.go | 7 + .../docker/docker/daemon/debugtrap_unix.go | 21 + .../docker/daemon/debugtrap_unsupported.go | 7 + .../docker/docker/daemon/debugtrap_windows.go | 30 + .../github.com/docker/docker/daemon/delete.go | 146 + .../github.com/docker/docker/daemon/exec.go | 305 ++ .../docker/docker/daemon/exec_freebsd.go | 9 + .../docker/docker/daemon/exec_linux.go | 18 + .../docker/docker/daemon/exec_windows.go | 9 + .../github.com/docker/docker/daemon/export.go | 25 + .../docker/docker/daemon/history.go | 31 + .../docker/docker/daemon/image_delete.go | 180 + .../github.com/docker/docker/daemon/info.go | 114 + .../docker/docker/daemon/inspect.go | 95 + .../docker/docker/daemon/inspect_unix.go | 62 + .../docker/docker/daemon/inspect_windows.go | 12 + .../github.com/docker/docker/daemon/kill.go | 27 + .../github.com/docker/docker/daemon/list.go | 205 + .../docker/docker/daemon/logdrivers_linux.go | 11 + .../docker/daemon/logdrivers_windows.go | 7 + .../github.com/docker/docker/daemon/logs.go | 83 + .../docker/docker/daemon/monitor.go | 339 ++ .../docker/docker/daemon/network/settings.go | 0 .../github.com/docker/docker/daemon/pause.go | 17 + .../github.com/docker/docker/daemon/rename.go | 45 + .../github.com/docker/docker/daemon/resize.go | 19 + .../docker/docker/daemon/restart.go | 14 + .../github.com/docker/docker/daemon/start.go | 48 + .../github.com/docker/docker/daemon/state.go | 276 ++ .../docker/docker/daemon/state_test.go | 104 + .../github.com/docker/docker/daemon/stats.go | 118 + .../docker/daemon/stats_collector_unix.go | 162 + .../docker/daemon/stats_collector_windows.go | 31 + .../docker/docker/daemon/stats_freebsd.go | 14 + .../docker/docker/daemon/stats_linux.go | 76 + .../docker/docker/daemon/stats_windows.go | 14 + .../github.com/docker/docker/daemon/stop.go | 17 + vendor/github.com/docker/docker/daemon/top.go | 73 + .../docker/docker/daemon/unpause.go | 17 + .../docker/docker/daemon/utils_freebsd.go | 9 + .../docker/docker/daemon/utils_linux.go | 48 + .../docker/docker/daemon/utils_nounix.go | 13 + .../docker/docker/daemon/utils_test.go | 28 + .../docker/docker/daemon/volumes.go | 88 + .../docker/daemon/volumes_linux_unit_test.go | 87 + .../docker/docker/daemon/volumes_unit_test.go | 35 + .../docker/docker/daemon/volumes_unix.go | 400 ++ .../docker/docker/daemon/volumes_windows.go | 28 + .../github.com/docker/docker/daemon/wait.go | 12 + .../github.com/docker/docker/graph/export.go | 170 + .../github.com/docker/docker/graph/graph.go | 612 +++ .../docker/docker/graph/graph_test.go | 298 ++ .../docker/docker/graph/graph_unix.go | 120 + .../docker/docker/graph/graph_windows.go | 164 + .../github.com/docker/docker/graph/history.go | 121 + .../github.com/docker/docker/graph/import.go | 86 + vendor/github.com/docker/docker/graph/list.go | 156 + vendor/github.com/docker/docker/graph/load.go | 135 + .../docker/docker/graph/load_unsupported.go | 14 + .../github.com/docker/docker/graph/mutex.go | 45 + .../docker/docker/graph/pools_test.go | 49 + vendor/github.com/docker/docker/graph/pull.go | 143 + .../github.com/docker/docker/graph/pull_v1.go | 331 ++ .../github.com/docker/docker/graph/pull_v2.go | 409 ++ vendor/github.com/docker/docker/graph/push.go | 117 + .../github.com/docker/docker/graph/push_v1.go | 309 ++ .../github.com/docker/docker/graph/push_v2.go | 263 ++ .../docker/docker/graph/registry.go | 111 + .../github.com/docker/docker/graph/service.go | 81 + vendor/github.com/docker/docker/graph/tags.go | 455 +++ .../docker/docker/graph/tags/tags.go | 0 .../docker/graph/tags/tags_unit_test.go | 0 .../docker/docker/graph/tags_unit_test.go | 211 ++ .../github.com/docker/docker/image/image.go | 0 .../github.com/docker/docker/image/spec/v1.md | 0 .../github.com/docker/docker/opts/envfile.go | 0 .../docker/docker/opts/envfile_test.go | 0 .../docker/docker/opts/hosts_unix.go | 0 .../docker/docker/opts/hosts_windows.go | 0 .../github.com/docker/docker/opts/ip.go | 0 .../github.com/docker/docker/opts/ip_test.go | 0 .../github.com/docker/docker/opts/opts.go | 0 .../docker/docker/opts/opts_test.go | 0 .../github.com/docker/docker/opts/ulimit.go | 0 .../docker/docker/opts/ulimit_test.go | 0 vendor/github.com/docker/docker/pkg/README.md | 11 + .../docker/docker/pkg/archive/README.md | 0 .../docker/docker/pkg/archive/archive.go | 0 .../docker/docker/pkg/archive/archive_test.go | 0 .../docker/docker/pkg/archive/archive_unix.go | 0 .../docker/pkg/archive/archive_unix_test.go | 0 .../docker/pkg/archive/archive_windows.go | 0 .../pkg/archive/archive_windows_test.go | 0 .../docker/docker/pkg/archive/changes.go | 0 .../docker/pkg/archive/changes_linux.go | 0 .../docker/pkg/archive/changes_other.go | 0 .../docker/pkg/archive/changes_posix_test.go | 0 .../docker/docker/pkg/archive/changes_test.go | 0 .../docker/docker/pkg/archive/changes_unix.go | 0 .../docker/pkg/archive/changes_windows.go | 0 .../docker/docker/pkg/archive/copy.go | 0 .../docker/docker/pkg/archive/copy_test.go | 0 .../docker/docker/pkg/archive/diff.go | 0 .../docker/docker/pkg/archive/diff_test.go | 0 .../docker/pkg/archive/example_changes.go | 0 .../docker/pkg/archive/testdata/broken.tar | Bin .../docker/docker/pkg/archive/time_linux.go | 0 .../docker/pkg/archive/time_unsupported.go | 0 .../docker/docker/pkg/archive/utils_test.go | 0 .../docker/docker/pkg/archive/wrap.go | 0 .../docker/docker/pkg/archive/wrap_test.go | 0 .../docker/docker/pkg/fileutils/fileutils.go | 0 .../docker/pkg/fileutils/fileutils_test.go | 0 .../docker/docker/pkg/homedir/homedir.go | 0 .../docker/docker/pkg/homedir/homedir_test.go | 0 .../docker/docker/pkg/httputils/httputils.go | 0 .../docker/docker/pkg/httputils/mimetype.go | 0 .../pkg/httputils/resumablerequestreader.go | 0 .../httputils/resumablerequestreader_test.go | 0 .../docker/docker/pkg/ioutils/fmt.go | 0 .../docker/docker/pkg/ioutils/fmt_test.go | 0 .../docker/docker/pkg/ioutils/multireader.go | 0 .../docker/pkg/ioutils/multireader_test.go | 0 .../docker/docker/pkg/ioutils/readers.go | 0 .../docker/docker/pkg/ioutils/readers_test.go | 0 .../docker/docker/pkg/ioutils/scheduler.go | 0 .../docker/pkg/ioutils/scheduler_gccgo.go | 0 .../docker/docker/pkg/ioutils/writeflusher.go | 0 .../docker/docker/pkg/ioutils/writers.go | 0 .../docker/docker/pkg/ioutils/writers_test.go | 0 .../docker/pkg/jsonmessage/jsonmessage.go | 0 .../pkg/jsonmessage/jsonmessage_test.go | 0 .../docker/docker/pkg/mflag/LICENSE | 0 .../docker/docker/pkg/mflag/README.md | 0 .../docker/pkg/mflag/example/example.go | 0 .../docker/docker/pkg/mflag/flag.go | 0 .../docker/docker/pkg/mflag/flag_test.go | 0 .../docker/docker/pkg/mount/flags.go | 0 .../docker/docker/pkg/mount/flags_freebsd.go | 0 .../docker/docker/pkg/mount/flags_linux.go | 0 .../docker/pkg/mount/flags_unsupported.go | 0 .../docker/docker/pkg/mount/mount.go | 0 .../docker/docker/pkg/mount/mount_test.go | 0 .../docker/pkg/mount/mounter_freebsd.go | 0 .../docker/docker/pkg/mount/mounter_linux.go | 0 .../docker/pkg/mount/mounter_unsupported.go | 0 .../docker/docker/pkg/mount/mountinfo.go | 0 .../docker/pkg/mount/mountinfo_freebsd.go | 0 .../docker/pkg/mount/mountinfo_linux.go | 0 .../docker/pkg/mount/mountinfo_linux_test.go | 0 .../docker/pkg/mount/mountinfo_unsupported.go | 0 .../docker/pkg/mount/sharedsubtree_linux.go | 0 .../pkg/mount/sharedsubtree_linux_test.go | 0 .../github.com/docker/docker/pkg/nat/nat.go | 0 .../docker/docker/pkg/nat/nat_test.go | 0 .../github.com/docker/docker/pkg/nat/sort.go | 0 .../docker/docker/pkg/nat/sort_test.go | 0 .../docker/pkg/parsers/filters/parse.go | 0 .../docker/pkg/parsers/filters/parse_test.go | 0 .../docker/pkg/parsers/kernel/kernel.go | 0 .../docker/pkg/parsers/kernel/kernel_test.go | 0 .../pkg/parsers/kernel/kernel_windows.go | 0 .../docker/pkg/parsers/kernel/uname_linux.go | 0 .../pkg/parsers/kernel/uname_unsupported.go | 0 .../operatingsystem_freebsd.go | 0 .../operatingsystem/operatingsystem_linux.go | 0 .../operatingsystem/operatingsystem_test.go | 0 .../operatingsystem_windows.go | 0 .../docker/docker/pkg/parsers/parsers.go | 0 .../docker/docker/pkg/parsers/parsers_test.go | 0 .../docker/docker/pkg/pools/pools.go | 0 .../docker/docker/pkg/pools/pools_test.go | 0 .../docker/docker/pkg/promise/promise.go | 0 .../docker/docker/pkg/random/random.go | 0 .../docker/docker/pkg/random/random_test.go | 0 .../docker/docker/pkg/reexec/README.md | 0 .../docker/pkg/reexec/command_freebsd.go | 0 .../docker/docker/pkg/reexec/command_linux.go | 0 .../docker/pkg/reexec/command_unsupported.go | 0 .../docker/pkg/reexec/command_windows.go | 0 .../docker/docker/pkg/reexec/reexec.go | 0 .../docker/docker/pkg/stdcopy/stdcopy.go | 0 .../docker/docker/pkg/stdcopy/stdcopy_test.go | 0 .../docker/docker/pkg/stringid/README.md | 0 .../docker/docker/pkg/stringid/stringid.go | 0 .../docker/pkg/stringid/stringid_test.go | 0 .../docker/docker/pkg/symlink/LICENSE.APACHE | 0 .../docker/docker/pkg/symlink/LICENSE.BSD | 0 .../docker/docker/pkg/symlink/README.md | 0 .../docker/docker/pkg/symlink/fs.go | 0 .../docker/docker/pkg/symlink/fs_test.go | 0 .../docker/docker/pkg/system/errors.go | 0 .../docker/pkg/system/events_windows.go | 0 .../docker/docker/pkg/system/filesys.go | 0 .../docker/pkg/system/filesys_windows.go | 0 .../docker/docker/pkg/system/lstat.go | 0 .../docker/docker/pkg/system/lstat_test.go | 0 .../docker/docker/pkg/system/lstat_windows.go | 0 .../docker/docker/pkg/system/meminfo.go | 0 .../docker/docker/pkg/system/meminfo_linux.go | 0 .../docker/pkg/system/meminfo_linux_test.go | 0 .../docker/pkg/system/meminfo_unsupported.go | 0 .../docker/pkg/system/meminfo_windows.go | 0 .../docker/docker/pkg/system/mknod.go | 0 .../docker/docker/pkg/system/mknod_windows.go | 0 .../docker/docker/pkg/system/stat.go | 0 .../docker/docker/pkg/system/stat_freebsd.go | 0 .../docker/docker/pkg/system/stat_linux.go | 0 .../docker/docker/pkg/system/stat_test.go | 0 .../docker/pkg/system/stat_unsupported.go | 0 .../docker/docker/pkg/system/stat_windows.go | 0 .../docker/docker/pkg/system/umask.go | 0 .../docker/docker/pkg/system/umask_windows.go | 0 .../docker/docker/pkg/system/utimes_darwin.go | 0 .../docker/pkg/system/utimes_freebsd.go | 0 .../docker/docker/pkg/system/utimes_linux.go | 0 .../docker/docker/pkg/system/utimes_test.go | 0 .../docker/pkg/system/utimes_unsupported.go | 0 .../docker/docker/pkg/system/xattrs_linux.go | 0 .../docker/pkg/system/xattrs_unsupported.go | 0 .../docker/pkg/tarsum/builder_context.go | 0 .../docker/pkg/tarsum/builder_context_test.go | 63 + .../docker/docker/pkg/tarsum/fileinfosums.go | 0 .../docker/pkg/tarsum/fileinfosums_test.go | 62 + .../docker/docker/pkg/tarsum/tarsum.go | 0 .../docker/docker/pkg/tarsum/tarsum_spec.md | 0 .../docker/docker/pkg/tarsum/tarsum_test.go | 648 ++++ .../json | 1 + .../layer.tar | Bin 0 -> 9216 bytes .../json | 1 + .../layer.tar | Bin 0 -> 1536 bytes .../tarsum/testdata/collision/collision-0.tar | Bin 0 -> 10240 bytes .../tarsum/testdata/collision/collision-1.tar | Bin 0 -> 10240 bytes .../tarsum/testdata/collision/collision-2.tar | Bin 0 -> 10240 bytes .../tarsum/testdata/collision/collision-3.tar | Bin 0 -> 10240 bytes .../docker/pkg/tarsum/testdata/xattr/json | 1 + .../pkg/tarsum/testdata/xattr/layer.tar | Bin 2048 -> 2560 bytes .../docker/docker/pkg/tarsum/versioning.go | 0 .../docker/pkg/tarsum/versioning_test.go | 98 + .../docker/docker/pkg/tarsum/writercloser.go | 22 + .../docker/docker/pkg/term/tc_linux_cgo.go | 0 .../docker/docker/pkg/term/tc_other.go | 0 .../github.com/docker/docker/pkg/term/term.go | 0 .../docker/docker/pkg/term/term_windows.go | 0 .../docker/docker/pkg/term/termios_darwin.go | 0 .../docker/docker/pkg/term/termios_freebsd.go | 0 .../docker/docker/pkg/term/termios_linux.go | 0 .../docker/pkg/term/windows/ansi_reader.go | 0 .../docker/pkg/term/windows/ansi_writer.go | 0 .../docker/docker/pkg/term/windows/console.go | 0 .../docker/docker/pkg/term/windows/windows.go | 0 .../docker/pkg/term/windows/windows_test.go | 0 .../docker/docker/pkg/timeutils/json.go | 0 .../docker/docker/pkg/timeutils/json_test.go | 0 .../docker/docker/pkg/timeutils/utils.go | 0 .../docker/docker/pkg/timeutils/utils_test.go | 0 .../docker/docker/pkg/tlsconfig/config.go | 0 .../docker/docker/pkg/ulimit/ulimit.go | 0 .../docker/docker/pkg/ulimit/ulimit_test.go | 0 .../docker/docker/pkg/units/duration.go | 0 .../docker/docker/pkg/units/duration_test.go | 0 .../docker/docker/pkg/units/size.go | 0 .../docker/docker/pkg/units/size_test.go | 0 .../docker/docker/pkg/urlutil/urlutil.go | 0 .../docker/docker/pkg/urlutil/urlutil_test.go | 0 .../docker/docker/pkg/useragent/README.md | 0 .../docker/docker/pkg/useragent/useragent.go | 0 .../docker/pkg/useragent/useragent_test.go | 0 .../docker/docker/pkg/version/version.go | 0 .../docker/docker/pkg/version/version_test.go | 0 .../github.com/docker/docker/registry/auth.go | 0 .../docker/docker/registry/auth_test.go | 0 .../docker/docker/registry/authchallenge.go | 0 .../docker/docker/registry/config.go | 0 .../docker/docker/registry/config_test.go | 0 .../docker/docker/registry/endpoint.go | 0 .../docker/docker/registry/endpoint_test.go | 0 .../docker/docker/registry/reference.go | 0 .../docker/docker/registry/registry.go | 0 .../docker/registry/registry_mock_test.go | 0 .../docker/docker/registry/registry_test.go | 0 .../docker/docker/registry/service.go | 0 .../docker/docker/registry/session.go | 0 .../docker/docker/registry/token.go | 0 .../docker/docker/registry/types.go | 0 .../docker/docker/runconfig/compare.go | 0 .../docker/docker/runconfig/compare_test.go | 0 .../docker/docker/runconfig/config.go | 0 .../docker/docker/runconfig/config_test.go | 0 .../docker/docker/runconfig/exec.go | 0 .../docker/docker/runconfig/exec_test.go | 0 .../fixtures/container_config_1_14.json | 0 .../fixtures/container_config_1_17.json | 0 .../fixtures/container_config_1_19.json | 0 .../fixtures/container_hostconfig_1_14.json | 0 .../fixtures/container_hostconfig_1_19.json | 0 .../docker/runconfig/fixtures/valid.env | 0 .../docker/runconfig/fixtures/valid.label | 0 .../docker/docker/runconfig/hostconfig.go | 0 .../docker/runconfig/hostconfig_test.go | 0 .../docker/runconfig/hostconfig_unix.go | 0 .../docker/runconfig/hostconfig_windows.go | 0 .../docker/docker/runconfig/merge.go | 0 .../docker/docker/runconfig/merge_test.go | 0 .../docker/docker/runconfig/parse.go | 0 .../docker/runconfig/parse_experimental.go | 0 .../docker/docker/runconfig/parse_stub.go | 0 .../docker/docker/runconfig/parse_test.go | 0 .../docker/docker/runconfig/parse_unix.go | 0 .../docker/docker/runconfig/parse_windows.go | 0 .../docker/docker/utils/experimental.go | 0 .../github.com/docker/docker/utils/git.go | 0 .../docker/docker/utils/git_test.go | 0 .../github.com/docker/docker/utils/stubs.go | 0 .../github.com/docker/docker/utils/utils.go | 0 .../docker/docker/utils/utils_test.go | 0 .../docker/docker/volume/drivers/adapter.go | 0 .../docker/docker/volume/drivers/api.go | 0 .../docker/docker/volume/drivers/extpoint.go | 0 .../docker/docker/volume/drivers/proxy.go | 0 .../docker/volume/drivers/proxy_test.go | 0 .../docker/docker/volume/local/local.go | 0 .../github.com/docker/docker/volume/volume.go | 0 .../docker/libcompose/.dockerignore | 1 + .../github.com/docker/libcompose/.gitignore | 8 + .../github.com/docker/libcompose/CHANGELOG.md | 8 + .../docker/libcompose/CONTRIBUTING.md | 16 + .../github.com/docker/libcompose/Dockerfile | 45 + vendor/github.com/docker/libcompose/LICENSE | 191 + .../github.com/docker/libcompose/MAINTAINERS | 6 + vendor/github.com/docker/libcompose/Makefile | 67 + vendor/github.com/docker/libcompose/README.md | 128 + .../docker/libcompose/cli/app/app.go | 10 +- .../docker/libcompose/cli/app/types.go | 0 .../docker/libcompose/cli/command/command.go | 27 +- .../docker/libcompose/cli/command/help.go | 37 + .../libcompose/cli/docker/app/commands.go | 0 .../libcompose/cli/docker/app/factory.go | 0 .../libcompose/cli/logger/color_logger.go | 0 .../docker/libcompose/cli/logger/colors.go | 0 .../docker/libcompose/cli/main/main.go | 41 + .../docker/libcompose/docker/builder.go | 53 +- .../docker/libcompose/docker/client.go | 26 +- .../libcompose/docker/client_factory.go | 11 +- .../docker/libcompose/docker/container.go | 539 +++ .../docker/libcompose/docker/context.go | 3 + .../docker/libcompose/docker/convert.go | 177 + .../docker/libcompose/docker/convert_test.go | 21 +- .../docker/libcompose/docker/functions.go | 52 + .../docker/libcompose/docker/labels.go | 75 + .../docker/libcompose/docker/name.go | 27 +- .../docker/libcompose/docker/project.go | 1 + .../docker/libcompose/docker/service.go | 109 +- .../libcompose/docker/service_factory.go | 2 + .../docker/libcompose/docker/service_test.go | 27 + .../github.com/docker/libcompose/generate.go | 4 + .../docker/libcompose/logger/null.go | 18 + .../docker/libcompose/logger/types.go | 29 + .../docker/libcompose/lookup/file.go | 0 .../docker/libcompose/lookup/file_test.go | 0 .../docker/libcompose/lookup/simple_env.go | 0 .../libcompose/lookup/simple_env_test.go | 0 .../github.com/docker/libcompose/package.go | 1 + .../docker/libcompose/project/context.go | 16 +- .../docker/libcompose/project/empty.go | 70 + .../docker/libcompose/project/hash.go | 11 +- .../docker/libcompose/project/info.go | 4 +- .../libcompose/project/interpolation.go | 179 + .../libcompose/project/interpolation_test.go | 226 ++ .../docker/libcompose/project/listener.go | 76 + .../docker/libcompose/project/merge.go | 54 +- .../docker/libcompose/project/merge_test.go | 192 + .../docker/libcompose/project/project.go | 148 +- .../docker/libcompose/project/project_test.go | 148 + .../libcompose/project/service-wrapper.go | 18 +- .../docker/libcompose/project/types.go | 295 ++ .../docker/libcompose/project/types_yaml.go | 297 ++ .../libcompose/project/types_yaml_test.go | 14 +- .../docker/libcompose/project/utils.go | 21 +- .../docker/libcompose/project/yaml_test.go | 54 + .../docker/libcompose/utils/util.go | 62 +- .../docker/libcompose/utils/util_test.go | 23 +- .../github.com/docker/libcontainer/.gitignore | 3 + .../docker/libcontainer/CONTRIBUTING.md | 257 ++ .../github.com/docker/libcontainer/Dockerfile | 25 + vendor/github.com/docker/libcontainer/LICENSE | 191 + .../docker/libcontainer/MAINTAINERS | 7 + .../docker/libcontainer/MAINTAINERS_GUIDE.md | 99 + .../github.com/docker/libcontainer/Makefile | 33 + vendor/github.com/docker/libcontainer/NOTICE | 16 + .../docker/libcontainer/PRINCIPLES.md | 19 + .../github.com/docker/libcontainer/README.md | 7 + .../github.com/docker/libcontainer/ROADMAP.md | 20 + vendor/github.com/docker/libcontainer/SPEC.md | 334 ++ .../docker/libcontainer/capabilities_linux.go | 91 + .../github.com/docker/libcontainer/console.go | 15 + .../docker/libcontainer/console_freebsd.go | 13 + .../docker/libcontainer/console_linux.go | 145 + .../docker/libcontainer/console_windows.go | 30 + .../docker/libcontainer/container.go | 162 + .../docker/libcontainer/container_linux.go | 779 ++++ .../libcontainer/container_linux_test.go | 212 ++ .../libcontainer/container_nouserns_linux.go | 13 + .../libcontainer/container_userns_linux.go | 26 + .../docker/libcontainer/criu_opts.go | 16 + .../github.com/docker/libcontainer/error.go | 62 + .../docker/libcontainer/error_test.go | 20 + .../github.com/docker/libcontainer/factory.go | 45 + .../docker/libcontainer/factory_linux.go | 263 ++ .../docker/libcontainer/factory_linux_test.go | 179 + .../docker/libcontainer/generic_error.go | 74 + .../docker/libcontainer/generic_error_test.go | 14 + .../docker/libcontainer/init_linux.go | 330 ++ .../docker/libcontainer/netlink/MAINTAINERS | 0 .../docker/libcontainer/netlink/netlink.go | 0 .../libcontainer/netlink/netlink_linux.go | 0 .../netlink/netlink_linux_armppc64.go | 0 .../netlink/netlink_linux_notarm.go | 0 .../netlink/netlink_linux_test.go | 0 .../netlink/netlink_unsupported.go | 0 .../docker/libcontainer/network_linux.go | 248 ++ .../docker/libcontainer/notify_linux.go | 63 + .../docker/libcontainer/notify_linux_test.go | 96 + .../github.com/docker/libcontainer/process.go | 89 + .../docker/libcontainer/process_linux.go | 303 ++ .../docker/libcontainer/restored_process.go | 118 + .../docker/libcontainer/rootfs_linux.go | 462 +++ .../docker/libcontainer/rootfs_linux_test.go | 37 + .../docker/libcontainer/setns_init_linux.go | 35 + .../libcontainer/standard_init_linux.go | 106 + .../github.com/docker/libcontainer/stats.go | 15 + .../docker/libcontainer/stats_freebsd.go | 5 + .../docker/libcontainer/stats_linux.go | 8 + .../docker/libcontainer/stats_windows.go | 5 + .../docker/libcontainer/update-vendor.sh | 50 + .../github.com/docker/libnetwork/.gitignore | 33 + vendor/github.com/docker/libnetwork/LICENSE | 202 + .../github.com/docker/libnetwork/MAINTAINERS | 5 + vendor/github.com/docker/libnetwork/Makefile | 79 + vendor/github.com/docker/libnetwork/README.md | 88 + .../github.com/docker/libnetwork/ROADMAP.md | 20 + .../github.com/docker/libnetwork/circle.yml | 12 + .../docker/libnetwork/controller.go | 399 ++ .../docker/libnetwork/drivers_freebsd.go | 19 + .../docker/libnetwork/drivers_linux.go | 25 + .../docker/libnetwork/drivers_windows.go | 17 + .../github.com/docker/libnetwork/endpoint.go | 998 +++++ .../docker/libnetwork/endpoint_info.go | 323 ++ vendor/github.com/docker/libnetwork/error.go | 175 + .../docker/libnetwork/errors_test.go | 51 + .../libnetwork/libnetwork_internal_test.go | 32 + .../docker/libnetwork/libnetwork_test.go | 2067 ++++++++++ .../github.com/docker/libnetwork/network.go | 471 +++ .../docker/libnetwork/resolvconf/README.md | 0 .../libnetwork/resolvconf/dns/resolvconf.go | 0 .../libnetwork/resolvconf/resolvconf.go | 0 .../libnetwork/resolvconf/resolvconf_test.go | 0 .../docker/libnetwork/sandboxdata.go | 251 ++ .../docker/libnetwork/sandboxdata_test.go | 141 + vendor/github.com/docker/libnetwork/store.go | 371 ++ .../docker/libtrust/CONTRIBUTING.md | 13 + vendor/github.com/docker/libtrust/LICENSE | 191 + vendor/github.com/docker/libtrust/MAINTAINERS | 3 + vendor/github.com/docker/libtrust/README.md | 18 + .../docker/libtrust/certificates.go | 175 + .../docker/libtrust/certificates_test.go | 111 + vendor/github.com/docker/libtrust/doc.go | 9 + vendor/github.com/docker/libtrust/ec_key.go | 428 +++ .../github.com/docker/libtrust/ec_key_test.go | 157 + vendor/github.com/docker/libtrust/filter.go | 50 + .../github.com/docker/libtrust/filter_test.go | 81 + vendor/github.com/docker/libtrust/hash.go | 56 + vendor/github.com/docker/libtrust/jsonsign.go | 657 ++++ .../docker/libtrust/jsonsign_test.go | 380 ++ vendor/github.com/docker/libtrust/key.go | 253 ++ .../github.com/docker/libtrust/key_files.go | 255 ++ .../docker/libtrust/key_files_test.go | 220 ++ .../github.com/docker/libtrust/key_manager.go | 175 + vendor/github.com/docker/libtrust/key_test.go | 80 + vendor/github.com/docker/libtrust/rsa_key.go | 427 +++ .../docker/libtrust/rsa_key_test.go | 157 + .../docker/libtrust/testutil/certificates.go | 94 + .../docker/libtrust/tlsdemo/README.md | 50 + .../docker/libtrust/tlsdemo/client.go | 89 + .../docker/libtrust/tlsdemo/gencert.go | 62 + .../docker/libtrust/tlsdemo/genkeys.go | 61 + .../docker/libtrust/tlsdemo/server.go | 80 + .../docker/libtrust/trustgraph/graph.go | 50 + .../libtrust/trustgraph/memory_graph.go | 133 + .../libtrust/trustgraph/memory_graph_test.go | 174 + .../docker/libtrust/trustgraph/statement.go | 227 ++ .../libtrust/trustgraph/statement_test.go | 417 +++ .../github.com/docker/libtrust/util.go | 0 .../github.com/docker/libtrust/util_test.go | 0 .../github.com/docker/machine/.dockerignore | 2 + vendor/github.com/docker/machine/.gitignore | 2 + vendor/github.com/docker/machine/.godir | 1 + vendor/github.com/docker/machine/.travis.yml | 14 + vendor/github.com/docker/machine/CHANGELOG.md | 164 + .../github.com/docker/machine/CONTRIBUTING.md | 227 ++ vendor/github.com/docker/machine/Dockerfile | 15 + vendor/github.com/docker/machine/LICENSE | 191 + vendor/github.com/docker/machine/MAINTAINERS | 3 + vendor/github.com/docker/machine/Makefile | 18 + vendor/github.com/docker/machine/README.md | 56 + vendor/github.com/docker/machine/ROADMAP.md | 31 + .../github.com/docker/machine/log/log.go | 0 .../github.com/docker/machine/log/log_test.go | 0 .../github.com/docker/machine/log/terminal.go | 0 vendor/github.com/docker/machine/main.go | 125 + vendor/github.com/docker/machine/main_test.go | 1 + .../github.com/docker/machine/utils/b2d.go | 0 .../docker/machine/utils/b2d_test.go | 0 .../github.com/docker/machine/utils/certs.go | 0 .../docker/machine/utils/certs_test.go | 0 .../github.com/docker/machine/utils/utils.go | 0 .../docker/machine/utils/utils_test.go | 0 vendor/github.com/flynn/go-shlex/COPYING | 202 + .../github.com/flynn/go-shlex/Makefile | 0 .../github.com/flynn/go-shlex/README.md | 0 .../github.com/flynn/go-shlex/shlex.go | 0 .../github.com/flynn/go-shlex/shlex_test.go | 0 .../fsouza/go-dockerclient/.gitignore | 2 + .../fsouza/go-dockerclient/.travis.yml | 15 + .../github.com/fsouza/go-dockerclient/AUTHORS | 32 +- .../fsouza/go-dockerclient/DOCKER-LICENSE | 0 .../github.com/fsouza/go-dockerclient/LICENSE | 0 .../fsouza/go-dockerclient/Makefile | 51 + .../fsouza/go-dockerclient/README.markdown | 43 +- .../github.com/fsouza/go-dockerclient/auth.go | 59 +- .../fsouza/go-dockerclient/auth_test.go | 39 +- .../fsouza/go-dockerclient/build_test.go | 12 +- .../fsouza/go-dockerclient/change.go | 2 +- .../fsouza/go-dockerclient/change_test.go | 4 +- .../fsouza/go-dockerclient/client.go | 340 +- .../fsouza/go-dockerclient/client_test.go | 150 +- .../fsouza/go-dockerclient/container.go | 539 ++- .../fsouza/go-dockerclient/container_test.go | 388 +- .../github.com/fsouza/go-dockerclient/env.go | 0 .../fsouza/go-dockerclient/env_test.go | 0 .../fsouza/go-dockerclient/event.go | 31 +- .../fsouza/go-dockerclient/event_test.go | 0 .../fsouza/go-dockerclient/example_test.go | 0 .../github.com/fsouza/go-dockerclient/exec.go | 151 +- .../fsouza/go-dockerclient/exec_test.go | 0 .../github.com/Sirupsen/logrus/CHANGELOG.md | 55 + .../github.com/Sirupsen/logrus/LICENSE | 21 + .../github.com/Sirupsen/logrus/README.md | 358 ++ .../github.com/Sirupsen/logrus/doc.go | 26 + .../github.com/Sirupsen/logrus/entry.go | 0 .../github.com/Sirupsen/logrus/entry_test.go | 2 +- .../github.com/Sirupsen/logrus/exported.go | 2 + .../github.com/Sirupsen/logrus/formatter.go | 48 + .../Sirupsen/logrus/formatter_bench_test.go | 98 + .../github.com/Sirupsen/logrus/hook_test.go | 122 + .../github.com/Sirupsen/logrus/hooks.go | 34 + .../Sirupsen/logrus/json_formatter.go | 41 + .../Sirupsen/logrus/json_formatter_test.go | 120 + .../github.com/Sirupsen/logrus/logger.go | 95 +- .../github.com/Sirupsen/logrus/logrus.go | 0 .../github.com/Sirupsen/logrus/logrus_test.go | 301 ++ .../Sirupsen/logrus/terminal_bsd.go | 9 + .../Sirupsen/logrus/terminal_linux.go | 2 +- .../Sirupsen/logrus/terminal_notwindows.go | 21 + .../Sirupsen/logrus/terminal_windows.go | 27 + .../Sirupsen/logrus/text_formatter.go | 161 + .../Sirupsen/logrus/text_formatter_test.go | 61 + .../github.com/Sirupsen/logrus/writer.go | 31 + .../registry/api/errcode/errors.go | 259 ++ .../registry/api/errcode/errors_test.go | 179 + .../registry/api/errcode/handler.go | 44 + .../registry/api/errcode/register.go | 128 + .../github.com/docker/docker/errors/README.md | 58 + .../docker/docker/errors/builder.go | 93 + .../github.com/docker/docker/errors/daemon.go | 925 +++++ .../github.com/docker/docker/errors/error.go | 6 + .../github.com/docker/docker/errors/image.go | 20 + .../github.com/docker/docker/errors/server.go | 36 + .../github.com/docker/docker/opts/envfile.go | 67 + .../docker/docker/opts/envfile_test.go | 142 + .../docker/docker/opts/hosts_unix.go | 8 + .../docker/docker/opts/hosts_windows.go | 6 + .../github.com/docker/docker/opts/ip.go | 42 + .../github.com/docker/docker/opts/ip_test.go | 54 + .../github.com/docker/docker/opts/opts.go | 360 ++ .../docker/docker/opts/opts_test.go | 427 +++ .../github.com/docker/docker/opts/ulimit.go | 52 + .../docker/docker/opts/ulimit_test.go | 42 + .../docker/docker/pkg/archive/README.md | 0 .../docker/docker/pkg/archive/archive.go | 432 ++- .../docker/docker/pkg/archive/archive_test.go | 12 +- .../docker/docker/pkg/archive/archive_unix.go | 31 +- .../docker/pkg/archive/archive_unix_test.go | 0 .../docker/pkg/archive/archive_windows.go | 24 +- .../pkg/archive/archive_windows_test.go | 22 + .../docker/docker/pkg/archive/changes.go | 80 +- .../docker/pkg/archive/changes_linux.go | 2 +- .../docker/pkg/archive/changes_other.go | 19 +- .../docker/pkg/archive/changes_posix_test.go | 4 +- .../docker/docker/pkg/archive/changes_test.go | 33 +- .../docker/docker/pkg/archive/changes_unix.go | 17 +- .../docker/pkg/archive/changes_windows.go | 14 +- .../docker/docker/pkg/archive/copy.go | 407 ++ .../docker/docker/pkg/archive/copy_test.go | 625 ++++ .../docker/docker/pkg/archive/copy_unix.go | 11 + .../docker/docker/pkg/archive/copy_windows.go | 9 + .../docker/docker/pkg/archive/diff.go | 264 ++ .../docker/docker/pkg/archive/diff_test.go | 0 .../docker/pkg/archive/example_changes.go | 4 +- .../docker/pkg/archive/testdata/broken.tar | Bin 0 -> 13824 bytes .../docker/docker/pkg/archive/time_linux.go | 0 .../docker/pkg/archive/time_unsupported.go | 0 .../docker/docker/pkg/archive/utils_test.go | 2 +- .../docker/docker/pkg/archive/whiteouts.go | 23 + .../docker/docker/pkg/archive/wrap.go | 0 .../docker/docker/pkg/archive/wrap_test.go | 0 .../docker/docker/pkg/fileutils/fileutils.go | 49 +- .../docker/pkg/fileutils/fileutils_test.go | 49 +- .../docker/pkg/fileutils/fileutils_unix.go | 22 + .../docker/pkg/fileutils/fileutils_windows.go | 7 + .../docker/docker/pkg/homedir/homedir.go | 39 + .../docker/docker/pkg/homedir/homedir_test.go | 24 + .../docker/docker/pkg/idtools/idtools.go | 195 + .../docker/docker/pkg/idtools/idtools_unix.go | 60 + .../docker/pkg/idtools/idtools_unix_test.go | 243 ++ .../docker/pkg/idtools/idtools_windows.go | 18 + .../docker/pkg/idtools/usergroupadd_linux.go | 155 + .../pkg/idtools/usergroupadd_unsupported.go | 12 + .../docker/docker/pkg/ioutils/bytespipe.go | 89 + .../docker/pkg/ioutils/bytespipe_test.go | 141 + .../docker/docker/pkg/ioutils/fmt.go | 8 + .../docker/docker/pkg/ioutils/fmt_test.go | 0 .../docker/docker/pkg/ioutils/multireader.go | 226 ++ .../docker/pkg/ioutils/multireader_test.go | 149 + .../docker/docker/pkg/ioutils/readers.go | 170 + .../docker/docker/pkg/ioutils/readers_test.go | 20 +- .../docker/docker/pkg/ioutils/scheduler.go | 6 + .../docker/pkg/ioutils/scheduler_gccgo.go | 13 + .../docker/docker/pkg/ioutils/temp_unix.go | 10 + .../docker/docker/pkg/ioutils/temp_windows.go | 18 + .../docker/docker/pkg/ioutils/writeflusher.go | 0 .../docker/docker/pkg/ioutils/writers.go | 0 .../docker/docker/pkg/ioutils/writers_test.go | 0 .../docker/docker/pkg/longpath/longpath.go | 26 + .../docker/pkg/longpath/longpath_test.go | 22 + .../docker/docker/pkg/mflag/LICENSE | 27 + .../docker/docker/pkg/mflag/README.md | 40 + .../docker/docker/pkg/mflag/flag.go | 1201 ++++++ .../docker/docker/pkg/mflag/flag_test.go | 516 +++ .../docker/docker/pkg/parsers/parsers.go | 259 ++ .../docker/docker/pkg/parsers/parsers_test.go | 295 ++ .../docker/docker/pkg/pools/pools.go | 16 +- .../docker/docker/pkg/pools/pools_test.go | 0 .../docker/docker/pkg/promise/promise.go | 0 .../docker/docker/pkg/stdcopy/stdcopy.go | 65 +- .../docker/docker/pkg/stdcopy/stdcopy_test.go | 261 ++ .../docker/docker/pkg/system/chtimes.go | 31 + .../docker/docker/pkg/system/chtimes_test.go | 120 + .../docker/pkg/system/chtimes_unix_test.go | 121 + .../docker/pkg/system/chtimes_windows_test.go | 114 + .../docker/docker/pkg/system/errors.go | 1 + .../docker/pkg/system/events_windows.go | 83 + .../docker/docker/pkg/system/filesys.go | 19 + .../docker/pkg/system/filesys_windows.go | 18 + .../docker/docker/pkg/system/lstat.go | 4 +- .../docker/docker/pkg/system/lstat_test.go | 0 .../docker/pkg/system/lstat_unix_test.go | 30 + .../docker/docker/pkg/system/lstat_windows.go | 8 +- .../docker/docker/pkg/system/meminfo.go | 0 .../docker/docker/pkg/system/meminfo_linux.go | 7 +- .../docker/pkg/system/meminfo_linux_test.go | 2 +- .../docker/pkg/system/meminfo_unix_test.go | 40 + .../docker/pkg/system/meminfo_unsupported.go | 1 + .../docker/pkg/system/meminfo_windows.go | 0 .../docker/docker/pkg/system/mknod.go | 6 +- .../docker/docker/pkg/system/mknod_windows.go | 2 + .../docker/docker/pkg/system/stat.go | 53 + .../docker/docker/pkg/system/stat_freebsd.go | 27 + .../docker/docker/pkg/system/stat_linux.go | 12 +- .../docker/docker/pkg/system/stat_test.go | 0 .../docker/pkg/system/stat_unix_test.go | 39 + .../docker/pkg/system/stat_unsupported.go | 17 + .../docker/docker/pkg/system/stat_windows.go | 43 + .../docker/docker/pkg/system/syscall_unix.go | 11 + .../docker/pkg/system/syscall_windows.go | 6 + .../docker/docker/pkg/system/umask.go | 2 + .../docker/docker/pkg/system/umask_windows.go | 1 + .../docker/docker/pkg/system/utimes_darwin.go | 5 +- .../docker/pkg/system/utimes_freebsd.go | 6 +- .../docker/docker/pkg/system/utimes_linux.go | 26 + .../docker/docker/pkg/system/utimes_test.go | 0 .../docker/pkg/system/utimes_unix_test.go | 68 + .../docker/pkg/system/utimes_unsupported.go | 5 +- .../docker/docker/pkg/system/xattrs_linux.go | 6 +- .../docker/pkg/system/xattrs_unsupported.go | 2 + .../docker/docker/pkg/ulimit/ulimit.go | 111 + .../docker/docker/pkg/ulimit/ulimit_test.go | 55 + .../docker/docker/pkg/units/duration.go | 4 +- .../docker/docker/pkg/units/duration_test.go | 0 .../docker/docker/pkg/units/size.go | 12 +- .../docker/docker/pkg/units/size_test.go | 0 .../github.com/docker/docker/volume/volume.go | 172 + .../docker/docker/volume/volume_test.go | 261 ++ .../docker/docker/volume/volume_unix.go | 132 + .../docker/docker/volume/volume_windows.go | 181 + .../docker}/libcontainer/user/MAINTAINERS | 0 .../docker}/libcontainer/user/lookup.go | 0 .../docker}/libcontainer/user/lookup_unix.go | 0 .../libcontainer/user/lookup_unsupported.go | 0 .../docker/libcontainer/user/user.go | 407 ++ .../docker/libcontainer/user/user_test.go | 443 +++ .../github.com/gorilla/context/LICENSE | 0 .../github.com/gorilla/context/README.md | 0 .../github.com/gorilla/context/context.go | 0 .../gorilla/context/context_test.go | 0 .../github.com/gorilla/context/doc.go | 0 .../external}/github.com/gorilla/mux/LICENSE | 0 .../external/github.com/gorilla/mux/README.md | 235 ++ .../github.com/gorilla/mux/bench_test.go | 0 .../external/github.com/gorilla/mux/doc.go | 206 + .../external/github.com/gorilla/mux/mux.go | 474 +++ .../github.com/gorilla/mux/mux_test.go | 1334 +++++++ .../github.com/gorilla/mux/old_test.go | 714 ++++ .../external/github.com/gorilla/mux/regexp.go | 317 ++ .../external}/github.com/gorilla/mux/route.go | 44 +- .../github.com/hashicorp/go-cleanhttp/LICENSE | 363 ++ .../hashicorp/go-cleanhttp/README.md | 30 + .../hashicorp/go-cleanhttp/cleanhttp.go | 28 + .../runc/libcontainer/user/MAINTAINERS | 2 + .../runc/libcontainer/user/lookup.go | 108 + .../runc/libcontainer/user/lookup_unix.go | 30 + .../libcontainer/user/lookup_unsupported.go | 21 + .../runc/libcontainer/user/user.go | 418 +++ .../runc/libcontainer/user/user_test.go | 472 +++ .../fsouza/go-dockerclient/image.go | 238 +- .../fsouza/go-dockerclient/image_test.go | 48 +- .../go-dockerclient/integration_test.go | 94 + .../github.com/fsouza/go-dockerclient/misc.go | 20 +- .../fsouza/go-dockerclient/misc_test.go | 0 .../fsouza/go-dockerclient/network.go | 143 + .../fsouza/go-dockerclient/network_test.go | 115 + .../fsouza/go-dockerclient/signal.go | 0 .../github.com/fsouza/go-dockerclient/tar.go | 4 +- .../github.com/fsouza/go-dockerclient/tls.go | 4 - .../fsouza/go-dockerclient/volume.go | 127 + .../fsouza/go-dockerclient/volume_test.go | 142 + .../github.com/gorilla/context/.travis.yml | 0 vendor/github.com/gorilla/context/LICENSE | 27 + vendor/github.com/gorilla/context/README.md | 7 + vendor/github.com/gorilla/context/context.go | 143 + .../gorilla/context/context_test.go | 0 vendor/github.com/gorilla/context/doc.go | 82 + vendor/github.com/gorilla/mux/.travis.yml | 7 + vendor/github.com/gorilla/mux/LICENSE | 27 + .../github.com/gorilla/mux/README.md | 0 vendor/github.com/gorilla/mux/bench_test.go | 21 + .../github.com/gorilla/mux/doc.go | 0 .../github.com/gorilla/mux/mux.go | 0 .../github.com/gorilla/mux/mux_test.go | 0 .../github.com/gorilla/mux/old_test.go | 0 .../github.com/gorilla/mux/regexp.go | 0 .../github.com/gorilla/mux/route.go | 0 .../github.com/guelfey/go.dbus/LICENSE | 0 .../guelfey/go.dbus/README.markdown | 0 .../github.com/guelfey/go.dbus/auth.go | 0 .../guelfey/go.dbus/auth_external.go | 0 .../github.com/guelfey/go.dbus/auth_sha1.go | 0 .../github.com/guelfey/go.dbus/call.go | 0 .../github.com/guelfey/go.dbus/conn.go | 0 .../github.com/guelfey/go.dbus/conn_darwin.go | 0 .../github.com/guelfey/go.dbus/conn_other.go | 0 .../github.com/guelfey/go.dbus/conn_test.go | 0 .../github.com/guelfey/go.dbus/dbus.go | 0 .../github.com/guelfey/go.dbus/decoder.go | 0 .../github.com/guelfey/go.dbus/doc.go | 0 .../github.com/guelfey/go.dbus/encoder.go | 0 .../guelfey/go.dbus/examples_test.go | 0 .../github.com/guelfey/go.dbus/export.go | 0 .../guelfey/go.dbus/introspect/call.go | 0 .../guelfey/go.dbus/introspect/introspect.go | 0 .../go.dbus/introspect/introspectable.go | 0 .../github.com/guelfey/go.dbus/message.go | 0 .../github.com/guelfey/go.dbus/prop/prop.go | 0 .../github.com/guelfey/go.dbus/proto_test.go | 0 .../github.com/guelfey/go.dbus/sig.go | 0 .../github.com/guelfey/go.dbus/sig_test.go | 0 .../guelfey/go.dbus/transport_darwin.go | 0 .../guelfey/go.dbus/transport_generic.go | 0 .../guelfey/go.dbus/transport_unix.go | 0 .../guelfey/go.dbus/transport_unix_test.go | 0 .../guelfey/go.dbus/transport_unixcred.go | 0 .../github.com/guelfey/go.dbus/variant.go | 0 .../guelfey/go.dbus/variant_lexer.go | 0 .../guelfey/go.dbus/variant_parser.go | 0 .../guelfey/go.dbus/variant_test.go | 0 .../github.com/j-keck/arping/.gitignore | 0 .../github.com/j-keck/arping/LICENSE | 0 .../github.com/j-keck/arping/README.md | 0 .../github.com/j-keck/arping/arp_datagram.go | 0 .../github.com/j-keck/arping/arping.go | 0 .../github.com/j-keck/arping/arping_bsd.go | 0 .../github.com/j-keck/arping/arping_linux.go | 0 .../j-keck/arping/arping_windows.go | 0 .../github.com/j-keck/arping/netutils.go | 0 .../github.com/kless/term/Doc/AUTHORS.md | 0 .../github.com/kless/term/Doc/CONTRIBUTORS.md | 0 .../github.com/kless/term/Doc/LICENSE-MPL.txt | 0 .../github.com/kless/term/Doc/NEWS.md | 0 .../github.com/kless/term/README.md | 0 .../github.com/kless/term/doc.go | 0 .../github.com/kless/term/readline/ansi.go | 0 .../github.com/kless/term/readline/buffer.go | 0 .../github.com/kless/term/readline/doc.go | 0 .../github.com/kless/term/readline/error.go | 0 .../github.com/kless/term/readline/history.go | 0 .../kless/term/readline/history_test.go | 0 .../github.com/kless/term/readline/read.go | 0 .../kless/term/readline/read_unix.go | 0 .../github.com/kless/term/sys/doc.go | 0 .../github.com/kless/term/sys/key_unix.go | 0 .../github.com/kless/term/sys/sys_bsd.go | 0 .../github.com/kless/term/sys/sys_linux.go | 0 .../github.com/kless/term/sys/sys_unix.go | 0 .../kless/term/sys/z-sys_darwin_386.go | 0 .../kless/term/sys/z-sys_darwin_amd64.go | 0 .../kless/term/sys/z-sys_freebsd.go | 0 .../github.com/kless/term/sys/z-sys_linux.go | 0 .../github.com/kless/term/sys/z-sys_netbsd.go | 0 .../kless/term/sys/z-sys_openbsd.go | 0 .../github.com/kless/term/term.go | 0 .../github.com/kless/term/term_unix.go | 0 .../github.com/kless/term/test/runtest.go | 0 .../github.com/kless/term/unix_test.go | 0 .../github.com/kless/term/util_unix.go | 0 .../github.com/opencontainers/runc/.gitignore | 4 + .../opencontainers/runc/CONTRIBUTING.md | 117 + vendor/github.com/opencontainers/runc/LICENSE | 191 + .../opencontainers/runc/MAINTAINERS | 6 + .../opencontainers/runc/MAINTAINERS_GUIDE.md | 120 + .../github.com/opencontainers/runc/Makefile | 35 + vendor/github.com/opencontainers/runc/NOTICE | 17 + .../opencontainers/runc/PRINCIPLES.md | 19 + .../github.com/opencontainers/runc/README.md | 239 ++ .../opencontainers/runc/checkpoint.go | 66 + .../github.com/opencontainers/runc/events.go | 95 + .../runc/libcontainer/README.md | 152 + .../opencontainers/runc/libcontainer/SPEC.md | 334 ++ .../runc/libcontainer/capabilities_linux.go | 91 + .../runc/libcontainer/cgroups/cgroups.go | 0 .../runc/libcontainer/cgroups/cgroups_test.go | 0 .../cgroups/cgroups_unsupported.go | 0 .../runc/libcontainer/cgroups/fs/apply_raw.go | 0 .../runc/libcontainer/cgroups/fs/blkio.go | 0 .../libcontainer/cgroups/fs/blkio_test.go | 0 .../runc/libcontainer/cgroups/fs/cpu.go | 0 .../runc/libcontainer/cgroups/fs/cpu_test.go | 0 .../runc/libcontainer/cgroups/fs/cpuacct.go | 0 .../runc/libcontainer/cgroups/fs/cpuset.go | 0 .../libcontainer/cgroups/fs/cpuset_test.go | 0 .../runc/libcontainer/cgroups/fs/devices.go | 0 .../libcontainer/cgroups/fs/devices_test.go | 0 .../runc/libcontainer/cgroups/fs/freezer.go | 0 .../libcontainer/cgroups/fs/freezer_test.go | 0 .../libcontainer/cgroups/fs/fs_unsupported.go | 0 .../runc/libcontainer/cgroups/fs/hugetlb.go | 0 .../libcontainer/cgroups/fs/hugetlb_test.go | 0 .../runc/libcontainer/cgroups/fs/memory.go | 0 .../libcontainer/cgroups/fs/memory_test.go | 0 .../runc/libcontainer/cgroups/fs/net_cls.go | 0 .../libcontainer/cgroups/fs/net_cls_test.go | 0 .../runc/libcontainer/cgroups/fs/net_prio.go | 0 .../libcontainer/cgroups/fs/net_prio_test.go | 0 .../libcontainer/cgroups/fs/perf_event.go | 0 .../cgroups/fs/stats_util_test.go | 0 .../runc/libcontainer/cgroups/fs/util_test.go | 0 .../runc/libcontainer/cgroups/fs/utils.go | 0 .../libcontainer/cgroups/fs/utils_test.go | 0 .../runc/libcontainer/cgroups/stats.go | 0 .../cgroups/systemd/apply_nosystemd.go | 0 .../cgroups/systemd/apply_systemd.go | 0 .../runc/libcontainer/cgroups/utils.go | 0 .../runc/libcontainer/configs/cgroup.go | 0 .../runc/libcontainer/configs/config.go | 0 .../runc/libcontainer/configs/config_test.go | 0 .../runc/libcontainer/configs/config_unix.go | 0 .../runc/libcontainer/configs/device.go | 0 .../libcontainer/configs/device_defaults.go | 0 .../libcontainer/configs/hugepage_limit.go | 0 .../configs/interface_priority_map.go | 0 .../runc/libcontainer/configs/mount.go | 0 .../runc/libcontainer/configs/namespaces.go | 0 .../configs/namespaces_syscall.go | 0 .../configs/namespaces_syscall_unsupported.go | 0 .../libcontainer/configs/namespaces_unix.go | 0 .../configs/namespaces_windows.go | 0 .../runc/libcontainer/configs/network.go | 0 .../libcontainer/configs/validate/config.go | 0 .../runc/libcontainer/console.go | 15 + .../runc/libcontainer/console_freebsd.go | 13 + .../runc/libcontainer/console_linux.go | 145 + .../runc/libcontainer/console_windows.go | 30 + .../runc/libcontainer/container.go | 162 + .../runc/libcontainer/container_linux.go | 813 ++++ .../runc/libcontainer/container_linux_test.go | 212 ++ .../libcontainer/container_nouserns_linux.go | 13 + .../libcontainer/container_userns_linux.go | 26 + .../runc/libcontainer/criu_opts.go | 17 + .../opencontainers/runc/libcontainer/error.go | 62 + .../runc/libcontainer/error_test.go | 20 + .../runc/libcontainer/factory.go | 45 + .../runc/libcontainer/factory_linux.go | 269 ++ .../runc/libcontainer/factory_linux_test.go | 179 + .../runc/libcontainer/generic_error.go | 74 + .../runc/libcontainer/generic_error_test.go | 14 + .../runc/libcontainer/init_linux.go | 330 ++ .../runc/libcontainer/network_linux.go | 248 ++ .../runc/libcontainer/notify_linux.go | 63 + .../runc/libcontainer/notify_linux_test.go | 96 + .../runc/libcontainer/nsenter/README.md | 0 .../runc/libcontainer/nsenter/nsenter.go | 0 .../libcontainer/nsenter/nsenter_gccgo.go | 0 .../runc/libcontainer/nsenter/nsenter_test.go | 0 .../nsenter/nsenter_unsupported.go | 0 .../runc/libcontainer/nsenter/nsexec.c | 0 .../runc/libcontainer/process.go | 89 + .../runc/libcontainer/process_linux.go | 303 ++ .../runc/libcontainer/restored_process.go | 118 + .../runc/libcontainer/rootfs_linux.go | 516 +++ .../runc/libcontainer/rootfs_linux_test.go | 37 + .../runc/libcontainer/setns_init_linux.go | 35 + .../runc/libcontainer/standard_init_linux.go | 106 + .../opencontainers/runc/libcontainer/stats.go | 15 + .../runc/libcontainer/stats_freebsd.go | 5 + .../runc/libcontainer/stats_linux.go | 8 + .../runc/libcontainer/stats_windows.go | 5 + .../runc/libcontainer/system/linux.go | 0 .../runc/libcontainer/system/proc.go | 0 .../runc/libcontainer/system/setns_linux.go | 0 .../libcontainer/system/syscall_linux_386.go | 0 .../libcontainer/system/syscall_linux_64.go | 0 .../libcontainer/system/syscall_linux_arm.go | 0 .../runc/libcontainer/system/sysconfig.go | 0 .../libcontainer/system/sysconfig_notcgo.go | 0 .../runc/libcontainer/system/xattrs_linux.go | 0 .../runc/libcontainer/user/MAINTAINERS | 2 + .../runc/libcontainer/user/lookup.go | 108 + .../runc/libcontainer/user/lookup_unix.go | 30 + .../libcontainer/user/lookup_unsupported.go | 21 + .../runc/libcontainer/user/user.go | 0 .../runc/libcontainer/user/user_test.go | 0 vendor/github.com/opencontainers/runc/main.go | 72 + .../opencontainers/runc/main_unix.go | 5 + .../opencontainers/runc/main_unsupported.go | 23 + .../github.com/opencontainers/runc/restore.go | 134 + vendor/github.com/opencontainers/runc/run.go | 108 + .../github.com/opencontainers/runc/signals.go | 113 + vendor/github.com/opencontainers/runc/spec.go | 411 ++ vendor/github.com/opencontainers/runc/tty.go | 99 + .../github.com/opencontainers/runc/utils.go | 177 + .../rancher/docker-from-scratch/.dockerignore | 0 .../rancher/docker-from-scratch/.drone.yml | 0 .../rancher/docker-from-scratch/.gitignore | 0 .../docker-from-scratch/.wrap-docker-args | 0 .../rancher/docker-from-scratch/Dockerfile | 0 .../docker-from-scratch/Dockerfile.wrap | 0 .../rancher/docker-from-scratch/LICENSE | 0 .../rancher/docker-from-scratch/README.md | 0 .../rancher/docker-from-scratch/build.sh | 0 .../rancher/docker-from-scratch/glide.yaml | 34 + .../rancher/docker-from-scratch/scratch.go | 0 .../rancher/docker-from-scratch/util/util.go | 0 .../docker-from-scratch/util/util_linux.go | 0 .../docker-from-scratch/util/util_test.go | 0 .../github.com/rancher/netconf/LICENSE | 0 .../github.com/rancher/netconf/README.md | 0 .../rancher/netconf/ipv4ll_linux.go | 0 .../rancher/netconf/netconf_linux.go | 0 .../github.com/rancher/netconf/types.go | 0 .../github.com/ryanuber/go-glob/.travis.yml | 0 .../github.com/ryanuber/go-glob/LICENSE | 0 .../github.com/ryanuber/go-glob/README.md | 0 .../github.com/ryanuber/go-glob/glob.go | 0 .../github.com/ryanuber/go-glob/glob_test.go | 0 .../github.com/stretchr/testify}/.gitignore | 2 + .../github.com/stretchr/testify/.travis.yml | 11 + .../github.com/stretchr/testify/LICENCE.txt | 9 + vendor/github.com/stretchr/testify/README.md | 332 ++ .../stretchr/testify/assert/assertions.go | 0 .../testify/assert/assertions_test.go | 0 .../github.com/stretchr/testify/assert/doc.go | 0 .../stretchr/testify/assert/errors.go | 0 .../testify/assert/forward_assertions.go | 0 .../testify/assert/forward_assertions_test.go | 0 .../testify/assert/http_assertions.go | 0 .../testify/assert/http_assertions_test.go | 0 vendor/github.com/stretchr/testify/doc.go | 22 + .../stretchr/testify/package_test.go | 12 + .../stretchr/testify/require/doc.go | 0 .../testify/require/forward_requirements.go | 0 .../require/forward_requirements_test.go | 0 .../stretchr/testify/require/requirements.go | 0 .../testify/require/requirements_test.go | 0 .../vishvananda/netlink/.travis.yml | 0 .../github.com/vishvananda/netlink/LICENSE | 0 .../github.com/vishvananda/netlink/Makefile | 0 .../github.com/vishvananda/netlink/README.md | 0 .../github.com/vishvananda/netlink/addr.go | 0 .../vishvananda/netlink/addr_linux.go | 0 .../vishvananda/netlink/addr_test.go | 0 .../github.com/vishvananda/netlink/link.go | 0 .../vishvananda/netlink/link_linux.go | 0 .../vishvananda/netlink/link_test.go | 0 .../github.com/vishvananda/netlink/neigh.go | 0 .../vishvananda/netlink/neigh_linux.go | 0 .../vishvananda/netlink/neigh_test.go | 0 .../github.com/vishvananda/netlink/netlink.go | 0 .../vishvananda/netlink/netlink_test.go | 0 .../netlink/netlink_unspecified.go | 0 .../vishvananda/netlink/nl/addr_linux.go | 0 .../vishvananda/netlink/nl/addr_linux_test.go | 0 .../vishvananda/netlink/nl/link_linux.go | 0 .../vishvananda/netlink/nl/nl_linux.go | 0 .../vishvananda/netlink/nl/nl_linux_test.go | 0 .../vishvananda/netlink/nl/route_linux.go | 0 .../netlink/nl/route_linux_test.go | 0 .../vishvananda/netlink/nl/xfrm_linux.go | 0 .../vishvananda/netlink/nl/xfrm_linux_test.go | 0 .../netlink/nl/xfrm_policy_linux.go | 0 .../netlink/nl/xfrm_policy_linux_test.go | 0 .../netlink/nl/xfrm_state_linux.go | 0 .../netlink/nl/xfrm_state_linux_test.go | 0 .../vishvananda/netlink/protinfo.go | 0 .../vishvananda/netlink/protinfo_linux.go | 0 .../vishvananda/netlink/protinfo_test.go | 0 .../github.com/vishvananda/netlink/route.go | 0 .../vishvananda/netlink/route_linux.go | 0 .../vishvananda/netlink/route_test.go | 0 .../github.com/vishvananda/netlink/xfrm.go | 0 .../vishvananda/netlink/xfrm_policy.go | 0 .../vishvananda/netlink/xfrm_policy_linux.go | 0 .../vishvananda/netlink/xfrm_policy_test.go | 0 .../vishvananda/netlink/xfrm_state.go | 0 .../vishvananda/netlink/xfrm_state_linux.go | 0 .../vishvananda/netlink/xfrm_state_test.go | 0 vendor/golang.org/x/crypto/.gitattributes | 10 + vendor/golang.org/x/crypto/.gitignore | 2 + vendor/golang.org/x/crypto/AUTHORS | 3 + vendor/golang.org/x/crypto/CONTRIBUTING.md | 31 + vendor/golang.org/x/crypto/CONTRIBUTORS | 3 + vendor/golang.org/x/crypto/LICENSE | 27 + vendor/golang.org/x/crypto/PATENTS | 22 + vendor/golang.org/x/crypto/README | 3 + vendor/golang.org/x/crypto/codereview.cfg | 1 + .../golang.org/x/crypto/ssh/benchmark_test.go | 122 + vendor/golang.org/x/crypto/ssh/buffer.go | 98 + vendor/golang.org/x/crypto/ssh/buffer_test.go | 87 + vendor/golang.org/x/crypto/ssh/certs.go | 501 +++ vendor/golang.org/x/crypto/ssh/certs_test.go | 216 ++ vendor/golang.org/x/crypto/ssh/channel.go | 631 ++++ vendor/golang.org/x/crypto/ssh/cipher.go | 549 +++ vendor/golang.org/x/crypto/ssh/cipher_test.go | 127 + vendor/golang.org/x/crypto/ssh/client.go | 213 ++ vendor/golang.org/x/crypto/ssh/client_auth.go | 441 +++ .../x/crypto/ssh/client_auth_test.go | 393 ++ vendor/golang.org/x/crypto/ssh/client_test.go | 39 + vendor/golang.org/x/crypto/ssh/common.go | 365 ++ vendor/golang.org/x/crypto/ssh/connection.go | 144 + vendor/golang.org/x/crypto/ssh/doc.go | 18 + .../golang.org/x/crypto/ssh/example_test.go | 211 ++ vendor/golang.org/x/crypto/ssh/handshake.go | 404 ++ .../golang.org/x/crypto/ssh/handshake_test.go | 316 ++ vendor/golang.org/x/crypto/ssh/kex.go | 386 ++ vendor/golang.org/x/crypto/ssh/kex_test.go | 48 + vendor/golang.org/x/crypto/ssh/keys.go | 628 ++++ vendor/golang.org/x/crypto/ssh/keys_test.go | 306 ++ vendor/golang.org/x/crypto/ssh/mac.go | 57 + .../golang.org/x/crypto/ssh/mempipe_test.go | 110 + vendor/golang.org/x/crypto/ssh/messages.go | 725 ++++ .../golang.org/x/crypto/ssh/messages_test.go | 254 ++ vendor/golang.org/x/crypto/ssh/mux.go | 356 ++ vendor/golang.org/x/crypto/ssh/mux_test.go | 525 +++ vendor/golang.org/x/crypto/ssh/server.go | 493 +++ vendor/golang.org/x/crypto/ssh/session.go | 605 +++ .../golang.org/x/crypto/ssh/session_test.go | 774 ++++ vendor/golang.org/x/crypto/ssh/tcpip.go | 404 ++ vendor/golang.org/x/crypto/ssh/tcpip_test.go | 20 + .../x/crypto/ssh/terminal/terminal.go | 0 .../x/crypto/ssh/terminal/terminal_test.go | 0 .../golang.org/x/crypto/ssh/terminal/util.go | 2 +- .../x/crypto/ssh/terminal/util_bsd.go | 0 .../x/crypto/ssh/terminal/util_linux.go | 0 .../x/crypto/ssh/terminal/util_windows.go | 0 .../golang.org/x/crypto/ssh/testdata_test.go | 63 + vendor/golang.org/x/crypto/ssh/transport.go | 332 ++ .../golang.org/x/crypto/ssh/transport_test.go | 109 + vendor/golang.org/x/net/.gitattributes | 10 + vendor/golang.org/x/net/.gitignore | 2 + vendor/golang.org/x/net/AUTHORS | 3 + vendor/golang.org/x/net/CONTRIBUTING.md | 31 + vendor/golang.org/x/net/CONTRIBUTORS | 3 + vendor/golang.org/x/net/LICENSE | 27 + vendor/golang.org/x/net/PATENTS | 22 + vendor/golang.org/x/net/README | 3 + vendor/golang.org/x/net/codereview.cfg | 1 + .../golang.org/x/net/context/context.go | 2 +- .../golang.org/x/net/context/context_test.go | 0 .../x/net/context/withtimeout_test.go | 26 + vendor/google.golang.org/cloud/.travis.yml | 10 + vendor/google.golang.org/cloud/AUTHORS | 12 + .../google.golang.org/cloud/CONTRIBUTING.md | 66 + vendor/google.golang.org/cloud/CONTRIBUTORS | 22 + vendor/google.golang.org/cloud/LICENSE | 202 + vendor/google.golang.org/cloud/README.md | 130 + vendor/google.golang.org/cloud/cloud.go | 49 + vendor/google.golang.org/cloud/cloud_test.go | 36 + .../cloud/compute/metadata/go13.go | 0 .../cloud/compute/metadata/metadata.go | 0 .../google.golang.org/cloud/internal/cloud.go | 0 .../internal/datastore/datastore_v1.pb.go | 0 .../internal/datastore/datastore_v1.proto | 0 .../cloud/internal/testutil/context.go | 0 vendor/google.golang.org/cloud/key.json.enc | Bin 0 -> 1248 bytes 2232 files changed, 154499 insertions(+), 9037 deletions(-) delete mode 100644 Godeps/Godeps.json delete mode 100644 Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/airbrake/airbrake.go delete mode 100644 Godeps/_workspace/src/github.com/Sirupsen/logrus/text_formatter.go delete mode 100644 Godeps/_workspace/src/github.com/Sirupsen/logrus/text_formatter_test.go delete mode 100644 Godeps/_workspace/src/github.com/docker/distribution/Godeps/Readme delete mode 100644 Godeps/_workspace/src/github.com/docker/docker/autogen/dockerversion/dockerversion.go delete mode 100644 Godeps/_workspace/src/github.com/docker/libcompose/docker/container.go delete mode 100644 Godeps/_workspace/src/github.com/docker/libcompose/docker/convert.go delete mode 100644 Godeps/_workspace/src/github.com/docker/libcompose/docker/functions.go delete mode 100644 Godeps/_workspace/src/github.com/docker/libcompose/docker/labels.go delete mode 100644 Godeps/_workspace/src/github.com/docker/libcompose/logger/null.go delete mode 100644 Godeps/_workspace/src/github.com/docker/libcompose/logger/types.go delete mode 100644 Godeps/_workspace/src/github.com/docker/libcompose/project/empty.go delete mode 100644 Godeps/_workspace/src/github.com/docker/libcompose/project/listener.go delete mode 100644 Godeps/_workspace/src/github.com/docker/libcompose/project/project_test.go delete mode 100644 Godeps/_workspace/src/github.com/docker/libcompose/project/types.go delete mode 100644 Godeps/_workspace/src/github.com/docker/libcompose/project/types_yaml.go delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/.dockerignore delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/.travis.yml delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/Dockerfile.1_3 delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/Dockerfile.1_4 delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/Makefile delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/codeship-services.yml delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/codeship-steps.yml delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/bin/fmtpolice delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/.dockerignore delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/Dockerfile delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/barfile delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/ca.pem delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/cert.pem delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/dockerfile.tar delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/foofile delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/key.pem delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/server.pem delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/serverkey.pem delete mode 120000 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/symlink delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/server.go delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/server_test.go delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/CHANGELOG.md delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/terminal_freebsd.go delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/archive/diff.go delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/ioutils/readers.go delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/stdcopy/stdcopy_test.go delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/filesys.go delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/stat.go delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/stat_unsupported.go delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/stat_windows.go delete mode 100644 Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/utimes_linux.go delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/README.md delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/auth.go delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/auth_test.go delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/dockerclient.go delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/dockerclient_test.go delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/engine_mock_test.go delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/example_responses.go delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/examples/events.go delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/examples/stats/stats.go delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/interface.go delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/mockclient/mock.go delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/mockclient/mock_test.go delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/types.go delete mode 100644 Godeps/_workspace/src/github.com/samalba/dockerclient/utils.go rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/.gitignore (100%) rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/.travis.yml (100%) create mode 100644 vendor/github.com/Sirupsen/logrus/CHANGELOG.md rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/LICENSE (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor}/github.com/Sirupsen/logrus/README.md (95%) create mode 100644 vendor/github.com/Sirupsen/logrus/doc.go create mode 100644 vendor/github.com/Sirupsen/logrus/entry.go create mode 100644 vendor/github.com/Sirupsen/logrus/entry_test.go rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/examples/basic/basic.go (76%) rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/examples/hook/hook.go (70%) create mode 100644 vendor/github.com/Sirupsen/logrus/exported.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor}/github.com/Sirupsen/logrus/formatter.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor}/github.com/Sirupsen/logrus/formatter_bench_test.go (90%) create mode 100644 vendor/github.com/Sirupsen/logrus/formatters/logstash/logstash.go create mode 100644 vendor/github.com/Sirupsen/logrus/formatters/logstash/logstash_test.go rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/hook_test.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor}/github.com/Sirupsen/logrus/hooks.go (87%) create mode 100644 vendor/github.com/Sirupsen/logrus/hooks/airbrake/airbrake.go create mode 100644 vendor/github.com/Sirupsen/logrus/hooks/airbrake/airbrake_test.go create mode 100644 vendor/github.com/Sirupsen/logrus/hooks/bugsnag/bugsnag.go create mode 100644 vendor/github.com/Sirupsen/logrus/hooks/bugsnag/bugsnag_test.go rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/hooks/papertrail/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/hooks/papertrail/papertrail.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/hooks/papertrail/papertrail_test.go (100%) create mode 100644 vendor/github.com/Sirupsen/logrus/hooks/sentry/README.md create mode 100644 vendor/github.com/Sirupsen/logrus/hooks/sentry/sentry.go create mode 100644 vendor/github.com/Sirupsen/logrus/hooks/sentry/sentry_test.go rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/hooks/syslog/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/hooks/syslog/syslog.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor}/github.com/Sirupsen/logrus/json_formatter.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor}/github.com/Sirupsen/logrus/json_formatter_test.go (100%) create mode 100644 vendor/github.com/Sirupsen/logrus/logger.go create mode 100644 vendor/github.com/Sirupsen/logrus/logrus.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor}/github.com/Sirupsen/logrus/logrus_test.go (98%) rename Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_openbsd.go => vendor/github.com/Sirupsen/logrus/terminal_bsd.go (68%) rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/terminal_linux.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor}/github.com/Sirupsen/logrus/terminal_notwindows.go (90%) rename {Godeps/_workspace/src => vendor}/github.com/Sirupsen/logrus/terminal_windows.go (100%) create mode 100644 vendor/github.com/Sirupsen/logrus/text_formatter.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor}/github.com/Sirupsen/logrus/text_formatter_test.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor}/github.com/Sirupsen/logrus/writer.go (100%) create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/.gitignore create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/.travis.yml create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/LICENSE create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/README.md create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/api.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/candiedyaml_suite_test.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/decode.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/decode_test.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/emitter.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/encode.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/encode_test.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/libyaml-LICENSE create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/parser.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/parser_test.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/reader.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/reader_test.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/resolver.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/resolver_test.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/run_parser.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/scanner.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/scanner_test.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/tags.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/writer.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/yaml_definesh.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/yaml_privateh.go create mode 100644 vendor/github.com/cloudfoundry-incubator/candiedyaml/yamlh.go rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/.travis.yml (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/LICENSE (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/app.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/app_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/autocomplete/bash_autocomplete (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/autocomplete/zsh_autocomplete (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/cli.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/cli_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/command.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/command_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/context.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/context_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/flag.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/flag_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/help.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/codegangsta/cli/helpers_test.go (100%) create mode 100644 vendor/github.com/coreos/coreos-cloudinit/.gitignore create mode 100644 vendor/github.com/coreos/coreos-cloudinit/.travis.yml create mode 100644 vendor/github.com/coreos/coreos-cloudinit/CONTRIBUTING.md create mode 100644 vendor/github.com/coreos/coreos-cloudinit/DCO rename {Godeps/_workspace/src/github.com/docker/distribution => vendor/github.com/coreos/coreos-cloudinit}/LICENSE (100%) create mode 100644 vendor/github.com/coreos/coreos-cloudinit/MAINTAINERS create mode 100644 vendor/github.com/coreos/coreos-cloudinit/NOTICE create mode 100644 vendor/github.com/coreos/coreos-cloudinit/README.md create mode 100755 vendor/github.com/coreos/coreos-cloudinit/build rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/config.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/config_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/decode.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/etc_hosts.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/etcd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/file.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/file_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/flannel.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/fleet.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/locksmith.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/oem.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/script.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/unit.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/unit_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/update.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/update_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/user.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/validate/context.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/validate/context_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/validate/node.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/validate/node_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/validate/report.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/validate/report_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/validate/rules.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/validate/rules_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/validate/validate.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/config/validate/validate_test.go (100%) create mode 100644 vendor/github.com/coreos/coreos-cloudinit/coreos-cloudinit.go create mode 100644 vendor/github.com/coreos/coreos-cloudinit/coreos-cloudinit_test.go create mode 100755 vendor/github.com/coreos/coreos-cloudinit/cover rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/configdrive/configdrive.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/configdrive/configdrive_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/datasource.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/file/file.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/metadata/cloudsigma/server_context.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/metadata/cloudsigma/server_context_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/metadata/digitalocean/metadata.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/metadata/digitalocean/metadata_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/metadata/ec2/metadata.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/metadata/ec2/metadata_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/metadata/metadata.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/metadata/metadata_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/metadata/test/test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/proc_cmdline/proc_cmdline.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/proc_cmdline/proc_cmdline_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/test/filesystem.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/test/filesystem_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/url/url.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/waagent/waagent.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/datasource/waagent/waagent_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/initialize/config.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/initialize/config_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/initialize/env.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/initialize/env_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/initialize/github.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/initialize/ssh_keys.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/initialize/ssh_keys_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/initialize/user_data.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/initialize/user_data_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/initialize/workspace.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/network/debian.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/network/debian_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/network/digitalocean.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/network/digitalocean_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/network/interface.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/network/interface_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/network/stanza.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/network/stanza_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/pkg/http_client.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/pkg/http_client_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/env.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/env_file.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/env_file_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/env_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/etc_hosts.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/etc_hosts_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/etcd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/etcd_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/file.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/file_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/flannel.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/flannel_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/fleet.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/fleet_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/locksmith.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/locksmith_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/networkd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/oem.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/oem_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/ssh_key.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/systemd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/systemd_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/unit.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/unit_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/update.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/update_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/coreos-cloudinit/system/user.go (100%) create mode 100755 vendor/github.com/coreos/coreos-cloudinit/test create mode 100644 vendor/github.com/coreos/go-systemd/.travis.yml create mode 100644 vendor/github.com/coreos/go-systemd/LICENSE create mode 100644 vendor/github.com/coreos/go-systemd/README.md rename {Godeps/_workspace/src => vendor}/github.com/coreos/go-systemd/dbus/dbus.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/go-systemd/dbus/dbus_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/go-systemd/dbus/methods.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/go-systemd/dbus/methods_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/go-systemd/dbus/properties.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/go-systemd/dbus/set.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/go-systemd/dbus/set_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/go-systemd/dbus/subscription.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/go-systemd/dbus/subscription_set.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/go-systemd/dbus/subscription_set_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/go-systemd/dbus/subscription_test.go (100%) create mode 100755 vendor/github.com/coreos/go-systemd/test rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/LICENSE (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/LICENSE.libyaml (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/apic.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/decode.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/decode_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/emitterc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/encode.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/encode_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/parserc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/readerc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/resolve.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/scannerc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/sorter.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/suite_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/writerc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/yaml.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/yamlh.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/coreos/yaml/yamlprivateh.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/.drone.yml (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/.gitignore (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/.mailmap (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/AUTHORS (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/CONTRIBUTING.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/Dockerfile (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/Godeps/Godeps.json (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/Readme (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/.gitignore (100%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/attempt.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/attempt_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/aws.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/aws_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/client.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/export_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/regions.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/retry.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/retry_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/sign.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/sign_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/cloudfront.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/cloudfront_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/testdata/key.pub create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/export_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/lifecycle.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/lifecycle_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/multi.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/multi_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/responses_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3i_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3t_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3test/server.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/sign.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/sign_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/.gitignore create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/.travis.yml rename Godeps/_workspace/src/github.com/flynn/go-shlex/COPYING => vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/LICENSE (100%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/storage/blob.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/storage/blob_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/storage/client.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/storage/client_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/storage/queue.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/storage/queue_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/storage/util.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Azure/azure-sdk-for-go/storage/util_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/.gitignore create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/.travis.yml create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/CHANGELOG.md rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/Sirupsen/logrus/LICENSE (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/README.md (74%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/entry.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/entry_test.go (100%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/examples/basic/basic.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/examples/hook/hook.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/Sirupsen/logrus/exported.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/formatter.go (95%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/formatter_bench_test.go (100%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/formatters/logstash/logstash.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/formatters/logstash/logstash_test.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/Sirupsen/logrus/hook_test.go (96%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/hooks.go (100%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/airbrake/airbrake.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/airbrake/airbrake_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/bugsnag/bugsnag.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/bugsnag/bugsnag_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/papertrail.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/papertrail_test.go rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/hooks/sentry/README.md (98%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/hooks/sentry/sentry.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/hooks/sentry/sentry_test.go (100%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/syslog.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/json_formatter.go (50%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/json_formatter_test.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/Sirupsen/logrus/logger.go (98%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/logrus.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/logrus_test.go (96%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/terminal_darwin.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/terminal_freebsd.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/Sirupsen/logrus/terminal_linux.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/terminal_notwindows.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/Sirupsen/logrus/terminal_openbsd.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/Sirupsen/logrus/terminal_windows.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/Sirupsen/logrus/text_formatter.go (95%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/Sirupsen/logrus/text_formatter_test.go rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/Sirupsen/logrus/writer.go (91%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/.travis.yml create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/LICENSE.txt create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/appengine.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/bugsnag.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/bugsnag_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/configuration.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/configuration_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/doc.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/errors/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/errors/error.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/errors/error_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/errors/parse_panic.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/errors/parse_panic_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/errors/stackframe.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/event.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/json_tags.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/metadata.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/metadata_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/middleware.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/middleware_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/notifier.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/panicwrap.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/panicwrap_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/payload.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/bugsnag-go/revel/bugsnagrevel.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/osext/LICENSE create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/osext/osext.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/osext/osext_plan9.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/osext/osext_procfs.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/osext/osext_sysctl.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/osext/osext_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/osext/osext_windows.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/panicwrap/LICENSE create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/panicwrap/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/panicwrap/monitor.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/panicwrap/monitor_windows.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/panicwrap/panicwrap.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/bugsnag/panicwrap/panicwrap_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/.travis.yml create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/LICENSE create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/app.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/autocomplete/bash_autocomplete create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/autocomplete/zsh_autocomplete create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/cli.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/cli_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/command.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/command_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/context.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/context_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/flag.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/flag_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/help.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/codegangsta/cli/helpers_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/oss/client.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/oss/client_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/oss/config_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/oss/export.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/oss/multi.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/oss/multi_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/oss/regions.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/oss/signature.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/util/attempt.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/util/attempt_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/util/encoding.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/util/encoding_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/util/iso6801.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/util/iso6801_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/util/signature.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/util/signature_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/util/util.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/denverdino/aliyungo/util/util_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/docker/docker/pkg/tarsum/builder_context.go rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/builder_context_test.go (100%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/docker/docker/pkg/tarsum/fileinfosums.go rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/fileinfosums_test.go (100%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/docker/docker/pkg/tarsum/tarsum.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/docker/docker/pkg/tarsum/tarsum_spec.md rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/tarsum_test.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/46af0962ab5afeb5ce6740d4d91652e69206fc991fd5328c1a94d364ad00e457/json (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/46af0962ab5afeb5ce6740d4d91652e69206fc991fd5328c1a94d364ad00e457/layer.tar (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158/json (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158/layer.tar (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/collision/collision-0.tar (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/collision/collision-1.tar (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/collision/collision-2.tar (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/collision/collision-3.tar (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/xattr/json (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/testdata/xattr/layer.tar (100%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/docker/docker/pkg/tarsum/versioning.go rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/versioning_test.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/docker/pkg/tarsum/writercloser.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/CONTRIBUTING.md (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/LICENSE (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/MAINTAINERS (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/README.md (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/certificates.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/certificates_test.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/doc.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/ec_key.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/ec_key_test.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/filter.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/filter_test.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/hash.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/jsonsign.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/jsonsign_test.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/key.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/key_files.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/key_files_test.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/key_manager.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/key_test.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/rsa_key.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/rsa_key_test.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/testutil/certificates.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/tlsdemo/README.md (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/tlsdemo/client.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/tlsdemo/gencert.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/tlsdemo/genkeys.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/tlsdemo/server.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/trustgraph/graph.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/trustgraph/memory_graph.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/trustgraph/memory_graph_test.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/trustgraph/statement.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/github.com/docker/libtrust/trustgraph/statement_test.go (100%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/docker/libtrust/util.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/docker/libtrust/util_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/internal/commandinfo.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/internal/redistest/testdb.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/conn.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/conn_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/doc.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/log.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/pool.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/pool_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/pubsub.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/pubsub_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/redis.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/reply.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/reply_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/scan.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/scan_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/script.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/script_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/test_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/garyburd/redigo/redis/zpop_example_test.go rename {Godeps/_workspace/src/github.com/gorilla/mux => vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/gorilla/context}/.travis.yml (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/gorilla/context/LICENSE (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/gorilla/context/README.md (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/gorilla/context/context.go (100%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/gorilla/context/context_test.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/gorilla/context/doc.go (100%) rename {Godeps/_workspace/src/gopkg.in/yaml.v2 => vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/gorilla/handlers}/.travis.yml (58%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/gorilla/handlers/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/gorilla/handlers/compress.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/gorilla/handlers/compress_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/gorilla/handlers/handlers.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/gorilla/handlers/handlers_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/gorilla/mux/.travis.yml rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/gorilla/mux/LICENSE (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/gorilla/mux/README.md (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/gorilla/mux/bench_test.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/gorilla/mux/doc.go (96%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/gorilla/mux/mux.go (95%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/gorilla/mux/mux_test.go (92%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/gorilla/mux/old_test.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/docker/distribution/Godeps/_workspace/src}/github.com/gorilla/mux/regexp.go (98%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/gorilla/mux/route.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/mitchellh/mapstructure/.travis.yml create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/mitchellh/mapstructure/LICENSE create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/mitchellh/mapstructure/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/mitchellh/mapstructure/decode_hooks.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/mitchellh/mapstructure/decode_hooks_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/mitchellh/mapstructure/error.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/mitchellh/mapstructure/mapstructure.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/mitchellh/mapstructure/mapstructure_benchmark_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/mitchellh/mapstructure/mapstructure_bugs_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/mitchellh/mapstructure/mapstructure_examples_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/mitchellh/mapstructure/mapstructure_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/.gitignore create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/.travis.yml create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/COPYING create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/auth.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/auth_v3.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/compatibility_1_0.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/compatibility_1_1.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/doc.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/example_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/meta.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/meta_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/notes.txt create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/rs/rs.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/rs/rs_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/swift.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/swift_internal_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/swift_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/swifttest/server.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/timeout_reader.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/timeout_reader_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/watchdog_reader.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/ncw/swift/watchdog_reader_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/noahdesu/go-ceph/rados/conn.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/noahdesu/go-ceph/rados/doc.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/noahdesu/go-ceph/rados/ioctx.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/noahdesu/go-ceph/rados/rados.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/noahdesu/go-ceph/rados/rados_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/.gitignore create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/LICENSE create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/resumable.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha256/resume.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha256/sha256.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha256/sha256_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha256/sha256block.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha256/sha256block_386.s create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha256/sha256block_amd64.s create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha256/sha256block_decl.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha256/sha256resume_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha512/resume.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha512/sha512.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha512/sha512_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha512/sha512block.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha512/sha512block_amd64.s create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha512/sha512block_decl.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/stevvooe/resumable/sha512/sha512resume_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/.gitignore create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/LICENSE create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/cmd/metrics-bench/metrics-bench.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/cmd/metrics-example/metrics-example.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/cmd/never-read/never-read.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/counter.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/counter_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/debug.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/debug_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/ewma.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/ewma_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/gauge.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/gauge_float64.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/gauge_float64_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/gauge_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/graphite.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/graphite_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/healthcheck.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/histogram.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/histogram_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/influxdb/influxdb.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/json.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/json_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/librato/client.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/librato/librato.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/log.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/memory.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/meter.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/meter_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/metrics.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/metrics_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/opentsdb.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/opentsdb_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/registry.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/registry_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/runtime.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/runtime_cgo.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/runtime_no_cgo.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/runtime_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/sample.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/sample_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/stathat/stathat.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/syslog.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/timer.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/timer_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/writer.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/go-metrics/writer_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/.gitignore create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/.travis.yml create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/LICENSE create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/agent.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/doc.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/examples/example1.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/examples/example_web.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/gc_metrics.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/gometrica.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/http_metrics.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/memory_metrics.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/nut.json create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/gorelic/runtime_metrics.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/.travis.yml create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/LICENSE create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/agent.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/component.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/doc.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/examples/wave_plugin.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/metrica.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/nut.json create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/github.com/yvasiyarov/newrelic_platform_go/plugin.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/golang.org/x/crypto/bcrypt/base64.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/golang.org/x/crypto/bcrypt/bcrypt.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/golang.org/x/crypto/bcrypt/bcrypt_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/golang.org/x/crypto/blowfish/block.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/golang.org/x/crypto/blowfish/blowfish_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/golang.org/x/crypto/blowfish/cipher.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/golang.org/x/crypto/blowfish/const.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/golang.org/x/net/context/context.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/golang.org/x/net/context/context_test.go rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/golang.org/x/net/context/withtimeout_test.go (100%) create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/.gitignore create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/LICENSE create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/README.md create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/TODO create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/benchmark.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/benchmark_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/bootstrap_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/check.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/check_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/checkers.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/checkers_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/export_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/fixture_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/foundation_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/helpers.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/helpers_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/printer.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/printer_test.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/run.go create mode 100644 vendor/github.com/docker/distribution/Godeps/_workspace/src/gopkg.in/check.v1/run_test.go rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/LICENSE (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/LICENSE.libyaml (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/README.md (95%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/apic.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/decode.go (97%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/decode_test.go (99%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/emitterc.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/encode.go (94%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/encode_test.go (96%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/parserc.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/readerc.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/resolve.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/scannerc.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/sorter.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/suite_test.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/writerc.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/yaml.go (93%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/yamlh.go (100%) rename {Godeps => vendor/github.com/docker/distribution/Godeps}/_workspace/src/gopkg.in/yaml.v2/yamlprivateh.go (100%) rename {Godeps/_workspace/src/github.com/samalba/dockerclient => vendor/github.com/docker/distribution}/LICENSE (99%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/MAINTAINERS (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/Makefile (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/ROADMAP.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/blobs.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/circle.yml (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/cmd/dist/list.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/cmd/dist/main.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/cmd/dist/pull.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/cmd/dist/push.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/cmd/registry-api-descriptor-template/main.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/cmd/registry/config-cache.yml (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/cmd/registry/config-dev.yml (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/cmd/registry/config-example.yml (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/cmd/registry/main.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/cmd/registry/rados.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/configuration/configuration.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/configuration/configuration_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/configuration/parser.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/context/context.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/context/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/context/http.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/context/http_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/context/logger.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/context/trace.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/context/trace_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/context/util.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/apache/README.MD (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/apache/apache.conf (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/ceph/ci-setup.sh (100%) mode change 100644 => 100755 rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/compose/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/compose/docker-compose.yml (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/compose/nginx/Dockerfile (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/compose/nginx/docker-registry-v2.conf (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/compose/nginx/docker-registry.conf (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/compose/nginx/nginx.conf (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/compose/nginx/registry.conf (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/Dockerfile (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/docker-compose.yml (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/install_certs.sh (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/nginx/Dockerfile (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/nginx/docker-registry-v2.conf (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/nginx/docker-registry.conf (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/nginx/nginx.conf (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/nginx/registry-basic.conf (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/nginx/registry-noauth.conf (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/nginx/registry.conf (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/nginx/test.passwd (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/run.sh (100%) mode change 100644 => 100755 rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/run_multiversion.sh (100%) mode change 100644 => 100755 rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/test_runner.sh (100%) mode change 100644 => 100755 rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/contrib/docker-integration/tls.bats (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/digest/digest.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/digest/digest_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/digest/digester.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/digest/digester_resumable_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/digest/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/digest/set.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/digest/set_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/digest/tarsum.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/digest/tarsum_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/digest/verifiers.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/digest/verifiers_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/Dockerfile (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/Makefile (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/architecture.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/authentication.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/building.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/configuration.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/deploying.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/glossary.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/help.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/images/notifications.gliffy (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/images/notifications.png (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/images/notifications.svg (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/images/registry.gliffy (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/images/registry.png (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/images/registry.svg (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/index.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/introduction.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/migration.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/mirror.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/mkdocs.yml (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/notifications.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/osx-setup-guide.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/osx/com.docker.registry.plist (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/osx/config.yml (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/spec/api.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/spec/api.md.tmpl (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/spec/auth/token.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/spec/implementations.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/spec/json.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/spec/manifest-v2-1.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/storage-drivers/azure.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/storage-drivers/filesystem.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/storage-drivers/inmemory.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/storage-drivers/oss.md (100%) mode change 100644 => 100755 rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/storage-drivers/rados.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/storage-drivers/s3.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/storage-drivers/swift.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/docs/storagedrivers.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/errors.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/health/api/api.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/health/api/api_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/health/checks/checks.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/health/checks/checks_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/health/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/health/health.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/health/health_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/manifest/manifest.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/manifest/manifest_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/manifest/sign.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/manifest/verify.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/notifications/bridge.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/notifications/bridge_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/notifications/endpoint.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/notifications/event.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/notifications/event_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/notifications/http.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/notifications/http_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/notifications/listener.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/notifications/listener_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/notifications/metrics.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/notifications/sinks.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/notifications/sinks_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/project/dev-image/Dockerfile (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/project/hooks/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/project/hooks/configure-hooks.sh (100%) mode change 100644 => 100755 rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/project/hooks/pre-commit (100%) mode change 100644 => 100755 rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/api/errcode/errors.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/api/errcode/errors_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/api/errcode/handler.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/api/errcode/register.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/api/v2/descriptors.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/api/v2/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/api/v2/errors.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/api/v2/names.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/api/v2/names_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/api/v2/routes.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/api/v2/routes_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/api/v2/urls.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/api/v2/urls_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/auth/auth.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/auth/htpasswd/access.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/auth/htpasswd/access_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/auth/htpasswd/htpasswd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/auth/htpasswd/htpasswd_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/auth/silly/access.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/auth/silly/access_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/auth/token/accesscontroller.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/auth/token/stringset.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/auth/token/token.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/auth/token/token_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/auth/token/util.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/client/auth/api_version.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/client/auth/authchallenge.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/client/auth/authchallenge_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/client/auth/session.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/client/auth/session_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/client/blob_writer.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/client/blob_writer_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/client/errors.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/client/repository.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/client/repository_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/client/transport/http_reader.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/client/transport/transport.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/api_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/app.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/app_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/basicauth.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/basicauth_prego14.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/blob.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/blobupload.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/catalog.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/context.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/helpers.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/hmac.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/hmac_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/hooks.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/images.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/mail.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/handlers/tags.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/listener/listener.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/middleware/registry/middleware.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/middleware/repository/middleware.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/proxy/proxyauth.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/proxy/proxyblobstore.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/proxy/proxyblobstore_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/proxy/proxymanifeststore.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/proxy/proxymanifeststore_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/proxy/proxymetrics.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/proxy/proxyregistry.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/proxy/scheduler/scheduler.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/proxy/scheduler/scheduler_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/blob_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/blobcachemetrics.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/blobserver.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/blobstore.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/blobwriter.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/blobwriter_nonresumable.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/blobwriter_resumable.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/cache/cache.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/cache/cachedblobdescriptorstore.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/cache/memory/memory.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/cache/memory/memory_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/cache/redis/redis.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/cache/redis/redis_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/cache/suite.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/catalog.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/catalog_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/azure/azure.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/azure/azure_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/azure/blockblob.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/azure/blockblob_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/azure/blockid.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/azure/blockid_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/azure/randomwriter.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/azure/randomwriter_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/azure/zerofillwriter.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/azure/zerofillwriter_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/base/base.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/factory/factory.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/fileinfo.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/filesystem/driver.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/filesystem/driver_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/inmemory/driver.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/inmemory/driver_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/inmemory/mfs.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/middleware/cloudfront/middleware.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/middleware/storagemiddleware.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/oss/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/oss/oss.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/oss/oss_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/rados/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/rados/rados.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/rados/rados_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/s3/s3.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/s3/s3_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/storagedriver.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/swift/swift.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/swift/swift_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/driver/testsuites/testsuites.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/filereader.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/filereader_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/filewriter.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/filewriter_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/linkedblobstore.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/manifeststore.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/manifeststore_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/paths.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/paths_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/purgeuploads.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/purgeuploads_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/registry.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/revisionstore.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/signaturestore.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/tagstore.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/util.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/vacuum.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/walk.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/registry/storage/walk_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/testutil/handler.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/testutil/tarfile.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/uuid/uuid.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/uuid/uuid_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/version/print.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/version/version.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/distribution/version/version.sh (100%) mode change 100644 => 100755 create mode 100644 vendor/github.com/docker/docker/.dockerignore create mode 100644 vendor/github.com/docker/docker/.gitignore create mode 100644 vendor/github.com/docker/docker/.mailmap create mode 100644 vendor/github.com/docker/docker/AUTHORS create mode 100644 vendor/github.com/docker/docker/CHANGELOG.md create mode 100644 vendor/github.com/docker/docker/CONTRIBUTING.md create mode 100644 vendor/github.com/docker/docker/Dockerfile create mode 100644 vendor/github.com/docker/docker/Dockerfile.simple create mode 100644 vendor/github.com/docker/docker/LICENSE create mode 100644 vendor/github.com/docker/docker/MAINTAINERS create mode 100644 vendor/github.com/docker/docker/Makefile create mode 100644 vendor/github.com/docker/docker/NOTICE create mode 100644 vendor/github.com/docker/docker/README.md create mode 100644 vendor/github.com/docker/docker/ROADMAP.md create mode 100644 vendor/github.com/docker/docker/VERSION rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/api_unit_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/attach.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/build.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/cli.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/client.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/commit.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/cp.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/create.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/diff.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/events.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/exec.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/export.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/hijack.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/history.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/images.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/import.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/info.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/inspect.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/kill.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/load.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/login.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/logout.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/logs.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/network.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/pause.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/port.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/ps.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/ps/custom.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/ps/custom_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/ps/formatter.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/pull.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/push.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/rename.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/restart.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/rm.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/rmi.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/run.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/save.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/search.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/service.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/start.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/stats.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/stats_unit_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/stop.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/tag.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/top.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/trust.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/unpause.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/utils.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/version.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/client/wait.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/common.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/server/form.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/server/form_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/server/profiler.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/server/server.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/server/server_experimental.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/server/server_linux_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/server/server_stub.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/server/server_unix.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/server/server_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/types/stats.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/api/types/types.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/cliconfig/config.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/cliconfig/config_test.go (100%) create mode 100644 vendor/github.com/docker/docker/daemon/README.md create mode 100644 vendor/github.com/docker/docker/daemon/archive.go create mode 100644 vendor/github.com/docker/docker/daemon/archive_unix.go create mode 100644 vendor/github.com/docker/docker/daemon/archive_windows.go create mode 100644 vendor/github.com/docker/docker/daemon/attach.go create mode 100644 vendor/github.com/docker/docker/daemon/changes.go create mode 100644 vendor/github.com/docker/docker/daemon/commit.go create mode 100644 vendor/github.com/docker/docker/daemon/config.go create mode 100644 vendor/github.com/docker/docker/daemon/config_experimental.go create mode 100644 vendor/github.com/docker/docker/daemon/config_stub.go create mode 100644 vendor/github.com/docker/docker/daemon/config_unix.go create mode 100644 vendor/github.com/docker/docker/daemon/config_windows.go create mode 100644 vendor/github.com/docker/docker/daemon/container.go create mode 100644 vendor/github.com/docker/docker/daemon/container_unit_test.go create mode 100644 vendor/github.com/docker/docker/daemon/container_unix.go create mode 100644 vendor/github.com/docker/docker/daemon/container_windows.go create mode 100644 vendor/github.com/docker/docker/daemon/create.go create mode 100644 vendor/github.com/docker/docker/daemon/create_unix.go create mode 100644 vendor/github.com/docker/docker/daemon/create_windows.go create mode 100644 vendor/github.com/docker/docker/daemon/daemon.go create mode 100644 vendor/github.com/docker/docker/daemon/daemon_aufs.go create mode 100644 vendor/github.com/docker/docker/daemon/daemon_btrfs.go create mode 100644 vendor/github.com/docker/docker/daemon/daemon_devicemapper.go create mode 100644 vendor/github.com/docker/docker/daemon/daemon_no_aufs.go create mode 100644 vendor/github.com/docker/docker/daemon/daemon_overlay.go create mode 100644 vendor/github.com/docker/docker/daemon/daemon_test.go create mode 100644 vendor/github.com/docker/docker/daemon/daemon_unix.go create mode 100644 vendor/github.com/docker/docker/daemon/daemon_windows.go create mode 100644 vendor/github.com/docker/docker/daemon/daemon_zfs.go create mode 100644 vendor/github.com/docker/docker/daemon/debugtrap_unix.go create mode 100644 vendor/github.com/docker/docker/daemon/debugtrap_unsupported.go create mode 100644 vendor/github.com/docker/docker/daemon/debugtrap_windows.go create mode 100644 vendor/github.com/docker/docker/daemon/delete.go create mode 100644 vendor/github.com/docker/docker/daemon/exec.go create mode 100644 vendor/github.com/docker/docker/daemon/exec_freebsd.go create mode 100644 vendor/github.com/docker/docker/daemon/exec_linux.go create mode 100644 vendor/github.com/docker/docker/daemon/exec_windows.go create mode 100644 vendor/github.com/docker/docker/daemon/export.go create mode 100644 vendor/github.com/docker/docker/daemon/history.go create mode 100644 vendor/github.com/docker/docker/daemon/image_delete.go create mode 100644 vendor/github.com/docker/docker/daemon/info.go create mode 100644 vendor/github.com/docker/docker/daemon/inspect.go create mode 100644 vendor/github.com/docker/docker/daemon/inspect_unix.go create mode 100644 vendor/github.com/docker/docker/daemon/inspect_windows.go create mode 100644 vendor/github.com/docker/docker/daemon/kill.go create mode 100644 vendor/github.com/docker/docker/daemon/list.go create mode 100644 vendor/github.com/docker/docker/daemon/logdrivers_linux.go create mode 100644 vendor/github.com/docker/docker/daemon/logdrivers_windows.go create mode 100644 vendor/github.com/docker/docker/daemon/logs.go create mode 100644 vendor/github.com/docker/docker/daemon/monitor.go rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/daemon/network/settings.go (100%) create mode 100644 vendor/github.com/docker/docker/daemon/pause.go create mode 100644 vendor/github.com/docker/docker/daemon/rename.go create mode 100644 vendor/github.com/docker/docker/daemon/resize.go create mode 100644 vendor/github.com/docker/docker/daemon/restart.go create mode 100644 vendor/github.com/docker/docker/daemon/start.go create mode 100644 vendor/github.com/docker/docker/daemon/state.go create mode 100644 vendor/github.com/docker/docker/daemon/state_test.go create mode 100644 vendor/github.com/docker/docker/daemon/stats.go create mode 100644 vendor/github.com/docker/docker/daemon/stats_collector_unix.go create mode 100644 vendor/github.com/docker/docker/daemon/stats_collector_windows.go create mode 100644 vendor/github.com/docker/docker/daemon/stats_freebsd.go create mode 100644 vendor/github.com/docker/docker/daemon/stats_linux.go create mode 100644 vendor/github.com/docker/docker/daemon/stats_windows.go create mode 100644 vendor/github.com/docker/docker/daemon/stop.go create mode 100644 vendor/github.com/docker/docker/daemon/top.go create mode 100644 vendor/github.com/docker/docker/daemon/unpause.go create mode 100644 vendor/github.com/docker/docker/daemon/utils_freebsd.go create mode 100644 vendor/github.com/docker/docker/daemon/utils_linux.go create mode 100644 vendor/github.com/docker/docker/daemon/utils_nounix.go create mode 100644 vendor/github.com/docker/docker/daemon/utils_test.go create mode 100644 vendor/github.com/docker/docker/daemon/volumes.go create mode 100644 vendor/github.com/docker/docker/daemon/volumes_linux_unit_test.go create mode 100644 vendor/github.com/docker/docker/daemon/volumes_unit_test.go create mode 100644 vendor/github.com/docker/docker/daemon/volumes_unix.go create mode 100644 vendor/github.com/docker/docker/daemon/volumes_windows.go create mode 100644 vendor/github.com/docker/docker/daemon/wait.go create mode 100644 vendor/github.com/docker/docker/graph/export.go create mode 100644 vendor/github.com/docker/docker/graph/graph.go create mode 100644 vendor/github.com/docker/docker/graph/graph_test.go create mode 100644 vendor/github.com/docker/docker/graph/graph_unix.go create mode 100644 vendor/github.com/docker/docker/graph/graph_windows.go create mode 100644 vendor/github.com/docker/docker/graph/history.go create mode 100644 vendor/github.com/docker/docker/graph/import.go create mode 100644 vendor/github.com/docker/docker/graph/list.go create mode 100644 vendor/github.com/docker/docker/graph/load.go create mode 100644 vendor/github.com/docker/docker/graph/load_unsupported.go create mode 100644 vendor/github.com/docker/docker/graph/mutex.go create mode 100644 vendor/github.com/docker/docker/graph/pools_test.go create mode 100644 vendor/github.com/docker/docker/graph/pull.go create mode 100644 vendor/github.com/docker/docker/graph/pull_v1.go create mode 100644 vendor/github.com/docker/docker/graph/pull_v2.go create mode 100644 vendor/github.com/docker/docker/graph/push.go create mode 100644 vendor/github.com/docker/docker/graph/push_v1.go create mode 100644 vendor/github.com/docker/docker/graph/push_v2.go create mode 100644 vendor/github.com/docker/docker/graph/registry.go create mode 100644 vendor/github.com/docker/docker/graph/service.go create mode 100644 vendor/github.com/docker/docker/graph/tags.go rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/graph/tags/tags.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/graph/tags/tags_unit_test.go (100%) create mode 100644 vendor/github.com/docker/docker/graph/tags_unit_test.go rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/image/image.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/image/spec/v1.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/opts/envfile.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/opts/envfile_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/opts/hosts_unix.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/opts/hosts_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/opts/ip.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/opts/ip_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/opts/opts.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/opts/opts_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/opts/ulimit.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/opts/ulimit_test.go (100%) create mode 100644 vendor/github.com/docker/docker/pkg/README.md rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/archive.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/archive_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/archive_unix.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/archive_unix_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/archive_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/archive_windows_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/changes.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/changes_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/changes_other.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/changes_posix_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/changes_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/changes_unix.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/changes_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/copy.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/copy_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/diff.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/diff_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/example_changes.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/testdata/broken.tar (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/time_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/time_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/utils_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/wrap.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/archive/wrap_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/fileutils/fileutils.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/fileutils/fileutils_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/homedir/homedir.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/homedir/homedir_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/httputils/httputils.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/httputils/mimetype.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/httputils/resumablerequestreader.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/httputils/resumablerequestreader_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/ioutils/fmt.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/ioutils/fmt_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/ioutils/multireader.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/ioutils/multireader_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/ioutils/readers.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/ioutils/readers_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/ioutils/scheduler.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/ioutils/scheduler_gccgo.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/ioutils/writeflusher.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/ioutils/writers.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/ioutils/writers_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/jsonmessage/jsonmessage.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/jsonmessage/jsonmessage_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mflag/LICENSE (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mflag/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mflag/example/example.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mflag/flag.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mflag/flag_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/flags.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/flags_freebsd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/flags_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/flags_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/mount.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/mount_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/mounter_freebsd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/mounter_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/mounter_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/mountinfo.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/mountinfo_freebsd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/mountinfo_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/mountinfo_linux_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/mountinfo_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/sharedsubtree_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/mount/sharedsubtree_linux_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/nat/nat.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/nat/nat_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/nat/sort.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/nat/sort_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/parsers/filters/parse.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/parsers/filters/parse_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/parsers/kernel/kernel.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/parsers/kernel/kernel_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/parsers/kernel/kernel_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/parsers/kernel/uname_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/parsers/kernel/uname_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_freebsd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/parsers/operatingsystem/operatingsystem_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/parsers/parsers.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/parsers/parsers_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/pools/pools.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/pools/pools_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/promise/promise.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/random/random.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/random/random_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/reexec/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/reexec/command_freebsd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/reexec/command_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/reexec/command_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/reexec/command_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/reexec/reexec.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/stdcopy/stdcopy.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/stdcopy/stdcopy_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/stringid/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/stringid/stringid.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/stringid/stringid_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/symlink/LICENSE.APACHE (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/symlink/LICENSE.BSD (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/symlink/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/symlink/fs.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/symlink/fs_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/errors.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/events_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/filesys.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/filesys_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/lstat.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/lstat_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/lstat_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/meminfo.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/meminfo_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/meminfo_linux_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/meminfo_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/meminfo_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/mknod.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/mknod_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/stat.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/stat_freebsd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/stat_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/stat_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/stat_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/stat_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/umask.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/umask_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/utimes_darwin.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/utimes_freebsd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/utimes_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/utimes_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/utimes_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/xattrs_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/system/xattrs_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/tarsum/builder_context.go (100%) create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/builder_context_test.go rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/tarsum/fileinfosums.go (100%) create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/fileinfosums_test.go rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/tarsum/tarsum.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/tarsum/tarsum_spec.md (100%) create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/tarsum_test.go create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/testdata/46af0962ab5afeb5ce6740d4d91652e69206fc991fd5328c1a94d364ad00e457/json create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/testdata/46af0962ab5afeb5ce6740d4d91652e69206fc991fd5328c1a94d364ad00e457/layer.tar create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/testdata/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158/json create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/testdata/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158/layer.tar create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/testdata/collision/collision-0.tar create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/testdata/collision/collision-1.tar create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/testdata/collision/collision-2.tar create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/testdata/collision/collision-3.tar create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/testdata/xattr/json rename Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/container.tar => vendor/github.com/docker/docker/pkg/tarsum/testdata/xattr/layer.tar (65%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/tarsum/versioning.go (100%) create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/versioning_test.go create mode 100644 vendor/github.com/docker/docker/pkg/tarsum/writercloser.go rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/term/tc_linux_cgo.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/term/tc_other.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/term/term.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/term/term_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/term/termios_darwin.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/term/termios_freebsd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/term/termios_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/term/windows/ansi_reader.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/term/windows/ansi_writer.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/term/windows/console.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/term/windows/windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/term/windows/windows_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/timeutils/json.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/timeutils/json_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/timeutils/utils.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/timeutils/utils_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/tlsconfig/config.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/ulimit/ulimit.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/ulimit/ulimit_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/units/duration.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/units/duration_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/units/size.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/units/size_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/urlutil/urlutil.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/urlutil/urlutil_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/useragent/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/useragent/useragent.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/useragent/useragent_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/version/version.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/pkg/version/version_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/auth.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/auth_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/authchallenge.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/config.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/config_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/endpoint.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/endpoint_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/reference.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/registry.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/registry_mock_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/registry_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/service.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/session.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/token.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/registry/types.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/compare.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/compare_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/config.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/config_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/exec.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/exec_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/fixtures/container_config_1_14.json (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/fixtures/container_config_1_17.json (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/fixtures/container_config_1_19.json (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/fixtures/container_hostconfig_1_14.json (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/fixtures/container_hostconfig_1_19.json (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/fixtures/valid.env (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/fixtures/valid.label (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/hostconfig.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/hostconfig_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/hostconfig_unix.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/hostconfig_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/merge.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/merge_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/parse.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/parse_experimental.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/parse_stub.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/parse_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/parse_unix.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/runconfig/parse_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/utils/experimental.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/utils/git.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/utils/git_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/utils/stubs.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/utils/utils.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/utils/utils_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/volume/drivers/adapter.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/volume/drivers/api.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/volume/drivers/extpoint.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/volume/drivers/proxy.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/volume/drivers/proxy_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/volume/local/local.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/docker/volume/volume.go (100%) create mode 100644 vendor/github.com/docker/libcompose/.dockerignore create mode 100644 vendor/github.com/docker/libcompose/.gitignore create mode 100644 vendor/github.com/docker/libcompose/CHANGELOG.md create mode 100644 vendor/github.com/docker/libcompose/CONTRIBUTING.md create mode 100644 vendor/github.com/docker/libcompose/Dockerfile create mode 100644 vendor/github.com/docker/libcompose/LICENSE create mode 100644 vendor/github.com/docker/libcompose/MAINTAINERS create mode 100644 vendor/github.com/docker/libcompose/Makefile create mode 100644 vendor/github.com/docker/libcompose/README.md rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/cli/app/app.go (95%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/cli/app/types.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/cli/command/command.go (88%) create mode 100644 vendor/github.com/docker/libcompose/cli/command/help.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/cli/docker/app/commands.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/cli/docker/app/factory.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/cli/logger/color_logger.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/cli/logger/colors.go (100%) create mode 100644 vendor/github.com/docker/libcompose/cli/main/main.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/docker/builder.go (75%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/docker/client.go (69%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/docker/client_factory.go (57%) create mode 100644 vendor/github.com/docker/libcompose/docker/container.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/docker/context.go (70%) create mode 100644 vendor/github.com/docker/libcompose/docker/convert.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/docker/convert_test.go (50%) create mode 100644 vendor/github.com/docker/libcompose/docker/functions.go create mode 100644 vendor/github.com/docker/libcompose/docker/labels.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/docker/name.go (57%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/docker/project.go (94%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/docker/service.go (60%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/docker/service_factory.go (66%) create mode 100644 vendor/github.com/docker/libcompose/docker/service_test.go create mode 100644 vendor/github.com/docker/libcompose/generate.go create mode 100644 vendor/github.com/docker/libcompose/logger/null.go create mode 100644 vendor/github.com/docker/libcompose/logger/types.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/lookup/file.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/lookup/file_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/lookup/simple_env.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/lookup/simple_env_test.go (100%) create mode 100644 vendor/github.com/docker/libcompose/package.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/project/context.go (87%) create mode 100644 vendor/github.com/docker/libcompose/project/empty.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/project/hash.go (87%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/project/info.go (89%) create mode 100644 vendor/github.com/docker/libcompose/project/interpolation.go create mode 100644 vendor/github.com/docker/libcompose/project/interpolation_test.go create mode 100644 vendor/github.com/docker/libcompose/project/listener.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/project/merge.go (76%) create mode 100644 vendor/github.com/docker/libcompose/project/merge_test.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/project/project.go (55%) create mode 100644 vendor/github.com/docker/libcompose/project/project_test.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/project/service-wrapper.go (82%) create mode 100644 vendor/github.com/docker/libcompose/project/types.go create mode 100644 vendor/github.com/docker/libcompose/project/types_yaml.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/project/types_yaml_test.go (92%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/project/utils.go (55%) create mode 100644 vendor/github.com/docker/libcompose/project/yaml_test.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/utils/util.go (58%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcompose/utils/util_test.go (88%) create mode 100644 vendor/github.com/docker/libcontainer/.gitignore create mode 100644 vendor/github.com/docker/libcontainer/CONTRIBUTING.md create mode 100644 vendor/github.com/docker/libcontainer/Dockerfile create mode 100644 vendor/github.com/docker/libcontainer/LICENSE create mode 100644 vendor/github.com/docker/libcontainer/MAINTAINERS create mode 100644 vendor/github.com/docker/libcontainer/MAINTAINERS_GUIDE.md create mode 100644 vendor/github.com/docker/libcontainer/Makefile create mode 100644 vendor/github.com/docker/libcontainer/NOTICE create mode 100644 vendor/github.com/docker/libcontainer/PRINCIPLES.md create mode 100644 vendor/github.com/docker/libcontainer/README.md create mode 100644 vendor/github.com/docker/libcontainer/ROADMAP.md create mode 100644 vendor/github.com/docker/libcontainer/SPEC.md create mode 100644 vendor/github.com/docker/libcontainer/capabilities_linux.go create mode 100644 vendor/github.com/docker/libcontainer/console.go create mode 100644 vendor/github.com/docker/libcontainer/console_freebsd.go create mode 100644 vendor/github.com/docker/libcontainer/console_linux.go create mode 100644 vendor/github.com/docker/libcontainer/console_windows.go create mode 100644 vendor/github.com/docker/libcontainer/container.go create mode 100644 vendor/github.com/docker/libcontainer/container_linux.go create mode 100644 vendor/github.com/docker/libcontainer/container_linux_test.go create mode 100644 vendor/github.com/docker/libcontainer/container_nouserns_linux.go create mode 100644 vendor/github.com/docker/libcontainer/container_userns_linux.go create mode 100644 vendor/github.com/docker/libcontainer/criu_opts.go create mode 100644 vendor/github.com/docker/libcontainer/error.go create mode 100644 vendor/github.com/docker/libcontainer/error_test.go create mode 100644 vendor/github.com/docker/libcontainer/factory.go create mode 100644 vendor/github.com/docker/libcontainer/factory_linux.go create mode 100644 vendor/github.com/docker/libcontainer/factory_linux_test.go create mode 100644 vendor/github.com/docker/libcontainer/generic_error.go create mode 100644 vendor/github.com/docker/libcontainer/generic_error_test.go create mode 100644 vendor/github.com/docker/libcontainer/init_linux.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libcontainer/netlink/MAINTAINERS (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcontainer/netlink/netlink.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcontainer/netlink/netlink_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcontainer/netlink/netlink_linux_armppc64.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcontainer/netlink/netlink_linux_notarm.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcontainer/netlink/netlink_linux_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libcontainer/netlink/netlink_unsupported.go (100%) create mode 100644 vendor/github.com/docker/libcontainer/network_linux.go create mode 100644 vendor/github.com/docker/libcontainer/notify_linux.go create mode 100644 vendor/github.com/docker/libcontainer/notify_linux_test.go create mode 100644 vendor/github.com/docker/libcontainer/process.go create mode 100644 vendor/github.com/docker/libcontainer/process_linux.go create mode 100644 vendor/github.com/docker/libcontainer/restored_process.go create mode 100644 vendor/github.com/docker/libcontainer/rootfs_linux.go create mode 100644 vendor/github.com/docker/libcontainer/rootfs_linux_test.go create mode 100644 vendor/github.com/docker/libcontainer/setns_init_linux.go create mode 100644 vendor/github.com/docker/libcontainer/standard_init_linux.go create mode 100644 vendor/github.com/docker/libcontainer/stats.go create mode 100644 vendor/github.com/docker/libcontainer/stats_freebsd.go create mode 100644 vendor/github.com/docker/libcontainer/stats_linux.go create mode 100644 vendor/github.com/docker/libcontainer/stats_windows.go create mode 100755 vendor/github.com/docker/libcontainer/update-vendor.sh create mode 100644 vendor/github.com/docker/libnetwork/.gitignore create mode 100644 vendor/github.com/docker/libnetwork/LICENSE create mode 100644 vendor/github.com/docker/libnetwork/MAINTAINERS create mode 100644 vendor/github.com/docker/libnetwork/Makefile create mode 100644 vendor/github.com/docker/libnetwork/README.md create mode 100644 vendor/github.com/docker/libnetwork/ROADMAP.md create mode 100644 vendor/github.com/docker/libnetwork/circle.yml create mode 100644 vendor/github.com/docker/libnetwork/controller.go create mode 100644 vendor/github.com/docker/libnetwork/drivers_freebsd.go create mode 100644 vendor/github.com/docker/libnetwork/drivers_linux.go create mode 100644 vendor/github.com/docker/libnetwork/drivers_windows.go create mode 100644 vendor/github.com/docker/libnetwork/endpoint.go create mode 100644 vendor/github.com/docker/libnetwork/endpoint_info.go create mode 100644 vendor/github.com/docker/libnetwork/error.go create mode 100644 vendor/github.com/docker/libnetwork/errors_test.go create mode 100644 vendor/github.com/docker/libnetwork/libnetwork_internal_test.go create mode 100644 vendor/github.com/docker/libnetwork/libnetwork_test.go create mode 100644 vendor/github.com/docker/libnetwork/network.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libnetwork/resolvconf/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libnetwork/resolvconf/dns/resolvconf.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libnetwork/resolvconf/resolvconf.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libnetwork/resolvconf/resolvconf_test.go (100%) create mode 100644 vendor/github.com/docker/libnetwork/sandboxdata.go create mode 100644 vendor/github.com/docker/libnetwork/sandboxdata_test.go create mode 100644 vendor/github.com/docker/libnetwork/store.go create mode 100644 vendor/github.com/docker/libtrust/CONTRIBUTING.md create mode 100644 vendor/github.com/docker/libtrust/LICENSE create mode 100644 vendor/github.com/docker/libtrust/MAINTAINERS create mode 100644 vendor/github.com/docker/libtrust/README.md create mode 100644 vendor/github.com/docker/libtrust/certificates.go create mode 100644 vendor/github.com/docker/libtrust/certificates_test.go create mode 100644 vendor/github.com/docker/libtrust/doc.go create mode 100644 vendor/github.com/docker/libtrust/ec_key.go create mode 100644 vendor/github.com/docker/libtrust/ec_key_test.go create mode 100644 vendor/github.com/docker/libtrust/filter.go create mode 100644 vendor/github.com/docker/libtrust/filter_test.go create mode 100644 vendor/github.com/docker/libtrust/hash.go create mode 100644 vendor/github.com/docker/libtrust/jsonsign.go create mode 100644 vendor/github.com/docker/libtrust/jsonsign_test.go create mode 100644 vendor/github.com/docker/libtrust/key.go create mode 100644 vendor/github.com/docker/libtrust/key_files.go create mode 100644 vendor/github.com/docker/libtrust/key_files_test.go create mode 100644 vendor/github.com/docker/libtrust/key_manager.go create mode 100644 vendor/github.com/docker/libtrust/key_test.go create mode 100644 vendor/github.com/docker/libtrust/rsa_key.go create mode 100644 vendor/github.com/docker/libtrust/rsa_key_test.go create mode 100644 vendor/github.com/docker/libtrust/testutil/certificates.go create mode 100644 vendor/github.com/docker/libtrust/tlsdemo/README.md create mode 100644 vendor/github.com/docker/libtrust/tlsdemo/client.go create mode 100644 vendor/github.com/docker/libtrust/tlsdemo/gencert.go create mode 100644 vendor/github.com/docker/libtrust/tlsdemo/genkeys.go create mode 100644 vendor/github.com/docker/libtrust/tlsdemo/server.go create mode 100644 vendor/github.com/docker/libtrust/trustgraph/graph.go create mode 100644 vendor/github.com/docker/libtrust/trustgraph/memory_graph.go create mode 100644 vendor/github.com/docker/libtrust/trustgraph/memory_graph_test.go create mode 100644 vendor/github.com/docker/libtrust/trustgraph/statement.go create mode 100644 vendor/github.com/docker/libtrust/trustgraph/statement_test.go rename {Godeps/_workspace/src => vendor}/github.com/docker/libtrust/util.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/libtrust/util_test.go (100%) create mode 100644 vendor/github.com/docker/machine/.dockerignore create mode 100644 vendor/github.com/docker/machine/.gitignore create mode 100644 vendor/github.com/docker/machine/.godir create mode 100644 vendor/github.com/docker/machine/.travis.yml create mode 100644 vendor/github.com/docker/machine/CHANGELOG.md create mode 100644 vendor/github.com/docker/machine/CONTRIBUTING.md create mode 100644 vendor/github.com/docker/machine/Dockerfile create mode 100644 vendor/github.com/docker/machine/LICENSE create mode 100644 vendor/github.com/docker/machine/MAINTAINERS create mode 100644 vendor/github.com/docker/machine/Makefile create mode 100644 vendor/github.com/docker/machine/README.md create mode 100644 vendor/github.com/docker/machine/ROADMAP.md rename {Godeps/_workspace/src => vendor}/github.com/docker/machine/log/log.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/machine/log/log_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/machine/log/terminal.go (100%) create mode 100644 vendor/github.com/docker/machine/main.go create mode 100644 vendor/github.com/docker/machine/main_test.go rename {Godeps/_workspace/src => vendor}/github.com/docker/machine/utils/b2d.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/machine/utils/b2d_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/machine/utils/certs.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/machine/utils/certs_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/machine/utils/utils.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/docker/machine/utils/utils_test.go (100%) create mode 100644 vendor/github.com/flynn/go-shlex/COPYING rename {Godeps/_workspace/src => vendor}/github.com/flynn/go-shlex/Makefile (100%) rename {Godeps/_workspace/src => vendor}/github.com/flynn/go-shlex/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/flynn/go-shlex/shlex.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/flynn/go-shlex/shlex_test.go (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/.gitignore create mode 100644 vendor/github.com/fsouza/go-dockerclient/.travis.yml rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/AUTHORS (73%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/DOCKER-LICENSE (100%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/LICENSE (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/Makefile rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/README.markdown (58%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/auth.go (64%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/auth_test.go (54%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/build_test.go (90%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/change.go (95%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/change_test.go (96%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/client.go (67%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/client_test.go (72%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/container.go (62%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/container_test.go (82%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/env.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/env_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/event.go (94%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/event_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/example_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/exec.go (82%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/exec_test.go (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/CHANGELOG.md create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/LICENSE create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/README.md create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/doc.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/Sirupsen/logrus/entry.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/Sirupsen/logrus/entry_test.go (92%) rename {Godeps/_workspace/src => vendor/github.com/fsouza/go-dockerclient/external}/github.com/Sirupsen/logrus/exported.go (99%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/formatter.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/formatter_bench_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/hook_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/hooks.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/json_formatter.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/json_formatter_test.go rename {Godeps/_workspace/src => vendor/github.com/fsouza/go-dockerclient/external}/github.com/Sirupsen/logrus/logger.go (69%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/Sirupsen/logrus/logrus.go (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/logrus_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_bsd.go rename Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/terminal_darwin.go => vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_linux.go (85%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_notwindows.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_windows.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/text_formatter.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/text_formatter_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/writer.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/distribution/registry/api/errcode/errors.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/distribution/registry/api/errcode/errors_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/distribution/registry/api/errcode/handler.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/distribution/registry/api/errcode/register.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/errors/README.md create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/errors/builder.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/errors/daemon.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/errors/error.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/errors/image.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/errors/server.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/envfile.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/envfile_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/hosts_unix.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/hosts_windows.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/ip.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/ip_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/opts.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/opts_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/ulimit.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts/ulimit_test.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/README.md (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/archive.go (60%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/archive_test.go (98%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/archive_unix.go (66%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/archive_unix_test.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/archive_windows.go (61%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/archive_windows_test.go (74%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/changes.go (79%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/changes_linux.go (98%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/changes_other.go (70%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/changes_posix_test.go (96%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/changes_test.go (94%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/changes_unix.go (57%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/changes_windows.go (56%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/copy.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/copy_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/copy_unix.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/copy_windows.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/diff.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/diff_test.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/example_changes.go (93%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/testdata/broken.tar rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/time_linux.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/time_unsupported.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/utils_test.go (99%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/archive/whiteouts.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/wrap.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/archive/wrap_test.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/fileutils/fileutils.go (80%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/fileutils/fileutils_test.go (90%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/fileutils/fileutils_unix.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/fileutils/fileutils_windows.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/homedir/homedir.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/homedir/homedir_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/idtools/idtools.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/idtools/idtools_unix.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/idtools/idtools_unix_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/idtools/idtools_windows.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/idtools/usergroupadd_linux.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/idtools/usergroupadd_unsupported.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/bytespipe.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/bytespipe_test.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/ioutils/fmt.go (57%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/ioutils/fmt_test.go (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/multireader.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/multireader_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/readers.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/ioutils/readers_test.go (95%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/scheduler.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/scheduler_gccgo.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/temp_unix.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ioutils/temp_windows.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/ioutils/writeflusher.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/ioutils/writers.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/ioutils/writers_test.go (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/longpath/longpath.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/longpath/longpath_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/mflag/LICENSE create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/mflag/README.md create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/mflag/flag.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/mflag/flag_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/parsers/parsers.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/parsers/parsers_test.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/pools/pools.go (82%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/pools/pools_test.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/promise/promise.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/stdcopy/stdcopy.go (66%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/stdcopy/stdcopy_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_unix_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/chtimes_windows_test.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/errors.go (66%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/events_windows.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/filesys.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/filesys_windows.go (67%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/lstat.go (74%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/lstat_test.go (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/lstat_unix_test.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/lstat_windows.go (77%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/meminfo.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/meminfo_linux.go (90%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/meminfo_linux_test.go (90%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/meminfo_unix_test.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/meminfo_unsupported.go (61%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/meminfo_windows.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/mknod.go (70%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/mknod_windows.go (72%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_freebsd.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/stat_linux.go (59%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/stat_test.go (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_unix_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_unsupported.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_windows.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/syscall_unix.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/syscall_windows.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/umask.go (62%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/umask_windows.go (76%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/utimes_darwin.go (56%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/utimes_freebsd.go (68%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/utimes_linux.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/utimes_test.go (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/utimes_unix_test.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/utimes_unsupported.go (63%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/xattrs_linux.go (82%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/system/xattrs_unsupported.go (66%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ulimit/ulimit.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/ulimit/ulimit_test.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/units/duration.go (84%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/units/duration_test.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/units/size.go (87%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/docker/docker/pkg/units/size_test.go (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/volume/volume.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/volume/volume_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/volume/volume_unix.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/volume/volume_windows.go rename {Godeps/_workspace/src/github.com/opencontainers/runc => vendor/github.com/fsouza/go-dockerclient/external/github.com/docker}/libcontainer/user/MAINTAINERS (100%) rename {Godeps/_workspace/src/github.com/opencontainers/runc => vendor/github.com/fsouza/go-dockerclient/external/github.com/docker}/libcontainer/user/lookup.go (100%) rename {Godeps/_workspace/src/github.com/opencontainers/runc => vendor/github.com/fsouza/go-dockerclient/external/github.com/docker}/libcontainer/user/lookup_unix.go (100%) rename {Godeps/_workspace/src/github.com/opencontainers/runc => vendor/github.com/fsouza/go-dockerclient/external/github.com/docker}/libcontainer/user/lookup_unsupported.go (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/libcontainer/user/user.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/docker/libcontainer/user/user_test.go rename {Godeps/_workspace/src => vendor/github.com/fsouza/go-dockerclient/external}/github.com/gorilla/context/LICENSE (100%) rename {Godeps/_workspace/src => vendor/github.com/fsouza/go-dockerclient/external}/github.com/gorilla/context/README.md (100%) rename {Godeps/_workspace/src => vendor/github.com/fsouza/go-dockerclient/external}/github.com/gorilla/context/context.go (100%) rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/gorilla/context/context_test.go (100%) rename {Godeps/_workspace/src => vendor/github.com/fsouza/go-dockerclient/external}/github.com/gorilla/context/doc.go (100%) rename {Godeps/_workspace/src => vendor/github.com/fsouza/go-dockerclient/external}/github.com/gorilla/mux/LICENSE (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/README.md rename {Godeps/_workspace/src => vendor/github.com/fsouza/go-dockerclient/external}/github.com/gorilla/mux/bench_test.go (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/doc.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/mux.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/mux_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/old_test.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux/regexp.go rename {Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor => vendor/github.com/fsouza/go-dockerclient/external}/github.com/gorilla/mux/route.go (91%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/hashicorp/go-cleanhttp/LICENSE create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/hashicorp/go-cleanhttp/README.md create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/hashicorp/go-cleanhttp/cleanhttp.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user/MAINTAINERS create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user/lookup.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user/lookup_unix.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user/lookup_unsupported.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user/user.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user/user_test.go rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/image.go (73%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/image_test.go (95%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/integration_test.go rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/misc.go (77%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/misc_test.go (100%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/network.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/network_test.go rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/signal.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/tar.go (95%) rename {Godeps/_workspace/src => vendor}/github.com/fsouza/go-dockerclient/tls.go (93%) create mode 100644 vendor/github.com/fsouza/go-dockerclient/volume.go create mode 100644 vendor/github.com/fsouza/go-dockerclient/volume_test.go rename {Godeps/_workspace/src => vendor}/github.com/gorilla/context/.travis.yml (100%) create mode 100644 vendor/github.com/gorilla/context/LICENSE create mode 100644 vendor/github.com/gorilla/context/README.md create mode 100644 vendor/github.com/gorilla/context/context.go rename {Godeps/_workspace/src => vendor}/github.com/gorilla/context/context_test.go (100%) create mode 100644 vendor/github.com/gorilla/context/doc.go create mode 100644 vendor/github.com/gorilla/mux/.travis.yml create mode 100644 vendor/github.com/gorilla/mux/LICENSE rename {Godeps/_workspace/src => vendor}/github.com/gorilla/mux/README.md (100%) create mode 100644 vendor/github.com/gorilla/mux/bench_test.go rename {Godeps/_workspace/src => vendor}/github.com/gorilla/mux/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/gorilla/mux/mux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/gorilla/mux/mux_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/gorilla/mux/old_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/gorilla/mux/regexp.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/gorilla/mux/route.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/LICENSE (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/README.markdown (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/auth.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/auth_external.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/auth_sha1.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/call.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/conn.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/conn_darwin.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/conn_other.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/conn_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/dbus.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/decoder.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/encoder.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/examples_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/export.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/introspect/call.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/introspect/introspect.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/introspect/introspectable.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/message.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/prop/prop.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/proto_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/sig.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/sig_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/transport_darwin.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/transport_generic.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/transport_unix.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/transport_unix_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/transport_unixcred.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/variant.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/variant_lexer.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/variant_parser.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/guelfey/go.dbus/variant_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/j-keck/arping/.gitignore (100%) rename {Godeps/_workspace/src => vendor}/github.com/j-keck/arping/LICENSE (100%) rename {Godeps/_workspace/src => vendor}/github.com/j-keck/arping/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/j-keck/arping/arp_datagram.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/j-keck/arping/arping.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/j-keck/arping/arping_bsd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/j-keck/arping/arping_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/j-keck/arping/arping_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/j-keck/arping/netutils.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/Doc/AUTHORS.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/Doc/CONTRIBUTORS.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/Doc/LICENSE-MPL.txt (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/Doc/NEWS.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/readline/ansi.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/readline/buffer.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/readline/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/readline/error.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/readline/history.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/readline/history_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/readline/read.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/readline/read_unix.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/sys/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/sys/key_unix.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/sys/sys_bsd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/sys/sys_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/sys/sys_unix.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/sys/z-sys_darwin_386.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/sys/z-sys_darwin_amd64.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/sys/z-sys_freebsd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/sys/z-sys_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/sys/z-sys_netbsd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/sys/z-sys_openbsd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/term.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/term_unix.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/test/runtest.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/unix_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/kless/term/util_unix.go (100%) create mode 100644 vendor/github.com/opencontainers/runc/.gitignore create mode 100644 vendor/github.com/opencontainers/runc/CONTRIBUTING.md create mode 100644 vendor/github.com/opencontainers/runc/LICENSE create mode 100644 vendor/github.com/opencontainers/runc/MAINTAINERS create mode 100644 vendor/github.com/opencontainers/runc/MAINTAINERS_GUIDE.md create mode 100644 vendor/github.com/opencontainers/runc/Makefile create mode 100644 vendor/github.com/opencontainers/runc/NOTICE create mode 100644 vendor/github.com/opencontainers/runc/PRINCIPLES.md create mode 100644 vendor/github.com/opencontainers/runc/README.md create mode 100644 vendor/github.com/opencontainers/runc/checkpoint.go create mode 100644 vendor/github.com/opencontainers/runc/events.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/README.md create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/SPEC.md create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/capabilities_linux.go rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/cgroups.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/cgroups_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/cgroups_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/apply_raw.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/blkio.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/blkio_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpu.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpu_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuacct.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuset.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/cpuset_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/devices.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/devices_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/freezer.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/freezer_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/fs_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/hugetlb.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/hugetlb_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/memory.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/memory_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_cls.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_cls_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_prio.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/net_prio_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/perf_event.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/stats_util_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/util_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/utils.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/fs/utils_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/stats.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/systemd/apply_nosystemd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/systemd/apply_systemd.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/cgroups/utils.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/cgroup.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/config.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/config_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/config_unix.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/device.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/device_defaults.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/hugepage_limit.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/interface_priority_map.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/mount.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/namespaces.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/namespaces_syscall.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/namespaces_syscall_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/namespaces_unix.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/namespaces_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/network.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/configs/validate/config.go (100%) create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/console.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/console_freebsd.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/console_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/console_windows.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/container.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/container_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/container_linux_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/container_nouserns_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/container_userns_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/criu_opts.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/error.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/error_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/factory.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/factory_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/factory_linux_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/generic_error.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/generic_error_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/init_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/network_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/notify_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/notify_linux_test.go rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/nsenter/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/nsenter/nsenter.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/nsenter/nsenter_gccgo.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/nsenter/nsenter_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/nsenter/nsenter_unsupported.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/nsenter/nsexec.c (100%) create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/process.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/process_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/restored_process.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/rootfs_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/rootfs_linux_test.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/setns_init_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/standard_init_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/stats.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/stats_freebsd.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/stats_linux.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/stats_windows.go rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/system/linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/system/proc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/system/setns_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/system/syscall_linux_386.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/system/syscall_linux_arm.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/system/sysconfig.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/system/sysconfig_notcgo.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/system/xattrs_linux.go (100%) create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/user/MAINTAINERS create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/user/lookup.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/user/lookup_unix.go create mode 100644 vendor/github.com/opencontainers/runc/libcontainer/user/lookup_unsupported.go rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/user/user.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/opencontainers/runc/libcontainer/user/user_test.go (100%) create mode 100644 vendor/github.com/opencontainers/runc/main.go create mode 100644 vendor/github.com/opencontainers/runc/main_unix.go create mode 100644 vendor/github.com/opencontainers/runc/main_unsupported.go create mode 100644 vendor/github.com/opencontainers/runc/restore.go create mode 100644 vendor/github.com/opencontainers/runc/run.go create mode 100644 vendor/github.com/opencontainers/runc/signals.go create mode 100644 vendor/github.com/opencontainers/runc/spec.go create mode 100644 vendor/github.com/opencontainers/runc/tty.go create mode 100644 vendor/github.com/opencontainers/runc/utils.go rename {Godeps/_workspace/src => vendor}/github.com/rancher/docker-from-scratch/.dockerignore (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/docker-from-scratch/.drone.yml (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/docker-from-scratch/.gitignore (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/docker-from-scratch/.wrap-docker-args (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/docker-from-scratch/Dockerfile (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/docker-from-scratch/Dockerfile.wrap (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/docker-from-scratch/LICENSE (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/docker-from-scratch/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/docker-from-scratch/build.sh (100%) mode change 100644 => 100755 create mode 100644 vendor/github.com/rancher/docker-from-scratch/glide.yaml rename {Godeps/_workspace/src => vendor}/github.com/rancher/docker-from-scratch/scratch.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/docker-from-scratch/util/util.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/docker-from-scratch/util/util_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/docker-from-scratch/util/util_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/netconf/LICENSE (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/netconf/README.md (100%) rename Godeps/_workspace/src/github.com/rancher/netconf/ipv4ll.go => vendor/github.com/rancher/netconf/ipv4ll_linux.go (100%) rename Godeps/_workspace/src/github.com/rancher/netconf/netconf.go => vendor/github.com/rancher/netconf/netconf_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/rancher/netconf/types.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/ryanuber/go-glob/.travis.yml (100%) rename {Godeps/_workspace/src => vendor}/github.com/ryanuber/go-glob/LICENSE (100%) rename {Godeps/_workspace/src => vendor}/github.com/ryanuber/go-glob/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/ryanuber/go-glob/glob.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/ryanuber/go-glob/glob_test.go (100%) rename {Godeps/_workspace/src/github.com/samalba/dockerclient => vendor/github.com/stretchr/testify}/.gitignore (95%) create mode 100644 vendor/github.com/stretchr/testify/.travis.yml create mode 100644 vendor/github.com/stretchr/testify/LICENCE.txt create mode 100644 vendor/github.com/stretchr/testify/README.md rename {Godeps/_workspace/src => vendor}/github.com/stretchr/testify/assert/assertions.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/stretchr/testify/assert/assertions_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/stretchr/testify/assert/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/stretchr/testify/assert/errors.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/stretchr/testify/assert/forward_assertions.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/stretchr/testify/assert/forward_assertions_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/stretchr/testify/assert/http_assertions.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/stretchr/testify/assert/http_assertions_test.go (100%) create mode 100644 vendor/github.com/stretchr/testify/doc.go create mode 100644 vendor/github.com/stretchr/testify/package_test.go rename {Godeps/_workspace/src => vendor}/github.com/stretchr/testify/require/doc.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/stretchr/testify/require/forward_requirements.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/stretchr/testify/require/forward_requirements_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/stretchr/testify/require/requirements.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/stretchr/testify/require/requirements_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/.travis.yml (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/LICENSE (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/Makefile (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/addr.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/addr_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/addr_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/link.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/link_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/link_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/neigh.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/neigh_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/neigh_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/netlink.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/netlink_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/netlink_unspecified.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/nl/addr_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/nl/addr_linux_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/nl/link_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/nl/nl_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/nl/nl_linux_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/nl/route_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/nl/route_linux_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/nl/xfrm_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/nl/xfrm_linux_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/nl/xfrm_policy_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/nl/xfrm_policy_linux_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/nl/xfrm_state_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/nl/xfrm_state_linux_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/protinfo.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/protinfo_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/protinfo_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/route.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/route_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/route_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/xfrm.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/xfrm_policy.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/xfrm_policy_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/xfrm_policy_test.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/xfrm_state.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/xfrm_state_linux.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/vishvananda/netlink/xfrm_state_test.go (100%) create mode 100644 vendor/golang.org/x/crypto/.gitattributes create mode 100644 vendor/golang.org/x/crypto/.gitignore create mode 100644 vendor/golang.org/x/crypto/AUTHORS create mode 100644 vendor/golang.org/x/crypto/CONTRIBUTING.md create mode 100644 vendor/golang.org/x/crypto/CONTRIBUTORS create mode 100644 vendor/golang.org/x/crypto/LICENSE create mode 100644 vendor/golang.org/x/crypto/PATENTS create mode 100644 vendor/golang.org/x/crypto/README create mode 100644 vendor/golang.org/x/crypto/codereview.cfg create mode 100644 vendor/golang.org/x/crypto/ssh/benchmark_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/buffer.go create mode 100644 vendor/golang.org/x/crypto/ssh/buffer_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/certs.go create mode 100644 vendor/golang.org/x/crypto/ssh/certs_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/channel.go create mode 100644 vendor/golang.org/x/crypto/ssh/cipher.go create mode 100644 vendor/golang.org/x/crypto/ssh/cipher_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/client.go create mode 100644 vendor/golang.org/x/crypto/ssh/client_auth.go create mode 100644 vendor/golang.org/x/crypto/ssh/client_auth_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/client_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/common.go create mode 100644 vendor/golang.org/x/crypto/ssh/connection.go create mode 100644 vendor/golang.org/x/crypto/ssh/doc.go create mode 100644 vendor/golang.org/x/crypto/ssh/example_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/handshake.go create mode 100644 vendor/golang.org/x/crypto/ssh/handshake_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/kex.go create mode 100644 vendor/golang.org/x/crypto/ssh/kex_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/keys.go create mode 100644 vendor/golang.org/x/crypto/ssh/keys_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/mac.go create mode 100644 vendor/golang.org/x/crypto/ssh/mempipe_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/messages.go create mode 100644 vendor/golang.org/x/crypto/ssh/messages_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/mux.go create mode 100644 vendor/golang.org/x/crypto/ssh/mux_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/server.go create mode 100644 vendor/golang.org/x/crypto/ssh/session.go create mode 100644 vendor/golang.org/x/crypto/ssh/session_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/tcpip.go create mode 100644 vendor/golang.org/x/crypto/ssh/tcpip_test.go rename {Godeps/_workspace/src => vendor}/golang.org/x/crypto/ssh/terminal/terminal.go (100%) rename {Godeps/_workspace/src => vendor}/golang.org/x/crypto/ssh/terminal/terminal_test.go (100%) rename {Godeps/_workspace/src => vendor}/golang.org/x/crypto/ssh/terminal/util.go (98%) rename {Godeps/_workspace/src => vendor}/golang.org/x/crypto/ssh/terminal/util_bsd.go (100%) rename {Godeps/_workspace/src => vendor}/golang.org/x/crypto/ssh/terminal/util_linux.go (100%) rename {Godeps/_workspace/src => vendor}/golang.org/x/crypto/ssh/terminal/util_windows.go (100%) create mode 100644 vendor/golang.org/x/crypto/ssh/testdata_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/transport.go create mode 100644 vendor/golang.org/x/crypto/ssh/transport_test.go create mode 100644 vendor/golang.org/x/net/.gitattributes create mode 100644 vendor/golang.org/x/net/.gitignore create mode 100644 vendor/golang.org/x/net/AUTHORS create mode 100644 vendor/golang.org/x/net/CONTRIBUTING.md create mode 100644 vendor/golang.org/x/net/CONTRIBUTORS create mode 100644 vendor/golang.org/x/net/LICENSE create mode 100644 vendor/golang.org/x/net/PATENTS create mode 100644 vendor/golang.org/x/net/README create mode 100644 vendor/golang.org/x/net/codereview.cfg rename {Godeps/_workspace/src => vendor}/golang.org/x/net/context/context.go (99%) rename {Godeps/_workspace/src => vendor}/golang.org/x/net/context/context_test.go (100%) create mode 100644 vendor/golang.org/x/net/context/withtimeout_test.go create mode 100644 vendor/google.golang.org/cloud/.travis.yml create mode 100644 vendor/google.golang.org/cloud/AUTHORS create mode 100644 vendor/google.golang.org/cloud/CONTRIBUTING.md create mode 100644 vendor/google.golang.org/cloud/CONTRIBUTORS create mode 100644 vendor/google.golang.org/cloud/LICENSE create mode 100644 vendor/google.golang.org/cloud/README.md create mode 100644 vendor/google.golang.org/cloud/cloud.go create mode 100644 vendor/google.golang.org/cloud/cloud_test.go rename {Godeps/_workspace/src => vendor}/google.golang.org/cloud/compute/metadata/go13.go (100%) rename {Godeps/_workspace/src => vendor}/google.golang.org/cloud/compute/metadata/metadata.go (100%) rename {Godeps/_workspace/src => vendor}/google.golang.org/cloud/internal/cloud.go (100%) rename {Godeps/_workspace/src => vendor}/google.golang.org/cloud/internal/datastore/datastore_v1.pb.go (100%) rename {Godeps/_workspace/src => vendor}/google.golang.org/cloud/internal/datastore/datastore_v1.proto (100%) rename {Godeps/_workspace/src => vendor}/google.golang.org/cloud/internal/testutil/context.go (100%) create mode 100644 vendor/google.golang.org/cloud/key.json.enc diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json deleted file mode 100644 index 9bbe4474..00000000 --- a/Godeps/Godeps.json +++ /dev/null @@ -1,416 +0,0 @@ -{ - "ImportPath": "github.com/rancher/os", - "GoVersion": "go1.4.1", - "Packages": [ - "./..." - ], - "Deps": [ - { - "ImportPath": "github.com/Sirupsen/logrus", - "Comment": "v0.6.4-13-g0b189e0", - "Rev": "0b189e019aabcec0af8e433b10b3073ad9382b44" - }, - { - "ImportPath": "github.com/codegangsta/cli", - "Comment": "1.2.0-87-g8ce64f1", - "Rev": "8ce64f19ff08029a69d11b7615c9b591245450ad" - }, - { - "ImportPath": "github.com/coreos/coreos-cloudinit/config", - "Comment": "v1.3.2-6-g405c260", - "Rev": "405c2600b19ae77516c967f8ee8ebde5624d3663" - }, - { - "ImportPath": "github.com/coreos/coreos-cloudinit/datasource", - "Comment": "v1.3.2-6-g405c260", - "Rev": "405c2600b19ae77516c967f8ee8ebde5624d3663" - }, - { - "ImportPath": "github.com/coreos/coreos-cloudinit/initialize", - "Comment": "v1.3.2-6-g405c260", - "Rev": "405c2600b19ae77516c967f8ee8ebde5624d3663" - }, - { - "ImportPath": "github.com/coreos/coreos-cloudinit/network", - "Comment": "v1.3.2-6-g405c260", - "Rev": "405c2600b19ae77516c967f8ee8ebde5624d3663" - }, - { - "ImportPath": "github.com/coreos/coreos-cloudinit/pkg", - "Comment": "v1.3.2-6-g405c260", - "Rev": "405c2600b19ae77516c967f8ee8ebde5624d3663" - }, - { - "ImportPath": "github.com/coreos/coreos-cloudinit/system", - "Comment": "v1.3.2-6-g405c260", - "Rev": "405c2600b19ae77516c967f8ee8ebde5624d3663" - }, - { - "ImportPath": "github.com/coreos/go-systemd/dbus", - "Rev": "4fbc5060a317b142e6c7bfbedb65596d5f0ab99b" - }, - { - "ImportPath": "github.com/coreos/yaml", - "Rev": "6b16a5714269b2f70720a45406b1babd947a17ef" - }, - { - "ImportPath": "github.com/docker/distribution", - "Comment": "v2.1.0-rc.0", - "Rev": "a0c63372fad430b7ab08d2763cb7d9e2c512c384" - }, - { - "ImportPath": "github.com/docker/docker/api", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/autogen/dockerversion", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/cliconfig", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/daemon/network", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/graph/tags", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/image", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/opts", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/archive", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/fileutils", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/homedir", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/httputils", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/ioutils", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/jsonmessage", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/mflag", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/mount", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/nat", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/parsers", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/pools", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/promise", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/random", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/reexec", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/stdcopy", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/stringid", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/symlink", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/system", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/tarsum", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/term", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/timeutils", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/tlsconfig", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/ulimit", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/units", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/urlutil", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/useragent", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/pkg/version", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/registry", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/runconfig", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/utils", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/docker/volume", - "Comment": "v1.4.1-5200-gf39987a", - "Rev": "f39987afe8d611407887b3094c03d6ba6a766a67" - }, - { - "ImportPath": "github.com/docker/libcompose/cli/app", - "Rev": "a77147c9909a0ee7055c896826a01cb55352b4d9" - }, - { - "ImportPath": "github.com/docker/libcompose/cli/command", - "Rev": "a77147c9909a0ee7055c896826a01cb55352b4d9" - }, - { - "ImportPath": "github.com/docker/libcompose/cli/docker/app", - "Rev": "a77147c9909a0ee7055c896826a01cb55352b4d9" - }, - { - "ImportPath": "github.com/docker/libcompose/cli/logger", - "Rev": "a77147c9909a0ee7055c896826a01cb55352b4d9" - }, - { - "ImportPath": "github.com/docker/libcompose/docker", - "Rev": "a77147c9909a0ee7055c896826a01cb55352b4d9" - }, - { - "ImportPath": "github.com/docker/libcompose/logger", - "Rev": "a77147c9909a0ee7055c896826a01cb55352b4d9" - }, - { - "ImportPath": "github.com/docker/libcompose/lookup", - "Rev": "a77147c9909a0ee7055c896826a01cb55352b4d9" - }, - { - "ImportPath": "github.com/docker/libcompose/project", - "Rev": "a77147c9909a0ee7055c896826a01cb55352b4d9" - }, - { - "ImportPath": "github.com/docker/libcompose/utils", - "Rev": "a77147c9909a0ee7055c896826a01cb55352b4d9" - }, - { - "ImportPath": "github.com/docker/libcontainer/netlink", - "Comment": "v2.2.1-23-g83a102c", - "Rev": "83a102cc68a09d890cce3b6c2e5c14c49e6373a0" - }, - { - "ImportPath": "github.com/docker/libnetwork/resolvconf", - "Comment": "v0.2-301-g0cc39f8", - "Rev": "0cc39f87276366ef6f22961ef2018d957d662724" - }, - { - "ImportPath": "github.com/docker/libtrust", - "Rev": "9cbd2a1374f46905c68a4eb3694a130610adc62a" - }, - { - "ImportPath": "github.com/docker/machine/log", - "Comment": "v0.3.0-rc1-172-g4a8e93a", - "Rev": "4a8e93ac9bc2ced1c3bc4a43c03fdaa1c2749205" - }, - { - "ImportPath": "github.com/docker/machine/utils", - "Comment": "v0.3.0-rc1-172-g4a8e93a", - "Rev": "4a8e93ac9bc2ced1c3bc4a43c03fdaa1c2749205" - }, - { - "ImportPath": "github.com/flynn/go-shlex", - "Rev": "3f9db97f856818214da2e1057f8ad84803971cff" - }, - { - "ImportPath": "github.com/fsouza/go-dockerclient", - "Rev": "4c9e84441078c14677bad5722161ad09146b0c4e" - }, - { - "ImportPath": "github.com/gorilla/context", - "Rev": "215affda49addc4c8ef7e2534915df2c8c35c6cd" - }, - { - "ImportPath": "github.com/gorilla/mux", - "Rev": "f15e0c49460fd49eebe2bcc8486b05d1bef68d3a" - }, - { - "ImportPath": "github.com/guelfey/go.dbus", - "Rev": "f6a3a2366cc39b8479cadc499d3c735fb10fbdda" - }, - { - "ImportPath": "github.com/j-keck/arping", - "Rev": "4f4d2c8983a18e2c9c63a3f339bc9a998c4557bc" - }, - { - "ImportPath": "github.com/kless/term", - "Rev": "d57d9d2d5be197e12d9dee142d855470d83ce62f" - }, - { - "ImportPath": "github.com/opencontainers/runc/libcontainer/cgroups", - "Comment": "v0.0.2-32-gb40c790", - "Rev": "b40c7901845dcec5950ecb37cb9de178fc2c0604" - }, - { - "ImportPath": "github.com/opencontainers/runc/libcontainer/configs", - "Comment": "v0.0.2-32-gb40c790", - "Rev": "b40c7901845dcec5950ecb37cb9de178fc2c0604" - }, - { - "ImportPath": "github.com/opencontainers/runc/libcontainer/nsenter", - "Comment": "v0.0.2-32-gb40c790", - "Rev": "b40c7901845dcec5950ecb37cb9de178fc2c0604" - }, - { - "ImportPath": "github.com/opencontainers/runc/libcontainer/system", - "Comment": "v0.0.2-32-gb40c790", - "Rev": "b40c7901845dcec5950ecb37cb9de178fc2c0604" - }, - { - "ImportPath": "github.com/opencontainers/runc/libcontainer/user", - "Comment": "v0.0.2-32-gb40c790", - "Rev": "b40c7901845dcec5950ecb37cb9de178fc2c0604" - }, - { - "ImportPath": "github.com/rancher/docker-from-scratch", - "Comment": "v1.9.1", - "Rev": "b7bf6fe5ceafa78b02679ac0d00bf6a5ffbb6194" - }, - { - "ImportPath": "github.com/rancher/netconf", - "Rev": "02925e7cf5a0f0bb0aa5360ee260ef7378e5eff8" - }, - { - "ImportPath": "github.com/ryanuber/go-glob", - "Rev": "0067a9abd927e50aed5190662702f81231413ae0" - }, - { - "ImportPath": "github.com/samalba/dockerclient", - "Rev": "16320a397fb98ba77c00283de77930e37b7a2153" - }, - { - "ImportPath": "github.com/stretchr/testify/assert", - "Comment": "v1.0-17-g089c718", - "Rev": "089c7181b8c728499929ff09b62d3fdd8df8adff" - }, - { - "ImportPath": "github.com/stretchr/testify/require", - "Comment": "v1.0-17-g089c718", - "Rev": "089c7181b8c728499929ff09b62d3fdd8df8adff" - }, - { - "ImportPath": "github.com/vishvananda/netlink", - "Rev": "ae3e7dba57271b4e976c4f91637861ee477135e2" - }, - { - "ImportPath": "golang.org/x/crypto/ssh/terminal", - "Rev": "2f3083f6163ef51179ad42ed523a18c9a1141467" - }, - { - "ImportPath": "golang.org/x/net/context", - "Rev": "84ba27dd5b2d8135e9da1395277f2c9333a2ffda" - }, - { - "ImportPath": "google.golang.org/cloud/compute/metadata", - "Rev": "c97f5f9979a8582f3ab72873a51979619801248b" - }, - { - "ImportPath": "google.golang.org/cloud/internal", - "Rev": "c97f5f9979a8582f3ab72873a51979619801248b" - }, - { - "ImportPath": "gopkg.in/yaml.v2", - "Rev": "a1c4bcb6c278a41992e2f4f0f29a44b4146daa5c" - } - ] -} diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/airbrake/airbrake.go b/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/airbrake/airbrake.go deleted file mode 100644 index 880d21ec..00000000 --- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/airbrake/airbrake.go +++ /dev/null @@ -1,54 +0,0 @@ -package logrus_airbrake - -import ( - "github.com/Sirupsen/logrus" - "github.com/tobi/airbrake-go" -) - -// AirbrakeHook to send exceptions to an exception-tracking service compatible -// with the Airbrake API. You must set: -// * airbrake.Endpoint -// * airbrake.ApiKey -// * airbrake.Environment (only sends exceptions when set to "production") -// -// Before using this hook, to send an error. Entries that trigger an Error, -// Fatal or Panic should now include an "error" field to send to Airbrake. -type AirbrakeHook struct{} - -func (hook *AirbrakeHook) Fire(entry *logrus.Entry) error { - if entry.Data["error"] == nil { - entry.Logger.WithFields(logrus.Fields{ - "source": "airbrake", - "endpoint": airbrake.Endpoint, - }).Warn("Exceptions sent to Airbrake must have an 'error' key with the error") - return nil - } - - err, ok := entry.Data["error"].(error) - if !ok { - entry.Logger.WithFields(logrus.Fields{ - "source": "airbrake", - "endpoint": airbrake.Endpoint, - }).Warn("Exceptions sent to Airbrake must have an `error` key of type `error`") - return nil - } - - airErr := airbrake.Notify(err) - if airErr != nil { - entry.Logger.WithFields(logrus.Fields{ - "source": "airbrake", - "endpoint": airbrake.Endpoint, - "error": airErr, - }).Warn("Failed to send error to Airbrake") - } - - return nil -} - -func (hook *AirbrakeHook) Levels() []logrus.Level { - return []logrus.Level{ - logrus.ErrorLevel, - logrus.FatalLevel, - logrus.PanicLevel, - } -} diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/text_formatter.go b/Godeps/_workspace/src/github.com/Sirupsen/logrus/text_formatter.go deleted file mode 100644 index 78e78893..00000000 --- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/text_formatter.go +++ /dev/null @@ -1,124 +0,0 @@ -package logrus - -import ( - "bytes" - "fmt" - "regexp" - "sort" - "strings" - "time" -) - -const ( - nocolor = 0 - red = 31 - green = 32 - yellow = 33 - blue = 34 -) - -var ( - baseTimestamp time.Time - isTerminal bool - noQuoteNeeded *regexp.Regexp -) - -func init() { - baseTimestamp = time.Now() - isTerminal = IsTerminal() -} - -func miniTS() int { - return int(time.Since(baseTimestamp) / time.Second) -} - -type TextFormatter struct { - // Set to true to bypass checking for a TTY before outputting colors. - ForceColors bool - DisableColors bool - // Set to true to disable timestamp logging (useful when the output - // is redirected to a logging system already adding a timestamp) - DisableTimestamp bool -} - -func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { - - var keys []string - for k := range entry.Data { - keys = append(keys, k) - } - sort.Strings(keys) - - b := &bytes.Buffer{} - - prefixFieldClashes(entry.Data) - - isColored := (f.ForceColors || isTerminal) && !f.DisableColors - - if isColored { - printColored(b, entry, keys) - } else { - if !f.DisableTimestamp { - f.appendKeyValue(b, "time", entry.Time.Format(time.RFC3339)) - } - f.appendKeyValue(b, "level", entry.Level.String()) - f.appendKeyValue(b, "msg", entry.Message) - for _, key := range keys { - f.appendKeyValue(b, key, entry.Data[key]) - } - } - - b.WriteByte('\n') - return b.Bytes(), nil -} - -func printColored(b *bytes.Buffer, entry *Entry, keys []string) { - var levelColor int - switch entry.Level { - case WarnLevel: - levelColor = yellow - case ErrorLevel, FatalLevel, PanicLevel: - levelColor = red - default: - levelColor = blue - } - - levelText := strings.ToUpper(entry.Level.String())[0:4] - - fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, miniTS(), entry.Message) - for _, k := range keys { - v := entry.Data[k] - fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=%v", levelColor, k, v) - } -} - -func needsQuoting(text string) bool { - for _, ch := range text { - if !((ch >= 'a' && ch <= 'z') || - (ch >= 'A' && ch <= 'Z') || - (ch >= '0' && ch < '9') || - ch == '-' || ch == '.') { - return false - } - } - return true -} - -func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key, value interface{}) { - switch value.(type) { - case string: - if needsQuoting(value.(string)) { - fmt.Fprintf(b, "%v=%s ", key, value) - } else { - fmt.Fprintf(b, "%v=%q ", key, value) - } - case error: - if needsQuoting(value.(error).Error()) { - fmt.Fprintf(b, "%v=%s ", key, value) - } else { - fmt.Fprintf(b, "%v=%q ", key, value) - } - default: - fmt.Fprintf(b, "%v=%v ", key, value) - } -} diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/text_formatter_test.go b/Godeps/_workspace/src/github.com/Sirupsen/logrus/text_formatter_test.go deleted file mode 100644 index f604f1b0..00000000 --- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/text_formatter_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package logrus - -import ( - "bytes" - "errors" - - "testing" -) - -func TestQuoting(t *testing.T) { - tf := &TextFormatter{DisableColors: true} - - checkQuoting := func(q bool, value interface{}) { - b, _ := tf.Format(WithField("test", value)) - idx := bytes.Index(b, ([]byte)("test=")) - cont := bytes.Contains(b[idx+5:], []byte{'"'}) - if cont != q { - if q { - t.Errorf("quoting expected for: %#v", value) - } else { - t.Errorf("quoting not expected for: %#v", value) - } - } - } - - checkQuoting(false, "abcd") - checkQuoting(false, "v1.0") - checkQuoting(true, "/foobar") - checkQuoting(true, "x y") - checkQuoting(true, "x,y") - checkQuoting(false, errors.New("invalid")) - checkQuoting(true, errors.New("invalid argument")) -} diff --git a/Godeps/_workspace/src/github.com/docker/distribution/Godeps/Readme b/Godeps/_workspace/src/github.com/docker/distribution/Godeps/Readme deleted file mode 100644 index 4cdaa53d..00000000 --- a/Godeps/_workspace/src/github.com/docker/distribution/Godeps/Readme +++ /dev/null @@ -1,5 +0,0 @@ -This directory tree is generated automatically by godep. - -Please do not edit. - -See https://github.com/tools/godep for more information. diff --git a/Godeps/_workspace/src/github.com/docker/docker/autogen/dockerversion/dockerversion.go b/Godeps/_workspace/src/github.com/docker/docker/autogen/dockerversion/dockerversion.go deleted file mode 100644 index 1c2d3254..00000000 --- a/Godeps/_workspace/src/github.com/docker/docker/autogen/dockerversion/dockerversion.go +++ /dev/null @@ -1,12 +0,0 @@ -// AUTOGENERATED FILE; see ./hack/make/.go-autogen -package dockerversion - -var ( - GITCOMMIT string = "" - VERSION string = "" - BUILDTIME string = "" - - IAMSTATIC string = "true" - INITSHA1 string = "" - INITPATH string = "" -) diff --git a/Godeps/_workspace/src/github.com/docker/libcompose/docker/container.go b/Godeps/_workspace/src/github.com/docker/libcompose/docker/container.go deleted file mode 100644 index d112c5bd..00000000 --- a/Godeps/_workspace/src/github.com/docker/libcompose/docker/container.go +++ /dev/null @@ -1,508 +0,0 @@ -package docker - -import ( - "bufio" - "fmt" - "math" - "strings" - - "github.com/Sirupsen/logrus" - "github.com/docker/docker/cliconfig" - "github.com/docker/docker/graph/tags" - "github.com/docker/docker/pkg/parsers" - "github.com/docker/docker/pkg/stdcopy" - "github.com/docker/docker/registry" - "github.com/docker/docker/utils" - "github.com/docker/libcompose/logger" - "github.com/docker/libcompose/project" - "github.com/samalba/dockerclient" -) - -type Container struct { - project.EmptyService - - name string - service *Service - client dockerclient.Client -} - -func NewContainer(client dockerclient.Client, name string, service *Service) *Container { - return &Container{ - client: client, - name: name, - service: service, - } -} - -func (c *Container) findExisting() (*dockerclient.Container, error) { - return GetContainerByName(c.client, c.name) -} - -func (c *Container) findInfo() (*dockerclient.ContainerInfo, error) { - container, err := c.findExisting() - if err != nil { - return nil, err - } - - return c.client.InspectContainer(container.Id) -} - -func (c *Container) Info() (project.Info, error) { - container, err := c.findExisting() - if err != nil { - return nil, err - } - - result := project.Info{} - - result = append(result, project.InfoPart{Key: "Name", Value: name(container.Names)}) - result = append(result, project.InfoPart{Key: "Command", Value: container.Command}) - result = append(result, project.InfoPart{Key: "State", Value: container.Status}) - result = append(result, project.InfoPart{Key: "Ports", Value: portString(container.Ports)}) - - return result, nil -} - -func portString(ports []dockerclient.Port) string { - result := []string{} - - for _, port := range ports { - if port.PublicPort > 0 { - result = append(result, fmt.Sprintf("%s:%d->%d/%s", port.IP, port.PublicPort, port.PrivatePort, port.Type)) - } else { - result = append(result, fmt.Sprintf("%d/%s", port.PrivatePort, port.Type)) - } - } - - return strings.Join(result, ", ") -} - -func name(names []string) string { - max := math.MaxInt32 - var current string - - for _, v := range names { - if len(v) < max { - max = len(v) - current = v - } - } - - return current[1:] -} - -func (c *Container) Rebuild(imageName string) (*dockerclient.Container, error) { - info, err := c.findInfo() - if err != nil { - return nil, err - } else if info == nil { - return nil, fmt.Errorf("Can not find container to rebuild for service: %s", c.service.Name()) - } - - hash := info.Config.Labels[HASH.Str()] - if hash == "" { - return nil, fmt.Errorf("Failed to find hash on old container: %s", info.Name) - } - - name := info.Name[1:] - new_name := fmt.Sprintf("%s_%s", name, info.Id[:12]) - deleted := false - logrus.Debugf("Renaming %s => %s", name, new_name) - if err := c.client.RenameContainer(name, new_name); err != nil { - logrus.Errorf("Rename failed, deleting %s", name) - if err := c.client.RemoveContainer(info.Id, true, false); err != nil { - return nil, err - } - deleted = true - } - - newContainer, err := c.createContainer(imageName, info.Id) - if err != nil { - return nil, err - } - logrus.Debugf("Created replacement container %s", newContainer.Id) - - if !deleted { - if err := c.client.RemoveContainer(info.Id, true, false); err != nil { - logrus.Errorf("Failed to remove old container %s", c.name) - return nil, err - } - logrus.Debugf("Removed old container %s %s", c.name, info.Id) - } - - return newContainer, nil -} - -func (c *Container) Create(imageName string) (*dockerclient.Container, error) { - container, err := c.findExisting() - if err != nil { - return nil, err - } - - if container == nil { - container, err = c.createContainer(imageName, "") - if err != nil { - return nil, err - } - c.service.context.Project.Notify(project.CONTAINER_CREATED, c.service.Name(), map[string]string{ - "name": c.Name(), - }) - } - - return container, err -} - -func (c *Container) Down() error { - return c.withContainer(func(container *dockerclient.Container) error { - return c.client.StopContainer(container.Id, c.service.context.Timeout) - }) -} - -func (c *Container) Kill() error { - return c.withContainer(func(container *dockerclient.Container) error { - return c.client.KillContainer(container.Id, c.service.context.Signal) - }) -} - -func (c *Container) Delete() error { - container, err := c.findExisting() - if err != nil || container == nil { - return err - } - - info, err := c.client.InspectContainer(container.Id) - if err != nil { - return err - } - - if info.State.Running { - err := c.client.StopContainer(container.Id, c.service.context.Timeout) - if err != nil { - return err - } - } - - return c.client.RemoveContainer(container.Id, true, false) -} - -func (c *Container) Up(imageName string) error { - var err error - - defer func() { - if err == nil && c.service.context.Log { - go c.Log() - } - }() - - container, err := c.Create(imageName) - if err != nil { - return err - } - - info, err := c.client.InspectContainer(container.Id) - if err != nil { - return err - } - - if !info.State.Running { - logrus.Debugf("Starting container: %s", container.Id) - if err := c.client.StartContainer(container.Id, nil); err != nil { - return err - } - - c.service.context.Project.Notify(project.CONTAINER_STARTED, c.service.Name(), map[string]string{ - "name": c.Name(), - }) - } - - return nil -} - -func (c *Container) OutOfSync(imageName string) (bool, error) { - info, err := c.findInfo() - if err != nil || info == nil { - return false, err - } - - if info.Config.Image != imageName { - logrus.Debugf("Images for %s do not match %s!=%s", c.name, info.Config.Image, imageName) - return true, nil - } - - if info.Config.Labels[HASH.Str()] != c.getHash() { - logrus.Debugf("Hashes for %s do not match %s!=%s", c.name, info.Config.Labels[HASH.Str()], c.getHash()) - return true, nil - } - - image, err := c.client.InspectImage(info.Config.Image) - if err != nil && (err.Error() == "Not found" || image == nil) { - logrus.Debugf("Image %s do not exist, do not know if it's out of sync", info.Config.Image) - return false, nil - } else if err != nil { - return false, err - } - - logrus.Debugf("Checking existing image name vs id: %s == %s", image.Id, info.Image) - return image.Id != info.Image, err -} - -func (c *Container) getHash() string { - return project.GetServiceHash(c.service.Name(), *c.service.Config()) -} - -func (c *Container) createContainer(imageName, oldContainer string) (*dockerclient.Container, error) { - config, err := ConvertToApi(c.service.serviceConfig) - if err != nil { - return nil, err - } - - config.Image = imageName - - if config.Labels == nil { - config.Labels = map[string]string{} - } - - config.Labels[NAME.Str()] = c.name - config.Labels[SERVICE.Str()] = c.service.name - config.Labels[PROJECT.Str()] = c.service.context.Project.Name - config.Labels[HASH.Str()] = c.getHash() - - err = c.populateAdditionalHostConfig(&config.HostConfig) - if err != nil { - return nil, err - } - - if oldContainer != "" { - config.HostConfig.VolumesFrom = append(config.HostConfig.VolumesFrom, oldContainer) - } - - logrus.Debugf("Creating container %s %#v", c.name, config) - - id, err := c.client.CreateContainer(config, c.name) - if err != nil && err.Error() == "Not found" { - logrus.Debugf("Not Found, pulling image %s", config.Image) - if err = c.pull(config.Image); err != nil { - return nil, err - } - if id, err = c.client.CreateContainer(config, c.name); err != nil { - return nil, err - } - } - - if err != nil { - logrus.Debugf("Failed to create container %s: %v", c.name, err) - return nil, err - } - - return GetContainerById(c.client, id) -} - -func (c *Container) populateAdditionalHostConfig(hostConfig *dockerclient.HostConfig) error { - links := map[string]string{} - - for _, link := range c.service.DependentServices() { - if _, ok := c.service.context.Project.Configs[link.Target]; !ok { - continue - } - - service, err := c.service.context.Project.CreateService(link.Target) - if err != nil { - return err - } - - containers, err := service.Containers() - if err != nil { - return err - } - - if link.Type == project.REL_TYPE_LINK { - c.addLinks(links, service, link, containers) - } else if link.Type == project.REL_TYPE_IPC_NAMESPACE { - hostConfig, err = c.addIpc(hostConfig, service, containers) - } else if link.Type == project.REL_TYPE_NET_NAMESPACE { - hostConfig, err = c.addNetNs(hostConfig, service, containers) - } - - if err != nil { - return err - } - } - - hostConfig.Links = []string{} - for k, v := range links { - hostConfig.Links = append(hostConfig.Links, strings.Join([]string{v, k}, ":")) - } - for _, v := range c.service.Config().ExternalLinks { - hostConfig.Links = append(hostConfig.Links, v) - } - - return nil -} - -func (c *Container) addLinks(links map[string]string, service project.Service, rel project.ServiceRelationship, containers []project.Container) { - for _, container := range containers { - if _, ok := links[rel.Alias]; !ok { - links[rel.Alias] = container.Name() - } - - links[container.Name()] = container.Name() - } -} - -func (c *Container) addIpc(config *dockerclient.HostConfig, service project.Service, containers []project.Container) (*dockerclient.HostConfig, error) { - if len(containers) == 0 { - return nil, fmt.Errorf("Failed to find container for IPC %v", c.service.Config().Ipc) - } - - id, err := containers[0].Id() - if err != nil { - return nil, err - } - - config.IpcMode = "container:" + id - return config, nil -} - -func (c *Container) addNetNs(config *dockerclient.HostConfig, service project.Service, containers []project.Container) (*dockerclient.HostConfig, error) { - if len(containers) == 0 { - return nil, fmt.Errorf("Failed to find container for networks ns %v", c.service.Config().Net) - } - - id, err := containers[0].Id() - if err != nil { - return nil, err - } - - config.NetworkMode = "container:" + id - return config, nil -} - -func (c *Container) Id() (string, error) { - container, err := c.findExisting() - if container == nil { - return "", err - } else { - return container.Id, err - } -} - -func (c *Container) Name() string { - return c.name -} - -func (c *Container) Pull() error { - return c.pull(c.service.serviceConfig.Image) -} - -func (c *Container) Restart() error { - container, err := c.findExisting() - if err != nil || container == nil { - return err - } - - return c.client.RestartContainer(container.Id, c.service.context.Timeout) -} - -func (c *Container) Log() error { - container, err := c.findExisting() - if container == nil || err != nil { - return err - } - - info, err := c.client.InspectContainer(container.Id) - if info == nil || err != nil { - return err - } - - l := c.service.context.LoggerFactory.Create(c.name) - - output, err := c.client.ContainerLogs(container.Id, &dockerclient.LogOptions{ - Follow: true, - Stdout: true, - Stderr: true, - Tail: 10, - }) - if err != nil { - return err - } - - if info.Config.Tty { - scanner := bufio.NewScanner(output) - for scanner.Scan() { - l.Out([]byte(scanner.Text() + "\n")) - } - return scanner.Err() - } else { - _, err := stdcopy.StdCopy(&logger.LoggerWrapper{ - Logger: l, - }, &logger.LoggerWrapper{ - Err: true, - Logger: l, - }, output) - return err - } -} - -func (c *Container) pull(image string) error { - return PullImage(c.client, c.service, image) -} - -func PullImage(client dockerclient.Client, service *Service, image string) error { - taglessRemote, tag := parsers.ParseRepositoryTag(image) - if tag == "" { - image = utils.ImageReference(taglessRemote, tags.DEFAULTTAG) - } - - repoInfo, err := registry.ParseRepositoryInfo(taglessRemote) - if err != nil { - return err - } - - authConfig := cliconfig.AuthConfig{} - if service.context.ConfigFile != nil && repoInfo != nil && repoInfo.Index != nil { - authConfig = registry.ResolveAuthConfig(service.context.ConfigFile, repoInfo.Index) - } - - err = client.PullImage(image, &dockerclient.AuthConfig{ - Username: authConfig.Username, - Password: authConfig.Password, - Email: authConfig.Email, - }) - - if err != nil { - logrus.Errorf("Failed to pull image %s: %v", image, err) - } - - return err -} - -func (c *Container) withContainer(action func(*dockerclient.Container) error) error { - container, err := c.findExisting() - if err != nil { - return err - } - - if container != nil { - return action(container) - } - - return nil -} - -func (c *Container) Port(port string) (string, error) { - info, err := c.findInfo() - if err != nil { - return "", err - } - - if bindings, ok := info.NetworkSettings.Ports[port]; ok { - result := []string{} - for _, binding := range bindings { - result = append(result, binding.HostIp+":"+binding.HostPort) - } - - return strings.Join(result, "\n"), nil - } else { - return "", nil - } -} diff --git a/Godeps/_workspace/src/github.com/docker/libcompose/docker/convert.go b/Godeps/_workspace/src/github.com/docker/libcompose/docker/convert.go deleted file mode 100644 index 82aa04f2..00000000 --- a/Godeps/_workspace/src/github.com/docker/libcompose/docker/convert.go +++ /dev/null @@ -1,141 +0,0 @@ -package docker - -import ( - "strings" - - "github.com/Sirupsen/logrus" - "github.com/docker/docker/pkg/nat" - "github.com/docker/docker/runconfig" - "github.com/docker/libcompose/project" - "github.com/docker/libcompose/utils" - "github.com/samalba/dockerclient" -) - -func Filter(vs []string, f func(string) bool) []string { - r := make([]string, 0, len(vs)) - for _, v := range vs { - if f(v) { - r = append(r, v) - } - } - return r -} - -func isBind(s string) bool { - return strings.ContainsRune(s, ':') -} - -func isVolume(s string) bool { - return !isBind(s) -} - -func ConvertToApi(c *project.ServiceConfig) (*dockerclient.ContainerConfig, error) { - config, hostConfig, err := Convert(c) - if err != nil { - return nil, err - } - - var result dockerclient.ContainerConfig - err = utils.ConvertByJSON(config, &result) - if err != nil { - logrus.Errorf("Failed to convert config to API structure: %v\n%#v", err, config) - return nil, err - } - - err = utils.ConvertByJSON(hostConfig, &result.HostConfig) - if err != nil { - logrus.Errorf("Failed to convert hostConfig to API structure: %v\n%#v", err, hostConfig) - } - return &result, err -} - -func Convert(c *project.ServiceConfig) (*runconfig.Config, *runconfig.HostConfig, error) { - vs := Filter(c.Volumes, isVolume) - - volumes := make(map[string]struct{}, len(vs)) - for _, v := range vs { - volumes[v] = struct{}{} - } - - ports, binding, err := nat.ParsePortSpecs(c.Ports) - if err != nil { - return nil, nil, err - } - restart, err := runconfig.ParseRestartPolicy(c.Restart) - if err != nil { - return nil, nil, err - } - - if exposedPorts, _, err := nat.ParsePortSpecs(c.Expose); err != nil { - return nil, nil, err - } else { - for k, v := range exposedPorts { - ports[k] = v - } - } - - deviceMappings, err := parseDevices(c.Devices) - if err != nil { - return nil, nil, err - } - - config := &runconfig.Config{ - Entrypoint: runconfig.NewEntrypoint(c.Entrypoint.Slice()...), - Hostname: c.Hostname, - Domainname: c.DomainName, - User: c.User, - Env: c.Environment.Slice(), - Cmd: runconfig.NewCommand(c.Command.Slice()...), - Image: c.Image, - Labels: c.Labels.MapParts(), - ExposedPorts: ports, - Tty: c.Tty, - OpenStdin: c.StdinOpen, - WorkingDir: c.WorkingDir, - VolumeDriver: c.VolumeDriver, - Volumes: volumes, - } - host_config := &runconfig.HostConfig{ - VolumesFrom: c.VolumesFrom, - CapAdd: runconfig.NewCapList(c.CapAdd), - CapDrop: runconfig.NewCapList(c.CapDrop), - CPUShares: c.CpuShares, - CpusetCpus: c.CpuSet, - ExtraHosts: c.ExtraHosts, - Privileged: c.Privileged, - Binds: Filter(c.Volumes, isBind), - Devices: deviceMappings, - DNS: c.Dns.Slice(), - DNSSearch: c.DnsSearch.Slice(), - LogConfig: runconfig.LogConfig{ - Type: c.LogDriver, - Config: c.LogOpt, - }, - Memory: c.MemLimit, - MemorySwap: c.MemSwapLimit, - NetworkMode: runconfig.NetworkMode(c.Net), - ReadonlyRootfs: c.ReadOnly, - PidMode: runconfig.PidMode(c.Pid), - UTSMode: runconfig.UTSMode(c.Uts), - IpcMode: runconfig.IpcMode(c.Ipc), - PortBindings: binding, - RestartPolicy: restart, - SecurityOpt: c.SecurityOpt, - } - - return config, host_config, nil -} - -func parseDevices(devices []string) ([]runconfig.DeviceMapping, error) { - // parse device mappings - deviceMappings := []runconfig.DeviceMapping{} - for _, device := range devices { - deviceMapping, err := runconfig.ParseDevice(device) - if err != nil { - return nil, err - } - deviceMappings = append(deviceMappings, deviceMapping) - } - - return deviceMappings, nil -} diff --git a/Godeps/_workspace/src/github.com/docker/libcompose/docker/functions.go b/Godeps/_workspace/src/github.com/docker/libcompose/docker/functions.go deleted file mode 100644 index ccee5077..00000000 --- a/Godeps/_workspace/src/github.com/docker/libcompose/docker/functions.go +++ /dev/null @@ -1,49 +0,0 @@ -package docker - -import "github.com/samalba/dockerclient" - -func GetContainersByFilter(client dockerclient.Client, filter ...string) ([]dockerclient.Container, error) { - filterResult := "" - - for _, value := range filter { - if filterResult == "" { - filterResult = value - } else { - filterResult = And(filterResult, value) - } - } - - return client.ListContainers(true, false, filterResult) -} - -func GetContainerByName(client dockerclient.Client, name string) (*dockerclient.Container, error) { - containers, err := client.ListContainers(true, false, NAME.Eq(name)) - if err != nil { - return nil, err - } - - if len(containers) == 0 { - return nil, nil - } - - return &containers[0], nil -} - -func GetContainerById(client dockerclient.Client, id string) (*dockerclient.Container, error) { - containers, err := client.ListContainers(true, false, "") - if err != nil { - return nil, err - } - - if len(containers) == 0 { - return nil, nil - } - - for _, c := range containers { - if c.Id == id { - return &c, nil - } - } - - return nil, nil -} diff --git a/Godeps/_workspace/src/github.com/docker/libcompose/docker/labels.go b/Godeps/_workspace/src/github.com/docker/libcompose/docker/labels.go deleted file mode 100644 index 49b7a551..00000000 --- a/Godeps/_workspace/src/github.com/docker/libcompose/docker/labels.go +++ /dev/null @@ -1,47 +0,0 @@ -package docker - -import ( - "encoding/json" - - "github.com/docker/libcompose/utils" -) - -type Label string - -const ( - NAME = Label("io.docker.compose.name") - PROJECT = Label("io.docker.compose.project") - SERVICE = Label("io.docker.compose.service") - HASH = Label("io.docker.compose.config-hash") - REBUILD = Label("io.docker.compose.rebuild") -) - -func (f Label) Eq(value string) string { - return utils.LabelFilter(string(f), value) -} - -func And(left, right string) string { - leftMap := map[string][]string{} - rightMap := map[string][]string{} - - // Ignore errors - json.Unmarshal([]byte(left), &leftMap) - json.Unmarshal([]byte(right), &rightMap) - - for k, v := range rightMap { - existing, ok := leftMap[k] - if ok { - leftMap[k] = append(existing, v...) - } else { - leftMap[k] = v - } - } - - result, _ := json.Marshal(leftMap) - - return string(result) -} - -func (f Label) Str() string { - return string(f) -} diff --git a/Godeps/_workspace/src/github.com/docker/libcompose/logger/null.go b/Godeps/_workspace/src/github.com/docker/libcompose/logger/null.go deleted file mode 100644 index 07f7bcf6..00000000 --- a/Godeps/_workspace/src/github.com/docker/libcompose/logger/null.go +++ /dev/null @@ -1,14 +0,0 @@ -package logger - -type NullLogger struct { -} - -func (n *NullLogger) Out(_ []byte) { -} - -func (n *NullLogger) Err(_ []byte) { -} - -func (n *NullLogger) Create(_ string) Logger { - return &NullLogger{} -} diff --git a/Godeps/_workspace/src/github.com/docker/libcompose/logger/types.go b/Godeps/_workspace/src/github.com/docker/libcompose/logger/types.go deleted file mode 100644 index 9a6868a4..00000000 --- a/Godeps/_workspace/src/github.com/docker/libcompose/logger/types.go +++ /dev/null @@ -1,24 +0,0 @@ -package logger - -type Factory interface { - Create(name string) Logger -} - -type Logger interface { - Out(bytes []byte) - Err(bytes []byte) -} - -type LoggerWrapper struct { - Err bool - Logger Logger -} - -func (l *LoggerWrapper) Write(bytes []byte) (int, error) { - if l.Err { - l.Logger.Err(bytes) - } else { - l.Logger.Out(bytes) - } - return len(bytes), nil -} diff --git a/Godeps/_workspace/src/github.com/docker/libcompose/project/empty.go b/Godeps/_workspace/src/github.com/docker/libcompose/project/empty.go deleted file mode 100644 index 431d9758..00000000 --- a/Godeps/_workspace/src/github.com/docker/libcompose/project/empty.go +++ /dev/null @@ -1,56 +0,0 @@ -package project - -type EmptyService struct { -} - -func (e *EmptyService) Create() error { - return nil -} - -func (e *EmptyService) Build() error { - return nil -} - -func (e *EmptyService) Up() error { - return nil -} - -func (e *EmptyService) Start() error { - return nil -} - -func (e *EmptyService) Down() error { - return nil -} - -func (e *EmptyService) Delete() error { - return nil -} - -func (e *EmptyService) Restart() error { - return nil -} - -func (e *EmptyService) Log() error { - return nil -} - -func (e *EmptyService) Pull() error { - return nil -} - -func (e *EmptyService) Kill() error { - return nil -} - -func (e *EmptyService) Containers() ([]Container, error) { - return []Container{}, nil -} - -func (e *EmptyService) Scale(count int) error { - return nil -} - -func (e *EmptyService) Info() (InfoSet, error) { - return InfoSet{}, nil -} diff --git a/Godeps/_workspace/src/github.com/docker/libcompose/project/listener.go b/Godeps/_workspace/src/github.com/docker/libcompose/project/listener.go deleted file mode 100644 index 1b98c8b1..00000000 --- a/Godeps/_workspace/src/github.com/docker/libcompose/project/listener.go +++ /dev/null @@ -1,75 +0,0 @@ -package project - -import ( - "bytes" - - "github.com/Sirupsen/logrus" -) - -var ( - infoEvents = map[Event]bool{ - PROJECT_DELETE_DONE: true, - PROJECT_DELETE_START: true, - PROJECT_DOWN_DONE: true, - PROJECT_DOWN_START: true, - PROJECT_RESTART_DONE: true, - PROJECT_RESTART_START: true, - PROJECT_UP_DONE: true, - PROJECT_UP_START: true, - SERVICE_DELETE_START: true, - SERVICE_DELETE: true, - SERVICE_DOWN_START: true, - SERVICE_DOWN: true, - SERVICE_RESTART_START: true, - SERVICE_RESTART: true, - SERVICE_UP_START: true, - SERVICE_UP: true, - } -) - -type defaultListener struct { - project *Project - listenChan chan ProjectEvent - upCount int -} - -func NewDefaultListener(p *Project) chan<- ProjectEvent { - l := defaultListener{ - listenChan: make(chan ProjectEvent), - project: p, - } - go l.start() - return l.listenChan -} - -func (d *defaultListener) start() { - for event := range d.listenChan { - buffer := bytes.NewBuffer(nil) - if event.Data != nil { - for k, v := range event.Data { - if buffer.Len() > 0 { - buffer.WriteString(", ") - } - buffer.WriteString(k) - buffer.WriteString("=") - buffer.WriteString(v) - } - } - - if event.Event == SERVICE_UP { - d.upCount++ - } - - logf := logrus.Debugf - - if infoEvents[event.Event] { - logf = logrus.Infof - } - - if event.ServiceName == "" { - logf("Project [%s]: %s %s", d.project.Name, event.Event, buffer.Bytes()) - } else { - logf("[%d/%d] [%s]: %s %s", d.upCount, len(d.project.Configs), event.ServiceName, event.Event, buffer.Bytes()) - } - } -} diff --git a/Godeps/_workspace/src/github.com/docker/libcompose/project/project_test.go b/Godeps/_workspace/src/github.com/docker/libcompose/project/project_test.go deleted file mode 100644 index ff4f52cb..00000000 --- a/Godeps/_workspace/src/github.com/docker/libcompose/project/project_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package project - -import ( - "fmt" - "testing" -) - -func TestEventEquality(t *testing.T) { - if fmt.Sprintf("%s", SERVICE_START) != "Started" || - fmt.Sprintf("%v", SERVICE_START) != "Started" { - t.Fatalf("SERVICE_START String() doesn't work: %s %v", SERVICE_START, SERVICE_START) - } - - if fmt.Sprintf("%s", SERVICE_START) != fmt.Sprintf("%s", SERVICE_UP) { - t.Fatal("Event messages do not match") - } - - if SERVICE_START == SERVICE_UP { - t.Fatal("Events match") - } -} diff --git a/Godeps/_workspace/src/github.com/docker/libcompose/project/types.go b/Godeps/_workspace/src/github.com/docker/libcompose/project/types.go deleted file mode 100644 index e8fb0645..00000000 --- a/Godeps/_workspace/src/github.com/docker/libcompose/project/types.go +++ /dev/null @@ -1,271 +0,0 @@ -package project - -import "fmt" - -type Event int - -const ( - CONTAINER_ID = "container_id" - - NO_EVENT = Event(iota) - - CONTAINER_CREATED = Event(iota) - CONTAINER_STARTED = Event(iota) - - SERVICE_ADD = Event(iota) - SERVICE_UP_START = Event(iota) - SERVICE_UP_IGNORED = Event(iota) - SERVICE_UP = Event(iota) - SERVICE_CREATE_START = Event(iota) - SERVICE_CREATE = Event(iota) - SERVICE_DELETE_START = Event(iota) - SERVICE_DELETE = Event(iota) - SERVICE_DOWN_START = Event(iota) - SERVICE_DOWN = Event(iota) - SERVICE_RESTART_START = Event(iota) - SERVICE_RESTART = Event(iota) - SERVICE_PULL_START = Event(iota) - SERVICE_PULL = Event(iota) - SERVICE_KILL_START = Event(iota) - SERVICE_KILL = Event(iota) - SERVICE_START_START = Event(iota) - SERVICE_START = Event(iota) - SERVICE_BUILD_START = Event(iota) - SERVICE_BUILD = Event(iota) - - PROJECT_DOWN_START = Event(iota) - PROJECT_DOWN_DONE = Event(iota) - PROJECT_CREATE_START = Event(iota) - PROJECT_CREATE_DONE = Event(iota) - PROJECT_UP_START = Event(iota) - PROJECT_UP_DONE = Event(iota) - PROJECT_DELETE_START = Event(iota) - PROJECT_DELETE_DONE = Event(iota) - PROJECT_RESTART_START = Event(iota) - PROJECT_RESTART_DONE = Event(iota) - PROJECT_RELOAD = Event(iota) - PROJECT_RELOAD_TRIGGER = Event(iota) - PROJECT_KILL_START = Event(iota) - PROJECT_KILL_DONE = Event(iota) - PROJECT_START_START = Event(iota) - PROJECT_START_DONE = Event(iota) - PROJECT_BUILD_START = Event(iota) - PROJECT_BUILD_DONE = Event(iota) -) - -func (e Event) String() string { - var m string - switch e { - case CONTAINER_CREATED: - m = "Created container" - case CONTAINER_STARTED: - m = "Started container" - - case SERVICE_ADD: - m = "Adding" - case SERVICE_UP_START: - m = "Starting" - case SERVICE_UP_IGNORED: - m = "Ignoring" - case SERVICE_UP: - m = "Started" - case SERVICE_CREATE_START: - m = "Creating" - case SERVICE_CREATE: - m = "Created" - case SERVICE_DELETE_START: - m = "Deleting" - case SERVICE_DELETE: - m = "Deleted" - case SERVICE_DOWN_START: - m = "Stopping" - case SERVICE_DOWN: - m = "Stopped" - case SERVICE_RESTART_START: - m = "Restarting" - case SERVICE_RESTART: - m = "Restarted" - case SERVICE_PULL_START: - m = "Pulling" - case SERVICE_PULL: - m = "Pulled" - case SERVICE_KILL_START: - m = "Killing" - case SERVICE_KILL: - m = "Killed" - case SERVICE_START_START: - m = "Starting" - case SERVICE_START: - m = "Started" - case SERVICE_BUILD_START: - m = "Building" - case SERVICE_BUILD: - m = "Built" - - case PROJECT_DOWN_START: - m = "Stopping project" - case PROJECT_DOWN_DONE: - m = "Project stopped" - case PROJECT_CREATE_START: - m = "Creating project" - case PROJECT_CREATE_DONE: - m = "Project created" - case PROJECT_UP_START: - m = "Starting project" - case PROJECT_UP_DONE: - m = "Project started" - case PROJECT_DELETE_START: - m = "Deleting project" - case PROJECT_DELETE_DONE: - m = "Project deleted" - case PROJECT_RESTART_START: - m = "Restarting project" - case PROJECT_RESTART_DONE: - m = "Project restarted" - case PROJECT_RELOAD: - m = "Reloading project" - case PROJECT_RELOAD_TRIGGER: - m = "Triggering project reload" - case PROJECT_KILL_START: - m = "Killing project" - case PROJECT_KILL_DONE: - m = "Project killed" - case PROJECT_START_START: - m = "Starting project" - case PROJECT_START_DONE: - m = "Project started" - case PROJECT_BUILD_START: - m = "Building project" - case PROJECT_BUILD_DONE: - m = "Project built" - } - - if m == "" { - m = fmt.Sprintf("Event: %d", int(e)) - } - - return m -} - -type InfoPart struct { - Key, Value string -} - -type InfoSet []Info -type Info []InfoPart - -type ServiceConfig struct { - Build string `yaml:"build,omitempty"` - CapAdd []string `yaml:"cap_add,omitempty"` - CapDrop []string `yaml:"cap_drop,omitempty"` - CpuSet string `yaml:"cpuset,omitempty"` - CpuShares int64 `yaml:"cpu_shares,omitempty"` - Command Command `yaml:"command"` // omitempty breaks serialization! - Devices []string `yaml:"devices,omitempty"` - Dns Stringorslice `yaml:"dns"` // omitempty breaks serialization! - DnsSearch Stringorslice `yaml:"dns_search"` // omitempty breaks serialization! - Dockerfile string `yaml:"dockerfile,omitempty"` - DomainName string `yaml:"domainname,omitempty"` - Entrypoint Command `yaml:"entrypoint"` // omitempty breaks serialization! - EnvFile Stringorslice `yaml:"env_file"` // omitempty breaks serialization! - Environment MaporEqualSlice `yaml:"environment"` // omitempty breaks serialization! - Hostname string `yaml:"hostname,omitempty"` - Image string `yaml:"image,omitempty"` - Labels SliceorMap `yaml:"labels"` // omitempty breaks serialization! - Links MaporColonSlice `yaml:"links"` // omitempty breaks serialization! - LogDriver string `yaml:"log_driver,omitempty"` - MemLimit int64 `yaml:"mem_limit,omitempty"` - MemSwapLimit int64 `yaml:"memswap_limit,omitempty"` - Name string `yaml:"name,omitempty"` - Net string `yaml:"net,omitempty"` - Pid string `yaml:"pid,omitempty"` - Uts string `yaml:"uts,omitempty"` - Ipc string `yaml:"ipc,omitempty"` - Ports []string `yaml:"ports,omitempty"` - Privileged bool `yaml:"privileged,omitempty"` - Restart string `yaml:"restart,omitempty"` - ReadOnly bool `yaml:"read_only,omitempty"` - StdinOpen bool `yaml:"stdin_open,omitempty"` - SecurityOpt []string `yaml:"security_opt,omitempty"` - Tty bool `yaml:"tty,omitempty"` - User string `yaml:"user,omitempty"` - VolumeDriver string `yaml:"volume_driver,omitempty"` - Volumes []string `yaml:"volumes,omitempty"` - VolumesFrom []string `yaml:"volumes_from,omitempty"` - WorkingDir string `yaml:"working_dir,omitempty"` - Expose []string `yaml:"expose,omitempty"` - ExternalLinks []string `yaml:"external_links,omitempty"` - LogOpt map[string]string `yaml:"log_opt,omitempty"` - ExtraHosts []string `yaml:"extra_hosts,omitempty"` -} - -type EnvironmentLookup interface { - Lookup(key, serviceName string, config *ServiceConfig) []string -} - -type ConfigLookup interface { - Lookup(file, relativeTo string) ([]byte, string, error) -} - -type Project struct { - Name string - Configs map[string]*ServiceConfig - File string - ReloadCallback func() error - context *Context - reload []string - upCount int - listeners []chan<- ProjectEvent - hasListeners bool -} - -type Service interface { - Info() (InfoSet, error) - Name() string - Build() error - Create() error - Up() error - Start() error - Down() error - Delete() error - Restart() error - Log() error - Pull() error - Kill() error - Config() *ServiceConfig - DependentServices() []ServiceRelationship - Containers() ([]Container, error) - Scale(count int) error -} - -type Container interface { - Id() (string, error) - Name() string - Port(port string) (string, error) -} - -type ServiceFactory interface { - Create(project *Project, name string, serviceConfig *ServiceConfig) (Service, error) -} - -type ServiceRelationshipType string - -const REL_TYPE_LINK = ServiceRelationshipType("") -const REL_TYPE_NET_NAMESPACE = ServiceRelationshipType("netns") -const REL_TYPE_IPC_NAMESPACE = ServiceRelationshipType("ipc") -const REL_TYPE_VOLUMES_FROM = ServiceRelationshipType("volumesFrom") - -type ServiceRelationship struct { - Target, Alias string - Type ServiceRelationshipType - Optional bool -} - -func NewServiceRelationship(nameAlias string, relType ServiceRelationshipType) ServiceRelationship { - name, alias := NameAlias(nameAlias) - return ServiceRelationship{ - Target: name, - Alias: alias, - Type: relType, - } -} diff --git a/Godeps/_workspace/src/github.com/docker/libcompose/project/types_yaml.go b/Godeps/_workspace/src/github.com/docker/libcompose/project/types_yaml.go deleted file mode 100644 index 4d071b0c..00000000 --- a/Godeps/_workspace/src/github.com/docker/libcompose/project/types_yaml.go +++ /dev/null @@ -1,250 +0,0 @@ -package project - -import ( - "strings" - - "github.com/flynn/go-shlex" -) - -type Stringorslice struct { - parts []string -} - -func (s Stringorslice) MarshalYAML() (interface{}, error) { - return s.parts, nil -} - -func (s *Stringorslice) UnmarshalYAML(unmarshal func(interface{}) error) error { - var sliceType []string - err := unmarshal(&sliceType) - if err == nil { - s.parts = sliceType - return nil - } - - var stringType string - err = unmarshal(&stringType) - if err == nil { - sliceType = make([]string, 0, 1) - s.parts = append(sliceType, string(stringType)) - return nil - } - return err -} - -func (s *Stringorslice) Len() int { - if s == nil { - return 0 - } - return len(s.parts) -} - -func (s *Stringorslice) Slice() []string { - if s == nil { - return nil - } - return s.parts -} - -func NewStringorslice(parts ...string) Stringorslice { - return Stringorslice{parts} -} - -type Command struct { - parts []string -} - -func (s Command) MarshalYAML() (interface{}, error) { - return s.parts, nil -} - -func (s *Command) UnmarshalYAML(unmarshal func(interface{}) error) error { - var stringType string - err := unmarshal(&stringType) - if err == nil { - s.parts, err = shlex.Split(stringType) - return err - } - - var sliceType []string - err = unmarshal(&sliceType) - if err == nil { - s.parts = sliceType - return nil - } - - return err -} - -func (s *Command) ToString() string { - return strings.Join(s.parts, " ") -} - -func (s *Command) Slice() []string { - return s.parts -} - -func NewCommand(parts ...string) Command { - return Command{parts} -} - -type SliceorMap struct { - parts map[string]string -} - -func (s SliceorMap) MarshalYAML() (interface{}, error) { - return s.parts, nil -} - -func (s *SliceorMap) UnmarshalYAML(unmarshal func(interface{}) error) error { - mapType := make(map[string]string) - err := unmarshal(&mapType) - if err == nil { - s.parts = mapType - return nil - } - - var sliceType []string - var key string - var value string - - err = unmarshal(&sliceType) - if err != nil { - return err - } - - mapType = make(map[string]string) - for _, slice := range sliceType { - slice = strings.TrimSpace(slice) - keyValueSlice := strings.SplitN(slice, "=", 2) - - key = keyValueSlice[0] - value = "" - if len(keyValueSlice) == 2 { - value = keyValueSlice[1] - } - - mapType[key] = value - } - s.parts = mapType - return nil -} - -func (s *SliceorMap) MapParts() map[string]string { - if s == nil { - return nil - } - return s.parts -} - -func NewSliceorMap(parts map[string]string) SliceorMap { - return SliceorMap{parts} -} - -type MaporEqualSlice struct { - parts []string -} - -func (s MaporEqualSlice) MarshalYAML() (interface{}, error) { - return s.parts, nil -} - -func (s *MaporEqualSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { - err := unmarshal(&s.parts) - if err == nil { - return nil - } - - var mapType map[string]string - - err = unmarshal(&mapType) - if err != nil { - return err - } - - for k, v := range mapType { - s.parts = append(s.parts, strings.Join([]string{k, v}, "=")) - } - - return nil -} - -func (s *MaporEqualSlice) Slice() []string { - return s.parts -} - -func NewMaporEqualSlice(parts []string) MaporEqualSlice { - return MaporEqualSlice{parts} -} - -type MaporColonSlice struct { - parts []string -} - -func (s MaporColonSlice) MarshalYAML() (interface{}, error) { - return s.parts, nil -} - -func (s *MaporColonSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { - err := unmarshal(&s.parts) - if err == nil { - return nil - } - - var mapType map[string]string - - err = unmarshal(&mapType) - if err != nil { - return err - } - - for k, v := range mapType { - s.parts = append(s.parts, strings.Join([]string{k, v}, ":")) - } - - return nil -} - -func (s *MaporColonSlice) Slice() []string { - return s.parts -} - -func NewMaporColonSlice(parts []string) MaporColonSlice { - return MaporColonSlice{parts} -} - -type MaporSpaceSlice struct { - parts []string -} - -func (s MaporSpaceSlice) MarshalYAML() (interface{}, error) { - return s.parts, nil -} - -func (s *MaporSpaceSlice) UnmarshalYAML(unmarshal func(interface{}) error) error { - err := unmarshal(&s.parts) - if err == nil { - return nil - } - - var mapType map[string]string - - err = unmarshal(&mapType) - if err != nil { - return err - } - - for k, v := range mapType { - s.parts = append(s.parts, strings.Join([]string{k, v}, " ")) - } - - return nil -} - -func (s *MaporSpaceSlice) Slice() []string { - return s.parts -} - -func NewMaporSpaceSlice(parts []string) MaporSpaceSlice { - return MaporSpaceSlice{parts} -} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/.dockerignore b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/.dockerignore deleted file mode 100644 index b8807263..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -.git -README.markdown diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/.travis.yml b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/.travis.yml deleted file mode 100644 index e394b30c..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: go -go: - - 1.3.1 - - 1.4 - - tip -env: - - GOARCH=amd64 - - GOARCH=386 -script: - - make test diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/Dockerfile.1_3 b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/Dockerfile.1_3 deleted file mode 100644 index 24b235ea..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/Dockerfile.1_3 +++ /dev/null @@ -1,10 +0,0 @@ -FROM golang:1.3.3-cross -MAINTAINER peter.edge@gmail.com - -RUN \ - go get -v code.google.com/p/go.tools/cmd/vet && \ - go get -v github.com/golang/lint/golint - -RUN mkdir -p /go/src/github.com/fsouza/go-dockerclient -ADD . /go/src/github.com/fsouza/go-dockerclient -WORKDIR /go/src/github.com/fsouza/go-dockerclient diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/Dockerfile.1_4 b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/Dockerfile.1_4 deleted file mode 100644 index 2030cbc0..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/Dockerfile.1_4 +++ /dev/null @@ -1,10 +0,0 @@ -FROM golang:1.4.2-cross -MAINTAINER peter.edge@gmail.com - -RUN \ - go get -v golang.org/x/tools/cmd/vet && \ - go get -v github.com/golang/lint/golint - -RUN mkdir -p /go/src/github.com/fsouza/go-dockerclient -ADD . /go/src/github.com/fsouza/go-dockerclient -WORKDIR /go/src/github.com/fsouza/go-dockerclient diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/Makefile b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/Makefile deleted file mode 100644 index 7f8a6252..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -.PHONY: \ - all \ - vendor \ - lint \ - vet \ - fmt \ - fmtcheck \ - pretest \ - test \ - cov \ - clean - -all: test - -vendor: - go get -v github.com/mjibson/party - party -d vendor -c -u - -lint: - go get -v github.com/golang/lint/golint - for file in $(shell git ls-files '*.go' | grep -v '^vendor/'); do \ - golint $$file; \ - done - -vet: - @ go get -v golang.org/x/tools/cmd/vet - go vet ./... - -fmt: - gofmt -w $(shell git ls-files '*.go' | grep -v '^vendor/') - -fmtcheck: - for file in $(shell git ls-files '*.go' | grep -v '^vendor/'); do \ - gofmt $$file | diff -u $$file -; \ - if [ -n "$$(gofmt $$file | diff -u $$file -)" ]; then\ - exit 1; \ - fi; \ - done - -pretest: lint vet fmtcheck - -test: pretest - go test - go test ./testing - -cov: - go get -v github.com/axw/gocov/gocov - go get golang.org/x/tools/cmd/cover - gocov test | gocov report - -clean: - go clean ./... diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/codeship-services.yml b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/codeship-services.yml deleted file mode 100644 index 24d663f9..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/codeship-services.yml +++ /dev/null @@ -1,24 +0,0 @@ -"1_3_386": - build: - image: fsouza/godockerclient:1.3 - dockerfile: Dockerfile.1_3 - environment: - - GOARCH=386 -"1_3_amd64": - build: - image: fsouza/godockerclient:1.3 - dockerfile: Dockerfile.1_3 - environment: - - GOARCH=amd64 -"1_4_386": - build: - image: fsouza/godockerclient:1.4 - dockerfile: Dockerfile.1_4 - environment: - - GOARCH=386 -"1_4_amd64": - build: - image: fsouza/godockerclient:1.4 - dockerfile: Dockerfile.1_4 - environment: - - GOARCH=amd64 diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/codeship-steps.yml b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/codeship-steps.yml deleted file mode 100644 index e4d262f6..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/codeship-steps.yml +++ /dev/null @@ -1,8 +0,0 @@ -- type: parallel - services: - - 1_3_386 - - 1_3_amd64 - - 1_4_386 - - 1_4_amd64 - steps: - - command: make test diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/bin/fmtpolice b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/bin/fmtpolice deleted file mode 100644 index da275e8a..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/bin/fmtpolice +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -readonly GOPATH="${GOPATH%%:*}" - -main() { - check_fmt - check_lint -} - -check_fmt() { - eval "set -e" - for file in $(_list_go_files) ; do - gofmt $file | diff -u $file - - done - eval "set +e" -} - -check_lint() { - _install_linter - - for file in $(_list_go_files) ; do - if [[ ! "$(${GOPATH}/bin/golint $file)" =~ ^[[:blank:]]*$ ]] ; then - _lint_verbose && exit 1 - fi - done -} - -_lint_verbose() { - for file in $(_list_go_files) ; do $GOPATH/bin/golint $file ; done -} - -_install_linter() { - if [[ ! -x "${GOPATH}/bin/golint" ]] ; then - go get -u -f github.com/golang/lint/golint - fi -} - -_list_go_files() { - git ls-files '*.go' | grep -v '^vendor/' -} - -main "$@" diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/.dockerignore b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/.dockerignore deleted file mode 100644 index 027e8c20..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -container.tar -dockerfile.tar -foofile diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/Dockerfile b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/Dockerfile deleted file mode 100644 index 0948dcfa..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -# this file describes how to build tsuru python image -# to run it: -# 1- install docker -# 2- run: $ docker build -t tsuru/python https://raw.github.com/tsuru/basebuilder/master/python/Dockerfile - -from base:ubuntu-quantal -run apt-get install wget -y --force-yes -run wget http://github.com/tsuru/basebuilder/tarball/master -O basebuilder.tar.gz --no-check-certificate -run mkdir /var/lib/tsuru -run tar -xvf basebuilder.tar.gz -C /var/lib/tsuru --strip 1 -run cp /var/lib/tsuru/python/deploy /var/lib/tsuru -run cp /var/lib/tsuru/base/restart /var/lib/tsuru -run cp /var/lib/tsuru/base/start /var/lib/tsuru -run /var/lib/tsuru/base/install -run /var/lib/tsuru/base/setup diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/barfile b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/barfile deleted file mode 100644 index e69de29b..00000000 diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/ca.pem b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/ca.pem deleted file mode 100644 index 8e38bba1..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/ca.pem +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIC1TCCAb+gAwIBAgIQJ9MsNxrUxumNbAytGi3GEDALBgkqhkiG9w0BAQswFjEU -MBIGA1UEChMLQm9vdDJEb2NrZXIwHhcNMTQxMDE2MjAyMTM4WhcNMTcwOTMwMjAy -MTM4WjAWMRQwEgYDVQQKEwtCb290MkRvY2tlcjCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBALpFCSARjG+5yXoqr7UMzuE0df7RRZfeRZI06lJ02ZqV4Iii -rgL7ML9yPxX50NbLnjiilSDTUhnyocYFItokzUzz8qpX/nlYhuN2Iqwh4d0aWS8z -f5y248F+H1z+HY2W8NPl/6DVlVwYaNW1/k+RPMlHS0INLR6j+3Ievew7RNE0NnM2 -znELW6NetekDt3GUcz0Z95vDUDfdPnIk1eIFMmYvLxZh23xOca4Q37a3S8F3d+dN -+OOpwjdgY9Qme0NQUaXpgp58jWuQfB8q7mZrdnLlLqRa8gx1HeDSotX7UmWtWPkb -vd9EdlKLYw5PVpxMV1rkwf2t4TdgD5NfkpXlXkkCAwEAAaMjMCEwDgYDVR0PAQH/ -BAQDAgCkMA8GA1UdEwEB/wQFMAMBAf8wCwYJKoZIhvcNAQELA4IBAQBxYjHVSKqE -MJw7CW0GddesULtXXVWGJuZdWJLQlPvPMfIfjIvlcZyS4cdVNiQ3sREFIZz8TpII -CT0/Pg3sgv/FcOQe1CN0xZYZcyiAZHK1z0fJQq2qVpdv7+tJcjI2vvU6NI24iQCo -W1wz25trJz9QbdB2MRLMjyz7TSWuafztIvcfEzaIdQ0Whqund/cSuPGQx5IwF83F -rvlkOyJSH2+VIEBTCIuykJeL0DLTt8cePBQR5L1ISXb4RUMK9ZtqRscBRv8sn7o2 -ixG3wtL0gYF4xLtsQWVxI3iFVrU3WzOH/3c5shVRkWBd+AQRSwCJI4mKH7penJCF -i3/zzlkvOnjV ------END CERTIFICATE----- diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/cert.pem b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/cert.pem deleted file mode 100644 index 5e7244b2..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/cert.pem +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIC6DCCAdKgAwIBAgIRANO6ymxQAjp66KmEka1G6b0wCwYJKoZIhvcNAQELMBYx -FDASBgNVBAoTC0Jvb3QyRG9ja2VyMB4XDTE0MTAxNjIwMjE1MloXDTE3MDkzMDIw -MjE1MlowFjEUMBIGA1UEChMLQm9vdDJEb2NrZXIwggEiMA0GCSqGSIb3DQEBAQUA -A4IBDwAwggEKAoIBAQDGA1mAhSOpZspD1dpZ7qVEQrIJw4Xo8252jHaORnEdDiFm -b6brEmr6jw8t4P3IGxbqBc/TqRV+SSXxwYEVvfpeQKH+SmqStoMNtD3Ura161az4 -V0BcxMtSlsUGpoz+//QCAq8qiaxMwgiyc5253mkQm88anj2cNt7xbewiu/KFWuf7 -BVpNK1+ltpJmlukfcj/G+I1bw7j1KxBjDrFqe5cyDuuZcDL2tmUXP/ZWDyXwSv+H -AOckqn44z6aXlBkVvOXDBZJqY76d/vWVDNCuZeXRnqlhP3t1kH4V0RQXo+JD2tgt -JgdU0unzyoFOSWNUBPm73tqmjUGGAmGHBmeegJr/AgMBAAGjNTAzMA4GA1UdDwEB -/wQEAwIAgDATBgNVHSUEDDAKBggrBgEFBQcDAjAMBgNVHRMBAf8EAjAAMAsGCSqG -SIb3DQEBCwOCAQEABVTWl5SmBP+j5He5bQsgnIXjviSKqe40/10V4LJAOmilycRF -zLrzM+YMwfjg6PLIs8CldAMWHw9y9ktZY4MxkgCktaiaN/QmMTMwFWEcN4wy5IpM -U5l93eAg7xsnY430h3QBBADujX4wdF3fs8rSL8zAAQFL0ihurwU124K3yXKsrwpb -CiVUGfIN4sPwjy8Ws9oxHFDC9/P8lgjHZ1nBIf8KSHnMzlxDGj7isQfhtH+7mcCL -cM1qO2NirS2v7uaEPPY+MJstAz+W7EJCW9dfMSmHna2SDC37Xkin7uEY9z+qaKFL -8d/XxOB/L8Ucy8VZhdsv0dsBq5KfJntITM0ksQ== ------END CERTIFICATE----- diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/dockerfile.tar b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/dockerfile.tar deleted file mode 100644 index 32c9ce64704835cd096b85ac44c35b5087b5ccdd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2560 zcmeHGy>8<$49;3V1%d0TNOs}`$a>xT46-c8LTt+?QB8ACf0XPiQll-h0~9$I?_v`_`p)qp;@ z0OJK)JAmosQD=m*-~y?5ASGvD1{zS;L7n!AYz2z}2Y8%Kb25fgK0fDb5l4UE+{yF$ zXs`{{TG^hbn!J);Cl1>2UV0=k!T8hL+GbhfZ2u5L51|SJ2KFb&fyiW3|3Qw(jvC+i zouk4oz*u9Q((Iyric9uLhPZsmgZ8ANMrS_2p5cn+n!M}dU&=mMrdq8|OlgOvF-oFN zh5A!%9Pk(EcxS4q(c~Z~u-BL7!+gIN2&&-GnGy1YRpY|{e@?X?J9}9;KY_$PxYO}H o;5QJT#=q||{Y*ZuNn-Gk-)jtGb|Y`+PV+v2`vmS2xaA4_1I+dVl>h($ diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/foofile b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/foofile deleted file mode 100644 index e69de29b..00000000 diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/key.pem b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/key.pem deleted file mode 100644 index a9346bcf..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/key.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAxgNZgIUjqWbKQ9XaWe6lREKyCcOF6PNudox2jkZxHQ4hZm+m -6xJq+o8PLeD9yBsW6gXP06kVfkkl8cGBFb36XkCh/kpqkraDDbQ91K2tetWs+FdA -XMTLUpbFBqaM/v/0AgKvKomsTMIIsnOdud5pEJvPGp49nDbe8W3sIrvyhVrn+wVa -TStfpbaSZpbpH3I/xviNW8O49SsQYw6xanuXMg7rmXAy9rZlFz/2Vg8l8Er/hwDn -JKp+OM+ml5QZFbzlwwWSamO+nf71lQzQrmXl0Z6pYT97dZB+FdEUF6PiQ9rYLSYH -VNLp88qBTkljVAT5u97apo1BhgJhhwZnnoCa/wIDAQABAoIBAQCaGy9EC9pmU95l -DwGh7k5nIrUnTilg1FwLHWSDdCVCZKXv8ENrPelOWZqJrUo1u4eI2L8XTsewgkNq -tJu/DRzWz9yDaO0qg6rZNobMh+K076lvmZA44twOydJLS8H+D7ua+PXU2FLlZjmY -kMyXRJZmW6zCXZc7haTbJx6ZJccoquk/DkS4FcFurJP177u1YrWS9TTw9kensUtU -jQ63uf56UTN1i+0+Rxl7OW1TZlqwlri5I4njg5249+FxwwHzIq8+l7zD7K9pl8c/ -nG1HuulvU2bVlDlRdyslMPAH34vw9Sku1BD8furrJLr1na5lRSLKJODEaIPEsLwv -CdEUwP9JAoGBAO76ZW80RyNB2fA+wbTq70Sr8CwrXxYemXrez5LKDC7SsohKFCPE -IedpO/n+nmymiiJvMm874EExoG6BVrbkWkeb+2vinEfOQNlDMsDx7WLjPekP3t6i -rXHO3CjFooVFq2z3mZa/Nc5NZqu8fNWNCKJxZDJphdoj6sORNJIUvZVjAoGBANQd -++J+ITcu3/+A6JrGcgLunBFQYPqkiItk0J4QKYKuX5ik9rWcQDN8TTtfW2mDuiQ4 -NrCwuVPq1V1kB16JzH017SsYLo9g8I20YjnBZge9pKTeUaLVTb3C50LW8FBylop0 -Bnm597dNbtSjphjoTMg0XyC19o3Esf2YeWG0QNS1AoGAWWDfFRNJU99qIldmXULM -0DM6NVrXSk+ReYnhunXEzrJQwXZrR+EwCPurydk36Uz0NuK9yypquhdUeF/5TZfk -SAoHo5byekyipl9imRUigqyY2BTudvgCxKDoaHtaSFwBPFTyZZYICquaLbrmOXxw -8UhVgCFFRYvPXuts7QHC0h8CgYBWEvy9gfU0kV7wLX02IUTuj6jhFb7ktpN6DSTi -nyhZES1VoctDEu6ydcRZTW6ouH12aSE4Pd5WgTqntQmQgVZrkNB25k8ue2Xh+srJ -KQOgLIJ9LIHwE6KCWG7DnrjRzE3uTPq7to0g4tkQjH/AJ7PQof/gJDayfJjFkXPg -A+cy6QKBgEPbKpiqscm03gT2QanBut5pg4dqPOxp0SlErA3kSFNTRK3oYBQPC+LH -qA5nD5brdkeNBB58Rll8Zpzxiff50bcvLP/7/Sb3NjaXFTEY0gVbdRof3n6N0YP3 -Hu5XDNJ9RNkNzE5RIG1g86KE+aKlcrKMaigqAiuIy2PSnjkQeGk8 ------END RSA PRIVATE KEY----- diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/server.pem b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/server.pem deleted file mode 100644 index 89cc445e..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/server.pem +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIC/DCCAeagAwIBAgIQMUILcXtvmSOK63zEBo0VXzALBgkqhkiG9w0BAQswFjEU -MBIGA1UEChMLQm9vdDJEb2NrZXIwHhcNMTQxMDE2MjAyMTQ2WhcNMTcwOTMwMjAy -MTQ2WjAWMRQwEgYDVQQKEwtCb290MkRvY2tlcjCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBANxUOUhNnqFnrTlLsBYzfFRZWQo268l+4K4lOJCVbfDonP3g -Mz0vGi9fcyFqEWSA8Y+ShXna625HTnReCwFdsu0861qCIq7v95hFFCyOe0iIxpd0 -AKLnl90d+1vonE7andgFgoobbTiMly4UK4H6z8D148fFNIihoteOG3PIF89TFxP7 -CJ/3wXnx/IKpdlO8PAnub3tBPJHvGDj7KORLy4IBxRX5VBAdfGNybE66fcrehEva -rLA4m9pgiaR/Nnr9FdKhPyqYdjflLNvzydxNvMIV4M0hFlhXmYvpMjA5/XsTnsyV -t9JHJa5Upwqsbne08t7rsm7liZNxZlko8xPOTQcCAwEAAaNKMEgwDgYDVR0PAQH/ -BAQDAgCgMAwGA1UdEwEB/wQCMAAwKAYDVR0RBCEwH4ILYm9vdDJkb2NrZXKHBH8A -AAGHBAoAAg+HBMCoO2cwCwYJKoZIhvcNAQELA4IBAQAYoYcDkDWkl73FZ0WnPmAj -LiF7HU95Qg3KyEpFsAJeShSLPPbQntmwhdekEzY4tQ3eKQB/+zHFjzsCr/lmDUmH -Ea/ryQ17C+jyH+Ykg0IWW6L6veZhvRDg6Z9focVtPVBRxPTqC/Qhb54blWRASV+W -UreMuXQ5+1dQptAM7ixOeLVHjBi/bd9TL3jvwBVCr9QedteMjjK4TCF9Tbcou+MF -2w3OJJZMDhcD+YwoK9uJDqlKmcTm/vVMbSsp/pTMcnQ7jxCeR8/XyX+VwTZwaHAa -o92Q/eg3THAiWhvyT/SzyH9dHHBAyXynUwGCggKawHktfvW4QXRPuLxLrJ7iB5cy ------END CERTIFICATE----- diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/serverkey.pem b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/serverkey.pem deleted file mode 100644 index c897e5da..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/serverkey.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEoAIBAAKCAQEA3FQ5SE2eoWetOUuwFjN8VFlZCjbryX7griU4kJVt8Oic/eAz -PS8aL19zIWoRZIDxj5KFedrrbkdOdF4LAV2y7TzrWoIiru/3mEUULI57SIjGl3QA -oueX3R37W+icTtqd2AWCihttOIyXLhQrgfrPwPXjx8U0iKGi144bc8gXz1MXE/sI -n/fBefH8gql2U7w8Ce5ve0E8ke8YOPso5EvLggHFFflUEB18Y3JsTrp9yt6ES9qs -sDib2mCJpH82ev0V0qE/Kph2N+Us2/PJ3E28whXgzSEWWFeZi+kyMDn9exOezJW3 -0kclrlSnCqxud7Ty3uuybuWJk3FmWSjzE85NBwIDAQABAoIBAG0ak+cW8LeShHf7 -3+2Of0GxoOLrAWWdG5uAuPr31CJYve0FybnBimDtDjD8ujIfm/7xmoEWBEFutA3x -x9dcU88gvJbsHEqub9gKVQwfXjMz78tt2SbSMiR/xUnk7QorPcCMMfE71aEMFYzu -1gCed6Rg3vO81t/V0rKVH0j9S7UQz5v/oX15eVDV5LOqyCHwAi6K0eXXbqnbI0TH -SOQ/nexM2msVXWbO9t6ra6f5V7FXziDK5Xi+rPxRbX9mkrDzxDAevfuRqYBx5vtL -W2Q2hKjUAHFgXFniNSZBS7dCdAtz0el/3ct+cNmpuTMhhs7M6wC1CuYiZ/DxLiFh -Si73VckCgYEA+/ceh3+VjtQ0rgEw8sD9bqYEA8IaBiObjneIoFnKBYRG7yZd8JMm -HD4M/aQ1qhcRLPN7GR03YQULgQJURbKSjJHnhfTXHyeHC3NN4gMVHQXewu2MHCh6 -7FCQ9CfK0KcYLgegVVvL3PrF3hyWGnmTu+G0UkDQRYVnaNrB7snrW6UCgYEA39tq -+MCQdu0moJ5szSZf02undg9EeW6isk9qzi7TId3/MLci2eH7PEnipipPUK3+DERq -aba0y0TKgBR2EXvXLFJA/+kfdo2loIEHOfox85HVfxgUaFRti63ZI0uF8D0QT2Yy -oJal+RFghVoSnv4LjhRKEPbIkScTXGjdK+7wFjsCfz79iKRXQQx0ALd/lL0bgkAn -QNmvrNHcFQeI2p8700WNzC39aX67SsvEt3qxkrjzC1gxhpTAuReIK1gVPPwvqHN8 -BmV20FD5kMlMCix2mNCopwgUWvKvLAvoGFTxncKMA39+aJbuXAjiqJTekKgNvOE7 -i9kEWw0GTNPp3JHV6QECgYAPwb0M11kT1euDIMOdyRazpf86kyaJuZzgGjD1ZFxe -JOcigbGFTp/FhZnbglzk2+pm6KXo3QBq0mPCki4hWusxZnTGzpz1VlETNCHTFeZQ -M7KoaIR/N3oie9Et59H8r/+m5xWnMhNqratyl316DX24uXrhKM3DUdHODl+LCR2D -IwKBgE1MbHuwolUPEw3HeO4R7NMFVTFei7E/fpUsimPfArGg8UydwvloNT1myJos -N2JzfGGjN2KPVcBk9fOs71mJ6VcK3C3g5JIccplk6h9VNaw55+zdQvKPTzoBoTvy -A+Fwx2AlF61KeRF87DL2YTRJ6B9MHmWgf7+GVZOxomLgEAcZ ------END RSA PRIVATE KEY----- diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/symlink b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/symlink deleted file mode 120000 index 3ddf86a3..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/data/symlink +++ /dev/null @@ -1 +0,0 @@ -doesnotexist \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/server.go b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/server.go deleted file mode 100644 index bbfdc531..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/server.go +++ /dev/null @@ -1,945 +0,0 @@ -// Copyright 2015 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package testing provides a fake implementation of the Docker API, useful for -// testing purpose. -package testing - -import ( - "archive/tar" - "crypto/rand" - "encoding/json" - "errors" - "fmt" - mathrand "math/rand" - "net" - "net/http" - "regexp" - "strconv" - "strings" - "sync" - "time" - - "github.com/fsouza/go-dockerclient" - "github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/stdcopy" - "github.com/fsouza/go-dockerclient/vendor/github.com/gorilla/mux" -) - -var nameRegexp = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9_.-]+$`) - -// DockerServer represents a programmable, concurrent (not much), HTTP server -// implementing a fake version of the Docker remote API. -// -// It can used in standalone mode, listening for connections or as an arbitrary -// HTTP handler. -// -// For more details on the remote API, check http://goo.gl/G3plxW. -type DockerServer struct { - containers []*docker.Container - execs []*docker.ExecInspect - execMut sync.RWMutex - cMut sync.RWMutex - images []docker.Image - iMut sync.RWMutex - imgIDs map[string]string - listener net.Listener - mux *mux.Router - hook func(*http.Request) - failures map[string]string - multiFailures []map[string]string - execCallbacks map[string]func() - customHandlers map[string]http.Handler - handlerMutex sync.RWMutex - cChan chan<- *docker.Container -} - -// NewServer returns a new instance of the fake server, in standalone mode. Use -// the method URL to get the URL of the server. -// -// It receives the bind address (use 127.0.0.1:0 for getting an available port -// on the host), a channel of containers and a hook function, that will be -// called on every request. -// -// The fake server will send containers in the channel whenever the container -// changes its state, via the HTTP API (i.e.: create, start and stop). This -// channel may be nil, which means that the server won't notify on state -// changes. -func NewServer(bind string, containerChan chan<- *docker.Container, hook func(*http.Request)) (*DockerServer, error) { - listener, err := net.Listen("tcp", bind) - if err != nil { - return nil, err - } - server := DockerServer{ - listener: listener, - imgIDs: make(map[string]string), - hook: hook, - failures: make(map[string]string), - execCallbacks: make(map[string]func()), - customHandlers: make(map[string]http.Handler), - cChan: containerChan, - } - server.buildMuxer() - go http.Serve(listener, &server) - return &server, nil -} - -func (s *DockerServer) notify(container *docker.Container) { - if s.cChan != nil { - s.cChan <- container - } -} - -func (s *DockerServer) buildMuxer() { - s.mux = mux.NewRouter() - s.mux.Path("/commit").Methods("POST").HandlerFunc(s.handlerWrapper(s.commitContainer)) - s.mux.Path("/containers/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.listContainers)) - s.mux.Path("/containers/create").Methods("POST").HandlerFunc(s.handlerWrapper(s.createContainer)) - s.mux.Path("/containers/{id:.*}/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.inspectContainer)) - s.mux.Path("/containers/{id:.*}/rename").Methods("POST").HandlerFunc(s.handlerWrapper(s.renameContainer)) - s.mux.Path("/containers/{id:.*}/top").Methods("GET").HandlerFunc(s.handlerWrapper(s.topContainer)) - s.mux.Path("/containers/{id:.*}/start").Methods("POST").HandlerFunc(s.handlerWrapper(s.startContainer)) - s.mux.Path("/containers/{id:.*}/kill").Methods("POST").HandlerFunc(s.handlerWrapper(s.stopContainer)) - s.mux.Path("/containers/{id:.*}/stop").Methods("POST").HandlerFunc(s.handlerWrapper(s.stopContainer)) - s.mux.Path("/containers/{id:.*}/pause").Methods("POST").HandlerFunc(s.handlerWrapper(s.pauseContainer)) - s.mux.Path("/containers/{id:.*}/unpause").Methods("POST").HandlerFunc(s.handlerWrapper(s.unpauseContainer)) - s.mux.Path("/containers/{id:.*}/wait").Methods("POST").HandlerFunc(s.handlerWrapper(s.waitContainer)) - s.mux.Path("/containers/{id:.*}/attach").Methods("POST").HandlerFunc(s.handlerWrapper(s.attachContainer)) - s.mux.Path("/containers/{id:.*}").Methods("DELETE").HandlerFunc(s.handlerWrapper(s.removeContainer)) - s.mux.Path("/containers/{id:.*}/exec").Methods("POST").HandlerFunc(s.handlerWrapper(s.createExecContainer)) - s.mux.Path("/exec/{id:.*}/resize").Methods("POST").HandlerFunc(s.handlerWrapper(s.resizeExecContainer)) - s.mux.Path("/exec/{id:.*}/start").Methods("POST").HandlerFunc(s.handlerWrapper(s.startExecContainer)) - s.mux.Path("/exec/{id:.*}/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.inspectExecContainer)) - s.mux.Path("/images/create").Methods("POST").HandlerFunc(s.handlerWrapper(s.pullImage)) - s.mux.Path("/build").Methods("POST").HandlerFunc(s.handlerWrapper(s.buildImage)) - s.mux.Path("/images/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.listImages)) - s.mux.Path("/images/{id:.*}").Methods("DELETE").HandlerFunc(s.handlerWrapper(s.removeImage)) - s.mux.Path("/images/{name:.*}/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.inspectImage)) - s.mux.Path("/images/{name:.*}/push").Methods("POST").HandlerFunc(s.handlerWrapper(s.pushImage)) - s.mux.Path("/images/{name:.*}/tag").Methods("POST").HandlerFunc(s.handlerWrapper(s.tagImage)) - s.mux.Path("/events").Methods("GET").HandlerFunc(s.listEvents) - s.mux.Path("/_ping").Methods("GET").HandlerFunc(s.handlerWrapper(s.pingDocker)) - s.mux.Path("/images/load").Methods("POST").HandlerFunc(s.handlerWrapper(s.loadImage)) - s.mux.Path("/images/{id:.*}/get").Methods("GET").HandlerFunc(s.handlerWrapper(s.getImage)) -} - -// SetHook changes the hook function used by the server. -// -// The hook function is a function called on every request. -func (s *DockerServer) SetHook(hook func(*http.Request)) { - s.hook = hook -} - -// PrepareExec adds a callback to a container exec in the fake server. -// -// This function will be called whenever the given exec id is started, and the -// given exec id will remain in the "Running" start while the function is -// running, so it's useful for emulating an exec that runs for two seconds, for -// example: -// -// opts := docker.CreateExecOptions{ -// AttachStdin: true, -// AttachStdout: true, -// AttachStderr: true, -// Tty: true, -// Cmd: []string{"/bin/bash", "-l"}, -// } -// // Client points to a fake server. -// exec, err := client.CreateExec(opts) -// // handle error -// server.PrepareExec(exec.ID, func() {time.Sleep(2 * time.Second)}) -// err = client.StartExec(exec.ID, docker.StartExecOptions{Tty: true}) // will block for 2 seconds -// // handle error -func (s *DockerServer) PrepareExec(id string, callback func()) { - s.execCallbacks[id] = callback -} - -// PrepareFailure adds a new expected failure based on a URL regexp it receives -// an id for the failure. -func (s *DockerServer) PrepareFailure(id string, urlRegexp string) { - s.failures[id] = urlRegexp -} - -// PrepareMultiFailures enqueues a new expected failure based on a URL regexp -// it receives an id for the failure. -func (s *DockerServer) PrepareMultiFailures(id string, urlRegexp string) { - s.multiFailures = append(s.multiFailures, map[string]string{"error": id, "url": urlRegexp}) -} - -// ResetFailure removes an expected failure identified by the given id. -func (s *DockerServer) ResetFailure(id string) { - delete(s.failures, id) -} - -// ResetMultiFailures removes all enqueued failures. -func (s *DockerServer) ResetMultiFailures() { - s.multiFailures = []map[string]string{} -} - -// CustomHandler registers a custom handler for a specific path. -// -// For example: -// -// server.CustomHandler("/containers/json", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { -// http.Error(w, "Something wrong is not right", http.StatusInternalServerError) -// })) -func (s *DockerServer) CustomHandler(path string, handler http.Handler) { - s.handlerMutex.Lock() - s.customHandlers[path] = handler - s.handlerMutex.Unlock() -} - -// MutateContainer changes the state of a container, returning an error if the -// given id does not match to any container "running" in the server. -func (s *DockerServer) MutateContainer(id string, state docker.State) error { - for _, container := range s.containers { - if container.ID == id { - container.State = state - return nil - } - } - return errors.New("container not found") -} - -// Stop stops the server. -func (s *DockerServer) Stop() { - if s.listener != nil { - s.listener.Close() - } -} - -// URL returns the HTTP URL of the server. -func (s *DockerServer) URL() string { - if s.listener == nil { - return "" - } - return "http://" + s.listener.Addr().String() + "/" -} - -// ServeHTTP handles HTTP requests sent to the server. -func (s *DockerServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { - s.handlerMutex.RLock() - defer s.handlerMutex.RUnlock() - for re, handler := range s.customHandlers { - if m, _ := regexp.MatchString(re, r.URL.Path); m { - handler.ServeHTTP(w, r) - return - } - } - s.mux.ServeHTTP(w, r) - if s.hook != nil { - s.hook(r) - } -} - -// DefaultHandler returns default http.Handler mux, it allows customHandlers to -// call the default behavior if wanted. -func (s *DockerServer) DefaultHandler() http.Handler { - return s.mux -} - -func (s *DockerServer) handlerWrapper(f func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) { - return func(w http.ResponseWriter, r *http.Request) { - for errorID, urlRegexp := range s.failures { - matched, err := regexp.MatchString(urlRegexp, r.URL.Path) - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - if !matched { - continue - } - http.Error(w, errorID, http.StatusBadRequest) - return - } - for i, failure := range s.multiFailures { - matched, err := regexp.MatchString(failure["url"], r.URL.Path) - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - if !matched { - continue - } - http.Error(w, failure["error"], http.StatusBadRequest) - s.multiFailures = append(s.multiFailures[:i], s.multiFailures[i+1:]...) - return - } - f(w, r) - } -} - -func (s *DockerServer) listContainers(w http.ResponseWriter, r *http.Request) { - all := r.URL.Query().Get("all") - s.cMut.RLock() - result := make([]docker.APIContainers, len(s.containers)) - for i, container := range s.containers { - if all == "1" || container.State.Running { - result[i] = docker.APIContainers{ - ID: container.ID, - Image: container.Image, - Command: fmt.Sprintf("%s %s", container.Path, strings.Join(container.Args, " ")), - Created: container.Created.Unix(), - Status: container.State.String(), - Ports: container.NetworkSettings.PortMappingAPI(), - Names: []string{fmt.Sprintf("/%s", container.Name)}, - } - } - } - s.cMut.RUnlock() - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - json.NewEncoder(w).Encode(result) -} - -func (s *DockerServer) listImages(w http.ResponseWriter, r *http.Request) { - s.cMut.RLock() - result := make([]docker.APIImages, len(s.images)) - for i, image := range s.images { - result[i] = docker.APIImages{ - ID: image.ID, - Created: image.Created.Unix(), - } - for tag, id := range s.imgIDs { - if id == image.ID { - result[i].RepoTags = append(result[i].RepoTags, tag) - } - } - } - s.cMut.RUnlock() - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - json.NewEncoder(w).Encode(result) -} - -func (s *DockerServer) findImage(id string) (string, error) { - s.iMut.RLock() - defer s.iMut.RUnlock() - image, ok := s.imgIDs[id] - if ok { - return image, nil - } - image, _, err := s.findImageByID(id) - return image, err -} - -func (s *DockerServer) findImageByID(id string) (string, int, error) { - s.iMut.RLock() - defer s.iMut.RUnlock() - for i, image := range s.images { - if image.ID == id { - return image.ID, i, nil - } - } - return "", -1, errors.New("No such image") -} - -func (s *DockerServer) createContainer(w http.ResponseWriter, r *http.Request) { - var config struct { - *docker.Config - HostConfig *docker.HostConfig - } - defer r.Body.Close() - err := json.NewDecoder(r.Body).Decode(&config) - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - name := r.URL.Query().Get("name") - if name != "" && !nameRegexp.MatchString(name) { - http.Error(w, "Invalid container name", http.StatusInternalServerError) - return - } - if _, err := s.findImage(config.Image); err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - ports := map[docker.Port][]docker.PortBinding{} - for port := range config.ExposedPorts { - ports[port] = []docker.PortBinding{{ - HostIP: "0.0.0.0", - HostPort: strconv.Itoa(mathrand.Int() % 65536), - }} - } - - //the container may not have cmd when using a Dockerfile - var path string - var args []string - if len(config.Cmd) == 1 { - path = config.Cmd[0] - } else if len(config.Cmd) > 1 { - path = config.Cmd[0] - args = config.Cmd[1:] - } - - container := docker.Container{ - Name: name, - ID: s.generateID(), - Created: time.Now(), - Path: path, - Args: args, - Config: config.Config, - HostConfig: config.HostConfig, - State: docker.State{ - Running: false, - Pid: mathrand.Int() % 50000, - ExitCode: 0, - StartedAt: time.Now(), - }, - Image: config.Image, - NetworkSettings: &docker.NetworkSettings{ - IPAddress: fmt.Sprintf("172.16.42.%d", mathrand.Int()%250+2), - IPPrefixLen: 24, - Gateway: "172.16.42.1", - Bridge: "docker0", - Ports: ports, - }, - } - s.cMut.Lock() - if container.Name != "" { - for _, c := range s.containers { - if c.Name == container.Name { - defer s.cMut.Unlock() - http.Error(w, "there's already a container with this name", http.StatusConflict) - return - } - } - } - s.containers = append(s.containers, &container) - s.cMut.Unlock() - w.WriteHeader(http.StatusCreated) - s.notify(&container) - var c = struct{ ID string }{ID: container.ID} - json.NewEncoder(w).Encode(c) -} - -func (s *DockerServer) generateID() string { - var buf [16]byte - rand.Read(buf[:]) - return fmt.Sprintf("%x", buf) -} - -func (s *DockerServer) renameContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - container, index, err := s.findContainer(id) - if err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - copy := *container - copy.Name = r.URL.Query().Get("name") - s.cMut.Lock() - defer s.cMut.Unlock() - if s.containers[index].ID == copy.ID { - s.containers[index] = © - } - w.WriteHeader(http.StatusNoContent) -} - -func (s *DockerServer) inspectContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - container, _, err := s.findContainer(id) - if err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - json.NewEncoder(w).Encode(container) -} - -func (s *DockerServer) topContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - container, _, err := s.findContainer(id) - if err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - if !container.State.Running { - w.WriteHeader(http.StatusInternalServerError) - fmt.Fprintf(w, "Container %s is not running", id) - return - } - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - result := docker.TopResult{ - Titles: []string{"UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"}, - Processes: [][]string{ - {"root", "7535", "7516", "0", "03:20", "?", "00:00:00", container.Path + " " + strings.Join(container.Args, " ")}, - }, - } - json.NewEncoder(w).Encode(result) -} - -func (s *DockerServer) startContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - container, _, err := s.findContainer(id) - if err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - s.cMut.Lock() - defer s.cMut.Unlock() - defer r.Body.Close() - var hostConfig docker.HostConfig - err = json.NewDecoder(r.Body).Decode(&hostConfig) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - container.HostConfig = &hostConfig - if container.State.Running { - http.Error(w, "Container already running", http.StatusBadRequest) - return - } - container.State.Running = true - s.notify(container) -} - -func (s *DockerServer) stopContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - container, _, err := s.findContainer(id) - if err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - s.cMut.Lock() - defer s.cMut.Unlock() - if !container.State.Running { - http.Error(w, "Container not running", http.StatusBadRequest) - return - } - w.WriteHeader(http.StatusNoContent) - container.State.Running = false - s.notify(container) -} - -func (s *DockerServer) pauseContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - container, _, err := s.findContainer(id) - if err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - s.cMut.Lock() - defer s.cMut.Unlock() - if container.State.Paused { - http.Error(w, "Container already paused", http.StatusBadRequest) - return - } - w.WriteHeader(http.StatusNoContent) - container.State.Paused = true -} - -func (s *DockerServer) unpauseContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - container, _, err := s.findContainer(id) - if err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - s.cMut.Lock() - defer s.cMut.Unlock() - if !container.State.Paused { - http.Error(w, "Container not paused", http.StatusBadRequest) - return - } - w.WriteHeader(http.StatusNoContent) - container.State.Paused = false -} - -func (s *DockerServer) attachContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - container, _, err := s.findContainer(id) - if err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - hijacker, ok := w.(http.Hijacker) - if !ok { - http.Error(w, "cannot hijack connection", http.StatusInternalServerError) - return - } - w.Header().Set("Content-Type", "application/vnd.docker.raw-stream") - w.WriteHeader(http.StatusOK) - conn, _, err := hijacker.Hijack() - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - outStream := stdcopy.NewStdWriter(conn, stdcopy.Stdout) - if container.State.Running { - fmt.Fprintf(outStream, "Container %q is running\n", container.ID) - } else { - fmt.Fprintf(outStream, "Container %q is not running\n", container.ID) - } - fmt.Fprintln(outStream, "What happened?") - fmt.Fprintln(outStream, "Something happened") - conn.Close() -} - -func (s *DockerServer) waitContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - container, _, err := s.findContainer(id) - if err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - for { - time.Sleep(1e6) - s.cMut.RLock() - if !container.State.Running { - s.cMut.RUnlock() - break - } - s.cMut.RUnlock() - } - result := map[string]int{"StatusCode": container.State.ExitCode} - json.NewEncoder(w).Encode(result) -} - -func (s *DockerServer) removeContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - force := r.URL.Query().Get("force") - _, index, err := s.findContainer(id) - if err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - if s.containers[index].State.Running && force != "1" { - msg := "Error: API error (406): Impossible to remove a running container, please stop it first" - http.Error(w, msg, http.StatusInternalServerError) - return - } - w.WriteHeader(http.StatusNoContent) - s.cMut.Lock() - defer s.cMut.Unlock() - s.containers[index] = s.containers[len(s.containers)-1] - s.containers = s.containers[:len(s.containers)-1] -} - -func (s *DockerServer) commitContainer(w http.ResponseWriter, r *http.Request) { - id := r.URL.Query().Get("container") - container, _, err := s.findContainer(id) - if err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - var config *docker.Config - runConfig := r.URL.Query().Get("run") - if runConfig != "" { - config = new(docker.Config) - err = json.Unmarshal([]byte(runConfig), config) - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - } - w.WriteHeader(http.StatusOK) - image := docker.Image{ - ID: "img-" + container.ID, - Parent: container.Image, - Container: container.ID, - Comment: r.URL.Query().Get("m"), - Author: r.URL.Query().Get("author"), - Config: config, - } - repository := r.URL.Query().Get("repo") - tag := r.URL.Query().Get("tag") - s.iMut.Lock() - s.images = append(s.images, image) - if repository != "" { - if tag != "" { - repository += ":" + tag - } - s.imgIDs[repository] = image.ID - } - s.iMut.Unlock() - fmt.Fprintf(w, `{"ID":%q}`, image.ID) -} - -func (s *DockerServer) findContainer(idOrName string) (*docker.Container, int, error) { - s.cMut.RLock() - defer s.cMut.RUnlock() - for i, container := range s.containers { - if container.ID == idOrName || container.Name == idOrName { - return container, i, nil - } - } - return nil, -1, errors.New("No such container") -} - -func (s *DockerServer) buildImage(w http.ResponseWriter, r *http.Request) { - if ct := r.Header.Get("Content-Type"); ct == "application/tar" { - gotDockerFile := false - tr := tar.NewReader(r.Body) - for { - header, err := tr.Next() - if err != nil { - break - } - if header.Name == "Dockerfile" { - gotDockerFile = true - } - } - if !gotDockerFile { - w.WriteHeader(http.StatusBadRequest) - w.Write([]byte("miss Dockerfile")) - return - } - } - //we did not use that Dockerfile to build image cause we are a fake Docker daemon - image := docker.Image{ - ID: s.generateID(), - Created: time.Now(), - } - - query := r.URL.Query() - repository := image.ID - if t := query.Get("t"); t != "" { - repository = t - } - s.iMut.Lock() - s.images = append(s.images, image) - s.imgIDs[repository] = image.ID - s.iMut.Unlock() - w.Write([]byte(fmt.Sprintf("Successfully built %s", image.ID))) -} - -func (s *DockerServer) pullImage(w http.ResponseWriter, r *http.Request) { - fromImageName := r.URL.Query().Get("fromImage") - tag := r.URL.Query().Get("tag") - image := docker.Image{ - ID: s.generateID(), - } - s.iMut.Lock() - s.images = append(s.images, image) - if fromImageName != "" { - if tag != "" { - fromImageName = fmt.Sprintf("%s:%s", fromImageName, tag) - } - s.imgIDs[fromImageName] = image.ID - } - s.iMut.Unlock() -} - -func (s *DockerServer) pushImage(w http.ResponseWriter, r *http.Request) { - name := mux.Vars(r)["name"] - tag := r.URL.Query().Get("tag") - if tag != "" { - name += ":" + tag - } - s.iMut.RLock() - if _, ok := s.imgIDs[name]; !ok { - s.iMut.RUnlock() - http.Error(w, "No such image", http.StatusNotFound) - return - } - s.iMut.RUnlock() - fmt.Fprintln(w, "Pushing...") - fmt.Fprintln(w, "Pushed") -} - -func (s *DockerServer) tagImage(w http.ResponseWriter, r *http.Request) { - name := mux.Vars(r)["name"] - s.iMut.RLock() - if _, ok := s.imgIDs[name]; !ok { - s.iMut.RUnlock() - http.Error(w, "No such image", http.StatusNotFound) - return - } - s.iMut.RUnlock() - s.iMut.Lock() - defer s.iMut.Unlock() - newRepo := r.URL.Query().Get("repo") - newTag := r.URL.Query().Get("tag") - if newTag != "" { - newRepo += ":" + newTag - } - s.imgIDs[newRepo] = s.imgIDs[name] - w.WriteHeader(http.StatusCreated) -} - -func (s *DockerServer) removeImage(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - s.iMut.RLock() - var tag string - if img, ok := s.imgIDs[id]; ok { - id, tag = img, id - } - var tags []string - for tag, taggedID := range s.imgIDs { - if taggedID == id { - tags = append(tags, tag) - } - } - s.iMut.RUnlock() - _, index, err := s.findImageByID(id) - if err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - w.WriteHeader(http.StatusNoContent) - s.iMut.Lock() - defer s.iMut.Unlock() - if len(tags) < 2 { - s.images[index] = s.images[len(s.images)-1] - s.images = s.images[:len(s.images)-1] - } - if tag != "" { - delete(s.imgIDs, tag) - } -} - -func (s *DockerServer) inspectImage(w http.ResponseWriter, r *http.Request) { - name := mux.Vars(r)["name"] - s.iMut.RLock() - defer s.iMut.RUnlock() - if id, ok := s.imgIDs[name]; ok { - for _, img := range s.images { - if img.ID == id { - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - json.NewEncoder(w).Encode(img) - return - } - } - } - http.Error(w, "not found", http.StatusNotFound) -} - -func (s *DockerServer) listEvents(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - var events [][]byte - count := mathrand.Intn(20) - for i := 0; i < count; i++ { - data, err := json.Marshal(s.generateEvent()) - if err != nil { - w.WriteHeader(http.StatusInternalServerError) - return - } - events = append(events, data) - } - w.WriteHeader(http.StatusOK) - for _, d := range events { - fmt.Fprintln(w, d) - time.Sleep(time.Duration(mathrand.Intn(200)) * time.Millisecond) - } -} - -func (s *DockerServer) pingDocker(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) -} - -func (s *DockerServer) generateEvent() *docker.APIEvents { - var eventType string - switch mathrand.Intn(4) { - case 0: - eventType = "create" - case 1: - eventType = "start" - case 2: - eventType = "stop" - case 3: - eventType = "destroy" - } - return &docker.APIEvents{ - ID: s.generateID(), - Status: eventType, - From: "mybase:latest", - Time: time.Now().Unix(), - } -} - -func (s *DockerServer) loadImage(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) -} - -func (s *DockerServer) getImage(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - w.Header().Set("Content-Type", "application/tar") -} - -func (s *DockerServer) createExecContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - container, _, err := s.findContainer(id) - if err != nil { - http.Error(w, err.Error(), http.StatusNotFound) - return - } - exec := docker.ExecInspect{ - ID: s.generateID(), - Container: *container, - } - var params docker.CreateExecOptions - err = json.NewDecoder(r.Body).Decode(¶ms) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - if len(params.Cmd) > 0 { - exec.ProcessConfig.EntryPoint = params.Cmd[0] - if len(params.Cmd) > 1 { - exec.ProcessConfig.Arguments = params.Cmd[1:] - } - } - s.execMut.Lock() - s.execs = append(s.execs, &exec) - s.execMut.Unlock() - w.WriteHeader(http.StatusOK) - w.Header().Set("Content-Type", "application/json") - json.NewEncoder(w).Encode(map[string]string{"Id": exec.ID}) -} - -func (s *DockerServer) startExecContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - if exec, err := s.getExec(id); err == nil { - s.execMut.Lock() - exec.Running = true - s.execMut.Unlock() - if callback, ok := s.execCallbacks[id]; ok { - callback() - delete(s.execCallbacks, id) - } else if callback, ok := s.execCallbacks["*"]; ok { - callback() - delete(s.execCallbacks, "*") - } - s.execMut.Lock() - exec.Running = false - s.execMut.Unlock() - w.WriteHeader(http.StatusOK) - return - } - w.WriteHeader(http.StatusNotFound) -} - -func (s *DockerServer) resizeExecContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - if _, err := s.getExec(id); err == nil { - w.WriteHeader(http.StatusOK) - return - } - w.WriteHeader(http.StatusNotFound) -} - -func (s *DockerServer) inspectExecContainer(w http.ResponseWriter, r *http.Request) { - id := mux.Vars(r)["id"] - if exec, err := s.getExec(id); err == nil { - w.WriteHeader(http.StatusOK) - w.Header().Set("Content-Type", "application/json") - json.NewEncoder(w).Encode(exec) - return - } - w.WriteHeader(http.StatusNotFound) -} - -func (s *DockerServer) getExec(id string) (*docker.ExecInspect, error) { - s.execMut.RLock() - defer s.execMut.RUnlock() - for _, exec := range s.execs { - if exec.ID == id { - return exec, nil - } - } - return nil, errors.New("exec not found") -} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/server_test.go b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/server_test.go deleted file mode 100644 index 6c55d579..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/server_test.go +++ /dev/null @@ -1,1593 +0,0 @@ -// Copyright 2015 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package testing - -import ( - "bytes" - "encoding/json" - "fmt" - "math/rand" - "net" - "net/http" - "net/http/httptest" - "os" - "reflect" - "strings" - "testing" - "time" - - "github.com/fsouza/go-dockerclient" -) - -func TestNewServer(t *testing.T) { - server, err := NewServer("127.0.0.1:0", nil, nil) - if err != nil { - t.Fatal(err) - } - defer server.listener.Close() - conn, err := net.Dial("tcp", server.listener.Addr().String()) - if err != nil { - t.Fatal(err) - } - conn.Close() -} - -func TestServerStop(t *testing.T) { - server, err := NewServer("127.0.0.1:0", nil, nil) - if err != nil { - t.Fatal(err) - } - server.Stop() - _, err = net.Dial("tcp", server.listener.Addr().String()) - if err == nil { - t.Error("Unexpected error when dialing to stopped server") - } -} - -func TestServerStopNoListener(t *testing.T) { - server := DockerServer{} - server.Stop() -} - -func TestServerURL(t *testing.T) { - server, err := NewServer("127.0.0.1:0", nil, nil) - if err != nil { - t.Fatal(err) - } - defer server.Stop() - url := server.URL() - if expected := "http://" + server.listener.Addr().String() + "/"; url != expected { - t.Errorf("DockerServer.URL(): Want %q. Got %q.", expected, url) - } -} - -func TestServerURLNoListener(t *testing.T) { - server := DockerServer{} - url := server.URL() - if url != "" { - t.Errorf("DockerServer.URL(): Expected empty URL on handler mode, got %q.", url) - } -} - -func TestHandleWithHook(t *testing.T) { - var called bool - server, _ := NewServer("127.0.0.1:0", nil, func(*http.Request) { called = true }) - defer server.Stop() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if !called { - t.Error("ServeHTTP did not call the hook function.") - } -} - -func TestSetHook(t *testing.T) { - var called bool - server, _ := NewServer("127.0.0.1:0", nil, nil) - defer server.Stop() - server.SetHook(func(*http.Request) { called = true }) - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if !called { - t.Error("ServeHTTP did not call the hook function.") - } -} - -func TestCustomHandler(t *testing.T) { - var called bool - server, _ := NewServer("127.0.0.1:0", nil, nil) - addContainers(server, 2) - server.CustomHandler("/containers/json", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - called = true - fmt.Fprint(w, "Hello world") - })) - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if !called { - t.Error("Did not call the custom handler") - } - if got := recorder.Body.String(); got != "Hello world" { - t.Errorf("Wrong output for custom handler: want %q. Got %q.", "Hello world", got) - } -} - -func TestCustomHandlerRegexp(t *testing.T) { - var called bool - server, _ := NewServer("127.0.0.1:0", nil, nil) - addContainers(server, 2) - server.CustomHandler("/containers/.*/json", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - called = true - fmt.Fprint(w, "Hello world") - })) - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/.*/json?all=1", nil) - server.ServeHTTP(recorder, request) - if !called { - t.Error("Did not call the custom handler") - } - if got := recorder.Body.String(); got != "Hello world" { - t.Errorf("Wrong output for custom handler: want %q. Got %q.", "Hello world", got) - } -} - -func TestListContainers(t *testing.T) { - server := DockerServer{} - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("ListContainers: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - expected := make([]docker.APIContainers, 2) - for i, container := range server.containers { - expected[i] = docker.APIContainers{ - ID: container.ID, - Image: container.Image, - Command: strings.Join(container.Config.Cmd, " "), - Created: container.Created.Unix(), - Status: container.State.String(), - Ports: container.NetworkSettings.PortMappingAPI(), - Names: []string{"/" + container.Name}, - } - } - var got []docker.APIContainers - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(got, expected) { - t.Errorf("ListContainers. Want %#v. Got %#v.", expected, got) - } -} - -func TestListRunningContainers(t *testing.T) { - server := DockerServer{} - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=0", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("ListRunningContainers: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - var got []docker.APIContainers - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if len(got) == 0 { - t.Errorf("ListRunningContainers: Want 0. Got %d.", len(got)) - } -} - -func TestCreateContainer(t *testing.T) { - server := DockerServer{} - server.imgIDs = map[string]string{"base": "a1234"} - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Hostname":"", "User":"ubuntu", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, -"PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":"","HostConfig":{"Binds":["/var/run/docker.sock:/var/run/docker.sock:rw"]}}` - request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - var returned docker.Container - err := json.NewDecoder(recorder.Body).Decode(&returned) - if err != nil { - t.Fatal(err) - } - stored := server.containers[0] - if returned.ID != stored.ID { - t.Errorf("CreateContainer: ID mismatch. Stored: %q. Returned: %q.", stored.ID, returned.ID) - } - if stored.State.Running { - t.Errorf("CreateContainer should not set container to running state.") - } - if stored.Config.User != "ubuntu" { - t.Errorf("CreateContainer: wrong config. Expected: %q. Returned: %q.", "ubuntu", stored.Config.User) - } - expectedBind := []string{"/var/run/docker.sock:/var/run/docker.sock:rw"} - if !reflect.DeepEqual(stored.HostConfig.Binds, expectedBind) { - t.Errorf("CreateContainer: wrong host config. Expected: %v. Returned %v.", expectedBind, stored.HostConfig.Binds) - } -} - -func TestCreateContainerWithNotifyChannel(t *testing.T) { - ch := make(chan *docker.Container, 1) - server := DockerServer{} - server.imgIDs = map[string]string{"base": "a1234"} - server.cChan = ch - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Hostname":"", "User":"", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, -"PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":""}` - request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - if notified := <-ch; notified != server.containers[0] { - t.Errorf("CreateContainer: did not notify the proper container. Want %q. Got %q.", server.containers[0].ID, notified.ID) - } -} - -func TestCreateContainerInvalidBody(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader("whaaaaaat---")) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } -} - -func TestCreateContainerDuplicateName(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - server.imgIDs = map[string]string{"base": "a1234"} - addContainers(&server, 1) - server.containers[0].Name = "mycontainer" - recorder := httptest.NewRecorder() - body := `{"Hostname":"", "User":"ubuntu", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, -"PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":"","HostConfig":{"Binds":["/var/run/docker.sock:/var/run/docker.sock:rw"]}}` - request, _ := http.NewRequest("POST", "/containers/create?name=mycontainer", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusConflict { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusConflict, recorder.Code) - } -} - -func TestCreateMultipleContainersEmptyName(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - server.imgIDs = map[string]string{"base": "a1234"} - addContainers(&server, 1) - server.containers[0].Name = "" - recorder := httptest.NewRecorder() - body := `{"Hostname":"", "User":"ubuntu", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, -"PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":"","HostConfig":{"Binds":["/var/run/docker.sock:/var/run/docker.sock:rw"]}}` - request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - var returned docker.Container - err := json.NewDecoder(recorder.Body).Decode(&returned) - if err != nil { - t.Fatal(err) - } - stored := server.containers[1] - if returned.ID != stored.ID { - t.Errorf("CreateContainer: ID mismatch. Stored: %q. Returned: %q.", stored.ID, returned.ID) - } - if stored.State.Running { - t.Errorf("CreateContainer should not set container to running state.") - } - if stored.Config.User != "ubuntu" { - t.Errorf("CreateContainer: wrong config. Expected: %q. Returned: %q.", "ubuntu", stored.Config.User) - } - expectedBind := []string{"/var/run/docker.sock:/var/run/docker.sock:rw"} - if !reflect.DeepEqual(stored.HostConfig.Binds, expectedBind) { - t.Errorf("CreateContainer: wrong host config. Expected: %v. Returned %v.", expectedBind, stored.HostConfig.Binds) - } -} - -func TestCreateContainerInvalidName(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Hostname":"", "User":"", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, -"PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], -"Image":"base", "Volumes":{}, "VolumesFrom":""}` - request, _ := http.NewRequest("POST", "/containers/create?name=myapp/container1", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusInternalServerError { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusInternalServerError, recorder.Code) - } - expectedBody := "Invalid container name\n" - if got := recorder.Body.String(); got != expectedBody { - t.Errorf("CreateContainer: wrong body. Want %q. Got %q.", expectedBody, got) - } -} - -func TestCreateContainerImageNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Hostname":"", "User":"", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, -"PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], -"Image":"base", "Volumes":{}, "VolumesFrom":""}` - request, _ := http.NewRequest("POST", "/containers/create", strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestRenameContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - newName := server.containers[0].Name + "abc" - path := fmt.Sprintf("/containers/%s/rename?name=%s", server.containers[0].ID, newName) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RenameContainer: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - container := server.containers[0] - if container.Name != newName { - t.Errorf("RenameContainer: did not rename the container. Want %q. Got %q.", newName, container.Name) - } -} - -func TestRenameContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/containers/blabla/rename?name=something", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("RenameContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestCommitContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/commit?container="+server.containers[0].ID, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("CommitContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - expected := fmt.Sprintf(`{"ID":"%s"}`, server.images[0].ID) - if got := recorder.Body.String(); got != expected { - t.Errorf("CommitContainer: wrong response body. Want %q. Got %q.", expected, got) - } -} - -func TestCommitContainerComplete(t *testing.T) { - server := DockerServer{} - server.imgIDs = make(map[string]string) - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - queryString := "container=" + server.containers[0].ID + "&repo=tsuru/python&m=saving&author=developers" - queryString += `&run={"Cmd": ["cat", "/world"],"PortSpecs":["22"]}` - request, _ := http.NewRequest("POST", "/commit?"+queryString, nil) - server.ServeHTTP(recorder, request) - image := server.images[0] - if image.Parent != server.containers[0].Image { - t.Errorf("CommitContainer: wrong parent image. Want %q. Got %q.", server.containers[0].Image, image.Parent) - } - if image.Container != server.containers[0].ID { - t.Errorf("CommitContainer: wrong container. Want %q. Got %q.", server.containers[0].ID, image.Container) - } - message := "saving" - if image.Comment != message { - t.Errorf("CommitContainer: wrong comment (commit message). Want %q. Got %q.", message, image.Comment) - } - author := "developers" - if image.Author != author { - t.Errorf("CommitContainer: wrong author. Want %q. Got %q.", author, image.Author) - } - if id := server.imgIDs["tsuru/python"]; id != image.ID { - t.Errorf("CommitContainer: wrong ID saved for repository. Want %q. Got %q.", image.ID, id) - } - portSpecs := []string{"22"} - if !reflect.DeepEqual(image.Config.PortSpecs, portSpecs) { - t.Errorf("CommitContainer: wrong port spec in config. Want %#v. Got %#v.", portSpecs, image.Config.PortSpecs) - } - cmd := []string{"cat", "/world"} - if !reflect.DeepEqual(image.Config.Cmd, cmd) { - t.Errorf("CommitContainer: wrong cmd in config. Want %#v. Got %#v.", cmd, image.Config.Cmd) - } -} - -func TestCommitContainerWithTag(t *testing.T) { - server := DockerServer{} - server.imgIDs = make(map[string]string) - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - queryString := "container=" + server.containers[0].ID + "&repo=tsuru/python&tag=v1" - request, _ := http.NewRequest("POST", "/commit?"+queryString, nil) - server.ServeHTTP(recorder, request) - image := server.images[0] - if image.Parent != server.containers[0].Image { - t.Errorf("CommitContainer: wrong parent image. Want %q. Got %q.", server.containers[0].Image, image.Parent) - } - if image.Container != server.containers[0].ID { - t.Errorf("CommitContainer: wrong container. Want %q. Got %q.", server.containers[0].ID, image.Container) - } - if id := server.imgIDs["tsuru/python:v1"]; id != image.ID { - t.Errorf("CommitContainer: wrong ID saved for repository. Want %q. Got %q.", image.ID, id) - } -} - -func TestCommitContainerInvalidRun(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/commit?container="+server.containers[0].ID+"&run=abc---", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("CommitContainer. Wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } -} - -func TestCommitContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/commit?container=abc123", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("CommitContainer. Wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestInspectContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/json", server.containers[0].ID) - request, _ := http.NewRequest("GET", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("InspectContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - expected := server.containers[0] - var got docker.Container - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(got.Config, expected.Config) { - t.Errorf("InspectContainer: wrong value. Want %#v. Got %#v.", *expected, got) - } - if !reflect.DeepEqual(got.NetworkSettings, expected.NetworkSettings) { - t.Errorf("InspectContainer: wrong value. Want %#v. Got %#v.", *expected, got) - } - got.State.StartedAt = expected.State.StartedAt - got.State.FinishedAt = expected.State.FinishedAt - got.Config = expected.Config - got.Created = expected.Created - got.NetworkSettings = expected.NetworkSettings - if !reflect.DeepEqual(got, *expected) { - t.Errorf("InspectContainer: wrong value. Want %#v. Got %#v.", *expected, got) - } -} - -func TestInspectContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/abc123/json", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("InspectContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestTopContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/top", server.containers[0].ID) - request, _ := http.NewRequest("GET", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("TopContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - var got docker.TopResult - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(got.Titles, []string{"UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"}) { - t.Fatalf("TopContainer: Unexpected titles, got: %#v", got.Titles) - } - if len(got.Processes) != 1 { - t.Fatalf("TopContainer: Unexpected process len, got: %d", len(got.Processes)) - } - if got.Processes[0][len(got.Processes[0])-1] != "ls -la .." { - t.Fatalf("TopContainer: Unexpected command name, got: %s", got.Processes[0][len(got.Processes[0])-1]) - } -} - -func TestTopContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/xyz/top", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("TopContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestTopContainerStopped(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/top", server.containers[0].ID) - request, _ := http.NewRequest("GET", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusInternalServerError { - t.Errorf("TopContainer: wrong status. Want %d. Got %d.", http.StatusInternalServerError, recorder.Code) - } -} - -func TestStartContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - memory := int64(536870912) - hostConfig := docker.HostConfig{Memory: memory} - configBytes, err := json.Marshal(hostConfig) - if err != nil { - t.Fatal(err) - } - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/start", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, bytes.NewBuffer(configBytes)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if !server.containers[0].State.Running { - t.Error("StartContainer: did not set the container to running state") - } - if gotMemory := server.containers[0].HostConfig.Memory; gotMemory != memory { - t.Errorf("StartContainer: wrong HostConfig. Wants %d of memory. Got %s", memory, gotMemory) - } -} - -func TestStartContainerWithNotifyChannel(t *testing.T) { - ch := make(chan *docker.Container, 1) - server := DockerServer{} - server.cChan = ch - addContainers(&server, 1) - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/start", server.containers[1].ID) - request, _ := http.NewRequest("POST", path, bytes.NewBuffer([]byte("{}"))) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if notified := <-ch; notified != server.containers[1] { - t.Errorf("StartContainer: did not notify the proper container. Want %q. Got %q.", server.containers[1].ID, notified.ID) - } -} - -func TestStartContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - path := "/containers/abc123/start" - request, _ := http.NewRequest("POST", path, bytes.NewBuffer([]byte("null"))) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestStartContainerAlreadyRunning(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/start", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, bytes.NewBuffer([]byte("null"))) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("StartContainer: wrong status code. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } -} - -func TestStopContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/stop", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("StopContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if server.containers[0].State.Running { - t.Error("StopContainer: did not stop the container") - } -} - -func TestKillContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/kill", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("KillContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if server.containers[0].State.Running { - t.Error("KillContainer: did not stop the container") - } -} - -func TestStopContainerWithNotifyChannel(t *testing.T) { - ch := make(chan *docker.Container, 1) - server := DockerServer{} - server.cChan = ch - addContainers(&server, 1) - addContainers(&server, 1) - server.containers[1].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/stop", server.containers[1].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("StopContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if notified := <-ch; notified != server.containers[1] { - t.Errorf("StopContainer: did not notify the proper container. Want %q. Got %q.", server.containers[1].ID, notified.ID) - } -} - -func TestStopContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - path := "/containers/abc123/stop" - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("StopContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestStopContainerNotRunning(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/stop", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("StopContainer: wrong status code. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } -} - -func TestPauseContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/pause", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("PauseContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if !server.containers[0].State.Paused { - t.Error("PauseContainer: did not pause the container") - } -} - -func TestPauseContainerAlreadyPaused(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Paused = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/pause", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("PauseContainer: wrong status code. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } -} - -func TestPauseContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - path := "/containers/abc123/pause" - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("PauseContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestUnpauseContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Paused = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/unpause", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("UnpauseContainer: wrong status code. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if server.containers[0].State.Paused { - t.Error("UnpauseContainer: did not unpause the container") - } -} - -func TestUnpauseContainerNotPaused(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/unpause", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("UnpauseContainer: wrong status code. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } -} - -func TestUnpauseContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - path := "/containers/abc123/unpause" - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("UnpauseContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestWaitContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/wait", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - go func() { - server.cMut.Lock() - server.containers[0].State.Running = false - server.cMut.Unlock() - }() - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("WaitContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - expected := `{"StatusCode":0}` + "\n" - if body := recorder.Body.String(); body != expected { - t.Errorf("WaitContainer: wrong body. Want %q. Got %q.", expected, body) - } -} - -func TestWaitContainerStatus(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - server.containers[0].State.ExitCode = 63 - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/wait", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("WaitContainer: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - expected := `{"StatusCode":63}` + "\n" - if body := recorder.Body.String(); body != expected { - t.Errorf("WaitContainer: wrong body. Want %q. Got %q.", expected, body) - } -} - -func TestWaitContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - path := "/containers/abc123/wait" - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("WaitContainer: wrong status code. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestAttachContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s/attach?logs=1", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - lines := []string{ - fmt.Sprintf("\x01\x00\x00\x00\x03\x00\x00\x00Container %q is running", server.containers[0].ID), - "What happened?", - "Something happened", - } - expected := strings.Join(lines, "\n") + "\n" - if body := recorder.Body.String(); body == expected { - t.Errorf("AttachContainer: wrong body. Want %q. Got %q.", expected, body) - } -} - -func TestAttachContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - path := "/containers/abc123/attach?logs=1" - request, _ := http.NewRequest("POST", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("AttachContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestRemoveContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s", server.containers[0].ID) - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if len(server.containers) > 0 { - t.Error("RemoveContainer: did not remove the container.") - } -} - -func TestRemoveContainerByName(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s", server.containers[0].Name) - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if len(server.containers) > 0 { - t.Error("RemoveContainer: did not remove the container.") - } -} - -func TestRemoveContainerNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/abc123") - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestRemoveContainerRunning(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s", server.containers[0].ID) - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusInternalServerError { - t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusInternalServerError, recorder.Code) - } - if len(server.containers) < 1 { - t.Error("RemoveContainer: should not remove the container.") - } -} - -func TestRemoveContainerRunningForce(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.containers[0].State.Running = true - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/containers/%s?%s", server.containers[0].ID, "force=1") - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RemoveContainer: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if len(server.containers) > 0 { - t.Error("RemoveContainer: did not remove the container.") - } -} - -func TestPullImage(t *testing.T) { - server := DockerServer{imgIDs: make(map[string]string)} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/create?fromImage=base", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("PullImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if len(server.images) != 1 { - t.Errorf("PullImage: Want 1 image. Got %d.", len(server.images)) - } - if _, ok := server.imgIDs["base"]; !ok { - t.Error("PullImage: Repository should not be empty.") - } -} - -func TestPullImageWithTag(t *testing.T) { - server := DockerServer{imgIDs: make(map[string]string)} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/create?fromImage=base&tag=tag", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("PullImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if len(server.images) != 1 { - t.Errorf("PullImage: Want 1 image. Got %d.", len(server.images)) - } - if _, ok := server.imgIDs["base:tag"]; !ok { - t.Error("PullImage: Repository should not be empty.") - } -} - -func TestPushImage(t *testing.T) { - server := DockerServer{imgIDs: map[string]string{"tsuru/python": "a123"}} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/tsuru/python/push", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("PushImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } -} - -func TestPushImageWithTag(t *testing.T) { - server := DockerServer{imgIDs: map[string]string{"tsuru/python:v1": "a123"}} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/tsuru/python/push?tag=v1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("PushImage: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } -} - -func TestPushImageNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/tsuru/python/push", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("PushImage: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func TestTagImage(t *testing.T) { - server := DockerServer{imgIDs: map[string]string{"tsuru/python": "a123"}} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/tsuru/python/tag?repo=tsuru/new-python", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("TagImage: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - if server.imgIDs["tsuru/python"] != server.imgIDs["tsuru/new-python"] { - t.Errorf("TagImage: did not tag the image") - } -} - -func TestTagImageWithRepoAndTag(t *testing.T) { - server := DockerServer{imgIDs: map[string]string{"tsuru/python": "a123"}} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/tsuru/python/tag?repo=tsuru/new-python&tag=v1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusCreated { - t.Errorf("TagImage: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) - } - if server.imgIDs["tsuru/python"] != server.imgIDs["tsuru/new-python:v1"] { - t.Errorf("TagImage: did not tag the image") - } -} - -func TestTagImageNotFound(t *testing.T) { - server := DockerServer{} - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/images/tsuru/python/tag", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNotFound { - t.Errorf("TagImage: wrong status. Want %d. Got %d.", http.StatusNotFound, recorder.Code) - } -} - -func addContainers(server *DockerServer, n int) { - server.cMut.Lock() - defer server.cMut.Unlock() - for i := 0; i < n; i++ { - date := time.Now().Add(time.Duration((rand.Int() % (i + 1))) * time.Hour) - container := docker.Container{ - Name: fmt.Sprintf("%x", rand.Int()%10000), - ID: fmt.Sprintf("%x", rand.Int()%10000), - Created: date, - Path: "ls", - Args: []string{"-la", ".."}, - Config: &docker.Config{ - Hostname: fmt.Sprintf("docker-%d", i), - AttachStdout: true, - AttachStderr: true, - Env: []string{"ME=you", fmt.Sprintf("NUMBER=%d", i)}, - Cmd: []string{"ls", "-la", ".."}, - Image: "base", - }, - State: docker.State{ - Running: false, - Pid: 400 + i, - ExitCode: 0, - StartedAt: date, - }, - Image: "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", - NetworkSettings: &docker.NetworkSettings{ - IPAddress: fmt.Sprintf("10.10.10.%d", i+2), - IPPrefixLen: 24, - Gateway: "10.10.10.1", - Bridge: "docker0", - PortMapping: map[string]docker.PortMapping{ - "Tcp": {"8888": fmt.Sprintf("%d", 49600+i)}, - }, - }, - ResolvConfPath: "/etc/resolv.conf", - } - server.containers = append(server.containers, &container) - } -} - -func addImages(server *DockerServer, n int, repo bool) { - server.iMut.Lock() - defer server.iMut.Unlock() - if server.imgIDs == nil { - server.imgIDs = make(map[string]string) - } - for i := 0; i < n; i++ { - date := time.Now().Add(time.Duration((rand.Int() % (i + 1))) * time.Hour) - image := docker.Image{ - ID: fmt.Sprintf("%x", rand.Int()%10000), - Created: date, - } - server.images = append(server.images, image) - if repo { - repo := "docker/python-" + image.ID - server.imgIDs[repo] = image.ID - } - } -} - -func TestListImages(t *testing.T) { - server := DockerServer{} - addImages(&server, 2, true) - server.buildMuxer() - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/images/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("ListImages: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - expected := make([]docker.APIImages, 2) - for i, image := range server.images { - expected[i] = docker.APIImages{ - ID: image.ID, - Created: image.Created.Unix(), - RepoTags: []string{"docker/python-" + image.ID}, - } - } - var got []docker.APIImages - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(got, expected) { - t.Errorf("ListImages. Want %#v. Got %#v.", expected, got) - } -} - -func TestRemoveImage(t *testing.T) { - server := DockerServer{} - addImages(&server, 1, false) - server.buildMuxer() - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/images/%s", server.images[0].ID) - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RemoveImage: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if len(server.images) > 0 { - t.Error("RemoveImage: did not remove the image.") - } -} - -func TestRemoveImageByName(t *testing.T) { - server := DockerServer{} - addImages(&server, 1, true) - server.buildMuxer() - recorder := httptest.NewRecorder() - imgName := "docker/python-" + server.images[0].ID - path := "/images/" + imgName - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusNoContent { - t.Errorf("RemoveImage: wrong status. Want %d. Got %d.", http.StatusNoContent, recorder.Code) - } - if len(server.images) > 0 { - t.Error("RemoveImage: did not remove the image.") - } - _, ok := server.imgIDs[imgName] - if ok { - t.Error("RemoveImage: did not remove image tag name.") - } -} - -func TestRemoveImageWithMultipleTags(t *testing.T) { - server := DockerServer{} - addImages(&server, 1, true) - server.buildMuxer() - imgID := server.images[0].ID - imgName := "docker/python-" + imgID - server.imgIDs["docker/python-wat"] = imgID - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/images/%s", imgName) - request, _ := http.NewRequest("DELETE", path, nil) - server.ServeHTTP(recorder, request) - _, ok := server.imgIDs[imgName] - if ok { - t.Error("RemoveImage: did not remove image tag name.") - } - id, ok := server.imgIDs["docker/python-wat"] - if !ok { - t.Error("RemoveImage: removed the wrong tag name.") - } - if id != imgID { - t.Error("RemoveImage: disassociated the wrong ID from the tag") - } - if len(server.images) < 1 { - t.Fatal("RemoveImage: removed the image, but should keep it") - } - if server.images[0].ID != imgID { - t.Error("RemoveImage: changed the ID of the image!") - } -} - -func TestPrepareFailure(t *testing.T) { - server := DockerServer{failures: make(map[string]string)} - server.buildMuxer() - errorID := "my_error" - server.PrepareFailure(errorID, "containers/json") - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } - if recorder.Body.String() != errorID+"\n" { - t.Errorf("PrepareFailure: wrong message. Want %s. Got %s.", errorID, recorder.Body.String()) - } -} - -func TestPrepareMultiFailures(t *testing.T) { - server := DockerServer{multiFailures: []map[string]string{}} - server.buildMuxer() - errorID := "multi error" - server.PrepareMultiFailures(errorID, "containers/json") - server.PrepareMultiFailures(errorID, "containers/json") - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } - if recorder.Body.String() != errorID+"\n" { - t.Errorf("PrepareFailure: wrong message. Want %s. Got %s.", errorID, recorder.Body.String()) - } - recorder = httptest.NewRecorder() - request, _ = http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } - if recorder.Body.String() != errorID+"\n" { - t.Errorf("PrepareFailure: wrong message. Want %s. Got %s.", errorID, recorder.Body.String()) - } - recorder = httptest.NewRecorder() - request, _ = http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - if recorder.Body.String() == errorID+"\n" { - t.Errorf("PrepareFailure: wrong message. Want %s. Got %s.", errorID, recorder.Body.String()) - } -} - -func TestRemoveFailure(t *testing.T) { - server := DockerServer{failures: make(map[string]string)} - server.buildMuxer() - errorID := "my_error" - server.PrepareFailure(errorID, "containers/json") - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusBadRequest { - t.Errorf("PrepareFailure: wrong status. Want %d. Got %d.", http.StatusBadRequest, recorder.Code) - } - server.ResetFailure(errorID) - recorder = httptest.NewRecorder() - request, _ = http.NewRequest("GET", "/containers/json?all=1", nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Errorf("RemoveFailure: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } -} - -func TestResetMultiFailures(t *testing.T) { - server := DockerServer{multiFailures: []map[string]string{}} - server.buildMuxer() - errorID := "multi error" - server.PrepareMultiFailures(errorID, "containers/json") - server.PrepareMultiFailures(errorID, "containers/json") - if len(server.multiFailures) != 2 { - t.Errorf("PrepareMultiFailures: error adding multi failures.") - } - server.ResetMultiFailures() - if len(server.multiFailures) != 0 { - t.Errorf("ResetMultiFailures: error reseting multi failures.") - } -} - -func TestMutateContainer(t *testing.T) { - server := DockerServer{failures: make(map[string]string)} - server.buildMuxer() - server.containers = append(server.containers, &docker.Container{ID: "id123"}) - state := docker.State{Running: false, ExitCode: 1} - err := server.MutateContainer("id123", state) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(server.containers[0].State, state) { - t.Errorf("Wrong state after mutation.\nWant %#v.\nGot %#v.", - state, server.containers[0].State) - } -} - -func TestMutateContainerNotFound(t *testing.T) { - server := DockerServer{failures: make(map[string]string)} - server.buildMuxer() - state := docker.State{Running: false, ExitCode: 1} - err := server.MutateContainer("id123", state) - if err == nil { - t.Error("Unexpected error") - } - if err.Error() != "container not found" { - t.Errorf("wrong error message. Want %q. Got %q.", "container not found", err) - } -} - -func TestBuildImageWithContentTypeTar(t *testing.T) { - server := DockerServer{imgIDs: make(map[string]string)} - imageName := "teste" - recorder := httptest.NewRecorder() - tarFile, err := os.Open("data/dockerfile.tar") - if err != nil { - t.Fatal(err) - } - defer tarFile.Close() - request, _ := http.NewRequest("POST", "/build?t=teste", tarFile) - request.Header.Add("Content-Type", "application/tar") - server.buildImage(recorder, request) - if recorder.Body.String() == "miss Dockerfile" { - t.Errorf("BuildImage: miss Dockerfile") - return - } - if _, ok := server.imgIDs[imageName]; ok == false { - t.Errorf("BuildImage: image %s not builded", imageName) - } -} - -func TestBuildImageWithRemoteDockerfile(t *testing.T) { - server := DockerServer{imgIDs: make(map[string]string)} - imageName := "teste" - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("POST", "/build?t=teste&remote=http://localhost/Dockerfile", nil) - server.buildImage(recorder, request) - if _, ok := server.imgIDs[imageName]; ok == false { - t.Errorf("BuildImage: image %s not builded", imageName) - } -} - -func TestPing(t *testing.T) { - server := DockerServer{} - recorder := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/_ping", nil) - server.pingDocker(recorder, request) - if recorder.Body.String() != "" { - t.Errorf("Ping: Unexpected body: %s", recorder.Body.String()) - } - if recorder.Code != http.StatusOK { - t.Errorf("Ping: Expected code %d, got: %d", http.StatusOK, recorder.Code) - } -} - -func TestDefaultHandler(t *testing.T) { - server, err := NewServer("127.0.0.1:0", nil, nil) - if err != nil { - t.Fatal(err) - } - defer server.listener.Close() - if server.mux != server.DefaultHandler() { - t.Fatalf("DefaultHandler: Expected to return server.mux, got: %#v", server.DefaultHandler()) - } -} - -func TestCreateExecContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 2) - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Cmd": ["bash", "-c", "ls"]}` - path := fmt.Sprintf("/containers/%s/exec", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - serverExec := server.execs[0] - var got docker.Exec - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - if got.ID != serverExec.ID { - t.Errorf("CreateExec: wrong value. Want %#v. Got %#v.", serverExec.ID, got.ID) - } - expected := docker.ExecInspect{ - ID: got.ID, - ProcessConfig: docker.ExecProcessConfig{ - EntryPoint: "bash", - Arguments: []string{"-c", "ls"}, - }, - Container: *server.containers[0], - } - if !reflect.DeepEqual(*serverExec, expected) { - t.Errorf("InspectContainer: wrong value. Want:\n%#v\nGot:\n%#v\n", expected, *serverExec) - } -} - -func TestInspectExecContainer(t *testing.T) { - server := DockerServer{} - addContainers(&server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Cmd": ["bash", "-c", "ls"]}` - path := fmt.Sprintf("/containers/%s/exec", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - var got docker.Exec - err := json.NewDecoder(recorder.Body).Decode(&got) - if err != nil { - t.Fatal(err) - } - path = fmt.Sprintf("/exec/%s/json", got.ID) - request, _ = http.NewRequest("GET", path, nil) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - var got2 docker.ExecInspect - err = json.NewDecoder(recorder.Body).Decode(&got2) - if err != nil { - t.Fatal(err) - } - expected := docker.ExecInspect{ - ID: got.ID, - ProcessConfig: docker.ExecProcessConfig{ - EntryPoint: "bash", - Arguments: []string{"-c", "ls"}, - }, - Container: *server.containers[0], - } - got2.Container.State.StartedAt = expected.Container.State.StartedAt - got2.Container.State.FinishedAt = expected.Container.State.FinishedAt - got2.Container.Config = expected.Container.Config - got2.Container.Created = expected.Container.Created - got2.Container.NetworkSettings = expected.Container.NetworkSettings - if !reflect.DeepEqual(got2, expected) { - t.Errorf("InspectContainer: wrong value. Want:\n%#v\nGot:\n%#v\n", expected, got2) - } -} - -func TestStartExecContainer(t *testing.T) { - server, _ := NewServer("127.0.0.1:0", nil, nil) - addContainers(server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Cmd": ["bash", "-c", "ls"]}` - path := fmt.Sprintf("/containers/%s/exec", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - var exec docker.Exec - err := json.NewDecoder(recorder.Body).Decode(&exec) - if err != nil { - t.Fatal(err) - } - unleash := make(chan bool) - server.PrepareExec(exec.ID, func() { - <-unleash - }) - codes := make(chan int, 1) - sent := make(chan bool) - go func() { - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/exec/%s/start", exec.ID) - body := `{"Tty":true}` - request, _ := http.NewRequest("POST", path, strings.NewReader(body)) - close(sent) - server.ServeHTTP(recorder, request) - codes <- recorder.Code - }() - <-sent - execInfo, err := waitExec(server.URL(), exec.ID, true, 5) - if err != nil { - t.Fatal(err) - } - if !execInfo.Running { - t.Error("StartExec: expected exec to be running, but it's not running") - } - close(unleash) - if code := <-codes; code != http.StatusOK { - t.Errorf("StartExec: wrong status. Want %d. Got %d.", http.StatusOK, code) - } - execInfo, err = waitExec(server.URL(), exec.ID, false, 5) - if err != nil { - t.Fatal(err) - } - if execInfo.Running { - t.Error("StartExec: expected exec to be not running after start returns, but it's running") - } -} - -func TestStartExecContainerWildcardCallback(t *testing.T) { - server, _ := NewServer("127.0.0.1:0", nil, nil) - addContainers(server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Cmd": ["bash", "-c", "ls"]}` - path := fmt.Sprintf("/containers/%s/exec", server.containers[0].ID) - request, _ := http.NewRequest("POST", path, strings.NewReader(body)) - server.ServeHTTP(recorder, request) - if recorder.Code != http.StatusOK { - t.Fatalf("CreateExec: wrong status. Want %d. Got %d.", http.StatusOK, recorder.Code) - } - unleash := make(chan bool) - server.PrepareExec("*", func() { - <-unleash - }) - var exec docker.Exec - err := json.NewDecoder(recorder.Body).Decode(&exec) - if err != nil { - t.Fatal(err) - } - codes := make(chan int, 1) - sent := make(chan bool) - go func() { - recorder := httptest.NewRecorder() - path := fmt.Sprintf("/exec/%s/start", exec.ID) - body := `{"Tty":true}` - request, _ := http.NewRequest("POST", path, strings.NewReader(body)) - close(sent) - server.ServeHTTP(recorder, request) - codes <- recorder.Code - }() - <-sent - execInfo, err := waitExec(server.URL(), exec.ID, true, 5) - if err != nil { - t.Fatal(err) - } - if !execInfo.Running { - t.Error("StartExec: expected exec to be running, but it's not running") - } - close(unleash) - if code := <-codes; code != http.StatusOK { - t.Errorf("StartExec: wrong status. Want %d. Got %d.", http.StatusOK, code) - } - execInfo, err = waitExec(server.URL(), exec.ID, false, 5) - if err != nil { - t.Fatal(err) - } - if execInfo.Running { - t.Error("StartExec: expected exec to be not running after start returns, but it's running") - } -} - -func TestStartExecContainerNotFound(t *testing.T) { - server, _ := NewServer("127.0.0.1:0", nil, nil) - addContainers(server, 1) - server.buildMuxer() - recorder := httptest.NewRecorder() - body := `{"Tty":true}` - request, _ := http.NewRequest("POST", "/exec/something-wat/start", strings.NewReader(body)) - server.ServeHTTP(recorder, request) -} - -func waitExec(url, execID string, running bool, maxTry int) (*docker.ExecInspect, error) { - client, err := docker.NewClient(url) - if err != nil { - return nil, err - } - exec, err := client.InspectExec(execID) - for i := 0; i < maxTry && exec.Running != running && err == nil; i++ { - time.Sleep(100e6) - exec, err = client.InspectExec(exec.ID) - } - return exec, err -} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/CHANGELOG.md b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/CHANGELOG.md deleted file mode 100644 index 49c5506a..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/CHANGELOG.md +++ /dev/null @@ -1,21 +0,0 @@ -# 0.8.2 - -logrus: fix more Fatal family functions - -# 0.8.1 - -logrus: fix not exiting on `Fatalf` and `Fatalln` - -# 0.8.0 - -logrus: defaults to stderr instead of stdout -hooks/sentry: add special field for `*http.Request` -formatter/text: ignore Windows for colors - -# 0.7.3 - -formatter/\*: allow configuration of timestamp layout - -# 0.7.2 - -formatter/text: Add configuration option for time format (#158) diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/terminal_freebsd.go b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/terminal_freebsd.go deleted file mode 100644 index 0428ee5d..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/terminal_freebsd.go +++ /dev/null @@ -1,20 +0,0 @@ -/* - Go 1.2 doesn't include Termios for FreeBSD. This should be added in 1.3 and this could be merged with terminal_darwin. -*/ -package logrus - -import ( - "syscall" -) - -const ioctlReadTermios = syscall.TIOCGETA - -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed uint32 - Ospeed uint32 -} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/archive/diff.go b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/archive/diff.go deleted file mode 100644 index 92904be3..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/archive/diff.go +++ /dev/null @@ -1,168 +0,0 @@ -package archive - -import ( - "archive/tar" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "syscall" - - "github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/pools" - "github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system" -) - -func UnpackLayer(dest string, layer ArchiveReader) (size int64, err error) { - tr := tar.NewReader(layer) - trBuf := pools.BufioReader32KPool.Get(tr) - defer pools.BufioReader32KPool.Put(trBuf) - - var dirs []*tar.Header - - aufsTempdir := "" - aufsHardlinks := make(map[string]*tar.Header) - - // Iterate through the files in the archive. - for { - hdr, err := tr.Next() - if err == io.EOF { - // end of tar archive - break - } - if err != nil { - return 0, err - } - - size += hdr.Size - - // Normalize name, for safety and for a simple is-root check - hdr.Name = filepath.Clean(hdr.Name) - - if !strings.HasSuffix(hdr.Name, "/") { - // Not the root directory, ensure that the parent directory exists. - // This happened in some tests where an image had a tarfile without any - // parent directories. - parent := filepath.Dir(hdr.Name) - parentPath := filepath.Join(dest, parent) - if _, err := os.Lstat(parentPath); err != nil && os.IsNotExist(err) { - err = system.MkdirAll(parentPath, 0600) - if err != nil { - return 0, err - } - } - } - - // Skip AUFS metadata dirs - if strings.HasPrefix(hdr.Name, ".wh..wh.") { - // Regular files inside /.wh..wh.plnk can be used as hardlink targets - // We don't want this directory, but we need the files in them so that - // such hardlinks can be resolved. - if strings.HasPrefix(hdr.Name, ".wh..wh.plnk") && hdr.Typeflag == tar.TypeReg { - basename := filepath.Base(hdr.Name) - aufsHardlinks[basename] = hdr - if aufsTempdir == "" { - if aufsTempdir, err = ioutil.TempDir("", "dockerplnk"); err != nil { - return 0, err - } - defer os.RemoveAll(aufsTempdir) - } - if err := createTarFile(filepath.Join(aufsTempdir, basename), dest, hdr, tr, true); err != nil { - return 0, err - } - } - continue - } - - path := filepath.Join(dest, hdr.Name) - rel, err := filepath.Rel(dest, path) - if err != nil { - return 0, err - } - if strings.HasPrefix(rel, "../") { - return 0, breakoutError(fmt.Errorf("%q is outside of %q", hdr.Name, dest)) - } - base := filepath.Base(path) - - if strings.HasPrefix(base, ".wh.") { - originalBase := base[len(".wh."):] - originalPath := filepath.Join(filepath.Dir(path), originalBase) - if err := os.RemoveAll(originalPath); err != nil { - return 0, err - } - } else { - // If path exits we almost always just want to remove and replace it. - // The only exception is when it is a directory *and* the file from - // the layer is also a directory. Then we want to merge them (i.e. - // just apply the metadata from the layer). - if fi, err := os.Lstat(path); err == nil { - if !(fi.IsDir() && hdr.Typeflag == tar.TypeDir) { - if err := os.RemoveAll(path); err != nil { - return 0, err - } - } - } - - trBuf.Reset(tr) - srcData := io.Reader(trBuf) - srcHdr := hdr - - // Hard links into /.wh..wh.plnk don't work, as we don't extract that directory, so - // we manually retarget these into the temporary files we extracted them into - if hdr.Typeflag == tar.TypeLink && strings.HasPrefix(filepath.Clean(hdr.Linkname), ".wh..wh.plnk") { - linkBasename := filepath.Base(hdr.Linkname) - srcHdr = aufsHardlinks[linkBasename] - if srcHdr == nil { - return 0, fmt.Errorf("Invalid aufs hardlink") - } - tmpFile, err := os.Open(filepath.Join(aufsTempdir, linkBasename)) - if err != nil { - return 0, err - } - defer tmpFile.Close() - srcData = tmpFile - } - - if err := createTarFile(path, dest, srcHdr, srcData, true); err != nil { - return 0, err - } - - // Directory mtimes must be handled at the end to avoid further - // file creation in them to modify the directory mtime - if hdr.Typeflag == tar.TypeDir { - dirs = append(dirs, hdr) - } - } - } - - for _, hdr := range dirs { - path := filepath.Join(dest, hdr.Name) - ts := []syscall.Timespec{timeToTimespec(hdr.AccessTime), timeToTimespec(hdr.ModTime)} - if err := syscall.UtimesNano(path, ts); err != nil { - return 0, err - } - } - - return size, nil -} - -// ApplyLayer parses a diff in the standard layer format from `layer`, and -// applies it to the directory `dest`. Returns the size in bytes of the -// contents of the layer. -func ApplyLayer(dest string, layer ArchiveReader) (int64, error) { - dest = filepath.Clean(dest) - - // We need to be able to set any perms - oldmask, err := system.Umask(0) - if err != nil { - return 0, err - } - defer system.Umask(oldmask) // ignore err, ErrNotSupportedPlatform - - layer, err = DecompressStream(layer) - if err != nil { - return 0, err - } - return UnpackLayer(dest, layer) -} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/ioutils/readers.go b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/ioutils/readers.go deleted file mode 100644 index 0e542cba..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/ioutils/readers.go +++ /dev/null @@ -1,227 +0,0 @@ -package ioutils - -import ( - "bytes" - "crypto/rand" - "crypto/sha256" - "encoding/hex" - "io" - "math/big" - "sync" - "time" -) - -type readCloserWrapper struct { - io.Reader - closer func() error -} - -func (r *readCloserWrapper) Close() error { - return r.closer() -} - -func NewReadCloserWrapper(r io.Reader, closer func() error) io.ReadCloser { - return &readCloserWrapper{ - Reader: r, - closer: closer, - } -} - -type readerErrWrapper struct { - reader io.Reader - closer func() -} - -func (r *readerErrWrapper) Read(p []byte) (int, error) { - n, err := r.reader.Read(p) - if err != nil { - r.closer() - } - return n, err -} - -func NewReaderErrWrapper(r io.Reader, closer func()) io.Reader { - return &readerErrWrapper{ - reader: r, - closer: closer, - } -} - -// bufReader allows the underlying reader to continue to produce -// output by pre-emptively reading from the wrapped reader. -// This is achieved by buffering this data in bufReader's -// expanding buffer. -type bufReader struct { - sync.Mutex - buf *bytes.Buffer - reader io.Reader - err error - wait sync.Cond - drainBuf []byte - reuseBuf []byte - maxReuse int64 - resetTimeout time.Duration - bufLenResetThreshold int64 - maxReadDataReset int64 -} - -func NewBufReader(r io.Reader) *bufReader { - var timeout int - if randVal, err := rand.Int(rand.Reader, big.NewInt(120)); err == nil { - timeout = int(randVal.Int64()) + 180 - } else { - timeout = 300 - } - reader := &bufReader{ - buf: &bytes.Buffer{}, - drainBuf: make([]byte, 1024), - reuseBuf: make([]byte, 4096), - maxReuse: 1000, - resetTimeout: time.Second * time.Duration(timeout), - bufLenResetThreshold: 100 * 1024, - maxReadDataReset: 10 * 1024 * 1024, - reader: r, - } - reader.wait.L = &reader.Mutex - go reader.drain() - return reader -} - -func NewBufReaderWithDrainbufAndBuffer(r io.Reader, drainBuffer []byte, buffer *bytes.Buffer) *bufReader { - reader := &bufReader{ - buf: buffer, - drainBuf: drainBuffer, - reader: r, - } - reader.wait.L = &reader.Mutex - go reader.drain() - return reader -} - -func (r *bufReader) drain() { - var ( - duration time.Duration - lastReset time.Time - now time.Time - reset bool - bufLen int64 - dataSinceReset int64 - maxBufLen int64 - reuseBufLen int64 - reuseCount int64 - ) - reuseBufLen = int64(len(r.reuseBuf)) - lastReset = time.Now() - for { - n, err := r.reader.Read(r.drainBuf) - dataSinceReset += int64(n) - r.Lock() - bufLen = int64(r.buf.Len()) - if bufLen > maxBufLen { - maxBufLen = bufLen - } - - // Avoid unbounded growth of the buffer over time. - // This has been discovered to be the only non-intrusive - // solution to the unbounded growth of the buffer. - // Alternative solutions such as compression, multiple - // buffers, channels and other similar pieces of code - // were reducing throughput, overall Docker performance - // or simply crashed Docker. - // This solution releases the buffer when specific - // conditions are met to avoid the continuous resizing - // of the buffer for long lived containers. - // - // Move data to the front of the buffer if it's - // smaller than what reuseBuf can store - if bufLen > 0 && reuseBufLen >= bufLen { - n, _ := r.buf.Read(r.reuseBuf) - r.buf.Write(r.reuseBuf[0:n]) - // Take action if the buffer has been reused too many - // times and if there's data in the buffer. - // The timeout is also used as means to avoid doing - // these operations more often or less often than - // required. - // The various conditions try to detect heavy activity - // in the buffer which might be indicators of heavy - // growth of the buffer. - } else if reuseCount >= r.maxReuse && bufLen > 0 { - now = time.Now() - duration = now.Sub(lastReset) - timeoutReached := duration >= r.resetTimeout - - // The timeout has been reached and the - // buffered data couldn't be moved to the front - // of the buffer, so the buffer gets reset. - if timeoutReached && bufLen > reuseBufLen { - reset = true - } - // The amount of buffered data is too high now, - // reset the buffer. - if timeoutReached && maxBufLen >= r.bufLenResetThreshold { - reset = true - } - // Reset the buffer if a certain amount of - // data has gone through the buffer since the - // last reset. - if timeoutReached && dataSinceReset >= r.maxReadDataReset { - reset = true - } - // The buffered data is moved to a fresh buffer, - // swap the old buffer with the new one and - // reset all counters. - if reset { - newbuf := &bytes.Buffer{} - newbuf.ReadFrom(r.buf) - r.buf = newbuf - lastReset = now - reset = false - dataSinceReset = 0 - maxBufLen = 0 - reuseCount = 0 - } - } - if err != nil { - r.err = err - } else { - r.buf.Write(r.drainBuf[0:n]) - } - reuseCount++ - r.wait.Signal() - r.Unlock() - if err != nil { - break - } - } -} - -func (r *bufReader) Read(p []byte) (n int, err error) { - r.Lock() - defer r.Unlock() - for { - n, err = r.buf.Read(p) - if n > 0 { - return n, err - } - if r.err != nil { - return 0, r.err - } - r.wait.Wait() - } -} - -func (r *bufReader) Close() error { - closer, ok := r.reader.(io.ReadCloser) - if !ok { - return nil - } - return closer.Close() -} - -func HashData(src io.Reader) (string, error) { - h := sha256.New() - if _, err := io.Copy(h, src); err != nil { - return "", err - } - return "sha256:" + hex.EncodeToString(h.Sum(nil)), nil -} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/stdcopy/stdcopy_test.go b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/stdcopy/stdcopy_test.go deleted file mode 100644 index a9fd73a4..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/stdcopy/stdcopy_test.go +++ /dev/null @@ -1,85 +0,0 @@ -package stdcopy - -import ( - "bytes" - "io/ioutil" - "strings" - "testing" -) - -func TestNewStdWriter(t *testing.T) { - writer := NewStdWriter(ioutil.Discard, Stdout) - if writer == nil { - t.Fatalf("NewStdWriter with an invalid StdType should not return nil.") - } -} - -func TestWriteWithUnitializedStdWriter(t *testing.T) { - writer := StdWriter{ - Writer: nil, - prefix: Stdout, - sizeBuf: make([]byte, 4), - } - n, err := writer.Write([]byte("Something here")) - if n != 0 || err == nil { - t.Fatalf("Should fail when given an uncomplete or uninitialized StdWriter") - } -} - -func TestWriteWithNilBytes(t *testing.T) { - writer := NewStdWriter(ioutil.Discard, Stdout) - n, err := writer.Write(nil) - if err != nil { - t.Fatalf("Shouldn't have fail when given no data") - } - if n > 0 { - t.Fatalf("Write should have written 0 byte, but has written %d", n) - } -} - -func TestWrite(t *testing.T) { - writer := NewStdWriter(ioutil.Discard, Stdout) - data := []byte("Test StdWrite.Write") - n, err := writer.Write(data) - if err != nil { - t.Fatalf("Error while writing with StdWrite") - } - if n != len(data) { - t.Fatalf("Write should have writen %d byte but wrote %d.", len(data), n) - } -} - -func TestStdCopyWithInvalidInputHeader(t *testing.T) { - dstOut := NewStdWriter(ioutil.Discard, Stdout) - dstErr := NewStdWriter(ioutil.Discard, Stderr) - src := strings.NewReader("Invalid input") - _, err := StdCopy(dstOut, dstErr, src) - if err == nil { - t.Fatal("StdCopy with invalid input header should fail.") - } -} - -func TestStdCopyWithCorruptedPrefix(t *testing.T) { - data := []byte{0x01, 0x02, 0x03} - src := bytes.NewReader(data) - written, err := StdCopy(nil, nil, src) - if err != nil { - t.Fatalf("StdCopy should not return an error with corrupted prefix.") - } - if written != 0 { - t.Fatalf("StdCopy should have written 0, but has written %d", written) - } -} - -func BenchmarkWrite(b *testing.B) { - w := NewStdWriter(ioutil.Discard, Stdout) - data := []byte("Test line for testing stdwriter performance\n") - data = bytes.Repeat(data, 100) - b.SetBytes(int64(len(data))) - b.ResetTimer() - for i := 0; i < b.N; i++ { - if _, err := w.Write(data); err != nil { - b.Fatal(err) - } - } -} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/filesys.go b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/filesys.go deleted file mode 100644 index e1f70e8d..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/filesys.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build !windows - -package system - -import ( - "os" -) - -func MkdirAll(path string, perm os.FileMode) error { - return os.MkdirAll(path, perm) -} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/stat.go b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/stat.go deleted file mode 100644 index e2ecfe52..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/stat.go +++ /dev/null @@ -1,46 +0,0 @@ -// +build !windows - -package system - -import ( - "syscall" -) - -// Stat_t type contains status of a file. It contains metadata -// like permission, owner, group, size, etc about a file -type Stat_t struct { - mode uint32 - uid uint32 - gid uint32 - rdev uint64 - size int64 - mtim syscall.Timespec -} - -func (s Stat_t) Mode() uint32 { - return s.mode -} - -func (s Stat_t) Uid() uint32 { - return s.uid -} - -func (s Stat_t) Gid() uint32 { - return s.gid -} - -func (s Stat_t) Rdev() uint64 { - return s.rdev -} - -func (s Stat_t) Size() int64 { - return s.size -} - -func (s Stat_t) Mtim() syscall.Timespec { - return s.mtim -} - -func (s Stat_t) GetLastModification() syscall.Timespec { - return s.Mtim() -} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/stat_unsupported.go b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/stat_unsupported.go deleted file mode 100644 index 7e0d0348..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/stat_unsupported.go +++ /dev/null @@ -1,17 +0,0 @@ -// +build !linux,!windows - -package system - -import ( - "syscall" -) - -// fromStatT creates a system.Stat_t type from a syscall.Stat_t type -func fromStatT(s *syscall.Stat_t) (*Stat_t, error) { - return &Stat_t{size: s.Size, - mode: uint32(s.Mode), - uid: s.Uid, - gid: s.Gid, - rdev: uint64(s.Rdev), - mtim: s.Mtimespec}, nil -} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/stat_windows.go b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/stat_windows.go deleted file mode 100644 index b1fd39e8..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/stat_windows.go +++ /dev/null @@ -1,36 +0,0 @@ -// +build windows - -package system - -import ( - "os" - "time" -) - -type Stat_t struct { - name string - size int64 - mode os.FileMode - modTime time.Time - isDir bool -} - -func (s Stat_t) Name() string { - return s.name -} - -func (s Stat_t) Size() int64 { - return s.size -} - -func (s Stat_t) Mode() os.FileMode { - return s.mode -} - -func (s Stat_t) ModTime() time.Time { - return s.modTime -} - -func (s Stat_t) IsDir() bool { - return s.isDir -} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/utimes_linux.go b/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/utimes_linux.go deleted file mode 100644 index 8f902982..00000000 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/system/utimes_linux.go +++ /dev/null @@ -1,28 +0,0 @@ -package system - -import ( - "syscall" - "unsafe" -) - -func LUtimesNano(path string, ts []syscall.Timespec) error { - // These are not currently available in syscall - AT_FDCWD := -100 - AT_SYMLINK_NOFOLLOW := 0x100 - - var _path *byte - _path, err := syscall.BytePtrFromString(path) - if err != nil { - return err - } - - if _, _, err := syscall.Syscall6(syscall.SYS_UTIMENSAT, uintptr(AT_FDCWD), uintptr(unsafe.Pointer(_path)), uintptr(unsafe.Pointer(&ts[0])), uintptr(AT_SYMLINK_NOFOLLOW), 0, 0); err != 0 && err != syscall.ENOSYS { - return err - } - - return nil -} - -func UtimesNano(path string, ts []syscall.Timespec) error { - return syscall.UtimesNano(path, ts) -} diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/README.md b/Godeps/_workspace/src/github.com/samalba/dockerclient/README.md deleted file mode 100644 index 5a5027b8..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/README.md +++ /dev/null @@ -1,98 +0,0 @@ -Docker client library in Go -=========================== -[![GoDoc](http://godoc.org/github.com/samalba/dockerclient?status.png)](http://godoc.org/github.com/samalba/dockerclient) - -Well maintained docker client library. - -# How to use it? - -Here is an example showing how to use it: - -```go -package main - -import ( - "github.com/samalba/dockerclient" - "log" - "time" - "os" -) - -// Callback used to listen to Docker's events -func eventCallback(event *dockerclient.Event, ec chan error, args ...interface{}) { - log.Printf("Received event: %#v\n", *event) -} - -func main() { - // Init the client - docker, _ := dockerclient.NewDockerClient("unix:///var/run/docker.sock", nil) - - // Get only running containers - containers, err := docker.ListContainers(false, false, "") - if err != nil { - log.Fatal(err) - } - for _, c := range containers { - log.Println(c.Id, c.Names) - } - - // Inspect the first container returned - if len(containers) > 0 { - id := containers[0].Id - info, _ := docker.InspectContainer(id) - log.Println(info) - } - - // Build a docker image - // some.tar contains the build context (Dockerfile any any files it needs to add/copy) - dockerBuildContext, err := os.Open("some.tar") - defer dockerBuildContext.Close() - buildImageConfig := &dockerclient.BuildImage{ - Context: dockerBuildContext, - RepoName: "your_image_name", - SuppressOutput: false, - } - reader, err := docker.BuildImage(buildImageConfig) - if err != nil { - log.Fatal(err) - } - - // Create a container - containerConfig := &dockerclient.ContainerConfig{ - Image: "ubuntu:14.04", - Cmd: []string{"bash"}, - AttachStdin: true, - Tty: true} - containerId, err := docker.CreateContainer(containerConfig, "foobar") - if err != nil { - log.Fatal(err) - } - - // Start the container - hostConfig := &dockerclient.HostConfig{} - err = docker.StartContainer(containerId, hostConfig) - if err != nil { - log.Fatal(err) - } - - // Stop the container (with 5 seconds timeout) - docker.StopContainer(containerId, 5) - - // Listen to events - docker.StartMonitorEvents(eventCallback, nil) - - // Hold the execution to look at the events coming - time.Sleep(3600 * time.Second) -} -``` - -# Maintainers - -List of people you can ping for feedback on Pull Requests or any questions. - -- [Sam Alba](https://github.com/samalba) -- [Michael Crosby](https://github.com/crosbymichael) -- [Andrea Luzzardi](https://github.com/aluzzardi) -- [Victor Vieux](https://github.com/vieux) -- [Evan Hazlett](https://github.com/ehazlett) -- [Donald Huang](https://github.com/donhcd) diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/auth.go b/Godeps/_workspace/src/github.com/samalba/dockerclient/auth.go deleted file mode 100644 index 48f5f90b..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/auth.go +++ /dev/null @@ -1,38 +0,0 @@ -package dockerclient - -import ( - "bytes" - "encoding/base64" - "encoding/json" -) - -// AuthConfig hold parameters for authenticating with the docker registry -type AuthConfig struct { - Username string `json:"username,omitempty"` - Password string `json:"password,omitempty"` - Email string `json:"email,omitempty"` -} - -// encode the auth configuration struct into base64 for the X-Registry-Auth header -func (c *AuthConfig) encode() (string, error) { - var buf bytes.Buffer - if err := json.NewEncoder(&buf).Encode(c); err != nil { - return "", err - } - return base64.URLEncoding.EncodeToString(buf.Bytes()), nil -} - -// ConfigFile holds parameters for authenticating during a BuildImage request -type ConfigFile struct { - Configs map[string]AuthConfig `json:"configs,omitempty"` - rootPath string -} - -// encode the configuration struct into base64 for the X-Registry-Config header -func (c *ConfigFile) encode() (string, error) { - var buf bytes.Buffer - if err := json.NewEncoder(&buf).Encode(c); err != nil { - return "", err - } - return base64.URLEncoding.EncodeToString(buf.Bytes()), nil -} diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/auth_test.go b/Godeps/_workspace/src/github.com/samalba/dockerclient/auth_test.go deleted file mode 100644 index 99801b22..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/auth_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package dockerclient - -import ( - "testing" -) - -func TestAuthEncode(t *testing.T) { - a := AuthConfig{Username: "foo", Password: "password", Email: "bar@baz.com"} - expected := "eyJ1c2VybmFtZSI6ImZvbyIsInBhc3N3b3JkIjoicGFzc3dvcmQiLCJlbWFpbCI6ImJhckBiYXouY29tIn0K" - got, _ := a.encode() - - if expected != got { - t.Errorf("testAuthEncode failed. Expected [%s] got [%s]", expected, got) - } -} diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/dockerclient.go b/Godeps/_workspace/src/github.com/samalba/dockerclient/dockerclient.go deleted file mode 100644 index d8b11f4c..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/dockerclient.go +++ /dev/null @@ -1,714 +0,0 @@ -package dockerclient - -import ( - "bytes" - "crypto/tls" - "encoding/json" - "errors" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "strconv" - "strings" - "sync/atomic" - "time" -) - -const ( - APIVersion = "v1.15" -) - -var ( - ErrNotFound = errors.New("Not found") - - defaultTimeout = 30 * time.Second -) - -type DockerClient struct { - URL *url.URL - HTTPClient *http.Client - TLSConfig *tls.Config - monitorStats int32 - eventStopChan chan (struct{}) -} - -type Error struct { - StatusCode int - Status string - msg string -} - -func (e Error) Error() string { - return fmt.Sprintf("%s: %s", e.Status, e.msg) -} - -func NewDockerClient(daemonUrl string, tlsConfig *tls.Config) (*DockerClient, error) { - return NewDockerClientTimeout(daemonUrl, tlsConfig, time.Duration(defaultTimeout)) -} - -func NewDockerClientTimeout(daemonUrl string, tlsConfig *tls.Config, timeout time.Duration) (*DockerClient, error) { - u, err := url.Parse(daemonUrl) - if err != nil { - return nil, err - } - if u.Scheme == "" || u.Scheme == "tcp" { - if tlsConfig == nil { - u.Scheme = "http" - } else { - u.Scheme = "https" - } - } - httpClient := newHTTPClient(u, tlsConfig, timeout) - return &DockerClient{u, httpClient, tlsConfig, 0, nil}, nil -} - -func (client *DockerClient) doRequest(method string, path string, body []byte, headers map[string]string) ([]byte, error) { - b := bytes.NewBuffer(body) - - reader, err := client.doStreamRequest(method, path, b, headers) - if err != nil { - return nil, err - } - - defer reader.Close() - data, err := ioutil.ReadAll(reader) - if err != nil { - return nil, err - } - return data, nil -} - -func (client *DockerClient) doStreamRequest(method string, path string, in io.Reader, headers map[string]string) (io.ReadCloser, error) { - if (method == "POST" || method == "PUT") && in == nil { - in = bytes.NewReader(nil) - } - req, err := http.NewRequest(method, client.URL.String()+path, in) - if err != nil { - return nil, err - } - req.Header.Add("Content-Type", "application/json") - if headers != nil { - for header, value := range headers { - req.Header.Add(header, value) - } - } - resp, err := client.HTTPClient.Do(req) - if err != nil { - if !strings.Contains(err.Error(), "connection refused") && client.TLSConfig == nil { - return nil, fmt.Errorf("%v. Are you trying to connect to a TLS-enabled daemon without TLS?", err) - } - return nil, err - } - if resp.StatusCode == 404 { - return nil, ErrNotFound - } - if resp.StatusCode >= 400 { - defer resp.Body.Close() - data, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - return nil, Error{StatusCode: resp.StatusCode, Status: resp.Status, msg: string(data)} - } - - return resp.Body, nil -} - -func (client *DockerClient) Info() (*Info, error) { - uri := fmt.Sprintf("/%s/info", APIVersion) - data, err := client.doRequest("GET", uri, nil, nil) - if err != nil { - return nil, err - } - ret := &Info{} - err = json.Unmarshal(data, &ret) - if err != nil { - return nil, err - } - return ret, nil -} - -func (client *DockerClient) ListContainers(all bool, size bool, filters string) ([]Container, error) { - argAll := 0 - if all == true { - argAll = 1 - } - showSize := 0 - if size == true { - showSize = 1 - } - uri := fmt.Sprintf("/%s/containers/json?all=%d&size=%d", APIVersion, argAll, showSize) - - if filters != "" { - uri += "&filters=" + filters - } - - data, err := client.doRequest("GET", uri, nil, nil) - if err != nil { - return nil, err - } - ret := []Container{} - err = json.Unmarshal(data, &ret) - if err != nil { - return nil, err - } - return ret, nil -} - -func (client *DockerClient) InspectContainer(id string) (*ContainerInfo, error) { - uri := fmt.Sprintf("/%s/containers/%s/json", APIVersion, id) - data, err := client.doRequest("GET", uri, nil, nil) - if err != nil { - return nil, err - } - info := &ContainerInfo{} - err = json.Unmarshal(data, info) - if err != nil { - return nil, err - } - return info, nil -} - -func (client *DockerClient) CreateContainer(config *ContainerConfig, name string) (string, error) { - data, err := json.Marshal(config) - if err != nil { - return "", err - } - uri := fmt.Sprintf("/%s/containers/create", APIVersion) - if name != "" { - v := url.Values{} - v.Set("name", name) - uri = fmt.Sprintf("%s?%s", uri, v.Encode()) - } - data, err = client.doRequest("POST", uri, data, nil) - if err != nil { - return "", err - } - result := &RespContainersCreate{} - err = json.Unmarshal(data, result) - if err != nil { - return "", err - } - return result.Id, nil -} - -func (client *DockerClient) ContainerLogs(id string, options *LogOptions) (io.ReadCloser, error) { - v := url.Values{} - v.Add("follow", strconv.FormatBool(options.Follow)) - v.Add("stdout", strconv.FormatBool(options.Stdout)) - v.Add("stderr", strconv.FormatBool(options.Stderr)) - v.Add("timestamps", strconv.FormatBool(options.Timestamps)) - if options.Tail > 0 { - v.Add("tail", strconv.FormatInt(options.Tail, 10)) - } - - uri := fmt.Sprintf("/%s/containers/%s/logs?%s", APIVersion, id, v.Encode()) - req, err := http.NewRequest("GET", client.URL.String()+uri, nil) - if err != nil { - return nil, err - } - req.Header.Add("Content-Type", "application/json") - resp, err := client.HTTPClient.Do(req) - if err != nil { - return nil, err - } - return resp.Body, nil -} - -func (client *DockerClient) ContainerChanges(id string) ([]*ContainerChanges, error) { - uri := fmt.Sprintf("/%s/containers/%s/changes", APIVersion, id) - data, err := client.doRequest("GET", uri, nil, nil) - if err != nil { - return nil, err - } - changes := []*ContainerChanges{} - err = json.Unmarshal(data, &changes) - if err != nil { - return nil, err - } - return changes, nil -} - -func (client *DockerClient) readJSONStream(stream io.ReadCloser, decode func(*json.Decoder) decodingResult, stopChan <-chan struct{}) <-chan decodingResult { - resultChan := make(chan decodingResult) - - go func() { - decodeChan := make(chan decodingResult) - - go func() { - decoder := json.NewDecoder(stream) - for { - decodeResult := decode(decoder) - decodeChan <- decodeResult - if decodeResult.err != nil { - close(decodeChan) - return - } - } - }() - - defer close(resultChan) - - for { - select { - case <-stopChan: - stream.Close() - for range decodeChan { - } - return - case decodeResult := <-decodeChan: - resultChan <- decodeResult - if decodeResult.err != nil { - stream.Close() - return - } - } - } - - }() - - return resultChan -} - -func (client *DockerClient) StartContainer(id string, config *HostConfig) error { - data, err := json.Marshal(config) - if err != nil { - return err - } - uri := fmt.Sprintf("/%s/containers/%s/start", APIVersion, id) - _, err = client.doRequest("POST", uri, data, nil) - if err != nil { - return err - } - return nil -} - -func (client *DockerClient) StopContainer(id string, timeout int) error { - uri := fmt.Sprintf("/%s/containers/%s/stop?t=%d", APIVersion, id, timeout) - _, err := client.doRequest("POST", uri, nil, nil) - if err != nil { - return err - } - return nil -} - -func (client *DockerClient) RestartContainer(id string, timeout int) error { - uri := fmt.Sprintf("/%s/containers/%s/restart?t=%d", APIVersion, id, timeout) - _, err := client.doRequest("POST", uri, nil, nil) - if err != nil { - return err - } - return nil -} - -func (client *DockerClient) KillContainer(id, signal string) error { - uri := fmt.Sprintf("/%s/containers/%s/kill?signal=%s", APIVersion, id, signal) - _, err := client.doRequest("POST", uri, nil, nil) - if err != nil { - return err - } - return nil -} - -func (client *DockerClient) Wait(id string) <-chan WaitResult { - ch := make(chan WaitResult) - uri := fmt.Sprintf("/%s/containers/%s/wait", APIVersion, id) - - go func() { - data, err := client.doRequest("POST", uri, nil, nil) - if err != nil { - ch <- WaitResult{ExitCode: -1, Error: err} - return - } - - var result struct { - StatusCode int `json:"StatusCode"` - } - err = json.Unmarshal(data, &result) - ch <- WaitResult{ExitCode: result.StatusCode, Error: err} - }() - return ch -} - -func (client *DockerClient) MonitorEvents(options *MonitorEventsOptions, stopChan <-chan struct{}) (<-chan EventOrError, error) { - v := url.Values{} - if options != nil { - if options.Since != 0 { - v.Add("since", strconv.Itoa(options.Since)) - } - if options.Until != 0 { - v.Add("until", strconv.Itoa(options.Until)) - } - if options.Filters != nil { - filterMap := make(map[string][]string) - if len(options.Filters.Event) > 0 { - filterMap["event"] = []string{options.Filters.Event} - } - if len(options.Filters.Image) > 0 { - filterMap["image"] = []string{options.Filters.Image} - } - if len(options.Filters.Container) > 0 { - filterMap["container"] = []string{options.Filters.Container} - } - if len(filterMap) > 0 { - filterJSONBytes, err := json.Marshal(filterMap) - if err != nil { - return nil, err - } - v.Add("filters", string(filterJSONBytes)) - } - } - } - uri := fmt.Sprintf("%s/%s/events?%s", client.URL.String(), APIVersion, v.Encode()) - resp, err := client.HTTPClient.Get(uri) - if err != nil { - return nil, err - } - - decode := func(decoder *json.Decoder) decodingResult { - var event Event - if err := decoder.Decode(&event); err != nil { - return decodingResult{err: err} - } else { - return decodingResult{result: event} - } - } - decodingResultChan := client.readJSONStream(resp.Body, decode, stopChan) - eventOrErrorChan := make(chan EventOrError) - go func() { - for decodingResult := range decodingResultChan { - event, _ := decodingResult.result.(Event) - eventOrErrorChan <- EventOrError{ - Event: event, - Error: decodingResult.err, - } - } - close(eventOrErrorChan) - }() - return eventOrErrorChan, nil -} - -func (client *DockerClient) StartMonitorEvents(cb Callback, ec chan error, args ...interface{}) { - client.eventStopChan = make(chan struct{}) - - go func() { - eventErrChan, err := client.MonitorEvents(nil, client.eventStopChan) - if err != nil { - if ec != nil { - ec <- err - } - return - } - - for e := range eventErrChan { - if e.Error != nil { - if ec != nil { - ec <- err - } - return - } - cb(&e.Event, ec, args...) - } - }() -} - -func (client *DockerClient) StopAllMonitorEvents() { - close(client.eventStopChan) -} - -func (client *DockerClient) StartMonitorStats(id string, cb StatCallback, ec chan error, args ...interface{}) { - atomic.StoreInt32(&client.monitorStats, 1) - go client.getStats(id, cb, ec, args...) -} - -func (client *DockerClient) getStats(id string, cb StatCallback, ec chan error, args ...interface{}) { - uri := fmt.Sprintf("%s/%s/containers/%s/stats", client.URL.String(), APIVersion, id) - resp, err := client.HTTPClient.Get(uri) - if err != nil { - ec <- err - return - } - defer resp.Body.Close() - - dec := json.NewDecoder(resp.Body) - for atomic.LoadInt32(&client.monitorStats) > 0 { - var stats *Stats - if err := dec.Decode(&stats); err != nil { - ec <- err - return - } - cb(id, stats, ec, args...) - } -} - -func (client *DockerClient) StopAllMonitorStats() { - atomic.StoreInt32(&client.monitorStats, 0) -} - -func (client *DockerClient) TagImage(nameOrID string, repo string, tag string, force bool) error { - v := url.Values{} - v.Set("repo", repo) - v.Set("tag", tag) - if force { - v.Set("force", "1") - } - uri := fmt.Sprintf("/%s/images/%s/tag?%s", APIVersion, nameOrID, v.Encode()) - if _, err := client.doRequest("POST", uri, nil, nil); err != nil { - return err - } - return nil -} - -func (client *DockerClient) Version() (*Version, error) { - uri := fmt.Sprintf("/%s/version", APIVersion) - data, err := client.doRequest("GET", uri, nil, nil) - if err != nil { - return nil, err - } - version := &Version{} - err = json.Unmarshal(data, version) - if err != nil { - return nil, err - } - return version, nil -} - -func (client *DockerClient) PullImage(name string, auth *AuthConfig) error { - v := url.Values{} - v.Set("fromImage", name) - uri := fmt.Sprintf("/%s/images/create?%s", APIVersion, v.Encode()) - req, err := http.NewRequest("POST", client.URL.String()+uri, nil) - if auth != nil { - encoded_auth, err := auth.encode() - if err != nil { - return err - } - req.Header.Add("X-Registry-Auth", encoded_auth) - } - resp, err := client.HTTPClient.Do(req) - if err != nil { - return err - } - - defer resp.Body.Close() - if resp.StatusCode == 404 { - return ErrNotFound - } - if resp.StatusCode >= 400 { - data, err := ioutil.ReadAll(resp.Body) - if err != nil { - return err - } - return fmt.Errorf("%s", string(data)) - } - - var finalObj map[string]interface{} - for decoder := json.NewDecoder(resp.Body); err == nil; err = decoder.Decode(&finalObj) { - } - if err != io.EOF { - return err - } - if err, ok := finalObj["error"]; ok { - return fmt.Errorf("%v", err) - } - return nil -} - -func (client *DockerClient) InspectImage(id string) (*ImageInfo, error) { - uri := fmt.Sprintf("/%s/images/%s/json", APIVersion, id) - data, err := client.doRequest("GET", uri, nil, nil) - if err != nil { - return nil, err - } - info := &ImageInfo{} - err = json.Unmarshal(data, info) - if err != nil { - return nil, err - } - return info, nil -} - -func (client *DockerClient) LoadImage(reader io.Reader) error { - data, err := ioutil.ReadAll(reader) - if err != nil { - return err - } - - uri := fmt.Sprintf("/%s/images/load", APIVersion) - _, err = client.doRequest("POST", uri, data, nil) - if err != nil { - return err - } - return nil -} - -func (client *DockerClient) RemoveContainer(id string, force, volumes bool) error { - argForce := 0 - argVolumes := 0 - if force == true { - argForce = 1 - } - if volumes == true { - argVolumes = 1 - } - args := fmt.Sprintf("force=%d&v=%d", argForce, argVolumes) - uri := fmt.Sprintf("/%s/containers/%s?%s", APIVersion, id, args) - _, err := client.doRequest("DELETE", uri, nil, nil) - return err -} - -func (client *DockerClient) ListImages(all bool) ([]*Image, error) { - argAll := 0 - if all { - argAll = 1 - } - uri := fmt.Sprintf("/%s/images/json?all=%d", APIVersion, argAll) - data, err := client.doRequest("GET", uri, nil, nil) - if err != nil { - return nil, err - } - var images []*Image - if err := json.Unmarshal(data, &images); err != nil { - return nil, err - } - return images, nil -} - -func (client *DockerClient) RemoveImage(name string) ([]*ImageDelete, error) { - uri := fmt.Sprintf("/%s/images/%s", APIVersion, name) - data, err := client.doRequest("DELETE", uri, nil, nil) - if err != nil { - return nil, err - } - var imageDelete []*ImageDelete - if err := json.Unmarshal(data, &imageDelete); err != nil { - return nil, err - } - return imageDelete, nil -} - -func (client *DockerClient) PauseContainer(id string) error { - uri := fmt.Sprintf("/%s/containers/%s/pause", APIVersion, id) - _, err := client.doRequest("POST", uri, nil, nil) - if err != nil { - return err - } - return nil -} -func (client *DockerClient) UnpauseContainer(id string) error { - uri := fmt.Sprintf("/%s/containers/%s/unpause", APIVersion, id) - _, err := client.doRequest("POST", uri, nil, nil) - if err != nil { - return err - } - return nil -} - -func (client *DockerClient) Exec(config *ExecConfig) (string, error) { - data, err := json.Marshal(config) - if err != nil { - return "", err - } - uri := fmt.Sprintf("/containers/%s/exec", config.Container) - resp, err := client.doRequest("POST", uri, data, nil) - if err != nil { - return "", err - } - var createExecResp struct { - Id string - } - if err = json.Unmarshal(resp, &createExecResp); err != nil { - return "", err - } - uri = fmt.Sprintf("/exec/%s/start", createExecResp.Id) - resp, err = client.doRequest("POST", uri, data, nil) - if err != nil { - return "", err - } - return createExecResp.Id, nil -} - -func (client *DockerClient) RenameContainer(oldName string, newName string) error { - uri := fmt.Sprintf("/containers/%s/rename?name=%s", oldName, newName) - _, err := client.doRequest("POST", uri, nil, nil) - return err -} - -func (client *DockerClient) ImportImage(source string, repository string, tag string, tar io.Reader) (io.ReadCloser, error) { - var fromSrc string - v := &url.Values{} - if source == "" { - fromSrc = "-" - } else { - fromSrc = source - } - - v.Set("fromSrc", fromSrc) - v.Set("repo", repository) - if tag != "" { - v.Set("tag", tag) - } - - var in io.Reader - if fromSrc == "-" { - in = tar - } - return client.doStreamRequest("POST", "/images/create?"+v.Encode(), in, nil) -} - -func (client *DockerClient) BuildImage(image *BuildImage) (io.ReadCloser, error) { - v := url.Values{} - - if image.DockerfileName != "" { - v.Set("dockerfile", image.DockerfileName) - } - if image.RepoName != "" { - v.Set("t", image.RepoName) - } - if image.RemoteURL != "" { - v.Set("remote", image.RemoteURL) - } - if image.NoCache { - v.Set("nocache", "1") - } - if image.Pull { - v.Set("pull", "1") - } - if image.Remove { - v.Set("rm", "1") - } else { - v.Set("rm", "0") - } - if image.ForceRemove { - v.Set("forcerm", "1") - } - if image.SuppressOutput { - v.Set("q", "1") - } - - v.Set("memory", strconv.FormatInt(image.Memory, 10)) - v.Set("memswap", strconv.FormatInt(image.MemorySwap, 10)) - v.Set("cpushares", strconv.FormatInt(image.CpuShares, 10)) - v.Set("cpuperiod", strconv.FormatInt(image.CpuPeriod, 10)) - v.Set("cpuquota", strconv.FormatInt(image.CpuQuota, 10)) - v.Set("cpusetcpus", image.CpuSetCpus) - v.Set("cpusetmems", image.CpuSetMems) - v.Set("cgroupparent", image.CgroupParent) - - headers := make(map[string]string) - if image.Config != nil { - encoded_config, err := image.Config.encode() - if err != nil { - return nil, err - } - headers["X-Registry-Config"] = encoded_config - } - if image.Context != nil { - headers["Content-Type"] = "application/tar" - } - - uri := fmt.Sprintf("/%s/build?%s", APIVersion, v.Encode()) - return client.doStreamRequest("POST", uri, image.Context, headers) -} diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/dockerclient_test.go b/Godeps/_workspace/src/github.com/samalba/dockerclient/dockerclient_test.go deleted file mode 100644 index 88257e01..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/dockerclient_test.go +++ /dev/null @@ -1,240 +0,0 @@ -package dockerclient - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "reflect" - "strings" - "testing" - "time" - - "github.com/docker/docker/pkg/stdcopy" -) - -func assertEqual(t *testing.T, a interface{}, b interface{}, message string) { - if a == b { - return - } - if len(message) == 0 { - message = fmt.Sprintf("%v != %v", a, b) - } - t.Fatal(message) -} - -func testDockerClient(t *testing.T) *DockerClient { - client, err := NewDockerClient(testHTTPServer.URL, nil) - if err != nil { - t.Fatal("Cannot init the docker client") - } - return client -} - -func TestInfo(t *testing.T) { - client := testDockerClient(t) - info, err := client.Info() - if err != nil { - t.Fatal("Cannot get server info") - } - assertEqual(t, info.Images, int64(1), "") - assertEqual(t, info.Containers, int64(2), "") -} - -func TestKillContainer(t *testing.T) { - client := testDockerClient(t) - if err := client.KillContainer("23132acf2ac", "5"); err != nil { - t.Fatal("cannot kill container: %s", err) - } -} - -func TestWait(t *testing.T) { - client := testDockerClient(t) - - // This provokes an error on the server. - select { - case wr := <-client.Wait("1234"): - assertEqual(t, wr.ExitCode, int(-1), "") - case <-time.After(2 * time.Second): - t.Fatal("Timed out!") - } - - // Valid case. - select { - case wr := <-client.Wait("valid-id"): - assertEqual(t, wr.ExitCode, int(0), "") - case <-time.After(2 * time.Second): - t.Fatal("Timed out!") - } -} - -func TestPullImage(t *testing.T) { - client := testDockerClient(t) - err := client.PullImage("busybox", nil) - if err != nil { - t.Fatal("unable to pull busybox") - } - - err = client.PullImage("haproxy", nil) - if err != nil { - t.Fatal("unable to pull haproxy") - } - - err = client.PullImage("wrongimg", nil) - if err == nil { - t.Fatal("should return error when it fails to pull wrongimg") - } -} - -func TestListContainers(t *testing.T) { - client := testDockerClient(t) - containers, err := client.ListContainers(true, false, "") - if err != nil { - t.Fatal("cannot get containers: %s", err) - } - assertEqual(t, len(containers), 1, "") - cnt := containers[0] - assertEqual(t, cnt.SizeRw, int64(0), "") -} - -func TestContainerChanges(t *testing.T) { - client := testDockerClient(t) - changes, err := client.ContainerChanges("foobar") - if err != nil { - t.Fatal("cannot get container changes: %s", err) - } - assertEqual(t, len(changes), 3, "unexpected number of changes") - c := changes[0] - assertEqual(t, c.Path, "/dev", "unexpected") - assertEqual(t, c.Kind, 0, "unexpected") -} - -func TestListContainersWithSize(t *testing.T) { - client := testDockerClient(t) - containers, err := client.ListContainers(true, true, "") - if err != nil { - t.Fatal("cannot get containers: %s", err) - } - assertEqual(t, len(containers), 1, "") - cnt := containers[0] - assertEqual(t, cnt.SizeRw, int64(123), "") -} -func TestListContainersWithFilters(t *testing.T) { - client := testDockerClient(t) - containers, err := client.ListContainers(true, true, "{'id':['332375cfbc23edb921a21026314c3497674ba8bdcb2c85e0e65ebf2017f688ce']}") - if err != nil { - t.Fatal("cannot get containers: %s", err) - } - assertEqual(t, len(containers), 1, "") - - containers, err = client.ListContainers(true, true, "{'id':['332375cfbc23edb921a21026314c3497674ba8bdcb2c85e0e65ebf2017f688cf']}") - if err != nil { - t.Fatal("cannot get containers: %s", err) - } - assertEqual(t, len(containers), 0, "") -} - -func TestContainerLogs(t *testing.T) { - client := testDockerClient(t) - containerId := "foobar" - logOptions := &LogOptions{ - Follow: true, - Stdout: true, - Stderr: true, - Timestamps: true, - Tail: 10, - } - logsReader, err := client.ContainerLogs(containerId, logOptions) - if err != nil { - t.Fatal("cannot read logs from server") - } - - stdoutBuffer := new(bytes.Buffer) - stderrBuffer := new(bytes.Buffer) - if _, err = stdcopy.StdCopy(stdoutBuffer, stderrBuffer, logsReader); err != nil { - t.Fatal("cannot read logs from logs reader") - } - stdoutLogs := strings.TrimSpace(stdoutBuffer.String()) - stderrLogs := strings.TrimSpace(stderrBuffer.String()) - stdoutLogLines := strings.Split(stdoutLogs, "\n") - stderrLogLines := strings.Split(stderrLogs, "\n") - if len(stdoutLogLines) != 5 { - t.Fatalf("wrong number of stdout logs: len=%d", len(stdoutLogLines)) - } - if len(stderrLogLines) != 5 { - t.Fatalf("wrong number of stderr logs: len=%d", len(stdoutLogLines)) - } - for i, line := range stdoutLogLines { - expectedSuffix := fmt.Sprintf("Z line %d", 41+2*i) - if !strings.HasSuffix(line, expectedSuffix) { - t.Fatalf("expected stdout log line \"%s\" to end with \"%s\"", line, expectedSuffix) - } - } - for i, line := range stderrLogLines { - expectedSuffix := fmt.Sprintf("Z line %d", 40+2*i) - if !strings.HasSuffix(line, expectedSuffix) { - t.Fatalf("expected stderr log line \"%s\" to end with \"%s\"", line, expectedSuffix) - } - } -} - -func TestMonitorEvents(t *testing.T) { - client := testDockerClient(t) - decoder := json.NewDecoder(bytes.NewBufferString(eventsResp)) - var expectedEvents []Event - for { - var event Event - if err := decoder.Decode(&event); err != nil { - if err == io.EOF { - break - } else { - t.Fatalf("cannot parse expected resp: %s", err.Error()) - } - } else { - expectedEvents = append(expectedEvents, event) - } - } - - // test passing stop chan - stopChan := make(chan struct{}) - eventInfoChan, err := client.MonitorEvents(nil, stopChan) - if err != nil { - t.Fatalf("cannot get events from server: %s", err.Error()) - } - - eventInfo := <-eventInfoChan - if eventInfo.Error != nil || eventInfo.Event != expectedEvents[0] { - t.Fatalf("got:\n%#v\nexpected:\n%#v", eventInfo, expectedEvents[0]) - } - close(stopChan) - for i := 0; i < 3; i++ { - _, ok := <-eventInfoChan - if i == 2 && ok { - t.Fatalf("read more than 2 events successfully after closing stopChan") - } - } - - // test when you don't pass stop chan - eventInfoChan, err = client.MonitorEvents(nil, nil) - if err != nil { - t.Fatalf("cannot get events from server: %s", err.Error()) - } - - for i, expectedEvent := range expectedEvents { - t.Logf("on iter %d\n", i) - eventInfo := <-eventInfoChan - if eventInfo.Error != nil || eventInfo.Event != expectedEvent { - t.Fatalf("index %d, got:\n%#v\nexpected:\n%#v", i, eventInfo, expectedEvent) - } - t.Logf("done with iter %d\n", i) - } -} - -func TestDockerClientInterface(t *testing.T) { - iface := reflect.TypeOf((*Client)(nil)).Elem() - test := testDockerClient(t) - - if !reflect.TypeOf(test).Implements(iface) { - t.Fatalf("DockerClient does not implement the Client interface") - } -} diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/engine_mock_test.go b/Godeps/_workspace/src/github.com/samalba/dockerclient/engine_mock_test.go deleted file mode 100644 index 7d3a6d93..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/engine_mock_test.go +++ /dev/null @@ -1,245 +0,0 @@ -package dockerclient - -import ( - "encoding/json" - "fmt" - "io" - "log" - "net/http" - "net/http/httptest" - "strconv" - "time" - - "github.com/docker/docker/pkg/ioutils" - "github.com/docker/docker/pkg/jsonlog" - "github.com/docker/docker/pkg/stdcopy" - "github.com/docker/docker/pkg/timeutils" - "github.com/gorilla/mux" -) - -var ( - testHTTPServer *httptest.Server -) - -func init() { - r := mux.NewRouter() - baseURL := "/" + APIVersion - r.HandleFunc(baseURL+"/info", handlerGetInfo).Methods("GET") - r.HandleFunc(baseURL+"/containers/json", handlerGetContainers).Methods("GET") - r.HandleFunc(baseURL+"/containers/{id}/logs", handleContainerLogs).Methods("GET") - r.HandleFunc(baseURL+"/containers/{id}/changes", handleContainerChanges).Methods("GET") - r.HandleFunc(baseURL+"/containers/{id}/kill", handleContainerKill).Methods("POST") - r.HandleFunc(baseURL+"/containers/{id}/wait", handleWait).Methods("POST") - r.HandleFunc(baseURL+"/images/create", handleImagePull).Methods("POST") - r.HandleFunc(baseURL+"/events", handleEvents).Methods("GET") - testHTTPServer = httptest.NewServer(handlerAccessLog(r)) -} - -func handlerAccessLog(handler http.Handler) http.Handler { - logHandler := func(w http.ResponseWriter, r *http.Request) { - log.Printf("%s \"%s %s\"", r.RemoteAddr, r.Method, r.URL) - handler.ServeHTTP(w, r) - } - return http.HandlerFunc(logHandler) -} - -func handleContainerKill(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "{%q:%q", "Id", "421373210afd132") -} - -func handleWait(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - if vars["id"] == "valid-id" { - fmt.Fprintf(w, `{"StatusCode":0}`) - } else { - http.Error(w, "failed", 500) - } -} - -func handleImagePull(w http.ResponseWriter, r *http.Request) { - imageName := r.URL.Query()["fromImage"][0] - responses := []map[string]interface{}{{ - "status": fmt.Sprintf("Pulling repository mydockerregistry/%s", imageName), - }} - switch imageName { - case "busybox": - responses = append(responses, map[string]interface{}{ - "status": "Status: Image is up to date for mydockerregistry/busybox", - }) - case "haproxy": - fmt.Fprintf(w, haproxyPullOutput) - return - default: - errorMsg := fmt.Sprintf("Error: image %s not found", imageName) - responses = append(responses, map[string]interface{}{ - "errorDetail": map[string]interface{}{ - "message": errorMsg, - }, - "error": errorMsg, - }) - } - for _, response := range responses { - json.NewEncoder(w).Encode(response) - } -} - -func handleContainerLogs(w http.ResponseWriter, r *http.Request) { - var outStream, errStream io.Writer - outStream = ioutils.NewWriteFlusher(w) - - // not sure how to test follow - if err := r.ParseForm(); err != nil { - http.Error(w, err.Error(), 500) - } - stdout, stderr := getBoolValue(r.Form.Get("stdout")), getBoolValue(r.Form.Get("stderr")) - if stderr { - errStream = stdcopy.NewStdWriter(outStream, stdcopy.Stderr) - } - if stdout { - outStream = stdcopy.NewStdWriter(outStream, stdcopy.Stdout) - } - var i int - if tail, err := strconv.Atoi(r.Form.Get("tail")); err == nil && tail > 0 { - i = 50 - tail - if i < 0 { - i = 0 - } - } - for ; i < 50; i++ { - line := fmt.Sprintf("line %d", i) - if getBoolValue(r.Form.Get("timestamps")) { - l := &jsonlog.JSONLog{Log: line, Created: time.Now().UTC()} - line = fmt.Sprintf("%s %s", l.Created.Format(timeutils.RFC3339NanoFixed), line) - } - if i%2 == 0 && stderr { - fmt.Fprintln(errStream, line) - } else if i%2 == 1 && stdout { - fmt.Fprintln(outStream, line) - } - } -} - -func handleContainerChanges(w http.ResponseWriter, r *http.Request) { - writeHeaders(w, 200, "changes") - body := `[ - { - "Path": "/dev", - "Kind": 0 - }, - { - "Path": "/dev/kmsg", - "Kind": 1 - }, - { - "Path": "/test", - "Kind": 1 - } - ]` - w.Write([]byte(body)) -} - -func getBoolValue(boolString string) bool { - switch boolString { - case "1": - return true - case "True": - return true - case "true": - return true - default: - return false - } -} - -func writeHeaders(w http.ResponseWriter, code int, jobName string) { - h := w.Header() - h.Add("Content-Type", "application/json") - if jobName != "" { - h.Add("Job-Name", jobName) - } - w.WriteHeader(code) -} - -func handlerGetInfo(w http.ResponseWriter, r *http.Request) { - writeHeaders(w, 200, "info") - body := `{ - "Containers": 2, - "Debug": 1, - "Driver": "aufs", - "DriverStatus": [["Root Dir", "/mnt/sda1/var/lib/docker/aufs"], - ["Dirs", "0"]], - "ExecutionDriver": "native-0.2", - "IPv4Forwarding": 1, - "Images": 1, - "IndexServerAddress": "https://index.docker.io/v1/", - "InitPath": "/usr/local/bin/docker", - "InitSha1": "", - "KernelVersion": "3.16.4-tinycore64", - "MemoryLimit": 1, - "NEventsListener": 0, - "NFd": 10, - "NGoroutines": 11, - "OperatingSystem": "Boot2Docker 1.3.1 (TCL 5.4); master : a083df4 - Thu Jan 01 00:00:00 UTC 1970", - "SwapLimit": 1}` - w.Write([]byte(body)) -} - -func handlerGetContainers(w http.ResponseWriter, r *http.Request) { - writeHeaders(w, 200, "containers") - body := `[ - { - "Status": "Up 39 seconds", - "Ports": [ - { - "Type": "tcp", - "PublicPort": 49163, - "PrivatePort": 8080, - "IP": "0.0.0.0" - } - ], - "Names": [ - "/trusting_heisenberg" - ], - "Image": "foo:latest", - "Id": "332375cfbc23edb921a21026314c3497674ba8bdcb2c85e0e65ebf2017f688ce", - "Created": 1415720105, - "Command": "/bin/go-run" - } - ]` - if v, ok := r.URL.Query()["size"]; ok { - if v[0] == "1" { - body = `[ - { - "Status": "Up 39 seconds", - "Ports": [ - { - "Type": "tcp", - "PublicPort": 49163, - "PrivatePort": 8080, - "IP": "0.0.0.0" - } - ], - "Names": [ - "/trusting_heisenberg" - ], - "Image": "foo:latest", - "Id": "332375cfbc23edb921a21026314c3497674ba8bdcb2c85e0e65ebf2017f688ce", - "Created": 1415720105, - "SizeRootFs": 12345, - "SizeRW": 123, - "Command": "/bin/go-run" - } - ]` - } - } - if v, ok := r.URL.Query()["filters"]; ok { - if v[0] != "{'id':['332375cfbc23edb921a21026314c3497674ba8bdcb2c85e0e65ebf2017f688ce']}" { - body = "[]" - } - } - w.Write([]byte(body)) -} - -func handleEvents(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(eventsResp)) -} diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/example_responses.go b/Godeps/_workspace/src/github.com/samalba/dockerclient/example_responses.go deleted file mode 100644 index 670508c0..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/example_responses.go +++ /dev/null @@ -1,13 +0,0 @@ -package dockerclient - -var haproxyPullOutput = `{"status":"The image you are pulling has been verified","id":"haproxy:1"} -{"status":"Already exists","progressDetail":{},"id":"511136ea3c5a"}{"status":"Already exists","progressDetail":{},"id":"1aeada447715"}{"status":"Already exists","progressDetail":{},"id":"479215127fa7"}{"status":"Already exists","progressDetail":{},"id":"66301eb54a7d"}{"status":"Already exists","progressDetail":{},"id":"e3990b07573f"}{"status":"Already exists","progressDetail":{},"id":"ecb4b23ca7ce"}{"status":"Already exists","progressDetail":{},"id":"f453e940c177"}{"status":"Already exists","progressDetail":{},"id":"fc5ea1bc05ab"}{"status":"Already exists","progressDetail":{},"id":"380557f8f7b3"}{"status":"The image you are pulling has been verified","id":"haproxy:1.4"} -{"status":"Already exists","progressDetail":{},"id":"511136ea3c5a"}{"status":"Already exists","progressDetail":{},"id":"1aeada447715"}{"status":"Already exists","progressDetail":{},"id":"479215127fa7"}{"status":"Already exists","progressDetail":{},"id":"63a1b9929e14"}{"status":"Already exists","progressDetail":{},"id":"af43bf7d176e"}{"status":"Already exists","progressDetail":{},"id":"851aac2d69aa"}{"status":"Already exists","progressDetail":{},"id":"345053a92c95"}{"status":"Already exists","progressDetail":{},"id":"b41231d429c9"}{"status":"The image you are pulling has been verified","id":"haproxy:1.4.25"} -{"status":"Already exists","progressDetail":{},"id":"511136ea3c5a"}{"status":"Already exists","progressDetail":{},"id":"1aeada447715"}{"status":"Already exists","progressDetail":{},"id":"479215127fa7"}{"status":"Already exists","progressDetail":{},"id":"63a1b9929e14"}{"status":"Already exists","progressDetail":{},"id":"af43bf7d176e"}{"status":"Already exists","progressDetail":{},"id":"851aac2d69aa"}{"status":"Already exists","progressDetail":{},"id":"345053a92c95"}{"status":"Already exists","progressDetail":{},"id":"b41231d429c9"}{"status":"The image you are pulling has been verified","id":"haproxy:1.5"} -{"status":"Already exists","progressDetail":{},"id":"511136ea3c5a"}{"status":"Already exists","progressDetail":{},"id":"1aeada447715"}{"status":"Already exists","progressDetail":{},"id":"479215127fa7"}{"status":"Already exists","progressDetail":{},"id":"66301eb54a7d"}{"status":"Already exists","progressDetail":{},"id":"e3990b07573f"}{"status":"Already exists","progressDetail":{},"id":"ecb4b23ca7ce"}{"status":"Already exists","progressDetail":{},"id":"f453e940c177"}{"status":"Already exists","progressDetail":{},"id":"fc5ea1bc05ab"}{"status":"Already exists","progressDetail":{},"id":"380557f8f7b3"}{"status":"The image you are pulling has been verified","id":"haproxy:1.5.10"} -{"status":"Already exists","progressDetail":{},"id":"511136ea3c5a"}{"status":"Already exists","progressDetail":{},"id":"1aeada447715"}{"status":"Already exists","progressDetail":{},"id":"479215127fa7"}{"status":"Already exists","progressDetail":{},"id":"66301eb54a7d"}{"status":"Already exists","progressDetail":{},"id":"e3990b07573f"}{"status":"Already exists","progressDetail":{},"id":"ecb4b23ca7ce"}{"status":"Already exists","progressDetail":{},"id":"f453e940c177"}{"status":"Already exists","progressDetail":{},"id":"fc5ea1bc05ab"}{"status":"Already exists","progressDetail":{},"id":"380557f8f7b3"}{"status":"The image you are pulling has been verified","id":"haproxy:1.5.9"} -{"status":"Already exists","progressDetail":{},"id":"511136ea3c5a"}{"status":"Already exists","progressDetail":{},"id":"1aeada447715"}{"status":"Already exists","progressDetail":{},"id":"479215127fa7"}{"status":"Already exists","progressDetail":{},"id":"66301eb54a7d"}{"status":"Already exists","progressDetail":{},"id":"e3990b07573f"}{"status":"Already exists","progressDetail":{},"id":"3d894e6f7e63"}{"status":"Already exists","progressDetail":{},"id":"4d949c40bc77"}{"status":"Already exists","progressDetail":{},"id":"55e031889365"}{"status":"Already exists","progressDetail":{},"id":"c7aa675e1876"}{"status":"The image you are pulling has been verified","id":"haproxy:latest"} -{"status":"Already exists","progressDetail":{},"id":"511136ea3c5a"}{"status":"Already exists","progressDetail":{},"id":"1aeada447715"}{"status":"Already exists","progressDetail":{},"id":"479215127fa7"}{"status":"Already exists","progressDetail":{},"id":"66301eb54a7d"}{"status":"Already exists","progressDetail":{},"id":"e3990b07573f"}{"status":"Already exists","progressDetail":{},"id":"ecb4b23ca7ce"}{"status":"Already exists","progressDetail":{},"id":"f453e940c177"}{"status":"Already exists","progressDetail":{},"id":"fc5ea1bc05ab"}{"status":"Already exists","progressDetail":{},"id":"380557f8f7b3"}{"status":"Status: Image is up to date for haproxy"} -` - -var eventsResp = `{"status":"pull","id":"nginx:latest","time":1428620433}{"status":"create","id":"9b818c3b8291708fdcecd7c4086b75c222cb503be10a93d9c11040886032a48b","from":"nginx:latest","time":1428620433}{"status":"start","id":"9b818c3b8291708fdcecd7c4086b75c222cb503be10a93d9c11040886032a48b","from":"nginx:latest","time":1428620433}{"status":"die","id":"9b818c3b8291708fdcecd7c4086b75c222cb503be10a93d9c11040886032a48b","from":"nginx:latest","time":1428620442}{"status":"create","id":"352d0b412aae5a5d2b14ae9d88be59dc276602d9edb9dcc33e138e475b3e4720","from":"52.11.96.81/foobar/ubuntu:latest","time":1428620444}{"status":"start","id":"352d0b412aae5a5d2b14ae9d88be59dc276602d9edb9dcc33e138e475b3e4720","from":"52.11.96.81/foobar/ubuntu:latest","time":1428620444}{"status":"die","id":"352d0b412aae5a5d2b14ae9d88be59dc276602d9edb9dcc33e138e475b3e4720","from":"52.11.96.81/foobar/ubuntu:latest","time":1428620444}{"status":"pull","id":"debian:latest","time":1428620453}{"status":"create","id":"668887b5729946546b3072655dc6da08f0e3210111b68b704eb842adfce53f6c","from":"debian:latest","time":1428620453}{"status":"start","id":"668887b5729946546b3072655dc6da08f0e3210111b68b704eb842adfce53f6c","from":"debian:latest","time":1428620453}{"status":"die","id":"668887b5729946546b3072655dc6da08f0e3210111b68b704eb842adfce53f6c","from":"debian:latest","time":1428620453}{"status":"create","id":"eb4a19ec21ab29bbbffbf3ee2e2df9d99cb749780e1eff06a591cee5ba505180","from":"nginx:latest","time":1428620458}{"status":"start","id":"eb4a19ec21ab29bbbffbf3ee2e2df9d99cb749780e1eff06a591cee5ba505180","from":"nginx:latest","time":1428620458}{"status":"pause","id":"eb4a19ec21ab29bbbffbf3ee2e2df9d99cb749780e1eff06a591cee5ba505180","from":"nginx:latest","time":1428620462}{"status":"unpause","id":"eb4a19ec21ab29bbbffbf3ee2e2df9d99cb749780e1eff06a591cee5ba505180","from":"nginx:latest","time":1428620466}{"status":"die","id":"eb4a19ec21ab29bbbffbf3ee2e2df9d99cb749780e1eff06a591cee5ba505180","from":"nginx:latest","time":1428620469}` diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/examples/events.go b/Godeps/_workspace/src/github.com/samalba/dockerclient/examples/events.go deleted file mode 100644 index 2d6de40c..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/examples/events.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -import ( - "github.com/samalba/dockerclient" - "log" - "os" - "os/signal" - "syscall" -) - -func eventCallback(e *dockerclient.Event, ec chan error, args ...interface{}) { - log.Println(e) -} - -var ( - client *dockerclient.DockerClient -) - -func waitForInterrupt() { - sigChan := make(chan os.Signal, 1) - signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT) - for _ = range sigChan { - client.StopAllMonitorEvents() - os.Exit(0) - } -} - -func main() { - docker, err := dockerclient.NewDockerClient(os.Getenv("DOCKER_HOST"), nil) - if err != nil { - log.Fatal(err) - } - - client = docker - - client.StartMonitorEvents(eventCallback, nil) - - waitForInterrupt() -} diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/examples/stats/stats.go b/Godeps/_workspace/src/github.com/samalba/dockerclient/examples/stats/stats.go deleted file mode 100644 index 9027069d..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/examples/stats/stats.go +++ /dev/null @@ -1,43 +0,0 @@ -package main - -import ( - "github.com/samalba/dockerclient" - "log" - "os" - "os/signal" - "syscall" -) - -func statCallback(id string, stat *dockerclient.Stats, ec chan error, args ...interface{}) { - log.Println(stat) -} - -func waitForInterrupt() { - sigChan := make(chan os.Signal, 1) - signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT) - for _ = range sigChan { - os.Exit(0) - } -} - -func main() { - docker, err := dockerclient.NewDockerClient(os.Getenv("DOCKER_HOST"), nil) - if err != nil { - log.Fatal(err) - } - - containerConfig := &dockerclient.ContainerConfig{Image: "busybox", Cmd: []string{"sh"}} - containerId, err := docker.CreateContainer(containerConfig, "") - if err != nil { - log.Fatal(err) - } - - // Start the container - err = docker.StartContainer(containerId, nil) - if err != nil { - log.Fatal(err) - } - docker.StartMonitorStats(containerId, statCallback, nil) - - waitForInterrupt() -} diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/interface.go b/Godeps/_workspace/src/github.com/samalba/dockerclient/interface.go deleted file mode 100644 index 8a488119..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/interface.go +++ /dev/null @@ -1,46 +0,0 @@ -package dockerclient - -import ( - "io" -) - -type Callback func(*Event, chan error, ...interface{}) - -type StatCallback func(string, *Stats, chan error, ...interface{}) - -type Client interface { - Info() (*Info, error) - ListContainers(all, size bool, filters string) ([]Container, error) - InspectContainer(id string) (*ContainerInfo, error) - InspectImage(id string) (*ImageInfo, error) - CreateContainer(config *ContainerConfig, name string) (string, error) - ContainerLogs(id string, options *LogOptions) (io.ReadCloser, error) - ContainerChanges(id string) ([]*ContainerChanges, error) - Exec(config *ExecConfig) (string, error) - StartContainer(id string, config *HostConfig) error - StopContainer(id string, timeout int) error - RestartContainer(id string, timeout int) error - KillContainer(id, signal string) error - Wait(id string) <-chan WaitResult - // MonitorEvents takes options and an optional stop channel, and returns - // an EventOrError channel. If an error is ever sent, then no more - // events will be sent. If a stop channel is provided, events will stop - // being monitored after the stop channel is closed. - MonitorEvents(options *MonitorEventsOptions, stopChan <-chan struct{}) (<-chan EventOrError, error) - StartMonitorEvents(cb Callback, ec chan error, args ...interface{}) - StopAllMonitorEvents() - StartMonitorStats(id string, cb StatCallback, ec chan error, args ...interface{}) - StopAllMonitorStats() - TagImage(nameOrID string, repo string, tag string, force bool) error - Version() (*Version, error) - PullImage(name string, auth *AuthConfig) error - LoadImage(reader io.Reader) error - RemoveContainer(id string, force, volumes bool) error - ListImages(all bool) ([]*Image, error) - RemoveImage(name string) ([]*ImageDelete, error) - PauseContainer(name string) error - UnpauseContainer(name string) error - RenameContainer(oldName string, newName string) error - ImportImage(source string, repository string, tag string, tar io.Reader) (io.ReadCloser, error) - BuildImage(image *BuildImage) (io.ReadCloser, error) -} diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/mockclient/mock.go b/Godeps/_workspace/src/github.com/samalba/dockerclient/mockclient/mock.go deleted file mode 100644 index ff982663..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/mockclient/mock.go +++ /dev/null @@ -1,162 +0,0 @@ -package mockclient - -import ( - "io" - - "github.com/samalba/dockerclient" - "github.com/stretchr/testify/mock" -) - -type MockClient struct { - mock.Mock -} - -func NewMockClient() *MockClient { - return &MockClient{} -} - -func (client *MockClient) Info() (*dockerclient.Info, error) { - args := client.Mock.Called() - return args.Get(0).(*dockerclient.Info), args.Error(1) -} - -func (client *MockClient) ListContainers(all bool, size bool, filters string) ([]dockerclient.Container, error) { - args := client.Mock.Called(all, size, filters) - return args.Get(0).([]dockerclient.Container), args.Error(1) -} - -func (client *MockClient) InspectContainer(id string) (*dockerclient.ContainerInfo, error) { - args := client.Mock.Called(id) - return args.Get(0).(*dockerclient.ContainerInfo), args.Error(1) -} - -func (client *MockClient) InspectImage(id string) (*dockerclient.ImageInfo, error) { - args := client.Mock.Called(id) - return args.Get(0).(*dockerclient.ImageInfo), args.Error(1) -} - -func (client *MockClient) CreateContainer(config *dockerclient.ContainerConfig, name string) (string, error) { - args := client.Mock.Called(config, name) - return args.String(0), args.Error(1) -} - -func (client *MockClient) ContainerLogs(id string, options *dockerclient.LogOptions) (io.ReadCloser, error) { - args := client.Mock.Called(id, options) - return args.Get(0).(io.ReadCloser), args.Error(1) -} - -func (client *MockClient) ContainerChanges(id string) ([]*dockerclient.ContainerChanges, error) { - args := client.Mock.Called(id) - return args.Get(0).([]*dockerclient.ContainerChanges), args.Error(1) -} - -func (client *MockClient) StartContainer(id string, config *dockerclient.HostConfig) error { - args := client.Mock.Called(id, config) - return args.Error(0) -} - -func (client *MockClient) StopContainer(id string, timeout int) error { - args := client.Mock.Called(id, timeout) - return args.Error(0) -} - -func (client *MockClient) RestartContainer(id string, timeout int) error { - args := client.Mock.Called(id, timeout) - return args.Error(0) -} - -func (client *MockClient) KillContainer(id, signal string) error { - args := client.Mock.Called(id, signal) - return args.Error(0) -} - -func (client *MockClient) Wait(id string) <-chan dockerclient.WaitResult { - args := client.Mock.Called(id) - return args.Get(0).(<-chan dockerclient.WaitResult) -} - -func (client *MockClient) MonitorEvents(options *dockerclient.MonitorEventsOptions, stopChan <-chan struct{}) (<-chan dockerclient.EventOrError, error) { - args := client.Mock.Called(options, stopChan) - return args.Get(0).(<-chan dockerclient.EventOrError), args.Error(1) -} - -func (client *MockClient) StartMonitorEvents(cb dockerclient.Callback, ec chan error, args ...interface{}) { - client.Mock.Called(cb, ec, args) -} - -func (client *MockClient) StopAllMonitorEvents() { - client.Mock.Called() -} - -func (client *MockClient) TagImage(nameOrID string, repo string, tag string, force bool) error { - args := client.Mock.Called(nameOrID, repo, tag, force) - return args.Error(0) -} - -func (client *MockClient) StartMonitorStats(id string, cb dockerclient.StatCallback, ec chan error, args ...interface{}) { - client.Mock.Called(id, cb, ec, args) -} - -func (client *MockClient) StopAllMonitorStats() { - client.Mock.Called() -} - -func (client *MockClient) Version() (*dockerclient.Version, error) { - args := client.Mock.Called() - return args.Get(0).(*dockerclient.Version), args.Error(1) -} - -func (client *MockClient) PullImage(name string, auth *dockerclient.AuthConfig) error { - args := client.Mock.Called(name, auth) - return args.Error(0) -} - -func (client *MockClient) LoadImage(reader io.Reader) error { - args := client.Mock.Called(reader) - return args.Error(0) -} - -func (client *MockClient) RemoveContainer(id string, force, volumes bool) error { - args := client.Mock.Called(id, force, volumes) - return args.Error(0) -} - -func (client *MockClient) ListImages(all bool) ([]*dockerclient.Image, error) { - args := client.Mock.Called(all) - return args.Get(0).([]*dockerclient.Image), args.Error(1) -} - -func (client *MockClient) RemoveImage(name string) ([]*dockerclient.ImageDelete, error) { - args := client.Mock.Called(name) - return args.Get(0).([]*dockerclient.ImageDelete), args.Error(1) -} - -func (client *MockClient) PauseContainer(name string) error { - args := client.Mock.Called(name) - return args.Error(0) -} - -func (client *MockClient) UnpauseContainer(name string) error { - args := client.Mock.Called(name) - return args.Error(0) -} - -func (client *MockClient) Exec(config *dockerclient.ExecConfig) (string, error) { - args := client.Mock.Called(config) - return args.String(0), args.Error(1) -} - -func (client *MockClient) RenameContainer(oldName string, newName string) error { - args := client.Mock.Called(oldName, newName) - return args.Error(0) -} - -func (client *MockClient) ImportImage(source string, repository string, tag string, tar io.Reader) (io.ReadCloser, error) { - args := client.Mock.Called(source, repository, tag, tar) - return args.Get(0).(io.ReadCloser), args.Error(1) -} - -func (client *MockClient) BuildImage(image *dockerclient.BuildImage) (io.ReadCloser, error) { - args := client.Mock.Called(image) - return args.Get(0).(io.ReadCloser), args.Error(1) -} diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/mockclient/mock_test.go b/Godeps/_workspace/src/github.com/samalba/dockerclient/mockclient/mock_test.go deleted file mode 100644 index 8d91bcf6..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/mockclient/mock_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package mockclient - -import ( - "reflect" - "testing" - - "github.com/samalba/dockerclient" -) - -func TestMock(t *testing.T) { - mock := NewMockClient() - mock.On("Version").Return(&dockerclient.Version{Version: "foo"}, nil).Once() - - v, err := mock.Version() - if err != nil { - t.Fatal(err) - } - if v.Version != "foo" { - t.Fatal(v) - } - - mock.Mock.AssertExpectations(t) -} - -func TestMockInterface(t *testing.T) { - iface := reflect.TypeOf((*dockerclient.Client)(nil)).Elem() - mock := NewMockClient() - - if !reflect.TypeOf(mock).Implements(iface) { - t.Fatalf("Mock does not implement the Client interface") - } -} diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/types.go b/Godeps/_workspace/src/github.com/samalba/dockerclient/types.go deleted file mode 100644 index 15e1e8bc..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/types.go +++ /dev/null @@ -1,444 +0,0 @@ -package dockerclient - -import ( - "fmt" - "io" - "time" - - "github.com/docker/docker/pkg/units" -) - -type ContainerConfig struct { - Hostname string - Domainname string - User string - AttachStdin bool - AttachStdout bool - AttachStderr bool - ExposedPorts map[string]struct{} - Tty bool - OpenStdin bool - StdinOnce bool - Env []string - Cmd []string - Image string - Volumes map[string]struct{} - VolumeDriver string - WorkingDir string - Entrypoint []string - NetworkDisabled bool - MacAddress string - OnBuild []string - Labels map[string]string - - // FIXME: The following fields have been removed since API v1.18 - Memory int64 - MemorySwap int64 - CpuShares int64 - Cpuset string - PortSpecs []string - - // This is used only by the create command - HostConfig HostConfig -} - -type HostConfig struct { - Binds []string - ContainerIDFile string - LxcConf []map[string]string - Memory int64 - MemorySwap int64 - CpuShares int64 - CpuPeriod int64 - CpusetCpus string - CpusetMems string - CpuQuota int64 - BlkioWeight int64 - OomKillDisable bool - Privileged bool - PortBindings map[string][]PortBinding - Links []string - PublishAllPorts bool - Dns []string - DnsSearch []string - ExtraHosts []string - VolumesFrom []string - Devices []DeviceMapping - NetworkMode string - IpcMode string - PidMode string - UTSMode string - CapAdd []string - CapDrop []string - RestartPolicy RestartPolicy - SecurityOpt []string - ReadonlyRootfs bool - Ulimits []Ulimit - LogConfig LogConfig - CgroupParent string -} - -type DeviceMapping struct { - PathOnHost string `json:"PathOnHost"` - PathInContainer string `json:"PathInContainer"` - CgroupPermissions string `json:"CgroupPermissions"` -} - -type ExecConfig struct { - AttachStdin bool - AttachStdout bool - AttachStderr bool - Tty bool - Cmd []string - Container string - Detach bool -} - -type LogOptions struct { - Follow bool - Stdout bool - Stderr bool - Timestamps bool - Tail int64 -} - -type MonitorEventsFilters struct { - Event string `json:",omitempty"` - Image string `json:",omitempty"` - Container string `json:",omitempty"` -} - -type MonitorEventsOptions struct { - Since int - Until int - Filters *MonitorEventsFilters `json:",omitempty"` -} - -type RestartPolicy struct { - Name string - MaximumRetryCount int64 -} - -type PortBinding struct { - HostIp string - HostPort string -} - -type State struct { - Running bool - Paused bool - Restarting bool - OOMKilled bool - Dead bool - Pid int - ExitCode int - Error string // contains last known error when starting the container - StartedAt time.Time - FinishedAt time.Time - Ghost bool -} - -// String returns a human-readable description of the state -// Stoken from docker/docker/daemon/state.go -func (s *State) String() string { - if s.Running { - if s.Paused { - return fmt.Sprintf("Up %s (Paused)", units.HumanDuration(time.Now().UTC().Sub(s.StartedAt))) - } - if s.Restarting { - return fmt.Sprintf("Restarting (%d) %s ago", s.ExitCode, units.HumanDuration(time.Now().UTC().Sub(s.FinishedAt))) - } - - return fmt.Sprintf("Up %s", units.HumanDuration(time.Now().UTC().Sub(s.StartedAt))) - } - - if s.Dead { - return "Dead" - } - - if s.FinishedAt.IsZero() { - return "" - } - - return fmt.Sprintf("Exited (%d) %s ago", s.ExitCode, units.HumanDuration(time.Now().UTC().Sub(s.FinishedAt))) -} - -// StateString returns a single string to describe state -// Stoken from docker/docker/daemon/state.go -func (s *State) StateString() string { - if s.Running { - if s.Paused { - return "paused" - } - if s.Restarting { - return "restarting" - } - return "running" - } - - if s.Dead { - return "dead" - } - - return "exited" -} - -type ImageInfo struct { - Architecture string - Author string - Comment string - Config *ContainerConfig - Container string - ContainerConfig *ContainerConfig - Created time.Time - DockerVersion string - Id string - Os string - Parent string - Size int64 - VirtualSize int64 -} - -type ContainerInfo struct { - Id string - Created string - Path string - Name string - Args []string - ExecIDs []string - Config *ContainerConfig - State *State - Image string - NetworkSettings struct { - IPAddress string `json:"IpAddress"` - IPPrefixLen int `json:"IpPrefixLen"` - Gateway string - Bridge string - Ports map[string][]PortBinding - } - SysInitPath string - ResolvConfPath string - Volumes map[string]string - HostConfig *HostConfig -} - -type ContainerChanges struct { - Path string - Kind int -} - -type Port struct { - IP string - PrivatePort int - PublicPort int - Type string -} - -type Container struct { - Id string - Names []string - Image string - Command string - Created int64 - Status string - Ports []Port - SizeRw int64 - SizeRootFs int64 - Labels map[string]string -} - -type Event struct { - Id string - Status string - From string - Time int64 -} - -type Version struct { - ApiVersion string - Arch string - GitCommit string - GoVersion string - KernelVersion string - Os string - Version string -} - -type RespContainersCreate struct { - Id string - Warnings []string -} - -type Image struct { - Created int64 - Id string - ParentId string - RepoTags []string - Size int64 - VirtualSize int64 -} - -// Info is the struct returned by /info -// The API is currently in flux, so Debug, MemoryLimit, SwapLimit, and -// IPv4Forwarding are interfaces because in docker 1.6.1 they are 0 or 1 but in -// master they are bools. -type Info struct { - ID string - Containers int64 - Driver string - DriverStatus [][]string - ExecutionDriver string - Images int64 - KernelVersion string - OperatingSystem string - NCPU int64 - MemTotal int64 - Name string - Labels []string - Debug interface{} - NFd int64 - NGoroutines int64 - SystemTime string - NEventsListener int64 - InitPath string - InitSha1 string - IndexServerAddress string - MemoryLimit interface{} - SwapLimit interface{} - IPv4Forwarding interface{} - BridgeNfIptables bool - BridgeNfIp6tables bool - DockerRootDir string - HttpProxy string - HttpsProxy string - NoProxy string -} - -type ImageDelete struct { - Deleted string - Untagged string -} - -type EventOrError struct { - Event - Error error -} - -type WaitResult struct { - ExitCode int - Error error -} - -type decodingResult struct { - result interface{} - err error -} - -// The following are types for the API stats endpoint -type ThrottlingData struct { - // Number of periods with throttling active - Periods uint64 `json:"periods"` - // Number of periods when the container hit its throttling limit. - ThrottledPeriods uint64 `json:"throttled_periods"` - // Aggregate time the container was throttled for in nanoseconds. - ThrottledTime uint64 `json:"throttled_time"` -} - -type CpuUsage struct { - // Total CPU time consumed. - // Units: nanoseconds. - TotalUsage uint64 `json:"total_usage"` - // Total CPU time consumed per core. - // Units: nanoseconds. - PercpuUsage []uint64 `json:"percpu_usage"` - // Time spent by tasks of the cgroup in kernel mode. - // Units: nanoseconds. - UsageInKernelmode uint64 `json:"usage_in_kernelmode"` - // Time spent by tasks of the cgroup in user mode. - // Units: nanoseconds. - UsageInUsermode uint64 `json:"usage_in_usermode"` -} - -type CpuStats struct { - CpuUsage CpuUsage `json:"cpu_usage"` - SystemUsage uint64 `json:"system_cpu_usage"` - ThrottlingData ThrottlingData `json:"throttling_data,omitempty"` -} - -type NetworkStats struct { - RxBytes uint64 `json:"rx_bytes"` - RxPackets uint64 `json:"rx_packets"` - RxErrors uint64 `json:"rx_errors"` - RxDropped uint64 `json:"rx_dropped"` - TxBytes uint64 `json:"tx_bytes"` - TxPackets uint64 `json:"tx_packets"` - TxErrors uint64 `json:"tx_errors"` - TxDropped uint64 `json:"tx_dropped"` -} - -type MemoryStats struct { - Usage uint64 `json:"usage"` - MaxUsage uint64 `json:"max_usage"` - Stats map[string]uint64 `json:"stats"` - Failcnt uint64 `json:"failcnt"` - Limit uint64 `json:"limit"` -} - -type BlkioStatEntry struct { - Major uint64 `json:"major"` - Minor uint64 `json:"minor"` - Op string `json:"op"` - Value uint64 `json:"value"` -} - -type BlkioStats struct { - // number of bytes tranferred to and from the block device - IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive"` - IoServicedRecursive []BlkioStatEntry `json:"io_serviced_recursive"` - IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive"` - IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive"` - IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive"` - IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive"` - IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive"` - SectorsRecursive []BlkioStatEntry `json:"sectors_recursive"` -} - -type Stats struct { - Read time.Time `json:"read"` - NetworkStats NetworkStats `json:"network,omitempty"` - CpuStats CpuStats `json:"cpu_stats,omitempty"` - MemoryStats MemoryStats `json:"memory_stats,omitempty"` - BlkioStats BlkioStats `json:"blkio_stats,omitempty"` -} - -type Ulimit struct { - Name string `json:"name"` - Soft uint64 `json:"soft"` - Hard uint64 `json:"hard"` -} - -type LogConfig struct { - Type string `json:"type"` - Config map[string]string `json:"config"` -} - -type BuildImage struct { - Config *ConfigFile - DockerfileName string - Context io.Reader - RemoteURL string - RepoName string - SuppressOutput bool - NoCache bool - Remove bool - ForceRemove bool - Pull bool - Memory int64 - MemorySwap int64 - CpuShares int64 - CpuPeriod int64 - CpuQuota int64 - CpuSetCpus string - CpuSetMems string - CgroupParent string -} diff --git a/Godeps/_workspace/src/github.com/samalba/dockerclient/utils.go b/Godeps/_workspace/src/github.com/samalba/dockerclient/utils.go deleted file mode 100644 index 806f1b3e..00000000 --- a/Godeps/_workspace/src/github.com/samalba/dockerclient/utils.go +++ /dev/null @@ -1,33 +0,0 @@ -package dockerclient - -import ( - "crypto/tls" - "net" - "net/http" - "net/url" - "time" -) - -func newHTTPClient(u *url.URL, tlsConfig *tls.Config, timeout time.Duration) *http.Client { - httpTransport := &http.Transport{ - TLSClientConfig: tlsConfig, - } - - switch u.Scheme { - default: - httpTransport.Dial = func(proto, addr string) (net.Conn, error) { - return net.DialTimeout(proto, addr, timeout) - } - case "unix": - socketPath := u.Path - unixDial := func(proto, addr string) (net.Conn, error) { - return net.DialTimeout("unix", socketPath, timeout) - } - httpTransport.Dial = unixDial - // Override the main URL object so the HTTP lib won't complain - u.Scheme = "http" - u.Host = "unix.sock" - u.Path = "" - } - return &http.Client{Transport: httpTransport} -} diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/.gitignore b/vendor/github.com/Sirupsen/logrus/.gitignore similarity index 100% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/.gitignore rename to vendor/github.com/Sirupsen/logrus/.gitignore diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/.travis.yml b/vendor/github.com/Sirupsen/logrus/.travis.yml similarity index 100% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/.travis.yml rename to vendor/github.com/Sirupsen/logrus/.travis.yml diff --git a/vendor/github.com/Sirupsen/logrus/CHANGELOG.md b/vendor/github.com/Sirupsen/logrus/CHANGELOG.md new file mode 100644 index 00000000..78f98959 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/CHANGELOG.md @@ -0,0 +1,47 @@ +# 0.8.7 + +* logrus/core: fix possible race (#216) +* logrus/doc: small typo fixes and doc improvements + + +# 0.8.6 + +* hooks/raven: allow passing an initialized client + +# 0.8.5 + +* logrus/core: revert #208 + +# 0.8.4 + +* formatter/text: fix data race (#218) + +# 0.8.3 + +* logrus/core: fix entry log level (#208) +* logrus/core: improve performance of text formatter by 40% +* logrus/core: expose `LevelHooks` type +* logrus/core: add support for DragonflyBSD and NetBSD +* formatter/text: print structs more verbosely + +# 0.8.2 + +* logrus: fix more Fatal family functions + +# 0.8.1 + +* logrus: fix not exiting on `Fatalf` and `Fatalln` + +# 0.8.0 + +* logrus: defaults to stderr instead of stdout +* hooks/sentry: add special field for `*http.Request` +* formatter/text: ignore Windows for colors + +# 0.7.3 + +* formatter/\*: allow configuration of timestamp layout + +# 0.7.2 + +* formatter/text: Add configuration option for time format (#158) diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/LICENSE b/vendor/github.com/Sirupsen/logrus/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/LICENSE rename to vendor/github.com/Sirupsen/logrus/LICENSE diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/README.md b/vendor/github.com/Sirupsen/logrus/README.md similarity index 95% rename from Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/README.md rename to vendor/github.com/Sirupsen/logrus/README.md index cb73b018..6fa6e206 100644 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/README.md +++ b/vendor/github.com/Sirupsen/logrus/README.md @@ -206,6 +206,7 @@ func init() { | [Papertrail](https://github.com/Sirupsen/logrus/blob/master/hooks/papertrail/papertrail.go) | Send errors to the Papertrail hosted logging service via UDP. | | [Syslog](https://github.com/Sirupsen/logrus/blob/master/hooks/syslog/syslog.go) | Send errors to remote syslog server. Uses standard library `log/syslog` behind the scenes. | | [BugSnag](https://github.com/Sirupsen/logrus/blob/master/hooks/bugsnag/bugsnag.go) | Send errors to the Bugsnag exception tracking service. | +| [Sentry](https://github.com/Sirupsen/logrus/blob/master/hooks/sentry/sentry.go) | Send errors to the Sentry error logging and aggregation service. | | [Hiprus](https://github.com/nubo/hiprus) | Send errors to a channel in hipchat. | | [Logrusly](https://github.com/sebest/logrusly) | Send logs to [Loggly](https://www.loggly.com/) | | [Slackrus](https://github.com/johntdyer/slackrus) | Hook for Slack chat. | @@ -215,6 +216,9 @@ func init() { | [LFShook](https://github.com/rifflock/lfshook) | Hook for logging to the local filesystem | | [Honeybadger](https://github.com/agonzalezro/logrus_honeybadger) | Hook for sending exceptions to Honeybadger | | [Mail](https://github.com/zbindenren/logrus_mail) | Hook for sending exceptions via mail | +| [Rollrus](https://github.com/heroku/rollrus) | Hook for sending errors to rollbar | +| [Fluentd](https://github.com/evalphobia/logrus_fluent) | Hook for logging to fluentd | +| [Mongodb](https://github.com/weekface/mgorus) | Hook for logging to mongodb | #### Level logging @@ -270,7 +274,7 @@ init() { // do something here to set environment depending on an environment variable // or command-line flag if Environment == "production" { - log.SetFormatter(&logrus.JSONFormatter{}) + log.SetFormatter(&log.JSONFormatter{}) } else { // The TextFormatter is default, you don't actually have to do this. log.SetFormatter(&log.TextFormatter{}) @@ -313,7 +317,7 @@ type MyJSONFormatter struct { log.SetFormatter(new(MyJSONFormatter)) -func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { +func (f *MyJSONFormatter) Format(entry *Entry) ([]byte, error) { // Note this doesn't include Time, Level and Message which are available on // the Entry. Consult `godoc` on information about those fields or read the // source of the official loggers. @@ -327,7 +331,7 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { #### Logger as an `io.Writer` -Logrus can be transormed into an `io.Writer`. That writer is the end of an `io.Pipe` and it is your responsibility to close it. +Logrus can be transformed into an `io.Writer`. That writer is the end of an `io.Pipe` and it is your responsibility to close it. ```go w := logger.Writer() diff --git a/vendor/github.com/Sirupsen/logrus/doc.go b/vendor/github.com/Sirupsen/logrus/doc.go new file mode 100644 index 00000000..dddd5f87 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/doc.go @@ -0,0 +1,26 @@ +/* +Package logrus is a structured logger for Go, completely API compatible with the standard library logger. + + +The simplest way to use Logrus is simply the package-level exported logger: + + package main + + import ( + log "github.com/Sirupsen/logrus" + ) + + func main() { + log.WithFields(log.Fields{ + "animal": "walrus", + "number": 1, + "size": 10, + }).Info("A walrus appears") + } + +Output: + time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10 + +For a full guide visit https://github.com/Sirupsen/logrus +*/ +package logrus diff --git a/vendor/github.com/Sirupsen/logrus/entry.go b/vendor/github.com/Sirupsen/logrus/entry.go new file mode 100644 index 00000000..9ae900bc --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/entry.go @@ -0,0 +1,264 @@ +package logrus + +import ( + "bytes" + "fmt" + "io" + "os" + "time" +) + +// Defines the key when adding errors using WithError. +var ErrorKey = "error" + +// An entry is the final or intermediate Logrus logging entry. It contains all +// the fields passed with WithField{,s}. It's finally logged when Debug, Info, +// Warn, Error, Fatal or Panic is called on it. These objects can be reused and +// passed around as much as you wish to avoid field duplication. +type Entry struct { + Logger *Logger + + // Contains all the fields set by the user. + Data Fields + + // Time at which the log entry was created + Time time.Time + + // Level the log entry was logged at: Debug, Info, Warn, Error, Fatal or Panic + Level Level + + // Message passed to Debug, Info, Warn, Error, Fatal or Panic + Message string +} + +func NewEntry(logger *Logger) *Entry { + return &Entry{ + Logger: logger, + // Default is three fields, give a little extra room + Data: make(Fields, 5), + } +} + +// Returns a reader for the entry, which is a proxy to the formatter. +func (entry *Entry) Reader() (*bytes.Buffer, error) { + serialized, err := entry.Logger.Formatter.Format(entry) + return bytes.NewBuffer(serialized), err +} + +// Returns the string representation from the reader and ultimately the +// formatter. +func (entry *Entry) String() (string, error) { + reader, err := entry.Reader() + if err != nil { + return "", err + } + + return reader.String(), err +} + +// Add an error as single field (using the key defined in ErrorKey) to the Entry. +func (entry *Entry) WithError(err error) *Entry { + return entry.WithField(ErrorKey, err) +} + +// Add a single field to the Entry. +func (entry *Entry) WithField(key string, value interface{}) *Entry { + return entry.WithFields(Fields{key: value}) +} + +// Add a map of fields to the Entry. +func (entry *Entry) WithFields(fields Fields) *Entry { + data := Fields{} + for k, v := range entry.Data { + data[k] = v + } + for k, v := range fields { + data[k] = v + } + return &Entry{Logger: entry.Logger, Data: data} +} + +// This function is not declared with a pointer value because otherwise +// race conditions will occur when using multiple goroutines +func (entry Entry) log(level Level, msg string) { + entry.Time = time.Now() + entry.Level = level + entry.Message = msg + + if err := entry.Logger.Hooks.Fire(level, &entry); err != nil { + entry.Logger.mu.Lock() + fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err) + entry.Logger.mu.Unlock() + } + + reader, err := entry.Reader() + if err != nil { + entry.Logger.mu.Lock() + fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err) + entry.Logger.mu.Unlock() + } + + entry.Logger.mu.Lock() + defer entry.Logger.mu.Unlock() + + _, err = io.Copy(entry.Logger.Out, reader) + if err != nil { + fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err) + } + + // To avoid Entry#log() returning a value that only would make sense for + // panic() to use in Entry#Panic(), we avoid the allocation by checking + // directly here. + if level <= PanicLevel { + panic(&entry) + } +} + +func (entry *Entry) Debug(args ...interface{}) { + if entry.Logger.Level >= DebugLevel { + entry.log(DebugLevel, fmt.Sprint(args...)) + } +} + +func (entry *Entry) Print(args ...interface{}) { + entry.Info(args...) +} + +func (entry *Entry) Info(args ...interface{}) { + if entry.Logger.Level >= InfoLevel { + entry.log(InfoLevel, fmt.Sprint(args...)) + } +} + +func (entry *Entry) Warn(args ...interface{}) { + if entry.Logger.Level >= WarnLevel { + entry.log(WarnLevel, fmt.Sprint(args...)) + } +} + +func (entry *Entry) Warning(args ...interface{}) { + entry.Warn(args...) +} + +func (entry *Entry) Error(args ...interface{}) { + if entry.Logger.Level >= ErrorLevel { + entry.log(ErrorLevel, fmt.Sprint(args...)) + } +} + +func (entry *Entry) Fatal(args ...interface{}) { + if entry.Logger.Level >= FatalLevel { + entry.log(FatalLevel, fmt.Sprint(args...)) + } + os.Exit(1) +} + +func (entry *Entry) Panic(args ...interface{}) { + if entry.Logger.Level >= PanicLevel { + entry.log(PanicLevel, fmt.Sprint(args...)) + } + panic(fmt.Sprint(args...)) +} + +// Entry Printf family functions + +func (entry *Entry) Debugf(format string, args ...interface{}) { + if entry.Logger.Level >= DebugLevel { + entry.Debug(fmt.Sprintf(format, args...)) + } +} + +func (entry *Entry) Infof(format string, args ...interface{}) { + if entry.Logger.Level >= InfoLevel { + entry.Info(fmt.Sprintf(format, args...)) + } +} + +func (entry *Entry) Printf(format string, args ...interface{}) { + entry.Infof(format, args...) +} + +func (entry *Entry) Warnf(format string, args ...interface{}) { + if entry.Logger.Level >= WarnLevel { + entry.Warn(fmt.Sprintf(format, args...)) + } +} + +func (entry *Entry) Warningf(format string, args ...interface{}) { + entry.Warnf(format, args...) +} + +func (entry *Entry) Errorf(format string, args ...interface{}) { + if entry.Logger.Level >= ErrorLevel { + entry.Error(fmt.Sprintf(format, args...)) + } +} + +func (entry *Entry) Fatalf(format string, args ...interface{}) { + if entry.Logger.Level >= FatalLevel { + entry.Fatal(fmt.Sprintf(format, args...)) + } + os.Exit(1) +} + +func (entry *Entry) Panicf(format string, args ...interface{}) { + if entry.Logger.Level >= PanicLevel { + entry.Panic(fmt.Sprintf(format, args...)) + } +} + +// Entry Println family functions + +func (entry *Entry) Debugln(args ...interface{}) { + if entry.Logger.Level >= DebugLevel { + entry.Debug(entry.sprintlnn(args...)) + } +} + +func (entry *Entry) Infoln(args ...interface{}) { + if entry.Logger.Level >= InfoLevel { + entry.Info(entry.sprintlnn(args...)) + } +} + +func (entry *Entry) Println(args ...interface{}) { + entry.Infoln(args...) +} + +func (entry *Entry) Warnln(args ...interface{}) { + if entry.Logger.Level >= WarnLevel { + entry.Warn(entry.sprintlnn(args...)) + } +} + +func (entry *Entry) Warningln(args ...interface{}) { + entry.Warnln(args...) +} + +func (entry *Entry) Errorln(args ...interface{}) { + if entry.Logger.Level >= ErrorLevel { + entry.Error(entry.sprintlnn(args...)) + } +} + +func (entry *Entry) Fatalln(args ...interface{}) { + if entry.Logger.Level >= FatalLevel { + entry.Fatal(entry.sprintlnn(args...)) + } + os.Exit(1) +} + +func (entry *Entry) Panicln(args ...interface{}) { + if entry.Logger.Level >= PanicLevel { + entry.Panic(entry.sprintlnn(args...)) + } +} + +// Sprintlnn => Sprint no newline. This is to get the behavior of how +// fmt.Sprintln where spaces are always added between operands, regardless of +// their type. Instead of vendoring the Sprintln implementation to spare a +// string allocation, we do the simplest thing. +func (entry *Entry) sprintlnn(args ...interface{}) string { + msg := fmt.Sprintln(args...) + return msg[:len(msg)-1] +} diff --git a/vendor/github.com/Sirupsen/logrus/entry_test.go b/vendor/github.com/Sirupsen/logrus/entry_test.go new file mode 100644 index 00000000..99c3b41d --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/entry_test.go @@ -0,0 +1,77 @@ +package logrus + +import ( + "bytes" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestEntryWithError(t *testing.T) { + + assert := assert.New(t) + + defer func() { + ErrorKey = "error" + }() + + err := fmt.Errorf("kaboom at layer %d", 4711) + + assert.Equal(err, WithError(err).Data["error"]) + + logger := New() + logger.Out = &bytes.Buffer{} + entry := NewEntry(logger) + + assert.Equal(err, entry.WithError(err).Data["error"]) + + ErrorKey = "err" + + assert.Equal(err, entry.WithError(err).Data["err"]) + +} + +func TestEntryPanicln(t *testing.T) { + errBoom := fmt.Errorf("boom time") + + defer func() { + p := recover() + assert.NotNil(t, p) + + switch pVal := p.(type) { + case *Entry: + assert.Equal(t, "kaboom", pVal.Message) + assert.Equal(t, errBoom, pVal.Data["err"]) + default: + t.Fatalf("want type *Entry, got %T: %#v", pVal, pVal) + } + }() + + logger := New() + logger.Out = &bytes.Buffer{} + entry := NewEntry(logger) + entry.WithField("err", errBoom).Panicln("kaboom") +} + +func TestEntryPanicf(t *testing.T) { + errBoom := fmt.Errorf("boom again") + + defer func() { + p := recover() + assert.NotNil(t, p) + + switch pVal := p.(type) { + case *Entry: + assert.Equal(t, "kaboom true", pVal.Message) + assert.Equal(t, errBoom, pVal.Data["err"]) + default: + t.Fatalf("want type *Entry, got %T: %#v", pVal, pVal) + } + }() + + logger := New() + logger.Out = &bytes.Buffer{} + entry := NewEntry(logger) + entry.WithField("err", errBoom).Panicf("kaboom %v", true) +} diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/examples/basic/basic.go b/vendor/github.com/Sirupsen/logrus/examples/basic/basic.go similarity index 76% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/examples/basic/basic.go rename to vendor/github.com/Sirupsen/logrus/examples/basic/basic.go index a62ba45d..a1623ec0 100644 --- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/examples/basic/basic.go +++ b/vendor/github.com/Sirupsen/logrus/examples/basic/basic.go @@ -9,6 +9,7 @@ var log = logrus.New() func init() { log.Formatter = new(logrus.JSONFormatter) log.Formatter = new(logrus.TextFormatter) // default + log.Level = logrus.DebugLevel } func main() { @@ -23,6 +24,11 @@ func main() { } }() + log.WithFields(logrus.Fields{ + "animal": "walrus", + "number": 8, + }).Debug("Started observing beach") + log.WithFields(logrus.Fields{ "animal": "walrus", "size": 10, @@ -33,6 +39,10 @@ func main() { "number": 122, }).Warn("The group's number increased tremendously!") + log.WithFields(logrus.Fields{ + "temperature": -4, + }).Debug("Temperature changes") + log.WithFields(logrus.Fields{ "animal": "orca", "size": 9009, diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/examples/hook/hook.go b/vendor/github.com/Sirupsen/logrus/examples/hook/hook.go similarity index 70% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/examples/hook/hook.go rename to vendor/github.com/Sirupsen/logrus/examples/hook/hook.go index 42e7a4c9..cb5759a3 100644 --- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/examples/hook/hook.go +++ b/vendor/github.com/Sirupsen/logrus/examples/hook/hook.go @@ -3,21 +3,16 @@ package main import ( "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus/hooks/airbrake" - "github.com/tobi/airbrake-go" ) var log = logrus.New() func init() { log.Formatter = new(logrus.TextFormatter) // default - log.Hooks.Add(new(logrus_airbrake.AirbrakeHook)) + log.Hooks.Add(airbrake.NewHook("https://example.com", "xyz", "development")) } func main() { - airbrake.Endpoint = "https://exceptions.whatever.com/notifier_api/v2/notices.xml" - airbrake.ApiKey = "whatever" - airbrake.Environment = "production" - log.WithFields(logrus.Fields{ "animal": "walrus", "size": 10, diff --git a/vendor/github.com/Sirupsen/logrus/exported.go b/vendor/github.com/Sirupsen/logrus/exported.go new file mode 100644 index 00000000..9a0120ac --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/exported.go @@ -0,0 +1,193 @@ +package logrus + +import ( + "io" +) + +var ( + // std is the name of the standard logger in stdlib `log` + std = New() +) + +func StandardLogger() *Logger { + return std +} + +// SetOutput sets the standard logger output. +func SetOutput(out io.Writer) { + std.mu.Lock() + defer std.mu.Unlock() + std.Out = out +} + +// SetFormatter sets the standard logger formatter. +func SetFormatter(formatter Formatter) { + std.mu.Lock() + defer std.mu.Unlock() + std.Formatter = formatter +} + +// SetLevel sets the standard logger level. +func SetLevel(level Level) { + std.mu.Lock() + defer std.mu.Unlock() + std.Level = level +} + +// GetLevel returns the standard logger level. +func GetLevel() Level { + std.mu.Lock() + defer std.mu.Unlock() + return std.Level +} + +// AddHook adds a hook to the standard logger hooks. +func AddHook(hook Hook) { + std.mu.Lock() + defer std.mu.Unlock() + std.Hooks.Add(hook) +} + +// WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key. +func WithError(err error) *Entry { + return std.WithField(ErrorKey, err) +} + +// WithField creates an entry from the standard logger and adds a field to +// it. If you want multiple fields, use `WithFields`. +// +// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal +// or Panic on the Entry it returns. +func WithField(key string, value interface{}) *Entry { + return std.WithField(key, value) +} + +// WithFields creates an entry from the standard logger and adds multiple +// fields to it. This is simply a helper for `WithField`, invoking it +// once for each field. +// +// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal +// or Panic on the Entry it returns. +func WithFields(fields Fields) *Entry { + return std.WithFields(fields) +} + +// Debug logs a message at level Debug on the standard logger. +func Debug(args ...interface{}) { + std.Debug(args...) +} + +// Print logs a message at level Info on the standard logger. +func Print(args ...interface{}) { + std.Print(args...) +} + +// Info logs a message at level Info on the standard logger. +func Info(args ...interface{}) { + std.Info(args...) +} + +// Warn logs a message at level Warn on the standard logger. +func Warn(args ...interface{}) { + std.Warn(args...) +} + +// Warning logs a message at level Warn on the standard logger. +func Warning(args ...interface{}) { + std.Warning(args...) +} + +// Error logs a message at level Error on the standard logger. +func Error(args ...interface{}) { + std.Error(args...) +} + +// Panic logs a message at level Panic on the standard logger. +func Panic(args ...interface{}) { + std.Panic(args...) +} + +// Fatal logs a message at level Fatal on the standard logger. +func Fatal(args ...interface{}) { + std.Fatal(args...) +} + +// Debugf logs a message at level Debug on the standard logger. +func Debugf(format string, args ...interface{}) { + std.Debugf(format, args...) +} + +// Printf logs a message at level Info on the standard logger. +func Printf(format string, args ...interface{}) { + std.Printf(format, args...) +} + +// Infof logs a message at level Info on the standard logger. +func Infof(format string, args ...interface{}) { + std.Infof(format, args...) +} + +// Warnf logs a message at level Warn on the standard logger. +func Warnf(format string, args ...interface{}) { + std.Warnf(format, args...) +} + +// Warningf logs a message at level Warn on the standard logger. +func Warningf(format string, args ...interface{}) { + std.Warningf(format, args...) +} + +// Errorf logs a message at level Error on the standard logger. +func Errorf(format string, args ...interface{}) { + std.Errorf(format, args...) +} + +// Panicf logs a message at level Panic on the standard logger. +func Panicf(format string, args ...interface{}) { + std.Panicf(format, args...) +} + +// Fatalf logs a message at level Fatal on the standard logger. +func Fatalf(format string, args ...interface{}) { + std.Fatalf(format, args...) +} + +// Debugln logs a message at level Debug on the standard logger. +func Debugln(args ...interface{}) { + std.Debugln(args...) +} + +// Println logs a message at level Info on the standard logger. +func Println(args ...interface{}) { + std.Println(args...) +} + +// Infoln logs a message at level Info on the standard logger. +func Infoln(args ...interface{}) { + std.Infoln(args...) +} + +// Warnln logs a message at level Warn on the standard logger. +func Warnln(args ...interface{}) { + std.Warnln(args...) +} + +// Warningln logs a message at level Warn on the standard logger. +func Warningln(args ...interface{}) { + std.Warningln(args...) +} + +// Errorln logs a message at level Error on the standard logger. +func Errorln(args ...interface{}) { + std.Errorln(args...) +} + +// Panicln logs a message at level Panic on the standard logger. +func Panicln(args ...interface{}) { + std.Panicln(args...) +} + +// Fatalln logs a message at level Fatal on the standard logger. +func Fatalln(args ...interface{}) { + std.Fatalln(args...) +} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/formatter.go b/vendor/github.com/Sirupsen/logrus/formatter.go similarity index 100% rename from Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/formatter.go rename to vendor/github.com/Sirupsen/logrus/formatter.go diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/formatter_bench_test.go b/vendor/github.com/Sirupsen/logrus/formatter_bench_test.go similarity index 90% rename from Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/formatter_bench_test.go rename to vendor/github.com/Sirupsen/logrus/formatter_bench_test.go index 77989da6..c6d290c7 100644 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/formatter_bench_test.go +++ b/vendor/github.com/Sirupsen/logrus/formatter_bench_test.go @@ -1,6 +1,7 @@ package logrus import ( + "fmt" "testing" "time" ) @@ -45,6 +46,15 @@ var largeFields = Fields{ "entries": "yeah", } +var errorFields = Fields{ + "foo": fmt.Errorf("bar"), + "baz": fmt.Errorf("qux"), +} + +func BenchmarkErrorTextFormatter(b *testing.B) { + doBenchmark(b, &TextFormatter{DisableColors: true}, errorFields) +} + func BenchmarkSmallTextFormatter(b *testing.B) { doBenchmark(b, &TextFormatter{DisableColors: true}, smallFields) } diff --git a/vendor/github.com/Sirupsen/logrus/formatters/logstash/logstash.go b/vendor/github.com/Sirupsen/logrus/formatters/logstash/logstash.go new file mode 100644 index 00000000..8ea93ddf --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/formatters/logstash/logstash.go @@ -0,0 +1,56 @@ +package logstash + +import ( + "encoding/json" + "fmt" + + "github.com/Sirupsen/logrus" +) + +// Formatter generates json in logstash format. +// Logstash site: http://logstash.net/ +type LogstashFormatter struct { + Type string // if not empty use for logstash type field. + + // TimestampFormat sets the format used for timestamps. + TimestampFormat string +} + +func (f *LogstashFormatter) Format(entry *logrus.Entry) ([]byte, error) { + entry.Data["@version"] = 1 + + if f.TimestampFormat == "" { + f.TimestampFormat = logrus.DefaultTimestampFormat + } + + entry.Data["@timestamp"] = entry.Time.Format(f.TimestampFormat) + + // set message field + v, ok := entry.Data["message"] + if ok { + entry.Data["fields.message"] = v + } + entry.Data["message"] = entry.Message + + // set level field + v, ok = entry.Data["level"] + if ok { + entry.Data["fields.level"] = v + } + entry.Data["level"] = entry.Level.String() + + // set type field + if f.Type != "" { + v, ok = entry.Data["type"] + if ok { + entry.Data["fields.type"] = v + } + entry.Data["type"] = f.Type + } + + serialized, err := json.Marshal(entry.Data) + if err != nil { + return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) + } + return append(serialized, '\n'), nil +} diff --git a/vendor/github.com/Sirupsen/logrus/formatters/logstash/logstash_test.go b/vendor/github.com/Sirupsen/logrus/formatters/logstash/logstash_test.go new file mode 100644 index 00000000..d8814a0e --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/formatters/logstash/logstash_test.go @@ -0,0 +1,52 @@ +package logstash + +import ( + "bytes" + "encoding/json" + "github.com/Sirupsen/logrus" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestLogstashFormatter(t *testing.T) { + assert := assert.New(t) + + lf := LogstashFormatter{Type: "abc"} + + fields := logrus.Fields{ + "message": "def", + "level": "ijk", + "type": "lmn", + "one": 1, + "pi": 3.14, + "bool": true, + } + + entry := logrus.WithFields(fields) + entry.Message = "msg" + entry.Level = logrus.InfoLevel + + b, _ := lf.Format(entry) + + var data map[string]interface{} + dec := json.NewDecoder(bytes.NewReader(b)) + dec.UseNumber() + dec.Decode(&data) + + // base fields + assert.Equal(json.Number("1"), data["@version"]) + assert.NotEmpty(data["@timestamp"]) + assert.Equal("abc", data["type"]) + assert.Equal("msg", data["message"]) + assert.Equal("info", data["level"]) + + // substituted fields + assert.Equal("def", data["fields.message"]) + assert.Equal("ijk", data["fields.level"]) + assert.Equal("lmn", data["fields.type"]) + + // formats + assert.Equal(json.Number("1"), data["one"]) + assert.Equal(json.Number("3.14"), data["pi"]) + assert.Equal(true, data["bool"]) +} diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hook_test.go b/vendor/github.com/Sirupsen/logrus/hook_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/hook_test.go rename to vendor/github.com/Sirupsen/logrus/hook_test.go diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/hooks.go b/vendor/github.com/Sirupsen/logrus/hooks.go similarity index 87% rename from Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/hooks.go rename to vendor/github.com/Sirupsen/logrus/hooks.go index 0da2b365..3f151cdc 100644 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/hooks.go +++ b/vendor/github.com/Sirupsen/logrus/hooks.go @@ -11,11 +11,11 @@ type Hook interface { } // Internal type for storing the hooks on a logger instance. -type levelHooks map[Level][]Hook +type LevelHooks map[Level][]Hook // Add a hook to an instance of logger. This is called with // `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface. -func (hooks levelHooks) Add(hook Hook) { +func (hooks LevelHooks) Add(hook Hook) { for _, level := range hook.Levels() { hooks[level] = append(hooks[level], hook) } @@ -23,7 +23,7 @@ func (hooks levelHooks) Add(hook Hook) { // Fire all the hooks for the passed level. Used by `entry.log` to fire // appropriate hooks for a log entry. -func (hooks levelHooks) Fire(level Level, entry *Entry) error { +func (hooks LevelHooks) Fire(level Level, entry *Entry) error { for _, hook := range hooks[level] { if err := hook.Fire(entry); err != nil { return err diff --git a/vendor/github.com/Sirupsen/logrus/hooks/airbrake/airbrake.go b/vendor/github.com/Sirupsen/logrus/hooks/airbrake/airbrake.go new file mode 100644 index 00000000..b0502c33 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/hooks/airbrake/airbrake.go @@ -0,0 +1,54 @@ +package airbrake + +import ( + "errors" + "fmt" + + "github.com/Sirupsen/logrus" + "github.com/tobi/airbrake-go" +) + +// AirbrakeHook to send exceptions to an exception-tracking service compatible +// with the Airbrake API. +type airbrakeHook struct { + APIKey string + Endpoint string + Environment string +} + +func NewHook(endpoint, apiKey, env string) *airbrakeHook { + return &airbrakeHook{ + APIKey: apiKey, + Endpoint: endpoint, + Environment: env, + } +} + +func (hook *airbrakeHook) Fire(entry *logrus.Entry) error { + airbrake.ApiKey = hook.APIKey + airbrake.Endpoint = hook.Endpoint + airbrake.Environment = hook.Environment + + var notifyErr error + err, ok := entry.Data["error"].(error) + if ok { + notifyErr = err + } else { + notifyErr = errors.New(entry.Message) + } + + airErr := airbrake.Notify(notifyErr) + if airErr != nil { + return fmt.Errorf("Failed to send error to Airbrake: %s", airErr) + } + + return nil +} + +func (hook *airbrakeHook) Levels() []logrus.Level { + return []logrus.Level{ + logrus.ErrorLevel, + logrus.FatalLevel, + logrus.PanicLevel, + } +} diff --git a/vendor/github.com/Sirupsen/logrus/hooks/airbrake/airbrake_test.go b/vendor/github.com/Sirupsen/logrus/hooks/airbrake/airbrake_test.go new file mode 100644 index 00000000..058a91e3 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/hooks/airbrake/airbrake_test.go @@ -0,0 +1,133 @@ +package airbrake + +import ( + "encoding/xml" + "net/http" + "net/http/httptest" + "testing" + "time" + + "github.com/Sirupsen/logrus" +) + +type notice struct { + Error NoticeError `xml:"error"` +} +type NoticeError struct { + Class string `xml:"class"` + Message string `xml:"message"` +} + +type customErr struct { + msg string +} + +func (e *customErr) Error() string { + return e.msg +} + +const ( + testAPIKey = "abcxyz" + testEnv = "development" + expectedClass = "*airbrake.customErr" + expectedMsg = "foo" + unintendedMsg = "Airbrake will not see this string" +) + +var ( + noticeError = make(chan NoticeError, 1) +) + +// TestLogEntryMessageReceived checks if invoking Logrus' log.Error +// method causes an XML payload containing the log entry message is received +// by a HTTP server emulating an Airbrake-compatible endpoint. +func TestLogEntryMessageReceived(t *testing.T) { + log := logrus.New() + ts := startAirbrakeServer(t) + defer ts.Close() + + hook := NewHook(ts.URL, testAPIKey, "production") + log.Hooks.Add(hook) + + log.Error(expectedMsg) + + select { + case received := <-noticeError: + if received.Message != expectedMsg { + t.Errorf("Unexpected message received: %s", received.Message) + } + case <-time.After(time.Second): + t.Error("Timed out; no notice received by Airbrake API") + } +} + +// TestLogEntryMessageReceived confirms that, when passing an error type using +// logrus.Fields, a HTTP server emulating an Airbrake endpoint receives the +// error message returned by the Error() method on the error interface +// rather than the logrus.Entry.Message string. +func TestLogEntryWithErrorReceived(t *testing.T) { + log := logrus.New() + ts := startAirbrakeServer(t) + defer ts.Close() + + hook := NewHook(ts.URL, testAPIKey, "production") + log.Hooks.Add(hook) + + log.WithFields(logrus.Fields{ + "error": &customErr{expectedMsg}, + }).Error(unintendedMsg) + + select { + case received := <-noticeError: + if received.Message != expectedMsg { + t.Errorf("Unexpected message received: %s", received.Message) + } + if received.Class != expectedClass { + t.Errorf("Unexpected error class: %s", received.Class) + } + case <-time.After(time.Second): + t.Error("Timed out; no notice received by Airbrake API") + } +} + +// TestLogEntryWithNonErrorTypeNotReceived confirms that, when passing a +// non-error type using logrus.Fields, a HTTP server emulating an Airbrake +// endpoint receives the logrus.Entry.Message string. +// +// Only error types are supported when setting the 'error' field using +// logrus.WithFields(). +func TestLogEntryWithNonErrorTypeNotReceived(t *testing.T) { + log := logrus.New() + ts := startAirbrakeServer(t) + defer ts.Close() + + hook := NewHook(ts.URL, testAPIKey, "production") + log.Hooks.Add(hook) + + log.WithFields(logrus.Fields{ + "error": expectedMsg, + }).Error(unintendedMsg) + + select { + case received := <-noticeError: + if received.Message != unintendedMsg { + t.Errorf("Unexpected message received: %s", received.Message) + } + case <-time.After(time.Second): + t.Error("Timed out; no notice received by Airbrake API") + } +} + +func startAirbrakeServer(t *testing.T) *httptest.Server { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var notice notice + if err := xml.NewDecoder(r.Body).Decode(¬ice); err != nil { + t.Error(err) + } + r.Body.Close() + + noticeError <- notice.Error + })) + + return ts +} diff --git a/vendor/github.com/Sirupsen/logrus/hooks/bugsnag/bugsnag.go b/vendor/github.com/Sirupsen/logrus/hooks/bugsnag/bugsnag.go new file mode 100644 index 00000000..d20a0f54 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/hooks/bugsnag/bugsnag.go @@ -0,0 +1,68 @@ +package logrus_bugsnag + +import ( + "errors" + + "github.com/Sirupsen/logrus" + "github.com/bugsnag/bugsnag-go" +) + +type bugsnagHook struct{} + +// ErrBugsnagUnconfigured is returned if NewBugsnagHook is called before +// bugsnag.Configure. Bugsnag must be configured before the hook. +var ErrBugsnagUnconfigured = errors.New("bugsnag must be configured before installing this logrus hook") + +// ErrBugsnagSendFailed indicates that the hook failed to submit an error to +// bugsnag. The error was successfully generated, but `bugsnag.Notify()` +// failed. +type ErrBugsnagSendFailed struct { + err error +} + +func (e ErrBugsnagSendFailed) Error() string { + return "failed to send error to Bugsnag: " + e.err.Error() +} + +// NewBugsnagHook initializes a logrus hook which sends exceptions to an +// exception-tracking service compatible with the Bugsnag API. Before using +// this hook, you must call bugsnag.Configure(). The returned object should be +// registered with a log via `AddHook()` +// +// Entries that trigger an Error, Fatal or Panic should now include an "error" +// field to send to Bugsnag. +func NewBugsnagHook() (*bugsnagHook, error) { + if bugsnag.Config.APIKey == "" { + return nil, ErrBugsnagUnconfigured + } + return &bugsnagHook{}, nil +} + +// Fire forwards an error to Bugsnag. Given a logrus.Entry, it extracts the +// "error" field (or the Message if the error isn't present) and sends it off. +func (hook *bugsnagHook) Fire(entry *logrus.Entry) error { + var notifyErr error + err, ok := entry.Data["error"].(error) + if ok { + notifyErr = err + } else { + notifyErr = errors.New(entry.Message) + } + + bugsnagErr := bugsnag.Notify(notifyErr) + if bugsnagErr != nil { + return ErrBugsnagSendFailed{bugsnagErr} + } + + return nil +} + +// Levels enumerates the log levels on which the error should be forwarded to +// bugsnag: everything at or above the "Error" level. +func (hook *bugsnagHook) Levels() []logrus.Level { + return []logrus.Level{ + logrus.ErrorLevel, + logrus.FatalLevel, + logrus.PanicLevel, + } +} diff --git a/vendor/github.com/Sirupsen/logrus/hooks/bugsnag/bugsnag_test.go b/vendor/github.com/Sirupsen/logrus/hooks/bugsnag/bugsnag_test.go new file mode 100644 index 00000000..e9ea298d --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/hooks/bugsnag/bugsnag_test.go @@ -0,0 +1,64 @@ +package logrus_bugsnag + +import ( + "encoding/json" + "errors" + "io/ioutil" + "net/http" + "net/http/httptest" + "testing" + "time" + + "github.com/Sirupsen/logrus" + "github.com/bugsnag/bugsnag-go" +) + +type notice struct { + Events []struct { + Exceptions []struct { + Message string `json:"message"` + } `json:"exceptions"` + } `json:"events"` +} + +func TestNoticeReceived(t *testing.T) { + msg := make(chan string, 1) + expectedMsg := "foo" + + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var notice notice + data, _ := ioutil.ReadAll(r.Body) + if err := json.Unmarshal(data, ¬ice); err != nil { + t.Error(err) + } + _ = r.Body.Close() + + msg <- notice.Events[0].Exceptions[0].Message + })) + defer ts.Close() + + hook := &bugsnagHook{} + + bugsnag.Configure(bugsnag.Configuration{ + Endpoint: ts.URL, + ReleaseStage: "production", + APIKey: "12345678901234567890123456789012", + Synchronous: true, + }) + + log := logrus.New() + log.Hooks.Add(hook) + + log.WithFields(logrus.Fields{ + "error": errors.New(expectedMsg), + }).Error("Bugsnag will not see this string") + + select { + case received := <-msg: + if received != expectedMsg { + t.Errorf("Unexpected message received: %s", received) + } + case <-time.After(time.Second): + t.Error("Timed out; no notice received by Bugsnag API") + } +} diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/README.md b/vendor/github.com/Sirupsen/logrus/hooks/papertrail/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/README.md rename to vendor/github.com/Sirupsen/logrus/hooks/papertrail/README.md diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/papertrail.go b/vendor/github.com/Sirupsen/logrus/hooks/papertrail/papertrail.go similarity index 100% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/papertrail.go rename to vendor/github.com/Sirupsen/logrus/hooks/papertrail/papertrail.go diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/papertrail_test.go b/vendor/github.com/Sirupsen/logrus/hooks/papertrail/papertrail_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/papertrail_test.go rename to vendor/github.com/Sirupsen/logrus/hooks/papertrail/papertrail_test.go diff --git a/vendor/github.com/Sirupsen/logrus/hooks/sentry/README.md b/vendor/github.com/Sirupsen/logrus/hooks/sentry/README.md new file mode 100644 index 00000000..31de6540 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/hooks/sentry/README.md @@ -0,0 +1,111 @@ +# Sentry Hook for Logrus :walrus: + +[Sentry](https://getsentry.com) provides both self-hosted and hosted +solutions for exception tracking. +Both client and server are +[open source](https://github.com/getsentry/sentry). + +## Usage + +Every sentry application defined on the server gets a different +[DSN](https://www.getsentry.com/docs/). In the example below replace +`YOUR_DSN` with the one created for your application. + +```go +import ( + "github.com/Sirupsen/logrus" + "github.com/Sirupsen/logrus/hooks/sentry" +) + +func main() { + log := logrus.New() + hook, err := logrus_sentry.NewSentryHook(YOUR_DSN, []logrus.Level{ + logrus.PanicLevel, + logrus.FatalLevel, + logrus.ErrorLevel, + }) + + if err == nil { + log.Hooks.Add(hook) + } +} +``` + +If you wish to initialize a SentryHook with tags, you can use the `NewWithTagsSentryHook` constructor to provide default tags: + +```go +tags := map[string]string{ + "site": "example.com", +} +levels := []logrus.Level{ + logrus.PanicLevel, + logrus.FatalLevel, + logrus.ErrorLevel, +} +hook, err := logrus_sentry.NewWithTagsSentryHook(YOUR_DSN, tags, levels) + +``` + +If you wish to initialize a SentryHook with an already initialized raven client, you can use +the `NewWithClientSentryHook` constructor: + +```go +import ( + "github.com/Sirupsen/logrus" + "github.com/Sirupsen/logrus/hooks/sentry" + "github.com/getsentry/raven-go" +) + +func main() { + log := logrus.New() + + client, err := raven.New(YOUR_DSN) + if err != nil { + log.Fatal(err) + } + + hook, err := logrus_sentry.NewWithClientSentryHook(client, []logrus.Level{ + logrus.PanicLevel, + logrus.FatalLevel, + logrus.ErrorLevel, + }) + + if err == nil { + log.Hooks.Add(hook) + } +} + +hook, err := NewWithClientSentryHook(client, []logrus.Level{ + logrus.ErrorLevel, +}) +``` + +## Special fields + +Some logrus fields have a special meaning in this hook, +these are `server_name`, `logger` and `http_request`. +When logs are sent to sentry these fields are treated differently. +- `server_name` (also known as hostname) is the name of the server which +is logging the event (hostname.example.com) +- `logger` is the part of the application which is logging the event. +In go this usually means setting it to the name of the package. +- `http_request` is the in-coming request(*http.Request). The detailed request data are sent to Sentry. + +## Timeout + +`Timeout` is the time the sentry hook will wait for a response +from the sentry server. + +If this time elapses with no response from +the server an error will be returned. + +If `Timeout` is set to 0 the SentryHook will not wait for a reply +and will assume a correct delivery. + +The SentryHook has a default timeout of `100 milliseconds` when created +with a call to `NewSentryHook`. This can be changed by assigning a value to the `Timeout` field: + +```go +hook, _ := logrus_sentry.NewSentryHook(...) +hook.Timeout = 20*time.Second +``` diff --git a/vendor/github.com/Sirupsen/logrus/hooks/sentry/sentry.go b/vendor/github.com/Sirupsen/logrus/hooks/sentry/sentry.go new file mode 100644 index 00000000..cf88098a --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/hooks/sentry/sentry.go @@ -0,0 +1,137 @@ +package logrus_sentry + +import ( + "fmt" + "net/http" + "time" + + "github.com/Sirupsen/logrus" + "github.com/getsentry/raven-go" +) + +var ( + severityMap = map[logrus.Level]raven.Severity{ + logrus.DebugLevel: raven.DEBUG, + logrus.InfoLevel: raven.INFO, + logrus.WarnLevel: raven.WARNING, + logrus.ErrorLevel: raven.ERROR, + logrus.FatalLevel: raven.FATAL, + logrus.PanicLevel: raven.FATAL, + } +) + +func getAndDel(d logrus.Fields, key string) (string, bool) { + var ( + ok bool + v interface{} + val string + ) + if v, ok = d[key]; !ok { + return "", false + } + + if val, ok = v.(string); !ok { + return "", false + } + delete(d, key) + return val, true +} + +func getAndDelRequest(d logrus.Fields, key string) (*http.Request, bool) { + var ( + ok bool + v interface{} + req *http.Request + ) + if v, ok = d[key]; !ok { + return nil, false + } + if req, ok = v.(*http.Request); !ok || req == nil { + return nil, false + } + delete(d, key) + return req, true +} + +// SentryHook delivers logs to a sentry server. +type SentryHook struct { + // Timeout sets the time to wait for a delivery error from the sentry server. + // If this is set to zero the server will not wait for any response and will + // consider the message correctly sent + Timeout time.Duration + + client *raven.Client + levels []logrus.Level +} + +// NewSentryHook creates a hook to be added to an instance of logger +// and initializes the raven client. +// This method sets the timeout to 100 milliseconds. +func NewSentryHook(DSN string, levels []logrus.Level) (*SentryHook, error) { + client, err := raven.New(DSN) + if err != nil { + return nil, err + } + return &SentryHook{100 * time.Millisecond, client, levels}, nil +} + +// NewWithTagsSentryHook creates a hook with tags to be added to an instance +// of logger and initializes the raven client. This method sets the timeout to +// 100 milliseconds. +func NewWithTagsSentryHook(DSN string, tags map[string]string, levels []logrus.Level) (*SentryHook, error) { + client, err := raven.NewWithTags(DSN, tags) + if err != nil { + return nil, err + } + return &SentryHook{100 * time.Millisecond, client, levels}, nil +} + +// NewWithClientSentryHook creates a hook using an initialized raven client. +// This method sets the timeout to 100 milliseconds. +func NewWithClientSentryHook(client *raven.Client, levels []logrus.Level) (*SentryHook, error) { + return &SentryHook{100 * time.Millisecond, client, levels}, nil +} + +// Called when an event should be sent to sentry +// Special fields that sentry uses to give more information to the server +// are extracted from entry.Data (if they are found) +// These fields are: logger, server_name and http_request +func (hook *SentryHook) Fire(entry *logrus.Entry) error { + packet := &raven.Packet{ + Message: entry.Message, + Timestamp: raven.Timestamp(entry.Time), + Level: severityMap[entry.Level], + Platform: "go", + } + + d := entry.Data + + if logger, ok := getAndDel(d, "logger"); ok { + packet.Logger = logger + } + if serverName, ok := getAndDel(d, "server_name"); ok { + packet.ServerName = serverName + } + if req, ok := getAndDelRequest(d, "http_request"); ok { + packet.Interfaces = append(packet.Interfaces, raven.NewHttp(req)) + } + packet.Extra = map[string]interface{}(d) + + _, errCh := hook.client.Capture(packet, nil) + timeout := hook.Timeout + if timeout != 0 { + timeoutCh := time.After(timeout) + select { + case err := <-errCh: + return err + case <-timeoutCh: + return fmt.Errorf("no response from sentry server in %s", timeout) + } + } + return nil +} + +// Levels returns the available logging levels. +func (hook *SentryHook) Levels() []logrus.Level { + return hook.levels +} diff --git a/vendor/github.com/Sirupsen/logrus/hooks/sentry/sentry_test.go b/vendor/github.com/Sirupsen/logrus/hooks/sentry/sentry_test.go new file mode 100644 index 00000000..4a97bc63 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/hooks/sentry/sentry_test.go @@ -0,0 +1,154 @@ +package logrus_sentry + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/http/httptest" + "reflect" + "strings" + "testing" + + "github.com/Sirupsen/logrus" + "github.com/getsentry/raven-go" +) + +const ( + message = "error message" + server_name = "testserver.internal" + logger_name = "test.logger" +) + +func getTestLogger() *logrus.Logger { + l := logrus.New() + l.Out = ioutil.Discard + return l +} + +func WithTestDSN(t *testing.T, tf func(string, <-chan *raven.Packet)) { + pch := make(chan *raven.Packet, 1) + s := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { + defer req.Body.Close() + d := json.NewDecoder(req.Body) + p := &raven.Packet{} + err := d.Decode(p) + if err != nil { + t.Fatal(err.Error()) + } + + pch <- p + })) + defer s.Close() + + fragments := strings.SplitN(s.URL, "://", 2) + dsn := fmt.Sprintf( + "%s://public:secret@%s/sentry/project-id", + fragments[0], + fragments[1], + ) + tf(dsn, pch) +} + +func TestSpecialFields(t *testing.T) { + WithTestDSN(t, func(dsn string, pch <-chan *raven.Packet) { + logger := getTestLogger() + + hook, err := NewSentryHook(dsn, []logrus.Level{ + logrus.ErrorLevel, + }) + + if err != nil { + t.Fatal(err.Error()) + } + logger.Hooks.Add(hook) + + req, _ := http.NewRequest("GET", "url", nil) + logger.WithFields(logrus.Fields{ + "server_name": server_name, + "logger": logger_name, + "http_request": req, + }).Error(message) + + packet := <-pch + if packet.Logger != logger_name { + t.Errorf("logger should have been %s, was %s", logger_name, packet.Logger) + } + + if packet.ServerName != server_name { + t.Errorf("server_name should have been %s, was %s", server_name, packet.ServerName) + } + }) +} + +func TestSentryHandler(t *testing.T) { + WithTestDSN(t, func(dsn string, pch <-chan *raven.Packet) { + logger := getTestLogger() + hook, err := NewSentryHook(dsn, []logrus.Level{ + logrus.ErrorLevel, + }) + if err != nil { + t.Fatal(err.Error()) + } + logger.Hooks.Add(hook) + + logger.Error(message) + packet := <-pch + if packet.Message != message { + t.Errorf("message should have been %s, was %s", message, packet.Message) + } + }) +} + +func TestSentryWithClient(t *testing.T) { + WithTestDSN(t, func(dsn string, pch <-chan *raven.Packet) { + logger := getTestLogger() + + client, _ := raven.New(dsn) + + hook, err := NewWithClientSentryHook(client, []logrus.Level{ + logrus.ErrorLevel, + }) + if err != nil { + t.Fatal(err.Error()) + } + logger.Hooks.Add(hook) + + logger.Error(message) + packet := <-pch + if packet.Message != message { + t.Errorf("message should have been %s, was %s", message, packet.Message) + } + }) +} + +func TestSentryTags(t *testing.T) { + WithTestDSN(t, func(dsn string, pch <-chan *raven.Packet) { + logger := getTestLogger() + tags := map[string]string{ + "site": "test", + } + levels := []logrus.Level{ + logrus.ErrorLevel, + } + + hook, err := NewWithTagsSentryHook(dsn, tags, levels) + if err != nil { + t.Fatal(err.Error()) + } + + logger.Hooks.Add(hook) + + logger.Error(message) + packet := <-pch + expected := raven.Tags{ + raven.Tag{ + Key: "site", + Value: "test", + }, + } + if !reflect.DeepEqual(packet.Tags, expected) { + t.Errorf("message should have been %s, was %s", message, packet.Message) + } + }) +} diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/README.md b/vendor/github.com/Sirupsen/logrus/hooks/syslog/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/README.md rename to vendor/github.com/Sirupsen/logrus/hooks/syslog/README.md diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/syslog.go b/vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog.go similarity index 100% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/syslog.go rename to vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog.go diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go b/vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go rename to vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/json_formatter.go b/vendor/github.com/Sirupsen/logrus/json_formatter.go similarity index 100% rename from Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/json_formatter.go rename to vendor/github.com/Sirupsen/logrus/json_formatter.go diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/json_formatter_test.go b/vendor/github.com/Sirupsen/logrus/json_formatter_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/json_formatter_test.go rename to vendor/github.com/Sirupsen/logrus/json_formatter_test.go diff --git a/vendor/github.com/Sirupsen/logrus/logger.go b/vendor/github.com/Sirupsen/logrus/logger.go new file mode 100644 index 00000000..fd9804c6 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/logger.go @@ -0,0 +1,206 @@ +package logrus + +import ( + "io" + "os" + "sync" +) + +type Logger struct { + // The logs are `io.Copy`'d to this in a mutex. It's common to set this to a + // file, or leave it default which is `os.Stderr`. You can also set this to + // something more adventorous, such as logging to Kafka. + Out io.Writer + // Hooks for the logger instance. These allow firing events based on logging + // levels and log entries. For example, to send errors to an error tracking + // service, log to StatsD or dump the core on fatal errors. + Hooks LevelHooks + // All log entries pass through the formatter before logged to Out. The + // included formatters are `TextFormatter` and `JSONFormatter` for which + // TextFormatter is the default. In development (when a TTY is attached) it + // logs with colors, but to a file it wouldn't. You can easily implement your + // own that implements the `Formatter` interface, see the `README` or included + // formatters for examples. + Formatter Formatter + // The logging level the logger should log at. This is typically (and defaults + // to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be + // logged. `logrus.Debug` is useful in + Level Level + // Used to sync writing to the log. + mu sync.Mutex +} + +// Creates a new logger. Configuration should be set by changing `Formatter`, +// `Out` and `Hooks` directly on the default logger instance. You can also just +// instantiate your own: +// +// var log = &Logger{ +// Out: os.Stderr, +// Formatter: new(JSONFormatter), +// Hooks: make(LevelHooks), +// Level: logrus.DebugLevel, +// } +// +// It's recommended to make this a global instance called `log`. +func New() *Logger { + return &Logger{ + Out: os.Stderr, + Formatter: new(TextFormatter), + Hooks: make(LevelHooks), + Level: InfoLevel, + } +} + +// Adds a field to the log entry, note that you it doesn't log until you call +// Debug, Print, Info, Warn, Fatal or Panic. It only creates a log entry. +// If you want multiple fields, use `WithFields`. +func (logger *Logger) WithField(key string, value interface{}) *Entry { + return NewEntry(logger).WithField(key, value) +} + +// Adds a struct of fields to the log entry. All it does is call `WithField` for +// each `Field`. +func (logger *Logger) WithFields(fields Fields) *Entry { + return NewEntry(logger).WithFields(fields) +} + +func (logger *Logger) Debugf(format string, args ...interface{}) { + if logger.Level >= DebugLevel { + NewEntry(logger).Debugf(format, args...) + } +} + +func (logger *Logger) Infof(format string, args ...interface{}) { + if logger.Level >= InfoLevel { + NewEntry(logger).Infof(format, args...) + } +} + +func (logger *Logger) Printf(format string, args ...interface{}) { + NewEntry(logger).Printf(format, args...) +} + +func (logger *Logger) Warnf(format string, args ...interface{}) { + if logger.Level >= WarnLevel { + NewEntry(logger).Warnf(format, args...) + } +} + +func (logger *Logger) Warningf(format string, args ...interface{}) { + if logger.Level >= WarnLevel { + NewEntry(logger).Warnf(format, args...) + } +} + +func (logger *Logger) Errorf(format string, args ...interface{}) { + if logger.Level >= ErrorLevel { + NewEntry(logger).Errorf(format, args...) + } +} + +func (logger *Logger) Fatalf(format string, args ...interface{}) { + if logger.Level >= FatalLevel { + NewEntry(logger).Fatalf(format, args...) + } + os.Exit(1) +} + +func (logger *Logger) Panicf(format string, args ...interface{}) { + if logger.Level >= PanicLevel { + NewEntry(logger).Panicf(format, args...) + } +} + +func (logger *Logger) Debug(args ...interface{}) { + if logger.Level >= DebugLevel { + NewEntry(logger).Debug(args...) + } +} + +func (logger *Logger) Info(args ...interface{}) { + if logger.Level >= InfoLevel { + NewEntry(logger).Info(args...) + } +} + +func (logger *Logger) Print(args ...interface{}) { + NewEntry(logger).Info(args...) +} + +func (logger *Logger) Warn(args ...interface{}) { + if logger.Level >= WarnLevel { + NewEntry(logger).Warn(args...) + } +} + +func (logger *Logger) Warning(args ...interface{}) { + if logger.Level >= WarnLevel { + NewEntry(logger).Warn(args...) + } +} + +func (logger *Logger) Error(args ...interface{}) { + if logger.Level >= ErrorLevel { + NewEntry(logger).Error(args...) + } +} + +func (logger *Logger) Fatal(args ...interface{}) { + if logger.Level >= FatalLevel { + NewEntry(logger).Fatal(args...) + } + os.Exit(1) +} + +func (logger *Logger) Panic(args ...interface{}) { + if logger.Level >= PanicLevel { + NewEntry(logger).Panic(args...) + } +} + +func (logger *Logger) Debugln(args ...interface{}) { + if logger.Level >= DebugLevel { + NewEntry(logger).Debugln(args...) + } +} + +func (logger *Logger) Infoln(args ...interface{}) { + if logger.Level >= InfoLevel { + NewEntry(logger).Infoln(args...) + } +} + +func (logger *Logger) Println(args ...interface{}) { + NewEntry(logger).Println(args...) +} + +func (logger *Logger) Warnln(args ...interface{}) { + if logger.Level >= WarnLevel { + NewEntry(logger).Warnln(args...) + } +} + +func (logger *Logger) Warningln(args ...interface{}) { + if logger.Level >= WarnLevel { + NewEntry(logger).Warnln(args...) + } +} + +func (logger *Logger) Errorln(args ...interface{}) { + if logger.Level >= ErrorLevel { + NewEntry(logger).Errorln(args...) + } +} + +func (logger *Logger) Fatalln(args ...interface{}) { + if logger.Level >= FatalLevel { + NewEntry(logger).Fatalln(args...) + } + os.Exit(1) +} + +func (logger *Logger) Panicln(args ...interface{}) { + if logger.Level >= PanicLevel { + NewEntry(logger).Panicln(args...) + } +} diff --git a/vendor/github.com/Sirupsen/logrus/logrus.go b/vendor/github.com/Sirupsen/logrus/logrus.go new file mode 100644 index 00000000..0c09fbc2 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/logrus.go @@ -0,0 +1,98 @@ +package logrus + +import ( + "fmt" + "log" +) + +// Fields type, used to pass to `WithFields`. +type Fields map[string]interface{} + +// Level type +type Level uint8 + +// Convert the Level to a string. E.g. PanicLevel becomes "panic". +func (level Level) String() string { + switch level { + case DebugLevel: + return "debug" + case InfoLevel: + return "info" + case WarnLevel: + return "warning" + case ErrorLevel: + return "error" + case FatalLevel: + return "fatal" + case PanicLevel: + return "panic" + } + + return "unknown" +} + +// ParseLevel takes a string level and returns the Logrus log level constant. +func ParseLevel(lvl string) (Level, error) { + switch lvl { + case "panic": + return PanicLevel, nil + case "fatal": + return FatalLevel, nil + case "error": + return ErrorLevel, nil + case "warn", "warning": + return WarnLevel, nil + case "info": + return InfoLevel, nil + case "debug": + return DebugLevel, nil + } + + var l Level + return l, fmt.Errorf("not a valid logrus Level: %q", lvl) +} + +// These are the different logging levels. You can set the logging level to log +// on your instance of logger, obtained with `logrus.New()`. +const ( + // PanicLevel level, highest level of severity. Logs and then calls panic with the + // message passed to Debug, Info, ... + PanicLevel Level = iota + // FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the + // logging level is set to Panic. + FatalLevel + // ErrorLevel level. Logs. Used for errors that should definitely be noted. + // Commonly used for hooks to send errors to an error tracking service. + ErrorLevel + // WarnLevel level. Non-critical entries that deserve eyes. + WarnLevel + // InfoLevel level. General operational entries about what's going on inside the + // application. + InfoLevel + // DebugLevel level. Usually only enabled when debugging. Very verbose logging. + DebugLevel +) + +// Won't compile if StdLogger can't be realized by a log.Logger +var ( + _ StdLogger = &log.Logger{} + _ StdLogger = &Entry{} + _ StdLogger = &Logger{} +) + +// StdLogger is what your logrus-enabled library should take, that way +// it'll accept a stdlib logger and a logrus logger. There's no standard +// interface, this is the closest we get, unfortunately. +type StdLogger interface { + Print(...interface{}) + Printf(string, ...interface{}) + Println(...interface{}) + + Fatal(...interface{}) + Fatalf(string, ...interface{}) + Fatalln(...interface{}) + + Panic(...interface{}) + Panicf(string, ...interface{}) + Panicln(...interface{}) +} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/logrus_test.go b/vendor/github.com/Sirupsen/logrus/logrus_test.go similarity index 98% rename from Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/logrus_test.go rename to vendor/github.com/Sirupsen/logrus/logrus_test.go index 955d3012..efaacea2 100644 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/logrus_test.go +++ b/vendor/github.com/Sirupsen/logrus/logrus_test.go @@ -8,7 +8,7 @@ import ( "sync" "testing" - "github.com/fsouza/go-dockerclient/vendor/github.com/stretchr/testify/assert" + "github.com/stretchr/testify/assert" ) func LogAndAssertJSON(t *testing.T, log func(*Logger), assertions func(fields Fields)) { diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_openbsd.go b/vendor/github.com/Sirupsen/logrus/terminal_bsd.go similarity index 68% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_openbsd.go rename to vendor/github.com/Sirupsen/logrus/terminal_bsd.go index d238bfa0..71f8d67a 100644 --- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_openbsd.go +++ b/vendor/github.com/Sirupsen/logrus/terminal_bsd.go @@ -1,3 +1,4 @@ +// +build darwin freebsd openbsd netbsd dragonfly package logrus diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_linux.go b/vendor/github.com/Sirupsen/logrus/terminal_linux.go similarity index 100% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_linux.go rename to vendor/github.com/Sirupsen/logrus/terminal_linux.go diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go b/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go similarity index 90% rename from Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go rename to vendor/github.com/Sirupsen/logrus/terminal_notwindows.go index b8bebc13..4bb53760 100644 --- a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go +++ b/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go @@ -3,7 +3,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build linux darwin freebsd openbsd +// +build linux darwin freebsd openbsd netbsd dragonfly package logrus diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_windows.go b/vendor/github.com/Sirupsen/logrus/terminal_windows.go similarity index 100% rename from Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_windows.go rename to vendor/github.com/Sirupsen/logrus/terminal_windows.go diff --git a/vendor/github.com/Sirupsen/logrus/text_formatter.go b/vendor/github.com/Sirupsen/logrus/text_formatter.go new file mode 100644 index 00000000..17cc2984 --- /dev/null +++ b/vendor/github.com/Sirupsen/logrus/text_formatter.go @@ -0,0 +1,159 @@ +package logrus + +import ( + "bytes" + "fmt" + "runtime" + "sort" + "strings" + "time" +) + +const ( + nocolor = 0 + red = 31 + green = 32 + yellow = 33 + blue = 34 + gray = 37 +) + +var ( + baseTimestamp time.Time + isTerminal bool +) + +func init() { + baseTimestamp = time.Now() + isTerminal = IsTerminal() +} + +func miniTS() int { + return int(time.Since(baseTimestamp) / time.Second) +} + +type TextFormatter struct { + // Set to true to bypass checking for a TTY before outputting colors. + ForceColors bool + + // Force disabling colors. + DisableColors bool + + // Disable timestamp logging. useful when output is redirected to logging + // system that already adds timestamps. + DisableTimestamp bool + + // Enable logging the full timestamp when a TTY is attached instead of just + // the time passed since beginning of execution. + FullTimestamp bool + + // TimestampFormat to use for display when a full timestamp is printed + TimestampFormat string + + // The fields are sorted by default for a consistent output. For applications + // that log extremely frequently and don't use the JSON formatter this may not + // be desired. + DisableSorting bool +} + +func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { + var keys []string = make([]string, 0, len(entry.Data)) + for k := range entry.Data { + keys = append(keys, k) + } + + if !f.DisableSorting { + sort.Strings(keys) + } + + b := &bytes.Buffer{} + + prefixFieldClashes(entry.Data) + + isColorTerminal := isTerminal && (runtime.GOOS != "windows") + isColored := (f.ForceColors || isColorTerminal) && !f.DisableColors + + timestampFormat := f.TimestampFormat + if timestampFormat == "" { + timestampFormat = DefaultTimestampFormat + } + if isColored { + f.printColored(b, entry, keys, timestampFormat) + } else { + if !f.DisableTimestamp { + f.appendKeyValue(b, "time", entry.Time.Format(timestampFormat)) + } + f.appendKeyValue(b, "level", entry.Level.String()) + f.appendKeyValue(b, "msg", entry.Message) + for _, key := range keys { + f.appendKeyValue(b, key, entry.Data[key]) + } + } + + b.WriteByte('\n') + return b.Bytes(), nil +} + +func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) { + var levelColor int + switch entry.Level { + case DebugLevel: + levelColor = gray + case WarnLevel: + levelColor = yellow + case ErrorLevel, FatalLevel, PanicLevel: + levelColor = red + default: + levelColor = blue + } + + levelText := strings.ToUpper(entry.Level.String())[0:4] + + if !f.FullTimestamp { + fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, miniTS(), entry.Message) + } else { + fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message) + } + for _, k := range keys { + v := entry.Data[k] + fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=%+v", levelColor, k, v) + } +} + +func needsQuoting(text string) bool { + for _, ch := range text { + if !((ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z') || + (ch >= '0' && ch <= '9') || + ch == '-' || ch == '.') { + return false + } + } + return true +} + +func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) { + + b.WriteString(key) + b.WriteByte('=') + + switch value := value.(type) { + case string: + if needsQuoting(value) { + b.WriteString(value) + } else { + fmt.Fprintf(b, "%q", value) + } + case error: + errmsg := value.Error() + if needsQuoting(errmsg) { + b.WriteString(errmsg) + } else { + fmt.Fprintf(b, "%q", value) + } + default: + fmt.Fprint(b, value) + } + + b.WriteByte(' ') +} diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/text_formatter_test.go b/vendor/github.com/Sirupsen/logrus/text_formatter_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/text_formatter_test.go rename to vendor/github.com/Sirupsen/logrus/text_formatter_test.go diff --git a/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/writer.go b/vendor/github.com/Sirupsen/logrus/writer.go similarity index 100% rename from Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/Sirupsen/logrus/writer.go rename to vendor/github.com/Sirupsen/logrus/writer.go diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/.gitignore b/vendor/github.com/cloudfoundry-incubator/candiedyaml/.gitignore new file mode 100644 index 00000000..78237789 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/.gitignore @@ -0,0 +1 @@ +*.coverprofile diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/.travis.yml b/vendor/github.com/cloudfoundry-incubator/candiedyaml/.travis.yml new file mode 100644 index 00000000..b39955e5 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/.travis.yml @@ -0,0 +1,12 @@ +language: go + +go: + - 1.4.1 + +install: + - go get -t -v ./... + - go install github.com/onsi/ginkgo/ginkgo + +script: + - export PATH=$HOME/gopath/bin:$PATH + - ginkgo -r -failOnPending -randomizeAllSpecs -race diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/LICENSE b/vendor/github.com/cloudfoundry-incubator/candiedyaml/LICENSE new file mode 100644 index 00000000..f4f87bd4 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/LICENSE @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + \ No newline at end of file diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/README.md b/vendor/github.com/cloudfoundry-incubator/candiedyaml/README.md new file mode 100644 index 00000000..4979e590 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/README.md @@ -0,0 +1,55 @@ +[![Build Status](https://travis-ci.org/cloudfoundry-incubator/candiedyaml.svg)](https://travis-ci.org/cloudfoundry-incubator/candiedyaml) + +candiedyaml +=========== + +YAML for Go + +A YAML 1.1 parser with support for YAML 1.2 features + +Usage +----- + +```go +package myApp + +import ( + "github.com/cloudfoundry-incubator/candiedyaml" + "fmt" + "os" +) + +func main() { + file, err := os.Open("path/to/some/file.yml") + if err != nil { + println("File does not exist:", err.Error()) + os.Exit(1) + } + + document := new(interface{}) + decoder := candiedyaml.NewDecoder(file) + err = decoder.Decode(document) + + if err != nil { + println("Failed to decode document:", err.Error()) + } + + println("parsed yml into interface:", fmt.Sprintf("%#v", document)) + + fileToWrite, err := os.Create("path/to/some/new/file.yml") + if err != nil { + println("Failed to open file for writing:", err.Error()) + os.Exit(1) + } + + encoder := candiedyaml.NewEncoder(fileToWrite) + err = encoder.Encode(document) + + if err != nil { + println("Failed to encode document:", err.Error()) + os.Exit(1) + } + + return +} +``` diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/api.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/api.go new file mode 100644 index 00000000..87c1043e --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/api.go @@ -0,0 +1,834 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "io" +) + +/* + * Create a new parser object. + */ + +func yaml_parser_initialize(parser *yaml_parser_t) bool { + *parser = yaml_parser_t{ + raw_buffer: make([]byte, 0, INPUT_RAW_BUFFER_SIZE), + buffer: make([]byte, 0, INPUT_BUFFER_SIZE), + } + + return true +} + +/* + * Destroy a parser object. + */ +func yaml_parser_delete(parser *yaml_parser_t) { + *parser = yaml_parser_t{} +} + +/* + * String read handler. + */ + +func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (int, error) { + if parser.input_pos == len(parser.input) { + return 0, io.EOF + } + + n := copy(buffer, parser.input[parser.input_pos:]) + parser.input_pos += n + return n, nil +} + +/* + * File read handler. + */ + +func yaml_file_read_handler(parser *yaml_parser_t, buffer []byte) (int, error) { + return parser.input_reader.Read(buffer) +} + +/* + * Set a string input. + */ + +func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) { + if parser.read_handler != nil { + panic("input already set") + } + + parser.read_handler = yaml_string_read_handler + + parser.input = input + parser.input_pos = 0 +} + +/* + * Set a reader input + */ +func yaml_parser_set_input_reader(parser *yaml_parser_t, reader io.Reader) { + if parser.read_handler != nil { + panic("input already set") + } + + parser.read_handler = yaml_file_read_handler + parser.input_reader = reader +} + +/* + * Set a generic input. + */ + +func yaml_parser_set_input(parser *yaml_parser_t, handler yaml_read_handler_t) { + if parser.read_handler != nil { + panic("input already set") + } + + parser.read_handler = handler +} + +/* + * Set the source encoding. + */ + +func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) { + if parser.encoding != yaml_ANY_ENCODING { + panic("encoding already set") + } + + parser.encoding = encoding +} + +/* + * Create a new emitter object. + */ + +func yaml_emitter_initialize(emitter *yaml_emitter_t) { + *emitter = yaml_emitter_t{ + buffer: make([]byte, OUTPUT_BUFFER_SIZE), + raw_buffer: make([]byte, 0, OUTPUT_RAW_BUFFER_SIZE), + states: make([]yaml_emitter_state_t, 0, INITIAL_STACK_SIZE), + events: make([]yaml_event_t, 0, INITIAL_QUEUE_SIZE), + } +} + +func yaml_emitter_delete(emitter *yaml_emitter_t) { + *emitter = yaml_emitter_t{} +} + +/* + * String write handler. + */ + +func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error { + *emitter.output_buffer = append(*emitter.output_buffer, buffer...) + return nil +} + +/* + * File write handler. + */ + +func yaml_writer_write_handler(emitter *yaml_emitter_t, buffer []byte) error { + _, err := emitter.output_writer.Write(buffer) + return err +} + +/* + * Set a string output. + */ + +func yaml_emitter_set_output_string(emitter *yaml_emitter_t, buffer *[]byte) { + if emitter.write_handler != nil { + panic("output already set") + } + + emitter.write_handler = yaml_string_write_handler + emitter.output_buffer = buffer +} + +/* + * Set a file output. + */ + +func yaml_emitter_set_output_writer(emitter *yaml_emitter_t, w io.Writer) { + if emitter.write_handler != nil { + panic("output already set") + } + + emitter.write_handler = yaml_writer_write_handler + emitter.output_writer = w +} + +/* + * Set a generic output handler. + */ + +func yaml_emitter_set_output(emitter *yaml_emitter_t, handler yaml_write_handler_t) { + if emitter.write_handler != nil { + panic("output already set") + } + + emitter.write_handler = handler +} + +/* + * Set the output encoding. + */ + +func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_encoding_t) { + if emitter.encoding != yaml_ANY_ENCODING { + panic("encoding already set") + } + + emitter.encoding = encoding +} + +/* + * Set the canonical output style. + */ + +func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { + emitter.canonical = canonical +} + +/* + * Set the indentation increment. + */ + +func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { + if indent < 2 || indent > 9 { + indent = 2 + } + emitter.best_indent = indent +} + +/* + * Set the preferred line width. + */ + +func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) { + if width < 0 { + width = -1 + } + emitter.best_width = width +} + +/* + * Set if unescaped non-ASCII characters are allowed. + */ + +func yaml_emitter_set_unicode(emitter *yaml_emitter_t, unicode bool) { + emitter.unicode = unicode +} + +/* + * Set the preferred line break character. + */ + +func yaml_emitter_set_break(emitter *yaml_emitter_t, line_break yaml_break_t) { + emitter.line_break = line_break +} + +/* + * Destroy a token object. + */ + +// yaml_DECLARE(void) +// yaml_token_delete(yaml_token_t *token) +// { +// assert(token); /* Non-NULL token object expected. */ +// +// switch (token.type) +// { +// case yaml_TAG_DIRECTIVE_TOKEN: +// yaml_free(token.data.tag_directive.handle); +// yaml_free(token.data.tag_directive.prefix); +// break; +// +// case yaml_ALIAS_TOKEN: +// yaml_free(token.data.alias.value); +// break; +// +// case yaml_ANCHOR_TOKEN: +// yaml_free(token.data.anchor.value); +// break; +// +// case yaml_TAG_TOKEN: +// yaml_free(token.data.tag.handle); +// yaml_free(token.data.tag.suffix); +// break; +// +// case yaml_SCALAR_TOKEN: +// yaml_free(token.data.scalar.value); +// break; +// +// default: +// break; +// } +// +// memset(token, 0, sizeof(yaml_token_t)); +// } + +/* + * Check if a string is a valid UTF-8 sequence. + * + * Check 'reader.c' for more details on UTF-8 encoding. + */ + +// static int +// yaml_check_utf8(yaml_char_t *start, size_t length) +// { +// yaml_char_t *end = start+length; +// yaml_char_t *pointer = start; +// +// while (pointer < end) { +// unsigned char octet; +// unsigned int width; +// unsigned int value; +// size_t k; +// +// octet = pointer[0]; +// width = (octet & 0x80) == 0x00 ? 1 : +// (octet & 0xE0) == 0xC0 ? 2 : +// (octet & 0xF0) == 0xE0 ? 3 : +// (octet & 0xF8) == 0xF0 ? 4 : 0; +// value = (octet & 0x80) == 0x00 ? octet & 0x7F : +// (octet & 0xE0) == 0xC0 ? octet & 0x1F : +// (octet & 0xF0) == 0xE0 ? octet & 0x0F : +// (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0; +// if (!width) return 0; +// if (pointer+width > end) return 0; +// for (k = 1; k < width; k ++) { +// octet = pointer[k]; +// if ((octet & 0xC0) != 0x80) return 0; +// value = (value << 6) + (octet & 0x3F); +// } +// if (!((width == 1) || +// (width == 2 && value >= 0x80) || +// (width == 3 && value >= 0x800) || +// (width == 4 && value >= 0x10000))) return 0; +// +// pointer += width; +// } +// +// return 1; +// } + +/* + * Create STREAM-START. + */ + +func yaml_stream_start_event_initialize(event *yaml_event_t, encoding yaml_encoding_t) { + *event = yaml_event_t{ + event_type: yaml_STREAM_START_EVENT, + encoding: encoding, + } +} + +/* + * Create STREAM-END. + */ + +func yaml_stream_end_event_initialize(event *yaml_event_t) { + *event = yaml_event_t{ + event_type: yaml_STREAM_END_EVENT, + } +} + +/* + * Create DOCUMENT-START. + */ + +func yaml_document_start_event_initialize(event *yaml_event_t, + version_directive *yaml_version_directive_t, + tag_directives []yaml_tag_directive_t, + implicit bool) { + *event = yaml_event_t{ + event_type: yaml_DOCUMENT_START_EVENT, + version_directive: version_directive, + tag_directives: tag_directives, + implicit: implicit, + } +} + +/* + * Create DOCUMENT-END. + */ + +func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) { + *event = yaml_event_t{ + event_type: yaml_DOCUMENT_END_EVENT, + implicit: implicit, + } +} + +/* + * Create ALIAS. + */ + +func yaml_alias_event_initialize(event *yaml_event_t, anchor []byte) { + *event = yaml_event_t{ + event_type: yaml_ALIAS_EVENT, + anchor: anchor, + } +} + +/* + * Create SCALAR. + */ + +func yaml_scalar_event_initialize(event *yaml_event_t, + anchor []byte, tag []byte, + value []byte, + plain_implicit bool, quoted_implicit bool, + style yaml_scalar_style_t) { + + *event = yaml_event_t{ + event_type: yaml_SCALAR_EVENT, + anchor: anchor, + tag: tag, + value: value, + implicit: plain_implicit, + quoted_implicit: quoted_implicit, + style: yaml_style_t(style), + } +} + +/* + * Create SEQUENCE-START. + */ + +func yaml_sequence_start_event_initialize(event *yaml_event_t, + anchor []byte, tag []byte, implicit bool, style yaml_sequence_style_t) { + *event = yaml_event_t{ + event_type: yaml_SEQUENCE_START_EVENT, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(style), + } +} + +/* + * Create SEQUENCE-END. + */ + +func yaml_sequence_end_event_initialize(event *yaml_event_t) { + *event = yaml_event_t{ + event_type: yaml_SEQUENCE_END_EVENT, + } +} + +/* + * Create MAPPING-START. + */ + +func yaml_mapping_start_event_initialize(event *yaml_event_t, + anchor []byte, tag []byte, implicit bool, style yaml_mapping_style_t) { + *event = yaml_event_t{ + event_type: yaml_MAPPING_START_EVENT, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(style), + } +} + +/* + * Create MAPPING-END. + */ + +func yaml_mapping_end_event_initialize(event *yaml_event_t) { + *event = yaml_event_t{ + event_type: yaml_MAPPING_END_EVENT, + } +} + +/* + * Destroy an event object. + */ + +func yaml_event_delete(event *yaml_event_t) { + *event = yaml_event_t{} +} + +// /* +// * Create a document object. +// */ +// +// func yaml_document_initialize(document *yaml_document_t, +// version_directive *yaml_version_directive_t, +// tag_directives []yaml_tag_directive_t, +// start_implicit, end_implicit bool) bool { +// +// +// { +// struct { +// YAML_error_type_t error; +// } context; +// struct { +// yaml_node_t *start; +// yaml_node_t *end; +// yaml_node_t *top; +// } nodes = { NULL, NULL, NULL }; +// yaml_version_directive_t *version_directive_copy = NULL; +// struct { +// yaml_tag_directive_t *start; +// yaml_tag_directive_t *end; +// yaml_tag_directive_t *top; +// } tag_directives_copy = { NULL, NULL, NULL }; +// yaml_tag_directive_t value = { NULL, NULL }; +// YAML_mark_t mark = { 0, 0, 0 }; +// +// assert(document); /* Non-NULL document object is expected. */ +// assert((tag_directives_start && tag_directives_end) || +// (tag_directives_start == tag_directives_end)); +// /* Valid tag directives are expected. */ +// +// if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error; +// +// if (version_directive) { +// version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t)); +// if (!version_directive_copy) goto error; +// version_directive_copy.major = version_directive.major; +// version_directive_copy.minor = version_directive.minor; +// } +// +// if (tag_directives_start != tag_directives_end) { +// yaml_tag_directive_t *tag_directive; +// if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE)) +// goto error; +// for (tag_directive = tag_directives_start; +// tag_directive != tag_directives_end; tag_directive ++) { +// assert(tag_directive.handle); +// assert(tag_directive.prefix); +// if (!yaml_check_utf8(tag_directive.handle, +// strlen((char *)tag_directive.handle))) +// goto error; +// if (!yaml_check_utf8(tag_directive.prefix, +// strlen((char *)tag_directive.prefix))) +// goto error; +// value.handle = yaml_strdup(tag_directive.handle); +// value.prefix = yaml_strdup(tag_directive.prefix); +// if (!value.handle || !value.prefix) goto error; +// if (!PUSH(&context, tag_directives_copy, value)) +// goto error; +// value.handle = NULL; +// value.prefix = NULL; +// } +// } +// +// DOCUMENT_INIT(*document, nodes.start, nodes.end, version_directive_copy, +// tag_directives_copy.start, tag_directives_copy.top, +// start_implicit, end_implicit, mark, mark); +// +// return 1; +// +// error: +// STACK_DEL(&context, nodes); +// yaml_free(version_directive_copy); +// while (!STACK_EMPTY(&context, tag_directives_copy)) { +// yaml_tag_directive_t value = POP(&context, tag_directives_copy); +// yaml_free(value.handle); +// yaml_free(value.prefix); +// } +// STACK_DEL(&context, tag_directives_copy); +// yaml_free(value.handle); +// yaml_free(value.prefix); +// +// return 0; +// } +// +// /* +// * Destroy a document object. +// */ +// +// yaml_DECLARE(void) +// yaml_document_delete(document *yaml_document_t) +// { +// struct { +// YAML_error_type_t error; +// } context; +// yaml_tag_directive_t *tag_directive; +// +// context.error = yaml_NO_ERROR; /* Eliminate a compliler warning. */ +// +// assert(document); /* Non-NULL document object is expected. */ +// +// while (!STACK_EMPTY(&context, document.nodes)) { +// yaml_node_t node = POP(&context, document.nodes); +// yaml_free(node.tag); +// switch (node.type) { +// case yaml_SCALAR_NODE: +// yaml_free(node.data.scalar.value); +// break; +// case yaml_SEQUENCE_NODE: +// STACK_DEL(&context, node.data.sequence.items); +// break; +// case yaml_MAPPING_NODE: +// STACK_DEL(&context, node.data.mapping.pairs); +// break; +// default: +// assert(0); /* Should not happen. */ +// } +// } +// STACK_DEL(&context, document.nodes); +// +// yaml_free(document.version_directive); +// for (tag_directive = document.tag_directives.start; +// tag_directive != document.tag_directives.end; +// tag_directive++) { +// yaml_free(tag_directive.handle); +// yaml_free(tag_directive.prefix); +// } +// yaml_free(document.tag_directives.start); +// +// memset(document, 0, sizeof(yaml_document_t)); +// } +// +// /** +// * Get a document node. +// */ +// +// yaml_DECLARE(yaml_node_t *) +// yaml_document_get_node(document *yaml_document_t, int index) +// { +// assert(document); /* Non-NULL document object is expected. */ +// +// if (index > 0 && document.nodes.start + index <= document.nodes.top) { +// return document.nodes.start + index - 1; +// } +// return NULL; +// } +// +// /** +// * Get the root object. +// */ +// +// yaml_DECLARE(yaml_node_t *) +// yaml_document_get_root_node(document *yaml_document_t) +// { +// assert(document); /* Non-NULL document object is expected. */ +// +// if (document.nodes.top != document.nodes.start) { +// return document.nodes.start; +// } +// return NULL; +// } +// +// /* +// * Add a scalar node to a document. +// */ +// +// yaml_DECLARE(int) +// yaml_document_add_scalar(document *yaml_document_t, +// yaml_char_t *tag, yaml_char_t *value, int length, +// yaml_scalar_style_t style) +// { +// struct { +// YAML_error_type_t error; +// } context; +// YAML_mark_t mark = { 0, 0, 0 }; +// yaml_char_t *tag_copy = NULL; +// yaml_char_t *value_copy = NULL; +// yaml_node_t node; +// +// assert(document); /* Non-NULL document object is expected. */ +// assert(value); /* Non-NULL value is expected. */ +// +// if (!tag) { +// tag = (yaml_char_t *)yaml_DEFAULT_SCALAR_TAG; +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error; +// tag_copy = yaml_strdup(tag); +// if (!tag_copy) goto error; +// +// if (length < 0) { +// length = strlen((char *)value); +// } +// +// if (!yaml_check_utf8(value, length)) goto error; +// value_copy = yaml_malloc(length+1); +// if (!value_copy) goto error; +// memcpy(value_copy, value, length); +// value_copy[length] = '\0'; +// +// SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark); +// if (!PUSH(&context, document.nodes, node)) goto error; +// +// return document.nodes.top - document.nodes.start; +// +// error: +// yaml_free(tag_copy); +// yaml_free(value_copy); +// +// return 0; +// } +// +// /* +// * Add a sequence node to a document. +// */ +// +// yaml_DECLARE(int) +// yaml_document_add_sequence(document *yaml_document_t, +// yaml_char_t *tag, yaml_sequence_style_t style) +// { +// struct { +// YAML_error_type_t error; +// } context; +// YAML_mark_t mark = { 0, 0, 0 }; +// yaml_char_t *tag_copy = NULL; +// struct { +// yaml_node_item_t *start; +// yaml_node_item_t *end; +// yaml_node_item_t *top; +// } items = { NULL, NULL, NULL }; +// yaml_node_t node; +// +// assert(document); /* Non-NULL document object is expected. */ +// +// if (!tag) { +// tag = (yaml_char_t *)yaml_DEFAULT_SEQUENCE_TAG; +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error; +// tag_copy = yaml_strdup(tag); +// if (!tag_copy) goto error; +// +// if (!STACK_INIT(&context, items, INITIAL_STACK_SIZE)) goto error; +// +// SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end, +// style, mark, mark); +// if (!PUSH(&context, document.nodes, node)) goto error; +// +// return document.nodes.top - document.nodes.start; +// +// error: +// STACK_DEL(&context, items); +// yaml_free(tag_copy); +// +// return 0; +// } +// +// /* +// * Add a mapping node to a document. +// */ +// +// yaml_DECLARE(int) +// yaml_document_add_mapping(document *yaml_document_t, +// yaml_char_t *tag, yaml_mapping_style_t style) +// { +// struct { +// YAML_error_type_t error; +// } context; +// YAML_mark_t mark = { 0, 0, 0 }; +// yaml_char_t *tag_copy = NULL; +// struct { +// yaml_node_pair_t *start; +// yaml_node_pair_t *end; +// yaml_node_pair_t *top; +// } pairs = { NULL, NULL, NULL }; +// yaml_node_t node; +// +// assert(document); /* Non-NULL document object is expected. */ +// +// if (!tag) { +// tag = (yaml_char_t *)yaml_DEFAULT_MAPPING_TAG; +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error; +// tag_copy = yaml_strdup(tag); +// if (!tag_copy) goto error; +// +// if (!STACK_INIT(&context, pairs, INITIAL_STACK_SIZE)) goto error; +// +// MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end, +// style, mark, mark); +// if (!PUSH(&context, document.nodes, node)) goto error; +// +// return document.nodes.top - document.nodes.start; +// +// error: +// STACK_DEL(&context, pairs); +// yaml_free(tag_copy); +// +// return 0; +// } +// +// /* +// * Append an item to a sequence node. +// */ +// +// yaml_DECLARE(int) +// yaml_document_append_sequence_item(document *yaml_document_t, +// int sequence, int item) +// { +// struct { +// YAML_error_type_t error; +// } context; +// +// assert(document); /* Non-NULL document is required. */ +// assert(sequence > 0 +// && document.nodes.start + sequence <= document.nodes.top); +// /* Valid sequence id is required. */ +// assert(document.nodes.start[sequence-1].type == yaml_SEQUENCE_NODE); +// /* A sequence node is required. */ +// assert(item > 0 && document.nodes.start + item <= document.nodes.top); +// /* Valid item id is required. */ +// +// if (!PUSH(&context, +// document.nodes.start[sequence-1].data.sequence.items, item)) +// return 0; +// +// return 1; +// } +// +// /* +// * Append a pair of a key and a value to a mapping node. +// */ +// +// yaml_DECLARE(int) +// yaml_document_append_mapping_pair(document *yaml_document_t, +// int mapping, int key, int value) +// { +// struct { +// YAML_error_type_t error; +// } context; +// +// yaml_node_pair_t pair; +// +// assert(document); /* Non-NULL document is required. */ +// assert(mapping > 0 +// && document.nodes.start + mapping <= document.nodes.top); +// /* Valid mapping id is required. */ +// assert(document.nodes.start[mapping-1].type == yaml_MAPPING_NODE); +// /* A mapping node is required. */ +// assert(key > 0 && document.nodes.start + key <= document.nodes.top); +// /* Valid key id is required. */ +// assert(value > 0 && document.nodes.start + value <= document.nodes.top); +// /* Valid value id is required. */ +// +// pair.key = key; +// pair.value = value; +// +// if (!PUSH(&context, +// document.nodes.start[mapping-1].data.mapping.pairs, pair)) +// return 0; +// +// return 1; +// } +// diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/candiedyaml_suite_test.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/candiedyaml_suite_test.go new file mode 100644 index 00000000..0b97fe94 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/candiedyaml_suite_test.go @@ -0,0 +1,27 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestCandiedyaml(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Candiedyaml Suite") +} diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/decode.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/decode.go new file mode 100644 index 00000000..3cb5d735 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/decode.go @@ -0,0 +1,622 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "bytes" + "errors" + "fmt" + "io" + "reflect" + "runtime" + "strconv" + "strings" +) + +type Unmarshaler interface { + UnmarshalYAML(tag string, value interface{}) error +} + +// A Number represents a JSON number literal. +type Number string + +// String returns the literal text of the number. +func (n Number) String() string { return string(n) } + +// Float64 returns the number as a float64. +func (n Number) Float64() (float64, error) { + return strconv.ParseFloat(string(n), 64) +} + +// Int64 returns the number as an int64. +func (n Number) Int64() (int64, error) { + return strconv.ParseInt(string(n), 10, 64) +} + +type Decoder struct { + parser yaml_parser_t + event yaml_event_t + replay_events []yaml_event_t + useNumber bool + + anchors map[string][]yaml_event_t + tracking_anchors [][]yaml_event_t +} + +type ParserError struct { + ErrorType YAML_error_type_t + Context string + ContextMark YAML_mark_t + Problem string + ProblemMark YAML_mark_t +} + +func (e *ParserError) Error() string { + return fmt.Sprintf("yaml: [%s] %s at line %d, column %d", e.Context, e.Problem, e.ProblemMark.line+1, e.ProblemMark.column+1) +} + +type UnexpectedEventError struct { + Value string + EventType yaml_event_type_t + At YAML_mark_t +} + +func (e *UnexpectedEventError) Error() string { + return fmt.Sprintf("yaml: Unexpect event [%d]: '%s' at line %d, column %d", e.EventType, e.Value, e.At.line+1, e.At.column+1) +} + +func recovery(err *error) { + if r := recover(); r != nil { + if _, ok := r.(runtime.Error); ok { + panic(r) + } + + var tmpError error + switch r := r.(type) { + case error: + tmpError = r + case string: + tmpError = errors.New(r) + default: + tmpError = errors.New("Unknown panic: " + reflect.ValueOf(r).String()) + } + + *err = tmpError + } +} + +func Unmarshal(data []byte, v interface{}) error { + d := NewDecoder(bytes.NewBuffer(data)) + return d.Decode(v) +} + +func NewDecoder(r io.Reader) *Decoder { + d := &Decoder{ + anchors: make(map[string][]yaml_event_t), + tracking_anchors: make([][]yaml_event_t, 1), + } + yaml_parser_initialize(&d.parser) + yaml_parser_set_input_reader(&d.parser, r) + return d +} + +func (d *Decoder) Decode(v interface{}) (err error) { + defer recovery(&err) + + rv := reflect.ValueOf(v) + if rv.Kind() != reflect.Ptr || rv.IsNil() { + return fmt.Errorf("Expected a pointer or nil but was a %s at %s", rv.String(), d.event.start_mark) + } + + if d.event.event_type == yaml_NO_EVENT { + d.nextEvent() + + if d.event.event_type != yaml_STREAM_START_EVENT { + return errors.New("Invalid stream") + } + + d.nextEvent() + } + + d.document(rv) + return nil +} + +func (d *Decoder) UseNumber() { d.useNumber = true } + +func (d *Decoder) error(err error) { + panic(err) +} + +func (d *Decoder) nextEvent() { + if d.event.event_type == yaml_STREAM_END_EVENT { + d.error(errors.New("The stream is closed")) + } + + if d.replay_events != nil { + d.event = d.replay_events[0] + if len(d.replay_events) == 1 { + d.replay_events = nil + } else { + d.replay_events = d.replay_events[1:] + } + } else { + if !yaml_parser_parse(&d.parser, &d.event) { + yaml_event_delete(&d.event) + + d.error(&ParserError{ + ErrorType: d.parser.error, + Context: d.parser.context, + ContextMark: d.parser.context_mark, + Problem: d.parser.problem, + ProblemMark: d.parser.problem_mark, + }) + } + } + + last := len(d.tracking_anchors) + // skip aliases when tracking an anchor + if last > 0 && d.event.event_type != yaml_ALIAS_EVENT { + d.tracking_anchors[last-1] = append(d.tracking_anchors[last-1], d.event) + } +} + +func (d *Decoder) document(rv reflect.Value) { + if d.event.event_type != yaml_DOCUMENT_START_EVENT { + d.error(fmt.Errorf("Expected document start at %s", d.event.start_mark)) + } + + d.nextEvent() + d.parse(rv) + + if d.event.event_type != yaml_DOCUMENT_END_EVENT { + d.error(fmt.Errorf("Expected document end at %s", d.event.start_mark)) + } + + d.nextEvent() +} + +func (d *Decoder) parse(rv reflect.Value) { + if !rv.IsValid() { + // skip ahead since we cannot store + d.valueInterface() + return + } + + anchor := string(d.event.anchor) + switch d.event.event_type { + case yaml_SEQUENCE_START_EVENT: + d.begin_anchor(anchor) + d.sequence(rv) + d.end_anchor(anchor) + case yaml_MAPPING_START_EVENT: + d.begin_anchor(anchor) + d.mapping(rv) + d.end_anchor(anchor) + case yaml_SCALAR_EVENT: + d.begin_anchor(anchor) + d.scalar(rv) + d.end_anchor(anchor) + case yaml_ALIAS_EVENT: + d.alias(rv) + case yaml_DOCUMENT_END_EVENT: + default: + d.error(&UnexpectedEventError{ + Value: string(d.event.value), + EventType: d.event.event_type, + At: d.event.start_mark, + }) + } +} + +func (d *Decoder) begin_anchor(anchor string) { + if anchor != "" { + events := []yaml_event_t{d.event} + d.tracking_anchors = append(d.tracking_anchors, events) + } +} + +func (d *Decoder) end_anchor(anchor string) { + if anchor != "" { + events := d.tracking_anchors[len(d.tracking_anchors)-1] + d.tracking_anchors = d.tracking_anchors[0 : len(d.tracking_anchors)-1] + // remove the anchor, replaying events shouldn't have anchors + events[0].anchor = nil + // we went one too many, remove the extra event + events = events[:len(events)-1] + // if nested, append to all the other anchors + for i, e := range d.tracking_anchors { + d.tracking_anchors[i] = append(e, events...) + } + d.anchors[anchor] = events + } +} + +func (d *Decoder) indirect(v reflect.Value, decodingNull bool) (Unmarshaler, reflect.Value) { + // If v is a named type and is addressable, + // start with its address, so that if the type has pointer methods, + // we find them. + if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { + v = v.Addr() + } + for { + // Load value from interface, but only if the result will be + // usefully addressable. + if v.Kind() == reflect.Interface && !v.IsNil() { + e := v.Elem() + if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) { + v = e + continue + } + } + + if v.Kind() != reflect.Ptr { + break + } + + if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() { + break + } + + if v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) + } + + if v.Type().NumMethod() > 0 { + if u, ok := v.Interface().(Unmarshaler); ok { + var temp interface{} + return u, reflect.ValueOf(&temp) + } + } + + v = v.Elem() + } + + return nil, v +} + +func (d *Decoder) sequence(v reflect.Value) { + if d.event.event_type != yaml_SEQUENCE_START_EVENT { + d.error(fmt.Errorf("Expected sequence start at %s", d.event.start_mark)) + } + + u, pv := d.indirect(v, false) + if u != nil { + defer func() { + if err := u.UnmarshalYAML(yaml_SEQ_TAG, pv.Interface()); err != nil { + d.error(err) + } + }() + _, pv = d.indirect(pv, false) + } + + v = pv + + // Check type of target. + switch v.Kind() { + case reflect.Interface: + if v.NumMethod() == 0 { + // Decoding into nil interface? Switch to non-reflect code. + v.Set(reflect.ValueOf(d.sequenceInterface())) + return + } + // Otherwise it's invalid. + fallthrough + default: + d.error(fmt.Errorf("Expected an array, slice or interface{} but was a %s at %s", v, d.event.start_mark)) + case reflect.Array: + case reflect.Slice: + break + } + + d.nextEvent() + + i := 0 +done: + for { + switch d.event.event_type { + case yaml_SEQUENCE_END_EVENT, yaml_DOCUMENT_END_EVENT: + break done + } + + // Get element of array, growing if necessary. + if v.Kind() == reflect.Slice { + // Grow slice if necessary + if i >= v.Cap() { + newcap := v.Cap() + v.Cap()/2 + if newcap < 4 { + newcap = 4 + } + newv := reflect.MakeSlice(v.Type(), v.Len(), newcap) + reflect.Copy(newv, v) + v.Set(newv) + } + if i >= v.Len() { + v.SetLen(i + 1) + } + } + + if i < v.Len() { + // Decode into element. + d.parse(v.Index(i)) + } else { + // Ran out of fixed array: skip. + d.parse(reflect.Value{}) + } + i++ + } + + if i < v.Len() { + if v.Kind() == reflect.Array { + // Array. Zero the rest. + z := reflect.Zero(v.Type().Elem()) + for ; i < v.Len(); i++ { + v.Index(i).Set(z) + } + } else { + v.SetLen(i) + } + } + if i == 0 && v.Kind() == reflect.Slice { + v.Set(reflect.MakeSlice(v.Type(), 0, 0)) + } + + if d.event.event_type != yaml_DOCUMENT_END_EVENT { + d.nextEvent() + } +} + +func (d *Decoder) mapping(v reflect.Value) { + u, pv := d.indirect(v, false) + if u != nil { + defer func() { + if err := u.UnmarshalYAML(yaml_MAP_TAG, pv.Interface()); err != nil { + d.error(err) + } + }() + _, pv = d.indirect(pv, false) + } + v = pv + + // Decoding into nil interface? Switch to non-reflect code. + if v.Kind() == reflect.Interface && v.NumMethod() == 0 { + v.Set(reflect.ValueOf(d.mappingInterface())) + return + } + + // Check type of target: struct or map[X]Y + switch v.Kind() { + case reflect.Struct: + d.mappingStruct(v) + return + case reflect.Map: + default: + d.error(fmt.Errorf("Expected a struct or map but was a %s at %s ", v, d.event.start_mark)) + } + + mapt := v.Type() + if v.IsNil() { + v.Set(reflect.MakeMap(mapt)) + } + + d.nextEvent() + + keyt := mapt.Key() + mapElemt := mapt.Elem() + + var mapElem reflect.Value +done: + for { + switch d.event.event_type { + case yaml_MAPPING_END_EVENT: + break done + case yaml_DOCUMENT_END_EVENT: + return + } + + key := reflect.New(keyt) + d.parse(key.Elem()) + + if !mapElem.IsValid() { + mapElem = reflect.New(mapElemt).Elem() + } else { + mapElem.Set(reflect.Zero(mapElemt)) + } + + d.parse(mapElem) + + v.SetMapIndex(key.Elem(), mapElem) + } + + d.nextEvent() +} + +func (d *Decoder) mappingStruct(v reflect.Value) { + + structt := v.Type() + fields := cachedTypeFields(structt) + + d.nextEvent() + +done: + for { + switch d.event.event_type { + case yaml_MAPPING_END_EVENT: + break done + case yaml_DOCUMENT_END_EVENT: + return + } + + key := "" + d.parse(reflect.ValueOf(&key)) + + // Figure out field corresponding to key. + var subv reflect.Value + + var f *field + for i := range fields { + ff := &fields[i] + if ff.name == key { + f = ff + break + } + + if f == nil && strings.EqualFold(ff.name, key) { + f = ff + } + } + + if f != nil { + subv = v + for _, i := range f.index { + if subv.Kind() == reflect.Ptr { + if subv.IsNil() { + subv.Set(reflect.New(subv.Type().Elem())) + } + subv = subv.Elem() + } + subv = subv.Field(i) + } + } + d.parse(subv) + } + + d.nextEvent() +} + +func (d *Decoder) scalar(v reflect.Value) { + val := string(d.event.value) + wantptr := null_values[val] + + u, pv := d.indirect(v, wantptr) + + var tag string + if u != nil { + defer func() { + if err := u.UnmarshalYAML(tag, pv.Interface()); err != nil { + d.error(err) + } + }() + + _, pv = d.indirect(pv, wantptr) + } + v = pv + + var err error + tag, err = resolve(d.event, v, d.useNumber) + if err != nil { + d.error(err) + } + + d.nextEvent() +} + +func (d *Decoder) alias(rv reflect.Value) { + val, ok := d.anchors[string(d.event.anchor)] + if !ok { + d.error(fmt.Errorf("missing anchor: '%s' at %s", d.event.anchor, d.event.start_mark)) + } + + d.replay_events = val + d.nextEvent() + d.parse(rv) +} + +func (d *Decoder) valueInterface() interface{} { + var v interface{} + + anchor := string(d.event.anchor) + switch d.event.event_type { + case yaml_SEQUENCE_START_EVENT: + d.begin_anchor(anchor) + v = d.sequenceInterface() + case yaml_MAPPING_START_EVENT: + d.begin_anchor(anchor) + v = d.mappingInterface() + case yaml_SCALAR_EVENT: + d.begin_anchor(anchor) + v = d.scalarInterface() + case yaml_ALIAS_EVENT: + rv := reflect.ValueOf(&v) + d.alias(rv) + return v + case yaml_DOCUMENT_END_EVENT: + d.error(&UnexpectedEventError{ + Value: string(d.event.value), + EventType: d.event.event_type, + At: d.event.start_mark, + }) + + } + d.end_anchor(anchor) + + return v +} + +func (d *Decoder) scalarInterface() interface{} { + _, v := resolveInterface(d.event, d.useNumber) + + d.nextEvent() + return v +} + +// arrayInterface is like array but returns []interface{}. +func (d *Decoder) sequenceInterface() []interface{} { + var v = make([]interface{}, 0) + + d.nextEvent() + +done: + for { + switch d.event.event_type { + case yaml_SEQUENCE_END_EVENT, yaml_DOCUMENT_END_EVENT: + break done + } + + v = append(v, d.valueInterface()) + } + + if d.event.event_type != yaml_DOCUMENT_END_EVENT { + d.nextEvent() + } + + return v +} + +// objectInterface is like object but returns map[string]interface{}. +func (d *Decoder) mappingInterface() map[interface{}]interface{} { + m := make(map[interface{}]interface{}) + + d.nextEvent() + +done: + for { + switch d.event.event_type { + case yaml_MAPPING_END_EVENT, yaml_DOCUMENT_END_EVENT: + break done + } + + key := d.valueInterface() + + // Read value. + m[key] = d.valueInterface() + } + + if d.event.event_type != yaml_DOCUMENT_END_EVENT { + d.nextEvent() + } + + return m +} diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/decode_test.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/decode_test.go new file mode 100644 index 00000000..6ba1275a --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/decode_test.go @@ -0,0 +1,906 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "math" + "os" + "strconv" + "strings" + "time" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Decode", func() { + It("Decodes a file", func() { + f, _ := os.Open("fixtures/specification/example2_1.yaml") + d := NewDecoder(f) + var v interface{} + err := d.Decode(&v) + + Expect(err).NotTo(HaveOccurred()) + }) + + Context("strings", func() { + It("Decodes an empty string", func() { + d := NewDecoder(strings.NewReader(`"" +`)) + var v string + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal("")) + }) + + It("Decodes an empty string to an interface", func() { + d := NewDecoder(strings.NewReader(`"" +`)) + var v interface{} + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal("")) + }) + + It("Decodes a map containing empty strings to an interface", func() { + d := NewDecoder(strings.NewReader(`"" : "" +`)) + var v interface{} + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[interface{}]interface{}{"": ""})) + }) + }) + + Context("Sequence", func() { + It("Decodes to interface{}s", func() { + f, _ := os.Open("fixtures/specification/example2_1.yaml") + d := NewDecoder(f) + var v interface{} + err := d.Decode(&v) + + Expect(err).NotTo(HaveOccurred()) + Expect((v).([]interface{})).To(Equal([]interface{}{"Mark McGwire", "Sammy Sosa", "Ken Griffey"})) + }) + + It("Decodes to []string", func() { + f, _ := os.Open("fixtures/specification/example2_1.yaml") + d := NewDecoder(f) + v := make([]string, 0, 3) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal([]string{"Mark McGwire", "Sammy Sosa", "Ken Griffey"})) + }) + + It("Decodes a sequence of maps", func() { + f, _ := os.Open("fixtures/specification/example2_12.yaml") + d := NewDecoder(f) + v := make([]map[string]interface{}, 1) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal([]map[string]interface{}{ + {"item": "Super Hoop", "quantity": int64(1)}, + {"item": "Basketball", "quantity": int64(4)}, + {"item": "Big Shoes", "quantity": int64(1)}, + })) + + }) + + Describe("As structs", func() { + It("Simple struct", func() { + f, _ := os.Open("fixtures/specification/example2_4.yaml") + d := NewDecoder(f) + + type batter struct { + Name string + HR int64 + AVG float64 + } + v := make([]batter, 0, 1) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal([]batter{ + batter{Name: "Mark McGwire", HR: 65, AVG: 0.278}, + batter{Name: "Sammy Sosa", HR: 63, AVG: 0.288}, + })) + + }) + + It("Tagged struct", func() { + f, _ := os.Open("fixtures/specification/example2_4.yaml") + d := NewDecoder(f) + + type batter struct { + N string `yaml:"name"` + H int64 `yaml:"hr"` + A float64 `yaml:"avg"` + } + v := make([]batter, 0, 1) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal([]batter{ + batter{N: "Mark McGwire", H: 65, A: 0.278}, + batter{N: "Sammy Sosa", H: 63, A: 0.288}, + })) + + }) + + It("handles null values", func() { + type S struct { + Default interface{} + } + + d := NewDecoder(strings.NewReader(` +--- +default: +`)) + var s S + err := d.Decode(&s) + Expect(err).NotTo(HaveOccurred()) + Expect(s).To(Equal(S{Default: nil})) + + }) + + It("ignores missing tags", func() { + f, _ := os.Open("fixtures/specification/example2_4.yaml") + d := NewDecoder(f) + + type batter struct { + N string `yaml:"name"` + HR int64 + A float64 + } + v := make([]batter, 0, 1) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal([]batter{ + batter{N: "Mark McGwire", HR: 65}, + batter{N: "Sammy Sosa", HR: 63}, + })) + + }) + }) + + It("Decodes a sequence of sequences", func() { + f, _ := os.Open("fixtures/specification/example2_5.yaml") + d := NewDecoder(f) + v := make([][]interface{}, 1) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal([][]interface{}{ + {"name", "hr", "avg"}, + {"Mark McGwire", int64(65), float64(0.278)}, + {"Sammy Sosa", int64(63), float64(0.288)}, + })) + + }) + }) + + Context("Maps", func() { + It("Decodes to interface{}s", func() { + f, _ := os.Open("fixtures/specification/example2_2.yaml") + d := NewDecoder(f) + var v interface{} + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect((v).(map[interface{}]interface{})).To(Equal(map[interface{}]interface{}{ + "hr": int64(65), + "avg": float64(0.278), + "rbi": int64(147), + })) + + }) + + It("Decodes to a struct", func() { + f, _ := os.Open("fixtures/specification/example2_2.yaml") + d := NewDecoder(f) + + type batter struct { + HR int64 + AVG float64 + RBI int64 + } + v := batter{} + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(batter{HR: 65, AVG: 0.278, RBI: 147})) + }) + + It("Decodes to a map of string arrays", func() { + f, _ := os.Open("fixtures/specification/example2_9.yaml") + d := NewDecoder(f) + v := make(map[string][]string) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string][]string{"hr": []string{"Mark McGwire", "Sammy Sosa"}, "rbi": []string{"Sammy Sosa", "Ken Griffey"}})) + }) + }) + + Context("Sequence of Maps", func() { + It("Decodes to interface{}s", func() { + f, _ := os.Open("fixtures/specification/example2_4.yaml") + d := NewDecoder(f) + var v interface{} + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect((v).([]interface{})).To(Equal([]interface{}{ + map[interface{}]interface{}{"name": "Mark McGwire", "hr": int64(65), "avg": float64(0.278)}, + map[interface{}]interface{}{"name": "Sammy Sosa", "hr": int64(63), "avg": float64(0.288)}, + })) + + }) + }) + + It("Decodes ascii art", func() { + f, _ := os.Open("fixtures/specification/example2_13.yaml") + d := NewDecoder(f) + v := "" + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(`\//||\/|| +// || ||__ +`)) + + }) + + It("Decodes folded strings", func() { + f, _ := os.Open("fixtures/specification/example2_15.yaml") + d := NewDecoder(f) + v := "" + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal("Sammy Sosa completed another fine season with great stats.\n\n 63 Home Runs\n 0.288 Batting Average\n\nWhat a year!\n")) + }) + + It("Decodes literal and folded strings with indents", func() { + f, _ := os.Open("fixtures/specification/example2_16.yaml") + d := NewDecoder(f) + v := make(map[string]string) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]string{ + "name": "Mark McGwire", + "accomplishment": `Mark set a major league home run record in 1998. +`, + "stats": `65 Home Runs +0.278 Batting Average +`, + })) + + }) + + It("Decodes single quoted", func() { + f, _ := os.Open("fixtures/specification/example2_17_quoted.yaml") + d := NewDecoder(f) + v := make(map[string]string) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]string{ + "quoted": ` # not a 'comment'.`, + })) + + }) + + Context("ints", func() { + It("Decodes into an interface{}", func() { + f, _ := os.Open("fixtures/specification/example2_19.yaml") + d := NewDecoder(f) + v := make(map[string]interface{}) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]interface{}{ + "canonical": int64(12345), + "decimal": int64(12345), + "octal": int64(12), + "hexadecimal": int64(12), + })) + + }) + + It("Decodes into int64", func() { + f, _ := os.Open("fixtures/specification/example2_19.yaml") + d := NewDecoder(f) + v := make(map[string]int64) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]int64{ + "canonical": int64(12345), + "decimal": int64(12345), + "octal": int64(12), + "hexadecimal": int64(12), + })) + + }) + + Context("boundary values", func() { + intoInt64 := func(val int64) { + It("Decodes into an int64 value", func() { + var v int64 + + d := NewDecoder(strings.NewReader(strconv.FormatInt(val, 10))) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(val)) + + }) + } + + intoInt := func(val int) { + It("Decodes into an int value", func() { + var v int + + d := NewDecoder(strings.NewReader(strconv.FormatInt(int64(val), 10))) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(val)) + + }) + } + + intoInterface := func(val int64) { + It("Decodes into an interface{}", func() { + var v interface{} + + d := NewDecoder(strings.NewReader(strconv.FormatInt(val, 10))) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(val)) + }) + } + + intoInt64(math.MaxInt64) + intoInterface(math.MaxInt64) + + intoInt64(math.MinInt64) + intoInterface(math.MinInt64) + + intoInt(math.MaxInt32) + intoInt(math.MinInt32) + }) + }) + + It("Decodes a variety of floats", func() { + f, _ := os.Open("fixtures/specification/example2_20.yaml") + d := NewDecoder(f) + v := make(map[string]float64) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + + Expect(math.IsNaN(v["not a number"])).To(BeTrue()) + delete(v, "not a number") + + Expect(v).To(Equal(map[string]float64{ + "canonical": float64(1230.15), + "exponential": float64(1230.15), + "fixed": float64(1230.15), + "negative infinity": math.Inf(-1), + })) + + }) + + It("Decodes booleans, nil and strings", func() { + f, _ := os.Open("fixtures/specification/example2_21.yaml") + d := NewDecoder(f) + v := make(map[string]interface{}) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]interface{}{ + "": interface{}(nil), + "true": true, + "false": false, + "string": "12345", + })) + + }) + + It("Decodes a null ptr", func() { + d := NewDecoder(strings.NewReader(`null +`)) + var v *bool + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(BeNil()) + }) + + It("Decodes dates/time", func() { + f, _ := os.Open("fixtures/specification/example2_22.yaml") + d := NewDecoder(f) + v := make(map[string]time.Time) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]time.Time{ + "canonical": time.Date(2001, time.December, 15, 2, 59, 43, int(1*time.Millisecond), time.UTC), + "iso8601": time.Date(2001, time.December, 14, 21, 59, 43, int(10*time.Millisecond), time.FixedZone("", -5*3600)), + "spaced": time.Date(2001, time.December, 14, 21, 59, 43, int(10*time.Millisecond), time.FixedZone("", -5*3600)), + "date": time.Date(2002, time.December, 14, 0, 0, 0, 0, time.UTC), + })) + + }) + + Context("Tags", func() { + It("Respects tags", func() { + f, _ := os.Open("fixtures/specification/example2_23_non_date.yaml") + d := NewDecoder(f) + v := make(map[string]string) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]string{ + "not-date": "2002-04-28", + })) + + }) + + It("handles non-specific tags", func() { + d := NewDecoder(strings.NewReader(` +--- +not_parsed: ! 123 +`)) + v := make(map[string]int) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]int{"not_parsed": 123})) + }) + + It("handles non-specific tags", func() { + d := NewDecoder(strings.NewReader(` +--- +? a complex key +: ! "123" +`)) + v := make(map[string]string) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]string{"a complex key": "123"})) + }) + }) + + Context("Decodes binary/base64", func() { + It("to []byte", func() { + f, _ := os.Open("fixtures/specification/example2_23_picture.yaml") + d := NewDecoder(f) + v := make(map[string][]byte) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string][]byte{ + "picture": []byte{0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x0c, 0x00, + 0x0c, 0x00, 0x84, 0x00, 0x00, 0xff, 0xff, 0xf7, 0xf5, 0xf5, 0xee, + 0xe9, 0xe9, 0xe5, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0xe7, 0xe7, + 0xe7, 0x5e, 0x5e, 0x5e, 0xf3, 0xf3, 0xed, 0x8e, 0x8e, 0x8e, 0xe0, + 0xe0, 0xe0, 0x9f, 0x9f, 0x9f, 0x93, 0x93, 0x93, 0xa7, 0xa7, 0xa7, + 0x9e, 0x9e, 0x9e, 0x69, 0x5e, 0x10, 0x27, 0x20, 0x82, 0x0a, 0x01, + 0x00, 0x3b}, + })) + + }) + + It("to string", func() { + d := NewDecoder(strings.NewReader("!binary YWJjZGVmZw==")) + var v string + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal("abcdefg")) + }) + + It("to string via alternate form", func() { + d := NewDecoder(strings.NewReader("!!binary YWJjZGVmZw==")) + var v string + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal("abcdefg")) + }) + + It("to interface", func() { + d := NewDecoder(strings.NewReader("!binary YWJjZGVmZw==")) + var v interface{} + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal([]byte("abcdefg"))) + }) + }) + + Context("Aliases", func() { + Context("to known types", func() { + It("aliases scalars", func() { + f, _ := os.Open("fixtures/specification/example2_10.yaml") + d := NewDecoder(f) + v := make(map[string][]string) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string][]string{ + "hr": {"Mark McGwire", "Sammy Sosa"}, + "rbi": {"Sammy Sosa", "Ken Griffey"}, + })) + + }) + + It("aliases sequences", func() { + d := NewDecoder(strings.NewReader(` +--- +hr: &ss + - MG + - SS +rbi: *ss +`)) + v := make(map[string][]string) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string][]string{ + "hr": {"MG", "SS"}, + "rbi": {"MG", "SS"}, + })) + + }) + + It("aliases maps", func() { + d := NewDecoder(strings.NewReader(` +--- +hr: &ss + MG : SS +rbi: *ss +`)) + v := make(map[string]map[string]string) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]map[string]string{ + "hr": {"MG": "SS"}, + "rbi": {"MG": "SS"}, + })) + + }) + }) + + It("aliases to different types", func() { + type S struct { + A map[string]int + C map[string]string + } + d := NewDecoder(strings.NewReader(` +--- +a: &map + b : 1 +c: *map +`)) + var s S + err := d.Decode(&s) + Expect(err).NotTo(HaveOccurred()) + Expect(s).To(Equal(S{ + A: map[string]int{"b": 1}, + C: map[string]string{"b": "1"}, + })) + + }) + + It("fails if an anchor is undefined", func() { + d := NewDecoder(strings.NewReader(` +--- +a: *missing +`)) + m := make(map[string]string) + err := d.Decode(&m) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(MatchRegexp("missing anchor.*line.*column.*")) + }) + + Context("to Interface", func() { + It("aliases scalars", func() { + f, _ := os.Open("fixtures/specification/example2_10.yaml") + d := NewDecoder(f) + v := make(map[string]interface{}) + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]interface{}{ + "hr": []interface{}{"Mark McGwire", "Sammy Sosa"}, + "rbi": []interface{}{"Sammy Sosa", "Ken Griffey"}, + })) + + }) + + It("aliases sequences", func() { + d := NewDecoder(strings.NewReader(` +--- +hr: &ss + - MG + - SS +rbi: *ss +`)) + v := make(map[string]interface{}) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]interface{}{ + "hr": []interface{}{"MG", "SS"}, + "rbi": []interface{}{"MG", "SS"}, + })) + + }) + + It("aliases maps", func() { + d := NewDecoder(strings.NewReader(` +--- +hr: &ss + MG : SS +rbi: *ss +`)) + v := make(map[string]interface{}) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]interface{}{ + "hr": map[interface{}]interface{}{"MG": "SS"}, + "rbi": map[interface{}]interface{}{"MG": "SS"}, + })) + + }) + + It("supports duplicate aliases", func() { + d := NewDecoder(strings.NewReader(` +--- +a: &a + b: 1 +x: *a +y: *a +`)) + v := make(map[string]interface{}) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]interface{}{ + "a": map[interface{}]interface{}{"b": int64(1)}, + "x": map[interface{}]interface{}{"b": int64(1)}, + "y": map[interface{}]interface{}{"b": int64(1)}, + })) + + }) + + It("supports overriden anchors", func() { + d := NewDecoder(strings.NewReader(` +--- +First occurrence: &anchor Foo +Second occurrence: *anchor +Override anchor: &anchor Bar +Reuse anchor: *anchor +`)) + v := make(map[string]interface{}) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]interface{}{ + "First occurrence": "Foo", + "Second occurrence": "Foo", + "Override anchor": "Bar", + "Reuse anchor": "Bar", + })) + + }) + + It("fails if an anchor is undefined", func() { + d := NewDecoder(strings.NewReader(` +--- +a: *missing +`)) + var i interface{} + err := d.Decode(&i) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(MatchRegexp("missing anchor.*line.*column.*")) + }) + + }) + + It("supports composing aliases", func() { + d := NewDecoder(strings.NewReader(` +--- +a: &a b +x: &b + d: *a +z: *b +`)) + v := make(map[string]interface{}) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]interface{}{ + "a": "b", + "x": map[interface{}]interface{}{"d": "b"}, + "z": map[interface{}]interface{}{"d": "b"}, + })) + + }) + + It("redefinition while composing aliases", func() { + d := NewDecoder(strings.NewReader(` +--- +a: &a b +x: &c + d : &a 1 +y: *a +`)) + v := make(map[string]interface{}) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(Equal(map[string]interface{}{ + "a": "b", + "x": map[interface{}]interface{}{"d": int64(1)}, + "y": int64(1), + })) + + }) + + It("can parse nested anchors", func() { + d := NewDecoder(strings.NewReader(` +--- +a: + aa: &x + aaa: 1 + ab: + aba: &y + abaa: + abaaa: *x +b: +- ba: + baa: *y +`)) + v := make(map[string]interface{}) + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + }) + }) + + Context("When decoding fails", func() { + It("returns an error", func() { + f, _ := os.Open("fixtures/specification/example_empty.yaml") + d := NewDecoder(f) + var v interface{} + + err := d.Decode(&v) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(Equal("Expected document start at line 0, column 0")) + }) + }) + + Context("Unmarshaler support", func() { + Context("Receiver is a value", func() { + It("the Marshaler interface is not used", func() { + d := NewDecoder(strings.NewReader("abc\n")) + v := hasMarshaler{} + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v.Value).To(BeNil()) + }) + }) + + Context("Receiver is a pointer", func() { + It("uses the Marshaler interface when a pointer", func() { + d := NewDecoder(strings.NewReader("abc\n")) + v := hasPtrMarshaler{} + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + }) + + It("marshals a scalar", func() { + d := NewDecoder(strings.NewReader("abc\n")) + v := hasPtrMarshaler{} + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v.Tag).To(Equal(yaml_STR_TAG)) + Expect(v.Value).To(Equal("abc")) + }) + + It("marshals a sequence", func() { + d := NewDecoder(strings.NewReader("[abc, def]\n")) + v := hasPtrMarshaler{} + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v.Tag).To(Equal(yaml_SEQ_TAG)) + Expect(v.Value).To(Equal([]interface{}{"abc", "def"})) + }) + + It("marshals a map", func() { + d := NewDecoder(strings.NewReader("{ a: bc}\n")) + v := hasPtrMarshaler{} + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v.Tag).To(Equal(yaml_MAP_TAG)) + Expect(v.Value).To(Equal(map[interface{}]interface{}{"a": "bc"})) + }) + }) + }) + + Context("Marshals into a Number", func() { + It("when the number is an int", func() { + d := NewDecoder(strings.NewReader("123\n")) + d.UseNumber() + var v Number + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v.String()).To(Equal("123")) + }) + + It("when the number is an float", func() { + d := NewDecoder(strings.NewReader("1.23\n")) + d.UseNumber() + var v Number + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v.String()).To(Equal("1.23")) + }) + + It("it fails when its a non-Number", func() { + d := NewDecoder(strings.NewReader("on\n")) + d.UseNumber() + var v Number + + err := d.Decode(&v) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(MatchRegexp("Not a number: 'on' at line 0, column 0")) + }) + + It("returns a Number", func() { + d := NewDecoder(strings.NewReader("123\n")) + d.UseNumber() + var v interface{} + + err := d.Decode(&v) + Expect(err).NotTo(HaveOccurred()) + Expect(v).To(BeAssignableToTypeOf(Number(""))) + + n := v.(Number) + Expect(n.String()).To(Equal("123")) + }) + }) + Context("When there are special characters", func() { + It("returns an error", func() { + d := NewDecoder(strings.NewReader(` +--- +applications: + - name: m + services: + - !@# +`)) + var v interface{} + + err := d.Decode(&v) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(MatchRegexp("yaml.*did not find.*line.*column.*")) + }) + }) +}) diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/emitter.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/emitter.go new file mode 100644 index 00000000..a42df052 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/emitter.go @@ -0,0 +1,2072 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "bytes" +) + +var default_tag_directives = []yaml_tag_directive_t{ + {[]byte("!"), []byte("!")}, + {[]byte("!!"), []byte("tag:yaml.org,2002:")}, +} + +/* + * Flush the buffer if needed. + */ + +func flush(emitter *yaml_emitter_t) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) { + return yaml_emitter_flush(emitter) + } + return true +} + +/* + * Put a character to the output buffer. + */ +func put(emitter *yaml_emitter_t, value byte) bool { + if !flush(emitter) { + return false + } + + emitter.buffer[emitter.buffer_pos] = value + emitter.buffer_pos++ + emitter.column++ + return true +} + +/* + * Put a line break to the output buffer. + */ + +func put_break(emitter *yaml_emitter_t) bool { + if !flush(emitter) { + return false + } + switch emitter.line_break { + case yaml_CR_BREAK: + emitter.buffer[emitter.buffer_pos] = '\r' + emitter.buffer_pos++ + case yaml_LN_BREAK: + emitter.buffer[emitter.buffer_pos] = '\n' + emitter.buffer_pos++ + case yaml_CRLN_BREAK: + emitter.buffer[emitter.buffer_pos] = '\r' + emitter.buffer[emitter.buffer_pos] = '\n' + emitter.buffer_pos += 2 + default: + return false + } + emitter.column = 0 + emitter.line++ + return true +} + +/* + * Copy a character from a string into buffer. + */ +func write(emitter *yaml_emitter_t, src []byte, src_pos *int) bool { + if !flush(emitter) { + return false + } + copy_bytes(emitter.buffer, &emitter.buffer_pos, src, src_pos) + emitter.column++ + return true +} + +/* + * Copy a line break character from a string into buffer. + */ + +func write_break(emitter *yaml_emitter_t, src []byte, src_pos *int) bool { + if src[*src_pos] == '\n' { + if !put_break(emitter) { + return false + } + *src_pos++ + } else { + if !write(emitter, src, src_pos) { + return false + } + emitter.column = 0 + emitter.line++ + } + + return true +} + +/* + * Set an emitter error and return 0. + */ + +func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem string) bool { + emitter.error = yaml_EMITTER_ERROR + emitter.problem = problem + return false +} + +/* + * Emit an event. + */ + +func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { + emitter.events = append(emitter.events, *event) + for !yaml_emitter_need_more_events(emitter) { + event := &emitter.events[emitter.events_head] + if !yaml_emitter_analyze_event(emitter, event) { + return false + } + if !yaml_emitter_state_machine(emitter, event) { + return false + } + yaml_event_delete(event) + emitter.events_head++ + } + return true +} + +/* + * Check if we need to accumulate more events before emitting. + * + * We accumulate extra + * - 1 event for DOCUMENT-START + * - 2 events for SEQUENCE-START + * - 3 events for MAPPING-START + */ + +func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { + if emitter.events_head == len(emitter.events) { + return true + } + + accumulate := 0 + switch emitter.events[emitter.events_head].event_type { + case yaml_DOCUMENT_START_EVENT: + accumulate = 1 + case yaml_SEQUENCE_START_EVENT: + accumulate = 2 + case yaml_MAPPING_START_EVENT: + accumulate = 3 + default: + return false + } + + if len(emitter.events)-emitter.events_head > accumulate { + return false + } + + level := 0 + for i := emitter.events_head; i < len(emitter.events); i++ { + switch emitter.events[i].event_type { + case yaml_STREAM_START_EVENT, yaml_DOCUMENT_START_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT: + level++ + case yaml_STREAM_END_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_END_EVENT, yaml_MAPPING_END_EVENT: + level-- + } + + if level == 0 { + return false + } + } + return true +} + +/* + * Append a directive to the directives stack. + */ + +func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, + value *yaml_tag_directive_t, allow_duplicates bool) bool { + + for i := range emitter.tag_directives { + + if bytes.Equal(value.handle, emitter.tag_directives[i].handle) { + if allow_duplicates { + return true + } + return yaml_emitter_set_emitter_error(emitter, "duplicat %TAG directive") + } + } + + tag_copy := yaml_tag_directive_t{ + handle: value.handle, + prefix: value.prefix, + } + + emitter.tag_directives = append(emitter.tag_directives, tag_copy) + + return true +} + +/* + * Increase the indentation level. + */ + +func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow bool, indentless bool) bool { + + emitter.indents = append(emitter.indents, emitter.indent) + + if emitter.indent < 0 { + if flow { + emitter.indent = emitter.best_indent + } else { + emitter.indent = 0 + } + } else if !indentless { + emitter.indent += emitter.best_indent + } + + return true +} + +/* + * State dispatcher. + */ + +func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_event_t) bool { + switch emitter.state { + case yaml_EMIT_STREAM_START_STATE: + return yaml_emitter_emit_stream_start(emitter, event) + + case yaml_EMIT_FIRST_DOCUMENT_START_STATE: + return yaml_emitter_emit_document_start(emitter, event, true) + + case yaml_EMIT_DOCUMENT_START_STATE: + return yaml_emitter_emit_document_start(emitter, event, false) + + case yaml_EMIT_DOCUMENT_CONTENT_STATE: + return yaml_emitter_emit_document_content(emitter, event) + + case yaml_EMIT_DOCUMENT_END_STATE: + return yaml_emitter_emit_document_end(emitter, event) + + case yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE: + return yaml_emitter_emit_flow_sequence_item(emitter, event, true) + + case yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE: + return yaml_emitter_emit_flow_sequence_item(emitter, event, false) + + case yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE: + return yaml_emitter_emit_flow_mapping_key(emitter, event, true) + + case yaml_EMIT_FLOW_MAPPING_KEY_STATE: + return yaml_emitter_emit_flow_mapping_key(emitter, event, false) + + case yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE: + return yaml_emitter_emit_flow_mapping_value(emitter, event, true) + + case yaml_EMIT_FLOW_MAPPING_VALUE_STATE: + return yaml_emitter_emit_flow_mapping_value(emitter, event, false) + + case yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE: + return yaml_emitter_emit_block_sequence_item(emitter, event, true) + + case yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE: + return yaml_emitter_emit_block_sequence_item(emitter, event, false) + + case yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE: + return yaml_emitter_emit_block_mapping_key(emitter, event, true) + + case yaml_EMIT_BLOCK_MAPPING_KEY_STATE: + return yaml_emitter_emit_block_mapping_key(emitter, event, false) + + case yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE: + return yaml_emitter_emit_block_mapping_value(emitter, event, true) + + case yaml_EMIT_BLOCK_MAPPING_VALUE_STATE: + return yaml_emitter_emit_block_mapping_value(emitter, event, false) + + case yaml_EMIT_END_STATE: + return yaml_emitter_set_emitter_error(emitter, + "expected nothing after STREAM-END") + + } + + panic("invalid state") +} + +/* + * Expect STREAM-START. + */ + +func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + + if event.event_type != yaml_STREAM_START_EVENT { + return yaml_emitter_set_emitter_error(emitter, + "expected STREAM-START") + } + + if emitter.encoding == yaml_ANY_ENCODING { + emitter.encoding = event.encoding + + if emitter.encoding == yaml_ANY_ENCODING { + emitter.encoding = yaml_UTF8_ENCODING + } + } + + if emitter.best_indent < 2 || emitter.best_indent > 9 { + emitter.best_indent = 2 + } + + if emitter.best_width >= 0 && emitter.best_width <= emitter.best_indent*2 { + emitter.best_width = 80 + } + + if emitter.best_width < 0 { + emitter.best_width = 1<<31 - 1 + } + + if emitter.line_break == yaml_ANY_BREAK { + emitter.line_break = yaml_LN_BREAK + } + + emitter.indent = -1 + + emitter.line = 0 + emitter.column = 0 + emitter.whitespace = true + emitter.indention = true + + if emitter.encoding != yaml_UTF8_ENCODING { + if !yaml_emitter_write_bom(emitter) { + return false + } + } + + emitter.state = yaml_EMIT_FIRST_DOCUMENT_START_STATE + + return true +} + +/* + * Expect DOCUMENT-START or STREAM-END. + */ + +func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, + event *yaml_event_t, first bool) bool { + + if event.event_type == yaml_DOCUMENT_START_EVENT { + if event.version_directive != nil { + if !yaml_emitter_analyze_version_directive(emitter, + *event.version_directive) { + return false + } + } + + for i := range event.tag_directives { + tag_directive := &event.tag_directives[i] + + if !yaml_emitter_analyze_tag_directive(emitter, tag_directive) { + return false + } + if !yaml_emitter_append_tag_directive(emitter, tag_directive, false) { + return false + } + } + + for i := range default_tag_directives { + if !yaml_emitter_append_tag_directive(emitter, &default_tag_directives[i], true) { + return false + } + } + + implicit := event.implicit + if !first || emitter.canonical { + implicit = false + } + + if (event.version_directive != nil || len(event.tag_directives) > 0) && + emitter.open_ended { + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if event.version_directive != nil { + implicit = false + if !yaml_emitter_write_indicator(emitter, []byte("%YAML"), true, false, false) { + return false + } + + if !yaml_emitter_write_indicator(emitter, []byte("1.1"), true, false, false) { + return false + } + + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if len(event.tag_directives) > 0 { + implicit = false + for i := range event.tag_directives { + tag_directive := &event.tag_directives[i] + + if !yaml_emitter_write_indicator(emitter, []byte("%TAG"), true, false, false) { + return false + } + if !yaml_emitter_write_tag_handle(emitter, tag_directive.handle) { + return false + } + if !yaml_emitter_write_tag_content(emitter, tag_directive.prefix, true) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + } + + if yaml_emitter_check_empty_document(emitter) { + implicit = false + } + + if !implicit { + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte("---"), true, false, false) { + return false + } + + if emitter.canonical { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + } + + emitter.state = yaml_EMIT_DOCUMENT_CONTENT_STATE + + return true + } else if event.event_type == yaml_STREAM_END_EVENT { + if emitter.open_ended { + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if !yaml_emitter_flush(emitter) { + return false + } + + emitter.state = yaml_EMIT_END_STATE + + return true + } + + return yaml_emitter_set_emitter_error(emitter, + "expected DOCUMENT-START or STREAM-END") +} + +/* + * Expect the root node. + */ + +func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool { + emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE) + + return yaml_emitter_emit_node(emitter, event, true, false, false, false) +} + +/* + * Expect DOCUMENT-END. + */ + +func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t) bool { + + if event.event_type != yaml_DOCUMENT_END_EVENT { + return yaml_emitter_set_emitter_error(emitter, + "expected DOCUMENT-END") + } + + if !yaml_emitter_write_indent(emitter) { + return false + } + if !event.implicit { + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_flush(emitter) { + return false + } + + emitter.state = yaml_EMIT_DOCUMENT_START_STATE + emitter.tag_directives = emitter.tag_directives[:0] + return true +} + +/* + * + * Expect a flow item node. + */ + +func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + if first { + if !yaml_emitter_write_indicator(emitter, []byte("["), true, true, false) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + emitter.flow_level++ + } + + if event.event_type == yaml_SEQUENCE_END_EVENT { + emitter.flow_level-- + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + if emitter.canonical && !first { + if !yaml_emitter_write_indicator(emitter, []byte(","), false, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte("]"), false, false, false) { + return false + } + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + + return true + } + + if !first { + if !yaml_emitter_write_indicator(emitter, []byte(","), false, false, false) { + return false + } + } + + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE) + return yaml_emitter_emit_node(emitter, event, false, true, false, false) +} + +/* + * Expect a flow key node. + */ + +func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, + event *yaml_event_t, first bool) bool { + + if first { + + if !yaml_emitter_write_indicator(emitter, []byte("{"), true, true, false) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + emitter.flow_level++ + } + + if event.event_type == yaml_MAPPING_END_EVENT { + emitter.flow_level-- + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + + if emitter.canonical && !first { + if !yaml_emitter_write_indicator(emitter, []byte(","), false, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte("}"), false, false, false) { + return false + } + + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + + return true + } + + if !first { + if !yaml_emitter_write_indicator(emitter, []byte(","), false, false, false) { + return false + } + } + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if !emitter.canonical && yaml_emitter_check_simple_key(emitter) { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, true) + } else { + if !yaml_emitter_write_indicator(emitter, []byte("?"), true, false, false) { + return false + } + + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) + } +} + +/* + * Expect a flow value node. + */ + +func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, + event *yaml_event_t, simple bool) bool { + + if simple { + if !yaml_emitter_write_indicator(emitter, []byte(":"), false, false, false) { + return false + } + } else { + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte(":"), true, false, false) { + return false + } + } + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_KEY_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +/* + * Expect a block item node. + */ + +func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, + event *yaml_event_t, first bool) bool { + + if first { + if !yaml_emitter_increase_indent(emitter, false, + (emitter.mapping_context && !emitter.indention)) { + return false + } + } + + if event.event_type == yaml_SEQUENCE_END_EVENT { + + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + + return true + } + + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte("-"), true, false, true) { + return false + } + + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE) + return yaml_emitter_emit_node(emitter, event, false, true, false, false) +} + +/* + * Expect a block key node. + */ + +func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, + event *yaml_event_t, first bool) bool { + + if first { + if !yaml_emitter_increase_indent(emitter, false, false) { + return false + } + } + + if event.event_type == yaml_MAPPING_END_EVENT { + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + + return true + } + + if !yaml_emitter_write_indent(emitter) { + return false + } + + if yaml_emitter_check_simple_key(emitter) { + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE) + + return yaml_emitter_emit_node(emitter, event, false, false, true, true) + } else { + if !yaml_emitter_write_indicator(emitter, []byte("?"), true, false, true) { + return false + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_VALUE_STATE) + + return yaml_emitter_emit_node(emitter, event, false, false, true, false) + } +} + +/* + * Expect a block value node. + */ + +func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, + event *yaml_event_t, simple bool) bool { + + if simple { + if !yaml_emitter_write_indicator(emitter, []byte(":"), false, false, false) { + return false + } + } else { + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte(":"), true, false, true) { + return false + } + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE) + + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +/* + * Expect a node. + */ + +func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t, + root bool, sequence bool, mapping bool, simple_key bool) bool { + emitter.root_context = root + emitter.sequence_context = sequence + emitter.mapping_context = mapping + emitter.simple_key_context = simple_key + + switch event.event_type { + case yaml_ALIAS_EVENT: + return yaml_emitter_emit_alias(emitter, event) + + case yaml_SCALAR_EVENT: + return yaml_emitter_emit_scalar(emitter, event) + + case yaml_SEQUENCE_START_EVENT: + return yaml_emitter_emit_sequence_start(emitter, event) + + case yaml_MAPPING_START_EVENT: + return yaml_emitter_emit_mapping_start(emitter, event) + + default: + return yaml_emitter_set_emitter_error(emitter, + "expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS") + } + + return false +} + +/* + * Expect ALIAS. + */ + +func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + + return true +} + +/* + * Expect SCALAR. + */ + +func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_select_scalar_style(emitter, event) { + return false + } + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + if !yaml_emitter_process_scalar(emitter) { + return false + } + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + + return true +} + +/* + * Expect SEQUENCE-START. + */ + +func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + + if emitter.flow_level > 0 || emitter.canonical || + event.style == yaml_style_t(yaml_FLOW_SEQUENCE_STYLE) || + yaml_emitter_check_empty_sequence(emitter) { + emitter.state = yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE + } else { + emitter.state = yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE + } + + return true +} + +/* + * Expect MAPPING-START. + */ + +func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + + if emitter.flow_level > 0 || emitter.canonical || + event.style == yaml_style_t(yaml_FLOW_MAPPING_STYLE) || + yaml_emitter_check_empty_mapping(emitter) { + emitter.state = yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE + } else { + emitter.state = yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE + } + + return true +} + +/* + * Check if the document content is an empty scalar. + */ + +func yaml_emitter_check_empty_document(emitter *yaml_emitter_t) bool { + return false +} + +/* + * Check if the next events represent an empty sequence. + */ + +func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool { + if len(emitter.events)-emitter.events_head < 2 { + return false + } + + return (emitter.events[emitter.events_head].event_type == yaml_SEQUENCE_START_EVENT && + emitter.events[emitter.events_head+1].event_type == yaml_SEQUENCE_END_EVENT) +} + +/* + * Check if the next events represent an empty mapping. + */ + +func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool { + if len(emitter.events)-emitter.events_head < 2 { + return false + } + + return (emitter.events[emitter.events_head].event_type == yaml_MAPPING_START_EVENT && + emitter.events[emitter.events_head+1].event_type == yaml_MAPPING_END_EVENT) +} + +/* + * Check if the next node can be expressed as a simple key. + */ + +func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool { + length := 0 + + switch emitter.events[emitter.events_head].event_type { + case yaml_ALIAS_EVENT: + length += len(emitter.anchor_data.anchor) + + case yaml_SCALAR_EVENT: + if emitter.scalar_data.multiline { + return false + } + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + + len(emitter.scalar_data.value) + + case yaml_SEQUENCE_START_EVENT: + if !yaml_emitter_check_empty_sequence(emitter) { + return false + } + + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + + case yaml_MAPPING_START_EVENT: + if !yaml_emitter_check_empty_mapping(emitter) { + return false + } + + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + + default: + return false + } + + if length > 128 { + return false + } + + return true +} + +/* + * Determine an acceptable scalar style. + */ + +func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool { + no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 + + if no_tag && !event.implicit && !event.quoted_implicit { + return yaml_emitter_set_emitter_error(emitter, + "neither tag nor implicit flags are specified") + } + + style := yaml_scalar_style_t(event.style) + + if style == yaml_ANY_SCALAR_STYLE { + style = yaml_PLAIN_SCALAR_STYLE + } + + if emitter.canonical { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + + if emitter.simple_key_context && emitter.scalar_data.multiline { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + + if style == yaml_PLAIN_SCALAR_STYLE { + if (emitter.flow_level > 0 && !emitter.scalar_data.flow_plain_allowed) || + (emitter.flow_level == 0 && !emitter.scalar_data.block_plain_allowed) { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + if len(emitter.scalar_data.value) == 0 && + (emitter.flow_level > 0 || emitter.simple_key_context) { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + if no_tag && !event.implicit { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + } + + if style == yaml_SINGLE_QUOTED_SCALAR_STYLE { + if !emitter.scalar_data.single_quoted_allowed { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + } + + if style == yaml_LITERAL_SCALAR_STYLE || style == yaml_FOLDED_SCALAR_STYLE { + if !emitter.scalar_data.block_allowed || + emitter.flow_level > 0 || emitter.simple_key_context { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + } + + if no_tag && !event.quoted_implicit && + style != yaml_PLAIN_SCALAR_STYLE { + emitter.tag_data.handle = []byte("!") + } + + emitter.scalar_data.style = style + + return true +} + +/* + * Write an achor. + */ + +func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool { + if emitter.anchor_data.anchor == nil { + return true + } + + indicator := "*" + if !emitter.anchor_data.alias { + indicator = "&" + } + if !yaml_emitter_write_indicator(emitter, []byte(indicator), true, false, false) { + return false + } + + return yaml_emitter_write_anchor(emitter, emitter.anchor_data.anchor) +} + +/* + * Write a tag. + */ + +func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool { + if len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 { + return true + } + + if len(emitter.tag_data.handle) > 0 { + if !yaml_emitter_write_tag_handle(emitter, emitter.tag_data.handle) { + return false + } + + if len(emitter.tag_data.suffix) > 0 { + if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { + return false + } + + } + } else { + if !yaml_emitter_write_indicator(emitter, []byte("!<"), true, false, false) { + return false + } + + if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { + return false + } + + if !yaml_emitter_write_indicator(emitter, []byte(">"), false, false, false) { + return false + } + + } + + return true +} + +/* + * Write a scalar. + */ + +func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool { + switch emitter.scalar_data.style { + case yaml_PLAIN_SCALAR_STYLE: + return yaml_emitter_write_plain_scalar(emitter, + emitter.scalar_data.value, + !emitter.simple_key_context) + + case yaml_SINGLE_QUOTED_SCALAR_STYLE: + return yaml_emitter_write_single_quoted_scalar(emitter, + emitter.scalar_data.value, + !emitter.simple_key_context) + + case yaml_DOUBLE_QUOTED_SCALAR_STYLE: + return yaml_emitter_write_double_quoted_scalar(emitter, + emitter.scalar_data.value, + !emitter.simple_key_context) + + case yaml_LITERAL_SCALAR_STYLE: + return yaml_emitter_write_literal_scalar(emitter, + emitter.scalar_data.value) + + case yaml_FOLDED_SCALAR_STYLE: + return yaml_emitter_write_folded_scalar(emitter, + emitter.scalar_data.value) + + default: + panic("unknown scalar") + } + + return false +} + +/* + * Check if a %YAML directive is valid. + */ + +func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, + version_directive yaml_version_directive_t) bool { + if version_directive.major != 1 || version_directive.minor != 1 { + return yaml_emitter_set_emitter_error(emitter, + "incompatible %YAML directive") + } + + return true +} + +/* + * Check if a %TAG directive is valid. + */ + +func yaml_emitter_analyze_tag_directive(emitter *yaml_emitter_t, + tag_directive *yaml_tag_directive_t) bool { + handle := tag_directive.handle + prefix := tag_directive.prefix + + if len(handle) == 0 { + return yaml_emitter_set_emitter_error(emitter, + "tag handle must not be empty") + } + + if handle[0] != '!' { + return yaml_emitter_set_emitter_error(emitter, + "tag handle must start with '!'") + } + + if handle[len(handle)-1] != '!' { + return yaml_emitter_set_emitter_error(emitter, + "tag handle must end with '!'") + } + + for i := 1; i < len(handle)-1; width(handle[i]) { + if !is_alpha(handle[i]) { + return yaml_emitter_set_emitter_error(emitter, + "tag handle must contain alphanumerical characters only") + } + } + + if len(prefix) == 0 { + return yaml_emitter_set_emitter_error(emitter, + "tag prefix must not be empty") + } + + return true +} + +/* + * Check if an anchor is valid. + */ + +func yaml_emitter_analyze_anchor(emitter *yaml_emitter_t, + anchor []byte, alias bool) bool { + if len(anchor) == 0 { + errmsg := "alias value must not be empty" + if !alias { + errmsg = "anchor value must not be empty" + } + return yaml_emitter_set_emitter_error(emitter, errmsg) + } + + for i := 0; i < len(anchor); i += width(anchor[i]) { + if !is_alpha(anchor[i]) { + errmsg := "alias value must contain alphanumerical characters only" + if !alias { + errmsg = "anchor value must contain alphanumerical characters only" + } + return yaml_emitter_set_emitter_error(emitter, errmsg) + } + } + + emitter.anchor_data.anchor = anchor + emitter.anchor_data.alias = alias + + return true +} + +/* + * Check if a tag is valid. + */ + +func yaml_emitter_analyze_tag(emitter *yaml_emitter_t, tag []byte) bool { + if len(tag) == 0 { + return yaml_emitter_set_emitter_error(emitter, + "tag value must not be empty") + } + + for i := range emitter.tag_directives { + tag_directive := &emitter.tag_directives[i] + if bytes.HasPrefix(tag, tag_directive.prefix) { + emitter.tag_data.handle = tag_directive.handle + emitter.tag_data.suffix = tag[len(tag_directive.prefix):] + return true + } + } + + emitter.tag_data.suffix = tag + + return true +} + +/* + * Check if a scalar is valid. + */ + +func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool { + block_indicators := false + flow_indicators := false + line_breaks := false + special_characters := false + + leading_space := false + leading_break := false + trailing_space := false + trailing_break := false + break_space := false + space_break := false + + preceeded_by_whitespace := false + followed_by_whitespace := false + previous_space := false + previous_break := false + + emitter.scalar_data.value = value + + if len(value) == 0 { + emitter.scalar_data.multiline = false + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = true + emitter.scalar_data.single_quoted_allowed = true + emitter.scalar_data.block_allowed = false + + return true + } + + if len(value) >= 3 && ((value[0] == '-' && value[1] == '-' && value[2] == '-') || + (value[0] == '.' && value[1] == '.' && value[2] == '.')) { + block_indicators = true + flow_indicators = true + } + + preceeded_by_whitespace = true + + for i, w := 0, 0; i < len(value); i += w { + w = width(value[i]) + followed_by_whitespace = i+w >= len(value) || is_blankz_at(value, w) + + if i == 0 { + switch value[i] { + case '#', ',', '[', ']', '{', '}', '&', '*', '!', '|', '>', '\'', '"', '%', '@', '`': + flow_indicators = true + block_indicators = true + case '?', ':': + flow_indicators = true + if followed_by_whitespace { + block_indicators = true + } + case '-': + if followed_by_whitespace { + flow_indicators = true + block_indicators = true + } + } + } else { + switch value[i] { + case ',', '?', '[', ']', '{', '}': + flow_indicators = true + case ':': + flow_indicators = true + if followed_by_whitespace { + block_indicators = true + } + case '#': + if preceeded_by_whitespace { + flow_indicators = true + block_indicators = true + } + } + } + + if !is_printable_at(value, i) || (!is_ascii(value[i]) && !emitter.unicode) { + special_characters = true + } + + if is_break_at(value, i) { + line_breaks = true + } + + if is_space(value[i]) { + if i == 0 { + leading_space = true + } + if i+w == len(value) { + trailing_space = true + } + if previous_break { + break_space = true + } + previous_space = true + previous_break = false + } else if is_break_at(value, i) { + if i == 0 { + leading_break = true + } + if i+width(value[i]) == len(value) { + trailing_break = true + } + if previous_space { + space_break = true + } + previous_space = false + previous_break = true + } else { + previous_space = false + previous_break = false + } + + preceeded_by_whitespace = is_blankz_at(value, i) + } + + emitter.scalar_data.multiline = line_breaks + + emitter.scalar_data.flow_plain_allowed = true + emitter.scalar_data.block_plain_allowed = true + emitter.scalar_data.single_quoted_allowed = true + emitter.scalar_data.block_allowed = true + + if leading_space || leading_break || trailing_space || trailing_break { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + } + + if trailing_space { + emitter.scalar_data.block_allowed = false + } + + if break_space { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + emitter.scalar_data.single_quoted_allowed = false + } + + if space_break || special_characters { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + emitter.scalar_data.single_quoted_allowed = false + emitter.scalar_data.block_allowed = false + } + + if line_breaks { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + } + + if flow_indicators { + emitter.scalar_data.flow_plain_allowed = false + } + + if block_indicators { + emitter.scalar_data.block_plain_allowed = false + } + + return true +} + +/* + * Check if the event data is valid. + */ + +func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_event_t) bool { + emitter.anchor_data.anchor = nil + emitter.tag_data.handle = nil + emitter.tag_data.suffix = nil + emitter.scalar_data.value = nil + + switch event.event_type { + case yaml_ALIAS_EVENT: + if !yaml_emitter_analyze_anchor(emitter, + event.anchor, true) { + return false + } + + case yaml_SCALAR_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, + event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || + (!event.implicit && + !event.quoted_implicit)) { + if !yaml_emitter_analyze_tag(emitter, event.tag) { + return false + } + } + if !yaml_emitter_analyze_scalar(emitter, event.value) { + return false + } + case yaml_SEQUENCE_START_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, + event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || + !event.implicit) { + if !yaml_emitter_analyze_tag(emitter, + event.tag) { + return false + } + } + case yaml_MAPPING_START_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, + event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || + !event.implicit) { + if !yaml_emitter_analyze_tag(emitter, + event.tag) { + return false + } + } + + } + return true +} + +/* + * Write the BOM character. + */ + +func yaml_emitter_write_bom(emitter *yaml_emitter_t) bool { + if !flush(emitter) { + return false + } + + pos := emitter.buffer_pos + emitter.buffer[pos] = '\xEF' + emitter.buffer[pos+1] = '\xBB' + emitter.buffer[pos+2] = '\xBF' + emitter.buffer_pos += 3 + return true +} + +func yaml_emitter_write_indent(emitter *yaml_emitter_t) bool { + indent := emitter.indent + if indent < 0 { + indent = 0 + } + + if !emitter.indention || emitter.column > indent || + (emitter.column == indent && !emitter.whitespace) { + if !put_break(emitter) { + return false + } + } + + for emitter.column < indent { + if !put(emitter, ' ') { + return false + } + } + + emitter.whitespace = true + emitter.indention = true + + return true +} + +func yaml_emitter_write_indicator(emitter *yaml_emitter_t, + indicator []byte, need_whitespace bool, + is_whitespace bool, is_indention bool) bool { + if need_whitespace && !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + + ind_pos := 0 + for ind_pos < len(indicator) { + if !write(emitter, indicator, &ind_pos) { + return false + } + } + + emitter.whitespace = is_whitespace + emitter.indention = (emitter.indention && is_indention) + emitter.open_ended = false + + return true +} + +func yaml_emitter_write_anchor(emitter *yaml_emitter_t, value []byte) bool { + pos := 0 + for pos < len(value) { + if !write(emitter, value, &pos) { + return false + } + } + + emitter.whitespace = false + emitter.indention = false + + return true +} + +func yaml_emitter_write_tag_handle(emitter *yaml_emitter_t, value []byte) bool { + if !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + + pos := 0 + for pos < len(value) { + if !write(emitter, value, &pos) { + return false + } + } + + emitter.whitespace = false + emitter.indention = false + + return true +} + +func yaml_emitter_write_tag_content(emitter *yaml_emitter_t, value []byte, + need_whitespace bool) bool { + if need_whitespace && !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + + for i := 0; i < len(value); { + write_it := false + switch value[i] { + case ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '_', + '.', '!', '~', '*', '\'', '(', ')', '[', ']': + write_it = true + default: + write_it = is_alpha(value[i]) + } + if write_it { + if !write(emitter, value, &i) { + return false + } + } else { + w := width(value[i]) + for j := 0; j < w; j++ { + val := value[i] + i++ + + if !put(emitter, '%') { + return false + } + c := val >> 4 + if c < 10 { + c += '0' + } else { + c += 'A' - 10 + } + if !put(emitter, c) { + return false + } + + c = val & 0x0f + if c < 10 { + c += '0' + } else { + c += 'A' - 10 + } + if !put(emitter, c) { + return false + } + + } + } + } + + emitter.whitespace = false + emitter.indention = false + + return true +} + +func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []byte, + allow_breaks bool) bool { + spaces := false + breaks := false + + if !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + + for i := 0; i < len(value); { + if is_space(value[i]) { + if allow_breaks && !spaces && + emitter.column > emitter.best_width && + !is_space(value[i+1]) { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + spaces = true + } else if is_break_at(value, i) { + if !breaks && value[i] == '\n' { + if !put_break(emitter) { + return false + } + } + if !write_break(emitter, value, &i) { + return false + } + emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + spaces = false + breaks = false + } + } + + emitter.whitespace = false + emitter.indention = false + if emitter.root_context { + emitter.open_ended = true + } + + return true +} + +func yaml_emitter_write_single_quoted_scalar(emitter *yaml_emitter_t, value []byte, + allow_breaks bool) bool { + spaces := false + breaks := false + + if !yaml_emitter_write_indicator(emitter, []byte("'"), true, false, false) { + return false + } + + for i := 0; i < len(value); { + if is_space(value[i]) { + if allow_breaks && !spaces && + emitter.column > emitter.best_width && + i > 0 && i < len(value)-1 && + !is_space(value[i+1]) { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + spaces = true + } else if is_break_at(value, i) { + if !breaks && value[i] == '\n' { + if !put_break(emitter) { + return false + } + } + if !write_break(emitter, value, &i) { + return false + } + emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if value[i] == '\'' { + if !put(emitter, '\'') { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + spaces = false + breaks = false + } + } + + if !yaml_emitter_write_indicator(emitter, []byte("'"), false, false, false) { + return false + } + + emitter.whitespace = false + emitter.indention = false + + return true +} + +func yaml_emitter_write_double_quoted_scalar(emitter *yaml_emitter_t, value []byte, + allow_breaks bool) bool { + + spaces := false + + if !yaml_emitter_write_indicator(emitter, []byte("\""), true, false, false) { + return false + } + + for i := 0; i < len(value); { + if !is_printable_at(value, i) || (!emitter.unicode && !is_ascii(value[i])) || + is_bom_at(value, i) || is_break_at(value, i) || + value[i] == '"' || value[i] == '\\' { + octet := value[i] + + var w int + var v rune + switch { + case octet&0x80 == 0x00: + w, v = 1, rune(octet&0x7F) + case octet&0xE0 == 0xC0: + w, v = 2, rune(octet&0x1F) + case octet&0xF0 == 0xE0: + w, v = 3, rune(octet&0x0F) + case octet&0xF8 == 0xF0: + w, v = 4, rune(octet&0x07) + } + + for k := 1; k < w; k++ { + octet = value[i+k] + v = (v << 6) + (rune(octet) & 0x3F) + } + i += w + + if !put(emitter, '\\') { + return false + } + + switch v { + case 0x00: + if !put(emitter, '0') { + return false + } + case 0x07: + if !put(emitter, 'a') { + return false + } + case 0x08: + if !put(emitter, 'b') { + return false + } + case 0x09: + if !put(emitter, 't') { + return false + } + + case 0x0A: + if !put(emitter, 'n') { + return false + } + + case 0x0B: + if !put(emitter, 'v') { + return false + } + + case 0x0C: + if !put(emitter, 'f') { + return false + } + + case 0x0D: + if !put(emitter, 'r') { + return false + } + + case 0x1B: + if !put(emitter, 'e') { + return false + } + case 0x22: + if !put(emitter, '"') { + return false + } + case 0x5C: + if !put(emitter, '\\') { + return false + } + case 0x85: + if !put(emitter, 'N') { + return false + } + + case 0xA0: + if !put(emitter, '_') { + return false + } + + case 0x2028: + if !put(emitter, 'L') { + return false + } + + case 0x2029: + if !put(emitter, 'P') { + return false + } + default: + if v <= 0xFF { + if !put(emitter, 'x') { + return false + } + w = 2 + } else if v <= 0xFFFF { + if !put(emitter, 'u') { + return false + } + w = 4 + } else { + if !put(emitter, 'U') { + return false + } + w = 8 + } + for k := (w - 1) * 4; k >= 0; k -= 4 { + digit := byte((v >> uint(k)) & 0x0F) + c := digit + '0' + if c > 9 { + c = digit + 'A' - 10 + } + if !put(emitter, c) { + return false + } + } + } + spaces = false + } else if is_space(value[i]) { + if allow_breaks && !spaces && + emitter.column > emitter.best_width && + i > 0 && i < len(value)-1 { + if !yaml_emitter_write_indent(emitter) { + return false + } + if is_space(value[i+1]) { + if !put(emitter, '\\') { + return false + } + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + spaces = true + } else { + if !write(emitter, value, &i) { + return false + } + spaces = false + } + } + + if !yaml_emitter_write_indicator(emitter, []byte("\""), false, false, false) { + return false + } + + emitter.whitespace = false + emitter.indention = false + + return true +} + +func yaml_emitter_write_block_scalar_hints(emitter *yaml_emitter_t, value []byte) bool { + + if is_space(value[0]) || is_break_at(value, 0) { + indent_hint := []byte{'0' + byte(emitter.best_indent)} + if !yaml_emitter_write_indicator(emitter, indent_hint, false, false, false) { + return false + } + } + + emitter.open_ended = false + + var chomp_hint [1]byte + if len(value) == 0 { + chomp_hint[0] = '-' + } else { + i := len(value) - 1 + for value[i]&0xC0 == 0x80 { + i-- + } + + if !is_break_at(value, i) { + chomp_hint[0] = '-' + } else if i == 0 { + chomp_hint[0] = '+' + emitter.open_ended = true + } else { + for value[i]&0xC0 == 0x80 { + i-- + } + + if is_break_at(value, i) { + chomp_hint[0] = '+' + emitter.open_ended = true + } + } + } + + if chomp_hint[0] != 0 { + if !yaml_emitter_write_indicator(emitter, chomp_hint[:], false, false, false) { + return false + } + } + + return true +} + +func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bool { + + breaks := true + + if !yaml_emitter_write_indicator(emitter, []byte("|"), true, false, false) { + return false + } + + if !yaml_emitter_write_block_scalar_hints(emitter, value) { + return false + } + + if !put_break(emitter) { + return false + } + + emitter.indention = true + emitter.whitespace = true + + for i := 0; i < len(value); { + if is_break_at(value, i) { + if !write_break(emitter, value, &i) { + return false + } + emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + breaks = false + } + } + + return true +} + +func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) bool { + breaks := true + leading_spaces := true + + if !yaml_emitter_write_indicator(emitter, []byte(">"), true, false, false) { + return false + } + if !yaml_emitter_write_block_scalar_hints(emitter, value) { + return false + } + if !put_break(emitter) { + return false + } + emitter.indention = true + emitter.whitespace = true + + for i := 0; i < len(value); { + if is_break_at(value, i) { + if !breaks && !leading_spaces && value[i] == '\n' { + k := i + for is_break_at(value, k) { + k += width(value[k]) + } + if !is_blankz_at(value, k) { + if !put_break(emitter) { + return false + } + } + } + if !write_break(emitter, value, &i) { + return false + } + emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + leading_spaces = is_blank(value[i]) + } + if !breaks && is_space(value[i]) && !is_space(value[i+1]) && + emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + emitter.indention = false + breaks = false + } + } + + return true +} diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/encode.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/encode.go new file mode 100644 index 00000000..fd991808 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/encode.go @@ -0,0 +1,395 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "bytes" + "encoding/base64" + "io" + "math" + "reflect" + "regexp" + "sort" + "strconv" + "time" +) + +var ( + timeTimeType = reflect.TypeOf(time.Time{}) + marshalerType = reflect.TypeOf(new(Marshaler)).Elem() + numberType = reflect.TypeOf(Number("")) + nonPrintable = regexp.MustCompile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFD]") + multiline = regexp.MustCompile("\n|\u0085|\u2028|\u2029") + + shortTags = map[string]string{ + yaml_NULL_TAG: "!!null", + yaml_BOOL_TAG: "!!bool", + yaml_STR_TAG: "!!str", + yaml_INT_TAG: "!!int", + yaml_FLOAT_TAG: "!!float", + yaml_TIMESTAMP_TAG: "!!timestamp", + yaml_SEQ_TAG: "!!seq", + yaml_MAP_TAG: "!!map", + yaml_BINARY_TAG: "!!binary", + } +) + +type Marshaler interface { + MarshalYAML() (tag string, value interface{}, err error) +} + +// An Encoder writes JSON objects to an output stream. +type Encoder struct { + w io.Writer + emitter yaml_emitter_t + event yaml_event_t + flow bool + err error +} + +func Marshal(v interface{}) ([]byte, error) { + b := bytes.Buffer{} + e := NewEncoder(&b) + err := e.Encode(v) + return b.Bytes(), err +} + +// NewEncoder returns a new encoder that writes to w. +func NewEncoder(w io.Writer) *Encoder { + e := &Encoder{w: w} + yaml_emitter_initialize(&e.emitter) + yaml_emitter_set_output_writer(&e.emitter, e.w) + yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING) + e.emit() + yaml_document_start_event_initialize(&e.event, nil, nil, true) + e.emit() + + return e +} + +func (e *Encoder) Encode(v interface{}) (err error) { + defer recovery(&err) + + if e.err != nil { + return e.err + } + + e.marshal("", reflect.ValueOf(v), true) + + yaml_document_end_event_initialize(&e.event, true) + e.emit() + e.emitter.open_ended = false + yaml_stream_end_event_initialize(&e.event) + e.emit() + + return nil +} + +func (e *Encoder) emit() { + if !yaml_emitter_emit(&e.emitter, &e.event) { + panic("bad emit") + } +} + +func (e *Encoder) marshal(tag string, v reflect.Value, allowAddr bool) { + vt := v.Type() + + if vt.Implements(marshalerType) { + e.emitMarshaler(tag, v) + return + } + + if vt.Kind() != reflect.Ptr && allowAddr { + if reflect.PtrTo(vt).Implements(marshalerType) { + e.emitAddrMarshaler(tag, v) + return + } + } + + switch v.Kind() { + case reflect.Interface: + if v.IsNil() { + e.emitNil() + } else { + e.marshal(tag, v.Elem(), allowAddr) + } + case reflect.Map: + e.emitMap(tag, v) + case reflect.Ptr: + if v.IsNil() { + e.emitNil() + } else { + e.marshal(tag, v.Elem(), true) + } + case reflect.Struct: + e.emitStruct(tag, v) + case reflect.Slice: + e.emitSlice(tag, v) + case reflect.String: + e.emitString(tag, v) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + e.emitInt(tag, v) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + e.emitUint(tag, v) + case reflect.Float32, reflect.Float64: + e.emitFloat(tag, v) + case reflect.Bool: + e.emitBool(tag, v) + default: + panic("Can't marshal type yet: " + v.Type().String()) + } +} + +func (e *Encoder) emitMap(tag string, v reflect.Value) { + e.mapping(tag, func() { + var keys stringValues = v.MapKeys() + sort.Sort(keys) + for _, k := range keys { + e.marshal("", k, true) + e.marshal("", v.MapIndex(k), true) + } + }) +} + +func (e *Encoder) emitStruct(tag string, v reflect.Value) { + if v.Type() == timeTimeType { + e.emitTime(tag, v) + return + } + + fields := cachedTypeFields(v.Type()) + + e.mapping(tag, func() { + for _, f := range fields { + fv := fieldByIndex(v, f.index) + if !fv.IsValid() || f.omitEmpty && isEmptyValue(fv) { + continue + } + + e.marshal("", reflect.ValueOf(f.name), true) + e.flow = f.flow + e.marshal("", fv, true) + } + }) +} + +func (e *Encoder) emitTime(tag string, v reflect.Value) { + t := v.Interface().(time.Time) + bytes, _ := t.MarshalText() + e.emitScalar(string(bytes), "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func isEmptyValue(v reflect.Value) bool { + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + } + return false +} + +func (e *Encoder) mapping(tag string, f func()) { + implicit := tag == "" + style := yaml_BLOCK_MAPPING_STYLE + if e.flow { + e.flow = false + style = yaml_FLOW_MAPPING_STYLE + } + yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style) + e.emit() + + f() + + yaml_mapping_end_event_initialize(&e.event) + e.emit() +} + +func (e *Encoder) emitSlice(tag string, v reflect.Value) { + if v.Type() == byteSliceType { + e.emitBase64(tag, v) + return + } + + implicit := tag == "" + style := yaml_BLOCK_SEQUENCE_STYLE + if e.flow { + e.flow = false + style = yaml_FLOW_SEQUENCE_STYLE + } + yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style) + e.emit() + + n := v.Len() + for i := 0; i < n; i++ { + e.marshal("", v.Index(i), true) + } + + yaml_sequence_end_event_initialize(&e.event) + e.emit() +} + +func (e *Encoder) emitBase64(tag string, v reflect.Value) { + if v.IsNil() { + e.emitNil() + return + } + + s := v.Bytes() + + dst := make([]byte, base64.StdEncoding.EncodedLen(len(s))) + + base64.StdEncoding.Encode(dst, s) + e.emitScalar(string(dst), "", yaml_BINARY_TAG, yaml_DOUBLE_QUOTED_SCALAR_STYLE) +} + +func (e *Encoder) emitString(tag string, v reflect.Value) { + var style yaml_scalar_style_t + s := v.String() + + if nonPrintable.MatchString(s) { + e.emitBase64(tag, v) + return + } + + if v.Type() == numberType { + style = yaml_PLAIN_SCALAR_STYLE + } else { + event := yaml_event_t{ + implicit: true, + value: []byte(s), + } + + rtag, _ := resolveInterface(event, false) + if tag == "" && rtag != yaml_STR_TAG { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } else if multiline.MatchString(s) { + style = yaml_LITERAL_SCALAR_STYLE + } else { + style = yaml_PLAIN_SCALAR_STYLE + } + } + + e.emitScalar(s, "", tag, style) +} + +func (e *Encoder) emitBool(tag string, v reflect.Value) { + s := strconv.FormatBool(v.Bool()) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func (e *Encoder) emitInt(tag string, v reflect.Value) { + s := strconv.FormatInt(v.Int(), 10) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func (e *Encoder) emitUint(tag string, v reflect.Value) { + s := strconv.FormatUint(v.Uint(), 10) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func (e *Encoder) emitFloat(tag string, v reflect.Value) { + f := v.Float() + + var s string + switch { + case math.IsNaN(f): + s = ".nan" + case math.IsInf(f, 1): + s = "+.inf" + case math.IsInf(f, -1): + s = "-.inf" + default: + s = strconv.FormatFloat(f, 'g', -1, v.Type().Bits()) + } + + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func (e *Encoder) emitNil() { + e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE) +} + +func (e *Encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t) { + implicit := tag == "" + if !implicit { + style = yaml_PLAIN_SCALAR_STYLE + } + + stag := shortTags[tag] + if stag == "" { + stag = tag + } + + yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(stag), []byte(value), implicit, implicit, style) + e.emit() +} + +func (e *Encoder) emitMarshaler(tag string, v reflect.Value) { + if v.Kind() == reflect.Ptr && v.IsNil() { + e.emitNil() + return + } + + m := v.Interface().(Marshaler) + if m == nil { + e.emitNil() + return + } + t, val, err := m.MarshalYAML() + if err != nil { + panic(err) + } + if val == nil { + e.emitNil() + return + } + + e.marshal(t, reflect.ValueOf(val), false) +} + +func (e *Encoder) emitAddrMarshaler(tag string, v reflect.Value) { + if !v.CanAddr() { + e.marshal(tag, v, false) + return + } + + va := v.Addr() + if va.IsNil() { + e.emitNil() + return + } + + m := v.Interface().(Marshaler) + t, val, err := m.MarshalYAML() + if err != nil { + panic(err) + } + + if val == nil { + e.emitNil() + return + } + + e.marshal(t, reflect.ValueOf(val), false) +} diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/encode_test.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/encode_test.go new file mode 100644 index 00000000..d8c2aa81 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/encode_test.go @@ -0,0 +1,618 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "bytes" + "errors" + "math" + "time" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Encode", func() { + var buf *bytes.Buffer + var enc *Encoder + + BeforeEach(func() { + buf = &bytes.Buffer{} + enc = NewEncoder(buf) + }) + + Context("Scalars", func() { + It("handles strings", func() { + err := enc.Encode("abc") + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`abc +`)) + + }) + + It("handles really short strings", func() { + err := enc.Encode(".") + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`. +`)) + + }) + + It("encodes strings with multilines", func() { + err := enc.Encode("a\nc") + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`|- + a + c +`)) + + }) + + It("handles strings that match known scalars", func() { + err := enc.Encode("true") + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`"true" +`)) + + }) + + Context("handles ints", func() { + It("handles ints", func() { + err := enc.Encode(13) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal("13\n")) + }) + + It("handles uints", func() { + err := enc.Encode(uint64(1)) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal("1\n")) + }) + }) + + Context("handles floats", func() { + It("handles float32", func() { + err := enc.Encode(float32(1.234)) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal("1.234\n")) + + }) + + It("handles float64", func() { + err := enc.Encode(float64(1.2e23)) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal("1.2e+23\n")) + }) + + It("handles NaN", func() { + err := enc.Encode(math.NaN()) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(".nan\n")) + }) + + It("handles infinity", func() { + err := enc.Encode(math.Inf(-1)) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal("-.inf\n")) + }) + }) + + It("handles bools", func() { + err := enc.Encode(true) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal("true\n")) + }) + + It("handles time.Time", func() { + t := time.Now() + err := enc.Encode(t) + Expect(err).NotTo(HaveOccurred()) + bytes, _ := t.MarshalText() + Expect(buf.String()).To(Equal(string(bytes) + "\n")) + }) + + Context("Null", func() { + It("fails on nil", func() { + err := enc.Encode(nil) + Expect(err).To(HaveOccurred()) + }) + }) + + It("handles []byte", func() { + err := enc.Encode([]byte{'a', 'b', 'c'}) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal("!!binary YWJj\n")) + }) + + Context("Ptrs", func() { + It("handles ptr of a type", func() { + p := new(int) + *p = 10 + err := enc.Encode(p) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal("10\n")) + }) + + It("handles nil ptr", func() { + var p *int + err := enc.Encode(p) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal("null\n")) + }) + }) + + Context("Structs", func() { + It("handles simple structs", func() { + type batter struct { + Name string + HR int64 + AVG float64 + } + + batters := []batter{ + batter{Name: "Mark McGwire", HR: 65, AVG: 0.278}, + batter{Name: "Sammy Sosa", HR: 63, AVG: 0.288}, + } + err := enc.Encode(batters) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`- Name: Mark McGwire + HR: 65 + AVG: 0.278 +- Name: Sammy Sosa + HR: 63 + AVG: 0.288 +`)) + + }) + + It("handles tagged structs", func() { + type batter struct { + Name string `yaml:"name"` + HR int64 + AVG float64 `yaml:"avg"` + } + + batters := []batter{ + batter{Name: "Mark McGwire", HR: 65, AVG: 0.278}, + batter{Name: "Sammy Sosa", HR: 63, AVG: 0.288}, + } + err := enc.Encode(batters) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`- name: Mark McGwire + HR: 65 + avg: 0.278 +- name: Sammy Sosa + HR: 63 + avg: 0.288 +`)) + + }) + + It("handles nested structs", func() { + type nestedConfig struct { + AString string `yaml:"str"` + Integer int `yaml:"int"` + } + type config struct { + TopString string + Nested nestedConfig + } + + cfg := config{ + TopString: "def", + Nested: nestedConfig{ + AString: "abc", + Integer: 123, + }, + } + + err := enc.Encode(cfg) + Expect(err).NotTo(HaveOccurred()) + + Expect(buf.String()).To(Equal(`TopString: def +Nested: + str: abc + int: 123 +`)) + + }) + + It("handles inline structs", func() { + type NestedConfig struct { + AString string `yaml:"str"` + Integer int `yaml:"int"` + } + type config struct { + TopString string + NestedConfig + } + + cfg := config{ + TopString: "def", + NestedConfig: NestedConfig{ + AString: "abc", + Integer: 123, + }, + } + + err := enc.Encode(cfg) + Expect(err).NotTo(HaveOccurred()) + + Expect(buf.String()).To(Equal(`TopString: def +str: abc +int: 123 +`)) + + }) + + It("handles inline structs with conflicts", func() { + type NestedConfig struct { + AString string `yaml:"str"` + Integer int `yaml:"int"` + } + type config struct { + AString string `yaml:"str"` + NestedConfig + } + + cfg := config{ + AString: "def", + NestedConfig: NestedConfig{ + AString: "abc", + Integer: 123, + }, + } + + err := enc.Encode(cfg) + Expect(err).NotTo(HaveOccurred()) + + Expect(buf.String()).To(Equal(`str: def +int: 123 +`)) + + }) + + }) + + }) + + Context("Sequence", func() { + It("handles slices", func() { + val := []string{"a", "b", "c"} + err := enc.Encode(val) + Expect(err).NotTo(HaveOccurred()) + + Expect(buf.String()).To(Equal(`- a +- b +- c +`)) + + }) + }) + + Context("Maps", func() { + It("Decodes simple maps", func() { + err := enc.Encode(&map[string]string{ + "name": "Mark McGwire", + "hr": "65", + "avg": "0.278", + }) + Expect(err).NotTo(HaveOccurred()) + + Expect(buf.String()).To(Equal(`avg: "0.278" +hr: "65" +name: Mark McGwire +`)) + + }) + + It("Decodes mix types", func() { + err := enc.Encode(&map[string]interface{}{ + "name": "Mark McGwire", + "hr": 65, + "avg": 0.278, + }) + Expect(err).NotTo(HaveOccurred()) + + Expect(buf.String()).To(Equal(`avg: 0.278 +hr: 65 +name: Mark McGwire +`)) + + }) + }) + + Context("Sequence of Maps", func() { + It("decodes", func() { + err := enc.Encode([]map[string]interface{}{ + {"name": "Mark McGwire", + "hr": 65, + "avg": 0.278, + }, + {"name": "Sammy Sosa", + "hr": 63, + "avg": 0.288, + }, + }) + Expect(err).NotTo(HaveOccurred()) + + Expect(buf.String()).To(Equal(`- avg: 0.278 + hr: 65 + name: Mark McGwire +- avg: 0.288 + hr: 63 + name: Sammy Sosa +`)) + + }) + }) + + Context("Maps of Sequence", func() { + It("decodes", func() { + err := enc.Encode(map[string][]interface{}{ + "name": []interface{}{"Mark McGwire", "Sammy Sosa"}, + "hr": []interface{}{65, 63}, + "avg": []interface{}{0.278, 0.288}, + }) + Expect(err).NotTo(HaveOccurred()) + + Expect(buf.String()).To(Equal(`avg: +- 0.278 +- 0.288 +hr: +- 65 +- 63 +name: +- Mark McGwire +- Sammy Sosa +`)) + + }) + }) + + Context("Flow", func() { + It("flows structs", func() { + type i struct { + A string + } + type o struct { + I i `yaml:"i,flow"` + } + + err := enc.Encode(o{ + I: i{A: "abc"}, + }) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`i: {A: abc} +`)) + + }) + + It("flows sequences", func() { + type i struct { + A string + } + type o struct { + I []i `yaml:"i,flow"` + } + + err := enc.Encode(o{ + I: []i{{A: "abc"}}, + }) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`i: [{A: abc}] +`)) + + }) + }) + + Context("Omit empty", func() { + It("omits nil ptrs", func() { + type i struct { + A *string `yaml:"a,omitempty"` + } + type o struct { + I []i `yaml:"i,flow"` + } + + err := enc.Encode(o{ + I: []i{{A: nil}}, + }) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`i: [{}] +`)) + + }) + + }) + + Context("Skip field", func() { + It("does not include the field", func() { + type a struct { + B string `yaml:"-"` + C string + } + + err := enc.Encode(a{B: "b", C: "c"}) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`C: c +`)) + + }) + }) + + Context("Marshaler support", func() { + Context("Receiver is a value", func() { + It("uses the Marshaler interface when a value", func() { + err := enc.Encode(hasMarshaler{Value: 123}) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal("123\n")) + }) + + It("uses the Marshaler interface when a pointer", func() { + err := enc.Encode(&hasMarshaler{Value: "abc"}) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`abc +`)) + }) + + Context("when it fails", func() { + It("returns an error", func() { + err := enc.Encode(&hasMarshaler{Value: "abc", Error: errors.New("fail")}) + Expect(err).To(MatchError("fail")) + }) + }) + }) + + Context("Receiver is a pointer", func() { + It("uses the Marshaler interface when a pointer", func() { + err := enc.Encode(&hasPtrMarshaler{Value: map[string]string{"a": "b"}}) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`a: b +`)) + + }) + + It("skips the Marshaler when its a value", func() { + err := enc.Encode(hasPtrMarshaler{Value: map[string]string{"a": "b"}}) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`Tag: "" +Value: + a: b +Error: null +`)) + + }) + + Context("the receiver is nil", func() { + var ptr *hasPtrMarshaler + + Context("when it fails", func() { + It("returns an error", func() { + err := enc.Encode(&hasPtrMarshaler{Value: "abc", Error: errors.New("fail")}) + Expect(err).To(MatchError("fail")) + }) + }) + + It("returns a null", func() { + err := enc.Encode(ptr) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`null +`)) + + }) + + It("returns a null value for ptr types", func() { + err := enc.Encode(map[string]*hasPtrMarshaler{"a": ptr}) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`a: null +`)) + + }) + + It("panics when used as a nil interface", func() { + Expect(func() { enc.Encode(map[string]Marshaler{"a": ptr}) }).To(Panic()) + }) + }) + + Context("the receiver has a nil value", func() { + ptr := &hasPtrMarshaler{Value: nil} + + It("returns null", func() { + err := enc.Encode(ptr) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`null +`)) + + }) + + Context("in a map", func() { + It("returns a null value for ptr types", func() { + err := enc.Encode(map[string]*hasPtrMarshaler{"a": ptr}) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`a: null +`)) + + }) + + It("returns a null value for interface types", func() { + err := enc.Encode(map[string]Marshaler{"a": ptr}) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`a: null +`)) + + }) + }) + + Context("in a slice", func() { + It("returns a null value for ptr types", func() { + err := enc.Encode([]*hasPtrMarshaler{ptr}) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`- null +`)) + + }) + + It("returns a null value for interface types", func() { + err := enc.Encode([]Marshaler{ptr}) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal(`- null +`)) + + }) + }) + }) + }) + }) + + Context("Number type", func() { + It("encodes as a number", func() { + n := Number("12345") + err := enc.Encode(n) + Expect(err).NotTo(HaveOccurred()) + Expect(buf.String()).To(Equal("12345\n")) + }) + }) +}) + +type hasMarshaler struct { + Value interface{} + Error error +} + +func (m hasMarshaler) MarshalYAML() (string, interface{}, error) { + return "", m.Value, m.Error +} + +func (m hasMarshaler) UnmarshalYAML(tag string, value interface{}) error { + m.Value = value + return nil +} + +type hasPtrMarshaler struct { + Tag string + Value interface{} + Error error +} + +func (m *hasPtrMarshaler) MarshalYAML() (string, interface{}, error) { + return "", m.Value, m.Error +} + +func (m *hasPtrMarshaler) UnmarshalYAML(tag string, value interface{}) error { + m.Tag = tag + m.Value = value + return nil +} diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/libyaml-LICENSE b/vendor/github.com/cloudfoundry-incubator/candiedyaml/libyaml-LICENSE new file mode 100644 index 00000000..050ced23 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/libyaml-LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2006 Kirill Simonov + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/parser.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/parser.go new file mode 100644 index 00000000..8d38e306 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/parser.go @@ -0,0 +1,1230 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "bytes" +) + +/* + * The parser implements the following grammar: + * + * stream ::= STREAM-START implicit_document? explicit_document* STREAM-END + * implicit_document ::= block_node DOCUMENT-END* + * explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* + * block_node_or_indentless_sequence ::= + * ALIAS + * | properties (block_content | indentless_block_sequence)? + * | block_content + * | indentless_block_sequence + * block_node ::= ALIAS + * | properties block_content? + * | block_content + * flow_node ::= ALIAS + * | properties flow_content? + * | flow_content + * properties ::= TAG ANCHOR? | ANCHOR TAG? + * block_content ::= block_collection | flow_collection | SCALAR + * flow_content ::= flow_collection | SCALAR + * block_collection ::= block_sequence | block_mapping + * flow_collection ::= flow_sequence | flow_mapping + * block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END + * indentless_sequence ::= (BLOCK-ENTRY block_node?)+ + * block_mapping ::= BLOCK-MAPPING_START + * ((KEY block_node_or_indentless_sequence?)? + * (VALUE block_node_or_indentless_sequence?)?)* + * BLOCK-END + * flow_sequence ::= FLOW-SEQUENCE-START + * (flow_sequence_entry FLOW-ENTRY)* + * flow_sequence_entry? + * FLOW-SEQUENCE-END + * flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + * flow_mapping ::= FLOW-MAPPING-START + * (flow_mapping_entry FLOW-ENTRY)* + * flow_mapping_entry? + * FLOW-MAPPING-END + * flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + */ + +/* + * Peek the next token in the token queue. + */ +func peek_token(parser *yaml_parser_t) *yaml_token_t { + if parser.token_available || yaml_parser_fetch_more_tokens(parser) { + return &parser.tokens[parser.tokens_head] + } + return nil +} + +/* + * Remove the next token from the queue (must be called after peek_token). + */ +func skip_token(parser *yaml_parser_t) { + parser.token_available = false + parser.tokens_parsed++ + parser.stream_end_produced = parser.tokens[parser.tokens_head].token_type == yaml_STREAM_END_TOKEN + parser.tokens_head++ +} + +/* + * Get the next event. + */ + +func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool { + /* Erase the event object. */ + *event = yaml_event_t{} + + /* No events after the end of the stream or error. */ + + if parser.stream_end_produced || parser.error != yaml_NO_ERROR || + parser.state == yaml_PARSE_END_STATE { + return true + } + + /* Generate the next event. */ + + return yaml_parser_state_machine(parser, event) +} + +/* + * Set parser error. + */ + +func yaml_parser_set_parser_error(parser *yaml_parser_t, + problem string, problem_mark YAML_mark_t) bool { + parser.error = yaml_PARSER_ERROR + parser.problem = problem + parser.problem_mark = problem_mark + + return false +} + +func yaml_parser_set_parser_error_context(parser *yaml_parser_t, + context string, context_mark YAML_mark_t, + problem string, problem_mark YAML_mark_t) bool { + parser.error = yaml_PARSER_ERROR + parser.context = context + parser.context_mark = context_mark + parser.problem = problem + parser.problem_mark = problem_mark + + return false +} + +/* + * State dispatcher. + */ + +func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool { + switch parser.state { + case yaml_PARSE_STREAM_START_STATE: + return yaml_parser_parse_stream_start(parser, event) + + case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: + return yaml_parser_parse_document_start(parser, event, true) + + case yaml_PARSE_DOCUMENT_START_STATE: + return yaml_parser_parse_document_start(parser, event, false) + + case yaml_PARSE_DOCUMENT_CONTENT_STATE: + return yaml_parser_parse_document_content(parser, event) + + case yaml_PARSE_DOCUMENT_END_STATE: + return yaml_parser_parse_document_end(parser, event) + + case yaml_PARSE_BLOCK_NODE_STATE: + return yaml_parser_parse_node(parser, event, true, false) + + case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: + return yaml_parser_parse_node(parser, event, true, true) + + case yaml_PARSE_FLOW_NODE_STATE: + return yaml_parser_parse_node(parser, event, false, false) + + case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: + return yaml_parser_parse_block_sequence_entry(parser, event, true) + + case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_block_sequence_entry(parser, event, false) + + case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_indentless_sequence_entry(parser, event) + + case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: + return yaml_parser_parse_block_mapping_key(parser, event, true) + + case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: + return yaml_parser_parse_block_mapping_key(parser, event, false) + + case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: + return yaml_parser_parse_block_mapping_value(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: + return yaml_parser_parse_flow_sequence_entry(parser, event, true) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_flow_sequence_entry(parser, event, false) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event) + + case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: + return yaml_parser_parse_flow_mapping_key(parser, event, true) + + case yaml_PARSE_FLOW_MAPPING_KEY_STATE: + return yaml_parser_parse_flow_mapping_key(parser, event, false) + + case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: + return yaml_parser_parse_flow_mapping_value(parser, event, false) + + case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: + return yaml_parser_parse_flow_mapping_value(parser, event, true) + } + + panic("invalid parser state") +} + +/* + * Parse the production: + * stream ::= STREAM-START implicit_document? explicit_document* STREAM-END + * ************ + */ + +func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + if token.token_type != yaml_STREAM_START_TOKEN { + return yaml_parser_set_parser_error(parser, + "did not find expected ", token.start_mark) + } + + parser.state = yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE + *event = yaml_event_t{ + event_type: yaml_STREAM_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + encoding: token.encoding, + } + skip_token(parser) + + return true +} + +/* + * Parse the productions: + * implicit_document ::= block_node DOCUMENT-END* + * * + * explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* + * ************************* + */ + +func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, + implicit bool) bool { + + token := peek_token(parser) + if token == nil { + return false + } + + /* Parse extra document end indicators. */ + + if !implicit { + for token.token_type == yaml_DOCUMENT_END_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } + + /* Parse an implicit document. */ + + if implicit && token.token_type != yaml_VERSION_DIRECTIVE_TOKEN && + token.token_type != yaml_TAG_DIRECTIVE_TOKEN && + token.token_type != yaml_DOCUMENT_START_TOKEN && + token.token_type != yaml_STREAM_END_TOKEN { + if !yaml_parser_process_directives(parser, nil, nil) { + return false + } + + parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) + parser.state = yaml_PARSE_BLOCK_NODE_STATE + + *event = yaml_event_t{ + event_type: yaml_DOCUMENT_START_EVENT, + implicit: true, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + } else if token.token_type != yaml_STREAM_END_TOKEN { + /* Parse an explicit document. */ + var version_directive *yaml_version_directive_t + var tag_directives []yaml_tag_directive_t + + start_mark := token.start_mark + if !yaml_parser_process_directives(parser, &version_directive, + &tag_directives) { + return false + } + token = peek_token(parser) + if token == nil { + return false + } + if token.token_type != yaml_DOCUMENT_START_TOKEN { + yaml_parser_set_parser_error(parser, + "did not find expected ", token.start_mark) + return false + } + + parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) + parser.state = yaml_PARSE_DOCUMENT_CONTENT_STATE + + end_mark := token.end_mark + + *event = yaml_event_t{ + event_type: yaml_DOCUMENT_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + version_directive: version_directive, + tag_directives: tag_directives, + implicit: false, + } + skip_token(parser) + } else { + /* Parse the stream end. */ + parser.state = yaml_PARSE_END_STATE + + *event = yaml_event_t{ + event_type: yaml_STREAM_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + skip_token(parser) + } + return true +} + +/* + * Parse the productions: + * explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* + * *********** + */ + +func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + if token.token_type == yaml_VERSION_DIRECTIVE_TOKEN || + token.token_type == yaml_TAG_DIRECTIVE_TOKEN || + token.token_type == yaml_DOCUMENT_START_TOKEN || + token.token_type == yaml_DOCUMENT_END_TOKEN || + token.token_type == yaml_STREAM_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + return yaml_parser_process_empty_scalar(parser, event, + token.start_mark) + } else { + return yaml_parser_parse_node(parser, event, true, false) + } +} + +/* + * Parse the productions: + * implicit_document ::= block_node DOCUMENT-END* + * ************* + * explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* + * ************* + */ + +func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { + implicit := true + + token := peek_token(parser) + if token == nil { + return false + } + + start_mark, end_mark := token.start_mark, token.start_mark + + if token.token_type == yaml_DOCUMENT_END_TOKEN { + end_mark = token.end_mark + skip_token(parser) + implicit = false + } + + parser.tag_directives = parser.tag_directives[:0] + + parser.state = yaml_PARSE_DOCUMENT_START_STATE + *event = yaml_event_t{ + event_type: yaml_DOCUMENT_END_EVENT, + start_mark: start_mark, + end_mark: end_mark, + implicit: implicit, + } + + return true +} + +/* + * Parse the productions: + * block_node_or_indentless_sequence ::= + * ALIAS + * ***** + * | properties (block_content | indentless_block_sequence)? + * ********** * + * | block_content | indentless_block_sequence + * * + * block_node ::= ALIAS + * ***** + * | properties block_content? + * ********** * + * | block_content + * * + * flow_node ::= ALIAS + * ***** + * | properties flow_content? + * ********** * + * | flow_content + * * + * properties ::= TAG ANCHOR? | ANCHOR TAG? + * ************************* + * block_content ::= block_collection | flow_collection | SCALAR + * ****** + * flow_content ::= flow_collection | SCALAR + * ****** + */ + +func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, + block bool, indentless_sequence bool) bool { + + token := peek_token(parser) + if token == nil { + return false + } + + if token.token_type == yaml_ALIAS_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + event_type: yaml_ALIAS_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + anchor: token.value, + } + skip_token(parser) + return true + } else { + start_mark, end_mark := token.start_mark, token.start_mark + + var tag_handle []byte + var tag_suffix, anchor []byte + var tag_mark YAML_mark_t + if token.token_type == yaml_ANCHOR_TOKEN { + anchor = token.value + start_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.token_type == yaml_TAG_TOKEN { + tag_handle = token.value + tag_suffix = token.suffix + tag_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } else if token.token_type == yaml_TAG_TOKEN { + tag_handle = token.value + tag_suffix = token.suffix + start_mark, tag_mark = token.start_mark, token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.token_type == yaml_ANCHOR_TOKEN { + anchor = token.value + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + + } + } + + var tag []byte + if tag_handle != nil { + if len(tag_handle) == 0 { + tag = tag_suffix + tag_handle = nil + tag_suffix = nil + } else { + for i := range parser.tag_directives { + tag_directive := &parser.tag_directives[i] + if bytes.Equal(tag_directive.handle, tag_handle) { + tag = append([]byte(nil), tag_directive.prefix...) + tag = append(tag, tag_suffix...) + tag_handle = nil + tag_suffix = nil + break + } + } + if len(tag) == 0 { + yaml_parser_set_parser_error_context(parser, + "while parsing a node", start_mark, + "found undefined tag handle", tag_mark) + return false + } + } + } + + implicit := len(tag) == 0 + if indentless_sequence && token.token_type == yaml_BLOCK_ENTRY_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE + + *event = yaml_event_t{ + event_type: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), + } + + return true + } else { + if token.token_type == yaml_SCALAR_TOKEN { + plain_implicit := false + quoted_implicit := false + end_mark = token.end_mark + if (token.style == yaml_PLAIN_SCALAR_STYLE && len(tag) == 0) || + (len(tag) == 1 && tag[0] == '!') { + plain_implicit = true + } else if len(tag) == 0 { + quoted_implicit = true + } + + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + event_type: yaml_SCALAR_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + value: token.value, + implicit: plain_implicit, + quoted_implicit: quoted_implicit, + style: yaml_style_t(token.style), + } + + skip_token(parser) + return true + } else if token.token_type == yaml_FLOW_SEQUENCE_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE + + *event = yaml_event_t{ + event_type: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_FLOW_SEQUENCE_STYLE), + } + + return true + } else if token.token_type == yaml_FLOW_MAPPING_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE + + *event = yaml_event_t{ + event_type: yaml_MAPPING_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), + } + + return true + } else if block && token.token_type == yaml_BLOCK_SEQUENCE_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE + + *event = yaml_event_t{ + event_type: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), + } + + return true + } else if block && token.token_type == yaml_BLOCK_MAPPING_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE + + *event = yaml_event_t{ + event_type: yaml_MAPPING_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_MAPPING_STYLE), + } + return true + } else if len(anchor) > 0 || len(tag) > 0 { + + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + event_type: yaml_SCALAR_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + quoted_implicit: false, + style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), + } + return true + } else { + msg := "while parsing a block node" + if !block { + msg = "while parsing a flow node" + } + yaml_parser_set_parser_error_context(parser, msg, start_mark, + "did not find expected node content", token.start_mark) + return false + } + } + } + + return false +} + +/* + * Parse the productions: + * block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END + * ******************** *********** * ********* + */ + +func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, + event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.token_type == yaml_BLOCK_ENTRY_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.token_type != yaml_BLOCK_ENTRY_TOKEN && + token.token_type != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, true, false) + } else { + parser.state = yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + } else if token.token_type == yaml_BLOCK_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + *event = yaml_event_t{ + event_type: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + + skip_token(parser) + return true + } else { + mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + return yaml_parser_set_parser_error_context(parser, + "while parsing a block collection", mark, + "did not find expected '-' indicator", token.start_mark) + } +} + +/* + * Parse the productions: + * indentless_sequence ::= (BLOCK-ENTRY block_node?)+ + * *********** * + */ + +func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, + event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + if token.token_type == yaml_BLOCK_ENTRY_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.token_type != yaml_BLOCK_ENTRY_TOKEN && + token.token_type != yaml_KEY_TOKEN && + token.token_type != yaml_VALUE_TOKEN && + token.token_type != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, true, false) + } else { + parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + } else { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + event_type: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.start_mark, + } + return true + } +} + +/* + * Parse the productions: + * block_mapping ::= BLOCK-MAPPING_START + * ******************* + * ((KEY block_node_or_indentless_sequence?)? + * *** * + * (VALUE block_node_or_indentless_sequence?)?)* + * + * BLOCK-END + * ********* + */ + +func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, + event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.token_type == yaml_KEY_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.token_type != yaml_KEY_TOKEN && + token.token_type != yaml_VALUE_TOKEN && + token.token_type != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, true, true) + } else { + parser.state = yaml_PARSE_BLOCK_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + } else if token.token_type == yaml_BLOCK_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + *event = yaml_event_t{ + event_type: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + skip_token(parser) + return true + } else { + mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + return yaml_parser_set_parser_error_context(parser, + "while parsing a block mapping", mark, + "did not find expected key", token.start_mark) + } +} + +/* + * Parse the productions: + * block_mapping ::= BLOCK-MAPPING_START + * + * ((KEY block_node_or_indentless_sequence?)? + * + * (VALUE block_node_or_indentless_sequence?)?)* + * ***** * + * BLOCK-END + * + */ + +func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, + event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + if token.token_type == yaml_VALUE_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.token_type != yaml_KEY_TOKEN && + token.token_type != yaml_VALUE_TOKEN && + token.token_type != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_KEY_STATE) + return yaml_parser_parse_node(parser, event, true, true) + } else { + parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + } else { + parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) + } +} + +/* + * Parse the productions: + * flow_sequence ::= FLOW-SEQUENCE-START + * ******************* + * (flow_sequence_entry FLOW-ENTRY)* + * * ********** + * flow_sequence_entry? + * * + * FLOW-SEQUENCE-END + * ***************** + * flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + * * + */ + +func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, + event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.token_type != yaml_FLOW_SEQUENCE_END_TOKEN { + if !first { + if token.token_type == yaml_FLOW_ENTRY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } else { + mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + return yaml_parser_set_parser_error_context(parser, + "while parsing a flow sequence", mark, + "did not find expected ',' or ']'", token.start_mark) + } + } + + if token.token_type == yaml_KEY_TOKEN { + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE + *event = yaml_event_t{ + event_type: yaml_MAPPING_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + implicit: true, + style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), + } + + skip_token(parser) + return true + } else if token.token_type != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + *event = yaml_event_t{ + event_type: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + + skip_token(parser) + return true +} + +/* + * Parse the productions: + * flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + * *** * + */ + +func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, + event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + if token.token_type != yaml_VALUE_TOKEN && + token.token_type != yaml_FLOW_ENTRY_TOKEN && + token.token_type != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } else { + mark := token.end_mark + skip_token(parser) + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } +} + +/* + * Parse the productions: + * flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + * ***** * + */ + +func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, + event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + if token.token_type == yaml_VALUE_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.token_type != yaml_FLOW_ENTRY_TOKEN && + token.token_type != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +/* + * Parse the productions: + * flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + * * + */ + +func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, + event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE + *event = yaml_event_t{ + event_type: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.start_mark, + } + + return true +} + +/* + * Parse the productions: + * flow_mapping ::= FLOW-MAPPING-START + * ****************** + * (flow_mapping_entry FLOW-ENTRY)* + * * ********** + * flow_mapping_entry? + * ****************** + * FLOW-MAPPING-END + * **************** + * flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + * * *** * + */ + +func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, + event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.token_type != yaml_FLOW_MAPPING_END_TOKEN { + if !first { + if token.token_type == yaml_FLOW_ENTRY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } else { + mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + return yaml_parser_set_parser_error_context(parser, + "while parsing a flow mapping", mark, + "did not find expected ',' or '}'", token.start_mark) + } + } + + if token.token_type == yaml_KEY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.token_type != yaml_VALUE_TOKEN && + token.token_type != yaml_FLOW_ENTRY_TOKEN && + token.token_type != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } else { + parser.state = yaml_PARSE_FLOW_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, + token.start_mark) + } + } else if token.token_type != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + *event = yaml_event_t{ + event_type: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + + skip_token(parser) + return true +} + +/* + * Parse the productions: + * flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + * * ***** * + */ + +func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, + event *yaml_event_t, empty bool) bool { + token := peek_token(parser) + if token == nil { + return false + } + + if empty { + parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, + token.start_mark) + } + + if token.token_type == yaml_VALUE_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.token_type != yaml_FLOW_ENTRY_TOKEN && + token.token_type != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_KEY_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + + parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +/* + * Generate an empty scalar event. + */ + +func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml_event_t, + mark YAML_mark_t) bool { + *event = yaml_event_t{ + event_type: yaml_SCALAR_EVENT, + start_mark: mark, + end_mark: mark, + value: nil, + implicit: true, + style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), + } + + return true +} + +/* + * Parse directives. + */ + +func yaml_parser_process_directives(parser *yaml_parser_t, + version_directive_ref **yaml_version_directive_t, + tag_directives_ref *[]yaml_tag_directive_t) bool { + + token := peek_token(parser) + if token == nil { + return false + } + + var version_directive *yaml_version_directive_t + var tag_directives []yaml_tag_directive_t + + for token.token_type == yaml_VERSION_DIRECTIVE_TOKEN || + token.token_type == yaml_TAG_DIRECTIVE_TOKEN { + if token.token_type == yaml_VERSION_DIRECTIVE_TOKEN { + if version_directive != nil { + yaml_parser_set_parser_error(parser, + "found duplicate %YAML directive", token.start_mark) + return false + } + if token.major != 1 || + token.minor != 1 { + yaml_parser_set_parser_error(parser, + "found incompatible YAML document", token.start_mark) + return false + } + version_directive = &yaml_version_directive_t{ + major: token.major, + minor: token.minor, + } + } else if token.token_type == yaml_TAG_DIRECTIVE_TOKEN { + value := yaml_tag_directive_t{ + handle: token.value, + prefix: token.prefix, + } + + if !yaml_parser_append_tag_directive(parser, value, false, + token.start_mark) { + return false + } + tag_directives = append(tag_directives, value) + } + + skip_token(parser) + token := peek_token(parser) + if token == nil { + return false + } + } + + for i := range default_tag_directives { + if !yaml_parser_append_tag_directive(parser, default_tag_directives[i], true, token.start_mark) { + return false + } + } + + if version_directive_ref != nil { + *version_directive_ref = version_directive + } + if tag_directives_ref != nil { + *tag_directives_ref = tag_directives + } + + return true +} + +/* + * Append a tag directive to the directives stack. + */ + +func yaml_parser_append_tag_directive(parser *yaml_parser_t, + value yaml_tag_directive_t, allow_duplicates bool, mark YAML_mark_t) bool { + for i := range parser.tag_directives { + tag := &parser.tag_directives[i] + if bytes.Equal(value.handle, tag.handle) { + if allow_duplicates { + return true + } + return yaml_parser_set_parser_error(parser, "found duplicate %TAG directive", mark) + } + } + + parser.tag_directives = append(parser.tag_directives, value) + return true +} diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/parser_test.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/parser_test.go new file mode 100644 index 00000000..534ca5ec --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/parser_test.go @@ -0,0 +1,81 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "io/ioutil" + "os" + "path/filepath" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var parses = func(filename string) { + It("parses "+filename, func() { + file, err := os.Open(filename) + Expect(err).To(BeNil()) + + parser := yaml_parser_t{} + yaml_parser_initialize(&parser) + yaml_parser_set_input_reader(&parser, file) + + failed := false + event := yaml_event_t{} + + for { + if !yaml_parser_parse(&parser, &event) { + failed = true + println("---", parser.error, parser.problem, parser.context, "line", parser.problem_mark.line, "col", parser.problem_mark.column) + break + } + + if event.event_type == yaml_STREAM_END_EVENT { + break + } + } + + file.Close() + + // msg := "SUCCESS" + // if failed { + // msg = "FAILED" + // if parser.error != yaml_NO_ERROR { + // m := parser.problem_mark + // fmt.Printf("ERROR: (%s) %s @ line: %d col: %d\n", + // parser.context, parser.problem, m.line, m.column) + // } + // } + Expect(failed).To(BeFalse()) + }) +} + +var parseYamls = func(dirname string) { + fileInfos, err := ioutil.ReadDir(dirname) + if err != nil { + panic(err.Error()) + } + + for _, fileInfo := range fileInfos { + if !fileInfo.IsDir() { + parses(filepath.Join(dirname, fileInfo.Name())) + } + } +} + +var _ = Describe("Parser", func() { + parseYamls("fixtures/specification") + parseYamls("fixtures/specification/types") +}) diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/reader.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/reader.go new file mode 100644 index 00000000..5631da2d --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/reader.go @@ -0,0 +1,465 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "io" +) + +/* + * Set the reader error and return 0. + */ + +func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string, + offset int, value int) bool { + parser.error = yaml_READER_ERROR + parser.problem = problem + parser.problem_offset = offset + parser.problem_value = value + + return false +} + +/* + * Byte order marks. + */ +const ( + BOM_UTF8 = "\xef\xbb\xbf" + BOM_UTF16LE = "\xff\xfe" + BOM_UTF16BE = "\xfe\xff" +) + +/* + * Determine the input stream encoding by checking the BOM symbol. If no BOM is + * found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure. + */ + +func yaml_parser_determine_encoding(parser *yaml_parser_t) bool { + /* Ensure that we had enough bytes in the raw buffer. */ + for !parser.eof && + len(parser.raw_buffer)-parser.raw_buffer_pos < 3 { + if !yaml_parser_update_raw_buffer(parser) { + return false + } + } + + /* Determine the encoding. */ + raw := parser.raw_buffer + pos := parser.raw_buffer_pos + remaining := len(raw) - pos + if remaining >= 2 && + raw[pos] == BOM_UTF16LE[0] && raw[pos+1] == BOM_UTF16LE[1] { + parser.encoding = yaml_UTF16LE_ENCODING + parser.raw_buffer_pos += 2 + parser.offset += 2 + } else if remaining >= 2 && + raw[pos] == BOM_UTF16BE[0] && raw[pos+1] == BOM_UTF16BE[1] { + parser.encoding = yaml_UTF16BE_ENCODING + parser.raw_buffer_pos += 2 + parser.offset += 2 + } else if remaining >= 3 && + raw[pos] == BOM_UTF8[0] && raw[pos+1] == BOM_UTF8[1] && raw[pos+2] == BOM_UTF8[2] { + parser.encoding = yaml_UTF8_ENCODING + parser.raw_buffer_pos += 3 + parser.offset += 3 + } else { + parser.encoding = yaml_UTF8_ENCODING + } + + return true +} + +/* + * Update the raw buffer. + */ + +func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool { + size_read := 0 + + /* Return if the raw buffer is full. */ + if parser.raw_buffer_pos == 0 && len(parser.raw_buffer) == cap(parser.raw_buffer) { + return true + } + + /* Return on EOF. */ + + if parser.eof { + return true + } + + /* Move the remaining bytes in the raw buffer to the beginning. */ + if parser.raw_buffer_pos > 0 && parser.raw_buffer_pos < len(parser.raw_buffer) { + copy(parser.raw_buffer, parser.raw_buffer[parser.raw_buffer_pos:]) + } + parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)-parser.raw_buffer_pos] + parser.raw_buffer_pos = 0 + + /* Call the read handler to fill the buffer. */ + size_read, err := parser.read_handler(parser, + parser.raw_buffer[len(parser.raw_buffer):cap(parser.raw_buffer)]) + parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)+size_read] + + if err == io.EOF { + parser.eof = true + } else if err != nil { + return yaml_parser_set_reader_error(parser, "input error: "+err.Error(), + parser.offset, -1) + } + + return true +} + +/* + * Ensure that the buffer contains at least `length` characters. + * Return 1 on success, 0 on failure. + * + * The length is supposed to be significantly less that the buffer size. + */ + +func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { + /* Read handler must be set. */ + if parser.read_handler == nil { + panic("read handler must be set") + } + + /* If the EOF flag is set and the raw buffer is empty, do nothing. */ + + if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { + return true + } + + /* Return if the buffer contains enough characters. */ + + if parser.unread >= length { + return true + } + + /* Determine the input encoding if it is not known yet. */ + + if parser.encoding == yaml_ANY_ENCODING { + if !yaml_parser_determine_encoding(parser) { + return false + } + } + + /* Move the unread characters to the beginning of the buffer. */ + buffer_end := len(parser.buffer) + if 0 < parser.buffer_pos && + parser.buffer_pos < buffer_end { + copy(parser.buffer, parser.buffer[parser.buffer_pos:]) + buffer_end -= parser.buffer_pos + parser.buffer_pos = 0 + } else if parser.buffer_pos == buffer_end { + buffer_end = 0 + parser.buffer_pos = 0 + } + + parser.buffer = parser.buffer[:cap(parser.buffer)] + + /* Fill the buffer until it has enough characters. */ + first := true + for parser.unread < length { + /* Fill the raw buffer if necessary. */ + + if !first || parser.raw_buffer_pos == len(parser.raw_buffer) { + if !yaml_parser_update_raw_buffer(parser) { + parser.buffer = parser.buffer[:buffer_end] + return false + } + } + first = false + + /* Decode the raw buffer. */ + for parser.raw_buffer_pos != len(parser.raw_buffer) { + var value rune + var w int + + raw_unread := len(parser.raw_buffer) - parser.raw_buffer_pos + incomplete := false + + /* Decode the next character. */ + + switch parser.encoding { + case yaml_UTF8_ENCODING: + + /* + * Decode a UTF-8 character. Check RFC 3629 + * (http://www.ietf.org/rfc/rfc3629.txt) for more details. + * + * The following table (taken from the RFC) is used for + * decoding. + * + * Char. number range | UTF-8 octet sequence + * (hexadecimal) | (binary) + * --------------------+------------------------------------ + * 0000 0000-0000 007F | 0xxxxxxx + * 0000 0080-0000 07FF | 110xxxxx 10xxxxxx + * 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx + * 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + * + * Additionally, the characters in the range 0xD800-0xDFFF + * are prohibited as they are reserved for use with UTF-16 + * surrogate pairs. + */ + + /* Determine the length of the UTF-8 sequence. */ + + octet := parser.raw_buffer[parser.raw_buffer_pos] + w = width(octet) + + /* Check if the leading octet is valid. */ + + if w == 0 { + return yaml_parser_set_reader_error(parser, + "invalid leading UTF-8 octet", + parser.offset, int(octet)) + } + + /* Check if the raw buffer contains an incomplete character. */ + + if w > raw_unread { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-8 octet sequence", + parser.offset, -1) + } + incomplete = true + break + } + + /* Decode the leading octet. */ + switch { + case octet&0x80 == 0x00: + value = rune(octet & 0x7F) + case octet&0xE0 == 0xC0: + value = rune(octet & 0x1F) + case octet&0xF0 == 0xE0: + value = rune(octet & 0x0F) + case octet&0xF8 == 0xF0: + value = rune(octet & 0x07) + default: + value = 0 + } + + /* Check and decode the trailing octets. */ + + for k := 1; k < w; k++ { + octet = parser.raw_buffer[parser.raw_buffer_pos+k] + + /* Check if the octet is valid. */ + + if (octet & 0xC0) != 0x80 { + return yaml_parser_set_reader_error(parser, + "invalid trailing UTF-8 octet", + parser.offset+k, int(octet)) + } + + /* Decode the octet. */ + + value = (value << 6) + rune(octet&0x3F) + } + + /* Check the length of the sequence against the value. */ + switch { + case w == 1: + case w == 2 && value >= 0x80: + case w == 3 && value >= 0x800: + case w == 4 && value >= 0x10000: + default: + return yaml_parser_set_reader_error(parser, + "invalid length of a UTF-8 sequence", + parser.offset, -1) + } + + /* Check the range of the value. */ + + if (value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF { + return yaml_parser_set_reader_error(parser, + "invalid Unicode character", + parser.offset, int(value)) + } + case yaml_UTF16LE_ENCODING, + yaml_UTF16BE_ENCODING: + + var low, high int + if parser.encoding == yaml_UTF16LE_ENCODING { + low, high = 0, 1 + } else { + high, low = 1, 0 + } + + /* + * The UTF-16 encoding is not as simple as one might + * naively think. Check RFC 2781 + * (http://www.ietf.org/rfc/rfc2781.txt). + * + * Normally, two subsequent bytes describe a Unicode + * character. However a special technique (called a + * surrogate pair) is used for specifying character + * values larger than 0xFFFF. + * + * A surrogate pair consists of two pseudo-characters: + * high surrogate area (0xD800-0xDBFF) + * low surrogate area (0xDC00-0xDFFF) + * + * The following formulas are used for decoding + * and encoding characters using surrogate pairs: + * + * U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF) + * U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF) + * W1 = 110110yyyyyyyyyy + * W2 = 110111xxxxxxxxxx + * + * where U is the character value, W1 is the high surrogate + * area, W2 is the low surrogate area. + */ + + /* Check for incomplete UTF-16 character. */ + + if raw_unread < 2 { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-16 character", + parser.offset, -1) + } + incomplete = true + break + } + + /* Get the character. */ + value = rune(parser.raw_buffer[parser.raw_buffer_pos+low]) + + (rune(parser.raw_buffer[parser.raw_buffer_pos+high]) << 8) + + /* Check for unexpected low surrogate area. */ + + if (value & 0xFC00) == 0xDC00 { + return yaml_parser_set_reader_error(parser, + "unexpected low surrogate area", + parser.offset, int(value)) + } + + /* Check for a high surrogate area. */ + + if (value & 0xFC00) == 0xD800 { + + w = 4 + + /* Check for incomplete surrogate pair. */ + + if raw_unread < 4 { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-16 surrogate pair", + parser.offset, -1) + } + incomplete = true + break + } + + /* Get the next character. */ + + value2 := rune(parser.raw_buffer[parser.raw_buffer_pos+low+2]) + + (rune(parser.raw_buffer[parser.raw_buffer_pos+high+2]) << 8) + + /* Check for a low surrogate area. */ + + if (value2 & 0xFC00) != 0xDC00 { + return yaml_parser_set_reader_error(parser, + "expected low surrogate area", + parser.offset+2, int(value2)) + } + + /* Generate the value of the surrogate pair. */ + + value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF) + } else { + w = 2 + } + + break + + default: + panic("Impossible") /* Impossible. */ + } + + /* Check if the raw buffer contains enough bytes to form a character. */ + + if incomplete { + break + } + + /* + * Check if the character is in the allowed range: + * #x9 | #xA | #xD | [#x20-#x7E] (8 bit) + * | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit) + * | [#x10000-#x10FFFF] (32 bit) + */ + + if !(value == 0x09 || value == 0x0A || value == 0x0D || + (value >= 0x20 && value <= 0x7E) || + (value == 0x85) || (value >= 0xA0 && value <= 0xD7FF) || + (value >= 0xE000 && value <= 0xFFFD) || + (value >= 0x10000 && value <= 0x10FFFF)) { + return yaml_parser_set_reader_error(parser, + "control characters are not allowed", + parser.offset, int(value)) + } + + /* Move the raw pointers. */ + + parser.raw_buffer_pos += w + parser.offset += w + + /* Finally put the character into the buffer. */ + + /* 0000 0000-0000 007F . 0xxxxxxx */ + if value <= 0x7F { + parser.buffer[buffer_end] = byte(value) + } else if value <= 0x7FF { + /* 0000 0080-0000 07FF . 110xxxxx 10xxxxxx */ + parser.buffer[buffer_end] = byte(0xC0 + (value >> 6)) + parser.buffer[buffer_end+1] = byte(0x80 + (value & 0x3F)) + } else if value <= 0xFFFF { + /* 0000 0800-0000 FFFF . 1110xxxx 10xxxxxx 10xxxxxx */ + parser.buffer[buffer_end] = byte(0xE0 + (value >> 12)) + parser.buffer[buffer_end+1] = byte(0x80 + ((value >> 6) & 0x3F)) + parser.buffer[buffer_end+2] = byte(0x80 + (value & 0x3F)) + } else { + /* 0001 0000-0010 FFFF . 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ + parser.buffer[buffer_end] = byte(0xF0 + (value >> 18)) + parser.buffer[buffer_end+1] = byte(0x80 + ((value >> 12) & 0x3F)) + parser.buffer[buffer_end+2] = byte(0x80 + ((value >> 6) & 0x3F)) + parser.buffer[buffer_end+3] = byte(0x80 + (value & 0x3F)) + } + + buffer_end += w + parser.unread++ + } + + /* On EOF, put NUL into the buffer and return. */ + + if parser.eof { + parser.buffer[buffer_end] = 0 + buffer_end++ + parser.buffer = parser.buffer[:buffer_end] + parser.unread++ + return true + } + + } + + parser.buffer = parser.buffer[:buffer_end] + return true +} diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/reader_test.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/reader_test.go new file mode 100644 index 00000000..3771ee76 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/reader_test.go @@ -0,0 +1,291 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + // "fmt" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +/* + * Test cases are stolen from + * http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt + */ + +type test_case struct { + title string + test string + result bool +} + +var _ = Describe("Reader", func() { + LONG := 100000 + + Context("UTF8 Sequences", func() { + utf8_sequences := []test_case{ + /* {"title", "test 1|test 2|...|test N!", (0 or 1)}, */ + + {"a simple test", "'test' is '\xd0\xbf\xd1\x80\xd0\xbe\xd0\xb2\xd0\xb5\xd1\x80\xd0\xba\xd0\xb0' in Russian!", true}, + + {"an empty line", "!", true}, + {"u-0 is a control character", "\x00!", false}, + {"u-80 is a control character", "\xc2\x80!", false}, + {"u-800 is valid", "\xe0\xa0\x80!", true}, + {"u-10000 is valid", "\xf0\x90\x80\x80!", true}, + {"5 bytes sequences are not allowed", "\xf8\x88\x80\x80\x80!", false}, + {"6 bytes sequences are not allowed", "\xfc\x84\x80\x80\x80\x80!", false}, + + {"u-7f is a control character", "\x7f!", false}, + {"u-7FF is valid", "\xdf\xbf!", true}, + {"u-FFFF is a control character", "\xef\xbf\xbf!", false}, + {"u-1FFFFF is too large", "\xf7\xbf\xbf\xbf!", false}, + {"u-3FFFFFF is 5 bytes", "\xfb\xbf\xbf\xbf\xbf!", false}, + {"u-7FFFFFFF is 6 bytes", "\xfd\xbf\xbf\xbf\xbf\xbf!", false}, + + {"u-D7FF", "\xed\x9f\xbf!", true}, + {"u-E000", "\xee\x80\x80!", true}, + {"u-FFFD", "\xef\xbf\xbd!", true}, + {"u-10FFFF", "\xf4\x8f\xbf\xbf!", true}, + {"u-110000", "\xf4\x90\x80\x80!", false}, + + {"first continuation byte", "\x80!", false}, + {"last continuation byte", "\xbf!", false}, + + {"2 continuation bytes", "\x80\xbf!", false}, + {"3 continuation bytes", "\x80\xbf\x80!", false}, + {"4 continuation bytes", "\x80\xbf\x80\xbf!", false}, + {"5 continuation bytes", "\x80\xbf\x80\xbf\x80!", false}, + {"6 continuation bytes", "\x80\xbf\x80\xbf\x80\xbf!", false}, + {"7 continuation bytes", "\x80\xbf\x80\xbf\x80\xbf\x80!", false}, + + {"sequence of all 64 possible continuation bytes", + "\x80|\x81|\x82|\x83|\x84|\x85|\x86|\x87|\x88|\x89|\x8a|\x8b|\x8c|\x8d|\x8e|\x8f|" + + "\x90|\x91|\x92|\x93|\x94|\x95|\x96|\x97|\x98|\x99|\x9a|\x9b|\x9c|\x9d|\x9e|\x9f|" + + "\xa0|\xa1|\xa2|\xa3|\xa4|\xa5|\xa6|\xa7|\xa8|\xa9|\xaa|\xab|\xac|\xad|\xae|\xaf|" + + "\xb0|\xb1|\xb2|\xb3|\xb4|\xb5|\xb6|\xb7|\xb8|\xb9|\xba|\xbb|\xbc|\xbd|\xbe|\xbf!", false}, + {"32 first bytes of 2-byte sequences {0xc0-0xdf}", + "\xc0 |\xc1 |\xc2 |\xc3 |\xc4 |\xc5 |\xc6 |\xc7 |\xc8 |\xc9 |\xca |\xcb |\xcc |\xcd |\xce |\xcf |" + + "\xd0 |\xd1 |\xd2 |\xd3 |\xd4 |\xd5 |\xd6 |\xd7 |\xd8 |\xd9 |\xda |\xdb |\xdc |\xdd |\xde |\xdf !", false}, + {"16 first bytes of 3-byte sequences {0xe0-0xef}", + "\xe0 |\xe1 |\xe2 |\xe3 |\xe4 |\xe5 |\xe6 |\xe7 |\xe8 |\xe9 |\xea |\xeb |\xec |\xed |\xee |\xef !", false}, + {"8 first bytes of 4-byte sequences {0xf0-0xf7}", "\xf0 |\xf1 |\xf2 |\xf3 |\xf4 |\xf5 |\xf6 |\xf7 !", false}, + {"4 first bytes of 5-byte sequences {0xf8-0xfb}", "\xf8 |\xf9 |\xfa |\xfb !", false}, + {"2 first bytes of 6-byte sequences {0xfc-0xfd}", "\xfc |\xfd !", false}, + + {"sequences with last byte missing {u-0}", + "\xc0|\xe0\x80|\xf0\x80\x80|\xf8\x80\x80\x80|\xfc\x80\x80\x80\x80!", false}, + {"sequences with last byte missing {u-...FF}", + "\xdf|\xef\xbf|\xf7\xbf\xbf|\xfb\xbf\xbf\xbf|\xfd\xbf\xbf\xbf\xbf!", false}, + + {"impossible bytes", "\xfe|\xff|\xfe\xfe\xff\xff!", false}, + + {"overlong sequences {u-2f}", + "\xc0\xaf|\xe0\x80\xaf|\xf0\x80\x80\xaf|\xf8\x80\x80\x80\xaf|\xfc\x80\x80\x80\x80\xaf!", false}, + + {"maximum overlong sequences", + "\xc1\xbf|\xe0\x9f\xbf|\xf0\x8f\xbf\xbf|\xf8\x87\xbf\xbf\xbf|\xfc\x83\xbf\xbf\xbf\xbf!", false}, + + {"overlong representation of the NUL character", + "\xc0\x80|\xe0\x80\x80|\xf0\x80\x80\x80|\xf8\x80\x80\x80\x80|\xfc\x80\x80\x80\x80\x80!", false}, + + {"single UTF-16 surrogates", + "\xed\xa0\x80|\xed\xad\xbf|\xed\xae\x80|\xed\xaf\xbf|\xed\xb0\x80|\xed\xbe\x80|\xed\xbf\xbf!", false}, + + {"paired UTF-16 surrogates", + "\xed\xa0\x80\xed\xb0\x80|\xed\xa0\x80\xed\xbf\xbf|\xed\xad\xbf\xed\xb0\x80|" + + "\xed\xad\xbf\xed\xbf\xbf|\xed\xae\x80\xed\xb0\x80|\xed\xae\x80\xed\xbf\xbf|" + + "\xed\xaf\xbf\xed\xb0\x80|\xed\xaf\xbf\xed\xbf\xbf!", false}, + + {"other illegal code positions", "\xef\xbf\xbe|\xef\xbf\xbf!", false}, + } + + check_sequence := func(tc test_case) { + It(tc.title, func() { + start := 0 + end := start + bytes := []byte(tc.test) + + for { + for bytes[end] != '|' && bytes[end] != '!' { + end++ + } + + parser := yaml_parser_t{} + yaml_parser_initialize(&parser) + yaml_parser_set_input_string(&parser, bytes) + result := yaml_parser_update_buffer(&parser, end-start) + Expect(result).To(Equal(tc.result)) + // outcome := '+' + // if result != tc.result { + // outcome = '-' + // } + // fmt.Printf("\t\t %c %s", outcome, tc.title) + // if parser.error == yaml_NO_ERROR { + // fmt.Printf("(no error)\n") + // } else if parser.error == yaml_READER_ERROR { + // if parser.problem_value != -1 { + // fmt.Printf("(reader error: %s: #%X at %d)\n", + // parser.problem, parser.problem_value, parser.problem_offset) + // } else { + // fmt.Printf("(reader error: %s: at %d)\n", + // parser.problem, parser.problem_offset) + // } + // } + + if bytes[end] == '!' { + break + } + + end++ + start = end + yaml_parser_delete(&parser) + } + }) + } + + for _, test := range utf8_sequences { + check_sequence(test) + } + }) + + Context("BOMs", func() { + boms := []test_case{ + /* {"title", "test!", lenth}, */ + {"no bom (utf-8)", "Hi is \xd0\x9f\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82!", true}, + {"bom (utf-8)", "\xef\xbb\xbfHi is \xd0\x9f\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82!", true}, + {"bom (utf-16-le)", "\xff\xfeH\x00i\x00 \x00i\x00s\x00 \x00\x1f\x04@\x04" + "8\x04" + "2\x04" + "5\x04" + "B\x04!", true}, + {"bom (utf-16-be)", "\xfe\xff\x00H\x00i\x00 \x00i\x00s\x00 \x04\x1f\x04@\x04" + "8\x04" + "2\x04" + "5\x04" + "B!", true}, + } + + check_bom := func(tc test_case) { + It(tc.title, func() { + start := 0 + end := start + bytes := []byte(tc.test) + + for bytes[end] != '!' { + end++ + } + + parser := yaml_parser_t{} + yaml_parser_initialize(&parser) + yaml_parser_set_input_string(&parser, bytes[:end-start]) + result := yaml_parser_update_buffer(&parser, end-start) + Expect(result).To(Equal(tc.result)) + yaml_parser_delete(&parser) + }) + } + + for _, test := range boms { + check_bom(test) + } + + }) + + Context("Long UTF8", func() { + It("parses properly", func() { + buffer := make([]byte, 0, 3+LONG*2) + buffer = append(buffer, '\xef', '\xbb', '\xbf') + for j := 0; j < LONG; j++ { + if j%2 == 1 { + buffer = append(buffer, '\xd0', '\x90') + } else { + buffer = append(buffer, '\xd0', '\xaf') + } + } + parser := yaml_parser_t{} + yaml_parser_initialize(&parser) + yaml_parser_set_input_string(&parser, buffer) + + for k := 0; k < LONG; k++ { + if parser.unread == 0 { + updated := yaml_parser_update_buffer(&parser, 1) + Expect(updated).To(BeTrue()) + // printf("\treader error: %s at %d\n", parser.problem, parser.problem_offset); + } + Expect(parser.unread).NotTo(Equal(0)) + // printf("\tnot enough characters at %d\n", k); + var ch0, ch1 byte + if k%2 == 1 { + ch0 = '\xd0' + ch1 = '\x90' + } else { + ch0 = '\xd0' + ch1 = '\xaf' + } + Expect(parser.buffer[parser.buffer_pos]).To(Equal(ch0)) + Expect(parser.buffer[parser.buffer_pos+1]).To(Equal(ch1)) + // printf("\tincorrect UTF-8 sequence: %X %X instead of %X %X\n", + // (int)parser.buffer.pointer[0], (int)parser.buffer.pointer[1], + // (int)ch0, (int)ch1); + + parser.buffer_pos += 2 + parser.unread -= 1 + } + updated := yaml_parser_update_buffer(&parser, 1) + Expect(updated).To(BeTrue()) + // printf("\treader error: %s at %d\n", parser.problem, parser.problem_offset); + yaml_parser_delete(&parser) + }) + }) + + Context("Long UTF16", func() { + It("parses properly", func() { + buffer := make([]byte, 0, 2+LONG*2) + buffer = append(buffer, '\xff', '\xfe') + for j := 0; j < LONG; j++ { + if j%2 == 1 { + buffer = append(buffer, '\x10', '\x04') + } else { + buffer = append(buffer, '/', '\x04') + } + } + parser := yaml_parser_t{} + yaml_parser_initialize(&parser) + yaml_parser_set_input_string(&parser, buffer) + + for k := 0; k < LONG; k++ { + if parser.unread == 0 { + updated := yaml_parser_update_buffer(&parser, 1) + Expect(updated).To(BeTrue()) + // printf("\treader error: %s at %d\n", parser.problem, parser.problem_offset); + } + Expect(parser.unread).NotTo(Equal(0)) + // printf("\tnot enough characters at %d\n", k); + var ch0, ch1 byte + if k%2 == 1 { + ch0 = '\xd0' + ch1 = '\x90' + } else { + ch0 = '\xd0' + ch1 = '\xaf' + } + Expect(parser.buffer[parser.buffer_pos]).To(Equal(ch0)) + Expect(parser.buffer[parser.buffer_pos+1]).To(Equal(ch1)) + // printf("\tincorrect UTF-8 sequence: %X %X instead of %X %X\n", + // (int)parser.buffer.pointer[0], (int)parser.buffer.pointer[1], + // (int)ch0, (int)ch1); + + parser.buffer_pos += 2 + parser.unread -= 1 + } + updated := yaml_parser_update_buffer(&parser, 1) + Expect(updated).To(BeTrue()) + // printf("\treader error: %s at %d\n", parser.problem, parser.problem_offset); + yaml_parser_delete(&parser) + }) + }) +}) diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/resolver.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/resolver.go new file mode 100644 index 00000000..65a6d3d4 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/resolver.go @@ -0,0 +1,449 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "bytes" + "encoding/base64" + "fmt" + "math" + "reflect" + "regexp" + "strconv" + "strings" + "time" +) + +var byteSliceType = reflect.TypeOf([]byte(nil)) + +var binary_tags = [][]byte{[]byte("!binary"), []byte(yaml_BINARY_TAG)} +var bool_values map[string]bool +var null_values map[string]bool + +var signs = []byte{'-', '+'} +var nulls = []byte{'~', 'n', 'N'} +var bools = []byte{'t', 'T', 'f', 'F', 'y', 'Y', 'n', 'N', 'o', 'O'} + +var timestamp_regexp *regexp.Regexp +var ymd_regexp *regexp.Regexp + +func init() { + bool_values = make(map[string]bool) + bool_values["y"] = true + bool_values["yes"] = true + bool_values["n"] = false + bool_values["no"] = false + bool_values["true"] = true + bool_values["false"] = false + bool_values["on"] = true + bool_values["off"] = false + + null_values = make(map[string]bool) + null_values["~"] = true + null_values["null"] = true + null_values["Null"] = true + null_values["NULL"] = true + + timestamp_regexp = regexp.MustCompile("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \t]*(?:Z|([-+][0-9][0-9]?)(?::([0-9][0-9])?)?))?)?$") + ymd_regexp = regexp.MustCompile("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)$") +} + +func resolve(event yaml_event_t, v reflect.Value, useNumber bool) (string, error) { + val := string(event.value) + + if null_values[val] { + v.Set(reflect.Zero(v.Type())) + return yaml_NULL_TAG, nil + } + + switch v.Kind() { + case reflect.String: + if useNumber && v.Type() == numberType { + tag, i := resolveInterface(event, useNumber) + if n, ok := i.(Number); ok { + v.Set(reflect.ValueOf(n)) + return tag, nil + } + return "", fmt.Errorf("Not a number: '%s' at %s", event.value, event.start_mark) + } + + return resolve_string(val, v, event) + case reflect.Bool: + return resolve_bool(val, v, event) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return resolve_int(val, v, useNumber, event) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return resolve_uint(val, v, useNumber, event) + case reflect.Float32, reflect.Float64: + return resolve_float(val, v, useNumber, event) + case reflect.Interface: + _, i := resolveInterface(event, useNumber) + if i != nil { + v.Set(reflect.ValueOf(i)) + } else { + v.Set(reflect.Zero(v.Type())) + } + + case reflect.Struct: + return resolve_time(val, v, event) + case reflect.Slice: + if v.Type() != byteSliceType { + return "", fmt.Errorf("Cannot resolve %s into %s at %s", val, v.String(), event.start_mark) + } + b, err := decode_binary(event.value, event) + if err != nil { + return "", err + } + + v.Set(reflect.ValueOf(b)) + default: + return "", fmt.Errorf("Unknown resolution for '%s' using %s at %s", val, v.String(), event.start_mark) + } + + return yaml_STR_TAG, nil +} + +func hasBinaryTag(event yaml_event_t) bool { + for _, tag := range binary_tags { + if bytes.Equal(event.tag, tag) { + return true + } + } + return false +} + +func decode_binary(value []byte, event yaml_event_t) ([]byte, error) { + b := make([]byte, base64.StdEncoding.DecodedLen(len(value))) + n, err := base64.StdEncoding.Decode(b, value) + if err != nil { + return nil, fmt.Errorf("Invalid base64 text: '%s' at %s", string(b), event.start_mark) + } + return b[:n], nil +} + +func resolve_string(val string, v reflect.Value, event yaml_event_t) (string, error) { + if len(event.tag) > 0 { + if hasBinaryTag(event) { + b, err := decode_binary(event.value, event) + if err != nil { + return "", err + } + val = string(b) + } + } + v.SetString(val) + return yaml_STR_TAG, nil +} + +func resolve_bool(val string, v reflect.Value, event yaml_event_t) (string, error) { + b, found := bool_values[strings.ToLower(val)] + if !found { + return "", fmt.Errorf("Invalid boolean: '%s' at %s", val, event.start_mark) + } + + v.SetBool(b) + return yaml_BOOL_TAG, nil +} + +func resolve_int(val string, v reflect.Value, useNumber bool, event yaml_event_t) (string, error) { + original := val + val = strings.Replace(val, "_", "", -1) + var value uint64 + + isNumberValue := v.Type() == numberType + + sign := int64(1) + if val[0] == '-' { + sign = -1 + val = val[1:] + } else if val[0] == '+' { + val = val[1:] + } + + base := 0 + if val == "0" { + if isNumberValue { + v.SetString("0") + } else { + v.Set(reflect.Zero(v.Type())) + } + + return yaml_INT_TAG, nil + } + + if strings.HasPrefix(val, "0o") { + base = 8 + val = val[2:] + } + + value, err := strconv.ParseUint(val, base, 64) + if err != nil { + return "", fmt.Errorf("Invalid integer: '%s' at %s", original, event.start_mark) + } + + var val64 int64 + if value <= math.MaxInt64 { + val64 = int64(value) + if sign == -1 { + val64 = -val64 + } + } else if sign == -1 && value == uint64(math.MaxInt64)+1 { + val64 = math.MinInt64 + } else { + return "", fmt.Errorf("Invalid integer: '%s' at %s", original, event.start_mark) + } + + if isNumberValue { + v.SetString(strconv.FormatInt(val64, 10)) + } else { + if v.OverflowInt(val64) { + return "", fmt.Errorf("Invalid integer: '%s' at %s", original, event.start_mark) + } + v.SetInt(val64) + } + + return yaml_INT_TAG, nil +} + +func resolve_uint(val string, v reflect.Value, useNumber bool, event yaml_event_t) (string, error) { + original := val + val = strings.Replace(val, "_", "", -1) + var value uint64 + + isNumberValue := v.Type() == numberType + + if val[0] == '-' { + return "", fmt.Errorf("Unsigned int with negative value: '%s' at %s", original, event.start_mark) + } + + if val[0] == '+' { + val = val[1:] + } + + base := 0 + if val == "0" { + if isNumberValue { + v.SetString("0") + } else { + v.Set(reflect.Zero(v.Type())) + } + + return yaml_INT_TAG, nil + } + + if strings.HasPrefix(val, "0o") { + base = 8 + val = val[2:] + } + + value, err := strconv.ParseUint(val, base, 64) + if err != nil { + return "", fmt.Errorf("Invalid unsigned integer: '%s' at %s", val, event.start_mark) + } + + if isNumberValue { + v.SetString(strconv.FormatUint(value, 10)) + } else { + if v.OverflowUint(value) { + return "", fmt.Errorf("Invalid unsigned integer: '%s' at %s", val, event.start_mark) + } + + v.SetUint(value) + } + + return yaml_INT_TAG, nil +} + +func resolve_float(val string, v reflect.Value, useNumber bool, event yaml_event_t) (string, error) { + val = strings.Replace(val, "_", "", -1) + var value float64 + + isNumberValue := v.Type() == numberType + typeBits := 64 + if !isNumberValue { + typeBits = v.Type().Bits() + } + + sign := 1 + if val[0] == '-' { + sign = -1 + val = val[1:] + } else if val[0] == '+' { + val = val[1:] + } + + valLower := strings.ToLower(val) + if valLower == ".inf" { + value = math.Inf(sign) + } else if valLower == ".nan" { + value = math.NaN() + } else { + var err error + value, err = strconv.ParseFloat(val, typeBits) + value *= float64(sign) + + if err != nil { + return "", fmt.Errorf("Invalid float: '%s' at %s", val, event.start_mark) + } + } + + if isNumberValue { + v.SetString(strconv.FormatFloat(value, 'g', -1, typeBits)) + } else { + if v.OverflowFloat(value) { + return "", fmt.Errorf("Invalid float: '%s' at %s", val, event.start_mark) + } + + v.SetFloat(value) + } + + return yaml_FLOAT_TAG, nil +} + +func resolve_time(val string, v reflect.Value, event yaml_event_t) (string, error) { + var parsedTime time.Time + matches := ymd_regexp.FindStringSubmatch(val) + if len(matches) > 0 { + year, _ := strconv.Atoi(matches[1]) + month, _ := strconv.Atoi(matches[2]) + day, _ := strconv.Atoi(matches[3]) + parsedTime = time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.UTC) + } else { + matches = timestamp_regexp.FindStringSubmatch(val) + if len(matches) == 0 { + return "", fmt.Errorf("Invalid timestap: '%s' at %s", val, event.start_mark) + } + + year, _ := strconv.Atoi(matches[1]) + month, _ := strconv.Atoi(matches[2]) + day, _ := strconv.Atoi(matches[3]) + hour, _ := strconv.Atoi(matches[4]) + min, _ := strconv.Atoi(matches[5]) + sec, _ := strconv.Atoi(matches[6]) + + nsec := 0 + if matches[7] != "" { + millis, _ := strconv.Atoi(matches[7]) + nsec = int(time.Duration(millis) * time.Millisecond) + } + + loc := time.UTC + if matches[8] != "" { + sign := matches[8][0] + hr, _ := strconv.Atoi(matches[8][1:]) + min := 0 + if matches[9] != "" { + min, _ = strconv.Atoi(matches[9]) + } + + zoneOffset := (hr*60 + min) * 60 + if sign == '-' { + zoneOffset = -zoneOffset + } + + loc = time.FixedZone("", zoneOffset) + } + parsedTime = time.Date(year, time.Month(month), day, hour, min, sec, nsec, loc) + } + + v.Set(reflect.ValueOf(parsedTime)) + return "", nil +} + +func resolveInterface(event yaml_event_t, useNumber bool) (string, interface{}) { + val := string(event.value) + if len(event.tag) == 0 && !event.implicit { + return "", val + } + + if len(val) == 0 { + return yaml_NULL_TAG, nil + } + + var result interface{} + + sign := false + c := val[0] + switch { + case bytes.IndexByte(signs, c) != -1: + sign = true + fallthrough + case c >= '0' && c <= '9': + i := int64(0) + result = &i + if useNumber { + var n Number + result = &n + } + + v := reflect.ValueOf(result).Elem() + if _, err := resolve_int(val, v, useNumber, event); err == nil { + return yaml_INT_TAG, v.Interface() + } + + f := float64(0) + result = &f + if useNumber { + var n Number + result = &n + } + + v = reflect.ValueOf(result).Elem() + if _, err := resolve_float(val, v, useNumber, event); err == nil { + return yaml_FLOAT_TAG, v.Interface() + } + + if !sign { + t := time.Time{} + if _, err := resolve_time(val, reflect.ValueOf(&t).Elem(), event); err == nil { + return "", t + } + } + case bytes.IndexByte(nulls, c) != -1: + if null_values[val] { + return yaml_NULL_TAG, nil + } + b := false + if _, err := resolve_bool(val, reflect.ValueOf(&b).Elem(), event); err == nil { + return yaml_BOOL_TAG, b + } + case c == '.': + f := float64(0) + result = &f + if useNumber { + var n Number + result = &n + } + + v := reflect.ValueOf(result).Elem() + if _, err := resolve_float(val, v, useNumber, event); err == nil { + return yaml_FLOAT_TAG, v.Interface() + } + case bytes.IndexByte(bools, c) != -1: + b := false + if _, err := resolve_bool(val, reflect.ValueOf(&b).Elem(), event); err == nil { + return yaml_BOOL_TAG, b + } + } + + if hasBinaryTag(event) { + bytes, err := decode_binary(event.value, event) + if err == nil { + return yaml_BINARY_TAG, bytes + } + } + + return yaml_STR_TAG, val +} diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/resolver_test.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/resolver_test.go new file mode 100644 index 00000000..88e61fd0 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/resolver_test.go @@ -0,0 +1,665 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "math" + "reflect" + "time" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Resolver", func() { + var event yaml_event_t + + var nulls = []string{"~", "null", "Null", "NULL"} + + BeforeEach(func() { + event = yaml_event_t{} + }) + + Context("Resolve", func() { + Context("Implicit events", func() { + checkNulls := func(f func()) { + for _, null := range nulls { + event = yaml_event_t{implicit: true} + event.value = []byte(null) + f() + } + } + + BeforeEach(func() { + event.implicit = true + }) + + Context("String", func() { + It("resolves a string", func() { + aString := "" + v := reflect.ValueOf(&aString) + event.value = []byte("abc") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_STR_TAG)) + Expect(aString).To(Equal("abc")) + }) + + It("resolves the empty string", func() { + aString := "abc" + v := reflect.ValueOf(&aString) + event.value = []byte("") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_STR_TAG)) + Expect(aString).To(Equal("")) + + }) + + It("resolves null", func() { + checkNulls(func() { + aString := "abc" + v := reflect.ValueOf(&aString) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_NULL_TAG)) + Expect(aString).To(Equal("")) + }) + }) + + It("resolves null pointers", func() { + checkNulls(func() { + aString := "abc" + pString := &aString + v := reflect.ValueOf(&pString) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_NULL_TAG)) + Expect(pString).To(BeNil()) + }) + }) + + }) + + Context("Booleans", func() { + match_bool := func(val string, expected bool) { + b := !expected + + v := reflect.ValueOf(&b) + event.value = []byte(val) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_BOOL_TAG)) + Expect(b).To(Equal(expected)) + } + + It("resolves on", func() { + match_bool("on", true) + match_bool("ON", true) + }) + + It("resolves off", func() { + match_bool("off", false) + match_bool("OFF", false) + }) + + It("resolves true", func() { + match_bool("true", true) + match_bool("TRUE", true) + }) + + It("resolves false", func() { + match_bool("false", false) + match_bool("FALSE", false) + }) + + It("resolves yes", func() { + match_bool("yes", true) + match_bool("YES", true) + }) + + It("resolves no", func() { + match_bool("no", false) + match_bool("NO", false) + }) + + It("reports an error otherwise", func() { + b := true + v := reflect.ValueOf(&b) + event.value = []byte("fail") + + _, err := resolve(event, v.Elem(), false) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(Equal("Invalid boolean: 'fail' at line 0, column 0")) + }) + + It("resolves null", func() { + checkNulls(func() { + b := true + v := reflect.ValueOf(&b) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_NULL_TAG)) + Expect(b).To(BeFalse()) + }) + }) + + It("resolves null pointers", func() { + checkNulls(func() { + b := true + pb := &b + v := reflect.ValueOf(&pb) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_NULL_TAG)) + Expect(pb).To(BeNil()) + }) + }) + }) + + Context("Ints", func() { + It("simple ints", func() { + i := 0 + v := reflect.ValueOf(&i) + event.value = []byte("1234") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_INT_TAG)) + Expect(i).To(Equal(1234)) + }) + + It("positive ints", func() { + i := int16(0) + v := reflect.ValueOf(&i) + event.value = []byte("+678") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_INT_TAG)) + Expect(i).To(Equal(int16(678))) + }) + + It("negative ints", func() { + i := int32(0) + v := reflect.ValueOf(&i) + event.value = []byte("-2345") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_INT_TAG)) + Expect(i).To(Equal(int32(-2345))) + }) + + It("base 8", func() { + i := 0 + v := reflect.ValueOf(&i) + event.value = []byte("0o12") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_INT_TAG)) + Expect(i).To(Equal(10)) + }) + + It("base 16", func() { + i := 0 + v := reflect.ValueOf(&i) + event.value = []byte("0xff") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_INT_TAG)) + Expect(i).To(Equal(255)) + }) + + It("fails on overflow", func() { + i := int8(0) + v := reflect.ValueOf(&i) + event.value = []byte("2345") + + _, err := resolve(event, v.Elem(), false) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(Equal("Invalid integer: '2345' at line 0, column 0")) + }) + + It("fails on invalid int", func() { + i := 0 + v := reflect.ValueOf(&i) + event.value = []byte("234f") + + _, err := resolve(event, v.Elem(), false) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(Equal("Invalid integer: '234f' at line 0, column 0")) + }) + + It("resolves null", func() { + checkNulls(func() { + i := 1 + v := reflect.ValueOf(&i) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_NULL_TAG)) + Expect(i).To(Equal(0)) + }) + }) + + It("resolves null pointers", func() { + checkNulls(func() { + i := 1 + pi := &i + v := reflect.ValueOf(&pi) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_NULL_TAG)) + Expect(pi).To(BeNil()) + }) + }) + + It("returns a Number", func() { + var i Number + v := reflect.ValueOf(&i) + + tag, err := resolve_int("12345", v.Elem(), true, event) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_INT_TAG)) + Expect(i).To(Equal(Number("12345"))) + Expect(i.Int64()).To(Equal(int64(12345))) + + event.value = []byte("1234") + tag, err = resolve(event, v.Elem(), true) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_INT_TAG)) + Expect(i).To(Equal(Number("1234"))) + }) + }) + + Context("UInts", func() { + It("resolves simple uints", func() { + i := uint(0) + v := reflect.ValueOf(&i) + event.value = []byte("1234") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_INT_TAG)) + Expect(i).To(Equal(uint(1234))) + }) + + It("resolves positive uints", func() { + i := uint16(0) + v := reflect.ValueOf(&i) + event.value = []byte("+678") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_INT_TAG)) + Expect(i).To(Equal(uint16(678))) + }) + + It("base 8", func() { + i := uint(0) + v := reflect.ValueOf(&i) + event.value = []byte("0o12") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_INT_TAG)) + Expect(i).To(Equal(uint(10))) + }) + + It("base 16", func() { + i := uint(0) + v := reflect.ValueOf(&i) + event.value = []byte("0xff") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_INT_TAG)) + Expect(i).To(Equal(uint(255))) + }) + + It("fails with negative ints", func() { + i := uint(0) + v := reflect.ValueOf(&i) + event.value = []byte("-2345") + + _, err := resolve(event, v.Elem(), false) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(Equal("Unsigned int with negative value: '-2345' at line 0, column 0")) + }) + + It("fails on overflow", func() { + i := uint8(0) + v := reflect.ValueOf(&i) + event.value = []byte("2345") + + _, err := resolve(event, v.Elem(), false) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(Equal("Invalid unsigned integer: '2345' at line 0, column 0")) + }) + + It("resolves null", func() { + checkNulls(func() { + i := uint(1) + v := reflect.ValueOf(&i) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_NULL_TAG)) + Expect(i).To(Equal(uint(0))) + }) + }) + + It("resolves null pointers", func() { + checkNulls(func() { + i := uint(1) + pi := &i + v := reflect.ValueOf(&pi) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_NULL_TAG)) + Expect(pi).To(BeNil()) + }) + }) + + It("returns a Number", func() { + var i Number + v := reflect.ValueOf(&i) + + tag, err := resolve_uint("12345", v.Elem(), true, event) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_INT_TAG)) + Expect(i).To(Equal(Number("12345"))) + + event.value = []byte("1234") + tag, err = resolve(event, v.Elem(), true) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_INT_TAG)) + Expect(i).To(Equal(Number("1234"))) + }) + }) + + Context("Floats", func() { + It("float32", func() { + f := float32(0) + v := reflect.ValueOf(&f) + event.value = []byte("2345.01") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_FLOAT_TAG)) + Expect(f).To(Equal(float32(2345.01))) + }) + + It("float64", func() { + f := float64(0) + v := reflect.ValueOf(&f) + event.value = []byte("-456456.01") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_FLOAT_TAG)) + Expect(f).To(Equal(float64(-456456.01))) + }) + + It("+inf", func() { + f := float64(0) + v := reflect.ValueOf(&f) + event.value = []byte("+.inf") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_FLOAT_TAG)) + Expect(f).To(Equal(math.Inf(1))) + }) + + It("-inf", func() { + f := float32(0) + v := reflect.ValueOf(&f) + event.value = []byte("-.inf") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_FLOAT_TAG)) + Expect(f).To(Equal(float32(math.Inf(-1)))) + }) + + It("nan", func() { + f := float64(0) + v := reflect.ValueOf(&f) + event.value = []byte(".NaN") + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_FLOAT_TAG)) + Expect(math.IsNaN(f)).To(BeTrue()) + }) + + It("fails on overflow", func() { + i := float32(0) + v := reflect.ValueOf(&i) + event.value = []byte("123e10000") + + _, err := resolve(event, v.Elem(), false) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(Equal("Invalid float: '123e10000' at line 0, column 0")) + }) + + It("fails on invalid float", func() { + i := float32(0) + v := reflect.ValueOf(&i) + event.value = []byte("123e1a") + + _, err := resolve(event, v.Elem(), false) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(Equal("Invalid float: '123e1a' at line 0, column 0")) + }) + + It("resolves null", func() { + checkNulls(func() { + f := float64(1) + v := reflect.ValueOf(&f) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_NULL_TAG)) + Expect(f).To(Equal(0.0)) + }) + }) + + It("resolves null pointers", func() { + checkNulls(func() { + f := float64(1) + pf := &f + v := reflect.ValueOf(&pf) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_NULL_TAG)) + Expect(pf).To(BeNil()) + }) + }) + + It("returns a Number", func() { + var i Number + v := reflect.ValueOf(&i) + + tag, err := resolve_float("12.345", v.Elem(), true, event) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_FLOAT_TAG)) + Expect(i).To(Equal(Number("12.345"))) + Expect(i.Float64()).To(Equal(12.345)) + + event.value = []byte("1.234") + tag, err = resolve(event, v.Elem(), true) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_FLOAT_TAG)) + Expect(i).To(Equal(Number("1.234"))) + }) + }) + + Context("Timestamps", func() { + parse_date := func(val string, date time.Time) { + d := time.Now() + v := reflect.ValueOf(&d) + event.value = []byte(val) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal("")) + Expect(d).To(Equal(date)) + } + + It("date", func() { + parse_date("2002-12-14", time.Date(2002, time.December, 14, 0, 0, 0, 0, time.UTC)) + }) + + It("canonical", func() { + parse_date("2001-12-15T02:59:43.1Z", time.Date(2001, time.December, 15, 2, 59, 43, int(1*time.Millisecond), time.UTC)) + }) + + It("iso8601", func() { + parse_date("2001-12-14t21:59:43.10-05:00", time.Date(2001, time.December, 14, 21, 59, 43, int(10*time.Millisecond), time.FixedZone("", -5*3600))) + }) + + It("space separated", func() { + parse_date("2001-12-14 21:59:43.10 -5", time.Date(2001, time.December, 14, 21, 59, 43, int(10*time.Millisecond), time.FixedZone("", -5*3600))) + }) + + It("no time zone", func() { + parse_date("2001-12-15 2:59:43.10", time.Date(2001, time.December, 15, 2, 59, 43, int(10*time.Millisecond), time.UTC)) + }) + + It("resolves null", func() { + checkNulls(func() { + d := time.Now() + v := reflect.ValueOf(&d) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_NULL_TAG)) + Expect(d).To(Equal(time.Time{})) + }) + }) + + It("resolves null pointers", func() { + checkNulls(func() { + d := time.Now() + pd := &d + v := reflect.ValueOf(&pd) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_NULL_TAG)) + Expect(pd).To(BeNil()) + }) + }) + }) + + Context("Binary tag", func() { + It("string", func() { + checkNulls(func() { + event.value = []byte("YWJjZGVmZw==") + event.tag = []byte("!binary") + aString := "" + v := reflect.ValueOf(&aString) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_STR_TAG)) + Expect(aString).To(Equal("abcdefg")) + }) + }) + + It("[]byte", func() { + checkNulls(func() { + event.value = []byte("YWJjZGVmZw==") + event.tag = []byte("!binary") + bytes := []byte(nil) + v := reflect.ValueOf(&bytes) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_STR_TAG)) + Expect(bytes).To(Equal([]byte("abcdefg"))) + }) + }) + + It("returns a []byte when provided no hints", func() { + checkNulls(func() { + event.value = []byte("YWJjZGVmZw==") + event.tag = []byte("!binary") + var intf interface{} + v := reflect.ValueOf(&intf) + + tag, err := resolve(event, v.Elem(), false) + Expect(err).NotTo(HaveOccurred()) + Expect(tag).To(Equal(yaml_STR_TAG)) + Expect(intf).To(Equal([]byte("abcdefg"))) + }) + }) + }) + + It("fails to resolve a pointer", func() { + aString := "" + pString := &aString + v := reflect.ValueOf(&pString) + event.value = []byte("abc") + + _, err := resolve(event, v.Elem(), false) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(Equal("Unknown resolution for 'abc' using <*string Value> at line 0, column 0")) + }) + }) + + Context("Not an implicit event && no tag", func() { + It("bool returns a string", func() { + event.value = []byte("on") + + tag, result := resolveInterface(event, false) + Expect(result).To(Equal("on")) + Expect(tag).To(Equal("")) + }) + + It("number returns a string", func() { + event.value = []byte("1234") + + tag, result := resolveInterface(event, false) + Expect(result).To(Equal("1234")) + Expect(tag).To(Equal("")) + }) + + It("returns the empty string", func() { + event.value = []byte("") + // event.implicit = true + + tag, result := resolveInterface(event, false) + Expect(result).To(Equal("")) + Expect(tag).To(Equal("")) + }) + }) + }) +}) diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/run_parser.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/run_parser.go new file mode 100644 index 00000000..25c29816 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/run_parser.go @@ -0,0 +1,62 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "fmt" + "os" +) + +func Run_parser(cmd string, args []string) { + for i := 0; i < len(args); i++ { + fmt.Printf("[%d] Scanning '%s'", i, args[i]) + file, err := os.Open(args[i]) + if err != nil { + panic(fmt.Sprintf("Invalid file '%s': %s", args[i], err.Error())) + } + + parser := yaml_parser_t{} + yaml_parser_initialize(&parser) + yaml_parser_set_input_reader(&parser, file) + + failed := false + token := yaml_token_t{} + count := 0 + for { + if !yaml_parser_scan(&parser, &token) { + failed = true + break + } + + if token.token_type == yaml_STREAM_END_TOKEN { + break + } + count++ + } + + file.Close() + + msg := "SUCCESS" + if failed { + msg = "FAILED" + if parser.error != yaml_NO_ERROR { + m := parser.problem_mark + fmt.Printf("ERROR: (%s) %s @ line: %d col: %d\n", + parser.context, parser.problem, m.line, m.column) + } + } + fmt.Printf("%s (%d tokens)\n", msg, count) + } +} diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/scanner.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/scanner.go new file mode 100644 index 00000000..f856a563 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/scanner.go @@ -0,0 +1,3318 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "bytes" +) + +/* + * Introduction + * ************ + * + * The following notes assume that you are familiar with the YAML specification + * (http://yaml.org/spec/cvs/current.html). We mostly follow it, although in + * some cases we are less restrictive that it requires. + * + * The process of transforming a YAML stream into a sequence of events is + * divided on two steps: Scanning and Parsing. + * + * The Scanner transforms the input stream into a sequence of tokens, while the + * parser transform the sequence of tokens produced by the Scanner into a + * sequence of parsing events. + * + * The Scanner is rather clever and complicated. The Parser, on the contrary, + * is a straightforward implementation of a recursive-descendant parser (or, + * LL(1) parser, as it is usually called). + * + * Actually there are two issues of Scanning that might be called "clever", the + * rest is quite straightforward. The issues are "block collection start" and + * "simple keys". Both issues are explained below in details. + * + * Here the Scanning step is explained and implemented. We start with the list + * of all the tokens produced by the Scanner together with short descriptions. + * + * Now, tokens: + * + * STREAM-START(encoding) # The stream start. + * STREAM-END # The stream end. + * VERSION-DIRECTIVE(major,minor) # The '%YAML' directive. + * TAG-DIRECTIVE(handle,prefix) # The '%TAG' directive. + * DOCUMENT-START # '---' + * DOCUMENT-END # '...' + * BLOCK-SEQUENCE-START # Indentation increase denoting a block + * BLOCK-MAPPING-START # sequence or a block mapping. + * BLOCK-END # Indentation decrease. + * FLOW-SEQUENCE-START # '[' + * FLOW-SEQUENCE-END # ']' + * BLOCK-SEQUENCE-START # '{' + * BLOCK-SEQUENCE-END # '}' + * BLOCK-ENTRY # '-' + * FLOW-ENTRY # ',' + * KEY # '?' or nothing (simple keys). + * VALUE # ':' + * ALIAS(anchor) # '*anchor' + * ANCHOR(anchor) # '&anchor' + * TAG(handle,suffix) # '!handle!suffix' + * SCALAR(value,style) # A scalar. + * + * The following two tokens are "virtual" tokens denoting the beginning and the + * end of the stream: + * + * STREAM-START(encoding) + * STREAM-END + * + * We pass the information about the input stream encoding with the + * STREAM-START token. + * + * The next two tokens are responsible for tags: + * + * VERSION-DIRECTIVE(major,minor) + * TAG-DIRECTIVE(handle,prefix) + * + * Example: + * + * %YAML 1.1 + * %TAG ! !foo + * %TAG !yaml! tag:yaml.org,2002: + * --- + * + * The correspoding sequence of tokens: + * + * STREAM-START(utf-8) + * VERSION-DIRECTIVE(1,1) + * TAG-DIRECTIVE("!","!foo") + * TAG-DIRECTIVE("!yaml","tag:yaml.org,2002:") + * DOCUMENT-START + * STREAM-END + * + * Note that the VERSION-DIRECTIVE and TAG-DIRECTIVE tokens occupy a whole + * line. + * + * The document start and end indicators are represented by: + * + * DOCUMENT-START + * DOCUMENT-END + * + * Note that if a YAML stream contains an implicit document (without '---' + * and '...' indicators), no DOCUMENT-START and DOCUMENT-END tokens will be + * produced. + * + * In the following examples, we present whole documents together with the + * produced tokens. + * + * 1. An implicit document: + * + * 'a scalar' + * + * Tokens: + * + * STREAM-START(utf-8) + * SCALAR("a scalar",single-quoted) + * STREAM-END + * + * 2. An explicit document: + * + * --- + * 'a scalar' + * ... + * + * Tokens: + * + * STREAM-START(utf-8) + * DOCUMENT-START + * SCALAR("a scalar",single-quoted) + * DOCUMENT-END + * STREAM-END + * + * 3. Several documents in a stream: + * + * 'a scalar' + * --- + * 'another scalar' + * --- + * 'yet another scalar' + * + * Tokens: + * + * STREAM-START(utf-8) + * SCALAR("a scalar",single-quoted) + * DOCUMENT-START + * SCALAR("another scalar",single-quoted) + * DOCUMENT-START + * SCALAR("yet another scalar",single-quoted) + * STREAM-END + * + * We have already introduced the SCALAR token above. The following tokens are + * used to describe aliases, anchors, tag, and scalars: + * + * ALIAS(anchor) + * ANCHOR(anchor) + * TAG(handle,suffix) + * SCALAR(value,style) + * + * The following series of examples illustrate the usage of these tokens: + * + * 1. A recursive sequence: + * + * &A [ *A ] + * + * Tokens: + * + * STREAM-START(utf-8) + * ANCHOR("A") + * FLOW-SEQUENCE-START + * ALIAS("A") + * FLOW-SEQUENCE-END + * STREAM-END + * + * 2. A tagged scalar: + * + * !!float "3.14" # A good approximation. + * + * Tokens: + * + * STREAM-START(utf-8) + * TAG("!!","float") + * SCALAR("3.14",double-quoted) + * STREAM-END + * + * 3. Various scalar styles: + * + * --- # Implicit empty plain scalars do not produce tokens. + * --- a plain scalar + * --- 'a single-quoted scalar' + * --- "a double-quoted scalar" + * --- |- + * a literal scalar + * --- >- + * a folded + * scalar + * + * Tokens: + * + * STREAM-START(utf-8) + * DOCUMENT-START + * DOCUMENT-START + * SCALAR("a plain scalar",plain) + * DOCUMENT-START + * SCALAR("a single-quoted scalar",single-quoted) + * DOCUMENT-START + * SCALAR("a double-quoted scalar",double-quoted) + * DOCUMENT-START + * SCALAR("a literal scalar",literal) + * DOCUMENT-START + * SCALAR("a folded scalar",folded) + * STREAM-END + * + * Now it's time to review collection-related tokens. We will start with + * flow collections: + * + * FLOW-SEQUENCE-START + * FLOW-SEQUENCE-END + * FLOW-MAPPING-START + * FLOW-MAPPING-END + * FLOW-ENTRY + * KEY + * VALUE + * + * The tokens FLOW-SEQUENCE-START, FLOW-SEQUENCE-END, FLOW-MAPPING-START, and + * FLOW-MAPPING-END represent the indicators '[', ']', '{', and '}' + * correspondingly. FLOW-ENTRY represent the ',' indicator. Finally the + * indicators '?' and ':', which are used for denoting mapping keys and values, + * are represented by the KEY and VALUE tokens. + * + * The following examples show flow collections: + * + * 1. A flow sequence: + * + * [item 1, item 2, item 3] + * + * Tokens: + * + * STREAM-START(utf-8) + * FLOW-SEQUENCE-START + * SCALAR("item 1",plain) + * FLOW-ENTRY + * SCALAR("item 2",plain) + * FLOW-ENTRY + * SCALAR("item 3",plain) + * FLOW-SEQUENCE-END + * STREAM-END + * + * 2. A flow mapping: + * + * { + * a simple key: a value, # Note that the KEY token is produced. + * ? a complex key: another value, + * } + * + * Tokens: + * + * STREAM-START(utf-8) + * FLOW-MAPPING-START + * KEY + * SCALAR("a simple key",plain) + * VALUE + * SCALAR("a value",plain) + * FLOW-ENTRY + * KEY + * SCALAR("a complex key",plain) + * VALUE + * SCALAR("another value",plain) + * FLOW-ENTRY + * FLOW-MAPPING-END + * STREAM-END + * + * A simple key is a key which is not denoted by the '?' indicator. Note that + * the Scanner still produce the KEY token whenever it encounters a simple key. + * + * For scanning block collections, the following tokens are used (note that we + * repeat KEY and VALUE here): + * + * BLOCK-SEQUENCE-START + * BLOCK-MAPPING-START + * BLOCK-END + * BLOCK-ENTRY + * KEY + * VALUE + * + * The tokens BLOCK-SEQUENCE-START and BLOCK-MAPPING-START denote indentation + * increase that precedes a block collection (cf. the INDENT token in Python). + * The token BLOCK-END denote indentation decrease that ends a block collection + * (cf. the DEDENT token in Python). However YAML has some syntax pecularities + * that makes detections of these tokens more complex. + * + * The tokens BLOCK-ENTRY, KEY, and VALUE are used to represent the indicators + * '-', '?', and ':' correspondingly. + * + * The following examples show how the tokens BLOCK-SEQUENCE-START, + * BLOCK-MAPPING-START, and BLOCK-END are emitted by the Scanner: + * + * 1. Block sequences: + * + * - item 1 + * - item 2 + * - + * - item 3.1 + * - item 3.2 + * - + * key 1: value 1 + * key 2: value 2 + * + * Tokens: + * + * STREAM-START(utf-8) + * BLOCK-SEQUENCE-START + * BLOCK-ENTRY + * SCALAR("item 1",plain) + * BLOCK-ENTRY + * SCALAR("item 2",plain) + * BLOCK-ENTRY + * BLOCK-SEQUENCE-START + * BLOCK-ENTRY + * SCALAR("item 3.1",plain) + * BLOCK-ENTRY + * SCALAR("item 3.2",plain) + * BLOCK-END + * BLOCK-ENTRY + * BLOCK-MAPPING-START + * KEY + * SCALAR("key 1",plain) + * VALUE + * SCALAR("value 1",plain) + * KEY + * SCALAR("key 2",plain) + * VALUE + * SCALAR("value 2",plain) + * BLOCK-END + * BLOCK-END + * STREAM-END + * + * 2. Block mappings: + * + * a simple key: a value # The KEY token is produced here. + * ? a complex key + * : another value + * a mapping: + * key 1: value 1 + * key 2: value 2 + * a sequence: + * - item 1 + * - item 2 + * + * Tokens: + * + * STREAM-START(utf-8) + * BLOCK-MAPPING-START + * KEY + * SCALAR("a simple key",plain) + * VALUE + * SCALAR("a value",plain) + * KEY + * SCALAR("a complex key",plain) + * VALUE + * SCALAR("another value",plain) + * KEY + * SCALAR("a mapping",plain) + * BLOCK-MAPPING-START + * KEY + * SCALAR("key 1",plain) + * VALUE + * SCALAR("value 1",plain) + * KEY + * SCALAR("key 2",plain) + * VALUE + * SCALAR("value 2",plain) + * BLOCK-END + * KEY + * SCALAR("a sequence",plain) + * VALUE + * BLOCK-SEQUENCE-START + * BLOCK-ENTRY + * SCALAR("item 1",plain) + * BLOCK-ENTRY + * SCALAR("item 2",plain) + * BLOCK-END + * BLOCK-END + * STREAM-END + * + * YAML does not always require to start a new block collection from a new + * line. If the current line contains only '-', '?', and ':' indicators, a new + * block collection may start at the current line. The following examples + * illustrate this case: + * + * 1. Collections in a sequence: + * + * - - item 1 + * - item 2 + * - key 1: value 1 + * key 2: value 2 + * - ? complex key + * : complex value + * + * Tokens: + * + * STREAM-START(utf-8) + * BLOCK-SEQUENCE-START + * BLOCK-ENTRY + * BLOCK-SEQUENCE-START + * BLOCK-ENTRY + * SCALAR("item 1",plain) + * BLOCK-ENTRY + * SCALAR("item 2",plain) + * BLOCK-END + * BLOCK-ENTRY + * BLOCK-MAPPING-START + * KEY + * SCALAR("key 1",plain) + * VALUE + * SCALAR("value 1",plain) + * KEY + * SCALAR("key 2",plain) + * VALUE + * SCALAR("value 2",plain) + * BLOCK-END + * BLOCK-ENTRY + * BLOCK-MAPPING-START + * KEY + * SCALAR("complex key") + * VALUE + * SCALAR("complex value") + * BLOCK-END + * BLOCK-END + * STREAM-END + * + * 2. Collections in a mapping: + * + * ? a sequence + * : - item 1 + * - item 2 + * ? a mapping + * : key 1: value 1 + * key 2: value 2 + * + * Tokens: + * + * STREAM-START(utf-8) + * BLOCK-MAPPING-START + * KEY + * SCALAR("a sequence",plain) + * VALUE + * BLOCK-SEQUENCE-START + * BLOCK-ENTRY + * SCALAR("item 1",plain) + * BLOCK-ENTRY + * SCALAR("item 2",plain) + * BLOCK-END + * KEY + * SCALAR("a mapping",plain) + * VALUE + * BLOCK-MAPPING-START + * KEY + * SCALAR("key 1",plain) + * VALUE + * SCALAR("value 1",plain) + * KEY + * SCALAR("key 2",plain) + * VALUE + * SCALAR("value 2",plain) + * BLOCK-END + * BLOCK-END + * STREAM-END + * + * YAML also permits non-indented sequences if they are included into a block + * mapping. In this case, the token BLOCK-SEQUENCE-START is not produced: + * + * key: + * - item 1 # BLOCK-SEQUENCE-START is NOT produced here. + * - item 2 + * + * Tokens: + * + * STREAM-START(utf-8) + * BLOCK-MAPPING-START + * KEY + * SCALAR("key",plain) + * VALUE + * BLOCK-ENTRY + * SCALAR("item 1",plain) + * BLOCK-ENTRY + * SCALAR("item 2",plain) + * BLOCK-END + */ + +/* + * Ensure that the buffer contains the required number of characters. + * Return 1 on success, 0 on failure (reader error or memory error). + */ +func cache(parser *yaml_parser_t, length int) bool { + if parser.unread >= length { + return true + } + + return yaml_parser_update_buffer(parser, length) +} + +/* + * Advance the buffer pointer. + */ +func skip(parser *yaml_parser_t) { + parser.mark.index++ + parser.mark.column++ + parser.unread-- + parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) +} + +func skip_line(parser *yaml_parser_t) { + if is_crlf_at(parser.buffer, parser.buffer_pos) { + parser.mark.index += 2 + parser.mark.column = 0 + parser.mark.line++ + parser.unread -= 2 + parser.buffer_pos += 2 + } else if is_break_at(parser.buffer, parser.buffer_pos) { + parser.mark.index++ + parser.mark.column = 0 + parser.mark.line++ + parser.unread-- + parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) + } +} + +/* + * Copy a character to a string buffer and advance pointers. + */ + +func read(parser *yaml_parser_t, s []byte) []byte { + w := width(parser.buffer[parser.buffer_pos]) + if w == 0 { + panic("invalid character sequence") + } + if len(s) == 0 { + s = make([]byte, 0, 32) + } + if w == 1 && len(s)+w <= cap(s) { + s = s[:len(s)+1] + s[len(s)-1] = parser.buffer[parser.buffer_pos] + parser.buffer_pos++ + } else { + s = append(s, parser.buffer[parser.buffer_pos:parser.buffer_pos+w]...) + parser.buffer_pos += w + } + parser.mark.index++ + parser.mark.column++ + parser.unread-- + return s +} + +/* + * Copy a line break character to a string buffer and advance pointers. + */ +func read_line(parser *yaml_parser_t, s []byte) []byte { + buf := parser.buffer + pos := parser.buffer_pos + if buf[pos] == '\r' && buf[pos+1] == '\n' { + /* CR LF . LF */ + s = append(s, '\n') + parser.buffer_pos += 2 + parser.mark.index++ + parser.unread-- + } else if buf[pos] == '\r' || buf[pos] == '\n' { + /* CR|LF . LF */ + s = append(s, '\n') + parser.buffer_pos += 1 + } else if buf[pos] == '\xC2' && buf[pos+1] == '\x85' { + /* NEL . LF */ + s = append(s, '\n') + parser.buffer_pos += 2 + } else if buf[pos] == '\xE2' && buf[pos+1] == '\x80' && + (buf[pos+2] == '\xA8' || buf[pos+2] == '\xA9') { + // LS|PS . LS|PS + s = append(s, buf[parser.buffer_pos:pos+3]...) + parser.buffer_pos += 3 + } else { + return s + } + + parser.mark.index++ + parser.mark.column = 0 + parser.mark.line++ + parser.unread-- + return s +} + +/* + * Get the next token. + */ + +func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool { + /* Erase the token object. */ + *token = yaml_token_t{} + + /* No tokens after STREAM-END or error. */ + + if parser.stream_end_produced || parser.error != yaml_NO_ERROR { + return true + } + + /* Ensure that the tokens queue contains enough tokens. */ + + if !parser.token_available { + if !yaml_parser_fetch_more_tokens(parser) { + return false + } + } + + /* Fetch the next token from the queue. */ + + *token = parser.tokens[parser.tokens_head] + parser.tokens_head++ + parser.token_available = false + parser.tokens_parsed++ + + if token.token_type == yaml_STREAM_END_TOKEN { + parser.stream_end_produced = true + } + + return true +} + +/* + * Set the scanner error and return 0. + */ + +func yaml_parser_set_scanner_error(parser *yaml_parser_t, context string, + context_mark YAML_mark_t, problem string) bool { + parser.error = yaml_SCANNER_ERROR + parser.context = context + parser.context_mark = context_mark + parser.problem = problem + parser.problem_mark = parser.mark + + return false +} + +func yaml_parser_set_scanner_tag_error(parser *yaml_parser_t, directive bool, context_mark YAML_mark_t, problem string) bool { + context := "while parsing a %TAG directive" + if directive { + context = "while parsing a tag" + } + return yaml_parser_set_scanner_error(parser, context, context_mark, "did not find URI escaped octet") +} + +/* + * Ensure that the tokens queue contains at least one token which can be + * returned to the Parser. + */ + +func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool { + /* While we need more tokens to fetch, do it. */ + + for { + /* + * Check if we really need to fetch more tokens. + */ + + need_more_tokens := false + + if parser.tokens_head == len(parser.tokens) { + /* Queue is empty. */ + + need_more_tokens = true + } else { + + /* Check if any potential simple key may occupy the head position. */ + + if !yaml_parser_stale_simple_keys(parser) { + return false + } + + for i := range parser.simple_keys { + simple_key := &parser.simple_keys[i] + + if simple_key.possible && + simple_key.token_number == parser.tokens_parsed { + need_more_tokens = true + break + } + } + } + if len(parser.simple_keys) > 0 { + + } + /* We are finished. */ + + if !need_more_tokens { + break + } + + /* Fetch the next token. */ + + if !yaml_parser_fetch_next_token(parser) { + return false + } + + } + + parser.token_available = true + + return true +} + +/* + * The dispatcher for token fetchers. + */ + +func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool { + /* Ensure that the buffer is initialized. */ + + if !cache(parser, 1) { + return false + } + + /* Check if we just started scanning. Fetch STREAM-START then. */ + + if !parser.stream_start_produced { + return yaml_parser_fetch_stream_start(parser) + } + + /* Eat whitespaces and comments until we reach the next token. */ + + if !yaml_parser_scan_to_next_token(parser) { + return false + } + + /* Remove obsolete potential simple keys. */ + + if !yaml_parser_stale_simple_keys(parser) { + return false + } + + /* Check the indentation level against the current column. */ + + if !yaml_parser_unroll_indent(parser, parser.mark.column) { + return false + } + + /* + * Ensure that the buffer contains at least 4 characters. 4 is the length + * of the longest indicators ('--- ' and '... '). + */ + + if !cache(parser, 4) { + return false + } + + /* Is it the end of the stream? */ + buf := parser.buffer + pos := parser.buffer_pos + + if is_z(buf[pos]) { + return yaml_parser_fetch_stream_end(parser) + } + + /* Is it a directive? */ + + if parser.mark.column == 0 && buf[pos] == '%' { + return yaml_parser_fetch_directive(parser) + } + + /* Is it the document start indicator? */ + + if parser.mark.column == 0 && + buf[pos] == '-' && buf[pos+1] == '-' && buf[pos+2] == '-' && + is_blankz_at(buf, pos+3) { + return yaml_parser_fetch_document_indicator(parser, + yaml_DOCUMENT_START_TOKEN) + } + + /* Is it the document end indicator? */ + + if parser.mark.column == 0 && + buf[pos] == '.' && buf[pos+1] == '.' && buf[pos+2] == '.' && + is_blankz_at(buf, pos+3) { + return yaml_parser_fetch_document_indicator(parser, + yaml_DOCUMENT_END_TOKEN) + } + + /* Is it the flow sequence start indicator? */ + + if buf[pos] == '[' { + return yaml_parser_fetch_flow_collection_start(parser, + yaml_FLOW_SEQUENCE_START_TOKEN) + } + + /* Is it the flow mapping start indicator? */ + + if buf[pos] == '{' { + return yaml_parser_fetch_flow_collection_start(parser, + yaml_FLOW_MAPPING_START_TOKEN) + } + + /* Is it the flow sequence end indicator? */ + + if buf[pos] == ']' { + return yaml_parser_fetch_flow_collection_end(parser, + yaml_FLOW_SEQUENCE_END_TOKEN) + } + + /* Is it the flow mapping end indicator? */ + + if buf[pos] == '}' { + return yaml_parser_fetch_flow_collection_end(parser, + yaml_FLOW_MAPPING_END_TOKEN) + } + + /* Is it the flow entry indicator? */ + + if buf[pos] == ',' { + return yaml_parser_fetch_flow_entry(parser) + } + + /* Is it the block entry indicator? */ + if buf[pos] == '-' && is_blankz_at(buf, pos+1) { + return yaml_parser_fetch_block_entry(parser) + } + + /* Is it the key indicator? */ + if buf[pos] == '?' && + (parser.flow_level > 0 || is_blankz_at(buf, pos+1)) { + return yaml_parser_fetch_key(parser) + } + + /* Is it the value indicator? */ + if buf[pos] == ':' && + (parser.flow_level > 0 || is_blankz_at(buf, pos+1)) { + return yaml_parser_fetch_value(parser) + } + + /* Is it an alias? */ + if buf[pos] == '*' { + return yaml_parser_fetch_anchor(parser, yaml_ALIAS_TOKEN) + } + + /* Is it an anchor? */ + + if buf[pos] == '&' { + return yaml_parser_fetch_anchor(parser, yaml_ANCHOR_TOKEN) + } + + /* Is it a tag? */ + + if buf[pos] == '!' { + return yaml_parser_fetch_tag(parser) + } + + /* Is it a literal scalar? */ + if buf[pos] == '|' && parser.flow_level == 0 { + return yaml_parser_fetch_block_scalar(parser, true) + } + + /* Is it a folded scalar? */ + if buf[pos] == '>' && parser.flow_level == 0 { + return yaml_parser_fetch_block_scalar(parser, false) + } + + /* Is it a single-quoted scalar? */ + + if buf[pos] == '\'' { + return yaml_parser_fetch_flow_scalar(parser, true) + } + + /* Is it a double-quoted scalar? */ + if buf[pos] == '"' { + return yaml_parser_fetch_flow_scalar(parser, false) + } + + /* + * Is it a plain scalar? + * + * A plain scalar may start with any non-blank characters except + * + * '-', '?', ':', ',', '[', ']', '{', '}', + * '#', '&', '*', '!', '|', '>', '\'', '\"', + * '%', '@', '`'. + * + * In the block context (and, for the '-' indicator, in the flow context + * too), it may also start with the characters + * + * '-', '?', ':' + * + * if it is followed by a non-space character. + * + * The last rule is more restrictive than the specification requires. + */ + + b := buf[pos] + if !(is_blankz_at(buf, pos) || b == '-' || + b == '?' || b == ':' || + b == ',' || b == '[' || + b == ']' || b == '{' || + b == '}' || b == '#' || + b == '&' || b == '*' || + b == '!' || b == '|' || + b == '>' || b == '\'' || + b == '"' || b == '%' || + b == '@' || b == '`') || + (b == '-' && !is_blank(buf[pos+1])) || + (parser.flow_level == 0 && + (buf[pos] == '?' || buf[pos+1] == ':') && + !is_blank(buf[pos+1])) { + return yaml_parser_fetch_plain_scalar(parser) + } + + /* + * If we don't determine the token type so far, it is an error. + */ + + return yaml_parser_set_scanner_error(parser, + "while scanning for the next token", parser.mark, + "found character that cannot start any token") +} + +/* + * Check the list of potential simple keys and remove the positions that + * cannot contain simple keys anymore. + */ + +func yaml_parser_stale_simple_keys(parser *yaml_parser_t) bool { + /* Check for a potential simple key for each flow level. */ + + for i := range parser.simple_keys { + /* + * The specification requires that a simple key + * + * - is limited to a single line, + * - is shorter than 1024 characters. + */ + + simple_key := &parser.simple_keys[i] + if simple_key.possible && + (simple_key.mark.line < parser.mark.line || + simple_key.mark.index+1024 < parser.mark.index) { + + /* Check if the potential simple key to be removed is required. */ + + if simple_key.required { + return yaml_parser_set_scanner_error(parser, + "while scanning a simple key", simple_key.mark, + "could not find expected ':'") + } + + simple_key.possible = false + } + } + + return true +} + +/* + * Check if a simple key may start at the current position and add it if + * needed. + */ + +func yaml_parser_save_simple_key(parser *yaml_parser_t) bool { + /* + * A simple key is required at the current position if the scanner is in + * the block context and the current column coincides with the indentation + * level. + */ + + required := (parser.flow_level == 0 && + parser.indent == parser.mark.column) + + /* + * A simple key is required only when it is the first token in the current + * line. Therefore it is always allowed. But we add a check anyway. + */ + if required && !parser.simple_key_allowed { + panic("impossible") /* Impossible. */ + } + + /* + * If the current position may start a simple key, save it. + */ + + if parser.simple_key_allowed { + simple_key := yaml_simple_key_t{ + possible: true, + required: required, + token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), + } + simple_key.mark = parser.mark + + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_keys[len(parser.simple_keys)-1] = simple_key + } + + return true +} + +/* + * Remove a potential simple key at the current flow level. + */ + +func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool { + simple_key := &parser.simple_keys[len(parser.simple_keys)-1] + + if simple_key.possible { + /* If the key is required, it is an error. */ + + if simple_key.required { + return yaml_parser_set_scanner_error(parser, + "while scanning a simple key", simple_key.mark, + "could not find expected ':'") + } + } + + /* Remove the key from the stack. */ + + simple_key.possible = false + + return true +} + +/* + * Increase the flow level and resize the simple key list if needed. + */ + +func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool { + /* Reset the simple key on the next level. */ + + parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{}) + + /* Increase the flow level. */ + + parser.flow_level++ + + return true +} + +/* + * Decrease the flow level. + */ + +func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool { + if parser.flow_level > 0 { + parser.flow_level-- + parser.simple_keys = parser.simple_keys[:len(parser.simple_keys)-1] + } + + return true +} + +/* + * Push the current indentation level to the stack and set the new level + * the current column is greater than the indentation level. In this case, + * append or insert the specified token into the token queue. + * + */ + +func yaml_parser_roll_indent(parser *yaml_parser_t, column int, + number int, token_type yaml_token_type_t, mark YAML_mark_t) bool { + /* In the flow context, do nothing. */ + + if parser.flow_level > 0 { + return true + } + + if parser.indent == -1 || parser.indent < column { + /* + * Push the current indentation level to the stack and set the new + * indentation level. + */ + + parser.indents = append(parser.indents, parser.indent) + parser.indent = column + + /* Create a token and insert it into the queue. */ + token := yaml_token_t{ + token_type: token_type, + start_mark: mark, + end_mark: mark, + } + + // number == -1 -> enqueue otherwise insert + if number > -1 { + number -= parser.tokens_parsed + } + insert_token(parser, number, &token) + } + + return true +} + +/* + * Pop indentation levels from the indents stack until the current level + * becomes less or equal to the column. For each indentation level, append + * the BLOCK-END token. + */ + +func yaml_parser_unroll_indent(parser *yaml_parser_t, column int) bool { + /* In the flow context, do nothing. */ + + if parser.flow_level > 0 { + return true + } + + /* + * column is unsigned and parser->indent is signed, so if + * parser->indent is less than zero the conditional in the while + * loop below is incorrect. Guard against that. + */ + + if parser.indent < 0 { + return true + } + + /* Loop through the indentation levels in the stack. */ + + for parser.indent > column { + /* Create a token and append it to the queue. */ + token := yaml_token_t{ + token_type: yaml_BLOCK_END_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + } + insert_token(parser, -1, &token) + + /* Pop the indentation level. */ + parser.indent = parser.indents[len(parser.indents)-1] + parser.indents = parser.indents[:len(parser.indents)-1] + + } + + return true +} + +/* + * Pop indentation levels from the indents stack until the current + * level resets to -1. For each indentation level, append the + * BLOCK-END token. + */ + +func yaml_parser_reset_indent(parser *yaml_parser_t) bool { + /* In the flow context, do nothing. */ + + if parser.flow_level > 0 { + return true + } + + /* Loop through the indentation levels in the stack. */ + + for parser.indent > -1 { + /* Create a token and append it to the queue. */ + + token := yaml_token_t{ + token_type: yaml_BLOCK_END_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + } + insert_token(parser, -1, &token) + + /* Pop the indentation level. */ + parser.indent = parser.indents[len(parser.indents)-1] + parser.indents = parser.indents[:len(parser.indents)-1] + } + + return true +} + +/* + * Initialize the scanner and produce the STREAM-START token. + */ + +func yaml_parser_fetch_stream_start(parser *yaml_parser_t) bool { + /* Set the initial indentation. */ + + parser.indent = -1 + + /* Initialize the simple key stack. */ + parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{}) + + /* A simple key is allowed at the beginning of the stream. */ + + parser.simple_key_allowed = true + + /* We have started. */ + + parser.stream_start_produced = true + + /* Create the STREAM-START token and append it to the queue. */ + token := yaml_token_t{ + token_type: yaml_STREAM_START_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + encoding: parser.encoding, + } + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce the STREAM-END token and shut down the scanner. + */ + +func yaml_parser_fetch_stream_end(parser *yaml_parser_t) bool { + /* Force new line. */ + + if parser.mark.column != 0 { + parser.mark.column = 0 + parser.mark.line++ + } + + /* Reset the indentation level. */ + + if !yaml_parser_reset_indent(parser) { + return false + } + + /* Reset simple keys. */ + + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + /* Create the STREAM-END token and append it to the queue. */ + token := yaml_token_t{ + token_type: yaml_STREAM_END_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + } + + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce a VERSION-DIRECTIVE or TAG-DIRECTIVE token. + */ + +func yaml_parser_fetch_directive(parser *yaml_parser_t) bool { + /* Reset the indentation level. */ + + if !yaml_parser_reset_indent(parser) { + return false + } + + /* Reset simple keys. */ + + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + /* Create the YAML-DIRECTIVE or TAG-DIRECTIVE token. */ + var token yaml_token_t + if !yaml_parser_scan_directive(parser, &token) { + return false + } + + /* Append the token to the queue. */ + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce the DOCUMENT-START or DOCUMENT-END token. + */ + +func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, + token_type yaml_token_type_t) bool { + + /* Reset the indentation level. */ + + if !yaml_parser_reset_indent(parser) { + return false + } + + /* Reset simple keys. */ + + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + /* Consume the token. */ + + start_mark := parser.mark + + skip(parser) + skip(parser) + skip(parser) + + end_mark := parser.mark + + /* Create the DOCUMENT-START or DOCUMENT-END token. */ + + token := yaml_token_t{ + token_type: token_type, + start_mark: start_mark, + end_mark: end_mark, + } + + /* Append the token to the queue. */ + + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce the FLOW-SEQUENCE-START or FLOW-MAPPING-START token. + */ + +func yaml_parser_fetch_flow_collection_start(parser *yaml_parser_t, + token_type yaml_token_type_t) bool { + + /* The indicators '[' and '{' may start a simple key. */ + + if !yaml_parser_save_simple_key(parser) { + return false + } + + /* Increase the flow level. */ + + if !yaml_parser_increase_flow_level(parser) { + return false + } + + /* A simple key may follow the indicators '[' and '{'. */ + + parser.simple_key_allowed = true + + /* Consume the token. */ + + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + /* Create the FLOW-SEQUENCE-START of FLOW-MAPPING-START token. */ + + token := yaml_token_t{ + token_type: token_type, + start_mark: start_mark, + end_mark: end_mark, + } + + /* Append the token to the queue. */ + + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce the FLOW-SEQUENCE-END or FLOW-MAPPING-END token. + */ + +func yaml_parser_fetch_flow_collection_end(parser *yaml_parser_t, + token_type yaml_token_type_t) bool { + + /* Reset any potential simple key on the current flow level. */ + + if !yaml_parser_remove_simple_key(parser) { + return false + } + + /* Decrease the flow level. */ + + if !yaml_parser_decrease_flow_level(parser) { + return false + } + + /* No simple keys after the indicators ']' and '}'. */ + + parser.simple_key_allowed = false + + /* Consume the token. */ + + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + /* Create the FLOW-SEQUENCE-END of FLOW-MAPPING-END token. */ + + token := yaml_token_t{ + token_type: token_type, + start_mark: start_mark, + end_mark: end_mark, + } + + /* Append the token to the queue. */ + + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce the FLOW-ENTRY token. + */ + +func yaml_parser_fetch_flow_entry(parser *yaml_parser_t) bool { + + /* Reset any potential simple keys on the current flow level. */ + + if !yaml_parser_remove_simple_key(parser) { + return false + } + + /* Simple keys are allowed after ','. */ + + parser.simple_key_allowed = true + + /* Consume the token. */ + + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + /* Create the FLOW-ENTRY token and append it to the queue. */ + + token := yaml_token_t{ + token_type: yaml_FLOW_ENTRY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce the BLOCK-ENTRY token. + */ + +func yaml_parser_fetch_block_entry(parser *yaml_parser_t) bool { + + /* Check if the scanner is in the block context. */ + + if parser.flow_level == 0 { + /* Check if we are allowed to start a new entry. */ + + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "block sequence entries are not allowed in this context") + } + + /* Add the BLOCK-SEQUENCE-START token if needed. */ + + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, + yaml_BLOCK_SEQUENCE_START_TOKEN, parser.mark) { + return false + } + } else { + /* + * It is an error for the '-' indicator to occur in the flow context, + * but we let the Parser detect and report about it because the Parser + * is able to point to the context. + */ + } + + /* Reset any potential simple keys on the current flow level. */ + + if !yaml_parser_remove_simple_key(parser) { + return false + } + + /* Simple keys are allowed after '-'. */ + + parser.simple_key_allowed = true + + /* Consume the token. */ + + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + /* Create the BLOCK-ENTRY token and append it to the queue. */ + + token := yaml_token_t{ + token_type: yaml_BLOCK_ENTRY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce the KEY token. + */ + +func yaml_parser_fetch_key(parser *yaml_parser_t) bool { + /* In the block context, additional checks are required. */ + + if parser.flow_level == 0 { + /* Check if we are allowed to start a new key (not nessesary simple). */ + + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "mapping keys are not allowed in this context") + } + + /* Add the BLOCK-MAPPING-START token if needed. */ + + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, + yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { + return false + } + } + + /* Reset any potential simple keys on the current flow level. */ + + if !yaml_parser_remove_simple_key(parser) { + return false + } + + /* Simple keys are allowed after '?' in the block context. */ + + parser.simple_key_allowed = (parser.flow_level == 0) + + /* Consume the token. */ + + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + /* Create the KEY token and append it to the queue. */ + + token := yaml_token_t{ + token_type: yaml_KEY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce the VALUE token. + */ + +func yaml_parser_fetch_value(parser *yaml_parser_t) bool { + + simple_key := &parser.simple_keys[len(parser.simple_keys)-1] + + /* Have we found a simple key? */ + + if simple_key.possible { + + /* Create the KEY token and insert it into the queue. */ + + token := yaml_token_t{ + token_type: yaml_KEY_TOKEN, + start_mark: simple_key.mark, + end_mark: simple_key.mark, + } + + insert_token(parser, simple_key.token_number-parser.tokens_parsed, &token) + + /* In the block context, we may need to add the BLOCK-MAPPING-START token. */ + + if !yaml_parser_roll_indent(parser, simple_key.mark.column, + simple_key.token_number, + yaml_BLOCK_MAPPING_START_TOKEN, simple_key.mark) { + return false + } + + /* Remove the simple key. */ + + simple_key.possible = false + + /* A simple key cannot follow another simple key. */ + + parser.simple_key_allowed = false + } else { + /* The ':' indicator follows a complex key. */ + + /* In the block context, extra checks are required. */ + + if parser.flow_level == 0 { + /* Check if we are allowed to start a complex value. */ + + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "mapping values are not allowed in this context") + } + + /* Add the BLOCK-MAPPING-START token if needed. */ + + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, + yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { + return false + } + } + + /* Simple keys after ':' are allowed in the block context. */ + + parser.simple_key_allowed = (parser.flow_level == 0) + } + + /* Consume the token. */ + + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + /* Create the VALUE token and append it to the queue. */ + + token := yaml_token_t{ + token_type: yaml_VALUE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce the ALIAS or ANCHOR token. + */ + +func yaml_parser_fetch_anchor(parser *yaml_parser_t, token_type yaml_token_type_t) bool { + + /* An anchor or an alias could be a simple key. */ + + if !yaml_parser_save_simple_key(parser) { + return false + } + + /* A simple key cannot follow an anchor or an alias. */ + + parser.simple_key_allowed = false + + /* Create the ALIAS or ANCHOR token and append it to the queue. */ + var token yaml_token_t + if !yaml_parser_scan_anchor(parser, &token, token_type) { + return false + } + + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce the TAG token. + */ + +func yaml_parser_fetch_tag(parser *yaml_parser_t) bool { + /* A tag could be a simple key. */ + + if !yaml_parser_save_simple_key(parser) { + return false + } + + /* A simple key cannot follow a tag. */ + + parser.simple_key_allowed = false + + /* Create the TAG token and append it to the queue. */ + var token yaml_token_t + if !yaml_parser_scan_tag(parser, &token) { + return false + } + + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce the SCALAR(...,literal) or SCALAR(...,folded) tokens. + */ + +func yaml_parser_fetch_block_scalar(parser *yaml_parser_t, literal bool) bool { + /* Remove any potential simple keys. */ + + if !yaml_parser_remove_simple_key(parser) { + return false + } + + /* A simple key may follow a block scalar. */ + + parser.simple_key_allowed = true + + /* Create the SCALAR token and append it to the queue. */ + var token yaml_token_t + if !yaml_parser_scan_block_scalar(parser, &token, literal) { + return false + } + + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce the SCALAR(...,single-quoted) or SCALAR(...,double-quoted) tokens. + */ + +func yaml_parser_fetch_flow_scalar(parser *yaml_parser_t, single bool) bool { + + /* A plain scalar could be a simple key. */ + + if !yaml_parser_save_simple_key(parser) { + return false + } + + /* A simple key cannot follow a flow scalar. */ + + parser.simple_key_allowed = false + + /* Create the SCALAR token and append it to the queue. */ + var token yaml_token_t + if !yaml_parser_scan_flow_scalar(parser, &token, single) { + return false + } + + insert_token(parser, -1, &token) + + return true +} + +/* + * Produce the SCALAR(...,plain) token. + */ + +func yaml_parser_fetch_plain_scalar(parser *yaml_parser_t) bool { + /* A plain scalar could be a simple key. */ + + if !yaml_parser_save_simple_key(parser) { + return false + } + + /* A simple key cannot follow a flow scalar. */ + + parser.simple_key_allowed = false + + /* Create the SCALAR token and append it to the queue. */ + var token yaml_token_t + if !yaml_parser_scan_plain_scalar(parser, &token) { + return false + } + + insert_token(parser, -1, &token) + + return true +} + +/* + * Eat whitespaces and comments until the next token is found. + */ + +func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { + /* Until the next token is not found. */ + + for { + /* Allow the BOM mark to start a line. */ + + if !cache(parser, 1) { + return false + } + + if parser.mark.column == 0 && is_bom_at(parser.buffer, parser.buffer_pos) { + skip(parser) + } + + /* + * Eat whitespaces. + * + * Tabs are allowed: + * + * - in the flow context; + * - in the block context, but not at the beginning of the line or + * after '-', '?', or ':' (complex value). + */ + + if !cache(parser, 1) { + return false + } + + for parser.buffer[parser.buffer_pos] == ' ' || + ((parser.flow_level > 0 || !parser.simple_key_allowed) && + parser.buffer[parser.buffer_pos] == '\t') { + skip(parser) + if !cache(parser, 1) { + return false + } + } + + /* Eat a comment until a line break. */ + + if parser.buffer[parser.buffer_pos] == '#' { + for !is_breakz_at(parser.buffer, parser.buffer_pos) { + skip(parser) + if !cache(parser, 1) { + return false + } + } + } + + /* If it is a line break, eat it. */ + + if is_break_at(parser.buffer, parser.buffer_pos) { + if !cache(parser, 2) { + return false + } + skip_line(parser) + + /* In the block context, a new line may start a simple key. */ + + if parser.flow_level == 0 { + parser.simple_key_allowed = true + } + } else { + /* We have found a token. */ + + break + } + } + + return true +} + +/* + * Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. + * + * Scope: + * %YAML 1.1 # a comment \n + * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + * %TAG !yaml! tag:yaml.org,2002: \n + * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + */ + +func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { + /* Eat '%'. */ + + start_mark := parser.mark + + skip(parser) + + /* Scan the directive name. */ + var name []byte + if !yaml_parser_scan_directive_name(parser, start_mark, &name) { + return false + } + + /* Is it a YAML directive? */ + var major, minor int + if bytes.Equal(name, []byte("YAML")) { + /* Scan the VERSION directive value. */ + + if !yaml_parser_scan_version_directive_value(parser, start_mark, + &major, &minor) { + return false + } + + end_mark := parser.mark + + /* Create a VERSION-DIRECTIVE token. */ + + *token = yaml_token_t{ + token_type: yaml_VERSION_DIRECTIVE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + major: major, + minor: minor, + } + } else if bytes.Equal(name, []byte("TAG")) { + /* Is it a TAG directive? */ + /* Scan the TAG directive value. */ + var handle, prefix []byte + if !yaml_parser_scan_tag_directive_value(parser, start_mark, + &handle, &prefix) { + return false + } + + end_mark := parser.mark + + /* Create a TAG-DIRECTIVE token. */ + + *token = yaml_token_t{ + token_type: yaml_TAG_DIRECTIVE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: handle, + prefix: prefix, + } + } else { + /* Unknown directive. */ + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "found uknown directive name") + return false + } + + /* Eat the rest of the line including any comments. */ + + if !cache(parser, 1) { + return false + } + + for is_blank(parser.buffer[parser.buffer_pos]) { + skip(parser) + if !cache(parser, 1) { + return false + } + } + + if parser.buffer[parser.buffer_pos] == '#' { + for !is_breakz_at(parser.buffer, parser.buffer_pos) { + skip(parser) + if !cache(parser, 1) { + return false + } + } + } + + /* Check if we are at the end of the line. */ + + if !is_breakz_at(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "did not find expected comment or line break") + return false + } + + /* Eat a line break. */ + + if is_break_at(parser.buffer, parser.buffer_pos) { + if !cache(parser, 2) { + return false + } + skip_line(parser) + } + + return true +} + +/* + * Scan the directive name. + * + * Scope: + * %YAML 1.1 # a comment \n + * ^^^^ + * %TAG !yaml! tag:yaml.org,2002: \n + * ^^^ + */ + +func yaml_parser_scan_directive_name(parser *yaml_parser_t, + start_mark YAML_mark_t, name *[]byte) bool { + + /* Consume the directive name. */ + + if !cache(parser, 1) { + return false + } + + var s []byte + for is_alpha(parser.buffer[parser.buffer_pos]) { + s = read(parser, s) + if !cache(parser, 1) { + return false + } + } + + /* Check if the name is empty. */ + + if len(s) == 0 { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "could not find expected directive name") + return false + } + + /* Check for an blank character after the name. */ + + if !is_blankz_at(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "found unexpected non-alphabetical character") + return false + } + + *name = s + + return true +} + +/* + * Scan the value of VERSION-DIRECTIVE. + * + * Scope: + * %YAML 1.1 # a comment \n + * ^^^^^^ + */ + +func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, + start_mark YAML_mark_t, major *int, minor *int) bool { + /* Eat whitespaces. */ + + if !cache(parser, 1) { + return false + } + + for is_blank(parser.buffer[parser.buffer_pos]) { + skip(parser) + if !cache(parser, 1) { + return false + } + } + + /* Consume the major version number. */ + + if !yaml_parser_scan_version_directive_number(parser, start_mark, major) { + return false + } + + /* Eat '.'. */ + + if parser.buffer[parser.buffer_pos] != '.' { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "did not find expected digit or '.' character") + } + + skip(parser) + + /* Consume the minor version number. */ + + if !yaml_parser_scan_version_directive_number(parser, start_mark, minor) { + return false + } + + return true +} + +const MAX_NUMBER_LENGTH = 9 + +/* + * Scan the version number of VERSION-DIRECTIVE. + * + * Scope: + * %YAML 1.1 # a comment \n + * ^ + * %YAML 1.1 # a comment \n + * ^ + */ + +func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, + start_mark YAML_mark_t, number *int) bool { + + /* Repeat while the next character is digit. */ + + if !cache(parser, 1) { + return false + } + + value := 0 + length := 0 + for is_digit(parser.buffer[parser.buffer_pos]) { + /* Check if the number is too long. */ + + length++ + if length > MAX_NUMBER_LENGTH { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "found extremely long version number") + } + + value = value*10 + as_digit(parser.buffer[parser.buffer_pos]) + + skip(parser) + + if !cache(parser, 1) { + return false + } + } + + /* Check if the number was present. */ + + if length == 0 { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "did not find expected version number") + } + + *number = value + + return true +} + +/* + * Scan the value of a TAG-DIRECTIVE token. + * + * Scope: + * %TAG !yaml! tag:yaml.org,2002: \n + * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + */ + +func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, + start_mark YAML_mark_t, handle, prefix *[]byte) bool { + + /* Eat whitespaces. */ + + if !cache(parser, 1) { + return false + } + + for is_blank(parser.buffer[parser.buffer_pos]) { + skip(parser) + if !cache(parser, 1) { + return false + } + } + + /* Scan a handle. */ + var handle_value []byte + if !yaml_parser_scan_tag_handle(parser, true, start_mark, &handle_value) { + return false + } + + /* Expect a whitespace. */ + + if !cache(parser, 1) { + return false + } + + if !is_blank(parser.buffer[parser.buffer_pos]) { + yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", + start_mark, "did not find expected whitespace") + return false + } + + /* Eat whitespaces. */ + + for is_blank(parser.buffer[parser.buffer_pos]) { + skip(parser) + if !cache(parser, 1) { + return false + } + } + + /* Scan a prefix. */ + var prefix_value []byte + if !yaml_parser_scan_tag_uri(parser, true, nil, start_mark, &prefix_value) { + return false + } + + /* Expect a whitespace or line break. */ + + if !cache(parser, 1) { + return false + } + + if !is_blankz_at(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", + start_mark, "did not find expected whitespace or line break") + return false + } + + *handle = handle_value + *prefix = prefix_value + + return true +} + +func yaml_parser_scan_anchor(parser *yaml_parser_t, token *yaml_token_t, + token_type yaml_token_type_t) bool { + + /* Eat the indicator character. */ + + start_mark := parser.mark + + skip(parser) + + /* Consume the value. */ + + if !cache(parser, 1) { + return false + } + + var s []byte + for is_alpha(parser.buffer[parser.buffer_pos]) { + s = read(parser, s) + if !cache(parser, 1) { + return false + } + } + + end_mark := parser.mark + + /* + * Check if length of the anchor is greater than 0 and it is followed by + * a whitespace character or one of the indicators: + * + * '?', ':', ',', ']', '}', '%', '@', '`'. + */ + + b := parser.buffer[parser.buffer_pos] + if len(s) == 0 || !(is_blankz_at(parser.buffer, parser.buffer_pos) || b == '?' || + b == ':' || b == ',' || + b == ']' || b == '}' || + b == '%' || b == '@' || + b == '`') { + context := "while scanning an anchor" + if token_type != yaml_ANCHOR_TOKEN { + context = "while scanning an alias" + } + yaml_parser_set_scanner_error(parser, context, start_mark, + "did not find expected alphabetic or numeric character") + return false + } + + /* Create a token. */ + *token = yaml_token_t{ + token_type: token_type, + start_mark: start_mark, + end_mark: end_mark, + value: s, + } + + return true +} + +/* + * Scan a TAG token. + */ + +func yaml_parser_scan_tag(parser *yaml_parser_t, token *yaml_token_t) bool { + start_mark := parser.mark + + /* Check if the tag is in the canonical form. */ + + if !cache(parser, 2) { + return false + } + + var handle []byte + var suffix []byte + if parser.buffer[parser.buffer_pos+1] == '<' { + /* Set the handle to '' */ + + /* Eat '!<' */ + + skip(parser) + skip(parser) + + /* Consume the tag value. */ + + if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { + return false + } + + /* Check for '>' and eat it. */ + + if parser.buffer[parser.buffer_pos] != '>' { + yaml_parser_set_scanner_error(parser, "while scanning a tag", + start_mark, "did not find the expected '>'") + return false + } + + skip(parser) + } else if is_blank(parser.buffer[parser.buffer_pos+1]) { + // NON-SPECIFIED + skip(parser) + } else { + /* The tag has either the '!suffix' or the '!handle!suffix' form. */ + + /* First, try to scan a handle. */ + + if !yaml_parser_scan_tag_handle(parser, false, start_mark, &handle) { + return false + } + + /* Check if it is, indeed, handle. */ + + if handle[0] == '!' && len(handle) > 1 && handle[len(handle)-1] == '!' { + /* Scan the suffix now. */ + + if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { + return false + } + } else { + /* It wasn't a handle after all. Scan the rest of the tag. */ + + if !yaml_parser_scan_tag_uri(parser, false, handle, start_mark, &suffix) { + return false + } + + /* Set the handle to '!'. */ + + handle = []byte{'!'} + + /* + * A special case: the '!' tag. Set the handle to '' and the + * suffix to '!'. + */ + + if len(suffix) == 0 { + handle, suffix = suffix, handle + } + + } + } + + /* Check the character which ends the tag. */ + + if !cache(parser, 1) { + return false + } + + if !is_blankz_at(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a tag", + start_mark, "did not find expected whitespace or line break") + return false + } + + end_mark := parser.mark + + /* Create a token. */ + + *token = yaml_token_t{ + token_type: yaml_TAG_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: handle, + suffix: suffix, + } + + return true +} + +/* + * Scan a tag handle. + */ + +func yaml_parser_scan_tag_handle(parser *yaml_parser_t, directive bool, + start_mark YAML_mark_t, handle *[]byte) bool { + + /* Check the initial '!' character. */ + + if !cache(parser, 1) { + return false + } + + if parser.buffer[parser.buffer_pos] != '!' { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected '!'") + return false + } + + /* Copy the '!' character. */ + var s []byte + s = read(parser, s) + + /* Copy all subsequent alphabetical and numerical characters. */ + + if !cache(parser, 1) { + return false + } + + for is_alpha(parser.buffer[parser.buffer_pos]) { + s = read(parser, s) + if !cache(parser, 1) { + return false + } + } + + /* Check if the trailing character is '!' and copy it. */ + + if parser.buffer[parser.buffer_pos] == '!' { + s = read(parser, s) + } else { + /* + * It's either the '!' tag or not really a tag handle. If it's a %TAG + * directive, it's an error. If it's a tag token, it must be a part of + * URI. + */ + + if directive && !(s[0] == '!' && len(s) == 1) { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected '!'") + return false + } + } + + *handle = s + + return true +} + +/* + * Scan a tag. + */ + +func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, + head []byte, start_mark YAML_mark_t, uri *[]byte) bool { + + var s []byte + /* + * Copy the head if needed. + * + * Note that we don't copy the leading '!' character. + */ + if len(head) > 1 { + s = append(s, head[1:]...) + } + + /* Scan the tag. */ + if !cache(parser, 1) { + return false + } + + /* + * The set of characters that may appear in URI is as follows: + * + * '0'-'9', 'A'-'Z', 'a'-'z', '_', '-', ';', '/', '?', ':', '@', '&', + * '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']', + * '%'. + */ + + b := parser.buffer[parser.buffer_pos] + for is_alpha(b) || b == ';' || + b == '/' || b == '?' || + b == ':' || b == '@' || + b == '&' || b == '=' || + b == '+' || b == '$' || + b == ',' || b == '.' || + b == '!' || b == '~' || + b == '*' || b == '\'' || + b == '(' || b == ')' || + b == '[' || b == ']' || + b == '%' { + /* Check if it is a URI-escape sequence. */ + + if b == '%' { + if !yaml_parser_scan_uri_escapes(parser, + directive, start_mark, &s) { + return false + } + } else { + s = read(parser, s) + } + + if !cache(parser, 1) { + return false + } + b = parser.buffer[parser.buffer_pos] + } + + /* Check if the tag is non-empty. */ + + if len(s) == 0 { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected tag URI") + return false + } + + *uri = s + + return true +} + +/* + * Decode an URI-escape sequence corresponding to a single UTF-8 character. + */ + +func yaml_parser_scan_uri_escapes(parser *yaml_parser_t, directive bool, + start_mark YAML_mark_t, s *[]byte) bool { + + /* Decode the required number of characters. */ + w := 10 + for w > 0 { + + /* Check for a URI-escaped octet. */ + + if !cache(parser, 3) { + return false + } + + if !(parser.buffer[parser.buffer_pos] == '%' && + is_hex(parser.buffer[parser.buffer_pos+1]) && + is_hex(parser.buffer[parser.buffer_pos+2])) { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find URI escaped octet") + } + + /* Get the octet. */ + octet := byte((as_hex(parser.buffer[parser.buffer_pos+1]) << 4) + + as_hex(parser.buffer[parser.buffer_pos+2])) + + /* If it is the leading octet, determine the length of the UTF-8 sequence. */ + + if w == 10 { + w = width(octet) + if w == 0 { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "found an incorrect leading UTF-8 octet") + } + } else { + /* Check if the trailing octet is correct. */ + + if (octet & 0xC0) != 0x80 { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "found an incorrect trailing UTF-8 octet") + } + } + + /* Copy the octet and move the pointers. */ + + *s = append(*s, octet) + skip(parser) + skip(parser) + skip(parser) + w-- + } + + return true +} + +/* + * Scan a block scalar. + */ + +func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, + literal bool) bool { + + /* Eat the indicator '|' or '>'. */ + + start_mark := parser.mark + + skip(parser) + + /* Scan the additional block scalar indicators. */ + + if !cache(parser, 1) { + return false + } + + /* Check for a chomping indicator. */ + chomping := 0 + increment := 0 + if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { + /* Set the chomping method and eat the indicator. */ + + if parser.buffer[parser.buffer_pos] == '+' { + chomping = +1 + } else { + chomping = -1 + } + + skip(parser) + + /* Check for an indentation indicator. */ + + if !cache(parser, 1) { + return false + } + + if is_digit(parser.buffer[parser.buffer_pos]) { + /* Check that the indentation is greater than 0. */ + + if parser.buffer[parser.buffer_pos] == '0' { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found an indentation indicator equal to 0") + return false + } + + /* Get the indentation level and eat the indicator. */ + + increment = as_digit(parser.buffer[parser.buffer_pos]) + + skip(parser) + } + } else if is_digit(parser.buffer[parser.buffer_pos]) { + + /* Do the same as above, but in the opposite order. */ + if parser.buffer[parser.buffer_pos] == '0' { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found an indentation indicator equal to 0") + return false + } + + increment = as_digit(parser.buffer[parser.buffer_pos]) + + skip(parser) + + if !cache(parser, 1) { + return false + } + + if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { + if parser.buffer[parser.buffer_pos] == '+' { + chomping = +1 + } else { + chomping = -1 + } + + skip(parser) + } + } + + /* Eat whitespaces and comments to the end of the line. */ + + if !cache(parser, 1) { + return false + } + + for is_blank(parser.buffer[parser.buffer_pos]) { + skip(parser) + if !cache(parser, 1) { + return false + } + } + + if parser.buffer[parser.buffer_pos] == '#' { + for !is_breakz_at(parser.buffer, parser.buffer_pos) { + skip(parser) + if !cache(parser, 1) { + return false + } + } + } + + /* Check if we are at the end of the line. */ + + if !is_breakz_at(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "did not find expected comment or line break") + return false + } + + /* Eat a line break. */ + + if is_break_at(parser.buffer, parser.buffer_pos) { + if !cache(parser, 2) { + return false + } + + skip_line(parser) + } + + end_mark := parser.mark + + /* Set the indentation level if it was specified. */ + indent := 0 + if increment > 0 { + if parser.indent >= 0 { + indent = parser.indent + increment + } else { + indent = increment + } + } + + /* Scan the leading line breaks and determine the indentation level if needed. */ + var trailing_breaks []byte + if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, + start_mark, &end_mark) { + return false + } + + /* Scan the block scalar content. */ + + if !cache(parser, 1) { + return false + } + + var s []byte + var leading_break []byte + leading_blank := false + trailing_blank := false + for parser.mark.column == indent && !is_z(parser.buffer[parser.buffer_pos]) { + + /* + * We are at the beginning of a non-empty line. + */ + + /* Is it a trailing whitespace? */ + + trailing_blank = is_blank(parser.buffer[parser.buffer_pos]) + + /* Check if we need to fold the leading line break. */ + + if !literal && len(leading_break) > 0 && leading_break[0] == '\n' && + !leading_blank && !trailing_blank { + /* Do we need to join the lines by space? */ + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } + leading_break = leading_break[:0] + } else { + s = append(s, leading_break...) + leading_break = leading_break[:0] + } + + /* Append the remaining line breaks. */ + s = append(s, trailing_breaks...) + trailing_breaks = trailing_breaks[:0] + + /* Is it a leading whitespace? */ + + leading_blank = is_blank(parser.buffer[parser.buffer_pos]) + + /* Consume the current line. */ + + for !is_breakz_at(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if !cache(parser, 1) { + return false + } + } + + /* Consume the line break. */ + + if !cache(parser, 2) { + return false + } + + leading_break = read_line(parser, leading_break) + + /* Eat the following indentation spaces and line breaks. */ + + if !yaml_parser_scan_block_scalar_breaks(parser, + &indent, &trailing_breaks, start_mark, &end_mark) { + return false + } + } + + /* Chomp the tail. */ + + if chomping != -1 { + s = append(s, leading_break...) + } + if chomping == 1 { + s = append(s, trailing_breaks...) + } + + /* Create a token. */ + + *token = yaml_token_t{ + token_type: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_LITERAL_SCALAR_STYLE, + } + if !literal { + token.style = yaml_FOLDED_SCALAR_STYLE + } + + return true +} + +/* + * Scan indentation spaces and line breaks for a block scalar. Determine the + * indentation level if needed. + */ + +func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, + indent *int, breaks *[]byte, + start_mark YAML_mark_t, end_mark *YAML_mark_t) bool { + + *end_mark = parser.mark + + /* Eat the indentation spaces and line breaks. */ + max_indent := 0 + for { + /* Eat the indentation spaces. */ + + if !cache(parser, 1) { + return false + } + + for (*indent == 0 || parser.mark.column < *indent) && + is_space(parser.buffer[parser.buffer_pos]) { + skip(parser) + if !cache(parser, 1) { + return false + } + } + if parser.mark.column > max_indent { + max_indent = parser.mark.column + } + + /* Check for a tab character messing the indentation. */ + + if (*indent == 0 || parser.mark.column < *indent) && + is_tab(parser.buffer[parser.buffer_pos]) { + return yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found a tab character where an indentation space is expected") + } + + /* Have we found a non-empty line? */ + + if !is_break_at(parser.buffer, parser.buffer_pos) { + break + } + + /* Consume the line break. */ + + if !cache(parser, 2) { + return false + } + + *breaks = read_line(parser, *breaks) + *end_mark = parser.mark + } + + /* Determine the indentation level if needed. */ + + if *indent == 0 { + *indent = max_indent + if *indent < parser.indent+1 { + *indent = parser.indent + 1 + } + if *indent < 1 { + *indent = 1 + } + } + + return true +} + +/* + * Scan a quoted scalar. + */ + +func yaml_parser_scan_flow_scalar(parser *yaml_parser_t, token *yaml_token_t, + single bool) bool { + + /* Eat the left quote. */ + + start_mark := parser.mark + + skip(parser) + + /* Consume the content of the quoted scalar. */ + var s []byte + var leading_break []byte + var trailing_breaks []byte + var whitespaces []byte + for { + /* Check that there are no document indicators at the beginning of the line. */ + + if !cache(parser, 4) { + return false + } + + if parser.mark.column == 0 && + ((parser.buffer[parser.buffer_pos] == '-' && + parser.buffer[parser.buffer_pos+1] == '-' && + parser.buffer[parser.buffer_pos+2] == '-') || + (parser.buffer[parser.buffer_pos] == '.' && + parser.buffer[parser.buffer_pos+1] == '.' && + parser.buffer[parser.buffer_pos+2] == '.')) && + is_blankz_at(parser.buffer, parser.buffer_pos+3) { + yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", + start_mark, "found unexpected document indicator") + return false + } + + /* Check for EOF. */ + + if is_z(parser.buffer[parser.buffer_pos]) { + yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", + start_mark, "found unexpected end of stream") + return false + } + + /* Consume non-blank characters. */ + + if !cache(parser, 2) { + return false + } + + leading_blanks := false + + for !is_blankz_at(parser.buffer, parser.buffer_pos) { + /* Check for an escaped single quote. */ + + if single && parser.buffer[parser.buffer_pos] == '\'' && + parser.buffer[parser.buffer_pos+1] == '\'' { + // Is is an escaped single quote. + s = append(s, '\'') + skip(parser) + skip(parser) + } else if single && parser.buffer[parser.buffer_pos] == '\'' { + /* Check for the right quote. */ + break + } else if !single && parser.buffer[parser.buffer_pos] == '"' { + /* Check for the right quote. */ + break + } else if !single && parser.buffer[parser.buffer_pos] == '\\' && + is_break_at(parser.buffer, parser.buffer_pos+1) { + + /* Check for an escaped line break. */ + if !cache(parser, 3) { + return false + } + + skip(parser) + skip_line(parser) + leading_blanks = true + break + } else if !single && parser.buffer[parser.buffer_pos] == '\\' { + + /* Check for an escape sequence. */ + + code_length := 0 + + /* Check the escape character. */ + + switch parser.buffer[parser.buffer_pos+1] { + case '0': + s = append(s, 0) + case 'a': + s = append(s, '\x07') + case 'b': + s = append(s, '\x08') + case 't', '\t': + s = append(s, '\x09') + case 'n': + s = append(s, '\x0A') + case 'v': + s = append(s, '\x0B') + case 'f': + s = append(s, '\x0C') + case 'r': + s = append(s, '\x0D') + case 'e': + s = append(s, '\x1B') + case ' ': + s = append(s, '\x20') + case '"': + s = append(s, '"') + case '/': + s = append(s, '/') + case '\\': + s = append(s, '\\') + case 'N': /* NEL (#x85) */ + s = append(s, '\xC2') + s = append(s, '\x85') + case '_': /* #xA0 */ + s = append(s, '\xC2') + s = append(s, '\xA0') + case 'L': /* LS (#x2028) */ + s = append(s, '\xE2') + s = append(s, '\x80') + s = append(s, '\xA8') + case 'P': /* PS (#x2029) */ + s = append(s, '\xE2') + s = append(s, '\x80') + s = append(s, '\xA9') + case 'x': + code_length = 2 + case 'u': + code_length = 4 + case 'U': + code_length = 8 + default: + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "found unknown escape character") + return false + } + + skip(parser) + skip(parser) + + /* Consume an arbitrary escape code. */ + + if code_length > 0 { + value := 0 + + /* Scan the character value. */ + + if !cache(parser, code_length) { + return false + } + + for k := 0; k < code_length; k++ { + if !is_hex(parser.buffer[parser.buffer_pos+k]) { + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "did not find expected hexdecimal number") + return false + } + value = (value << 4) + as_hex(parser.buffer[parser.buffer_pos+k]) + } + + /* Check the value and write the character. */ + + if (value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF { + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "found invalid Unicode character escape code") + return false + } + + if value <= 0x7F { + s = append(s, byte(value)) + } else if value <= 0x7FF { + s = append(s, byte(0xC0+(value>>6))) + s = append(s, byte(0x80+(value&0x3F))) + } else if value <= 0xFFFF { + s = append(s, byte(0xE0+(value>>12))) + s = append(s, byte(0x80+((value>>6)&0x3F))) + s = append(s, byte(0x80+(value&0x3F))) + } else { + s = append(s, byte(0xF0+(value>>18))) + s = append(s, byte(0x80+((value>>12)&0x3F))) + s = append(s, byte(0x80+((value>>6)&0x3F))) + s = append(s, byte(0x80+(value&0x3F))) + } + + /* Advance the pointer. */ + + for k := 0; k < code_length; k++ { + skip(parser) + } + } + } else { + /* It is a non-escaped non-blank character. */ + + s = read(parser, s) + } + + if !cache(parser, 2) { + return false + } + } + + /* Check if we are at the end of the scalar. */ + b := parser.buffer[parser.buffer_pos] + if single { + if b == '\'' { + break + } + } else if b == '"' { + break + } + + /* Consume blank characters. */ + + if !cache(parser, 1) { + return false + } + + for is_blank(parser.buffer[parser.buffer_pos]) || is_break_at(parser.buffer, parser.buffer_pos) { + if is_blank(parser.buffer[parser.buffer_pos]) { + /* Consume a space or a tab character. */ + if !leading_blanks { + whitespaces = read(parser, whitespaces) + } else { + skip(parser) + } + } else { + if !cache(parser, 2) { + return false + } + + /* Check if it is a first line break. */ + if !leading_blanks { + whitespaces = whitespaces[:0] + leading_break = read_line(parser, leading_break) + leading_blanks = true + } else { + trailing_breaks = read_line(parser, trailing_breaks) + } + } + + if !cache(parser, 1) { + return false + } + } + + /* Join the whitespaces or fold line breaks. */ + + if leading_blanks { + /* Do we need to fold line breaks? */ + + if len(leading_break) > 0 && leading_break[0] == '\n' { + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } else { + s = append(s, trailing_breaks...) + trailing_breaks = trailing_breaks[:0] + } + + leading_break = leading_break[:0] + } else { + s = append(s, leading_break...) + s = append(s, trailing_breaks...) + leading_break = leading_break[:0] + trailing_breaks = trailing_breaks[:0] + } + } else { + s = append(s, whitespaces...) + whitespaces = whitespaces[:0] + } + } + + /* Eat the right quote. */ + + skip(parser) + + end_mark := parser.mark + + /* Create a token. */ + + *token = yaml_token_t{ + token_type: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_SINGLE_QUOTED_SCALAR_STYLE, + } + if !single { + token.style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + + return true +} + +/* + * Scan a plain scalar. + */ + +func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) bool { + var s []byte + var leading_break []byte + var trailing_breaks []byte + var whitespaces []byte + leading_blanks := false + indent := parser.indent + 1 + + start_mark := parser.mark + end_mark := parser.mark + + /* Consume the content of the plain scalar. */ + + for { + /* Check for a document indicator. */ + + if !cache(parser, 4) { + return false + } + + if parser.mark.column == 0 && + ((parser.buffer[parser.buffer_pos] == '-' && + parser.buffer[parser.buffer_pos+1] == '-' && + parser.buffer[parser.buffer_pos+2] == '-') || + (parser.buffer[parser.buffer_pos] == '.' && + parser.buffer[parser.buffer_pos+1] == '.' && + parser.buffer[parser.buffer_pos+2] == '.')) && + is_blankz_at(parser.buffer, parser.buffer_pos+3) { + break + } + + /* Check for a comment. */ + + if parser.buffer[parser.buffer_pos] == '#' { + break + } + + /* Consume non-blank characters. */ + + for !is_blankz_at(parser.buffer, parser.buffer_pos) { + /* Check for 'x:x' in the flow context. TODO: Fix the test "spec-08-13". */ + + if parser.flow_level > 0 && + parser.buffer[parser.buffer_pos] == ':' && + !is_blankz_at(parser.buffer, parser.buffer_pos+1) { + yaml_parser_set_scanner_error(parser, "while scanning a plain scalar", + start_mark, "found unexpected ':'") + return false + } + + /* Check for indicators that may end a plain scalar. */ + b := parser.buffer[parser.buffer_pos] + if (b == ':' && is_blankz_at(parser.buffer, parser.buffer_pos+1)) || + (parser.flow_level > 0 && + (b == ',' || b == ':' || + b == '?' || b == '[' || + b == ']' || b == '{' || + b == '}')) { + break + } + + /* Check if we need to join whitespaces and breaks. */ + + if leading_blanks || len(whitespaces) > 0 { + if leading_blanks { + /* Do we need to fold line breaks? */ + + if leading_break[0] == '\n' { + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } else { + s = append(s, trailing_breaks...) + trailing_breaks = trailing_breaks[:0] + } + leading_break = leading_break[:0] + } else { + s = append(s, leading_break...) + s = append(s, trailing_breaks...) + leading_break = leading_break[:0] + trailing_breaks = trailing_breaks[:0] + } + + leading_blanks = false + } else { + s = append(s, whitespaces...) + whitespaces = whitespaces[:0] + } + } + + /* Copy the character. */ + + s = read(parser, s) + end_mark = parser.mark + + if !cache(parser, 2) { + return false + } + } + + /* Is it the end? */ + + if !(is_blank(parser.buffer[parser.buffer_pos]) || + is_break_at(parser.buffer, parser.buffer_pos)) { + break + } + + /* Consume blank characters. */ + + if !cache(parser, 1) { + return false + } + + for is_blank(parser.buffer[parser.buffer_pos]) || + is_break_at(parser.buffer, parser.buffer_pos) { + + if is_blank(parser.buffer[parser.buffer_pos]) { + /* Check for tab character that abuse indentation. */ + + if leading_blanks && parser.mark.column < indent && + is_tab(parser.buffer[parser.buffer_pos]) { + yaml_parser_set_scanner_error(parser, "while scanning a plain scalar", + start_mark, "found a tab character that violate indentation") + return false + } + + /* Consume a space or a tab character. */ + + if !leading_blanks { + whitespaces = read(parser, whitespaces) + } else { + skip(parser) + } + } else { + if !cache(parser, 2) { + return false + } + + /* Check if it is a first line break. */ + + if !leading_blanks { + whitespaces = whitespaces[:0] + leading_break = read_line(parser, leading_break) + leading_blanks = true + } else { + trailing_breaks = read_line(parser, trailing_breaks) + } + } + if !cache(parser, 1) { + return false + } + } + + /* Check indentation level. */ + + if parser.flow_level == 0 && parser.mark.column < indent { + break + } + } + + /* Create a token. */ + + *token = yaml_token_t{ + token_type: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_PLAIN_SCALAR_STYLE, + } + + /* Note that we change the 'simple_key_allowed' flag. */ + + if leading_blanks { + parser.simple_key_allowed = true + } + + return true +} diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/scanner_test.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/scanner_test.go new file mode 100644 index 00000000..db31e651 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/scanner_test.go @@ -0,0 +1,80 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "io/ioutil" + "os" + "path/filepath" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var scan = func(filename string) { + It("scan "+filename, func() { + file, err := os.Open(filename) + Expect(err).To(BeNil()) + + parser := yaml_parser_t{} + yaml_parser_initialize(&parser) + yaml_parser_set_input_reader(&parser, file) + + failed := false + token := yaml_token_t{} + + for { + if !yaml_parser_scan(&parser, &token) { + failed = true + break + } + + if token.token_type == yaml_STREAM_END_TOKEN { + break + } + } + + file.Close() + + // msg := "SUCCESS" + // if failed { + // msg = "FAILED" + // if parser.error != yaml_NO_ERROR { + // m := parser.problem_mark + // fmt.Printf("ERROR: (%s) %s @ line: %d col: %d\n", + // parser.context, parser.problem, m.line, m.column) + // } + // } + Expect(failed).To(BeFalse()) + }) +} + +var scanYamls = func(dirname string) { + fileInfos, err := ioutil.ReadDir(dirname) + if err != nil { + panic(err.Error()) + } + + for _, fileInfo := range fileInfos { + if !fileInfo.IsDir() { + scan(filepath.Join(dirname, fileInfo.Name())) + } + } +} + +var _ = Describe("Scanner", func() { + scanYamls("fixtures/specification") + scanYamls("fixtures/specification/types") +}) diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/tags.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/tags.go new file mode 100644 index 00000000..4df0b0a7 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/tags.go @@ -0,0 +1,343 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "reflect" + "sort" + "strings" + "sync" + "unicode" +) + +// A field represents a single field found in a struct. +type field struct { + name string + tag bool + index []int + typ reflect.Type + omitEmpty bool + flow bool +} + +// byName sorts field by name, breaking ties with depth, +// then breaking ties with "name came from json tag", then +// breaking ties with index sequence. +type byName []field + +func (x byName) Len() int { return len(x) } + +func (x byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +func (x byName) Less(i, j int) bool { + if x[i].name != x[j].name { + return x[i].name < x[j].name + } + if len(x[i].index) != len(x[j].index) { + return len(x[i].index) < len(x[j].index) + } + if x[i].tag != x[j].tag { + return x[i].tag + } + return byIndex(x).Less(i, j) +} + +// byIndex sorts field by index sequence. +type byIndex []field + +func (x byIndex) Len() int { return len(x) } + +func (x byIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +func (x byIndex) Less(i, j int) bool { + for k, xik := range x[i].index { + if k >= len(x[j].index) { + return false + } + if xik != x[j].index[k] { + return xik < x[j].index[k] + } + } + return len(x[i].index) < len(x[j].index) +} + +// typeFields returns a list of fields that JSON should recognize for the given type. +// The algorithm is breadth-first search over the set of structs to include - the top struct +// and then any reachable anonymous structs. +func typeFields(t reflect.Type) []field { + // Anonymous fields to explore at the current level and the next. + current := []field{} + next := []field{{typ: t}} + + // Count of queued names for current level and the next. + count := map[reflect.Type]int{} + nextCount := map[reflect.Type]int{} + + // Types already visited at an earlier level. + visited := map[reflect.Type]bool{} + + // Fields found. + var fields []field + + for len(next) > 0 { + current, next = next, current[:0] + count, nextCount = nextCount, map[reflect.Type]int{} + + for _, f := range current { + if visited[f.typ] { + continue + } + visited[f.typ] = true + + // Scan f.typ for fields to include. + for i := 0; i < f.typ.NumField(); i++ { + sf := f.typ.Field(i) + if sf.PkgPath != "" { // unexported + continue + } + tag := sf.Tag.Get("yaml") + if tag == "-" { + continue + } + name, opts := parseTag(tag) + if !isValidTag(name) { + name = "" + } + index := make([]int, len(f.index)+1) + copy(index, f.index) + index[len(f.index)] = i + + ft := sf.Type + if ft.Name() == "" && ft.Kind() == reflect.Ptr { + // Follow pointer. + ft = ft.Elem() + } + + // Record found field and index sequence. + if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct { + tagged := name != "" + if name == "" { + name = sf.Name + } + fields = append(fields, field{name, tagged, index, ft, + opts.Contains("omitempty"), opts.Contains("flow")}) + if count[f.typ] > 1 { + // If there were multiple instances, add a second, + // so that the annihilation code will see a duplicate. + // It only cares about the distinction between 1 or 2, + // so don't bother generating any more copies. + fields = append(fields, fields[len(fields)-1]) + } + continue + } + + // Record new anonymous struct to explore in next round. + nextCount[ft]++ + if nextCount[ft] == 1 { + next = append(next, field{name: ft.Name(), index: index, typ: ft}) + } + } + } + } + + sort.Sort(byName(fields)) + + // Delete all fields that are hidden by the Go rules for embedded fields, + // except that fields with JSON tags are promoted. + + // The fields are sorted in primary order of name, secondary order + // of field index length. Loop over names; for each name, delete + // hidden fields by choosing the one dominant field that survives. + out := fields[:0] + for advance, i := 0, 0; i < len(fields); i += advance { + // One iteration per name. + // Find the sequence of fields with the name of this first field. + fi := fields[i] + name := fi.name + for advance = 1; i+advance < len(fields); advance++ { + fj := fields[i+advance] + if fj.name != name { + break + } + } + if advance == 1 { // Only one field with this name + out = append(out, fi) + continue + } + dominant, ok := dominantField(fields[i : i+advance]) + if ok { + out = append(out, dominant) + } + } + + fields = out + sort.Sort(byIndex(fields)) + + return fields +} + +// dominantField looks through the fields, all of which are known to +// have the same name, to find the single field that dominates the +// others using Go's embedding rules, modified by the presence of +// JSON tags. If there are multiple top-level fields, the boolean +// will be false: This condition is an error in Go and we skip all +// the fields. +func dominantField(fields []field) (field, bool) { + // The fields are sorted in increasing index-length order. The winner + // must therefore be one with the shortest index length. Drop all + // longer entries, which is easy: just truncate the slice. + length := len(fields[0].index) + tagged := -1 // Index of first tagged field. + for i, f := range fields { + if len(f.index) > length { + fields = fields[:i] + break + } + if f.tag { + if tagged >= 0 { + // Multiple tagged fields at the same level: conflict. + // Return no field. + return field{}, false + } + tagged = i + } + } + if tagged >= 0 { + return fields[tagged], true + } + // All remaining fields have the same length. If there's more than one, + // we have a conflict (two fields named "X" at the same level) and we + // return no field. + if len(fields) > 1 { + return field{}, false + } + return fields[0], true +} + +var fieldCache struct { + sync.RWMutex + m map[reflect.Type][]field +} + +// cachedTypeFields is like typeFields but uses a cache to avoid repeated work. +func cachedTypeFields(t reflect.Type) []field { + fieldCache.RLock() + f := fieldCache.m[t] + fieldCache.RUnlock() + if f != nil { + return f + } + + // Compute fields without lock. + // Might duplicate effort but won't hold other computations back. + f = typeFields(t) + if f == nil { + f = []field{} + } + + fieldCache.Lock() + if fieldCache.m == nil { + fieldCache.m = map[reflect.Type][]field{} + } + fieldCache.m[t] = f + fieldCache.Unlock() + return f +} + +// tagOptions is the string following a comma in a struct field's "json" +// tag, or the empty string. It does not include the leading comma. +type tagOptions string + +func isValidTag(s string) bool { + if s == "" { + return false + } + for _, c := range s { + switch { + case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c): + // Backslash and quote chars are reserved, but + // otherwise any punctuation chars are allowed + // in a tag name. + default: + if !unicode.IsLetter(c) && !unicode.IsDigit(c) { + return false + } + } + } + return true +} + +func fieldByIndex(v reflect.Value, index []int) reflect.Value { + for _, i := range index { + if v.Kind() == reflect.Ptr { + if v.IsNil() { + return reflect.Value{} + } + v = v.Elem() + } + v = v.Field(i) + } + return v +} + +func typeByIndex(t reflect.Type, index []int) reflect.Type { + for _, i := range index { + if t.Kind() == reflect.Ptr { + t = t.Elem() + } + t = t.Field(i).Type + } + return t +} + +// stringValues is a slice of reflect.Value holding *reflect.StringValue. +// It implements the methods to sort by string. +type stringValues []reflect.Value + +func (sv stringValues) Len() int { return len(sv) } +func (sv stringValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } +func (sv stringValues) Less(i, j int) bool { return sv.get(i) < sv.get(j) } +func (sv stringValues) get(i int) string { return sv[i].String() } + +// parseTag splits a struct field's json tag into its name and +// comma-separated options. +func parseTag(tag string) (string, tagOptions) { + if idx := strings.Index(tag, ","); idx != -1 { + return tag[:idx], tagOptions(tag[idx+1:]) + } + return tag, tagOptions("") +} + +// Contains reports whether a comma-separated list of options +// contains a particular substr flag. substr must be surrounded by a +// string boundary or commas. +func (o tagOptions) Contains(optionName string) bool { + if len(o) == 0 { + return false + } + s := string(o) + for s != "" { + var next string + i := strings.Index(s, ",") + if i >= 0 { + s, next = s[:i], s[i+1:] + } + if s == optionName { + return true + } + s = next + } + return false +} diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/writer.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/writer.go new file mode 100644 index 00000000..a76b6336 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/writer.go @@ -0,0 +1,128 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +/* + * Set the writer error and return 0. + */ + +func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { + emitter.error = yaml_WRITER_ERROR + emitter.problem = problem + + return false +} + +/* + * Flush the output buffer. + */ + +func yaml_emitter_flush(emitter *yaml_emitter_t) bool { + if emitter.write_handler == nil { + panic("Write handler must be set") /* Write handler must be set. */ + } + if emitter.encoding == yaml_ANY_ENCODING { + panic("Encoding must be set") /* Output encoding must be set. */ + } + + /* Check if the buffer is empty. */ + + if emitter.buffer_pos == 0 { + return true + } + + /* If the output encoding is UTF-8, we don't need to recode the buffer. */ + + if emitter.encoding == yaml_UTF8_ENCODING { + if err := emitter.write_handler(emitter, + emitter.buffer[:emitter.buffer_pos]); err != nil { + return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) + } + emitter.buffer_pos = 0 + return true + } + + /* Recode the buffer into the raw buffer. */ + + var low, high int + if emitter.encoding == yaml_UTF16LE_ENCODING { + low, high = 0, 1 + } else { + high, low = 1, 0 + } + + pos := 0 + for pos < emitter.buffer_pos { + + /* + * See the "reader.c" code for more details on UTF-8 encoding. Note + * that we assume that the buffer contains a valid UTF-8 sequence. + */ + + /* Read the next UTF-8 character. */ + + octet := emitter.buffer[pos] + + var w int + var value rune + switch { + case octet&0x80 == 0x00: + w, value = 1, rune(octet&0x7F) + case octet&0xE0 == 0xC0: + w, value = 2, rune(octet&0x1F) + case octet&0xF0 == 0xE0: + w, value = 3, rune(octet&0x0F) + case octet&0xF8 == 0xF0: + w, value = 4, rune(octet&0x07) + } + + for k := 1; k < w; k++ { + octet = emitter.buffer[pos+k] + value = (value << 6) + (rune(octet) & 0x3F) + } + + pos += w + + /* Write the character. */ + + if value < 0x10000 { + var b [2]byte + b[high] = byte(value >> 8) + b[low] = byte(value & 0xFF) + emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1]) + } else { + /* Write the character using a surrogate pair (check "reader.c"). */ + + var b [4]byte + value -= 0x10000 + b[high] = byte(0xD8 + (value >> 18)) + b[low] = byte((value >> 10) & 0xFF) + b[high+2] = byte(0xDC + ((value >> 8) & 0xFF)) + b[low+2] = byte(value & 0xFF) + emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1], b[2], b[3]) + } + } + + /* Write the raw buffer. */ + + // Write the raw buffer. + if err := emitter.write_handler(emitter, emitter.raw_buffer); err != nil { + return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) + } + + emitter.buffer_pos = 0 + emitter.raw_buffer = emitter.raw_buffer[:0] + return true +} diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/yaml_definesh.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/yaml_definesh.go new file mode 100644 index 00000000..de4c05ad --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/yaml_definesh.go @@ -0,0 +1,22 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +const ( + yaml_VERSION_MAJOR = 0 + yaml_VERSION_MINOR = 1 + yaml_VERSION_PATCH = 6 + yaml_VERSION_STRING = "0.1.6" +) diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/yaml_privateh.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/yaml_privateh.go new file mode 100644 index 00000000..2b3b7d74 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/yaml_privateh.go @@ -0,0 +1,891 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +const ( + INPUT_RAW_BUFFER_SIZE = 1024 + + /* + * The size of the input buffer. + * + * It should be possible to decode the whole raw buffer. + */ + INPUT_BUFFER_SIZE = (INPUT_RAW_BUFFER_SIZE * 3) + + /* + * The size of the output buffer. + */ + + OUTPUT_BUFFER_SIZE = 512 + + /* + * The size of the output raw buffer. + * + * It should be possible to encode the whole output buffer. + */ + + OUTPUT_RAW_BUFFER_SIZE = (OUTPUT_BUFFER_SIZE*2 + 2) + + INITIAL_STACK_SIZE = 16 + INITIAL_QUEUE_SIZE = 16 +) + +func width(b byte) int { + if b&0x80 == 0 { + return 1 + } + + if b&0xE0 == 0xC0 { + return 2 + } + + if b&0xF0 == 0xE0 { + return 3 + } + + if b&0xF8 == 0xF0 { + return 4 + } + + return 0 +} + +func copy_bytes(dest []byte, dest_pos *int, src []byte, src_pos *int) { + w := width(src[*src_pos]) + switch w { + case 4: + dest[*dest_pos+3] = src[*src_pos+3] + fallthrough + case 3: + dest[*dest_pos+2] = src[*src_pos+2] + fallthrough + case 2: + dest[*dest_pos+1] = src[*src_pos+1] + fallthrough + case 1: + dest[*dest_pos] = src[*src_pos] + default: + panic("invalid width") + } + *dest_pos += w + *src_pos += w +} + +// /* +// * Check if the character at the specified position is an alphabetical +// * character, a digit, '_', or '-'. +// */ + +func is_alpha(b byte) bool { + return (b >= '0' && b <= '9') || + (b >= 'A' && b <= 'Z') || + (b >= 'a' && b <= 'z') || + b == '_' || b == '-' +} + +// /* +// * Check if the character at the specified position is a digit. +// */ +// +func is_digit(b byte) bool { + return b >= '0' && b <= '9' +} + +// /* +// * Get the value of a digit. +// */ +// +func as_digit(b byte) int { + return int(b) - '0' +} + +// /* +// * Check if the character at the specified position is a hex-digit. +// */ +// +func is_hex(b byte) bool { + return (b >= '0' && b <= '9') || + (b >= 'A' && b <= 'F') || + (b >= 'a' && b <= 'f') +} + +// +// /* +// * Get the value of a hex-digit. +// */ +// +func as_hex(b byte) int { + if b >= 'A' && b <= 'F' { + return int(b) - 'A' + 10 + } else if b >= 'a' && b <= 'f' { + return int(b) - 'a' + 10 + } + return int(b) - '0' +} + +// #define AS_HEX_AT(string,offset) \ +// (((string).pointer[offset] >= (yaml_char_t) 'A' && \ +// (string).pointer[offset] <= (yaml_char_t) 'F') ? \ +// ((string).pointer[offset] - (yaml_char_t) 'A' + 10) : \ +// ((string).pointer[offset] >= (yaml_char_t) 'a' && \ +// (string).pointer[offset] <= (yaml_char_t) 'f') ? \ +// ((string).pointer[offset] - (yaml_char_t) 'a' + 10) : \ +// ((string).pointer[offset] - (yaml_char_t) '0')) + +// /* +// * Check if the character is a line break, space, tab, or NUL. +// */ +func is_blankz_at(b []byte, i int) bool { + return is_blank(b[i]) || is_breakz_at(b, i) +} + +// /* +// * Check if the character at the specified position is a line break. +// */ +func is_break_at(b []byte, i int) bool { + return b[i] == '\r' || /* CR (#xD)*/ + b[i] == '\n' || /* LF (#xA) */ + (b[i] == 0xC2 && b[i+1] == 0x85) || /* NEL (#x85) */ + (b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8) || /* LS (#x2028) */ + (b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9) /* PS (#x2029) */ +} + +func is_breakz_at(b []byte, i int) bool { + return is_break_at(b, i) || is_z(b[i]) +} + +func is_crlf_at(b []byte, i int) bool { + return b[i] == '\r' && b[i+1] == '\n' +} + +// /* +// * Check if the character at the specified position is NUL. +// */ +func is_z(b byte) bool { + return b == 0x0 +} + +// /* +// * Check if the character at the specified position is space. +// */ +func is_space(b byte) bool { + return b == ' ' +} + +// +// /* +// * Check if the character at the specified position is tab. +// */ +func is_tab(b byte) bool { + return b == '\t' +} + +// /* +// * Check if the character at the specified position is blank (space or tab). +// */ +func is_blank(b byte) bool { + return is_space(b) || is_tab(b) +} + +// /* +// * Check if the character is ASCII. +// */ +func is_ascii(b byte) bool { + return b <= '\x7f' +} + +// /* +// * Check if the character can be printed unescaped. +// */ +func is_printable_at(b []byte, i int) bool { + return ((b[i] == 0x0A) || /* . == #x0A */ + (b[i] >= 0x20 && b[i] <= 0x7E) || /* #x20 <= . <= #x7E */ + (b[i] == 0xC2 && b[i+1] >= 0xA0) || /* #0xA0 <= . <= #xD7FF */ + (b[i] > 0xC2 && b[i] < 0xED) || + (b[i] == 0xED && b[i+1] < 0xA0) || + (b[i] == 0xEE) || + (b[i] == 0xEF && /* && . != #xFEFF */ + !(b[i+1] == 0xBB && b[i+2] == 0xBF) && + !(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF)))) +} + +func insert_token(parser *yaml_parser_t, pos int, token *yaml_token_t) { + // collapse the slice + if parser.tokens_head > 0 && len(parser.tokens) == cap(parser.tokens) { + if parser.tokens_head != len(parser.tokens) { + // move the tokens down + copy(parser.tokens, parser.tokens[parser.tokens_head:]) + } + // readjust the length + parser.tokens = parser.tokens[:len(parser.tokens)-parser.tokens_head] + parser.tokens_head = 0 + } + + parser.tokens = append(parser.tokens, *token) + if pos < 0 { + return + } + copy(parser.tokens[parser.tokens_head+pos+1:], parser.tokens[parser.tokens_head+pos:]) + parser.tokens[parser.tokens_head+pos] = *token +} + +// /* +// * Check if the character at the specified position is BOM. +// */ +// +func is_bom_at(b []byte, i int) bool { + return b[i] == 0xEF && b[i+1] == 0xBB && b[i+2] == 0xBF +} + +// +// #ifdef HAVE_CONFIG_H +// #include +// #endif +// +// #include "./yaml.h" +// +// #include +// #include +// +// /* +// * Memory management. +// */ +// +// yaml_DECLARE(void *) +// yaml_malloc(size_t size); +// +// yaml_DECLARE(void *) +// yaml_realloc(void *ptr, size_t size); +// +// yaml_DECLARE(void) +// yaml_free(void *ptr); +// +// yaml_DECLARE(yaml_char_t *) +// yaml_strdup(const yaml_char_t *); +// +// /* +// * Reader: Ensure that the buffer contains at least `length` characters. +// */ +// +// yaml_DECLARE(int) +// yaml_parser_update_buffer(yaml_parser_t *parser, size_t length); +// +// /* +// * Scanner: Ensure that the token stack contains at least one token ready. +// */ +// +// yaml_DECLARE(int) +// yaml_parser_fetch_more_tokens(yaml_parser_t *parser); +// +// /* +// * The size of the input raw buffer. +// */ +// +// #define INPUT_RAW_BUFFER_SIZE 16384 +// +// /* +// * The size of the input buffer. +// * +// * It should be possible to decode the whole raw buffer. +// */ +// +// #define INPUT_BUFFER_SIZE (INPUT_RAW_BUFFER_SIZE*3) +// +// /* +// * The size of the output buffer. +// */ +// +// #define OUTPUT_BUFFER_SIZE 16384 +// +// /* +// * The size of the output raw buffer. +// * +// * It should be possible to encode the whole output buffer. +// */ +// +// #define OUTPUT_RAW_BUFFER_SIZE (OUTPUT_BUFFER_SIZE*2+2) +// +// /* +// * The size of other stacks and queues. +// */ +// +// #define INITIAL_STACK_SIZE 16 +// #define INITIAL_QUEUE_SIZE 16 +// #define INITIAL_STRING_SIZE 16 +// +// /* +// * Buffer management. +// */ +// +// #define BUFFER_INIT(context,buffer,size) \ +// (((buffer).start = yaml_malloc(size)) ? \ +// ((buffer).last = (buffer).pointer = (buffer).start, \ +// (buffer).end = (buffer).start+(size), \ +// 1) : \ +// ((context)->error = yaml_MEMORY_ERROR, \ +// 0)) +// +// #define BUFFER_DEL(context,buffer) \ +// (yaml_free((buffer).start), \ +// (buffer).start = (buffer).pointer = (buffer).end = 0) +// +// /* +// * String management. +// */ +// +// typedef struct { +// yaml_char_t *start; +// yaml_char_t *end; +// yaml_char_t *pointer; +// } yaml_string_t; +// +// yaml_DECLARE(int) +// yaml_string_extend(yaml_char_t **start, +// yaml_char_t **pointer, yaml_char_t **end); +// +// yaml_DECLARE(int) +// yaml_string_join( +// yaml_char_t **a_start, yaml_char_t **a_pointer, yaml_char_t **a_end, +// yaml_char_t **b_start, yaml_char_t **b_pointer, yaml_char_t **b_end); +// +// #define NULL_STRING { NULL, NULL, NULL } +// +// #define STRING(string,length) { (string), (string)+(length), (string) } +// +// #define STRING_ASSIGN(value,string,length) \ +// ((value).start = (string), \ +// (value).end = (string)+(length), \ +// (value).pointer = (string)) +// +// #define STRING_INIT(context,string,size) \ +// (((string).start = yaml_malloc(size)) ? \ +// ((string).pointer = (string).start, \ +// (string).end = (string).start+(size), \ +// memset((string).start, 0, (size)), \ +// 1) : \ +// ((context)->error = yaml_MEMORY_ERROR, \ +// 0)) +// +// #define STRING_DEL(context,string) \ +// (yaml_free((string).start), \ +// (string).start = (string).pointer = (string).end = 0) +// +// #define STRING_EXTEND(context,string) \ +// (((string).pointer+5 < (string).end) \ +// || yaml_string_extend(&(string).start, \ +// &(string).pointer, &(string).end)) +// +// #define CLEAR(context,string) \ +// ((string).pointer = (string).start, \ +// memset((string).start, 0, (string).end-(string).start)) +// +// #define JOIN(context,string_a,string_b) \ +// ((yaml_string_join(&(string_a).start, &(string_a).pointer, \ +// &(string_a).end, &(string_b).start, \ +// &(string_b).pointer, &(string_b).end)) ? \ +// ((string_b).pointer = (string_b).start, \ +// 1) : \ +// ((context)->error = yaml_MEMORY_ERROR, \ +// 0)) +// +// /* +// * String check operations. +// */ +// +// /* +// * Check the octet at the specified position. +// */ +// +// #define CHECK_AT(string,octet,offset) \ +// ((string).pointer[offset] == (yaml_char_t)(octet)) +// +// /* +// * Check the current octet in the buffer. +// */ +// +// #define CHECK(string,octet) CHECK_AT((string),(octet),0) +// +// /* +// * Check if the character at the specified position is an alphabetical +// * character, a digit, '_', or '-'. +// */ +// +// #define IS_ALPHA_AT(string,offset) \ +// (((string).pointer[offset] >= (yaml_char_t) '0' && \ +// (string).pointer[offset] <= (yaml_char_t) '9') || \ +// ((string).pointer[offset] >= (yaml_char_t) 'A' && \ +// (string).pointer[offset] <= (yaml_char_t) 'Z') || \ +// ((string).pointer[offset] >= (yaml_char_t) 'a' && \ +// (string).pointer[offset] <= (yaml_char_t) 'z') || \ +// (string).pointer[offset] == '_' || \ +// (string).pointer[offset] == '-') +// +// #define IS_ALPHA(string) IS_ALPHA_AT((string),0) +// +// /* +// * Check if the character at the specified position is a digit. +// */ +// +// #define IS_DIGIT_AT(string,offset) \ +// (((string).pointer[offset] >= (yaml_char_t) '0' && \ +// (string).pointer[offset] <= (yaml_char_t) '9')) +// +// #define IS_DIGIT(string) IS_DIGIT_AT((string),0) +// +// /* +// * Get the value of a digit. +// */ +// +// #define AS_DIGIT_AT(string,offset) \ +// ((string).pointer[offset] - (yaml_char_t) '0') +// +// #define AS_DIGIT(string) AS_DIGIT_AT((string),0) +// +// /* +// * Check if the character at the specified position is a hex-digit. +// */ +// +// #define IS_HEX_AT(string,offset) \ +// (((string).pointer[offset] >= (yaml_char_t) '0' && \ +// (string).pointer[offset] <= (yaml_char_t) '9') || \ +// ((string).pointer[offset] >= (yaml_char_t) 'A' && \ +// (string).pointer[offset] <= (yaml_char_t) 'F') || \ +// ((string).pointer[offset] >= (yaml_char_t) 'a' && \ +// (string).pointer[offset] <= (yaml_char_t) 'f')) +// +// #define IS_HEX(string) IS_HEX_AT((string),0) +// +// /* +// * Get the value of a hex-digit. +// */ +// +// #define AS_HEX_AT(string,offset) \ +// (((string).pointer[offset] >= (yaml_char_t) 'A' && \ +// (string).pointer[offset] <= (yaml_char_t) 'F') ? \ +// ((string).pointer[offset] - (yaml_char_t) 'A' + 10) : \ +// ((string).pointer[offset] >= (yaml_char_t) 'a' && \ +// (string).pointer[offset] <= (yaml_char_t) 'f') ? \ +// ((string).pointer[offset] - (yaml_char_t) 'a' + 10) : \ +// ((string).pointer[offset] - (yaml_char_t) '0')) +// +// #define AS_HEX(string) AS_HEX_AT((string),0) +// +// /* +// * Check if the character is ASCII. +// */ +// +// #define IS_ASCII_AT(string,offset) \ +// ((string).pointer[offset] <= (yaml_char_t) '\x7F') +// +// #define IS_ASCII(string) IS_ASCII_AT((string),0) +// +// /* +// * Check if the character can be printed unescaped. +// */ +// +// #define IS_PRINTABLE_AT(string,offset) \ +// (((string).pointer[offset] == 0x0A) /* . == #x0A */ \ +// || ((string).pointer[offset] >= 0x20 /* #x20 <= . <= #x7E */ \ +// && (string).pointer[offset] <= 0x7E) \ +// || ((string).pointer[offset] == 0xC2 /* #0xA0 <= . <= #xD7FF */ \ +// && (string).pointer[offset+1] >= 0xA0) \ +// || ((string).pointer[offset] > 0xC2 \ +// && (string).pointer[offset] < 0xED) \ +// || ((string).pointer[offset] == 0xED \ +// && (string).pointer[offset+1] < 0xA0) \ +// || ((string).pointer[offset] == 0xEE) \ +// || ((string).pointer[offset] == 0xEF /* #xE000 <= . <= #xFFFD */ \ +// && !((string).pointer[offset+1] == 0xBB /* && . != #xFEFF */ \ +// && (string).pointer[offset+2] == 0xBF) \ +// && !((string).pointer[offset+1] == 0xBF \ +// && ((string).pointer[offset+2] == 0xBE \ +// || (string).pointer[offset+2] == 0xBF)))) +// +// #define IS_PRINTABLE(string) IS_PRINTABLE_AT((string),0) +// +// /* +// * Check if the character at the specified position is NUL. +// */ +// +// #define IS_Z_AT(string,offset) CHECK_AT((string),'\0',(offset)) +// +// #define IS_Z(string) IS_Z_AT((string),0) +// +// /* +// * Check if the character at the specified position is BOM. +// */ +// +// #define IS_BOM_AT(string,offset) \ +// (CHECK_AT((string),'\xEF',(offset)) \ +// && CHECK_AT((string),'\xBB',(offset)+1) \ +// && CHECK_AT((string),'\xBF',(offset)+2)) /* BOM (#xFEFF) */ +// +// #define IS_BOM(string) IS_BOM_AT(string,0) +// +// /* +// * Check if the character at the specified position is space. +// */ +// +// #define IS_SPACE_AT(string,offset) CHECK_AT((string),' ',(offset)) +// +// #define IS_SPACE(string) IS_SPACE_AT((string),0) +// +// /* +// * Check if the character at the specified position is tab. +// */ +// +// #define IS_TAB_AT(string,offset) CHECK_AT((string),'\t',(offset)) +// +// #define IS_TAB(string) IS_TAB_AT((string),0) +// +// /* +// * Check if the character at the specified position is blank (space or tab). +// */ +// +// #define IS_BLANK_AT(string,offset) \ +// (IS_SPACE_AT((string),(offset)) || IS_TAB_AT((string),(offset))) +// +// #define IS_BLANK(string) IS_BLANK_AT((string),0) +// +// /* +// * Check if the character at the specified position is a line break. +// */ +// +// #define IS_BREAK_AT(string,offset) \ +// (CHECK_AT((string),'\r',(offset)) /* CR (#xD)*/ \ +// || CHECK_AT((string),'\n',(offset)) /* LF (#xA) */ \ +// || (CHECK_AT((string),'\xC2',(offset)) \ +// && CHECK_AT((string),'\x85',(offset)+1)) /* NEL (#x85) */ \ +// || (CHECK_AT((string),'\xE2',(offset)) \ +// && CHECK_AT((string),'\x80',(offset)+1) \ +// && CHECK_AT((string),'\xA8',(offset)+2)) /* LS (#x2028) */ \ +// || (CHECK_AT((string),'\xE2',(offset)) \ +// && CHECK_AT((string),'\x80',(offset)+1) \ +// && CHECK_AT((string),'\xA9',(offset)+2))) /* PS (#x2029) */ +// +// #define IS_BREAK(string) IS_BREAK_AT((string),0) +// +// #define IS_CRLF_AT(string,offset) \ +// (CHECK_AT((string),'\r',(offset)) && CHECK_AT((string),'\n',(offset)+1)) +// +// #define IS_CRLF(string) IS_CRLF_AT((string),0) +// +// /* +// * Check if the character is a line break or NUL. +// */ +// +// #define IS_BREAKZ_AT(string,offset) \ +// (IS_BREAK_AT((string),(offset)) || IS_Z_AT((string),(offset))) +// +// #define IS_BREAKZ(string) IS_BREAKZ_AT((string),0) +// +// /* +// * Check if the character is a line break, space, or NUL. +// */ +// +// #define IS_SPACEZ_AT(string,offset) \ +// (IS_SPACE_AT((string),(offset)) || IS_BREAKZ_AT((string),(offset))) +// +// #define IS_SPACEZ(string) IS_SPACEZ_AT((string),0) +// +// /* +// * Check if the character is a line break, space, tab, or NUL. +// */ +// +// #define IS_BLANKZ_AT(string,offset) \ +// (IS_BLANK_AT((string),(offset)) || IS_BREAKZ_AT((string),(offset))) +// +// #define IS_BLANKZ(string) IS_BLANKZ_AT((string),0) +// +// /* +// * Determine the width of the character. +// */ +// +// #define WIDTH_AT(string,offset) \ +// (((string).pointer[offset] & 0x80) == 0x00 ? 1 : \ +// ((string).pointer[offset] & 0xE0) == 0xC0 ? 2 : \ +// ((string).pointer[offset] & 0xF0) == 0xE0 ? 3 : \ +// ((string).pointer[offset] & 0xF8) == 0xF0 ? 4 : 0) +// +// #define WIDTH(string) WIDTH_AT((string),0) +// +// /* +// * Move the string pointer to the next character. +// */ +// +// #define MOVE(string) ((string).pointer += WIDTH((string))) +// +// /* +// * Copy a character and move the pointers of both strings. +// */ +// +// #define COPY(string_a,string_b) \ +// ((*(string_b).pointer & 0x80) == 0x00 ? \ +// (*((string_a).pointer++) = *((string_b).pointer++)) : \ +// (*(string_b).pointer & 0xE0) == 0xC0 ? \ +// (*((string_a).pointer++) = *((string_b).pointer++), \ +// *((string_a).pointer++) = *((string_b).pointer++)) : \ +// (*(string_b).pointer & 0xF0) == 0xE0 ? \ +// (*((string_a).pointer++) = *((string_b).pointer++), \ +// *((string_a).pointer++) = *((string_b).pointer++), \ +// *((string_a).pointer++) = *((string_b).pointer++)) : \ +// (*(string_b).pointer & 0xF8) == 0xF0 ? \ +// (*((string_a).pointer++) = *((string_b).pointer++), \ +// *((string_a).pointer++) = *((string_b).pointer++), \ +// *((string_a).pointer++) = *((string_b).pointer++), \ +// *((string_a).pointer++) = *((string_b).pointer++)) : 0) +// +// /* +// * Stack and queue management. +// */ +// +// yaml_DECLARE(int) +// yaml_stack_extend(void **start, void **top, void **end); +// +// yaml_DECLARE(int) +// yaml_queue_extend(void **start, void **head, void **tail, void **end); +// +// #define STACK_INIT(context,stack,size) \ +// (((stack).start = yaml_malloc((size)*sizeof(*(stack).start))) ? \ +// ((stack).top = (stack).start, \ +// (stack).end = (stack).start+(size), \ +// 1) : \ +// ((context)->error = yaml_MEMORY_ERROR, \ +// 0)) +// +// #define STACK_DEL(context,stack) \ +// (yaml_free((stack).start), \ +// (stack).start = (stack).top = (stack).end = 0) +// +// #define STACK_EMPTY(context,stack) \ +// ((stack).start == (stack).top) +// +// #define PUSH(context,stack,value) \ +// (((stack).top != (stack).end \ +// || yaml_stack_extend((void **)&(stack).start, \ +// (void **)&(stack).top, (void **)&(stack).end)) ? \ +// (*((stack).top++) = value, \ +// 1) : \ +// ((context)->error = yaml_MEMORY_ERROR, \ +// 0)) +// +// #define POP(context,stack) \ +// (*(--(stack).top)) +// +// #define QUEUE_INIT(context,queue,size) \ +// (((queue).start = yaml_malloc((size)*sizeof(*(queue).start))) ? \ +// ((queue).head = (queue).tail = (queue).start, \ +// (queue).end = (queue).start+(size), \ +// 1) : \ +// ((context)->error = yaml_MEMORY_ERROR, \ +// 0)) +// +// #define QUEUE_DEL(context,queue) \ +// (yaml_free((queue).start), \ +// (queue).start = (queue).head = (queue).tail = (queue).end = 0) +// +// #define QUEUE_EMPTY(context,queue) \ +// ((queue).head == (queue).tail) +// +// #define ENQUEUE(context,queue,value) \ +// (((queue).tail != (queue).end \ +// || yaml_queue_extend((void **)&(queue).start, (void **)&(queue).head, \ +// (void **)&(queue).tail, (void **)&(queue).end)) ? \ +// (*((queue).tail++) = value, \ +// 1) : \ +// ((context)->error = yaml_MEMORY_ERROR, \ +// 0)) +// +// #define DEQUEUE(context,queue) \ +// (*((queue).head++)) +// +// #define QUEUE_INSERT(context,queue,index,value) \ +// (((queue).tail != (queue).end \ +// || yaml_queue_extend((void **)&(queue).start, (void **)&(queue).head, \ +// (void **)&(queue).tail, (void **)&(queue).end)) ? \ +// (memmove((queue).head+(index)+1,(queue).head+(index), \ +// ((queue).tail-(queue).head-(index))*sizeof(*(queue).start)), \ +// *((queue).head+(index)) = value, \ +// (queue).tail++, \ +// 1) : \ +// ((context)->error = yaml_MEMORY_ERROR, \ +// 0)) +// +// /* +// * Token initializers. +// */ +// +// #define TOKEN_INIT(token,token_type,token_start_mark,token_end_mark) \ +// (memset(&(token), 0, sizeof(yaml_token_t)), \ +// (token).type = (token_type), \ +// (token).start_mark = (token_start_mark), \ +// (token).end_mark = (token_end_mark)) +// +// #define STREAM_START_TOKEN_INIT(token,token_encoding,start_mark,end_mark) \ +// (TOKEN_INIT((token),yaml_STREAM_START_TOKEN,(start_mark),(end_mark)), \ +// (token).data.stream_start.encoding = (token_encoding)) +// +// #define STREAM_END_TOKEN_INIT(token,start_mark,end_mark) \ +// (TOKEN_INIT((token),yaml_STREAM_END_TOKEN,(start_mark),(end_mark))) +// +// #define ALIAS_TOKEN_INIT(token,token_value,start_mark,end_mark) \ +// (TOKEN_INIT((token),yaml_ALIAS_TOKEN,(start_mark),(end_mark)), \ +// (token).data.alias.value = (token_value)) +// +// #define ANCHOR_TOKEN_INIT(token,token_value,start_mark,end_mark) \ +// (TOKEN_INIT((token),yaml_ANCHOR_TOKEN,(start_mark),(end_mark)), \ +// (token).data.anchor.value = (token_value)) +// +// #define TAG_TOKEN_INIT(token,token_handle,token_suffix,start_mark,end_mark) \ +// (TOKEN_INIT((token),yaml_TAG_TOKEN,(start_mark),(end_mark)), \ +// (token).data.tag.handle = (token_handle), \ +// (token).data.tag.suffix = (token_suffix)) +// +// #define SCALAR_TOKEN_INIT(token,token_value,token_length,token_style,start_mark,end_mark) \ +// (TOKEN_INIT((token),yaml_SCALAR_TOKEN,(start_mark),(end_mark)), \ +// (token).data.scalar.value = (token_value), \ +// (token).data.scalar.length = (token_length), \ +// (token).data.scalar.style = (token_style)) +// +// #define VERSION_DIRECTIVE_TOKEN_INIT(token,token_major,token_minor,start_mark,end_mark) \ +// (TOKEN_INIT((token),yaml_VERSION_DIRECTIVE_TOKEN,(start_mark),(end_mark)), \ +// (token).data.version_directive.major = (token_major), \ +// (token).data.version_directive.minor = (token_minor)) +// +// #define TAG_DIRECTIVE_TOKEN_INIT(token,token_handle,token_prefix,start_mark,end_mark) \ +// (TOKEN_INIT((token),yaml_TAG_DIRECTIVE_TOKEN,(start_mark),(end_mark)), \ +// (token).data.tag_directive.handle = (token_handle), \ +// (token).data.tag_directive.prefix = (token_prefix)) +// +// /* +// * Event initializers. +// */ +// +// #define EVENT_INIT(event,event_type,event_start_mark,event_end_mark) \ +// (memset(&(event), 0, sizeof(yaml_event_t)), \ +// (event).type = (event_type), \ +// (event).start_mark = (event_start_mark), \ +// (event).end_mark = (event_end_mark)) +// +// #define STREAM_START_EVENT_INIT(event,event_encoding,start_mark,end_mark) \ +// (EVENT_INIT((event),yaml_STREAM_START_EVENT,(start_mark),(end_mark)), \ +// (event).data.stream_start.encoding = (event_encoding)) +// +// #define STREAM_END_EVENT_INIT(event,start_mark,end_mark) \ +// (EVENT_INIT((event),yaml_STREAM_END_EVENT,(start_mark),(end_mark))) +// +// #define DOCUMENT_START_EVENT_INIT(event,event_version_directive, \ +// event_tag_directives_start,event_tag_directives_end,event_implicit,start_mark,end_mark) \ +// (EVENT_INIT((event),yaml_DOCUMENT_START_EVENT,(start_mark),(end_mark)), \ +// (event).data.document_start.version_directive = (event_version_directive), \ +// (event).data.document_start.tag_directives.start = (event_tag_directives_start), \ +// (event).data.document_start.tag_directives.end = (event_tag_directives_end), \ +// (event).data.document_start.implicit = (event_implicit)) +// +// #define DOCUMENT_END_EVENT_INIT(event,event_implicit,start_mark,end_mark) \ +// (EVENT_INIT((event),yaml_DOCUMENT_END_EVENT,(start_mark),(end_mark)), \ +// (event).data.document_end.implicit = (event_implicit)) +// +// #define ALIAS_EVENT_INIT(event,event_anchor,start_mark,end_mark) \ +// (EVENT_INIT((event),yaml_ALIAS_EVENT,(start_mark),(end_mark)), \ +// (event).data.alias.anchor = (event_anchor)) +// +// #define SCALAR_EVENT_INIT(event,event_anchor,event_tag,event_value,event_length, \ +// event_plain_implicit, event_quoted_implicit,event_style,start_mark,end_mark) \ +// (EVENT_INIT((event),yaml_SCALAR_EVENT,(start_mark),(end_mark)), \ +// (event).data.scalar.anchor = (event_anchor), \ +// (event).data.scalar.tag = (event_tag), \ +// (event).data.scalar.value = (event_value), \ +// (event).data.scalar.length = (event_length), \ +// (event).data.scalar.plain_implicit = (event_plain_implicit), \ +// (event).data.scalar.quoted_implicit = (event_quoted_implicit), \ +// (event).data.scalar.style = (event_style)) +// +// #define SEQUENCE_START_EVENT_INIT(event,event_anchor,event_tag, \ +// event_implicit,event_style,start_mark,end_mark) \ +// (EVENT_INIT((event),yaml_SEQUENCE_START_EVENT,(start_mark),(end_mark)), \ +// (event).data.sequence_start.anchor = (event_anchor), \ +// (event).data.sequence_start.tag = (event_tag), \ +// (event).data.sequence_start.implicit = (event_implicit), \ +// (event).data.sequence_start.style = (event_style)) +// +// #define SEQUENCE_END_EVENT_INIT(event,start_mark,end_mark) \ +// (EVENT_INIT((event),yaml_SEQUENCE_END_EVENT,(start_mark),(end_mark))) +// +// #define MAPPING_START_EVENT_INIT(event,event_anchor,event_tag, \ +// event_implicit,event_style,start_mark,end_mark) \ +// (EVENT_INIT((event),yaml_MAPPING_START_EVENT,(start_mark),(end_mark)), \ +// (event).data.mapping_start.anchor = (event_anchor), \ +// (event).data.mapping_start.tag = (event_tag), \ +// (event).data.mapping_start.implicit = (event_implicit), \ +// (event).data.mapping_start.style = (event_style)) +// +// #define MAPPING_END_EVENT_INIT(event,start_mark,end_mark) \ +// (EVENT_INIT((event),yaml_MAPPING_END_EVENT,(start_mark),(end_mark))) +// +// /* +// * Document initializer. +// */ +// +// #define DOCUMENT_INIT(document,document_nodes_start,document_nodes_end, \ +// document_version_directive,document_tag_directives_start, \ +// document_tag_directives_end,document_start_implicit, \ +// document_end_implicit,document_start_mark,document_end_mark) \ +// (memset(&(document), 0, sizeof(yaml_document_t)), \ +// (document).nodes.start = (document_nodes_start), \ +// (document).nodes.end = (document_nodes_end), \ +// (document).nodes.top = (document_nodes_start), \ +// (document).version_directive = (document_version_directive), \ +// (document).tag_directives.start = (document_tag_directives_start), \ +// (document).tag_directives.end = (document_tag_directives_end), \ +// (document).start_implicit = (document_start_implicit), \ +// (document).end_implicit = (document_end_implicit), \ +// (document).start_mark = (document_start_mark), \ +// (document).end_mark = (document_end_mark)) +// +// /* +// * Node initializers. +// */ +// +// #define NODE_INIT(node,node_type,node_tag,node_start_mark,node_end_mark) \ +// (memset(&(node), 0, sizeof(yaml_node_t)), \ +// (node).type = (node_type), \ +// (node).tag = (node_tag), \ +// (node).start_mark = (node_start_mark), \ +// (node).end_mark = (node_end_mark)) +// +// #define SCALAR_NODE_INIT(node,node_tag,node_value,node_length, \ +// node_style,start_mark,end_mark) \ +// (NODE_INIT((node),yaml_SCALAR_NODE,(node_tag),(start_mark),(end_mark)), \ +// (node).data.scalar.value = (node_value), \ +// (node).data.scalar.length = (node_length), \ +// (node).data.scalar.style = (node_style)) +// +// #define SEQUENCE_NODE_INIT(node,node_tag,node_items_start,node_items_end, \ +// node_style,start_mark,end_mark) \ +// (NODE_INIT((node),yaml_SEQUENCE_NODE,(node_tag),(start_mark),(end_mark)), \ +// (node).data.sequence.items.start = (node_items_start), \ +// (node).data.sequence.items.end = (node_items_end), \ +// (node).data.sequence.items.top = (node_items_start), \ +// (node).data.sequence.style = (node_style)) +// +// #define MAPPING_NODE_INIT(node,node_tag,node_pairs_start,node_pairs_end, \ +// node_style,start_mark,end_mark) \ +// (NODE_INIT((node),yaml_MAPPING_NODE,(node_tag),(start_mark),(end_mark)), \ +// (node).data.mapping.pairs.start = (node_pairs_start), \ +// (node).data.mapping.pairs.end = (node_pairs_end), \ +// (node).data.mapping.pairs.top = (node_pairs_start), \ +// (node).data.mapping.style = (node_style)) +// diff --git a/vendor/github.com/cloudfoundry-incubator/candiedyaml/yamlh.go b/vendor/github.com/cloudfoundry-incubator/candiedyaml/yamlh.go new file mode 100644 index 00000000..d608dbb3 --- /dev/null +++ b/vendor/github.com/cloudfoundry-incubator/candiedyaml/yamlh.go @@ -0,0 +1,953 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package candiedyaml + +import ( + "fmt" + "io" +) + +/** The version directive data. */ +type yaml_version_directive_t struct { + major int // The major version number + minor int // The minor version number +} + +/** The tag directive data. */ +type yaml_tag_directive_t struct { + handle []byte // The tag handle + prefix []byte // The tag prefix +} + +/** The stream encoding. */ +type yaml_encoding_t int + +const ( + /** Let the parser choose the encoding. */ + yaml_ANY_ENCODING yaml_encoding_t = iota + /** The defau lt UTF-8 encoding. */ + yaml_UTF8_ENCODING + /** The UTF-16-LE encoding with BOM. */ + yaml_UTF16LE_ENCODING + /** The UTF-16-BE encoding with BOM. */ + yaml_UTF16BE_ENCODING +) + +/** Line break types. */ +type yaml_break_t int + +const ( + yaml_ANY_BREAK yaml_break_t = iota /** Let the parser choose the break type. */ + yaml_CR_BREAK /** Use CR for line breaks (Mac style). */ + yaml_LN_BREAK /** Use LN for line breaks (Unix style). */ + yaml_CRLN_BREAK /** Use CR LN for line breaks (DOS style). */ +) + +/** Many bad things could happen with the parser and emitter. */ +type YAML_error_type_t int + +const ( + /** No error is produced. */ + yaml_NO_ERROR YAML_error_type_t = iota + + /** Cannot allocate or reallocate a block of memory. */ + yaml_MEMORY_ERROR + + /** Cannot read or decode the input stream. */ + yaml_READER_ERROR + /** Cannot scan the input stream. */ + yaml_SCANNER_ERROR + /** Cannot parse the input stream. */ + yaml_PARSER_ERROR + /** Cannot compose a YAML document. */ + yaml_COMPOSER_ERROR + + /** Cannot write to the output stream. */ + yaml_WRITER_ERROR + /** Cannot emit a YAML stream. */ + yaml_EMITTER_ERROR +) + +/** The pointer position. */ +type YAML_mark_t struct { + /** The position index. */ + index int + + /** The position line. */ + line int + + /** The position column. */ + column int +} + +func (m YAML_mark_t) String() string { + return fmt.Sprintf("line %d, column %d", m.line, m.column) +} + +/** @} */ + +/** + * @defgroup styles Node Styles + * @{ + */ + +type yaml_style_t int + +/** Scalar styles. */ +type yaml_scalar_style_t yaml_style_t + +const ( + /** Let the emitter choose the style. */ + yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = iota + + /** The plain scalar style. */ + yaml_PLAIN_SCALAR_STYLE + + /** The single-quoted scalar style. */ + yaml_SINGLE_QUOTED_SCALAR_STYLE + /** The double-quoted scalar style. */ + yaml_DOUBLE_QUOTED_SCALAR_STYLE + + /** The literal scalar style. */ + yaml_LITERAL_SCALAR_STYLE + /** The folded scalar style. */ + yaml_FOLDED_SCALAR_STYLE +) + +/** Sequence styles. */ +type yaml_sequence_style_t yaml_style_t + +const ( + /** Let the emitter choose the style. */ + yaml_ANY_SEQUENCE_STYLE yaml_sequence_style_t = iota + + /** The block sequence style. */ + yaml_BLOCK_SEQUENCE_STYLE + /** The flow sequence style. */ + yaml_FLOW_SEQUENCE_STYLE +) + +/** Mapping styles. */ +type yaml_mapping_style_t yaml_style_t + +const ( + /** Let the emitter choose the style. */ + yaml_ANY_MAPPING_STYLE yaml_mapping_style_t = iota + + /** The block mapping style. */ + yaml_BLOCK_MAPPING_STYLE + /** The flow mapping style. */ + yaml_FLOW_MAPPING_STYLE + +/* yaml_FLOW_SET_MAPPING_STYLE */ +) + +/** @} */ + +/** + * @defgroup tokens Tokens + * @{ + */ + +/** Token types. */ +type yaml_token_type_t int + +const ( + /** An empty token. */ + yaml_NO_TOKEN yaml_token_type_t = iota + + /** A STREAM-START token. */ + yaml_STREAM_START_TOKEN + /** A STREAM-END token. */ + yaml_STREAM_END_TOKEN + + /** A VERSION-DIRECTIVE token. */ + yaml_VERSION_DIRECTIVE_TOKEN + /** A TAG-DIRECTIVE token. */ + yaml_TAG_DIRECTIVE_TOKEN + /** A DOCUMENT-START token. */ + yaml_DOCUMENT_START_TOKEN + /** A DOCUMENT-END token. */ + yaml_DOCUMENT_END_TOKEN + + /** A BLOCK-SEQUENCE-START token. */ + yaml_BLOCK_SEQUENCE_START_TOKEN + /** A BLOCK-SEQUENCE-END token. */ + yaml_BLOCK_MAPPING_START_TOKEN + /** A BLOCK-END token. */ + yaml_BLOCK_END_TOKEN + + /** A FLOW-SEQUENCE-START token. */ + yaml_FLOW_SEQUENCE_START_TOKEN + /** A FLOW-SEQUENCE-END token. */ + yaml_FLOW_SEQUENCE_END_TOKEN + /** A FLOW-MAPPING-START token. */ + yaml_FLOW_MAPPING_START_TOKEN + /** A FLOW-MAPPING-END token. */ + yaml_FLOW_MAPPING_END_TOKEN + + /** A BLOCK-ENTRY token. */ + yaml_BLOCK_ENTRY_TOKEN + /** A FLOW-ENTRY token. */ + yaml_FLOW_ENTRY_TOKEN + /** A KEY token. */ + yaml_KEY_TOKEN + /** A VALUE token. */ + yaml_VALUE_TOKEN + + /** An ALIAS token. */ + yaml_ALIAS_TOKEN + /** An ANCHOR token. */ + yaml_ANCHOR_TOKEN + /** A TAG token. */ + yaml_TAG_TOKEN + /** A SCALAR token. */ + yaml_SCALAR_TOKEN +) + +/** The token structure. */ +type yaml_token_t struct { + + /** The token type. */ + token_type yaml_token_type_t + + /** The token data. */ + /** The stream start (for @c yaml_STREAM_START_TOKEN). */ + encoding yaml_encoding_t + + /** The alias (for @c yaml_ALIAS_TOKEN, yaml_ANCHOR_TOKEN, yaml_SCALAR_TOKEN,yaml_TAG_TOKEN ). */ + /** The anchor (for @c ). */ + /** The scalar value (for @c ). */ + value []byte + + /** The tag suffix. */ + suffix []byte + + /** The scalar value (for @c yaml_SCALAR_TOKEN). */ + /** The scalar style. */ + style yaml_scalar_style_t + + /** The version directive (for @c yaml_VERSION_DIRECTIVE_TOKEN). */ + version_directive yaml_version_directive_t + + /** The tag directive (for @c yaml_TAG_DIRECTIVE_TOKEN). */ + prefix []byte + + /** The beginning of the token. */ + start_mark YAML_mark_t + /** The end of the token. */ + end_mark YAML_mark_t + + major, minor int +} + +/** + * @defgroup events Events + * @{ + */ + +/** Event types. */ +type yaml_event_type_t int + +const ( + /** An empty event. */ + yaml_NO_EVENT yaml_event_type_t = iota + + /** A STREAM-START event. */ + yaml_STREAM_START_EVENT + /** A STREAM-END event. */ + yaml_STREAM_END_EVENT + + /** A DOCUMENT-START event. */ + yaml_DOCUMENT_START_EVENT + /** A DOCUMENT-END event. */ + yaml_DOCUMENT_END_EVENT + + /** An ALIAS event. */ + yaml_ALIAS_EVENT + /** A SCALAR event. */ + yaml_SCALAR_EVENT + + /** A SEQUENCE-START event. */ + yaml_SEQUENCE_START_EVENT + /** A SEQUENCE-END event. */ + yaml_SEQUENCE_END_EVENT + + /** A MAPPING-START event. */ + yaml_MAPPING_START_EVENT + /** A MAPPING-END event. */ + yaml_MAPPING_END_EVENT +) + +/** The event structure. */ +type yaml_event_t struct { + + /** The event type. */ + event_type yaml_event_type_t + + /** The stream parameters (for @c yaml_STREAM_START_EVENT). */ + encoding yaml_encoding_t + + /** The document parameters (for @c yaml_DOCUMENT_START_EVENT). */ + version_directive *yaml_version_directive_t + + /** The beginning and end of the tag directives list. */ + tag_directives []yaml_tag_directive_t + + /** The document parameters (for @c yaml_DOCUMENT_START_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_START_EVENT,yaml_MAPPING_START_EVENT). */ + /** Is the document indicator implicit? */ + implicit bool + + /** The alias parameters (for @c yaml_ALIAS_EVENT,yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). */ + /** The anchor. */ + anchor []byte + + /** The scalar parameters (for @c yaml_SCALAR_EVENT,yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). */ + /** The tag. */ + tag []byte + /** The scalar value. */ + value []byte + + /** Is the tag optional for the plain style? */ + plain_implicit bool + /** Is the tag optional for any non-plain style? */ + quoted_implicit bool + + /** The sequence parameters (for @c yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). */ + /** The sequence style. */ + /** The scalar style. */ + style yaml_style_t + + /** The beginning of the event. */ + start_mark, end_mark YAML_mark_t +} + +/** + * @defgroup nodes Nodes + * @{ + */ + +const ( + /** The tag @c !!null with the only possible value: @c null. */ + yaml_NULL_TAG = "tag:yaml.org,2002:null" + /** The tag @c !!bool with the values: @c true and @c falce. */ + yaml_BOOL_TAG = "tag:yaml.org,2002:bool" + /** The tag @c !!str for string values. */ + yaml_STR_TAG = "tag:yaml.org,2002:str" + /** The tag @c !!int for integer values. */ + yaml_INT_TAG = "tag:yaml.org,2002:int" + /** The tag @c !!float for float values. */ + yaml_FLOAT_TAG = "tag:yaml.org,2002:float" + /** The tag @c !!timestamp for date and time values. */ + yaml_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp" + + /** The tag @c !!seq is used to denote sequences. */ + yaml_SEQ_TAG = "tag:yaml.org,2002:seq" + /** The tag @c !!map is used to denote mapping. */ + yaml_MAP_TAG = "tag:yaml.org,2002:map" + + /** The default scalar tag is @c !!str. */ + yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG + /** The default sequence tag is @c !!seq. */ + yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG + /** The default mapping tag is @c !!map. */ + yaml_DEFAULT_MAPPING_TAG = yaml_MAP_TAG + + yaml_BINARY_TAG = "tag:yaml.org,2002:binary" +) + +/** Node types. */ +type yaml_node_type_t int + +const ( + /** An empty node. */ + yaml_NO_NODE yaml_node_type_t = iota + + /** A scalar node. */ + yaml_SCALAR_NODE + /** A sequence node. */ + yaml_SEQUENCE_NODE + /** A mapping node. */ + yaml_MAPPING_NODE +) + +/** An element of a sequence node. */ +type yaml_node_item_t int + +/** An element of a mapping node. */ +type yaml_node_pair_t struct { + /** The key of the element. */ + key int + /** The value of the element. */ + value int +} + +/** The node structure. */ +type yaml_node_t struct { + + /** The node type. */ + node_type yaml_node_type_t + + /** The node tag. */ + tag []byte + + /** The scalar parameters (for @c yaml_SCALAR_NODE). */ + scalar struct { + /** The scalar value. */ + value []byte + /** The scalar style. */ + style yaml_scalar_style_t + } + + /** The sequence parameters (for @c yaml_SEQUENCE_NODE). */ + sequence struct { + /** The stack of sequence items. */ + items []yaml_node_item_t + /** The sequence style. */ + style yaml_sequence_style_t + } + + /** The mapping parameters (for @c yaml_MAPPING_NODE). */ + mapping struct { + /** The stack of mapping pairs (key, value). */ + pairs []yaml_node_pair_t + /** The mapping style. */ + style yaml_mapping_style_t + } + + /** The beginning of the node. */ + start_mark YAML_mark_t + /** The end of the node. */ + end_mark YAML_mark_t +} + +/** The document structure. */ +type yaml_document_t struct { + + /** The document nodes. */ + nodes []yaml_node_t + + /** The version directive. */ + version_directive *yaml_version_directive_t + + /** The list of tag directives. */ + tags []yaml_tag_directive_t + + /** Is the document start indicator implicit? */ + start_implicit bool + /** Is the document end indicator implicit? */ + end_implicit bool + + /** The beginning of the document. */ + start_mark YAML_mark_t + /** The end of the document. */ + end_mark YAML_mark_t +} + +/** + * The prototype of a read handler. + * + * The read handler is called when the parser needs to read more bytes from the + * source. The handler should write not more than @a size bytes to the @a + * buffer. The number of written bytes should be set to the @a length variable. + * + * @param[in,out] data A pointer to an application data specified by + * yaml_parser_set_input(). + * @param[out] buffer The buffer to write the data from the source. + * @param[in] size The size of the buffer. + * @param[out] size_read The actual number of bytes read from the source. + * + * @returns On success, the handler should return @c 1. If the handler failed, + * the returned value should be @c 0. On EOF, the handler should set the + * @a size_read to @c 0 and return @c 1. + */ + +type yaml_read_handler_t func(parser *yaml_parser_t, buffer []byte) (n int, err error) + +/** + * This structure holds information about a potential simple key. + */ + +type yaml_simple_key_t struct { + /** Is a simple key possible? */ + possible bool + + /** Is a simple key required? */ + required bool + + /** The number of the token. */ + token_number int + + /** The position mark. */ + mark YAML_mark_t +} + +/** + * The states of the parser. + */ +type yaml_parser_state_t int + +const ( + /** Expect STREAM-START. */ + yaml_PARSE_STREAM_START_STATE yaml_parser_state_t = iota + /** Expect the beginning of an implicit document. */ + yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE + /** Expect DOCUMENT-START. */ + yaml_PARSE_DOCUMENT_START_STATE + /** Expect the content of a document. */ + yaml_PARSE_DOCUMENT_CONTENT_STATE + /** Expect DOCUMENT-END. */ + yaml_PARSE_DOCUMENT_END_STATE + /** Expect a block node. */ + yaml_PARSE_BLOCK_NODE_STATE + /** Expect a block node or indentless sequence. */ + yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE + /** Expect a flow node. */ + yaml_PARSE_FLOW_NODE_STATE + /** Expect the first entry of a block sequence. */ + yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE + /** Expect an entry of a block sequence. */ + yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE + /** Expect an entry of an indentless sequence. */ + yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE + /** Expect the first key of a block mapping. */ + yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE + /** Expect a block mapping key. */ + yaml_PARSE_BLOCK_MAPPING_KEY_STATE + /** Expect a block mapping value. */ + yaml_PARSE_BLOCK_MAPPING_VALUE_STATE + /** Expect the first entry of a flow sequence. */ + yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE + /** Expect an entry of a flow sequence. */ + yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE + /** Expect a key of an ordered mapping. */ + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE + /** Expect a value of an ordered mapping. */ + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE + /** Expect the and of an ordered mapping entry. */ + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE + /** Expect the first key of a flow mapping. */ + yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE + /** Expect a key of a flow mapping. */ + yaml_PARSE_FLOW_MAPPING_KEY_STATE + /** Expect a value of a flow mapping. */ + yaml_PARSE_FLOW_MAPPING_VALUE_STATE + /** Expect an empty value of a flow mapping. */ + yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE + /** Expect nothing. */ + yaml_PARSE_END_STATE +) + +/** + * This structure holds aliases data. + */ + +type yaml_alias_data_t struct { + /** The anchor. */ + anchor []byte + /** The node id. */ + index int + /** The anchor mark. */ + mark YAML_mark_t +} + +/** + * The parser structure. + * + * All members are internal. Manage the structure using the @c yaml_parser_ + * family of functions. + */ + +type yaml_parser_t struct { + + /** + * @name Error handling + * @{ + */ + + /** Error type. */ + error YAML_error_type_t + /** Error description. */ + problem string + /** The byte about which the problem occured. */ + problem_offset int + /** The problematic value (@c -1 is none). */ + problem_value int + /** The problem position. */ + problem_mark YAML_mark_t + /** The error context. */ + context string + /** The context position. */ + context_mark YAML_mark_t + + /** + * @} + */ + + /** + * @name Reader stuff + * @{ + */ + + /** Read handler. */ + read_handler yaml_read_handler_t + + /** Reader input data. */ + input_reader io.Reader + input []byte + input_pos int + + /** EOF flag */ + eof bool + + /** The working buffer. */ + buffer []byte + buffer_pos int + + /* The number of unread characters in the buffer. */ + unread int + + /** The raw buffer. */ + raw_buffer []byte + raw_buffer_pos int + + /** The input encoding. */ + encoding yaml_encoding_t + + /** The offset of the current position (in bytes). */ + offset int + + /** The mark of the current position. */ + mark YAML_mark_t + + /** + * @} + */ + + /** + * @name Scanner stuff + * @{ + */ + + /** Have we started to scan the input stream? */ + stream_start_produced bool + + /** Have we reached the end of the input stream? */ + stream_end_produced bool + + /** The number of unclosed '[' and '{' indicators. */ + flow_level int + + /** The tokens queue. */ + tokens []yaml_token_t + tokens_head int + + /** The number of tokens fetched from the queue. */ + tokens_parsed int + + /* Does the tokens queue contain a token ready for dequeueing. */ + token_available bool + + /** The indentation levels stack. */ + indents []int + + /** The current indentation level. */ + indent int + + /** May a simple key occur at the current position? */ + simple_key_allowed bool + + /** The stack of simple keys. */ + simple_keys []yaml_simple_key_t + + /** + * @} + */ + + /** + * @name Parser stuff + * @{ + */ + + /** The parser states stack. */ + states []yaml_parser_state_t + + /** The current parser state. */ + state yaml_parser_state_t + + /** The stack of marks. */ + marks []YAML_mark_t + + /** The list of TAG directives. */ + tag_directives []yaml_tag_directive_t + + /** + * @} + */ + + /** + * @name Dumper stuff + * @{ + */ + + /** The alias data. */ + aliases []yaml_alias_data_t + + /** The currently parsed document. */ + document *yaml_document_t + + /** + * @} + */ + +} + +/** + * The prototype of a write handler. + * + * The write handler is called when the emitter needs to flush the accumulated + * characters to the output. The handler should write @a size bytes of the + * @a buffer to the output. + * + * @param[in,out] data A pointer to an application data specified by + * yaml_emitter_set_output(). + * @param[in] buffer The buffer with bytes to be written. + * @param[in] size The size of the buffer. + * + * @returns On success, the handler should return @c 1. If the handler failed, + * the returned value should be @c 0. + */ + +type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error + +/** The emitter states. */ +type yaml_emitter_state_t int + +const ( + /** Expect STREAM-START. */ + yaml_EMIT_STREAM_START_STATE yaml_emitter_state_t = iota + /** Expect the first DOCUMENT-START or STREAM-END. */ + yaml_EMIT_FIRST_DOCUMENT_START_STATE + /** Expect DOCUMENT-START or STREAM-END. */ + yaml_EMIT_DOCUMENT_START_STATE + /** Expect the content of a document. */ + yaml_EMIT_DOCUMENT_CONTENT_STATE + /** Expect DOCUMENT-END. */ + yaml_EMIT_DOCUMENT_END_STATE + /** Expect the first item of a flow sequence. */ + yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE + /** Expect an item of a flow sequence. */ + yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE + /** Expect the first key of a flow mapping. */ + yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE + /** Expect a key of a flow mapping. */ + yaml_EMIT_FLOW_MAPPING_KEY_STATE + /** Expect a value for a simple key of a flow mapping. */ + yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE + /** Expect a value of a flow mapping. */ + yaml_EMIT_FLOW_MAPPING_VALUE_STATE + /** Expect the first item of a block sequence. */ + yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE + /** Expect an item of a block sequence. */ + yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE + /** Expect the first key of a block mapping. */ + yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE + /** Expect the key of a block mapping. */ + yaml_EMIT_BLOCK_MAPPING_KEY_STATE + /** Expect a value for a simple key of a block mapping. */ + yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE + /** Expect a value of a block mapping. */ + yaml_EMIT_BLOCK_MAPPING_VALUE_STATE + /** Expect nothing. */ + yaml_EMIT_END_STATE +) + +/** + * The emitter structure. + * + * All members are internal. Manage the structure using the @c yaml_emitter_ + * family of functions. + */ + +type yaml_emitter_t struct { + + /** + * @name Error handling + * @{ + */ + + /** Error type. */ + error YAML_error_type_t + /** Error description. */ + problem string + + /** + * @} + */ + + /** + * @name Writer stuff + * @{ + */ + + /** Write handler. */ + write_handler yaml_write_handler_t + + /** Standard (string or file) output data. */ + output_buffer *[]byte + output_writer io.Writer + + /** The working buffer. */ + buffer []byte + buffer_pos int + + /** The raw buffer. */ + raw_buffer []byte + raw_buffer_pos int + + /** The stream encoding. */ + encoding yaml_encoding_t + + /** + * @} + */ + + /** + * @name Emitter stuff + * @{ + */ + + /** If the output is in the canonical style? */ + canonical bool + /** The number of indentation spaces. */ + best_indent int + /** The preferred width of the output lines. */ + best_width int + /** Allow unescaped non-ASCII characters? */ + unicode bool + /** The preferred line break. */ + line_break yaml_break_t + + /** The stack of states. */ + states []yaml_emitter_state_t + + /** The current emitter state. */ + state yaml_emitter_state_t + + /** The event queue. */ + events []yaml_event_t + events_head int + + /** The stack of indentation levels. */ + indents []int + + /** The list of tag directives. */ + tag_directives []yaml_tag_directive_t + + /** The current indentation level. */ + indent int + + /** The current flow level. */ + flow_level int + + /** Is it the document root context? */ + root_context bool + /** Is it a sequence context? */ + sequence_context bool + /** Is it a mapping context? */ + mapping_context bool + /** Is it a simple mapping key context? */ + simple_key_context bool + + /** The current line. */ + line int + /** The current column. */ + column int + /** If the last character was a whitespace? */ + whitespace bool + /** If the last character was an indentation character (' ', '-', '?', ':')? */ + indention bool + /** If an explicit document end is required? */ + open_ended bool + + /** Anchor analysis. */ + anchor_data struct { + /** The anchor value. */ + anchor []byte + /** Is it an alias? */ + alias bool + } + + /** Tag analysis. */ + tag_data struct { + /** The tag handle. */ + handle []byte + /** The tag suffix. */ + suffix []byte + } + + /** Scalar analysis. */ + scalar_data struct { + /** The scalar value. */ + value []byte + /** Does the scalar contain line breaks? */ + multiline bool + /** Can the scalar be expessed in the flow plain style? */ + flow_plain_allowed bool + /** Can the scalar be expressed in the block plain style? */ + block_plain_allowed bool + /** Can the scalar be expressed in the single quoted style? */ + single_quoted_allowed bool + /** Can the scalar be expressed in the literal or folded styles? */ + block_allowed bool + /** The output style. */ + style yaml_scalar_style_t + } + + /** + * @} + */ + + /** + * @name Dumper stuff + * @{ + */ + + /** If the stream was already opened? */ + opened bool + /** If the stream was already closed? */ + closed bool + + /** The information associated with the document nodes. */ + anchors *struct { + /** The number of references. */ + references int + /** The anchor id. */ + anchor int + /** If the node has been emitted? */ + serialized bool + } + + /** The last assigned anchor id. */ + last_anchor_id int + + /** The currently emitted document. */ + document *yaml_document_t + + /** + * @} + */ + +} diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/.travis.yml b/vendor/github.com/codegangsta/cli/.travis.yml similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/.travis.yml rename to vendor/github.com/codegangsta/cli/.travis.yml diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/LICENSE b/vendor/github.com/codegangsta/cli/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/LICENSE rename to vendor/github.com/codegangsta/cli/LICENSE diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/README.md b/vendor/github.com/codegangsta/cli/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/README.md rename to vendor/github.com/codegangsta/cli/README.md diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/app.go b/vendor/github.com/codegangsta/cli/app.go similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/app.go rename to vendor/github.com/codegangsta/cli/app.go diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go b/vendor/github.com/codegangsta/cli/app_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go rename to vendor/github.com/codegangsta/cli/app_test.go diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/autocomplete/bash_autocomplete b/vendor/github.com/codegangsta/cli/autocomplete/bash_autocomplete similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/autocomplete/bash_autocomplete rename to vendor/github.com/codegangsta/cli/autocomplete/bash_autocomplete diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/autocomplete/zsh_autocomplete b/vendor/github.com/codegangsta/cli/autocomplete/zsh_autocomplete similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/autocomplete/zsh_autocomplete rename to vendor/github.com/codegangsta/cli/autocomplete/zsh_autocomplete diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/cli.go b/vendor/github.com/codegangsta/cli/cli.go similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/cli.go rename to vendor/github.com/codegangsta/cli/cli.go diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/cli_test.go b/vendor/github.com/codegangsta/cli/cli_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/cli_test.go rename to vendor/github.com/codegangsta/cli/cli_test.go diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/command.go b/vendor/github.com/codegangsta/cli/command.go similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/command.go rename to vendor/github.com/codegangsta/cli/command.go diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/command_test.go b/vendor/github.com/codegangsta/cli/command_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/command_test.go rename to vendor/github.com/codegangsta/cli/command_test.go diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/context.go b/vendor/github.com/codegangsta/cli/context.go similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/context.go rename to vendor/github.com/codegangsta/cli/context.go diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/context_test.go b/vendor/github.com/codegangsta/cli/context_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/context_test.go rename to vendor/github.com/codegangsta/cli/context_test.go diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/flag.go b/vendor/github.com/codegangsta/cli/flag.go similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/flag.go rename to vendor/github.com/codegangsta/cli/flag.go diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/flag_test.go b/vendor/github.com/codegangsta/cli/flag_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/flag_test.go rename to vendor/github.com/codegangsta/cli/flag_test.go diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/help.go b/vendor/github.com/codegangsta/cli/help.go similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/help.go rename to vendor/github.com/codegangsta/cli/help.go diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/helpers_test.go b/vendor/github.com/codegangsta/cli/helpers_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/codegangsta/cli/helpers_test.go rename to vendor/github.com/codegangsta/cli/helpers_test.go diff --git a/vendor/github.com/coreos/coreos-cloudinit/.gitignore b/vendor/github.com/coreos/coreos-cloudinit/.gitignore new file mode 100644 index 00000000..874ddb58 --- /dev/null +++ b/vendor/github.com/coreos/coreos-cloudinit/.gitignore @@ -0,0 +1,4 @@ +*.swp +bin/ +coverage/ +gopath/ diff --git a/vendor/github.com/coreos/coreos-cloudinit/.travis.yml b/vendor/github.com/coreos/coreos-cloudinit/.travis.yml new file mode 100644 index 00000000..5bd6fddc --- /dev/null +++ b/vendor/github.com/coreos/coreos-cloudinit/.travis.yml @@ -0,0 +1,17 @@ +language: go +sudo: false +matrix: + include: + - go: 1.4 + env: TOOLS_CMD=golang.org/x/tools/cmd + - go: 1.3 + env: TOOLS_CMD=code.google.com/p/go.tools/cmd + - go: 1.2 + env: TOOLS_CMD=code.google.com/p/go.tools/cmd + +install: + - go get ${TOOLS_CMD}/cover + - go get ${TOOLS_CMD}/vet + +script: + - ./test diff --git a/vendor/github.com/coreos/coreos-cloudinit/CONTRIBUTING.md b/vendor/github.com/coreos/coreos-cloudinit/CONTRIBUTING.md new file mode 100644 index 00000000..7ad3b312 --- /dev/null +++ b/vendor/github.com/coreos/coreos-cloudinit/CONTRIBUTING.md @@ -0,0 +1,68 @@ +# How to Contribute + +CoreOS projects are [Apache 2.0 licensed](LICENSE) and accept contributions via +GitHub pull requests. This document outlines some of the conventions on +development workflow, commit message formatting, contact points and other +resources to make it easier to get your contribution accepted. + +# Certificate of Origin + +By contributing to this project you agree to the Developer Certificate of +Origin (DCO). This document was created by the Linux Kernel community and is a +simple statement that you, as a contributor, have the legal right to make the +contribution. See the [DCO](DCO) file for details. + +# Email and Chat + +The project currently uses the general CoreOS email list and IRC channel: +- Email: [coreos-dev](https://groups.google.com/forum/#!forum/coreos-dev) +- IRC: #[coreos](irc://irc.freenode.org:6667/#coreos) IRC channel on freenode.org + +## Getting Started + +- Fork the repository on GitHub +- Read the [README](README.md) for build and test instructions +- Play with the project, submit bugs, submit patches! + +## Contribution Flow + +This is a rough outline of what a contributor's workflow looks like: + +- Create a topic branch from where you want to base your work (usually master). +- Make commits of logical units. +- Make sure your commit messages are in the proper format (see below). +- Push your changes to a topic branch in your fork of the repository. +- Make sure the tests pass, and add any new tests as appropriate. +- Submit a pull request to the original repository. + +Thanks for your contributions! + +### Format of the Commit Message + +We follow a rough convention for commit messages that is designed to answer two +questions: what changed and why. The subject line should feature the what and +the body of the commit should describe the why. + +``` +environment: write new keys in consistent order + +Go 1.3 randomizes the ordering of keys when iterating over a map. +Sort the keys to make this ordering consistent. + +Fixes #38 +``` + +The format can be described more formally as follows: + +``` +: + + + +