From c9d53ef8be42e4bd6182234f18aeb14a708c41bc Mon Sep 17 00:00:00 2001 From: Marc CARRE Date: Sun, 8 Oct 2017 13:36:08 +0100 Subject: [PATCH] Add weaveworks/promrus v1.1.0. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` $ gvt fetch -tag v1.1.0 github.com/weaveworks/promrus 2017/10/08 XX:XX:XX Fetching: github.com/weaveworks/promrus 2017/10/08 XX:XX:XX · Fetching recursive dependency: github.com/julienschmidt/httprouter 2017/10/08 XX:XX:XX · Fetching recursive dependency: github.com/go-kit/kit/log 2017/10/08 XX:XX:XX ·· Fetching recursive dependency: github.com/go-stack/stack 2017/10/08 XX:XX:XX ·· Fetching recursive dependency: github.com/go-logfmt/logfmt 2017/10/08 XX:XX:XX ··· Fetching recursive dependency: github.com/kr/logfmt 2017/10/08 XX:XX:XX · Skipping (existing): gopkg.in/yaml.v2 2017/10/08 XX:XX:XX · Fetching recursive dependency: gopkg.in/alecthomas/kingpin.v2 2017/10/08 XX:XX:XX ·· Fetching recursive dependency: github.com/alecthomas/units 2017/10/08 XX:XX:XX ·· Fetching recursive dependency: github.com/alecthomas/template 2017/10/08 XX:XX:XX · Skipping (existing): golang.org/x/net/context/ctxhttp 2017/10/08 XX:XX:XX · Fetching recursive dependency: github.com/stretchr/objx 2017/10/08 XX:XX:XX · Skipping (existing): golang.org/x/net/context 2017/10/08 XX:XX:XX · Fetching recursive dependency: github.com/pkg/errors ``` --- vendor/github.com/alecthomas/template/LICENSE | 27 + vendor/github.com/alecthomas/template/doc.go | 406 ++ vendor/github.com/alecthomas/template/exec.go | 845 +++++ .../github.com/alecthomas/template/funcs.go | 598 +++ .../github.com/alecthomas/template/helper.go | 108 + .../alecthomas/template/parse/lex.go | 556 +++ .../alecthomas/template/parse/node.go | 834 ++++ .../alecthomas/template/parse/parse.go | 700 ++++ .../alecthomas/template/template.go | 218 ++ vendor/github.com/alecthomas/units/COPYING | 19 + vendor/github.com/alecthomas/units/bytes.go | 83 + vendor/github.com/alecthomas/units/doc.go | 13 + vendor/github.com/alecthomas/units/si.go | 26 + vendor/github.com/alecthomas/units/util.go | 138 + vendor/github.com/go-kit/kit/log/LICENSE | 22 + .../kit/log/deprecated_levels/levels.go | 127 + vendor/github.com/go-kit/kit/log/doc.go | 116 + .../github.com/go-kit/kit/log/json_logger.go | 89 + vendor/github.com/go-kit/kit/log/level/doc.go | 22 + .../github.com/go-kit/kit/log/level/level.go | 205 + vendor/github.com/go-kit/kit/log/log.go | 135 + .../go-kit/kit/log/logfmt_logger.go | 62 + .../github.com/go-kit/kit/log/nop_logger.go | 8 + vendor/github.com/go-kit/kit/log/stdlib.go | 116 + vendor/github.com/go-kit/kit/log/sync.go | 116 + .../go-kit/kit/log/term/colorlogger.go | 144 + .../go-kit/kit/log/term/colorwriter_others.go | 12 + .../kit/log/term/colorwriter_windows.go | 190 + vendor/github.com/go-kit/kit/log/term/term.go | 22 + .../go-kit/kit/log/term/terminal_appengine.go | 15 + .../go-kit/kit/log/term/terminal_darwin.go | 10 + .../go-kit/kit/log/term/terminal_freebsd.go | 7 + .../go-kit/kit/log/term/terminal_linux.go | 12 + .../kit/log/term/terminal_notwindows.go | 25 + .../go-kit/kit/log/term/terminal_openbsd.go | 5 + .../go-kit/kit/log/term/terminal_windows.go | 102 + vendor/github.com/go-kit/kit/log/value.go | 102 + vendor/github.com/go-logfmt/logfmt/LICENSE | 22 + vendor/github.com/go-logfmt/logfmt/decode.go | 237 ++ vendor/github.com/go-logfmt/logfmt/doc.go | 6 + vendor/github.com/go-logfmt/logfmt/encode.go | 321 ++ vendor/github.com/go-logfmt/logfmt/fuzz.go | 126 + .../github.com/go-logfmt/logfmt/jsonstring.go | 277 ++ vendor/github.com/go-stack/stack/LICENSE.md | 21 + vendor/github.com/go-stack/stack/stack.go | 340 ++ .../julienschmidt/httprouter/LICENSE | 24 + .../julienschmidt/httprouter/path.go | 123 + .../julienschmidt/httprouter/router.go | 411 ++ .../julienschmidt/httprouter/tree.go | 656 ++++ vendor/github.com/kr/logfmt/decode.go | 184 + vendor/github.com/kr/logfmt/scanner.go | 149 + vendor/github.com/kr/logfmt/unquote.go | 149 + vendor/github.com/pkg/errors/LICENSE | 23 + vendor/github.com/pkg/errors/errors.go | 269 ++ vendor/github.com/pkg/errors/stack.go | 186 + vendor/github.com/stretchr/objx/LICENSE.md | 23 + vendor/github.com/stretchr/objx/accessors.go | 179 + vendor/github.com/stretchr/objx/constants.go | 13 + .../github.com/stretchr/objx/conversions.go | 117 + vendor/github.com/stretchr/objx/doc.go | 72 + vendor/github.com/stretchr/objx/map.go | 222 ++ vendor/github.com/stretchr/objx/mutations.go | 81 + vendor/github.com/stretchr/objx/security.go | 14 + vendor/github.com/stretchr/objx/tests.go | 17 + .../stretchr/objx/type_specific_codegen.go | 2881 ++++++++++++++ vendor/github.com/stretchr/objx/value.go | 56 + vendor/github.com/weaveworks/promrus/LICENSE | 201 + .../github.com/weaveworks/promrus/promrus.go | 58 + .../beorn7/perks/histogram/histogram.go | 108 + .../beorn7/perks/quantile/stream.go | 292 ++ .../github.com/beorn7/perks/topk/topk.go | 90 + .../github.com/davecgh/go-spew/spew/bypass.go | 152 + .../davecgh/go-spew/spew/bypasssafe.go | 38 + .../github.com/davecgh/go-spew/spew/common.go | 341 ++ .../github.com/davecgh/go-spew/spew/config.go | 306 ++ .../github.com/davecgh/go-spew/spew/doc.go | 211 + .../github.com/davecgh/go-spew/spew/dump.go | 509 +++ .../github.com/davecgh/go-spew/spew/format.go | 419 ++ .../github.com/davecgh/go-spew/spew/spew.go | 148 + .../golang/protobuf/descriptor/descriptor.go | 93 + .../golang/protobuf/jsonpb/jsonpb.go | 1083 ++++++ .../jsonpb_test_proto/more_test_objects.pb.go | 266 ++ .../jsonpb_test_proto/test_objects.pb.go | 852 +++++ .../github.com/golang/protobuf/proto/clone.go | 229 ++ .../golang/protobuf/proto/decode.go | 970 +++++ .../golang/protobuf/proto/encode.go | 1362 +++++++ .../github.com/golang/protobuf/proto/equal.go | 300 ++ .../golang/protobuf/proto/extensions.go | 587 +++ .../github.com/golang/protobuf/proto/lib.go | 897 +++++ .../golang/protobuf/proto/message_set.go | 311 ++ .../golang/protobuf/proto/pointer_reflect.go | 484 +++ .../golang/protobuf/proto/pointer_unsafe.go | 270 ++ .../golang/protobuf/proto/properties.go | 872 +++++ .../protobuf/proto/proto3_proto/proto3.pb.go | 347 ++ .../github.com/golang/protobuf/proto/text.go | 854 +++++ .../golang/protobuf/proto/text_parser.go | 895 +++++ .../protoc-gen-go/descriptor/descriptor.pb.go | 2215 +++++++++++ .../golang/protobuf/protoc-gen-go/doc.go | 51 + .../protoc-gen-go/generator/generator.go | 2866 ++++++++++++++ .../protobuf/protoc-gen-go/grpc/grpc.go | 463 +++ .../protobuf/protoc-gen-go/link_grpc.go | 34 + .../golang/protobuf/protoc-gen-go/main.go | 98 + .../protoc-gen-go/plugin/plugin.pb.go | 293 ++ .../github.com/golang/protobuf/ptypes/any.go | 139 + .../golang/protobuf/ptypes/any/any.pb.go | 178 + .../github.com/golang/protobuf/ptypes/doc.go | 35 + .../golang/protobuf/ptypes/duration.go | 102 + .../protobuf/ptypes/duration/duration.pb.go | 144 + .../golang/protobuf/ptypes/empty/empty.pb.go | 66 + .../protobuf/ptypes/struct/struct.pb.go | 380 ++ .../golang/protobuf/ptypes/timestamp.go | 134 + .../protobuf/ptypes/timestamp/timestamp.pb.go | 160 + .../protobuf/ptypes/wrappers/wrappers.pb.go | 260 ++ .../golang_protobuf_extensions/ext/moved.go | 2 + .../pbtest/deleted.go | 2 + .../pbutil/decode.go | 75 + .../golang_protobuf_extensions/pbutil/doc.go | 16 + .../pbutil/encode.go | 46 + .../pmezard/go-difflib/difflib/difflib.go | 772 ++++ .../client_golang/api/prometheus/api.go | 345 ++ .../client_golang/examples/random/main.go | 103 + .../client_golang/examples/simple/main.go | 30 + .../client_golang/prometheus/collector.go | 75 + .../client_golang/prometheus/counter.go | 172 + .../client_golang/prometheus/desc.go | 205 + .../client_golang/prometheus/doc.go | 181 + .../prometheus/expvar_collector.go | 119 + .../client_golang/prometheus/fnv.go | 29 + .../client_golang/prometheus/gauge.go | 140 + .../client_golang/prometheus/go_collector.go | 263 ++ .../client_golang/prometheus/histogram.go | 444 +++ .../client_golang/prometheus/http.go | 490 +++ .../client_golang/prometheus/metric.go | 166 + .../prometheus/process_collector.go | 142 + .../client_golang/prometheus/promhttp/http.go | 201 + .../client_golang/prometheus/push/push.go | 172 + .../client_golang/prometheus/registry.go | 806 ++++ .../client_golang/prometheus/summary.go | 534 +++ .../client_golang/prometheus/untyped.go | 138 + .../client_golang/prometheus/value.go | 234 ++ .../client_golang/prometheus/vec.go | 404 ++ .../prometheus/client_model/cpp/metrics.pb.cc | 3380 +++++++++++++++++ .../prometheus/client_model/cpp/metrics.pb.h | 2072 ++++++++++ .../prometheus/client_model/go/metrics.pb.go | 364 ++ .../prometheus/common/config/config.go | 47 + .../prometheus/common/config/http_config.go | 279 ++ .../prometheus/common/expfmt/decode.go | 429 +++ .../prometheus/common/expfmt/encode.go | 88 + .../prometheus/common/expfmt/expfmt.go | 38 + .../prometheus/common/expfmt/fuzz.go | 36 + .../prometheus/common/expfmt/text_create.go | 303 ++ .../prometheus/common/expfmt/text_parse.go | 757 ++++ .../bitbucket.org/ww/goautoneg/autoneg.go | 162 + .../common/log/eventlog_formatter.go | 89 + .../github.com/prometheus/common/log/log.go | 359 ++ .../prometheus/common/log/syslog_formatter.go | 126 + .../prometheus/common/model/alert.go | 136 + .../prometheus/common/model/fingerprinting.go | 105 + .../github.com/prometheus/common/model/fnv.go | 42 + .../prometheus/common/model/labels.go | 210 + .../prometheus/common/model/labelset.go | 169 + .../prometheus/common/model/metric.go | 103 + .../prometheus/common/model/model.go | 16 + .../prometheus/common/model/signature.go | 144 + .../prometheus/common/model/silence.go | 106 + .../prometheus/common/model/time.go | 261 ++ .../prometheus/common/model/value.go | 416 ++ .../prometheus/common/promlog/flag/flag.go | 33 + .../prometheus/common/promlog/log.go | 63 + .../prometheus/common/route/route.go | 100 + .../prometheus/common/version/info.go | 89 + .../prometheus/procfs/bcache/bcache.go | 84 + .../prometheus/procfs/bcache/get.go | 330 ++ .../github.com/prometheus/procfs/buddyinfo.go | 95 + .../github.com/prometheus/procfs/doc.go | 45 + .../vendor/github.com/prometheus/procfs/fs.go | 46 + .../github.com/prometheus/procfs/ipvs.go | 246 ++ .../github.com/prometheus/procfs/mdstat.go | 138 + .../prometheus/procfs/mountstats.go | 556 +++ .../github.com/prometheus/procfs/proc.go | 224 ++ .../github.com/prometheus/procfs/proc_io.go | 55 + .../prometheus/procfs/proc_limits.go | 137 + .../github.com/prometheus/procfs/proc_stat.go | 175 + .../github.com/prometheus/procfs/stat.go | 219 ++ .../github.com/prometheus/procfs/sysfs/doc.go | 16 + .../github.com/prometheus/procfs/sysfs/fs.go | 108 + .../github.com/prometheus/procfs/xfrm.go | 187 + .../github.com/prometheus/procfs/xfs/parse.go | 359 ++ .../github.com/prometheus/procfs/xfs/xfs.go | 163 + .../github.com/sirupsen/logrus/alt_exit.go | 64 + .../vendor/github.com/sirupsen/logrus/doc.go | 26 + .../github.com/sirupsen/logrus/entry.go | 276 ++ .../github.com/sirupsen/logrus/exported.go | 193 + .../github.com/sirupsen/logrus/formatter.go | 45 + .../github.com/sirupsen/logrus/hooks.go | 34 + .../sirupsen/logrus/hooks/syslog/syslog.go | 55 + .../sirupsen/logrus/hooks/test/test.go | 95 + .../sirupsen/logrus/json_formatter.go | 79 + .../github.com/sirupsen/logrus/logger.go | 317 ++ .../github.com/sirupsen/logrus/logrus.go | 143 + .../sirupsen/logrus/terminal_bsd.go | 10 + .../sirupsen/logrus/terminal_linux.go | 14 + .../sirupsen/logrus/text_formatter.go | 191 + .../github.com/sirupsen/logrus/writer.go | 62 + .../testify/assert/assertion_forward.go | 387 ++ .../stretchr/testify/assert/assertions.go | 1052 +++++ .../github.com/stretchr/testify/assert/doc.go | 45 + .../stretchr/testify/assert/errors.go | 10 + .../testify/assert/forward_assertions.go | 16 + .../testify/assert/http_assertions.go | 106 + .../vendor/github.com/stretchr/testify/doc.go | 22 + .../github.com/stretchr/testify/http/doc.go | 2 + .../testify/http/test_response_writer.go | 49 + .../testify/http/test_round_tripper.go | 17 + .../github.com/stretchr/testify/mock/doc.go | 44 + .../github.com/stretchr/testify/mock/mock.go | 763 ++++ .../stretchr/testify/require/doc.go | 28 + .../testify/require/forward_requirements.go | 16 + .../stretchr/testify/require/require.go | 464 +++ .../testify/require/require_forward.go | 388 ++ .../stretchr/testify/require/requirements.go | 9 + .../github.com/stretchr/testify/suite/doc.go | 65 + .../stretchr/testify/suite/interfaces.go | 34 + .../stretchr/testify/suite/suite.go | 115 + .../vendor/golang.org/x/crypto/acme/acme.go | 1054 +++++ .../x/crypto/acme/autocert/autocert.go | 821 ++++ .../x/crypto/acme/autocert/cache.go | 130 + .../x/crypto/acme/autocert/listener.go | 160 + .../x/crypto/acme/autocert/renewal.go | 124 + .../vendor/golang.org/x/crypto/acme/jws.go | 153 + .../vendor/golang.org/x/crypto/acme/types.go | 329 ++ .../golang.org/x/crypto/bcrypt/base64.go | 35 + .../golang.org/x/crypto/bcrypt/bcrypt.go | 295 ++ .../golang.org/x/crypto/blake2b/blake2b.go | 207 + .../x/crypto/blake2b/blake2bAVX2_amd64.go | 43 + .../x/crypto/blake2b/blake2bAVX2_amd64.s | 762 ++++ .../x/crypto/blake2b/blake2b_amd64.go | 25 + .../x/crypto/blake2b/blake2b_amd64.s | 290 ++ .../x/crypto/blake2b/blake2b_generic.go | 179 + .../x/crypto/blake2b/blake2b_ref.go | 11 + .../golang.org/x/crypto/blake2b/blake2x.go | 177 + .../golang.org/x/crypto/blake2b/register.go | 32 + .../golang.org/x/crypto/blake2s/blake2s.go | 187 + .../x/crypto/blake2s/blake2s_386.go | 35 + .../golang.org/x/crypto/blake2s/blake2s_386.s | 460 +++ .../x/crypto/blake2s/blake2s_amd64.go | 40 + .../x/crypto/blake2s/blake2s_amd64.s | 463 +++ .../x/crypto/blake2s/blake2s_generic.go | 174 + .../x/crypto/blake2s/blake2s_ref.go | 17 + .../golang.org/x/crypto/blake2s/blake2x.go | 178 + .../golang.org/x/crypto/blake2s/register.go | 21 + .../golang.org/x/crypto/blowfish/block.go | 159 + .../golang.org/x/crypto/blowfish/cipher.go | 91 + .../golang.org/x/crypto/blowfish/const.go | 199 + .../vendor/golang.org/x/crypto/bn256/bn256.go | 404 ++ .../golang.org/x/crypto/bn256/constants.go | 44 + .../vendor/golang.org/x/crypto/bn256/curve.go | 278 ++ .../vendor/golang.org/x/crypto/bn256/gfp12.go | 200 + .../vendor/golang.org/x/crypto/bn256/gfp2.go | 219 ++ .../vendor/golang.org/x/crypto/bn256/gfp6.go | 296 ++ .../golang.org/x/crypto/bn256/optate.go | 395 ++ .../vendor/golang.org/x/crypto/bn256/twist.go | 249 ++ .../vendor/golang.org/x/crypto/cast5/cast5.go | 526 +++ .../chacha20poly1305/chacha20poly1305.go | 83 + .../chacha20poly1305_amd64.go | 127 + .../chacha20poly1305/chacha20poly1305_amd64.s | 2714 +++++++++++++ .../chacha20poly1305_generic.go | 70 + .../chacha20poly1305_noasm.go | 15 + .../internal/chacha20/chacha_generic.go | 198 + .../golang.org/x/crypto/cryptobyte/asn1.go | 732 ++++ .../x/crypto/cryptobyte/asn1/asn1.go | 46 + .../golang.org/x/crypto/cryptobyte/builder.go | 309 ++ .../golang.org/x/crypto/cryptobyte/string.go | 167 + .../x/crypto/curve25519/const_amd64.h | 8 + .../x/crypto/curve25519/const_amd64.s | 20 + .../x/crypto/curve25519/cswap_amd64.s | 65 + .../x/crypto/curve25519/curve25519.go | 834 ++++ .../golang.org/x/crypto/curve25519/doc.go | 23 + .../x/crypto/curve25519/freeze_amd64.s | 73 + .../x/crypto/curve25519/ladderstep_amd64.s | 1377 +++++++ .../x/crypto/curve25519/mont25519_amd64.go | 240 ++ .../x/crypto/curve25519/mul_amd64.s | 169 + .../x/crypto/curve25519/square_amd64.s | 132 + .../golang.org/x/crypto/ed25519/ed25519.go | 181 + .../ed25519/internal/edwards25519/const.go | 1422 +++++++ .../internal/edwards25519/edwards25519.go | 1771 +++++++++ .../vendor/golang.org/x/crypto/hkdf/hkdf.go | 75 + .../vendor/golang.org/x/crypto/md4/md4.go | 118 + .../golang.org/x/crypto/md4/md4block.go | 89 + .../golang.org/x/crypto/nacl/auth/auth.go | 58 + .../golang.org/x/crypto/nacl/box/box.go | 103 + .../x/crypto/nacl/secretbox/secretbox.go | 166 + .../vendor/golang.org/x/crypto/ocsp/ocsp.go | 778 ++++ .../x/crypto/openpgp/armor/armor.go | 219 ++ .../x/crypto/openpgp/armor/encode.go | 160 + .../x/crypto/openpgp/canonical_text.go | 59 + .../x/crypto/openpgp/clearsign/clearsign.go | 376 ++ .../x/crypto/openpgp/elgamal/elgamal.go | 122 + .../x/crypto/openpgp/errors/errors.go | 72 + .../golang.org/x/crypto/openpgp/keys.go | 637 ++++ .../x/crypto/openpgp/packet/compressed.go | 123 + .../x/crypto/openpgp/packet/config.go | 91 + .../x/crypto/openpgp/packet/encrypted_key.go | 199 + .../x/crypto/openpgp/packet/literal.go | 89 + .../x/crypto/openpgp/packet/ocfb.go | 143 + .../openpgp/packet/one_pass_signature.go | 73 + .../x/crypto/openpgp/packet/opaque.go | 162 + .../x/crypto/openpgp/packet/packet.go | 537 +++ .../x/crypto/openpgp/packet/private_key.go | 380 ++ .../x/crypto/openpgp/packet/public_key.go | 748 ++++ .../x/crypto/openpgp/packet/public_key_v3.go | 279 ++ .../x/crypto/openpgp/packet/reader.go | 76 + .../x/crypto/openpgp/packet/signature.go | 731 ++++ .../x/crypto/openpgp/packet/signature_v3.go | 146 + .../openpgp/packet/symmetric_key_encrypted.go | 155 + .../openpgp/packet/symmetrically_encrypted.go | 290 ++ .../x/crypto/openpgp/packet/userattribute.go | 91 + .../x/crypto/openpgp/packet/userid.go | 160 + .../golang.org/x/crypto/openpgp/read.go | 442 +++ .../golang.org/x/crypto/openpgp/s2k/s2k.go | 273 ++ .../golang.org/x/crypto/openpgp/write.go | 378 ++ .../x/crypto/otr/libotr_test_helper.c | 197 + .../vendor/golang.org/x/crypto/otr/otr.go | 1415 +++++++ .../vendor/golang.org/x/crypto/otr/smp.go | 572 +++ .../golang.org/x/crypto/pbkdf2/pbkdf2.go | 77 + .../golang.org/x/crypto/pkcs12/bmp-string.go | 50 + .../golang.org/x/crypto/pkcs12/crypto.go | 131 + .../golang.org/x/crypto/pkcs12/errors.go | 23 + .../x/crypto/pkcs12/internal/rc2/rc2.go | 274 ++ .../vendor/golang.org/x/crypto/pkcs12/mac.go | 45 + .../golang.org/x/crypto/pkcs12/pbkdf.go | 170 + .../golang.org/x/crypto/pkcs12/pkcs12.go | 346 ++ .../golang.org/x/crypto/pkcs12/safebags.go | 57 + .../golang.org/x/crypto/poly1305/poly1305.go | 33 + .../golang.org/x/crypto/poly1305/sum_amd64.go | 22 + .../golang.org/x/crypto/poly1305/sum_amd64.s | 125 + .../golang.org/x/crypto/poly1305/sum_arm.go | 22 + .../golang.org/x/crypto/poly1305/sum_arm.s | 427 +++ .../golang.org/x/crypto/poly1305/sum_ref.go | 141 + .../x/crypto/ripemd160/ripemd160.go | 120 + .../x/crypto/ripemd160/ripemd160block.go | 161 + .../x/crypto/salsa20/salsa/hsalsa20.go | 144 + .../x/crypto/salsa20/salsa/salsa2020_amd64.s | 889 +++++ .../x/crypto/salsa20/salsa/salsa208.go | 199 + .../x/crypto/salsa20/salsa/salsa20_amd64.go | 24 + .../x/crypto/salsa20/salsa/salsa20_ref.go | 234 ++ .../golang.org/x/crypto/salsa20/salsa20.go | 54 + .../golang.org/x/crypto/scrypt/scrypt.go | 244 ++ .../vendor/golang.org/x/crypto/sha3/doc.go | 66 + .../vendor/golang.org/x/crypto/sha3/hashes.go | 65 + .../golang.org/x/crypto/sha3/keccakf.go | 412 ++ .../golang.org/x/crypto/sha3/keccakf_amd64.go | 13 + .../golang.org/x/crypto/sha3/keccakf_amd64.s | 390 ++ .../golang.org/x/crypto/sha3/register.go | 18 + .../vendor/golang.org/x/crypto/sha3/sha3.go | 192 + .../vendor/golang.org/x/crypto/sha3/shake.go | 60 + .../vendor/golang.org/x/crypto/sha3/xor.go | 16 + .../golang.org/x/crypto/sha3/xor_generic.go | 28 + .../golang.org/x/crypto/sha3/xor_unaligned.go | 58 + .../golang.org/x/crypto/ssh/agent/client.go | 683 ++++ .../golang.org/x/crypto/ssh/agent/forward.go | 103 + .../golang.org/x/crypto/ssh/agent/keyring.go | 215 ++ .../golang.org/x/crypto/ssh/agent/server.go | 523 +++ .../vendor/golang.org/x/crypto/ssh/buffer.go | 97 + .../vendor/golang.org/x/crypto/ssh/certs.go | 519 +++ .../vendor/golang.org/x/crypto/ssh/channel.go | 633 +++ .../vendor/golang.org/x/crypto/ssh/cipher.go | 629 +++ .../vendor/golang.org/x/crypto/ssh/client.go | 257 ++ .../golang.org/x/crypto/ssh/client_auth.go | 486 +++ .../vendor/golang.org/x/crypto/ssh/common.go | 373 ++ .../golang.org/x/crypto/ssh/connection.go | 143 + .../vendor/golang.org/x/crypto/ssh/doc.go | 21 + .../golang.org/x/crypto/ssh/handshake.go | 640 ++++ .../vendor/golang.org/x/crypto/ssh/kex.go | 540 +++ .../vendor/golang.org/x/crypto/ssh/keys.go | 1031 +++++ .../x/crypto/ssh/knownhosts/knownhosts.go | 546 +++ .../vendor/golang.org/x/crypto/ssh/mac.go | 61 + .../golang.org/x/crypto/ssh/messages.go | 758 ++++ .../vendor/golang.org/x/crypto/ssh/mux.go | 330 ++ .../vendor/golang.org/x/crypto/ssh/server.go | 563 +++ .../vendor/golang.org/x/crypto/ssh/session.go | 647 ++++ .../golang.org/x/crypto/ssh/streamlocal.go | 115 + .../vendor/golang.org/x/crypto/ssh/tcpip.go | 465 +++ .../x/crypto/ssh/terminal/terminal.go | 951 +++++ .../golang.org/x/crypto/ssh/terminal/util.go | 123 + .../x/crypto/ssh/terminal/util_bsd.go | 12 + .../x/crypto/ssh/terminal/util_linux.go | 10 + .../x/crypto/ssh/terminal/util_plan9.go | 58 + .../x/crypto/ssh/terminal/util_solaris.go | 128 + .../x/crypto/ssh/terminal/util_windows.go | 102 + .../golang.org/x/crypto/ssh/test/doc.go | 7 + .../golang.org/x/crypto/ssh/transport.go | 375 ++ .../vendor/golang.org/x/crypto/tea/cipher.go | 109 + .../golang.org/x/crypto/twofish/twofish.go | 342 ++ .../vendor/golang.org/x/crypto/xtea/block.go | 66 + .../vendor/golang.org/x/crypto/xtea/cipher.go | 82 + .../vendor/golang.org/x/crypto/xts/xts.go | 137 + .../vendor/golang.org/x/sys/plan9/asm.s | 8 + .../golang.org/x/sys/plan9/asm_plan9_386.s | 30 + .../golang.org/x/sys/plan9/asm_plan9_amd64.s | 30 + .../golang.org/x/sys/plan9/const_plan9.go | 70 + .../golang.org/x/sys/plan9/dir_plan9.go | 212 ++ .../golang.org/x/sys/plan9/env_plan9.go | 27 + .../golang.org/x/sys/plan9/env_unset.go | 14 + .../golang.org/x/sys/plan9/errors_plan9.go | 50 + .../golang.org/x/sys/plan9/pwd_go15_plan9.go | 21 + .../golang.org/x/sys/plan9/pwd_plan9.go | 23 + .../vendor/golang.org/x/sys/plan9/race.go | 30 + .../vendor/golang.org/x/sys/plan9/race0.go | 25 + .../vendor/golang.org/x/sys/plan9/str.go | 22 + .../vendor/golang.org/x/sys/plan9/syscall.go | 74 + .../golang.org/x/sys/plan9/syscall_plan9.go | 349 ++ .../x/sys/plan9/zsyscall_plan9_386.go | 292 ++ .../x/sys/plan9/zsyscall_plan9_amd64.go | 292 ++ .../golang.org/x/sys/plan9/zsysnum_plan9.go | 49 + .../golang.org/x/sys/unix/asm_darwin_386.s | 29 + .../golang.org/x/sys/unix/asm_darwin_amd64.s | 29 + .../golang.org/x/sys/unix/asm_darwin_arm.s | 30 + .../golang.org/x/sys/unix/asm_darwin_arm64.s | 30 + .../x/sys/unix/asm_dragonfly_amd64.s | 29 + .../golang.org/x/sys/unix/asm_freebsd_386.s | 29 + .../golang.org/x/sys/unix/asm_freebsd_amd64.s | 29 + .../golang.org/x/sys/unix/asm_freebsd_arm.s | 29 + .../golang.org/x/sys/unix/asm_linux_386.s | 35 + .../golang.org/x/sys/unix/asm_linux_amd64.s | 29 + .../golang.org/x/sys/unix/asm_linux_arm.s | 29 + .../golang.org/x/sys/unix/asm_linux_arm64.s | 24 + .../golang.org/x/sys/unix/asm_linux_mips64x.s | 28 + .../golang.org/x/sys/unix/asm_linux_mipsx.s | 31 + .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 28 + .../golang.org/x/sys/unix/asm_linux_s390x.s | 28 + .../golang.org/x/sys/unix/asm_netbsd_386.s | 29 + .../golang.org/x/sys/unix/asm_netbsd_amd64.s | 29 + .../golang.org/x/sys/unix/asm_netbsd_arm.s | 29 + .../golang.org/x/sys/unix/asm_openbsd_386.s | 29 + .../golang.org/x/sys/unix/asm_openbsd_amd64.s | 29 + .../golang.org/x/sys/unix/asm_openbsd_arm.s | 29 + .../golang.org/x/sys/unix/asm_solaris_amd64.s | 17 + .../golang.org/x/sys/unix/bluetooth_linux.go | 35 + .../golang.org/x/sys/unix/cap_freebsd.go | 195 + .../vendor/golang.org/x/sys/unix/constants.go | 13 + .../golang.org/x/sys/unix/dev_darwin.go | 24 + .../golang.org/x/sys/unix/dev_dragonfly.go | 30 + .../golang.org/x/sys/unix/dev_freebsd.go | 30 + .../vendor/golang.org/x/sys/unix/dev_linux.go | 42 + .../golang.org/x/sys/unix/dev_netbsd.go | 29 + .../golang.org/x/sys/unix/dev_openbsd.go | 29 + .../vendor/golang.org/x/sys/unix/dirent.go | 102 + .../golang.org/x/sys/unix/endian_big.go | 9 + .../golang.org/x/sys/unix/endian_little.go | 9 + .../vendor/golang.org/x/sys/unix/env_unix.go | 27 + .../vendor/golang.org/x/sys/unix/env_unset.go | 14 + .../x/sys/unix/errors_freebsd_386.go | 227 ++ .../x/sys/unix/errors_freebsd_amd64.go | 227 ++ .../x/sys/unix/errors_freebsd_arm.go | 226 ++ .../vendor/golang.org/x/sys/unix/file_unix.go | 27 + .../vendor/golang.org/x/sys/unix/flock.go | 22 + .../x/sys/unix/flock_linux_32bit.go | 13 + .../vendor/golang.org/x/sys/unix/gccgo.go | 46 + .../vendor/golang.org/x/sys/unix/gccgo_c.c | 41 + .../x/sys/unix/gccgo_linux_amd64.go | 20 + .../golang.org/x/sys/unix/linux/mkall.go | 379 ++ .../golang.org/x/sys/unix/linux/types.go | 595 +++ .../vendor/golang.org/x/sys/unix/mkpost.go | 88 + .../golang.org/x/sys/unix/openbsd_pledge.go | 38 + .../golang.org/x/sys/unix/pagesize_unix.go | 15 + .../vendor/golang.org/x/sys/unix/race.go | 30 + .../vendor/golang.org/x/sys/unix/race0.go | 25 + .../golang.org/x/sys/unix/sockcmsg_linux.go | 36 + .../golang.org/x/sys/unix/sockcmsg_unix.go | 104 + .../vendor/golang.org/x/sys/unix/str.go | 26 + .../vendor/golang.org/x/sys/unix/syscall.go | 69 + .../golang.org/x/sys/unix/syscall_bsd.go | 635 ++++ .../golang.org/x/sys/unix/syscall_darwin.go | 536 +++ .../x/sys/unix/syscall_darwin_386.go | 75 + .../x/sys/unix/syscall_darwin_amd64.go | 75 + .../x/sys/unix/syscall_darwin_arm.go | 69 + .../x/sys/unix/syscall_darwin_arm64.go | 75 + .../x/sys/unix/syscall_dragonfly.go | 415 ++ .../x/sys/unix/syscall_dragonfly_amd64.go | 59 + .../golang.org/x/sys/unix/syscall_freebsd.go | 708 ++++ .../x/sys/unix/syscall_freebsd_386.go | 59 + .../x/sys/unix/syscall_freebsd_amd64.go | 59 + .../x/sys/unix/syscall_freebsd_arm.go | 59 + .../golang.org/x/sys/unix/syscall_linux.go | 1469 +++++++ .../x/sys/unix/syscall_linux_386.go | 397 ++ .../x/sys/unix/syscall_linux_amd64.go | 150 + .../x/sys/unix/syscall_linux_amd64_gc.go | 13 + .../x/sys/unix/syscall_linux_arm.go | 261 ++ .../x/sys/unix/syscall_linux_arm64.go | 188 + .../x/sys/unix/syscall_linux_mips64x.go | 207 + .../x/sys/unix/syscall_linux_mipsx.go | 237 ++ .../x/sys/unix/syscall_linux_ppc64x.go | 133 + .../x/sys/unix/syscall_linux_s390x.go | 326 ++ .../x/sys/unix/syscall_linux_sparc64.go | 149 + .../golang.org/x/sys/unix/syscall_netbsd.go | 472 +++ .../x/sys/unix/syscall_netbsd_386.go | 40 + .../x/sys/unix/syscall_netbsd_amd64.go | 40 + .../x/sys/unix/syscall_netbsd_arm.go | 40 + .../golang.org/x/sys/unix/syscall_no_getwd.go | 11 + .../golang.org/x/sys/unix/syscall_openbsd.go | 282 ++ .../x/sys/unix/syscall_openbsd_386.go | 40 + .../x/sys/unix/syscall_openbsd_amd64.go | 40 + .../x/sys/unix/syscall_openbsd_arm.go | 40 + .../golang.org/x/sys/unix/syscall_solaris.go | 719 ++++ .../x/sys/unix/syscall_solaris_amd64.go | 35 + .../golang.org/x/sys/unix/syscall_unix.go | 293 ++ .../golang.org/x/sys/unix/syscall_unix_gc.go | 15 + .../golang.org/x/sys/unix/types_darwin.go | 254 ++ .../golang.org/x/sys/unix/types_dragonfly.go | 249 ++ .../golang.org/x/sys/unix/types_freebsd.go | 372 ++ .../golang.org/x/sys/unix/types_netbsd.go | 239 ++ .../golang.org/x/sys/unix/types_openbsd.go | 251 ++ .../golang.org/x/sys/unix/types_solaris.go | 265 ++ .../x/sys/unix/zerrors_darwin_386.go | 1673 ++++++++ .../x/sys/unix/zerrors_darwin_amd64.go | 1673 ++++++++ .../x/sys/unix/zerrors_darwin_arm.go | 1673 ++++++++ .../x/sys/unix/zerrors_darwin_arm64.go | 1673 ++++++++ .../x/sys/unix/zerrors_dragonfly_amd64.go | 1568 ++++++++ .../x/sys/unix/zerrors_freebsd_386.go | 1706 +++++++++ .../x/sys/unix/zerrors_freebsd_amd64.go | 1707 +++++++++ .../x/sys/unix/zerrors_freebsd_arm.go | 1715 +++++++++ .../x/sys/unix/zerrors_linux_386.go | 2231 +++++++++++ .../x/sys/unix/zerrors_linux_amd64.go | 2232 +++++++++++ .../x/sys/unix/zerrors_linux_arm.go | 2236 +++++++++++ .../x/sys/unix/zerrors_linux_arm64.go | 2222 +++++++++++ .../x/sys/unix/zerrors_linux_mips.go | 2241 +++++++++++ .../x/sys/unix/zerrors_linux_mips64.go | 2241 +++++++++++ .../x/sys/unix/zerrors_linux_mips64le.go | 2241 +++++++++++ .../x/sys/unix/zerrors_linux_mipsle.go | 2241 +++++++++++ .../x/sys/unix/zerrors_linux_ppc64.go | 2294 +++++++++++ .../x/sys/unix/zerrors_linux_ppc64le.go | 2294 +++++++++++ .../x/sys/unix/zerrors_linux_s390x.go | 2293 +++++++++++ .../x/sys/unix/zerrors_linux_sparc64.go | 2142 +++++++++++ .../x/sys/unix/zerrors_netbsd_386.go | 1712 +++++++++ .../x/sys/unix/zerrors_netbsd_amd64.go | 1702 +++++++++ .../x/sys/unix/zerrors_netbsd_arm.go | 1691 +++++++++ .../x/sys/unix/zerrors_openbsd_386.go | 1584 ++++++++ .../x/sys/unix/zerrors_openbsd_amd64.go | 1583 ++++++++ .../x/sys/unix/zerrors_openbsd_arm.go | 1586 ++++++++ .../x/sys/unix/zerrors_solaris_amd64.go | 1489 ++++++++ .../x/sys/unix/zsyscall_darwin_386.go | 1609 ++++++++ .../x/sys/unix/zsyscall_darwin_amd64.go | 1609 ++++++++ .../x/sys/unix/zsyscall_darwin_arm.go | 1609 ++++++++ .../x/sys/unix/zsyscall_darwin_arm64.go | 1609 ++++++++ .../x/sys/unix/zsyscall_dragonfly_amd64.go | 1440 +++++++ .../x/sys/unix/zsyscall_freebsd_386.go | 1877 +++++++++ .../x/sys/unix/zsyscall_freebsd_amd64.go | 1877 +++++++++ .../x/sys/unix/zsyscall_freebsd_arm.go | 1877 +++++++++ .../x/sys/unix/zsyscall_linux_386.go | 1953 ++++++++++ .../x/sys/unix/zsyscall_linux_amd64.go | 2146 +++++++++++ .../x/sys/unix/zsyscall_linux_arm.go | 2055 ++++++++++ .../x/sys/unix/zsyscall_linux_arm64.go | 2029 ++++++++++ .../x/sys/unix/zsyscall_linux_mips.go | 2111 ++++++++++ .../x/sys/unix/zsyscall_linux_mips64.go | 2105 ++++++++++ .../x/sys/unix/zsyscall_linux_mips64le.go | 2105 ++++++++++ .../x/sys/unix/zsyscall_linux_mipsle.go | 2111 ++++++++++ .../x/sys/unix/zsyscall_linux_ppc64.go | 2157 +++++++++++ .../x/sys/unix/zsyscall_linux_ppc64le.go | 2157 +++++++++++ .../x/sys/unix/zsyscall_linux_s390x.go | 1937 ++++++++++ .../x/sys/unix/zsyscall_linux_sparc64.go | 1833 +++++++++ .../x/sys/unix/zsyscall_netbsd_386.go | 1346 +++++++ .../x/sys/unix/zsyscall_netbsd_amd64.go | 1346 +++++++ .../x/sys/unix/zsyscall_netbsd_arm.go | 1346 +++++++ .../x/sys/unix/zsyscall_openbsd_386.go | 1404 +++++++ .../x/sys/unix/zsyscall_openbsd_amd64.go | 1404 +++++++ .../x/sys/unix/zsyscall_openbsd_arm.go | 1404 +++++++ .../x/sys/unix/zsyscall_solaris_amd64.go | 1630 ++++++++ .../golang.org/x/sys/unix/zsysctl_openbsd.go | 270 ++ .../x/sys/unix/zsysnum_darwin_386.go | 398 ++ .../x/sys/unix/zsysnum_darwin_amd64.go | 398 ++ .../x/sys/unix/zsysnum_darwin_arm.go | 426 +++ .../x/sys/unix/zsysnum_darwin_arm64.go | 426 +++ .../x/sys/unix/zsysnum_dragonfly_amd64.go | 315 ++ .../x/sys/unix/zsysnum_freebsd_386.go | 353 ++ .../x/sys/unix/zsysnum_freebsd_amd64.go | 353 ++ .../x/sys/unix/zsysnum_freebsd_arm.go | 353 ++ .../x/sys/unix/zsysnum_linux_386.go | 390 ++ .../x/sys/unix/zsysnum_linux_amd64.go | 342 ++ .../x/sys/unix/zsysnum_linux_arm.go | 362 ++ .../x/sys/unix/zsysnum_linux_arm64.go | 286 ++ .../x/sys/unix/zsysnum_linux_mips.go | 375 ++ .../x/sys/unix/zsysnum_linux_mips64.go | 335 ++ .../x/sys/unix/zsysnum_linux_mips64le.go | 335 ++ .../x/sys/unix/zsysnum_linux_mipsle.go | 375 ++ .../x/sys/unix/zsysnum_linux_ppc64.go | 370 ++ .../x/sys/unix/zsysnum_linux_ppc64le.go | 370 ++ .../x/sys/unix/zsysnum_linux_s390x.go | 333 ++ .../x/sys/unix/zsysnum_linux_sparc64.go | 348 ++ .../x/sys/unix/zsysnum_netbsd_386.go | 274 ++ .../x/sys/unix/zsysnum_netbsd_amd64.go | 274 ++ .../x/sys/unix/zsysnum_netbsd_arm.go | 274 ++ .../x/sys/unix/zsysnum_openbsd_386.go | 207 + .../x/sys/unix/zsysnum_openbsd_amd64.go | 207 + .../x/sys/unix/zsysnum_openbsd_arm.go | 213 ++ .../x/sys/unix/zsysnum_solaris_amd64.go | 13 + .../x/sys/unix/ztypes_darwin_386.go | 462 +++ .../x/sys/unix/ztypes_darwin_amd64.go | 472 +++ .../x/sys/unix/ztypes_darwin_arm.go | 463 +++ .../x/sys/unix/ztypes_darwin_arm64.go | 471 +++ .../x/sys/unix/ztypes_dragonfly_amd64.go | 448 +++ .../x/sys/unix/ztypes_freebsd_386.go | 521 +++ .../x/sys/unix/ztypes_freebsd_amd64.go | 524 +++ .../x/sys/unix/ztypes_freebsd_arm.go | 524 +++ .../golang.org/x/sys/unix/ztypes_linux_386.go | 793 ++++ .../x/sys/unix/ztypes_linux_amd64.go | 811 ++++ .../golang.org/x/sys/unix/ztypes_linux_arm.go | 782 ++++ .../x/sys/unix/ztypes_linux_arm64.go | 790 ++++ .../x/sys/unix/ztypes_linux_mips.go | 787 ++++ .../x/sys/unix/ztypes_linux_mips64.go | 792 ++++ .../x/sys/unix/ztypes_linux_mips64le.go | 792 ++++ .../x/sys/unix/ztypes_linux_mipsle.go | 787 ++++ .../x/sys/unix/ztypes_linux_ppc64.go | 800 ++++ .../x/sys/unix/ztypes_linux_ppc64le.go | 800 ++++ .../x/sys/unix/ztypes_linux_s390x.go | 817 ++++ .../x/sys/unix/ztypes_linux_sparc64.go | 666 ++++ .../x/sys/unix/ztypes_netbsd_386.go | 401 ++ .../x/sys/unix/ztypes_netbsd_amd64.go | 408 ++ .../x/sys/unix/ztypes_netbsd_arm.go | 406 ++ .../x/sys/unix/ztypes_openbsd_386.go | 446 +++ .../x/sys/unix/ztypes_openbsd_amd64.go | 453 +++ .../x/sys/unix/ztypes_openbsd_arm.go | 439 +++ .../x/sys/unix/ztypes_solaris_amd64.go | 440 +++ .../x/sys/windows/asm_windows_386.s | 13 + .../x/sys/windows/asm_windows_amd64.s | 13 + .../golang.org/x/sys/windows/dll_windows.go | 377 ++ .../golang.org/x/sys/windows/env_unset.go | 15 + .../golang.org/x/sys/windows/env_windows.go | 25 + .../golang.org/x/sys/windows/eventlog.go | 20 + .../golang.org/x/sys/windows/exec_windows.go | 97 + .../x/sys/windows/memory_windows.go | 26 + .../golang.org/x/sys/windows/mksyscall.go | 7 + .../vendor/golang.org/x/sys/windows/race.go | 30 + .../vendor/golang.org/x/sys/windows/race0.go | 25 + .../golang.org/x/sys/windows/registry/key.go | 200 + .../x/sys/windows/registry/mksyscall.go | 7 + .../x/sys/windows/registry/syscall.go | 32 + .../x/sys/windows/registry/value.go | 384 ++ .../sys/windows/registry/zsyscall_windows.go | 120 + .../x/sys/windows/security_windows.go | 435 +++ .../golang.org/x/sys/windows/service.go | 164 + .../vendor/golang.org/x/sys/windows/str.go | 22 + .../golang.org/x/sys/windows/svc/debug/log.go | 56 + .../x/sys/windows/svc/debug/service.go | 45 + .../golang.org/x/sys/windows/svc/event.go | 48 + .../x/sys/windows/svc/eventlog/install.go | 80 + .../x/sys/windows/svc/eventlog/log.go | 70 + .../x/sys/windows/svc/example/beep.go | 22 + .../x/sys/windows/svc/example/install.go | 92 + .../x/sys/windows/svc/example/main.go | 76 + .../x/sys/windows/svc/example/manage.go | 62 + .../x/sys/windows/svc/example/service.go | 82 + .../golang.org/x/sys/windows/svc/go12.c | 24 + .../golang.org/x/sys/windows/svc/go12.go | 11 + .../golang.org/x/sys/windows/svc/go13.go | 31 + .../x/sys/windows/svc/mgr/config.go | 139 + .../golang.org/x/sys/windows/svc/mgr/mgr.go | 162 + .../x/sys/windows/svc/mgr/service.go | 72 + .../golang.org/x/sys/windows/svc/security.go | 62 + .../golang.org/x/sys/windows/svc/service.go | 363 ++ .../golang.org/x/sys/windows/svc/sys_386.s | 68 + .../golang.org/x/sys/windows/svc/sys_amd64.s | 42 + .../golang.org/x/sys/windows/syscall.go | 71 + .../x/sys/windows/syscall_windows.go | 1009 +++++ .../golang.org/x/sys/windows/types_windows.go | 1282 +++++++ .../x/sys/windows/types_windows_386.go | 22 + .../x/sys/windows/types_windows_amd64.go | 22 + .../x/sys/windows/zsyscall_windows.go | 2428 ++++++++++++ vendor/gopkg.in/alecthomas/kingpin.v2/COPYING | 19 + .../gopkg.in/alecthomas/kingpin.v2/actions.go | 42 + vendor/gopkg.in/alecthomas/kingpin.v2/app.go | 685 ++++ vendor/gopkg.in/alecthomas/kingpin.v2/args.go | 184 + vendor/gopkg.in/alecthomas/kingpin.v2/cmd.go | 274 ++ .../kingpin.v2/cmd/genvalues/main.go | 134 + .../alecthomas/kingpin.v2/completions.go | 33 + vendor/gopkg.in/alecthomas/kingpin.v2/doc.go | 68 + .../gopkg.in/alecthomas/kingpin.v2/envar.go | 45 + .../gopkg.in/alecthomas/kingpin.v2/flags.go | 308 ++ .../gopkg.in/alecthomas/kingpin.v2/global.go | 94 + .../alecthomas/kingpin.v2/guesswidth.go | 9 + .../alecthomas/kingpin.v2/guesswidth_unix.go | 38 + .../gopkg.in/alecthomas/kingpin.v2/model.go | 227 ++ .../gopkg.in/alecthomas/kingpin.v2/parser.go | 382 ++ .../gopkg.in/alecthomas/kingpin.v2/parsers.go | 212 ++ .../alecthomas/kingpin.v2/templates.go | 262 ++ .../gopkg.in/alecthomas/kingpin.v2/usage.go | 211 + .../gopkg.in/alecthomas/kingpin.v2/values.go | 470 +++ .../alecthomas/kingpin.v2/values_generated.go | 821 ++++ vendor/manifest | 89 + 689 files changed, 262301 insertions(+) create mode 100644 vendor/github.com/alecthomas/template/LICENSE create mode 100644 vendor/github.com/alecthomas/template/doc.go create mode 100644 vendor/github.com/alecthomas/template/exec.go create mode 100644 vendor/github.com/alecthomas/template/funcs.go create mode 100644 vendor/github.com/alecthomas/template/helper.go create mode 100644 vendor/github.com/alecthomas/template/parse/lex.go create mode 100644 vendor/github.com/alecthomas/template/parse/node.go create mode 100644 vendor/github.com/alecthomas/template/parse/parse.go create mode 100644 vendor/github.com/alecthomas/template/template.go create mode 100644 vendor/github.com/alecthomas/units/COPYING create mode 100644 vendor/github.com/alecthomas/units/bytes.go create mode 100644 vendor/github.com/alecthomas/units/doc.go create mode 100644 vendor/github.com/alecthomas/units/si.go create mode 100644 vendor/github.com/alecthomas/units/util.go create mode 100644 vendor/github.com/go-kit/kit/log/LICENSE create mode 100644 vendor/github.com/go-kit/kit/log/deprecated_levels/levels.go create mode 100644 vendor/github.com/go-kit/kit/log/doc.go create mode 100644 vendor/github.com/go-kit/kit/log/json_logger.go create mode 100644 vendor/github.com/go-kit/kit/log/level/doc.go create mode 100644 vendor/github.com/go-kit/kit/log/level/level.go create mode 100644 vendor/github.com/go-kit/kit/log/log.go create mode 100644 vendor/github.com/go-kit/kit/log/logfmt_logger.go create mode 100644 vendor/github.com/go-kit/kit/log/nop_logger.go create mode 100644 vendor/github.com/go-kit/kit/log/stdlib.go create mode 100644 vendor/github.com/go-kit/kit/log/sync.go create mode 100644 vendor/github.com/go-kit/kit/log/term/colorlogger.go create mode 100644 vendor/github.com/go-kit/kit/log/term/colorwriter_others.go create mode 100644 vendor/github.com/go-kit/kit/log/term/colorwriter_windows.go create mode 100644 vendor/github.com/go-kit/kit/log/term/term.go create mode 100644 vendor/github.com/go-kit/kit/log/term/terminal_appengine.go create mode 100644 vendor/github.com/go-kit/kit/log/term/terminal_darwin.go create mode 100644 vendor/github.com/go-kit/kit/log/term/terminal_freebsd.go create mode 100644 vendor/github.com/go-kit/kit/log/term/terminal_linux.go create mode 100644 vendor/github.com/go-kit/kit/log/term/terminal_notwindows.go create mode 100644 vendor/github.com/go-kit/kit/log/term/terminal_openbsd.go create mode 100644 vendor/github.com/go-kit/kit/log/term/terminal_windows.go create mode 100644 vendor/github.com/go-kit/kit/log/value.go create mode 100644 vendor/github.com/go-logfmt/logfmt/LICENSE create mode 100644 vendor/github.com/go-logfmt/logfmt/decode.go create mode 100644 vendor/github.com/go-logfmt/logfmt/doc.go create mode 100644 vendor/github.com/go-logfmt/logfmt/encode.go create mode 100644 vendor/github.com/go-logfmt/logfmt/fuzz.go create mode 100644 vendor/github.com/go-logfmt/logfmt/jsonstring.go create mode 100644 vendor/github.com/go-stack/stack/LICENSE.md create mode 100644 vendor/github.com/go-stack/stack/stack.go create mode 100644 vendor/github.com/julienschmidt/httprouter/LICENSE create mode 100644 vendor/github.com/julienschmidt/httprouter/path.go create mode 100644 vendor/github.com/julienschmidt/httprouter/router.go create mode 100644 vendor/github.com/julienschmidt/httprouter/tree.go create mode 100644 vendor/github.com/kr/logfmt/decode.go create mode 100644 vendor/github.com/kr/logfmt/scanner.go create mode 100644 vendor/github.com/kr/logfmt/unquote.go create mode 100644 vendor/github.com/pkg/errors/LICENSE create mode 100644 vendor/github.com/pkg/errors/errors.go create mode 100644 vendor/github.com/pkg/errors/stack.go create mode 100644 vendor/github.com/stretchr/objx/LICENSE.md create mode 100644 vendor/github.com/stretchr/objx/accessors.go create mode 100644 vendor/github.com/stretchr/objx/constants.go create mode 100644 vendor/github.com/stretchr/objx/conversions.go create mode 100644 vendor/github.com/stretchr/objx/doc.go create mode 100644 vendor/github.com/stretchr/objx/map.go create mode 100644 vendor/github.com/stretchr/objx/mutations.go create mode 100644 vendor/github.com/stretchr/objx/security.go create mode 100644 vendor/github.com/stretchr/objx/tests.go create mode 100644 vendor/github.com/stretchr/objx/type_specific_codegen.go create mode 100644 vendor/github.com/stretchr/objx/value.go create mode 100644 vendor/github.com/weaveworks/promrus/LICENSE create mode 100644 vendor/github.com/weaveworks/promrus/promrus.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/beorn7/perks/histogram/histogram.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/beorn7/perks/quantile/stream.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/beorn7/perks/topk/topk.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/davecgh/go-spew/spew/bypass.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/davecgh/go-spew/spew/common.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/davecgh/go-spew/spew/config.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/davecgh/go-spew/spew/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/davecgh/go-spew/spew/dump.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/davecgh/go-spew/spew/format.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/davecgh/go-spew/spew/spew.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/descriptor/descriptor.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.pb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.pb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/proto/clone.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/proto/decode.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/proto/encode.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/proto/equal.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/proto/extensions.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/proto/lib.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/proto/message_set.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/proto/pointer_reflect.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/proto/properties.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/proto/text.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/proto/text_parser.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/protoc-gen-go/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/protoc-gen-go/grpc/grpc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/protoc-gen-go/link_grpc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/protoc-gen-go/main.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/ptypes/any.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/ptypes/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/ptypes/duration.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/ptypes/timestamp.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/matttproud/golang_protobuf_extensions/ext/moved.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/matttproud/golang_protobuf_extensions/pbtest/deleted.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/pmezard/go-difflib/difflib/difflib.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/api/prometheus/api.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/examples/random/main.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/examples/simple/main.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/collector.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/counter.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/desc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/fnv.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/gauge.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/histogram.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/http.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/metric.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/push/push.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/registry.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/summary.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/untyped.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/value.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_golang/prometheus/vec.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_model/cpp/metrics.pb.cc create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_model/cpp/metrics.pb.h create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/client_model/go/metrics.pb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/config/config.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/config/http_config.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/expfmt/decode.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/expfmt/encode.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/expfmt/expfmt.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/expfmt/fuzz.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/expfmt/text_create.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/expfmt/text_parse.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/log/eventlog_formatter.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/log/log.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/log/syslog_formatter.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/model/alert.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/model/fingerprinting.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/model/fnv.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/model/labels.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/model/labelset.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/model/metric.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/model/model.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/model/signature.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/model/silence.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/model/time.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/model/value.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/promlog/flag/flag.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/promlog/log.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/route/route.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/common/version/info.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/bcache/bcache.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/bcache/get.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/buddyinfo.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/fs.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/ipvs.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/mdstat.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/mountstats.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/proc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/proc_io.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/proc_limits.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/proc_stat.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/stat.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/sysfs/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/sysfs/fs.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/xfrm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/xfs/parse.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/prometheus/procfs/xfs/xfs.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/alt_exit.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/entry.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/exported.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/formatter.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/hooks.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/hooks/syslog/syslog.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/hooks/test/test.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/json_formatter.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/logger.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/logrus.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/terminal_bsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/terminal_linux.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/text_formatter.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/sirupsen/logrus/writer.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/assert/assertion_forward.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/assert/assertions.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/assert/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/assert/errors.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/assert/forward_assertions.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/assert/http_assertions.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/http/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/http/test_response_writer.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/http/test_round_tripper.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/mock/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/mock/mock.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/require/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/require/forward_requirements.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/require/require.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/require/require_forward.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/require/requirements.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/suite/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/suite/interfaces.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/github.com/stretchr/testify/suite/suite.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/acme/acme.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/acme/autocert/autocert.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/acme/autocert/cache.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/acme/autocert/listener.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/acme/autocert/renewal.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/acme/jws.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/acme/types.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/bcrypt/base64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/bcrypt/bcrypt.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2b/blake2b.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2b/blake2b_generic.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2b/blake2b_ref.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2b/blake2x.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2b/register.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2s/blake2s.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2s/blake2s_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2s/blake2s_386.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2s/blake2s_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2s/blake2s_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2s/blake2s_generic.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2s/blake2s_ref.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2s/blake2x.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blake2s/register.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blowfish/block.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blowfish/cipher.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/blowfish/const.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/bn256/bn256.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/bn256/constants.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/bn256/curve.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/bn256/gfp12.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/bn256/gfp2.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/bn256/gfp6.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/bn256/optate.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/bn256/twist.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/cast5/cast5.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_generic.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_noasm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/chacha20poly1305/internal/chacha20/chacha_generic.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/cryptobyte/asn1.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/cryptobyte/asn1/asn1.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/cryptobyte/builder.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/cryptobyte/string.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/curve25519/const_amd64.h create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/curve25519/const_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/curve25519/cswap_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/curve25519/curve25519.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/curve25519/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/curve25519/freeze_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/curve25519/mont25519_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/curve25519/mul_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/curve25519/square_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ed25519/ed25519.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/const.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/hkdf/hkdf.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/md4/md4.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/md4/md4block.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/nacl/auth/auth.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/nacl/box/box.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/nacl/secretbox/secretbox.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ocsp/ocsp.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/armor/armor.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/armor/encode.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/canonical_text.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/clearsign/clearsign.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/errors/errors.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/keys.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/compressed.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/config.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/encrypted_key.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/literal.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/ocfb.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/one_pass_signature.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/opaque.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/packet.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/private_key.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/public_key.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/public_key_v3.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/reader.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/signature.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/signature_v3.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/userattribute.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/packet/userid.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/read.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/s2k/s2k.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/openpgp/write.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/otr/libotr_test_helper.c create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/otr/otr.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/otr/smp.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/pkcs12/bmp-string.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/pkcs12/crypto.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/pkcs12/errors.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/pkcs12/internal/rc2/rc2.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/pkcs12/mac.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/pkcs12/pbkdf.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/pkcs12/pkcs12.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/pkcs12/safebags.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/poly1305/poly1305.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/poly1305/sum_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/poly1305/sum_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/poly1305/sum_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/poly1305/sum_arm.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/poly1305/sum_ref.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ripemd160/ripemd160.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ripemd160/ripemd160block.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/salsa20/salsa/salsa2020_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/salsa20/salsa/salsa208.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_ref.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/salsa20/salsa20.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/scrypt/scrypt.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/sha3/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/sha3/hashes.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/sha3/keccakf.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/sha3/keccakf_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/sha3/keccakf_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/sha3/register.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/sha3/sha3.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/sha3/shake.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/sha3/xor.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/sha3/xor_generic.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/sha3/xor_unaligned.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/agent/client.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/agent/forward.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/agent/keyring.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/agent/server.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/buffer.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/certs.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/channel.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/cipher.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/client.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/client_auth.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/common.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/connection.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/handshake.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/kex.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/keys.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/mac.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/messages.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/mux.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/server.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/session.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/streamlocal.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/tcpip.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/terminal/terminal.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/terminal/util.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/terminal/util_linux.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/terminal/util_plan9.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/test/doc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/ssh/transport.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/tea/cipher.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/twofish/twofish.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/xtea/block.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/xtea/cipher.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/crypto/xts/xts.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/asm.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/asm_plan9_386.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/asm_plan9_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/const_plan9.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/dir_plan9.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/env_plan9.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/env_unset.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/errors_plan9.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/pwd_plan9.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/race.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/race0.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/str.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/syscall.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/syscall_plan9.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/plan9/zsysnum_plan9.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_darwin_386.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_darwin_arm.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_freebsd_386.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_linux_386.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_linux_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_linux_arm.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_linux_arm64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_linux_s390x.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_netbsd_386.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_openbsd_386.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/bluetooth_linux.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/cap_freebsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/constants.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/dev_darwin.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/dev_dragonfly.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/dev_freebsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/dev_linux.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/dev_netbsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/dev_openbsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/dirent.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/endian_big.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/endian_little.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/env_unix.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/env_unset.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/errors_freebsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/file_unix.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/flock.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/flock_linux_32bit.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/gccgo.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/gccgo_c.c create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/linux/mkall.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/linux/types.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/mkpost.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/openbsd_pledge.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/pagesize_unix.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/race.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/race0.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/sockcmsg_linux.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/sockcmsg_unix.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/str.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_bsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_darwin.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_darwin_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_dragonfly.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_freebsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_linux.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_linux_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_linux_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_netbsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_no_getwd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_openbsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_solaris.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_unix.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/syscall_unix_gc.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/types_darwin.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/types_dragonfly.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/types_freebsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/types_netbsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/types_openbsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/types_solaris.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_linux_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysctl_openbsd.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_linux_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/asm_windows_386.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/asm_windows_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/dll_windows.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/env_unset.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/env_windows.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/eventlog.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/exec_windows.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/memory_windows.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/mksyscall.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/race.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/race0.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/registry/key.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/registry/mksyscall.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/registry/syscall.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/registry/value.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/security_windows.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/service.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/str.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/debug/log.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/debug/service.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/event.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/eventlog/install.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/eventlog/log.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/example/beep.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/example/install.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/example/main.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/example/manage.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/example/service.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/go12.c create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/go12.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/go13.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/mgr/config.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/mgr/mgr.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/mgr/service.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/security.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/service.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/sys_386.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/svc/sys_amd64.s create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/syscall.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/syscall_windows.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/types_windows.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/types_windows_386.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/types_windows_amd64.go create mode 100644 vendor/github.com/weaveworks/promrus/vendor/golang.org/x/sys/windows/zsyscall_windows.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/COPYING create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/actions.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/app.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/args.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/cmd.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/cmd/genvalues/main.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/completions.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/doc.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/envar.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/flags.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/global.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/guesswidth.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/guesswidth_unix.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/model.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/parser.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/parsers.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/templates.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/usage.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/values.go create mode 100644 vendor/gopkg.in/alecthomas/kingpin.v2/values_generated.go diff --git a/vendor/github.com/alecthomas/template/LICENSE b/vendor/github.com/alecthomas/template/LICENSE new file mode 100644 index 000000000..744875676 --- /dev/null +++ b/vendor/github.com/alecthomas/template/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/alecthomas/template/doc.go b/vendor/github.com/alecthomas/template/doc.go new file mode 100644 index 000000000..223c595c2 --- /dev/null +++ b/vendor/github.com/alecthomas/template/doc.go @@ -0,0 +1,406 @@ +// Copyright 2011 The Go 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 template implements data-driven templates for generating textual output. + +To generate HTML output, see package html/template, which has the same interface +as this package but automatically secures HTML output against certain attacks. + +Templates are executed by applying them to a data structure. Annotations in the +template refer to elements of the data structure (typically a field of a struct +or a key in a map) to control execution and derive values to be displayed. +Execution of the template walks the structure and sets the cursor, represented +by a period '.' and called "dot", to the value at the current location in the +structure as execution proceeds. + +The input text for a template is UTF-8-encoded text in any format. +"Actions"--data evaluations or control structures--are delimited by +"{{" and "}}"; all text outside actions is copied to the output unchanged. +Actions may not span newlines, although comments can. + +Once parsed, a template may be executed safely in parallel. + +Here is a trivial example that prints "17 items are made of wool". + + type Inventory struct { + Material string + Count uint + } + sweaters := Inventory{"wool", 17} + tmpl, err := template.New("test").Parse("{{.Count}} items are made of {{.Material}}") + if err != nil { panic(err) } + err = tmpl.Execute(os.Stdout, sweaters) + if err != nil { panic(err) } + +More intricate examples appear below. + +Actions + +Here is the list of actions. "Arguments" and "pipelines" are evaluations of +data, defined in detail below. + +*/ +// {{/* a comment */}} +// A comment; discarded. May contain newlines. +// Comments do not nest and must start and end at the +// delimiters, as shown here. +/* + + {{pipeline}} + The default textual representation of the value of the pipeline + is copied to the output. + + {{if pipeline}} T1 {{end}} + If the value of the pipeline is empty, no output is generated; + otherwise, T1 is executed. The empty values are false, 0, any + nil pointer or interface value, and any array, slice, map, or + string of length zero. + Dot is unaffected. + + {{if pipeline}} T1 {{else}} T0 {{end}} + If the value of the pipeline is empty, T0 is executed; + otherwise, T1 is executed. Dot is unaffected. + + {{if pipeline}} T1 {{else if pipeline}} T0 {{end}} + To simplify the appearance of if-else chains, the else action + of an if may include another if directly; the effect is exactly + the same as writing + {{if pipeline}} T1 {{else}}{{if pipeline}} T0 {{end}}{{end}} + + {{range pipeline}} T1 {{end}} + The value of the pipeline must be an array, slice, map, or channel. + If the value of the pipeline has length zero, nothing is output; + otherwise, dot is set to the successive elements of the array, + slice, or map and T1 is executed. If the value is a map and the + keys are of basic type with a defined order ("comparable"), the + elements will be visited in sorted key order. + + {{range pipeline}} T1 {{else}} T0 {{end}} + The value of the pipeline must be an array, slice, map, or channel. + If the value of the pipeline has length zero, dot is unaffected and + T0 is executed; otherwise, dot is set to the successive elements + of the array, slice, or map and T1 is executed. + + {{template "name"}} + The template with the specified name is executed with nil data. + + {{template "name" pipeline}} + The template with the specified name is executed with dot set + to the value of the pipeline. + + {{with pipeline}} T1 {{end}} + If the value of the pipeline is empty, no output is generated; + otherwise, dot is set to the value of the pipeline and T1 is + executed. + + {{with pipeline}} T1 {{else}} T0 {{end}} + If the value of the pipeline is empty, dot is unaffected and T0 + is executed; otherwise, dot is set to the value of the pipeline + and T1 is executed. + +Arguments + +An argument is a simple value, denoted by one of the following. + + - A boolean, string, character, integer, floating-point, imaginary + or complex constant in Go syntax. These behave like Go's untyped + constants, although raw strings may not span newlines. + - The keyword nil, representing an untyped Go nil. + - The character '.' (period): + . + The result is the value of dot. + - A variable name, which is a (possibly empty) alphanumeric string + preceded by a dollar sign, such as + $piOver2 + or + $ + The result is the value of the variable. + Variables are described below. + - The name of a field of the data, which must be a struct, preceded + by a period, such as + .Field + The result is the value of the field. Field invocations may be + chained: + .Field1.Field2 + Fields can also be evaluated on variables, including chaining: + $x.Field1.Field2 + - The name of a key of the data, which must be a map, preceded + by a period, such as + .Key + The result is the map element value indexed by the key. + Key invocations may be chained and combined with fields to any + depth: + .Field1.Key1.Field2.Key2 + Although the key must be an alphanumeric identifier, unlike with + field names they do not need to start with an upper case letter. + Keys can also be evaluated on variables, including chaining: + $x.key1.key2 + - The name of a niladic method of the data, preceded by a period, + such as + .Method + The result is the value of invoking the method with dot as the + receiver, dot.Method(). Such a method must have one return value (of + any type) or two return values, the second of which is an error. + If it has two and the returned error is non-nil, execution terminates + and an error is returned to the caller as the value of Execute. + Method invocations may be chained and combined with fields and keys + to any depth: + .Field1.Key1.Method1.Field2.Key2.Method2 + Methods can also be evaluated on variables, including chaining: + $x.Method1.Field + - The name of a niladic function, such as + fun + The result is the value of invoking the function, fun(). The return + types and values behave as in methods. Functions and function + names are described below. + - A parenthesized instance of one the above, for grouping. The result + may be accessed by a field or map key invocation. + print (.F1 arg1) (.F2 arg2) + (.StructValuedMethod "arg").Field + +Arguments may evaluate to any type; if they are pointers the implementation +automatically indirects to the base type when required. +If an evaluation yields a function value, such as a function-valued +field of a struct, the function is not invoked automatically, but it +can be used as a truth value for an if action and the like. To invoke +it, use the call function, defined below. + +A pipeline is a possibly chained sequence of "commands". A command is a simple +value (argument) or a function or method call, possibly with multiple arguments: + + Argument + The result is the value of evaluating the argument. + .Method [Argument...] + The method can be alone or the last element of a chain but, + unlike methods in the middle of a chain, it can take arguments. + The result is the value of calling the method with the + arguments: + dot.Method(Argument1, etc.) + functionName [Argument...] + The result is the value of calling the function associated + with the name: + function(Argument1, etc.) + Functions and function names are described below. + +Pipelines + +A pipeline may be "chained" by separating a sequence of commands with pipeline +characters '|'. In a chained pipeline, the result of the each command is +passed as the last argument of the following command. The output of the final +command in the pipeline is the value of the pipeline. + +The output of a command will be either one value or two values, the second of +which has type error. If that second value is present and evaluates to +non-nil, execution terminates and the error is returned to the caller of +Execute. + +Variables + +A pipeline inside an action may initialize a variable to capture the result. +The initialization has syntax + + $variable := pipeline + +where $variable is the name of the variable. An action that declares a +variable produces no output. + +If a "range" action initializes a variable, the variable is set to the +successive elements of the iteration. Also, a "range" may declare two +variables, separated by a comma: + + range $index, $element := pipeline + +in which case $index and $element are set to the successive values of the +array/slice index or map key and element, respectively. Note that if there is +only one variable, it is assigned the element; this is opposite to the +convention in Go range clauses. + +A variable's scope extends to the "end" action of the control structure ("if", +"with", or "range") in which it is declared, or to the end of the template if +there is no such control structure. A template invocation does not inherit +variables from the point of its invocation. + +When execution begins, $ is set to the data argument passed to Execute, that is, +to the starting value of dot. + +Examples + +Here are some example one-line templates demonstrating pipelines and variables. +All produce the quoted word "output": + + {{"\"output\""}} + A string constant. + {{`"output"`}} + A raw string constant. + {{printf "%q" "output"}} + A function call. + {{"output" | printf "%q"}} + A function call whose final argument comes from the previous + command. + {{printf "%q" (print "out" "put")}} + A parenthesized argument. + {{"put" | printf "%s%s" "out" | printf "%q"}} + A more elaborate call. + {{"output" | printf "%s" | printf "%q"}} + A longer chain. + {{with "output"}}{{printf "%q" .}}{{end}} + A with action using dot. + {{with $x := "output" | printf "%q"}}{{$x}}{{end}} + A with action that creates and uses a variable. + {{with $x := "output"}}{{printf "%q" $x}}{{end}} + A with action that uses the variable in another action. + {{with $x := "output"}}{{$x | printf "%q"}}{{end}} + The same, but pipelined. + +Functions + +During execution functions are found in two function maps: first in the +template, then in the global function map. By default, no functions are defined +in the template but the Funcs method can be used to add them. + +Predefined global functions are named as follows. + + and + Returns the boolean AND of its arguments by returning the + first empty argument or the last argument, that is, + "and x y" behaves as "if x then y else x". All the + arguments are evaluated. + call + Returns the result of calling the first argument, which + must be a function, with the remaining arguments as parameters. + Thus "call .X.Y 1 2" is, in Go notation, dot.X.Y(1, 2) where + Y is a func-valued field, map entry, or the like. + The first argument must be the result of an evaluation + that yields a value of function type (as distinct from + a predefined function such as print). The function must + return either one or two result values, the second of which + is of type error. If the arguments don't match the function + or the returned error value is non-nil, execution stops. + html + Returns the escaped HTML equivalent of the textual + representation of its arguments. + index + Returns the result of indexing its first argument by the + following arguments. Thus "index x 1 2 3" is, in Go syntax, + x[1][2][3]. Each indexed item must be a map, slice, or array. + js + Returns the escaped JavaScript equivalent of the textual + representation of its arguments. + len + Returns the integer length of its argument. + not + Returns the boolean negation of its single argument. + or + Returns the boolean OR of its arguments by returning the + first non-empty argument or the last argument, that is, + "or x y" behaves as "if x then x else y". All the + arguments are evaluated. + print + An alias for fmt.Sprint + printf + An alias for fmt.Sprintf + println + An alias for fmt.Sprintln + urlquery + Returns the escaped value of the textual representation of + its arguments in a form suitable for embedding in a URL query. + +The boolean functions take any zero value to be false and a non-zero +value to be true. + +There is also a set of binary comparison operators defined as +functions: + + eq + Returns the boolean truth of arg1 == arg2 + ne + Returns the boolean truth of arg1 != arg2 + lt + Returns the boolean truth of arg1 < arg2 + le + Returns the boolean truth of arg1 <= arg2 + gt + Returns the boolean truth of arg1 > arg2 + ge + Returns the boolean truth of arg1 >= arg2 + +For simpler multi-way equality tests, eq (only) accepts two or more +arguments and compares the second and subsequent to the first, +returning in effect + + arg1==arg2 || arg1==arg3 || arg1==arg4 ... + +(Unlike with || in Go, however, eq is a function call and all the +arguments will be evaluated.) + +The comparison functions work on basic types only (or named basic +types, such as "type Celsius float32"). They implement the Go rules +for comparison of values, except that size and exact type are +ignored, so any integer value, signed or unsigned, may be compared +with any other integer value. (The arithmetic value is compared, +not the bit pattern, so all negative integers are less than all +unsigned integers.) However, as usual, one may not compare an int +with a float32 and so on. + +Associated templates + +Each template is named by a string specified when it is created. Also, each +template is associated with zero or more other templates that it may invoke by +name; such associations are transitive and form a name space of templates. + +A template may use a template invocation to instantiate another associated +template; see the explanation of the "template" action above. The name must be +that of a template associated with the template that contains the invocation. + +Nested template definitions + +When parsing a template, another template may be defined and associated with the +template being parsed. Template definitions must appear at the top level of the +template, much like global variables in a Go program. + +The syntax of such definitions is to surround each template declaration with a +"define" and "end" action. + +The define action names the template being created by providing a string +constant. Here is a simple example: + + `{{define "T1"}}ONE{{end}} + {{define "T2"}}TWO{{end}} + {{define "T3"}}{{template "T1"}} {{template "T2"}}{{end}} + {{template "T3"}}` + +This defines two templates, T1 and T2, and a third T3 that invokes the other two +when it is executed. Finally it invokes T3. If executed this template will +produce the text + + ONE TWO + +By construction, a template may reside in only one association. If it's +necessary to have a template addressable from multiple associations, the +template definition must be parsed multiple times to create distinct *Template +values, or must be copied with the Clone or AddParseTree method. + +Parse may be called multiple times to assemble the various associated templates; +see the ParseFiles and ParseGlob functions and methods for simple ways to parse +related templates stored in files. + +A template may be executed directly or through ExecuteTemplate, which executes +an associated template identified by name. To invoke our example above, we +might write, + + err := tmpl.Execute(os.Stdout, "no data needed") + if err != nil { + log.Fatalf("execution failed: %s", err) + } + +or to invoke a particular template explicitly by name, + + err := tmpl.ExecuteTemplate(os.Stdout, "T2", "no data needed") + if err != nil { + log.Fatalf("execution failed: %s", err) + } + +*/ +package template diff --git a/vendor/github.com/alecthomas/template/exec.go b/vendor/github.com/alecthomas/template/exec.go new file mode 100644 index 000000000..c3078e5d0 --- /dev/null +++ b/vendor/github.com/alecthomas/template/exec.go @@ -0,0 +1,845 @@ +// Copyright 2011 The Go 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 template + +import ( + "bytes" + "fmt" + "io" + "reflect" + "runtime" + "sort" + "strings" + + "github.com/alecthomas/template/parse" +) + +// state represents the state of an execution. It's not part of the +// template so that multiple executions of the same template +// can execute in parallel. +type state struct { + tmpl *Template + wr io.Writer + node parse.Node // current node, for errors + vars []variable // push-down stack of variable values. +} + +// variable holds the dynamic value of a variable such as $, $x etc. +type variable struct { + name string + value reflect.Value +} + +// push pushes a new variable on the stack. +func (s *state) push(name string, value reflect.Value) { + s.vars = append(s.vars, variable{name, value}) +} + +// mark returns the length of the variable stack. +func (s *state) mark() int { + return len(s.vars) +} + +// pop pops the variable stack up to the mark. +func (s *state) pop(mark int) { + s.vars = s.vars[0:mark] +} + +// setVar overwrites the top-nth variable on the stack. Used by range iterations. +func (s *state) setVar(n int, value reflect.Value) { + s.vars[len(s.vars)-n].value = value +} + +// varValue returns the value of the named variable. +func (s *state) varValue(name string) reflect.Value { + for i := s.mark() - 1; i >= 0; i-- { + if s.vars[i].name == name { + return s.vars[i].value + } + } + s.errorf("undefined variable: %s", name) + return zero +} + +var zero reflect.Value + +// at marks the state to be on node n, for error reporting. +func (s *state) at(node parse.Node) { + s.node = node +} + +// doublePercent returns the string with %'s replaced by %%, if necessary, +// so it can be used safely inside a Printf format string. +func doublePercent(str string) string { + if strings.Contains(str, "%") { + str = strings.Replace(str, "%", "%%", -1) + } + return str +} + +// errorf formats the error and terminates processing. +func (s *state) errorf(format string, args ...interface{}) { + name := doublePercent(s.tmpl.Name()) + if s.node == nil { + format = fmt.Sprintf("template: %s: %s", name, format) + } else { + location, context := s.tmpl.ErrorContext(s.node) + format = fmt.Sprintf("template: %s: executing %q at <%s>: %s", location, name, doublePercent(context), format) + } + panic(fmt.Errorf(format, args...)) +} + +// errRecover is the handler that turns panics into returns from the top +// level of Parse. +func errRecover(errp *error) { + e := recover() + if e != nil { + switch err := e.(type) { + case runtime.Error: + panic(e) + case error: + *errp = err + default: + panic(e) + } + } +} + +// ExecuteTemplate applies the template associated with t that has the given name +// to the specified data object and writes the output to wr. +// If an error occurs executing the template or writing its output, +// execution stops, but partial results may already have been written to +// the output writer. +// A template may be executed safely in parallel. +func (t *Template) ExecuteTemplate(wr io.Writer, name string, data interface{}) error { + tmpl := t.tmpl[name] + if tmpl == nil { + return fmt.Errorf("template: no template %q associated with template %q", name, t.name) + } + return tmpl.Execute(wr, data) +} + +// Execute applies a parsed template to the specified data object, +// and writes the output to wr. +// If an error occurs executing the template or writing its output, +// execution stops, but partial results may already have been written to +// the output writer. +// A template may be executed safely in parallel. +func (t *Template) Execute(wr io.Writer, data interface{}) (err error) { + defer errRecover(&err) + value := reflect.ValueOf(data) + state := &state{ + tmpl: t, + wr: wr, + vars: []variable{{"$", value}}, + } + t.init() + if t.Tree == nil || t.Root == nil { + var b bytes.Buffer + for name, tmpl := range t.tmpl { + if tmpl.Tree == nil || tmpl.Root == nil { + continue + } + if b.Len() > 0 { + b.WriteString(", ") + } + fmt.Fprintf(&b, "%q", name) + } + var s string + if b.Len() > 0 { + s = "; defined templates are: " + b.String() + } + state.errorf("%q is an incomplete or empty template%s", t.Name(), s) + } + state.walk(value, t.Root) + return +} + +// Walk functions step through the major pieces of the template structure, +// generating output as they go. +func (s *state) walk(dot reflect.Value, node parse.Node) { + s.at(node) + switch node := node.(type) { + case *parse.ActionNode: + // Do not pop variables so they persist until next end. + // Also, if the action declares variables, don't print the result. + val := s.evalPipeline(dot, node.Pipe) + if len(node.Pipe.Decl) == 0 { + s.printValue(node, val) + } + case *parse.IfNode: + s.walkIfOrWith(parse.NodeIf, dot, node.Pipe, node.List, node.ElseList) + case *parse.ListNode: + for _, node := range node.Nodes { + s.walk(dot, node) + } + case *parse.RangeNode: + s.walkRange(dot, node) + case *parse.TemplateNode: + s.walkTemplate(dot, node) + case *parse.TextNode: + if _, err := s.wr.Write(node.Text); err != nil { + s.errorf("%s", err) + } + case *parse.WithNode: + s.walkIfOrWith(parse.NodeWith, dot, node.Pipe, node.List, node.ElseList) + default: + s.errorf("unknown node: %s", node) + } +} + +// walkIfOrWith walks an 'if' or 'with' node. The two control structures +// are identical in behavior except that 'with' sets dot. +func (s *state) walkIfOrWith(typ parse.NodeType, dot reflect.Value, pipe *parse.PipeNode, list, elseList *parse.ListNode) { + defer s.pop(s.mark()) + val := s.evalPipeline(dot, pipe) + truth, ok := isTrue(val) + if !ok { + s.errorf("if/with can't use %v", val) + } + if truth { + if typ == parse.NodeWith { + s.walk(val, list) + } else { + s.walk(dot, list) + } + } else if elseList != nil { + s.walk(dot, elseList) + } +} + +// isTrue reports whether the value is 'true', in the sense of not the zero of its type, +// and whether the value has a meaningful truth value. +func isTrue(val reflect.Value) (truth, ok bool) { + if !val.IsValid() { + // Something like var x interface{}, never set. It's a form of nil. + return false, true + } + switch val.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + truth = val.Len() > 0 + case reflect.Bool: + truth = val.Bool() + case reflect.Complex64, reflect.Complex128: + truth = val.Complex() != 0 + case reflect.Chan, reflect.Func, reflect.Ptr, reflect.Interface: + truth = !val.IsNil() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + truth = val.Int() != 0 + case reflect.Float32, reflect.Float64: + truth = val.Float() != 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + truth = val.Uint() != 0 + case reflect.Struct: + truth = true // Struct values are always true. + default: + return + } + return truth, true +} + +func (s *state) walkRange(dot reflect.Value, r *parse.RangeNode) { + s.at(r) + defer s.pop(s.mark()) + val, _ := indirect(s.evalPipeline(dot, r.Pipe)) + // mark top of stack before any variables in the body are pushed. + mark := s.mark() + oneIteration := func(index, elem reflect.Value) { + // Set top var (lexically the second if there are two) to the element. + if len(r.Pipe.Decl) > 0 { + s.setVar(1, elem) + } + // Set next var (lexically the first if there are two) to the index. + if len(r.Pipe.Decl) > 1 { + s.setVar(2, index) + } + s.walk(elem, r.List) + s.pop(mark) + } + switch val.Kind() { + case reflect.Array, reflect.Slice: + if val.Len() == 0 { + break + } + for i := 0; i < val.Len(); i++ { + oneIteration(reflect.ValueOf(i), val.Index(i)) + } + return + case reflect.Map: + if val.Len() == 0 { + break + } + for _, key := range sortKeys(val.MapKeys()) { + oneIteration(key, val.MapIndex(key)) + } + return + case reflect.Chan: + if val.IsNil() { + break + } + i := 0 + for ; ; i++ { + elem, ok := val.Recv() + if !ok { + break + } + oneIteration(reflect.ValueOf(i), elem) + } + if i == 0 { + break + } + return + case reflect.Invalid: + break // An invalid value is likely a nil map, etc. and acts like an empty map. + default: + s.errorf("range can't iterate over %v", val) + } + if r.ElseList != nil { + s.walk(dot, r.ElseList) + } +} + +func (s *state) walkTemplate(dot reflect.Value, t *parse.TemplateNode) { + s.at(t) + tmpl := s.tmpl.tmpl[t.Name] + if tmpl == nil { + s.errorf("template %q not defined", t.Name) + } + // Variables declared by the pipeline persist. + dot = s.evalPipeline(dot, t.Pipe) + newState := *s + newState.tmpl = tmpl + // No dynamic scoping: template invocations inherit no variables. + newState.vars = []variable{{"$", dot}} + newState.walk(dot, tmpl.Root) +} + +// Eval functions evaluate pipelines, commands, and their elements and extract +// values from the data structure by examining fields, calling methods, and so on. +// The printing of those values happens only through walk functions. + +// evalPipeline returns the value acquired by evaluating a pipeline. If the +// pipeline has a variable declaration, the variable will be pushed on the +// stack. Callers should therefore pop the stack after they are finished +// executing commands depending on the pipeline value. +func (s *state) evalPipeline(dot reflect.Value, pipe *parse.PipeNode) (value reflect.Value) { + if pipe == nil { + return + } + s.at(pipe) + for _, cmd := range pipe.Cmds { + value = s.evalCommand(dot, cmd, value) // previous value is this one's final arg. + // If the object has type interface{}, dig down one level to the thing inside. + if value.Kind() == reflect.Interface && value.Type().NumMethod() == 0 { + value = reflect.ValueOf(value.Interface()) // lovely! + } + } + for _, variable := range pipe.Decl { + s.push(variable.Ident[0], value) + } + return value +} + +func (s *state) notAFunction(args []parse.Node, final reflect.Value) { + if len(args) > 1 || final.IsValid() { + s.errorf("can't give argument to non-function %s", args[0]) + } +} + +func (s *state) evalCommand(dot reflect.Value, cmd *parse.CommandNode, final reflect.Value) reflect.Value { + firstWord := cmd.Args[0] + switch n := firstWord.(type) { + case *parse.FieldNode: + return s.evalFieldNode(dot, n, cmd.Args, final) + case *parse.ChainNode: + return s.evalChainNode(dot, n, cmd.Args, final) + case *parse.IdentifierNode: + // Must be a function. + return s.evalFunction(dot, n, cmd, cmd.Args, final) + case *parse.PipeNode: + // Parenthesized pipeline. The arguments are all inside the pipeline; final is ignored. + return s.evalPipeline(dot, n) + case *parse.VariableNode: + return s.evalVariableNode(dot, n, cmd.Args, final) + } + s.at(firstWord) + s.notAFunction(cmd.Args, final) + switch word := firstWord.(type) { + case *parse.BoolNode: + return reflect.ValueOf(word.True) + case *parse.DotNode: + return dot + case *parse.NilNode: + s.errorf("nil is not a command") + case *parse.NumberNode: + return s.idealConstant(word) + case *parse.StringNode: + return reflect.ValueOf(word.Text) + } + s.errorf("can't evaluate command %q", firstWord) + panic("not reached") +} + +// idealConstant is called to return the value of a number in a context where +// we don't know the type. In that case, the syntax of the number tells us +// its type, and we use Go rules to resolve. Note there is no such thing as +// a uint ideal constant in this situation - the value must be of int type. +func (s *state) idealConstant(constant *parse.NumberNode) reflect.Value { + // These are ideal constants but we don't know the type + // and we have no context. (If it was a method argument, + // we'd know what we need.) The syntax guides us to some extent. + s.at(constant) + switch { + case constant.IsComplex: + return reflect.ValueOf(constant.Complex128) // incontrovertible. + case constant.IsFloat && !isHexConstant(constant.Text) && strings.IndexAny(constant.Text, ".eE") >= 0: + return reflect.ValueOf(constant.Float64) + case constant.IsInt: + n := int(constant.Int64) + if int64(n) != constant.Int64 { + s.errorf("%s overflows int", constant.Text) + } + return reflect.ValueOf(n) + case constant.IsUint: + s.errorf("%s overflows int", constant.Text) + } + return zero +} + +func isHexConstant(s string) bool { + return len(s) > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X') +} + +func (s *state) evalFieldNode(dot reflect.Value, field *parse.FieldNode, args []parse.Node, final reflect.Value) reflect.Value { + s.at(field) + return s.evalFieldChain(dot, dot, field, field.Ident, args, final) +} + +func (s *state) evalChainNode(dot reflect.Value, chain *parse.ChainNode, args []parse.Node, final reflect.Value) reflect.Value { + s.at(chain) + // (pipe).Field1.Field2 has pipe as .Node, fields as .Field. Eval the pipeline, then the fields. + pipe := s.evalArg(dot, nil, chain.Node) + if len(chain.Field) == 0 { + s.errorf("internal error: no fields in evalChainNode") + } + return s.evalFieldChain(dot, pipe, chain, chain.Field, args, final) +} + +func (s *state) evalVariableNode(dot reflect.Value, variable *parse.VariableNode, args []parse.Node, final reflect.Value) reflect.Value { + // $x.Field has $x as the first ident, Field as the second. Eval the var, then the fields. + s.at(variable) + value := s.varValue(variable.Ident[0]) + if len(variable.Ident) == 1 { + s.notAFunction(args, final) + return value + } + return s.evalFieldChain(dot, value, variable, variable.Ident[1:], args, final) +} + +// evalFieldChain evaluates .X.Y.Z possibly followed by arguments. +// dot is the environment in which to evaluate arguments, while +// receiver is the value being walked along the chain. +func (s *state) evalFieldChain(dot, receiver reflect.Value, node parse.Node, ident []string, args []parse.Node, final reflect.Value) reflect.Value { + n := len(ident) + for i := 0; i < n-1; i++ { + receiver = s.evalField(dot, ident[i], node, nil, zero, receiver) + } + // Now if it's a method, it gets the arguments. + return s.evalField(dot, ident[n-1], node, args, final, receiver) +} + +func (s *state) evalFunction(dot reflect.Value, node *parse.IdentifierNode, cmd parse.Node, args []parse.Node, final reflect.Value) reflect.Value { + s.at(node) + name := node.Ident + function, ok := findFunction(name, s.tmpl) + if !ok { + s.errorf("%q is not a defined function", name) + } + return s.evalCall(dot, function, cmd, name, args, final) +} + +// evalField evaluates an expression like (.Field) or (.Field arg1 arg2). +// The 'final' argument represents the return value from the preceding +// value of the pipeline, if any. +func (s *state) evalField(dot reflect.Value, fieldName string, node parse.Node, args []parse.Node, final, receiver reflect.Value) reflect.Value { + if !receiver.IsValid() { + return zero + } + typ := receiver.Type() + receiver, _ = indirect(receiver) + // Unless it's an interface, need to get to a value of type *T to guarantee + // we see all methods of T and *T. + ptr := receiver + if ptr.Kind() != reflect.Interface && ptr.CanAddr() { + ptr = ptr.Addr() + } + if method := ptr.MethodByName(fieldName); method.IsValid() { + return s.evalCall(dot, method, node, fieldName, args, final) + } + hasArgs := len(args) > 1 || final.IsValid() + // It's not a method; must be a field of a struct or an element of a map. The receiver must not be nil. + receiver, isNil := indirect(receiver) + if isNil { + s.errorf("nil pointer evaluating %s.%s", typ, fieldName) + } + switch receiver.Kind() { + case reflect.Struct: + tField, ok := receiver.Type().FieldByName(fieldName) + if ok { + field := receiver.FieldByIndex(tField.Index) + if tField.PkgPath != "" { // field is unexported + s.errorf("%s is an unexported field of struct type %s", fieldName, typ) + } + // If it's a function, we must call it. + if hasArgs { + s.errorf("%s has arguments but cannot be invoked as function", fieldName) + } + return field + } + s.errorf("%s is not a field of struct type %s", fieldName, typ) + case reflect.Map: + // If it's a map, attempt to use the field name as a key. + nameVal := reflect.ValueOf(fieldName) + if nameVal.Type().AssignableTo(receiver.Type().Key()) { + if hasArgs { + s.errorf("%s is not a method but has arguments", fieldName) + } + return receiver.MapIndex(nameVal) + } + } + s.errorf("can't evaluate field %s in type %s", fieldName, typ) + panic("not reached") +} + +var ( + errorType = reflect.TypeOf((*error)(nil)).Elem() + fmtStringerType = reflect.TypeOf((*fmt.Stringer)(nil)).Elem() +) + +// evalCall executes a function or method call. If it's a method, fun already has the receiver bound, so +// it looks just like a function call. The arg list, if non-nil, includes (in the manner of the shell), arg[0] +// as the function itself. +func (s *state) evalCall(dot, fun reflect.Value, node parse.Node, name string, args []parse.Node, final reflect.Value) reflect.Value { + if args != nil { + args = args[1:] // Zeroth arg is function name/node; not passed to function. + } + typ := fun.Type() + numIn := len(args) + if final.IsValid() { + numIn++ + } + numFixed := len(args) + if typ.IsVariadic() { + numFixed = typ.NumIn() - 1 // last arg is the variadic one. + if numIn < numFixed { + s.errorf("wrong number of args for %s: want at least %d got %d", name, typ.NumIn()-1, len(args)) + } + } else if numIn < typ.NumIn()-1 || !typ.IsVariadic() && numIn != typ.NumIn() { + s.errorf("wrong number of args for %s: want %d got %d", name, typ.NumIn(), len(args)) + } + if !goodFunc(typ) { + // TODO: This could still be a confusing error; maybe goodFunc should provide info. + s.errorf("can't call method/function %q with %d results", name, typ.NumOut()) + } + // Build the arg list. + argv := make([]reflect.Value, numIn) + // Args must be evaluated. Fixed args first. + i := 0 + for ; i < numFixed && i < len(args); i++ { + argv[i] = s.evalArg(dot, typ.In(i), args[i]) + } + // Now the ... args. + if typ.IsVariadic() { + argType := typ.In(typ.NumIn() - 1).Elem() // Argument is a slice. + for ; i < len(args); i++ { + argv[i] = s.evalArg(dot, argType, args[i]) + } + } + // Add final value if necessary. + if final.IsValid() { + t := typ.In(typ.NumIn() - 1) + if typ.IsVariadic() { + t = t.Elem() + } + argv[i] = s.validateType(final, t) + } + result := fun.Call(argv) + // If we have an error that is not nil, stop execution and return that error to the caller. + if len(result) == 2 && !result[1].IsNil() { + s.at(node) + s.errorf("error calling %s: %s", name, result[1].Interface().(error)) + } + return result[0] +} + +// canBeNil reports whether an untyped nil can be assigned to the type. See reflect.Zero. +func canBeNil(typ reflect.Type) bool { + switch typ.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + return true + } + return false +} + +// validateType guarantees that the value is valid and assignable to the type. +func (s *state) validateType(value reflect.Value, typ reflect.Type) reflect.Value { + if !value.IsValid() { + if typ == nil || canBeNil(typ) { + // An untyped nil interface{}. Accept as a proper nil value. + return reflect.Zero(typ) + } + s.errorf("invalid value; expected %s", typ) + } + if typ != nil && !value.Type().AssignableTo(typ) { + if value.Kind() == reflect.Interface && !value.IsNil() { + value = value.Elem() + if value.Type().AssignableTo(typ) { + return value + } + // fallthrough + } + // Does one dereference or indirection work? We could do more, as we + // do with method receivers, but that gets messy and method receivers + // are much more constrained, so it makes more sense there than here. + // Besides, one is almost always all you need. + switch { + case value.Kind() == reflect.Ptr && value.Type().Elem().AssignableTo(typ): + value = value.Elem() + if !value.IsValid() { + s.errorf("dereference of nil pointer of type %s", typ) + } + case reflect.PtrTo(value.Type()).AssignableTo(typ) && value.CanAddr(): + value = value.Addr() + default: + s.errorf("wrong type for value; expected %s; got %s", typ, value.Type()) + } + } + return value +} + +func (s *state) evalArg(dot reflect.Value, typ reflect.Type, n parse.Node) reflect.Value { + s.at(n) + switch arg := n.(type) { + case *parse.DotNode: + return s.validateType(dot, typ) + case *parse.NilNode: + if canBeNil(typ) { + return reflect.Zero(typ) + } + s.errorf("cannot assign nil to %s", typ) + case *parse.FieldNode: + return s.validateType(s.evalFieldNode(dot, arg, []parse.Node{n}, zero), typ) + case *parse.VariableNode: + return s.validateType(s.evalVariableNode(dot, arg, nil, zero), typ) + case *parse.PipeNode: + return s.validateType(s.evalPipeline(dot, arg), typ) + case *parse.IdentifierNode: + return s.evalFunction(dot, arg, arg, nil, zero) + case *parse.ChainNode: + return s.validateType(s.evalChainNode(dot, arg, nil, zero), typ) + } + switch typ.Kind() { + case reflect.Bool: + return s.evalBool(typ, n) + case reflect.Complex64, reflect.Complex128: + return s.evalComplex(typ, n) + case reflect.Float32, reflect.Float64: + return s.evalFloat(typ, n) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return s.evalInteger(typ, n) + case reflect.Interface: + if typ.NumMethod() == 0 { + return s.evalEmptyInterface(dot, n) + } + case reflect.String: + return s.evalString(typ, n) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return s.evalUnsignedInteger(typ, n) + } + s.errorf("can't handle %s for arg of type %s", n, typ) + panic("not reached") +} + +func (s *state) evalBool(typ reflect.Type, n parse.Node) reflect.Value { + s.at(n) + if n, ok := n.(*parse.BoolNode); ok { + value := reflect.New(typ).Elem() + value.SetBool(n.True) + return value + } + s.errorf("expected bool; found %s", n) + panic("not reached") +} + +func (s *state) evalString(typ reflect.Type, n parse.Node) reflect.Value { + s.at(n) + if n, ok := n.(*parse.StringNode); ok { + value := reflect.New(typ).Elem() + value.SetString(n.Text) + return value + } + s.errorf("expected string; found %s", n) + panic("not reached") +} + +func (s *state) evalInteger(typ reflect.Type, n parse.Node) reflect.Value { + s.at(n) + if n, ok := n.(*parse.NumberNode); ok && n.IsInt { + value := reflect.New(typ).Elem() + value.SetInt(n.Int64) + return value + } + s.errorf("expected integer; found %s", n) + panic("not reached") +} + +func (s *state) evalUnsignedInteger(typ reflect.Type, n parse.Node) reflect.Value { + s.at(n) + if n, ok := n.(*parse.NumberNode); ok && n.IsUint { + value := reflect.New(typ).Elem() + value.SetUint(n.Uint64) + return value + } + s.errorf("expected unsigned integer; found %s", n) + panic("not reached") +} + +func (s *state) evalFloat(typ reflect.Type, n parse.Node) reflect.Value { + s.at(n) + if n, ok := n.(*parse.NumberNode); ok && n.IsFloat { + value := reflect.New(typ).Elem() + value.SetFloat(n.Float64) + return value + } + s.errorf("expected float; found %s", n) + panic("not reached") +} + +func (s *state) evalComplex(typ reflect.Type, n parse.Node) reflect.Value { + if n, ok := n.(*parse.NumberNode); ok && n.IsComplex { + value := reflect.New(typ).Elem() + value.SetComplex(n.Complex128) + return value + } + s.errorf("expected complex; found %s", n) + panic("not reached") +} + +func (s *state) evalEmptyInterface(dot reflect.Value, n parse.Node) reflect.Value { + s.at(n) + switch n := n.(type) { + case *parse.BoolNode: + return reflect.ValueOf(n.True) + case *parse.DotNode: + return dot + case *parse.FieldNode: + return s.evalFieldNode(dot, n, nil, zero) + case *parse.IdentifierNode: + return s.evalFunction(dot, n, n, nil, zero) + case *parse.NilNode: + // NilNode is handled in evalArg, the only place that calls here. + s.errorf("evalEmptyInterface: nil (can't happen)") + case *parse.NumberNode: + return s.idealConstant(n) + case *parse.StringNode: + return reflect.ValueOf(n.Text) + case *parse.VariableNode: + return s.evalVariableNode(dot, n, nil, zero) + case *parse.PipeNode: + return s.evalPipeline(dot, n) + } + s.errorf("can't handle assignment of %s to empty interface argument", n) + panic("not reached") +} + +// indirect returns the item at the end of indirection, and a bool to indicate if it's nil. +// We indirect through pointers and empty interfaces (only) because +// non-empty interfaces have methods we might need. +func indirect(v reflect.Value) (rv reflect.Value, isNil bool) { + for ; v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface; v = v.Elem() { + if v.IsNil() { + return v, true + } + if v.Kind() == reflect.Interface && v.NumMethod() > 0 { + break + } + } + return v, false +} + +// printValue writes the textual representation of the value to the output of +// the template. +func (s *state) printValue(n parse.Node, v reflect.Value) { + s.at(n) + iface, ok := printableValue(v) + if !ok { + s.errorf("can't print %s of type %s", n, v.Type()) + } + fmt.Fprint(s.wr, iface) +} + +// printableValue returns the, possibly indirected, interface value inside v that +// is best for a call to formatted printer. +func printableValue(v reflect.Value) (interface{}, bool) { + if v.Kind() == reflect.Ptr { + v, _ = indirect(v) // fmt.Fprint handles nil. + } + if !v.IsValid() { + return "", true + } + + if !v.Type().Implements(errorType) && !v.Type().Implements(fmtStringerType) { + if v.CanAddr() && (reflect.PtrTo(v.Type()).Implements(errorType) || reflect.PtrTo(v.Type()).Implements(fmtStringerType)) { + v = v.Addr() + } else { + switch v.Kind() { + case reflect.Chan, reflect.Func: + return nil, false + } + } + } + return v.Interface(), true +} + +// Types to help sort the keys in a map for reproducible output. + +type rvs []reflect.Value + +func (x rvs) Len() int { return len(x) } +func (x rvs) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +type rvInts struct{ rvs } + +func (x rvInts) Less(i, j int) bool { return x.rvs[i].Int() < x.rvs[j].Int() } + +type rvUints struct{ rvs } + +func (x rvUints) Less(i, j int) bool { return x.rvs[i].Uint() < x.rvs[j].Uint() } + +type rvFloats struct{ rvs } + +func (x rvFloats) Less(i, j int) bool { return x.rvs[i].Float() < x.rvs[j].Float() } + +type rvStrings struct{ rvs } + +func (x rvStrings) Less(i, j int) bool { return x.rvs[i].String() < x.rvs[j].String() } + +// sortKeys sorts (if it can) the slice of reflect.Values, which is a slice of map keys. +func sortKeys(v []reflect.Value) []reflect.Value { + if len(v) <= 1 { + return v + } + switch v[0].Kind() { + case reflect.Float32, reflect.Float64: + sort.Sort(rvFloats{v}) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + sort.Sort(rvInts{v}) + case reflect.String: + sort.Sort(rvStrings{v}) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + sort.Sort(rvUints{v}) + } + return v +} diff --git a/vendor/github.com/alecthomas/template/funcs.go b/vendor/github.com/alecthomas/template/funcs.go new file mode 100644 index 000000000..39ee5ed68 --- /dev/null +++ b/vendor/github.com/alecthomas/template/funcs.go @@ -0,0 +1,598 @@ +// Copyright 2011 The Go 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 template + +import ( + "bytes" + "errors" + "fmt" + "io" + "net/url" + "reflect" + "strings" + "unicode" + "unicode/utf8" +) + +// FuncMap is the type of the map defining the mapping from names to functions. +// Each function must have either a single return value, or two return values of +// which the second has type error. In that case, if the second (error) +// return value evaluates to non-nil during execution, execution terminates and +// Execute returns that error. +type FuncMap map[string]interface{} + +var builtins = FuncMap{ + "and": and, + "call": call, + "html": HTMLEscaper, + "index": index, + "js": JSEscaper, + "len": length, + "not": not, + "or": or, + "print": fmt.Sprint, + "printf": fmt.Sprintf, + "println": fmt.Sprintln, + "urlquery": URLQueryEscaper, + + // Comparisons + "eq": eq, // == + "ge": ge, // >= + "gt": gt, // > + "le": le, // <= + "lt": lt, // < + "ne": ne, // != +} + +var builtinFuncs = createValueFuncs(builtins) + +// createValueFuncs turns a FuncMap into a map[string]reflect.Value +func createValueFuncs(funcMap FuncMap) map[string]reflect.Value { + m := make(map[string]reflect.Value) + addValueFuncs(m, funcMap) + return m +} + +// addValueFuncs adds to values the functions in funcs, converting them to reflect.Values. +func addValueFuncs(out map[string]reflect.Value, in FuncMap) { + for name, fn := range in { + v := reflect.ValueOf(fn) + if v.Kind() != reflect.Func { + panic("value for " + name + " not a function") + } + if !goodFunc(v.Type()) { + panic(fmt.Errorf("can't install method/function %q with %d results", name, v.Type().NumOut())) + } + out[name] = v + } +} + +// addFuncs adds to values the functions in funcs. It does no checking of the input - +// call addValueFuncs first. +func addFuncs(out, in FuncMap) { + for name, fn := range in { + out[name] = fn + } +} + +// goodFunc checks that the function or method has the right result signature. +func goodFunc(typ reflect.Type) bool { + // We allow functions with 1 result or 2 results where the second is an error. + switch { + case typ.NumOut() == 1: + return true + case typ.NumOut() == 2 && typ.Out(1) == errorType: + return true + } + return false +} + +// findFunction looks for a function in the template, and global map. +func findFunction(name string, tmpl *Template) (reflect.Value, bool) { + if tmpl != nil && tmpl.common != nil { + if fn := tmpl.execFuncs[name]; fn.IsValid() { + return fn, true + } + } + if fn := builtinFuncs[name]; fn.IsValid() { + return fn, true + } + return reflect.Value{}, false +} + +// Indexing. + +// index returns the result of indexing its first argument by the following +// arguments. Thus "index x 1 2 3" is, in Go syntax, x[1][2][3]. Each +// indexed item must be a map, slice, or array. +func index(item interface{}, indices ...interface{}) (interface{}, error) { + v := reflect.ValueOf(item) + for _, i := range indices { + index := reflect.ValueOf(i) + var isNil bool + if v, isNil = indirect(v); isNil { + return nil, fmt.Errorf("index of nil pointer") + } + switch v.Kind() { + case reflect.Array, reflect.Slice, reflect.String: + var x int64 + switch index.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + x = index.Int() + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + x = int64(index.Uint()) + default: + return nil, fmt.Errorf("cannot index slice/array with type %s", index.Type()) + } + if x < 0 || x >= int64(v.Len()) { + return nil, fmt.Errorf("index out of range: %d", x) + } + v = v.Index(int(x)) + case reflect.Map: + if !index.IsValid() { + index = reflect.Zero(v.Type().Key()) + } + if !index.Type().AssignableTo(v.Type().Key()) { + return nil, fmt.Errorf("%s is not index type for %s", index.Type(), v.Type()) + } + if x := v.MapIndex(index); x.IsValid() { + v = x + } else { + v = reflect.Zero(v.Type().Elem()) + } + default: + return nil, fmt.Errorf("can't index item of type %s", v.Type()) + } + } + return v.Interface(), nil +} + +// Length + +// length returns the length of the item, with an error if it has no defined length. +func length(item interface{}) (int, error) { + v, isNil := indirect(reflect.ValueOf(item)) + if isNil { + return 0, fmt.Errorf("len of nil pointer") + } + switch v.Kind() { + case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice, reflect.String: + return v.Len(), nil + } + return 0, fmt.Errorf("len of type %s", v.Type()) +} + +// Function invocation + +// call returns the result of evaluating the first argument as a function. +// The function must return 1 result, or 2 results, the second of which is an error. +func call(fn interface{}, args ...interface{}) (interface{}, error) { + v := reflect.ValueOf(fn) + typ := v.Type() + if typ.Kind() != reflect.Func { + return nil, fmt.Errorf("non-function of type %s", typ) + } + if !goodFunc(typ) { + return nil, fmt.Errorf("function called with %d args; should be 1 or 2", typ.NumOut()) + } + numIn := typ.NumIn() + var dddType reflect.Type + if typ.IsVariadic() { + if len(args) < numIn-1 { + return nil, fmt.Errorf("wrong number of args: got %d want at least %d", len(args), numIn-1) + } + dddType = typ.In(numIn - 1).Elem() + } else { + if len(args) != numIn { + return nil, fmt.Errorf("wrong number of args: got %d want %d", len(args), numIn) + } + } + argv := make([]reflect.Value, len(args)) + for i, arg := range args { + value := reflect.ValueOf(arg) + // Compute the expected type. Clumsy because of variadics. + var argType reflect.Type + if !typ.IsVariadic() || i < numIn-1 { + argType = typ.In(i) + } else { + argType = dddType + } + if !value.IsValid() && canBeNil(argType) { + value = reflect.Zero(argType) + } + if !value.Type().AssignableTo(argType) { + return nil, fmt.Errorf("arg %d has type %s; should be %s", i, value.Type(), argType) + } + argv[i] = value + } + result := v.Call(argv) + if len(result) == 2 && !result[1].IsNil() { + return result[0].Interface(), result[1].Interface().(error) + } + return result[0].Interface(), nil +} + +// Boolean logic. + +func truth(a interface{}) bool { + t, _ := isTrue(reflect.ValueOf(a)) + return t +} + +// and computes the Boolean AND of its arguments, returning +// the first false argument it encounters, or the last argument. +func and(arg0 interface{}, args ...interface{}) interface{} { + if !truth(arg0) { + return arg0 + } + for i := range args { + arg0 = args[i] + if !truth(arg0) { + break + } + } + return arg0 +} + +// or computes the Boolean OR of its arguments, returning +// the first true argument it encounters, or the last argument. +func or(arg0 interface{}, args ...interface{}) interface{} { + if truth(arg0) { + return arg0 + } + for i := range args { + arg0 = args[i] + if truth(arg0) { + break + } + } + return arg0 +} + +// not returns the Boolean negation of its argument. +func not(arg interface{}) (truth bool) { + truth, _ = isTrue(reflect.ValueOf(arg)) + return !truth +} + +// Comparison. + +// TODO: Perhaps allow comparison between signed and unsigned integers. + +var ( + errBadComparisonType = errors.New("invalid type for comparison") + errBadComparison = errors.New("incompatible types for comparison") + errNoComparison = errors.New("missing argument for comparison") +) + +type kind int + +const ( + invalidKind kind = iota + boolKind + complexKind + intKind + floatKind + integerKind + stringKind + uintKind +) + +func basicKind(v reflect.Value) (kind, error) { + switch v.Kind() { + case reflect.Bool: + return boolKind, nil + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return intKind, nil + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return uintKind, nil + case reflect.Float32, reflect.Float64: + return floatKind, nil + case reflect.Complex64, reflect.Complex128: + return complexKind, nil + case reflect.String: + return stringKind, nil + } + return invalidKind, errBadComparisonType +} + +// eq evaluates the comparison a == b || a == c || ... +func eq(arg1 interface{}, arg2 ...interface{}) (bool, error) { + v1 := reflect.ValueOf(arg1) + k1, err := basicKind(v1) + if err != nil { + return false, err + } + if len(arg2) == 0 { + return false, errNoComparison + } + for _, arg := range arg2 { + v2 := reflect.ValueOf(arg) + k2, err := basicKind(v2) + if err != nil { + return false, err + } + truth := false + if k1 != k2 { + // Special case: Can compare integer values regardless of type's sign. + switch { + case k1 == intKind && k2 == uintKind: + truth = v1.Int() >= 0 && uint64(v1.Int()) == v2.Uint() + case k1 == uintKind && k2 == intKind: + truth = v2.Int() >= 0 && v1.Uint() == uint64(v2.Int()) + default: + return false, errBadComparison + } + } else { + switch k1 { + case boolKind: + truth = v1.Bool() == v2.Bool() + case complexKind: + truth = v1.Complex() == v2.Complex() + case floatKind: + truth = v1.Float() == v2.Float() + case intKind: + truth = v1.Int() == v2.Int() + case stringKind: + truth = v1.String() == v2.String() + case uintKind: + truth = v1.Uint() == v2.Uint() + default: + panic("invalid kind") + } + } + if truth { + return true, nil + } + } + return false, nil +} + +// ne evaluates the comparison a != b. +func ne(arg1, arg2 interface{}) (bool, error) { + // != is the inverse of ==. + equal, err := eq(arg1, arg2) + return !equal, err +} + +// lt evaluates the comparison a < b. +func lt(arg1, arg2 interface{}) (bool, error) { + v1 := reflect.ValueOf(arg1) + k1, err := basicKind(v1) + if err != nil { + return false, err + } + v2 := reflect.ValueOf(arg2) + k2, err := basicKind(v2) + if err != nil { + return false, err + } + truth := false + if k1 != k2 { + // Special case: Can compare integer values regardless of type's sign. + switch { + case k1 == intKind && k2 == uintKind: + truth = v1.Int() < 0 || uint64(v1.Int()) < v2.Uint() + case k1 == uintKind && k2 == intKind: + truth = v2.Int() >= 0 && v1.Uint() < uint64(v2.Int()) + default: + return false, errBadComparison + } + } else { + switch k1 { + case boolKind, complexKind: + return false, errBadComparisonType + case floatKind: + truth = v1.Float() < v2.Float() + case intKind: + truth = v1.Int() < v2.Int() + case stringKind: + truth = v1.String() < v2.String() + case uintKind: + truth = v1.Uint() < v2.Uint() + default: + panic("invalid kind") + } + } + return truth, nil +} + +// le evaluates the comparison <= b. +func le(arg1, arg2 interface{}) (bool, error) { + // <= is < or ==. + lessThan, err := lt(arg1, arg2) + if lessThan || err != nil { + return lessThan, err + } + return eq(arg1, arg2) +} + +// gt evaluates the comparison a > b. +func gt(arg1, arg2 interface{}) (bool, error) { + // > is the inverse of <=. + lessOrEqual, err := le(arg1, arg2) + if err != nil { + return false, err + } + return !lessOrEqual, nil +} + +// ge evaluates the comparison a >= b. +func ge(arg1, arg2 interface{}) (bool, error) { + // >= is the inverse of <. + lessThan, err := lt(arg1, arg2) + if err != nil { + return false, err + } + return !lessThan, nil +} + +// HTML escaping. + +var ( + htmlQuot = []byte(""") // shorter than """ + htmlApos = []byte("'") // shorter than "'" and apos was not in HTML until HTML5 + htmlAmp = []byte("&") + htmlLt = []byte("<") + htmlGt = []byte(">") +) + +// HTMLEscape writes to w the escaped HTML equivalent of the plain text data b. +func HTMLEscape(w io.Writer, b []byte) { + last := 0 + for i, c := range b { + var html []byte + switch c { + case '"': + html = htmlQuot + case '\'': + html = htmlApos + case '&': + html = htmlAmp + case '<': + html = htmlLt + case '>': + html = htmlGt + default: + continue + } + w.Write(b[last:i]) + w.Write(html) + last = i + 1 + } + w.Write(b[last:]) +} + +// HTMLEscapeString returns the escaped HTML equivalent of the plain text data s. +func HTMLEscapeString(s string) string { + // Avoid allocation if we can. + if strings.IndexAny(s, `'"&<>`) < 0 { + return s + } + var b bytes.Buffer + HTMLEscape(&b, []byte(s)) + return b.String() +} + +// HTMLEscaper returns the escaped HTML equivalent of the textual +// representation of its arguments. +func HTMLEscaper(args ...interface{}) string { + return HTMLEscapeString(evalArgs(args)) +} + +// JavaScript escaping. + +var ( + jsLowUni = []byte(`\u00`) + hex = []byte("0123456789ABCDEF") + + jsBackslash = []byte(`\\`) + jsApos = []byte(`\'`) + jsQuot = []byte(`\"`) + jsLt = []byte(`\x3C`) + jsGt = []byte(`\x3E`) +) + +// JSEscape writes to w the escaped JavaScript equivalent of the plain text data b. +func JSEscape(w io.Writer, b []byte) { + last := 0 + for i := 0; i < len(b); i++ { + c := b[i] + + if !jsIsSpecial(rune(c)) { + // fast path: nothing to do + continue + } + w.Write(b[last:i]) + + if c < utf8.RuneSelf { + // Quotes, slashes and angle brackets get quoted. + // Control characters get written as \u00XX. + switch c { + case '\\': + w.Write(jsBackslash) + case '\'': + w.Write(jsApos) + case '"': + w.Write(jsQuot) + case '<': + w.Write(jsLt) + case '>': + w.Write(jsGt) + default: + w.Write(jsLowUni) + t, b := c>>4, c&0x0f + w.Write(hex[t : t+1]) + w.Write(hex[b : b+1]) + } + } else { + // Unicode rune. + r, size := utf8.DecodeRune(b[i:]) + if unicode.IsPrint(r) { + w.Write(b[i : i+size]) + } else { + fmt.Fprintf(w, "\\u%04X", r) + } + i += size - 1 + } + last = i + 1 + } + w.Write(b[last:]) +} + +// JSEscapeString returns the escaped JavaScript equivalent of the plain text data s. +func JSEscapeString(s string) string { + // Avoid allocation if we can. + if strings.IndexFunc(s, jsIsSpecial) < 0 { + return s + } + var b bytes.Buffer + JSEscape(&b, []byte(s)) + return b.String() +} + +func jsIsSpecial(r rune) bool { + switch r { + case '\\', '\'', '"', '<', '>': + return true + } + return r < ' ' || utf8.RuneSelf <= r +} + +// JSEscaper returns the escaped JavaScript equivalent of the textual +// representation of its arguments. +func JSEscaper(args ...interface{}) string { + return JSEscapeString(evalArgs(args)) +} + +// URLQueryEscaper returns the escaped value of the textual representation of +// its arguments in a form suitable for embedding in a URL query. +func URLQueryEscaper(args ...interface{}) string { + return url.QueryEscape(evalArgs(args)) +} + +// evalArgs formats the list of arguments into a string. It is therefore equivalent to +// fmt.Sprint(args...) +// except that each argument is indirected (if a pointer), as required, +// using the same rules as the default string evaluation during template +// execution. +func evalArgs(args []interface{}) string { + ok := false + var s string + // Fast path for simple common case. + if len(args) == 1 { + s, ok = args[0].(string) + } + if !ok { + for i, arg := range args { + a, ok := printableValue(reflect.ValueOf(arg)) + if ok { + args[i] = a + } // else left fmt do its thing + } + s = fmt.Sprint(args...) + } + return s +} diff --git a/vendor/github.com/alecthomas/template/helper.go b/vendor/github.com/alecthomas/template/helper.go new file mode 100644 index 000000000..3636fb54d --- /dev/null +++ b/vendor/github.com/alecthomas/template/helper.go @@ -0,0 +1,108 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Helper functions to make constructing templates easier. + +package template + +import ( + "fmt" + "io/ioutil" + "path/filepath" +) + +// Functions and methods to parse templates. + +// Must is a helper that wraps a call to a function returning (*Template, error) +// and panics if the error is non-nil. It is intended for use in variable +// initializations such as +// var t = template.Must(template.New("name").Parse("text")) +func Must(t *Template, err error) *Template { + if err != nil { + panic(err) + } + return t +} + +// ParseFiles creates a new Template and parses the template definitions from +// the named files. The returned template's name will have the (base) name and +// (parsed) contents of the first file. There must be at least one file. +// If an error occurs, parsing stops and the returned *Template is nil. +func ParseFiles(filenames ...string) (*Template, error) { + return parseFiles(nil, filenames...) +} + +// ParseFiles parses the named files and associates the resulting templates with +// t. If an error occurs, parsing stops and the returned template is nil; +// otherwise it is t. There must be at least one file. +func (t *Template) ParseFiles(filenames ...string) (*Template, error) { + return parseFiles(t, filenames...) +} + +// parseFiles is the helper for the method and function. If the argument +// template is nil, it is created from the first file. +func parseFiles(t *Template, filenames ...string) (*Template, error) { + if len(filenames) == 0 { + // Not really a problem, but be consistent. + return nil, fmt.Errorf("template: no files named in call to ParseFiles") + } + for _, filename := range filenames { + b, err := ioutil.ReadFile(filename) + if err != nil { + return nil, err + } + s := string(b) + name := filepath.Base(filename) + // First template becomes return value if not already defined, + // and we use that one for subsequent New calls to associate + // all the templates together. Also, if this file has the same name + // as t, this file becomes the contents of t, so + // t, err := New(name).Funcs(xxx).ParseFiles(name) + // works. Otherwise we create a new template associated with t. + var tmpl *Template + if t == nil { + t = New(name) + } + if name == t.Name() { + tmpl = t + } else { + tmpl = t.New(name) + } + _, err = tmpl.Parse(s) + if err != nil { + return nil, err + } + } + return t, nil +} + +// ParseGlob creates a new Template and parses the template definitions from the +// files identified by the pattern, which must match at least one file. The +// returned template will have the (base) name and (parsed) contents of the +// first file matched by the pattern. ParseGlob is equivalent to calling +// ParseFiles with the list of files matched by the pattern. +func ParseGlob(pattern string) (*Template, error) { + return parseGlob(nil, pattern) +} + +// ParseGlob parses the template definitions in the files identified by the +// pattern and associates the resulting templates with t. The pattern is +// processed by filepath.Glob and must match at least one file. ParseGlob is +// equivalent to calling t.ParseFiles with the list of files matched by the +// pattern. +func (t *Template) ParseGlob(pattern string) (*Template, error) { + return parseGlob(t, pattern) +} + +// parseGlob is the implementation of the function and method ParseGlob. +func parseGlob(t *Template, pattern string) (*Template, error) { + filenames, err := filepath.Glob(pattern) + if err != nil { + return nil, err + } + if len(filenames) == 0 { + return nil, fmt.Errorf("template: pattern matches no files: %#q", pattern) + } + return parseFiles(t, filenames...) +} diff --git a/vendor/github.com/alecthomas/template/parse/lex.go b/vendor/github.com/alecthomas/template/parse/lex.go new file mode 100644 index 000000000..55f1c051e --- /dev/null +++ b/vendor/github.com/alecthomas/template/parse/lex.go @@ -0,0 +1,556 @@ +// Copyright 2011 The Go 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 parse + +import ( + "fmt" + "strings" + "unicode" + "unicode/utf8" +) + +// item represents a token or text string returned from the scanner. +type item struct { + typ itemType // The type of this item. + pos Pos // The starting position, in bytes, of this item in the input string. + val string // The value of this item. +} + +func (i item) String() string { + switch { + case i.typ == itemEOF: + return "EOF" + case i.typ == itemError: + return i.val + case i.typ > itemKeyword: + return fmt.Sprintf("<%s>", i.val) + case len(i.val) > 10: + return fmt.Sprintf("%.10q...", i.val) + } + return fmt.Sprintf("%q", i.val) +} + +// itemType identifies the type of lex items. +type itemType int + +const ( + itemError itemType = iota // error occurred; value is text of error + itemBool // boolean constant + itemChar // printable ASCII character; grab bag for comma etc. + itemCharConstant // character constant + itemComplex // complex constant (1+2i); imaginary is just a number + itemColonEquals // colon-equals (':=') introducing a declaration + itemEOF + itemField // alphanumeric identifier starting with '.' + itemIdentifier // alphanumeric identifier not starting with '.' + itemLeftDelim // left action delimiter + itemLeftParen // '(' inside action + itemNumber // simple number, including imaginary + itemPipe // pipe symbol + itemRawString // raw quoted string (includes quotes) + itemRightDelim // right action delimiter + itemElideNewline // elide newline after right delim + itemRightParen // ')' inside action + itemSpace // run of spaces separating arguments + itemString // quoted string (includes quotes) + itemText // plain text + itemVariable // variable starting with '$', such as '$' or '$1' or '$hello' + // Keywords appear after all the rest. + itemKeyword // used only to delimit the keywords + itemDot // the cursor, spelled '.' + itemDefine // define keyword + itemElse // else keyword + itemEnd // end keyword + itemIf // if keyword + itemNil // the untyped nil constant, easiest to treat as a keyword + itemRange // range keyword + itemTemplate // template keyword + itemWith // with keyword +) + +var key = map[string]itemType{ + ".": itemDot, + "define": itemDefine, + "else": itemElse, + "end": itemEnd, + "if": itemIf, + "range": itemRange, + "nil": itemNil, + "template": itemTemplate, + "with": itemWith, +} + +const eof = -1 + +// stateFn represents the state of the scanner as a function that returns the next state. +type stateFn func(*lexer) stateFn + +// lexer holds the state of the scanner. +type lexer struct { + name string // the name of the input; used only for error reports + input string // the string being scanned + leftDelim string // start of action + rightDelim string // end of action + state stateFn // the next lexing function to enter + pos Pos // current position in the input + start Pos // start position of this item + width Pos // width of last rune read from input + lastPos Pos // position of most recent item returned by nextItem + items chan item // channel of scanned items + parenDepth int // nesting depth of ( ) exprs +} + +// next returns the next rune in the input. +func (l *lexer) next() rune { + if int(l.pos) >= len(l.input) { + l.width = 0 + return eof + } + r, w := utf8.DecodeRuneInString(l.input[l.pos:]) + l.width = Pos(w) + l.pos += l.width + return r +} + +// peek returns but does not consume the next rune in the input. +func (l *lexer) peek() rune { + r := l.next() + l.backup() + return r +} + +// backup steps back one rune. Can only be called once per call of next. +func (l *lexer) backup() { + l.pos -= l.width +} + +// emit passes an item back to the client. +func (l *lexer) emit(t itemType) { + l.items <- item{t, l.start, l.input[l.start:l.pos]} + l.start = l.pos +} + +// ignore skips over the pending input before this point. +func (l *lexer) ignore() { + l.start = l.pos +} + +// accept consumes the next rune if it's from the valid set. +func (l *lexer) accept(valid string) bool { + if strings.IndexRune(valid, l.next()) >= 0 { + return true + } + l.backup() + return false +} + +// acceptRun consumes a run of runes from the valid set. +func (l *lexer) acceptRun(valid string) { + for strings.IndexRune(valid, l.next()) >= 0 { + } + l.backup() +} + +// lineNumber reports which line we're on, based on the position of +// the previous item returned by nextItem. Doing it this way +// means we don't have to worry about peek double counting. +func (l *lexer) lineNumber() int { + return 1 + strings.Count(l.input[:l.lastPos], "\n") +} + +// errorf returns an error token and terminates the scan by passing +// back a nil pointer that will be the next state, terminating l.nextItem. +func (l *lexer) errorf(format string, args ...interface{}) stateFn { + l.items <- item{itemError, l.start, fmt.Sprintf(format, args...)} + return nil +} + +// nextItem returns the next item from the input. +func (l *lexer) nextItem() item { + item := <-l.items + l.lastPos = item.pos + return item +} + +// lex creates a new scanner for the input string. +func lex(name, input, left, right string) *lexer { + if left == "" { + left = leftDelim + } + if right == "" { + right = rightDelim + } + l := &lexer{ + name: name, + input: input, + leftDelim: left, + rightDelim: right, + items: make(chan item), + } + go l.run() + return l +} + +// run runs the state machine for the lexer. +func (l *lexer) run() { + for l.state = lexText; l.state != nil; { + l.state = l.state(l) + } +} + +// state functions + +const ( + leftDelim = "{{" + rightDelim = "}}" + leftComment = "/*" + rightComment = "*/" +) + +// lexText scans until an opening action delimiter, "{{". +func lexText(l *lexer) stateFn { + for { + if strings.HasPrefix(l.input[l.pos:], l.leftDelim) { + if l.pos > l.start { + l.emit(itemText) + } + return lexLeftDelim + } + if l.next() == eof { + break + } + } + // Correctly reached EOF. + if l.pos > l.start { + l.emit(itemText) + } + l.emit(itemEOF) + return nil +} + +// lexLeftDelim scans the left delimiter, which is known to be present. +func lexLeftDelim(l *lexer) stateFn { + l.pos += Pos(len(l.leftDelim)) + if strings.HasPrefix(l.input[l.pos:], leftComment) { + return lexComment + } + l.emit(itemLeftDelim) + l.parenDepth = 0 + return lexInsideAction +} + +// lexComment scans a comment. The left comment marker is known to be present. +func lexComment(l *lexer) stateFn { + l.pos += Pos(len(leftComment)) + i := strings.Index(l.input[l.pos:], rightComment) + if i < 0 { + return l.errorf("unclosed comment") + } + l.pos += Pos(i + len(rightComment)) + if !strings.HasPrefix(l.input[l.pos:], l.rightDelim) { + return l.errorf("comment ends before closing delimiter") + + } + l.pos += Pos(len(l.rightDelim)) + l.ignore() + return lexText +} + +// lexRightDelim scans the right delimiter, which is known to be present. +func lexRightDelim(l *lexer) stateFn { + l.pos += Pos(len(l.rightDelim)) + l.emit(itemRightDelim) + if l.peek() == '\\' { + l.pos++ + l.emit(itemElideNewline) + } + return lexText +} + +// lexInsideAction scans the elements inside action delimiters. +func lexInsideAction(l *lexer) stateFn { + // Either number, quoted string, or identifier. + // Spaces separate arguments; runs of spaces turn into itemSpace. + // Pipe symbols separate and are emitted. + if strings.HasPrefix(l.input[l.pos:], l.rightDelim+"\\") || strings.HasPrefix(l.input[l.pos:], l.rightDelim) { + if l.parenDepth == 0 { + return lexRightDelim + } + return l.errorf("unclosed left paren") + } + switch r := l.next(); { + case r == eof || isEndOfLine(r): + return l.errorf("unclosed action") + case isSpace(r): + return lexSpace + case r == ':': + if l.next() != '=' { + return l.errorf("expected :=") + } + l.emit(itemColonEquals) + case r == '|': + l.emit(itemPipe) + case r == '"': + return lexQuote + case r == '`': + return lexRawQuote + case r == '$': + return lexVariable + case r == '\'': + return lexChar + case r == '.': + // special look-ahead for ".field" so we don't break l.backup(). + if l.pos < Pos(len(l.input)) { + r := l.input[l.pos] + if r < '0' || '9' < r { + return lexField + } + } + fallthrough // '.' can start a number. + case r == '+' || r == '-' || ('0' <= r && r <= '9'): + l.backup() + return lexNumber + case isAlphaNumeric(r): + l.backup() + return lexIdentifier + case r == '(': + l.emit(itemLeftParen) + l.parenDepth++ + return lexInsideAction + case r == ')': + l.emit(itemRightParen) + l.parenDepth-- + if l.parenDepth < 0 { + return l.errorf("unexpected right paren %#U", r) + } + return lexInsideAction + case r <= unicode.MaxASCII && unicode.IsPrint(r): + l.emit(itemChar) + return lexInsideAction + default: + return l.errorf("unrecognized character in action: %#U", r) + } + return lexInsideAction +} + +// lexSpace scans a run of space characters. +// One space has already been seen. +func lexSpace(l *lexer) stateFn { + for isSpace(l.peek()) { + l.next() + } + l.emit(itemSpace) + return lexInsideAction +} + +// lexIdentifier scans an alphanumeric. +func lexIdentifier(l *lexer) stateFn { +Loop: + for { + switch r := l.next(); { + case isAlphaNumeric(r): + // absorb. + default: + l.backup() + word := l.input[l.start:l.pos] + if !l.atTerminator() { + return l.errorf("bad character %#U", r) + } + switch { + case key[word] > itemKeyword: + l.emit(key[word]) + case word[0] == '.': + l.emit(itemField) + case word == "true", word == "false": + l.emit(itemBool) + default: + l.emit(itemIdentifier) + } + break Loop + } + } + return lexInsideAction +} + +// lexField scans a field: .Alphanumeric. +// The . has been scanned. +func lexField(l *lexer) stateFn { + return lexFieldOrVariable(l, itemField) +} + +// lexVariable scans a Variable: $Alphanumeric. +// The $ has been scanned. +func lexVariable(l *lexer) stateFn { + if l.atTerminator() { // Nothing interesting follows -> "$". + l.emit(itemVariable) + return lexInsideAction + } + return lexFieldOrVariable(l, itemVariable) +} + +// lexVariable scans a field or variable: [.$]Alphanumeric. +// The . or $ has been scanned. +func lexFieldOrVariable(l *lexer, typ itemType) stateFn { + if l.atTerminator() { // Nothing interesting follows -> "." or "$". + if typ == itemVariable { + l.emit(itemVariable) + } else { + l.emit(itemDot) + } + return lexInsideAction + } + var r rune + for { + r = l.next() + if !isAlphaNumeric(r) { + l.backup() + break + } + } + if !l.atTerminator() { + return l.errorf("bad character %#U", r) + } + l.emit(typ) + return lexInsideAction +} + +// atTerminator reports whether the input is at valid termination character to +// appear after an identifier. Breaks .X.Y into two pieces. Also catches cases +// like "$x+2" not being acceptable without a space, in case we decide one +// day to implement arithmetic. +func (l *lexer) atTerminator() bool { + r := l.peek() + if isSpace(r) || isEndOfLine(r) { + return true + } + switch r { + case eof, '.', ',', '|', ':', ')', '(': + return true + } + // Does r start the delimiter? This can be ambiguous (with delim=="//", $x/2 will + // succeed but should fail) but only in extremely rare cases caused by willfully + // bad choice of delimiter. + if rd, _ := utf8.DecodeRuneInString(l.rightDelim); rd == r { + return true + } + return false +} + +// lexChar scans a character constant. The initial quote is already +// scanned. Syntax checking is done by the parser. +func lexChar(l *lexer) stateFn { +Loop: + for { + switch l.next() { + case '\\': + if r := l.next(); r != eof && r != '\n' { + break + } + fallthrough + case eof, '\n': + return l.errorf("unterminated character constant") + case '\'': + break Loop + } + } + l.emit(itemCharConstant) + return lexInsideAction +} + +// lexNumber scans a number: decimal, octal, hex, float, or imaginary. This +// isn't a perfect number scanner - for instance it accepts "." and "0x0.2" +// and "089" - but when it's wrong the input is invalid and the parser (via +// strconv) will notice. +func lexNumber(l *lexer) stateFn { + if !l.scanNumber() { + return l.errorf("bad number syntax: %q", l.input[l.start:l.pos]) + } + if sign := l.peek(); sign == '+' || sign == '-' { + // Complex: 1+2i. No spaces, must end in 'i'. + if !l.scanNumber() || l.input[l.pos-1] != 'i' { + return l.errorf("bad number syntax: %q", l.input[l.start:l.pos]) + } + l.emit(itemComplex) + } else { + l.emit(itemNumber) + } + return lexInsideAction +} + +func (l *lexer) scanNumber() bool { + // Optional leading sign. + l.accept("+-") + // Is it hex? + digits := "0123456789" + if l.accept("0") && l.accept("xX") { + digits = "0123456789abcdefABCDEF" + } + l.acceptRun(digits) + if l.accept(".") { + l.acceptRun(digits) + } + if l.accept("eE") { + l.accept("+-") + l.acceptRun("0123456789") + } + // Is it imaginary? + l.accept("i") + // Next thing mustn't be alphanumeric. + if isAlphaNumeric(l.peek()) { + l.next() + return false + } + return true +} + +// lexQuote scans a quoted string. +func lexQuote(l *lexer) stateFn { +Loop: + for { + switch l.next() { + case '\\': + if r := l.next(); r != eof && r != '\n' { + break + } + fallthrough + case eof, '\n': + return l.errorf("unterminated quoted string") + case '"': + break Loop + } + } + l.emit(itemString) + return lexInsideAction +} + +// lexRawQuote scans a raw quoted string. +func lexRawQuote(l *lexer) stateFn { +Loop: + for { + switch l.next() { + case eof, '\n': + return l.errorf("unterminated raw quoted string") + case '`': + break Loop + } + } + l.emit(itemRawString) + return lexInsideAction +} + +// isSpace reports whether r is a space character. +func isSpace(r rune) bool { + return r == ' ' || r == '\t' +} + +// isEndOfLine reports whether r is an end-of-line character. +func isEndOfLine(r rune) bool { + return r == '\r' || r == '\n' +} + +// isAlphaNumeric reports whether r is an alphabetic, digit, or underscore. +func isAlphaNumeric(r rune) bool { + return r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r) +} diff --git a/vendor/github.com/alecthomas/template/parse/node.go b/vendor/github.com/alecthomas/template/parse/node.go new file mode 100644 index 000000000..55c37f6db --- /dev/null +++ b/vendor/github.com/alecthomas/template/parse/node.go @@ -0,0 +1,834 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Parse nodes. + +package parse + +import ( + "bytes" + "fmt" + "strconv" + "strings" +) + +var textFormat = "%s" // Changed to "%q" in tests for better error messages. + +// A Node is an element in the parse tree. The interface is trivial. +// The interface contains an unexported method so that only +// types local to this package can satisfy it. +type Node interface { + Type() NodeType + String() string + // Copy does a deep copy of the Node and all its components. + // To avoid type assertions, some XxxNodes also have specialized + // CopyXxx methods that return *XxxNode. + Copy() Node + Position() Pos // byte position of start of node in full original input string + // tree returns the containing *Tree. + // It is unexported so all implementations of Node are in this package. + tree() *Tree +} + +// NodeType identifies the type of a parse tree node. +type NodeType int + +// Pos represents a byte position in the original input text from which +// this template was parsed. +type Pos int + +func (p Pos) Position() Pos { + return p +} + +// Type returns itself and provides an easy default implementation +// for embedding in a Node. Embedded in all non-trivial Nodes. +func (t NodeType) Type() NodeType { + return t +} + +const ( + NodeText NodeType = iota // Plain text. + NodeAction // A non-control action such as a field evaluation. + NodeBool // A boolean constant. + NodeChain // A sequence of field accesses. + NodeCommand // An element of a pipeline. + NodeDot // The cursor, dot. + nodeElse // An else action. Not added to tree. + nodeEnd // An end action. Not added to tree. + NodeField // A field or method name. + NodeIdentifier // An identifier; always a function name. + NodeIf // An if action. + NodeList // A list of Nodes. + NodeNil // An untyped nil constant. + NodeNumber // A numerical constant. + NodePipe // A pipeline of commands. + NodeRange // A range action. + NodeString // A string constant. + NodeTemplate // A template invocation action. + NodeVariable // A $ variable. + NodeWith // A with action. +) + +// Nodes. + +// ListNode holds a sequence of nodes. +type ListNode struct { + NodeType + Pos + tr *Tree + Nodes []Node // The element nodes in lexical order. +} + +func (t *Tree) newList(pos Pos) *ListNode { + return &ListNode{tr: t, NodeType: NodeList, Pos: pos} +} + +func (l *ListNode) append(n Node) { + l.Nodes = append(l.Nodes, n) +} + +func (l *ListNode) tree() *Tree { + return l.tr +} + +func (l *ListNode) String() string { + b := new(bytes.Buffer) + for _, n := range l.Nodes { + fmt.Fprint(b, n) + } + return b.String() +} + +func (l *ListNode) CopyList() *ListNode { + if l == nil { + return l + } + n := l.tr.newList(l.Pos) + for _, elem := range l.Nodes { + n.append(elem.Copy()) + } + return n +} + +func (l *ListNode) Copy() Node { + return l.CopyList() +} + +// TextNode holds plain text. +type TextNode struct { + NodeType + Pos + tr *Tree + Text []byte // The text; may span newlines. +} + +func (t *Tree) newText(pos Pos, text string) *TextNode { + return &TextNode{tr: t, NodeType: NodeText, Pos: pos, Text: []byte(text)} +} + +func (t *TextNode) String() string { + return fmt.Sprintf(textFormat, t.Text) +} + +func (t *TextNode) tree() *Tree { + return t.tr +} + +func (t *TextNode) Copy() Node { + return &TextNode{tr: t.tr, NodeType: NodeText, Pos: t.Pos, Text: append([]byte{}, t.Text...)} +} + +// PipeNode holds a pipeline with optional declaration +type PipeNode struct { + NodeType + Pos + tr *Tree + Line int // The line number in the input (deprecated; kept for compatibility) + Decl []*VariableNode // Variable declarations in lexical order. + Cmds []*CommandNode // The commands in lexical order. +} + +func (t *Tree) newPipeline(pos Pos, line int, decl []*VariableNode) *PipeNode { + return &PipeNode{tr: t, NodeType: NodePipe, Pos: pos, Line: line, Decl: decl} +} + +func (p *PipeNode) append(command *CommandNode) { + p.Cmds = append(p.Cmds, command) +} + +func (p *PipeNode) String() string { + s := "" + if len(p.Decl) > 0 { + for i, v := range p.Decl { + if i > 0 { + s += ", " + } + s += v.String() + } + s += " := " + } + for i, c := range p.Cmds { + if i > 0 { + s += " | " + } + s += c.String() + } + return s +} + +func (p *PipeNode) tree() *Tree { + return p.tr +} + +func (p *PipeNode) CopyPipe() *PipeNode { + if p == nil { + return p + } + var decl []*VariableNode + for _, d := range p.Decl { + decl = append(decl, d.Copy().(*VariableNode)) + } + n := p.tr.newPipeline(p.Pos, p.Line, decl) + for _, c := range p.Cmds { + n.append(c.Copy().(*CommandNode)) + } + return n +} + +func (p *PipeNode) Copy() Node { + return p.CopyPipe() +} + +// ActionNode holds an action (something bounded by delimiters). +// Control actions have their own nodes; ActionNode represents simple +// ones such as field evaluations and parenthesized pipelines. +type ActionNode struct { + NodeType + Pos + tr *Tree + Line int // The line number in the input (deprecated; kept for compatibility) + Pipe *PipeNode // The pipeline in the action. +} + +func (t *Tree) newAction(pos Pos, line int, pipe *PipeNode) *ActionNode { + return &ActionNode{tr: t, NodeType: NodeAction, Pos: pos, Line: line, Pipe: pipe} +} + +func (a *ActionNode) String() string { + return fmt.Sprintf("{{%s}}", a.Pipe) + +} + +func (a *ActionNode) tree() *Tree { + return a.tr +} + +func (a *ActionNode) Copy() Node { + return a.tr.newAction(a.Pos, a.Line, a.Pipe.CopyPipe()) + +} + +// CommandNode holds a command (a pipeline inside an evaluating action). +type CommandNode struct { + NodeType + Pos + tr *Tree + Args []Node // Arguments in lexical order: Identifier, field, or constant. +} + +func (t *Tree) newCommand(pos Pos) *CommandNode { + return &CommandNode{tr: t, NodeType: NodeCommand, Pos: pos} +} + +func (c *CommandNode) append(arg Node) { + c.Args = append(c.Args, arg) +} + +func (c *CommandNode) String() string { + s := "" + for i, arg := range c.Args { + if i > 0 { + s += " " + } + if arg, ok := arg.(*PipeNode); ok { + s += "(" + arg.String() + ")" + continue + } + s += arg.String() + } + return s +} + +func (c *CommandNode) tree() *Tree { + return c.tr +} + +func (c *CommandNode) Copy() Node { + if c == nil { + return c + } + n := c.tr.newCommand(c.Pos) + for _, c := range c.Args { + n.append(c.Copy()) + } + return n +} + +// IdentifierNode holds an identifier. +type IdentifierNode struct { + NodeType + Pos + tr *Tree + Ident string // The identifier's name. +} + +// NewIdentifier returns a new IdentifierNode with the given identifier name. +func NewIdentifier(ident string) *IdentifierNode { + return &IdentifierNode{NodeType: NodeIdentifier, Ident: ident} +} + +// SetPos sets the position. NewIdentifier is a public method so we can't modify its signature. +// Chained for convenience. +// TODO: fix one day? +func (i *IdentifierNode) SetPos(pos Pos) *IdentifierNode { + i.Pos = pos + return i +} + +// SetTree sets the parent tree for the node. NewIdentifier is a public method so we can't modify its signature. +// Chained for convenience. +// TODO: fix one day? +func (i *IdentifierNode) SetTree(t *Tree) *IdentifierNode { + i.tr = t + return i +} + +func (i *IdentifierNode) String() string { + return i.Ident +} + +func (i *IdentifierNode) tree() *Tree { + return i.tr +} + +func (i *IdentifierNode) Copy() Node { + return NewIdentifier(i.Ident).SetTree(i.tr).SetPos(i.Pos) +} + +// VariableNode holds a list of variable names, possibly with chained field +// accesses. The dollar sign is part of the (first) name. +type VariableNode struct { + NodeType + Pos + tr *Tree + Ident []string // Variable name and fields in lexical order. +} + +func (t *Tree) newVariable(pos Pos, ident string) *VariableNode { + return &VariableNode{tr: t, NodeType: NodeVariable, Pos: pos, Ident: strings.Split(ident, ".")} +} + +func (v *VariableNode) String() string { + s := "" + for i, id := range v.Ident { + if i > 0 { + s += "." + } + s += id + } + return s +} + +func (v *VariableNode) tree() *Tree { + return v.tr +} + +func (v *VariableNode) Copy() Node { + return &VariableNode{tr: v.tr, NodeType: NodeVariable, Pos: v.Pos, Ident: append([]string{}, v.Ident...)} +} + +// DotNode holds the special identifier '.'. +type DotNode struct { + NodeType + Pos + tr *Tree +} + +func (t *Tree) newDot(pos Pos) *DotNode { + return &DotNode{tr: t, NodeType: NodeDot, Pos: pos} +} + +func (d *DotNode) Type() NodeType { + // Override method on embedded NodeType for API compatibility. + // TODO: Not really a problem; could change API without effect but + // api tool complains. + return NodeDot +} + +func (d *DotNode) String() string { + return "." +} + +func (d *DotNode) tree() *Tree { + return d.tr +} + +func (d *DotNode) Copy() Node { + return d.tr.newDot(d.Pos) +} + +// NilNode holds the special identifier 'nil' representing an untyped nil constant. +type NilNode struct { + NodeType + Pos + tr *Tree +} + +func (t *Tree) newNil(pos Pos) *NilNode { + return &NilNode{tr: t, NodeType: NodeNil, Pos: pos} +} + +func (n *NilNode) Type() NodeType { + // Override method on embedded NodeType for API compatibility. + // TODO: Not really a problem; could change API without effect but + // api tool complains. + return NodeNil +} + +func (n *NilNode) String() string { + return "nil" +} + +func (n *NilNode) tree() *Tree { + return n.tr +} + +func (n *NilNode) Copy() Node { + return n.tr.newNil(n.Pos) +} + +// FieldNode holds a field (identifier starting with '.'). +// The names may be chained ('.x.y'). +// The period is dropped from each ident. +type FieldNode struct { + NodeType + Pos + tr *Tree + Ident []string // The identifiers in lexical order. +} + +func (t *Tree) newField(pos Pos, ident string) *FieldNode { + return &FieldNode{tr: t, NodeType: NodeField, Pos: pos, Ident: strings.Split(ident[1:], ".")} // [1:] to drop leading period +} + +func (f *FieldNode) String() string { + s := "" + for _, id := range f.Ident { + s += "." + id + } + return s +} + +func (f *FieldNode) tree() *Tree { + return f.tr +} + +func (f *FieldNode) Copy() Node { + return &FieldNode{tr: f.tr, NodeType: NodeField, Pos: f.Pos, Ident: append([]string{}, f.Ident...)} +} + +// ChainNode holds a term followed by a chain of field accesses (identifier starting with '.'). +// The names may be chained ('.x.y'). +// The periods are dropped from each ident. +type ChainNode struct { + NodeType + Pos + tr *Tree + Node Node + Field []string // The identifiers in lexical order. +} + +func (t *Tree) newChain(pos Pos, node Node) *ChainNode { + return &ChainNode{tr: t, NodeType: NodeChain, Pos: pos, Node: node} +} + +// Add adds the named field (which should start with a period) to the end of the chain. +func (c *ChainNode) Add(field string) { + if len(field) == 0 || field[0] != '.' { + panic("no dot in field") + } + field = field[1:] // Remove leading dot. + if field == "" { + panic("empty field") + } + c.Field = append(c.Field, field) +} + +func (c *ChainNode) String() string { + s := c.Node.String() + if _, ok := c.Node.(*PipeNode); ok { + s = "(" + s + ")" + } + for _, field := range c.Field { + s += "." + field + } + return s +} + +func (c *ChainNode) tree() *Tree { + return c.tr +} + +func (c *ChainNode) Copy() Node { + return &ChainNode{tr: c.tr, NodeType: NodeChain, Pos: c.Pos, Node: c.Node, Field: append([]string{}, c.Field...)} +} + +// BoolNode holds a boolean constant. +type BoolNode struct { + NodeType + Pos + tr *Tree + True bool // The value of the boolean constant. +} + +func (t *Tree) newBool(pos Pos, true bool) *BoolNode { + return &BoolNode{tr: t, NodeType: NodeBool, Pos: pos, True: true} +} + +func (b *BoolNode) String() string { + if b.True { + return "true" + } + return "false" +} + +func (b *BoolNode) tree() *Tree { + return b.tr +} + +func (b *BoolNode) Copy() Node { + return b.tr.newBool(b.Pos, b.True) +} + +// NumberNode holds a number: signed or unsigned integer, float, or complex. +// The value is parsed and stored under all the types that can represent the value. +// This simulates in a small amount of code the behavior of Go's ideal constants. +type NumberNode struct { + NodeType + Pos + tr *Tree + IsInt bool // Number has an integral value. + IsUint bool // Number has an unsigned integral value. + IsFloat bool // Number has a floating-point value. + IsComplex bool // Number is complex. + Int64 int64 // The signed integer value. + Uint64 uint64 // The unsigned integer value. + Float64 float64 // The floating-point value. + Complex128 complex128 // The complex value. + Text string // The original textual representation from the input. +} + +func (t *Tree) newNumber(pos Pos, text string, typ itemType) (*NumberNode, error) { + n := &NumberNode{tr: t, NodeType: NodeNumber, Pos: pos, Text: text} + switch typ { + case itemCharConstant: + rune, _, tail, err := strconv.UnquoteChar(text[1:], text[0]) + if err != nil { + return nil, err + } + if tail != "'" { + return nil, fmt.Errorf("malformed character constant: %s", text) + } + n.Int64 = int64(rune) + n.IsInt = true + n.Uint64 = uint64(rune) + n.IsUint = true + n.Float64 = float64(rune) // odd but those are the rules. + n.IsFloat = true + return n, nil + case itemComplex: + // fmt.Sscan can parse the pair, so let it do the work. + if _, err := fmt.Sscan(text, &n.Complex128); err != nil { + return nil, err + } + n.IsComplex = true + n.simplifyComplex() + return n, nil + } + // Imaginary constants can only be complex unless they are zero. + if len(text) > 0 && text[len(text)-1] == 'i' { + f, err := strconv.ParseFloat(text[:len(text)-1], 64) + if err == nil { + n.IsComplex = true + n.Complex128 = complex(0, f) + n.simplifyComplex() + return n, nil + } + } + // Do integer test first so we get 0x123 etc. + u, err := strconv.ParseUint(text, 0, 64) // will fail for -0; fixed below. + if err == nil { + n.IsUint = true + n.Uint64 = u + } + i, err := strconv.ParseInt(text, 0, 64) + if err == nil { + n.IsInt = true + n.Int64 = i + if i == 0 { + n.IsUint = true // in case of -0. + n.Uint64 = u + } + } + // If an integer extraction succeeded, promote the float. + if n.IsInt { + n.IsFloat = true + n.Float64 = float64(n.Int64) + } else if n.IsUint { + n.IsFloat = true + n.Float64 = float64(n.Uint64) + } else { + f, err := strconv.ParseFloat(text, 64) + if err == nil { + n.IsFloat = true + n.Float64 = f + // If a floating-point extraction succeeded, extract the int if needed. + if !n.IsInt && float64(int64(f)) == f { + n.IsInt = true + n.Int64 = int64(f) + } + if !n.IsUint && float64(uint64(f)) == f { + n.IsUint = true + n.Uint64 = uint64(f) + } + } + } + if !n.IsInt && !n.IsUint && !n.IsFloat { + return nil, fmt.Errorf("illegal number syntax: %q", text) + } + return n, nil +} + +// simplifyComplex pulls out any other types that are represented by the complex number. +// These all require that the imaginary part be zero. +func (n *NumberNode) simplifyComplex() { + n.IsFloat = imag(n.Complex128) == 0 + if n.IsFloat { + n.Float64 = real(n.Complex128) + n.IsInt = float64(int64(n.Float64)) == n.Float64 + if n.IsInt { + n.Int64 = int64(n.Float64) + } + n.IsUint = float64(uint64(n.Float64)) == n.Float64 + if n.IsUint { + n.Uint64 = uint64(n.Float64) + } + } +} + +func (n *NumberNode) String() string { + return n.Text +} + +func (n *NumberNode) tree() *Tree { + return n.tr +} + +func (n *NumberNode) Copy() Node { + nn := new(NumberNode) + *nn = *n // Easy, fast, correct. + return nn +} + +// StringNode holds a string constant. The value has been "unquoted". +type StringNode struct { + NodeType + Pos + tr *Tree + Quoted string // The original text of the string, with quotes. + Text string // The string, after quote processing. +} + +func (t *Tree) newString(pos Pos, orig, text string) *StringNode { + return &StringNode{tr: t, NodeType: NodeString, Pos: pos, Quoted: orig, Text: text} +} + +func (s *StringNode) String() string { + return s.Quoted +} + +func (s *StringNode) tree() *Tree { + return s.tr +} + +func (s *StringNode) Copy() Node { + return s.tr.newString(s.Pos, s.Quoted, s.Text) +} + +// endNode represents an {{end}} action. +// It does not appear in the final parse tree. +type endNode struct { + NodeType + Pos + tr *Tree +} + +func (t *Tree) newEnd(pos Pos) *endNode { + return &endNode{tr: t, NodeType: nodeEnd, Pos: pos} +} + +func (e *endNode) String() string { + return "{{end}}" +} + +func (e *endNode) tree() *Tree { + return e.tr +} + +func (e *endNode) Copy() Node { + return e.tr.newEnd(e.Pos) +} + +// elseNode represents an {{else}} action. Does not appear in the final tree. +type elseNode struct { + NodeType + Pos + tr *Tree + Line int // The line number in the input (deprecated; kept for compatibility) +} + +func (t *Tree) newElse(pos Pos, line int) *elseNode { + return &elseNode{tr: t, NodeType: nodeElse, Pos: pos, Line: line} +} + +func (e *elseNode) Type() NodeType { + return nodeElse +} + +func (e *elseNode) String() string { + return "{{else}}" +} + +func (e *elseNode) tree() *Tree { + return e.tr +} + +func (e *elseNode) Copy() Node { + return e.tr.newElse(e.Pos, e.Line) +} + +// BranchNode is the common representation of if, range, and with. +type BranchNode struct { + NodeType + Pos + tr *Tree + Line int // The line number in the input (deprecated; kept for compatibility) + Pipe *PipeNode // The pipeline to be evaluated. + List *ListNode // What to execute if the value is non-empty. + ElseList *ListNode // What to execute if the value is empty (nil if absent). +} + +func (b *BranchNode) String() string { + name := "" + switch b.NodeType { + case NodeIf: + name = "if" + case NodeRange: + name = "range" + case NodeWith: + name = "with" + default: + panic("unknown branch type") + } + if b.ElseList != nil { + return fmt.Sprintf("{{%s %s}}%s{{else}}%s{{end}}", name, b.Pipe, b.List, b.ElseList) + } + return fmt.Sprintf("{{%s %s}}%s{{end}}", name, b.Pipe, b.List) +} + +func (b *BranchNode) tree() *Tree { + return b.tr +} + +func (b *BranchNode) Copy() Node { + switch b.NodeType { + case NodeIf: + return b.tr.newIf(b.Pos, b.Line, b.Pipe, b.List, b.ElseList) + case NodeRange: + return b.tr.newRange(b.Pos, b.Line, b.Pipe, b.List, b.ElseList) + case NodeWith: + return b.tr.newWith(b.Pos, b.Line, b.Pipe, b.List, b.ElseList) + default: + panic("unknown branch type") + } +} + +// IfNode represents an {{if}} action and its commands. +type IfNode struct { + BranchNode +} + +func (t *Tree) newIf(pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) *IfNode { + return &IfNode{BranchNode{tr: t, NodeType: NodeIf, Pos: pos, Line: line, Pipe: pipe, List: list, ElseList: elseList}} +} + +func (i *IfNode) Copy() Node { + return i.tr.newIf(i.Pos, i.Line, i.Pipe.CopyPipe(), i.List.CopyList(), i.ElseList.CopyList()) +} + +// RangeNode represents a {{range}} action and its commands. +type RangeNode struct { + BranchNode +} + +func (t *Tree) newRange(pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) *RangeNode { + return &RangeNode{BranchNode{tr: t, NodeType: NodeRange, Pos: pos, Line: line, Pipe: pipe, List: list, ElseList: elseList}} +} + +func (r *RangeNode) Copy() Node { + return r.tr.newRange(r.Pos, r.Line, r.Pipe.CopyPipe(), r.List.CopyList(), r.ElseList.CopyList()) +} + +// WithNode represents a {{with}} action and its commands. +type WithNode struct { + BranchNode +} + +func (t *Tree) newWith(pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) *WithNode { + return &WithNode{BranchNode{tr: t, NodeType: NodeWith, Pos: pos, Line: line, Pipe: pipe, List: list, ElseList: elseList}} +} + +func (w *WithNode) Copy() Node { + return w.tr.newWith(w.Pos, w.Line, w.Pipe.CopyPipe(), w.List.CopyList(), w.ElseList.CopyList()) +} + +// TemplateNode represents a {{template}} action. +type TemplateNode struct { + NodeType + Pos + tr *Tree + Line int // The line number in the input (deprecated; kept for compatibility) + Name string // The name of the template (unquoted). + Pipe *PipeNode // The command to evaluate as dot for the template. +} + +func (t *Tree) newTemplate(pos Pos, line int, name string, pipe *PipeNode) *TemplateNode { + return &TemplateNode{tr: t, NodeType: NodeTemplate, Pos: pos, Line: line, Name: name, Pipe: pipe} +} + +func (t *TemplateNode) String() string { + if t.Pipe == nil { + return fmt.Sprintf("{{template %q}}", t.Name) + } + return fmt.Sprintf("{{template %q %s}}", t.Name, t.Pipe) +} + +func (t *TemplateNode) tree() *Tree { + return t.tr +} + +func (t *TemplateNode) Copy() Node { + return t.tr.newTemplate(t.Pos, t.Line, t.Name, t.Pipe.CopyPipe()) +} diff --git a/vendor/github.com/alecthomas/template/parse/parse.go b/vendor/github.com/alecthomas/template/parse/parse.go new file mode 100644 index 000000000..0d77ade87 --- /dev/null +++ b/vendor/github.com/alecthomas/template/parse/parse.go @@ -0,0 +1,700 @@ +// Copyright 2011 The Go 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 parse builds parse trees for templates as defined by text/template +// and html/template. Clients should use those packages to construct templates +// rather than this one, which provides shared internal data structures not +// intended for general use. +package parse + +import ( + "bytes" + "fmt" + "runtime" + "strconv" + "strings" +) + +// Tree is the representation of a single parsed template. +type Tree struct { + Name string // name of the template represented by the tree. + ParseName string // name of the top-level template during parsing, for error messages. + Root *ListNode // top-level root of the tree. + text string // text parsed to create the template (or its parent) + // Parsing only; cleared after parse. + funcs []map[string]interface{} + lex *lexer + token [3]item // three-token lookahead for parser. + peekCount int + vars []string // variables defined at the moment. +} + +// Copy returns a copy of the Tree. Any parsing state is discarded. +func (t *Tree) Copy() *Tree { + if t == nil { + return nil + } + return &Tree{ + Name: t.Name, + ParseName: t.ParseName, + Root: t.Root.CopyList(), + text: t.text, + } +} + +// Parse returns a map from template name to parse.Tree, created by parsing the +// templates described in the argument string. The top-level template will be +// given the specified name. If an error is encountered, parsing stops and an +// empty map is returned with the error. +func Parse(name, text, leftDelim, rightDelim string, funcs ...map[string]interface{}) (treeSet map[string]*Tree, err error) { + treeSet = make(map[string]*Tree) + t := New(name) + t.text = text + _, err = t.Parse(text, leftDelim, rightDelim, treeSet, funcs...) + return +} + +// next returns the next token. +func (t *Tree) next() item { + if t.peekCount > 0 { + t.peekCount-- + } else { + t.token[0] = t.lex.nextItem() + } + return t.token[t.peekCount] +} + +// backup backs the input stream up one token. +func (t *Tree) backup() { + t.peekCount++ +} + +// backup2 backs the input stream up two tokens. +// The zeroth token is already there. +func (t *Tree) backup2(t1 item) { + t.token[1] = t1 + t.peekCount = 2 +} + +// backup3 backs the input stream up three tokens +// The zeroth token is already there. +func (t *Tree) backup3(t2, t1 item) { // Reverse order: we're pushing back. + t.token[1] = t1 + t.token[2] = t2 + t.peekCount = 3 +} + +// peek returns but does not consume the next token. +func (t *Tree) peek() item { + if t.peekCount > 0 { + return t.token[t.peekCount-1] + } + t.peekCount = 1 + t.token[0] = t.lex.nextItem() + return t.token[0] +} + +// nextNonSpace returns the next non-space token. +func (t *Tree) nextNonSpace() (token item) { + for { + token = t.next() + if token.typ != itemSpace { + break + } + } + return token +} + +// peekNonSpace returns but does not consume the next non-space token. +func (t *Tree) peekNonSpace() (token item) { + for { + token = t.next() + if token.typ != itemSpace { + break + } + } + t.backup() + return token +} + +// Parsing. + +// New allocates a new parse tree with the given name. +func New(name string, funcs ...map[string]interface{}) *Tree { + return &Tree{ + Name: name, + funcs: funcs, + } +} + +// ErrorContext returns a textual representation of the location of the node in the input text. +// The receiver is only used when the node does not have a pointer to the tree inside, +// which can occur in old code. +func (t *Tree) ErrorContext(n Node) (location, context string) { + pos := int(n.Position()) + tree := n.tree() + if tree == nil { + tree = t + } + text := tree.text[:pos] + byteNum := strings.LastIndex(text, "\n") + if byteNum == -1 { + byteNum = pos // On first line. + } else { + byteNum++ // After the newline. + byteNum = pos - byteNum + } + lineNum := 1 + strings.Count(text, "\n") + context = n.String() + if len(context) > 20 { + context = fmt.Sprintf("%.20s...", context) + } + return fmt.Sprintf("%s:%d:%d", tree.ParseName, lineNum, byteNum), context +} + +// errorf formats the error and terminates processing. +func (t *Tree) errorf(format string, args ...interface{}) { + t.Root = nil + format = fmt.Sprintf("template: %s:%d: %s", t.ParseName, t.lex.lineNumber(), format) + panic(fmt.Errorf(format, args...)) +} + +// error terminates processing. +func (t *Tree) error(err error) { + t.errorf("%s", err) +} + +// expect consumes the next token and guarantees it has the required type. +func (t *Tree) expect(expected itemType, context string) item { + token := t.nextNonSpace() + if token.typ != expected { + t.unexpected(token, context) + } + return token +} + +// expectOneOf consumes the next token and guarantees it has one of the required types. +func (t *Tree) expectOneOf(expected1, expected2 itemType, context string) item { + token := t.nextNonSpace() + if token.typ != expected1 && token.typ != expected2 { + t.unexpected(token, context) + } + return token +} + +// unexpected complains about the token and terminates processing. +func (t *Tree) unexpected(token item, context string) { + t.errorf("unexpected %s in %s", token, context) +} + +// recover is the handler that turns panics into returns from the top level of Parse. +func (t *Tree) recover(errp *error) { + e := recover() + if e != nil { + if _, ok := e.(runtime.Error); ok { + panic(e) + } + if t != nil { + t.stopParse() + } + *errp = e.(error) + } + return +} + +// startParse initializes the parser, using the lexer. +func (t *Tree) startParse(funcs []map[string]interface{}, lex *lexer) { + t.Root = nil + t.lex = lex + t.vars = []string{"$"} + t.funcs = funcs +} + +// stopParse terminates parsing. +func (t *Tree) stopParse() { + t.lex = nil + t.vars = nil + t.funcs = nil +} + +// Parse parses the template definition string to construct a representation of +// the template for execution. If either action delimiter string is empty, the +// default ("{{" or "}}") is used. Embedded template definitions are added to +// the treeSet map. +func (t *Tree) Parse(text, leftDelim, rightDelim string, treeSet map[string]*Tree, funcs ...map[string]interface{}) (tree *Tree, err error) { + defer t.recover(&err) + t.ParseName = t.Name + t.startParse(funcs, lex(t.Name, text, leftDelim, rightDelim)) + t.text = text + t.parse(treeSet) + t.add(treeSet) + t.stopParse() + return t, nil +} + +// add adds tree to the treeSet. +func (t *Tree) add(treeSet map[string]*Tree) { + tree := treeSet[t.Name] + if tree == nil || IsEmptyTree(tree.Root) { + treeSet[t.Name] = t + return + } + if !IsEmptyTree(t.Root) { + t.errorf("template: multiple definition of template %q", t.Name) + } +} + +// IsEmptyTree reports whether this tree (node) is empty of everything but space. +func IsEmptyTree(n Node) bool { + switch n := n.(type) { + case nil: + return true + case *ActionNode: + case *IfNode: + case *ListNode: + for _, node := range n.Nodes { + if !IsEmptyTree(node) { + return false + } + } + return true + case *RangeNode: + case *TemplateNode: + case *TextNode: + return len(bytes.TrimSpace(n.Text)) == 0 + case *WithNode: + default: + panic("unknown node: " + n.String()) + } + return false +} + +// parse is the top-level parser for a template, essentially the same +// as itemList except it also parses {{define}} actions. +// It runs to EOF. +func (t *Tree) parse(treeSet map[string]*Tree) (next Node) { + t.Root = t.newList(t.peek().pos) + for t.peek().typ != itemEOF { + if t.peek().typ == itemLeftDelim { + delim := t.next() + if t.nextNonSpace().typ == itemDefine { + newT := New("definition") // name will be updated once we know it. + newT.text = t.text + newT.ParseName = t.ParseName + newT.startParse(t.funcs, t.lex) + newT.parseDefinition(treeSet) + continue + } + t.backup2(delim) + } + n := t.textOrAction() + if n.Type() == nodeEnd { + t.errorf("unexpected %s", n) + } + t.Root.append(n) + } + return nil +} + +// parseDefinition parses a {{define}} ... {{end}} template definition and +// installs the definition in the treeSet map. The "define" keyword has already +// been scanned. +func (t *Tree) parseDefinition(treeSet map[string]*Tree) { + const context = "define clause" + name := t.expectOneOf(itemString, itemRawString, context) + var err error + t.Name, err = strconv.Unquote(name.val) + if err != nil { + t.error(err) + } + t.expect(itemRightDelim, context) + var end Node + t.Root, end = t.itemList() + if end.Type() != nodeEnd { + t.errorf("unexpected %s in %s", end, context) + } + t.add(treeSet) + t.stopParse() +} + +// itemList: +// textOrAction* +// Terminates at {{end}} or {{else}}, returned separately. +func (t *Tree) itemList() (list *ListNode, next Node) { + list = t.newList(t.peekNonSpace().pos) + for t.peekNonSpace().typ != itemEOF { + n := t.textOrAction() + switch n.Type() { + case nodeEnd, nodeElse: + return list, n + } + list.append(n) + } + t.errorf("unexpected EOF") + return +} + +// textOrAction: +// text | action +func (t *Tree) textOrAction() Node { + switch token := t.nextNonSpace(); token.typ { + case itemElideNewline: + return t.elideNewline() + case itemText: + return t.newText(token.pos, token.val) + case itemLeftDelim: + return t.action() + default: + t.unexpected(token, "input") + } + return nil +} + +// elideNewline: +// Remove newlines trailing rightDelim if \\ is present. +func (t *Tree) elideNewline() Node { + token := t.peek() + if token.typ != itemText { + t.unexpected(token, "input") + return nil + } + + t.next() + stripped := strings.TrimLeft(token.val, "\n\r") + diff := len(token.val) - len(stripped) + if diff > 0 { + // This is a bit nasty. We mutate the token in-place to remove + // preceding newlines. + token.pos += Pos(diff) + token.val = stripped + } + return t.newText(token.pos, token.val) +} + +// Action: +// control +// command ("|" command)* +// Left delim is past. Now get actions. +// First word could be a keyword such as range. +func (t *Tree) action() (n Node) { + switch token := t.nextNonSpace(); token.typ { + case itemElse: + return t.elseControl() + case itemEnd: + return t.endControl() + case itemIf: + return t.ifControl() + case itemRange: + return t.rangeControl() + case itemTemplate: + return t.templateControl() + case itemWith: + return t.withControl() + } + t.backup() + // Do not pop variables; they persist until "end". + return t.newAction(t.peek().pos, t.lex.lineNumber(), t.pipeline("command")) +} + +// Pipeline: +// declarations? command ('|' command)* +func (t *Tree) pipeline(context string) (pipe *PipeNode) { + var decl []*VariableNode + pos := t.peekNonSpace().pos + // Are there declarations? + for { + if v := t.peekNonSpace(); v.typ == itemVariable { + t.next() + // Since space is a token, we need 3-token look-ahead here in the worst case: + // in "$x foo" we need to read "foo" (as opposed to ":=") to know that $x is an + // argument variable rather than a declaration. So remember the token + // adjacent to the variable so we can push it back if necessary. + tokenAfterVariable := t.peek() + if next := t.peekNonSpace(); next.typ == itemColonEquals || (next.typ == itemChar && next.val == ",") { + t.nextNonSpace() + variable := t.newVariable(v.pos, v.val) + decl = append(decl, variable) + t.vars = append(t.vars, v.val) + if next.typ == itemChar && next.val == "," { + if context == "range" && len(decl) < 2 { + continue + } + t.errorf("too many declarations in %s", context) + } + } else if tokenAfterVariable.typ == itemSpace { + t.backup3(v, tokenAfterVariable) + } else { + t.backup2(v) + } + } + break + } + pipe = t.newPipeline(pos, t.lex.lineNumber(), decl) + for { + switch token := t.nextNonSpace(); token.typ { + case itemRightDelim, itemRightParen: + if len(pipe.Cmds) == 0 { + t.errorf("missing value for %s", context) + } + if token.typ == itemRightParen { + t.backup() + } + return + case itemBool, itemCharConstant, itemComplex, itemDot, itemField, itemIdentifier, + itemNumber, itemNil, itemRawString, itemString, itemVariable, itemLeftParen: + t.backup() + pipe.append(t.command()) + default: + t.unexpected(token, context) + } + } +} + +func (t *Tree) parseControl(allowElseIf bool, context string) (pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) { + defer t.popVars(len(t.vars)) + line = t.lex.lineNumber() + pipe = t.pipeline(context) + var next Node + list, next = t.itemList() + switch next.Type() { + case nodeEnd: //done + case nodeElse: + if allowElseIf { + // Special case for "else if". If the "else" is followed immediately by an "if", + // the elseControl will have left the "if" token pending. Treat + // {{if a}}_{{else if b}}_{{end}} + // as + // {{if a}}_{{else}}{{if b}}_{{end}}{{end}}. + // To do this, parse the if as usual and stop at it {{end}}; the subsequent{{end}} + // is assumed. This technique works even for long if-else-if chains. + // TODO: Should we allow else-if in with and range? + if t.peek().typ == itemIf { + t.next() // Consume the "if" token. + elseList = t.newList(next.Position()) + elseList.append(t.ifControl()) + // Do not consume the next item - only one {{end}} required. + break + } + } + elseList, next = t.itemList() + if next.Type() != nodeEnd { + t.errorf("expected end; found %s", next) + } + } + return pipe.Position(), line, pipe, list, elseList +} + +// If: +// {{if pipeline}} itemList {{end}} +// {{if pipeline}} itemList {{else}} itemList {{end}} +// If keyword is past. +func (t *Tree) ifControl() Node { + return t.newIf(t.parseControl(true, "if")) +} + +// Range: +// {{range pipeline}} itemList {{end}} +// {{range pipeline}} itemList {{else}} itemList {{end}} +// Range keyword is past. +func (t *Tree) rangeControl() Node { + return t.newRange(t.parseControl(false, "range")) +} + +// With: +// {{with pipeline}} itemList {{end}} +// {{with pipeline}} itemList {{else}} itemList {{end}} +// If keyword is past. +func (t *Tree) withControl() Node { + return t.newWith(t.parseControl(false, "with")) +} + +// End: +// {{end}} +// End keyword is past. +func (t *Tree) endControl() Node { + return t.newEnd(t.expect(itemRightDelim, "end").pos) +} + +// Else: +// {{else}} +// Else keyword is past. +func (t *Tree) elseControl() Node { + // Special case for "else if". + peek := t.peekNonSpace() + if peek.typ == itemIf { + // We see "{{else if ... " but in effect rewrite it to {{else}}{{if ... ". + return t.newElse(peek.pos, t.lex.lineNumber()) + } + return t.newElse(t.expect(itemRightDelim, "else").pos, t.lex.lineNumber()) +} + +// Template: +// {{template stringValue pipeline}} +// Template keyword is past. The name must be something that can evaluate +// to a string. +func (t *Tree) templateControl() Node { + var name string + token := t.nextNonSpace() + switch token.typ { + case itemString, itemRawString: + s, err := strconv.Unquote(token.val) + if err != nil { + t.error(err) + } + name = s + default: + t.unexpected(token, "template invocation") + } + var pipe *PipeNode + if t.nextNonSpace().typ != itemRightDelim { + t.backup() + // Do not pop variables; they persist until "end". + pipe = t.pipeline("template") + } + return t.newTemplate(token.pos, t.lex.lineNumber(), name, pipe) +} + +// command: +// operand (space operand)* +// space-separated arguments up to a pipeline character or right delimiter. +// we consume the pipe character but leave the right delim to terminate the action. +func (t *Tree) command() *CommandNode { + cmd := t.newCommand(t.peekNonSpace().pos) + for { + t.peekNonSpace() // skip leading spaces. + operand := t.operand() + if operand != nil { + cmd.append(operand) + } + switch token := t.next(); token.typ { + case itemSpace: + continue + case itemError: + t.errorf("%s", token.val) + case itemRightDelim, itemRightParen: + t.backup() + case itemPipe: + default: + t.errorf("unexpected %s in operand; missing space?", token) + } + break + } + if len(cmd.Args) == 0 { + t.errorf("empty command") + } + return cmd +} + +// operand: +// term .Field* +// An operand is a space-separated component of a command, +// a term possibly followed by field accesses. +// A nil return means the next item is not an operand. +func (t *Tree) operand() Node { + node := t.term() + if node == nil { + return nil + } + if t.peek().typ == itemField { + chain := t.newChain(t.peek().pos, node) + for t.peek().typ == itemField { + chain.Add(t.next().val) + } + // Compatibility with original API: If the term is of type NodeField + // or NodeVariable, just put more fields on the original. + // Otherwise, keep the Chain node. + // TODO: Switch to Chains always when we can. + switch node.Type() { + case NodeField: + node = t.newField(chain.Position(), chain.String()) + case NodeVariable: + node = t.newVariable(chain.Position(), chain.String()) + default: + node = chain + } + } + return node +} + +// term: +// literal (number, string, nil, boolean) +// function (identifier) +// . +// .Field +// $ +// '(' pipeline ')' +// A term is a simple "expression". +// A nil return means the next item is not a term. +func (t *Tree) term() Node { + switch token := t.nextNonSpace(); token.typ { + case itemError: + t.errorf("%s", token.val) + case itemIdentifier: + if !t.hasFunction(token.val) { + t.errorf("function %q not defined", token.val) + } + return NewIdentifier(token.val).SetTree(t).SetPos(token.pos) + case itemDot: + return t.newDot(token.pos) + case itemNil: + return t.newNil(token.pos) + case itemVariable: + return t.useVar(token.pos, token.val) + case itemField: + return t.newField(token.pos, token.val) + case itemBool: + return t.newBool(token.pos, token.val == "true") + case itemCharConstant, itemComplex, itemNumber: + number, err := t.newNumber(token.pos, token.val, token.typ) + if err != nil { + t.error(err) + } + return number + case itemLeftParen: + pipe := t.pipeline("parenthesized pipeline") + if token := t.next(); token.typ != itemRightParen { + t.errorf("unclosed right paren: unexpected %s", token) + } + return pipe + case itemString, itemRawString: + s, err := strconv.Unquote(token.val) + if err != nil { + t.error(err) + } + return t.newString(token.pos, token.val, s) + } + t.backup() + return nil +} + +// hasFunction reports if a function name exists in the Tree's maps. +func (t *Tree) hasFunction(name string) bool { + for _, funcMap := range t.funcs { + if funcMap == nil { + continue + } + if funcMap[name] != nil { + return true + } + } + return false +} + +// popVars trims the variable list to the specified length +func (t *Tree) popVars(n int) { + t.vars = t.vars[:n] +} + +// useVar returns a node for a variable reference. It errors if the +// variable is not defined. +func (t *Tree) useVar(pos Pos, name string) Node { + v := t.newVariable(pos, name) + for _, varName := range t.vars { + if varName == v.Ident[0] { + return v + } + } + t.errorf("undefined variable %q", v.Ident[0]) + return nil +} diff --git a/vendor/github.com/alecthomas/template/template.go b/vendor/github.com/alecthomas/template/template.go new file mode 100644 index 000000000..447ed2aba --- /dev/null +++ b/vendor/github.com/alecthomas/template/template.go @@ -0,0 +1,218 @@ +// Copyright 2011 The Go 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 template + +import ( + "fmt" + "reflect" + + "github.com/alecthomas/template/parse" +) + +// common holds the information shared by related templates. +type common struct { + tmpl map[string]*Template + // We use two maps, one for parsing and one for execution. + // This separation makes the API cleaner since it doesn't + // expose reflection to the client. + parseFuncs FuncMap + execFuncs map[string]reflect.Value +} + +// Template is the representation of a parsed template. The *parse.Tree +// field is exported only for use by html/template and should be treated +// as unexported by all other clients. +type Template struct { + name string + *parse.Tree + *common + leftDelim string + rightDelim string +} + +// New allocates a new template with the given name. +func New(name string) *Template { + return &Template{ + name: name, + } +} + +// Name returns the name of the template. +func (t *Template) Name() string { + return t.name +} + +// New allocates a new template associated with the given one and with the same +// delimiters. The association, which is transitive, allows one template to +// invoke another with a {{template}} action. +func (t *Template) New(name string) *Template { + t.init() + return &Template{ + name: name, + common: t.common, + leftDelim: t.leftDelim, + rightDelim: t.rightDelim, + } +} + +func (t *Template) init() { + if t.common == nil { + t.common = new(common) + t.tmpl = make(map[string]*Template) + t.parseFuncs = make(FuncMap) + t.execFuncs = make(map[string]reflect.Value) + } +} + +// Clone returns a duplicate of the template, including all associated +// templates. The actual representation is not copied, but the name space of +// associated templates is, so further calls to Parse in the copy will add +// templates to the copy but not to the original. Clone can be used to prepare +// common templates and use them with variant definitions for other templates +// by adding the variants after the clone is made. +func (t *Template) Clone() (*Template, error) { + nt := t.copy(nil) + nt.init() + nt.tmpl[t.name] = nt + for k, v := range t.tmpl { + if k == t.name { // Already installed. + continue + } + // The associated templates share nt's common structure. + tmpl := v.copy(nt.common) + nt.tmpl[k] = tmpl + } + for k, v := range t.parseFuncs { + nt.parseFuncs[k] = v + } + for k, v := range t.execFuncs { + nt.execFuncs[k] = v + } + return nt, nil +} + +// copy returns a shallow copy of t, with common set to the argument. +func (t *Template) copy(c *common) *Template { + nt := New(t.name) + nt.Tree = t.Tree + nt.common = c + nt.leftDelim = t.leftDelim + nt.rightDelim = t.rightDelim + return nt +} + +// AddParseTree creates a new template with the name and parse tree +// and associates it with t. +func (t *Template) AddParseTree(name string, tree *parse.Tree) (*Template, error) { + if t.common != nil && t.tmpl[name] != nil { + return nil, fmt.Errorf("template: redefinition of template %q", name) + } + nt := t.New(name) + nt.Tree = tree + t.tmpl[name] = nt + return nt, nil +} + +// Templates returns a slice of the templates associated with t, including t +// itself. +func (t *Template) Templates() []*Template { + if t.common == nil { + return nil + } + // Return a slice so we don't expose the map. + m := make([]*Template, 0, len(t.tmpl)) + for _, v := range t.tmpl { + m = append(m, v) + } + return m +} + +// Delims sets the action delimiters to the specified strings, to be used in +// subsequent calls to Parse, ParseFiles, or ParseGlob. Nested template +// definitions will inherit the settings. An empty delimiter stands for the +// corresponding default: {{ or }}. +// The return value is the template, so calls can be chained. +func (t *Template) Delims(left, right string) *Template { + t.leftDelim = left + t.rightDelim = right + return t +} + +// Funcs adds the elements of the argument map to the template's function map. +// It panics if a value in the map is not a function with appropriate return +// type. However, it is legal to overwrite elements of the map. The return +// value is the template, so calls can be chained. +func (t *Template) Funcs(funcMap FuncMap) *Template { + t.init() + addValueFuncs(t.execFuncs, funcMap) + addFuncs(t.parseFuncs, funcMap) + return t +} + +// Lookup returns the template with the given name that is associated with t, +// or nil if there is no such template. +func (t *Template) Lookup(name string) *Template { + if t.common == nil { + return nil + } + return t.tmpl[name] +} + +// Parse parses a string into a template. Nested template definitions will be +// associated with the top-level template t. Parse may be called multiple times +// to parse definitions of templates to associate with t. It is an error if a +// resulting template is non-empty (contains content other than template +// definitions) and would replace a non-empty template with the same name. +// (In multiple calls to Parse with the same receiver template, only one call +// can contain text other than space, comments, and template definitions.) +func (t *Template) Parse(text string) (*Template, error) { + t.init() + trees, err := parse.Parse(t.name, text, t.leftDelim, t.rightDelim, t.parseFuncs, builtins) + if err != nil { + return nil, err + } + // Add the newly parsed trees, including the one for t, into our common structure. + for name, tree := range trees { + // If the name we parsed is the name of this template, overwrite this template. + // The associate method checks it's not a redefinition. + tmpl := t + if name != t.name { + tmpl = t.New(name) + } + // Even if t == tmpl, we need to install it in the common.tmpl map. + if replace, err := t.associate(tmpl, tree); err != nil { + return nil, err + } else if replace { + tmpl.Tree = tree + } + tmpl.leftDelim = t.leftDelim + tmpl.rightDelim = t.rightDelim + } + return t, nil +} + +// associate installs the new template into the group of templates associated +// with t. It is an error to reuse a name except to overwrite an empty +// template. The two are already known to share the common structure. +// The boolean return value reports wither to store this tree as t.Tree. +func (t *Template) associate(new *Template, tree *parse.Tree) (bool, error) { + if new.common != t.common { + panic("internal error: associate not common") + } + name := new.name + if old := t.tmpl[name]; old != nil { + oldIsEmpty := parse.IsEmptyTree(old.Root) + newIsEmpty := parse.IsEmptyTree(tree.Root) + if newIsEmpty { + // Whether old is empty or not, new is empty; no reason to replace old. + return false, nil + } + if !oldIsEmpty { + return false, fmt.Errorf("template: redefinition of template %q", name) + } + } + t.tmpl[name] = new + return true, nil +} diff --git a/vendor/github.com/alecthomas/units/COPYING b/vendor/github.com/alecthomas/units/COPYING new file mode 100644 index 000000000..2993ec085 --- /dev/null +++ b/vendor/github.com/alecthomas/units/COPYING @@ -0,0 +1,19 @@ +Copyright (C) 2014 Alec Thomas + +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/alecthomas/units/bytes.go b/vendor/github.com/alecthomas/units/bytes.go new file mode 100644 index 000000000..eaadeb800 --- /dev/null +++ b/vendor/github.com/alecthomas/units/bytes.go @@ -0,0 +1,83 @@ +package units + +// Base2Bytes is the old non-SI power-of-2 byte scale (1024 bytes in a kilobyte, +// etc.). +type Base2Bytes int64 + +// Base-2 byte units. +const ( + Kibibyte Base2Bytes = 1024 + KiB = Kibibyte + Mebibyte = Kibibyte * 1024 + MiB = Mebibyte + Gibibyte = Mebibyte * 1024 + GiB = Gibibyte + Tebibyte = Gibibyte * 1024 + TiB = Tebibyte + Pebibyte = Tebibyte * 1024 + PiB = Pebibyte + Exbibyte = Pebibyte * 1024 + EiB = Exbibyte +) + +var ( + bytesUnitMap = MakeUnitMap("iB", "B", 1024) + oldBytesUnitMap = MakeUnitMap("B", "B", 1024) +) + +// ParseBase2Bytes supports both iB and B in base-2 multipliers. That is, KB +// and KiB are both 1024. +func ParseBase2Bytes(s string) (Base2Bytes, error) { + n, err := ParseUnit(s, bytesUnitMap) + if err != nil { + n, err = ParseUnit(s, oldBytesUnitMap) + } + return Base2Bytes(n), err +} + +func (b Base2Bytes) String() string { + return ToString(int64(b), 1024, "iB", "B") +} + +var ( + metricBytesUnitMap = MakeUnitMap("B", "B", 1000) +) + +// MetricBytes are SI byte units (1000 bytes in a kilobyte). +type MetricBytes SI + +// SI base-10 byte units. +const ( + Kilobyte MetricBytes = 1000 + KB = Kilobyte + Megabyte = Kilobyte * 1000 + MB = Megabyte + Gigabyte = Megabyte * 1000 + GB = Gigabyte + Terabyte = Gigabyte * 1000 + TB = Terabyte + Petabyte = Terabyte * 1000 + PB = Petabyte + Exabyte = Petabyte * 1000 + EB = Exabyte +) + +// ParseMetricBytes parses base-10 metric byte units. That is, KB is 1000 bytes. +func ParseMetricBytes(s string) (MetricBytes, error) { + n, err := ParseUnit(s, metricBytesUnitMap) + return MetricBytes(n), err +} + +func (m MetricBytes) String() string { + return ToString(int64(m), 1000, "B", "B") +} + +// ParseStrictBytes supports both iB and B suffixes for base 2 and metric, +// respectively. That is, KiB represents 1024 and KB represents 1000. +func ParseStrictBytes(s string) (int64, error) { + n, err := ParseUnit(s, bytesUnitMap) + if err != nil { + n, err = ParseUnit(s, metricBytesUnitMap) + } + return int64(n), err +} diff --git a/vendor/github.com/alecthomas/units/doc.go b/vendor/github.com/alecthomas/units/doc.go new file mode 100644 index 000000000..156ae3867 --- /dev/null +++ b/vendor/github.com/alecthomas/units/doc.go @@ -0,0 +1,13 @@ +// Package units provides helpful unit multipliers and functions for Go. +// +// The goal of this package is to have functionality similar to the time [1] package. +// +// +// [1] http://golang.org/pkg/time/ +// +// It allows for code like this: +// +// n, err := ParseBase2Bytes("1KB") +// // n == 1024 +// n = units.Mebibyte * 512 +package units diff --git a/vendor/github.com/alecthomas/units/si.go b/vendor/github.com/alecthomas/units/si.go new file mode 100644 index 000000000..8234a9d52 --- /dev/null +++ b/vendor/github.com/alecthomas/units/si.go @@ -0,0 +1,26 @@ +package units + +// SI units. +type SI int64 + +// SI unit multiples. +const ( + Kilo SI = 1000 + Mega = Kilo * 1000 + Giga = Mega * 1000 + Tera = Giga * 1000 + Peta = Tera * 1000 + Exa = Peta * 1000 +) + +func MakeUnitMap(suffix, shortSuffix string, scale int64) map[string]float64 { + return map[string]float64{ + shortSuffix: 1, + "K" + suffix: float64(scale), + "M" + suffix: float64(scale * scale), + "G" + suffix: float64(scale * scale * scale), + "T" + suffix: float64(scale * scale * scale * scale), + "P" + suffix: float64(scale * scale * scale * scale * scale), + "E" + suffix: float64(scale * scale * scale * scale * scale * scale), + } +} diff --git a/vendor/github.com/alecthomas/units/util.go b/vendor/github.com/alecthomas/units/util.go new file mode 100644 index 000000000..6527e92d1 --- /dev/null +++ b/vendor/github.com/alecthomas/units/util.go @@ -0,0 +1,138 @@ +package units + +import ( + "errors" + "fmt" + "strings" +) + +var ( + siUnits = []string{"", "K", "M", "G", "T", "P", "E"} +) + +func ToString(n int64, scale int64, suffix, baseSuffix string) string { + mn := len(siUnits) + out := make([]string, mn) + for i, m := range siUnits { + if n%scale != 0 || i == 0 && n == 0 { + s := suffix + if i == 0 { + s = baseSuffix + } + out[mn-1-i] = fmt.Sprintf("%d%s%s", n%scale, m, s) + } + n /= scale + if n == 0 { + break + } + } + return strings.Join(out, "") +} + +// Below code ripped straight from http://golang.org/src/pkg/time/format.go?s=33392:33438#L1123 +var errLeadingInt = errors.New("units: bad [0-9]*") // never printed + +// leadingInt consumes the leading [0-9]* from s. +func leadingInt(s string) (x int64, rem string, err error) { + i := 0 + for ; i < len(s); i++ { + c := s[i] + if c < '0' || c > '9' { + break + } + if x >= (1<<63-10)/10 { + // overflow + return 0, "", errLeadingInt + } + x = x*10 + int64(c) - '0' + } + return x, s[i:], nil +} + +func ParseUnit(s string, unitMap map[string]float64) (int64, error) { + // [-+]?([0-9]*(\.[0-9]*)?[a-z]+)+ + orig := s + f := float64(0) + neg := false + + // Consume [-+]? + if s != "" { + c := s[0] + if c == '-' || c == '+' { + neg = c == '-' + s = s[1:] + } + } + // Special case: if all that is left is "0", this is zero. + if s == "0" { + return 0, nil + } + if s == "" { + return 0, errors.New("units: invalid " + orig) + } + for s != "" { + g := float64(0) // this element of the sequence + + var x int64 + var err error + + // The next character must be [0-9.] + if !(s[0] == '.' || ('0' <= s[0] && s[0] <= '9')) { + return 0, errors.New("units: invalid " + orig) + } + // Consume [0-9]* + pl := len(s) + x, s, err = leadingInt(s) + if err != nil { + return 0, errors.New("units: invalid " + orig) + } + g = float64(x) + pre := pl != len(s) // whether we consumed anything before a period + + // Consume (\.[0-9]*)? + post := false + if s != "" && s[0] == '.' { + s = s[1:] + pl := len(s) + x, s, err = leadingInt(s) + if err != nil { + return 0, errors.New("units: invalid " + orig) + } + scale := 1.0 + for n := pl - len(s); n > 0; n-- { + scale *= 10 + } + g += float64(x) / scale + post = pl != len(s) + } + if !pre && !post { + // no digits (e.g. ".s" or "-.s") + return 0, errors.New("units: invalid " + orig) + } + + // Consume unit. + i := 0 + for ; i < len(s); i++ { + c := s[i] + if c == '.' || ('0' <= c && c <= '9') { + break + } + } + u := s[:i] + s = s[i:] + unit, ok := unitMap[u] + if !ok { + return 0, errors.New("units: unknown unit " + u + " in " + orig) + } + + f += g * unit + } + + if neg { + f = -f + } + if f < float64(-1<<63) || f > float64(1<<63-1) { + return 0, errors.New("units: overflow parsing unit") + } + return int64(f), nil +} diff --git a/vendor/github.com/go-kit/kit/log/LICENSE b/vendor/github.com/go-kit/kit/log/LICENSE new file mode 100644 index 000000000..9d83342ac --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Peter Bourgon + +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/go-kit/kit/log/deprecated_levels/levels.go b/vendor/github.com/go-kit/kit/log/deprecated_levels/levels.go new file mode 100644 index 000000000..a03421277 --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/deprecated_levels/levels.go @@ -0,0 +1,127 @@ +package levels + +import "github.com/go-kit/kit/log" + +// Levels provides a leveled logging wrapper around a logger. It has five +// levels: debug, info, warning (warn), error, and critical (crit). If you +// want a different set of levels, you can create your own levels type very +// easily, and you can elide the configuration. +type Levels struct { + logger log.Logger + levelKey string + + // We have a choice between storing level values in string fields or + // making a separate context for each level. When using string fields the + // Log method must combine the base context, the level data, and the + // logged keyvals; but the With method only requires updating one context. + // If we instead keep a separate context for each level the Log method + // must only append the new keyvals; but the With method would have to + // update all five contexts. + + // Roughly speaking, storing multiple contexts breaks even if the ratio of + // Log/With calls is more than the number of levels. We have chosen to + // make the With method cheap and the Log method a bit more costly because + // we do not expect most applications to Log more than five times for each + // call to With. + + debugValue string + infoValue string + warnValue string + errorValue string + critValue string +} + +// New creates a new leveled logger, wrapping the passed logger. +func New(logger log.Logger, options ...Option) Levels { + l := Levels{ + logger: logger, + levelKey: "level", + + debugValue: "debug", + infoValue: "info", + warnValue: "warn", + errorValue: "error", + critValue: "crit", + } + for _, option := range options { + option(&l) + } + return l +} + +// With returns a new leveled logger that includes keyvals in all log events. +func (l Levels) With(keyvals ...interface{}) Levels { + return Levels{ + logger: log.With(l.logger, keyvals...), + levelKey: l.levelKey, + debugValue: l.debugValue, + infoValue: l.infoValue, + warnValue: l.warnValue, + errorValue: l.errorValue, + critValue: l.critValue, + } +} + +// Debug returns a debug level logger. +func (l Levels) Debug() log.Logger { + return log.WithPrefix(l.logger, l.levelKey, l.debugValue) +} + +// Info returns an info level logger. +func (l Levels) Info() log.Logger { + return log.WithPrefix(l.logger, l.levelKey, l.infoValue) +} + +// Warn returns a warning level logger. +func (l Levels) Warn() log.Logger { + return log.WithPrefix(l.logger, l.levelKey, l.warnValue) +} + +// Error returns an error level logger. +func (l Levels) Error() log.Logger { + return log.WithPrefix(l.logger, l.levelKey, l.errorValue) +} + +// Crit returns a critical level logger. +func (l Levels) Crit() log.Logger { + return log.WithPrefix(l.logger, l.levelKey, l.critValue) +} + +// Option sets a parameter for leveled loggers. +type Option func(*Levels) + +// Key sets the key for the field used to indicate log level. By default, +// the key is "level". +func Key(key string) Option { + return func(l *Levels) { l.levelKey = key } +} + +// DebugValue sets the value for the field used to indicate the debug log +// level. By default, the value is "debug". +func DebugValue(value string) Option { + return func(l *Levels) { l.debugValue = value } +} + +// InfoValue sets the value for the field used to indicate the info log level. +// By default, the value is "info". +func InfoValue(value string) Option { + return func(l *Levels) { l.infoValue = value } +} + +// WarnValue sets the value for the field used to indicate the warning log +// level. By default, the value is "warn". +func WarnValue(value string) Option { + return func(l *Levels) { l.warnValue = value } +} + +// ErrorValue sets the value for the field used to indicate the error log +// level. By default, the value is "error". +func ErrorValue(value string) Option { + return func(l *Levels) { l.errorValue = value } +} + +// CritValue sets the value for the field used to indicate the critical log +// level. By default, the value is "crit". +func CritValue(value string) Option { + return func(l *Levels) { l.critValue = value } +} diff --git a/vendor/github.com/go-kit/kit/log/doc.go b/vendor/github.com/go-kit/kit/log/doc.go new file mode 100644 index 000000000..918c0af46 --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/doc.go @@ -0,0 +1,116 @@ +// Package log provides a structured logger. +// +// Structured logging produces logs easily consumed later by humans or +// machines. Humans might be interested in debugging errors, or tracing +// specific requests. Machines might be interested in counting interesting +// events, or aggregating information for off-line processing. In both cases, +// it is important that the log messages are structured and actionable. +// Package log is designed to encourage both of these best practices. +// +// Basic Usage +// +// The fundamental interface is Logger. Loggers create log events from +// key/value data. The Logger interface has a single method, Log, which +// accepts a sequence of alternating key/value pairs, which this package names +// keyvals. +// +// type Logger interface { +// Log(keyvals ...interface{}) error +// } +// +// Here is an example of a function using a Logger to create log events. +// +// func RunTask(task Task, logger log.Logger) string { +// logger.Log("taskID", task.ID, "event", "starting task") +// ... +// logger.Log("taskID", task.ID, "event", "task complete") +// } +// +// The keys in the above example are "taskID" and "event". The values are +// task.ID, "starting task", and "task complete". Every key is followed +// immediately by its value. +// +// Keys are usually plain strings. Values may be any type that has a sensible +// encoding in the chosen log format. With structured logging it is a good +// idea to log simple values without formatting them. This practice allows +// the chosen logger to encode values in the most appropriate way. +// +// Contextual Loggers +// +// A contextual logger stores keyvals that it includes in all log events. +// Building appropriate contextual loggers reduces repetition and aids +// consistency in the resulting log output. With and WithPrefix add context to +// a logger. We can use With to improve the RunTask example. +// +// func RunTask(task Task, logger log.Logger) string { +// logger = log.With(logger, "taskID", task.ID) +// logger.Log("event", "starting task") +// ... +// taskHelper(task.Cmd, logger) +// ... +// logger.Log("event", "task complete") +// } +// +// The improved version emits the same log events as the original for the +// first and last calls to Log. Passing the contextual logger to taskHelper +// enables each log event created by taskHelper to include the task.ID even +// though taskHelper does not have access to that value. Using contextual +// loggers this way simplifies producing log output that enables tracing the +// life cycle of individual tasks. (See the Contextual example for the full +// code of the above snippet.) +// +// Dynamic Contextual Values +// +// A Valuer function stored in a contextual logger generates a new value each +// time an event is logged. The Valuer example demonstrates how this feature +// works. +// +// Valuers provide the basis for consistently logging timestamps and source +// code location. The log package defines several valuers for that purpose. +// See Timestamp, DefaultTimestamp, DefaultTimestampUTC, Caller, and +// DefaultCaller. A common logger initialization sequence that ensures all log +// entries contain a timestamp and source location looks like this: +// +// logger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout)) +// logger = log.With(logger, "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller) +// +// Concurrent Safety +// +// Applications with multiple goroutines want each log event written to the +// same logger to remain separate from other log events. Package log provides +// two simple solutions for concurrent safe logging. +// +// NewSyncWriter wraps an io.Writer and serializes each call to its Write +// method. Using a SyncWriter has the benefit that the smallest practical +// portion of the logging logic is performed within a mutex, but it requires +// the formatting Logger to make only one call to Write per log event. +// +// NewSyncLogger wraps any Logger and serializes each call to its Log method. +// Using a SyncLogger has the benefit that it guarantees each log event is +// handled atomically within the wrapped logger, but it typically serializes +// both the formatting and output logic. Use a SyncLogger if the formatting +// logger may perform multiple writes per log event. +// +// Error Handling +// +// This package relies on the practice of wrapping or decorating loggers with +// other loggers to provide composable pieces of functionality. It also means +// that Logger.Log must return an error because some +// implementations—especially those that output log data to an io.Writer—may +// encounter errors that cannot be handled locally. This in turn means that +// Loggers that wrap other loggers should return errors from the wrapped +// logger up the stack. +// +// Fortunately, the decorator pattern also provides a way to avoid the +// necessity to check for errors every time an application calls Logger.Log. +// An application required to panic whenever its Logger encounters +// an error could initialize its logger as follows. +// +// fmtlogger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout)) +// logger := log.LoggerFunc(func(keyvals ...interface{}) error { +// if err := fmtlogger.Log(keyvals...); err != nil { +// panic(err) +// } +// return nil +// }) +package log diff --git a/vendor/github.com/go-kit/kit/log/json_logger.go b/vendor/github.com/go-kit/kit/log/json_logger.go new file mode 100644 index 000000000..66094b4dd --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/json_logger.go @@ -0,0 +1,89 @@ +package log + +import ( + "encoding" + "encoding/json" + "fmt" + "io" + "reflect" +) + +type jsonLogger struct { + io.Writer +} + +// NewJSONLogger returns a Logger that encodes keyvals to the Writer as a +// single JSON object. Each log event produces no more than one call to +// w.Write. The passed Writer must be safe for concurrent use by multiple +// goroutines if the returned Logger will be used concurrently. +func NewJSONLogger(w io.Writer) Logger { + return &jsonLogger{w} +} + +func (l *jsonLogger) Log(keyvals ...interface{}) error { + n := (len(keyvals) + 1) / 2 // +1 to handle case when len is odd + m := make(map[string]interface{}, n) + for i := 0; i < len(keyvals); i += 2 { + k := keyvals[i] + var v interface{} = ErrMissingValue + if i+1 < len(keyvals) { + v = keyvals[i+1] + } + merge(m, k, v) + } + return json.NewEncoder(l.Writer).Encode(m) +} + +func merge(dst map[string]interface{}, k, v interface{}) { + var key string + switch x := k.(type) { + case string: + key = x + case fmt.Stringer: + key = safeString(x) + default: + key = fmt.Sprint(x) + } + + // We want json.Marshaler and encoding.TextMarshaller to take priority over + // err.Error() and v.String(). But json.Marshall (called later) does that by + // default so we force a no-op if it's one of those 2 case. + switch x := v.(type) { + case json.Marshaler: + case encoding.TextMarshaler: + case error: + v = safeError(x) + case fmt.Stringer: + v = safeString(x) + } + + dst[key] = v +} + +func safeString(str fmt.Stringer) (s string) { + defer func() { + if panicVal := recover(); panicVal != nil { + if v := reflect.ValueOf(str); v.Kind() == reflect.Ptr && v.IsNil() { + s = "NULL" + } else { + panic(panicVal) + } + } + }() + s = str.String() + return +} + +func safeError(err error) (s interface{}) { + defer func() { + if panicVal := recover(); panicVal != nil { + if v := reflect.ValueOf(err); v.Kind() == reflect.Ptr && v.IsNil() { + s = nil + } else { + panic(panicVal) + } + } + }() + s = err.Error() + return +} diff --git a/vendor/github.com/go-kit/kit/log/level/doc.go b/vendor/github.com/go-kit/kit/log/level/doc.go new file mode 100644 index 000000000..5e9df7fa1 --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/level/doc.go @@ -0,0 +1,22 @@ +// Package level implements leveled logging on top of package log. To use the +// level package, create a logger as per normal in your func main, and wrap it +// with level.NewFilter. +// +// var logger log.Logger +// logger = log.NewLogfmtLogger(os.Stderr) +// logger = level.NewFilter(logger, level.AllowInfoAndAbove()) // <-- +// logger = log.With(logger, "ts", log.DefaultTimestampUTC) +// +// Then, at the callsites, use one of the level.Debug, Info, Warn, or Error +// helper methods to emit leveled log events. +// +// logger.Log("foo", "bar") // as normal, no level +// level.Debug(logger).Log("request_id", reqID, "trace_data", trace.Get()) +// if value > 100 { +// level.Error(logger).Log("value", value) +// } +// +// NewFilter allows precise control over what happens when a log event is +// emitted without a level key, or if a squelched level is used. Check the +// Option functions for details. +package level diff --git a/vendor/github.com/go-kit/kit/log/level/level.go b/vendor/github.com/go-kit/kit/log/level/level.go new file mode 100644 index 000000000..6833b0dca --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/level/level.go @@ -0,0 +1,205 @@ +package level + +import "github.com/go-kit/kit/log" + +// Error returns a logger that includes a Key/ErrorValue pair. +func Error(logger log.Logger) log.Logger { + return log.WithPrefix(logger, Key(), ErrorValue()) +} + +// Warn returns a logger that includes a Key/WarnValue pair. +func Warn(logger log.Logger) log.Logger { + return log.WithPrefix(logger, Key(), WarnValue()) +} + +// Info returns a logger that includes a Key/InfoValue pair. +func Info(logger log.Logger) log.Logger { + return log.WithPrefix(logger, Key(), InfoValue()) +} + +// Debug returns a logger that includes a Key/DebugValue pair. +func Debug(logger log.Logger) log.Logger { + return log.WithPrefix(logger, Key(), DebugValue()) +} + +// NewFilter wraps next and implements level filtering. See the commentary on +// the Option functions for a detailed description of how to configure levels. +// If no options are provided, all leveled log events created with Debug, +// Info, Warn or Error helper methods are squelched and non-leveled log +// events are passed to next unmodified. +func NewFilter(next log.Logger, options ...Option) log.Logger { + l := &logger{ + next: next, + } + for _, option := range options { + option(l) + } + return l +} + +type logger struct { + next log.Logger + allowed level + squelchNoLevel bool + errNotAllowed error + errNoLevel error +} + +func (l *logger) Log(keyvals ...interface{}) error { + var hasLevel, levelAllowed bool + for i := 1; i < len(keyvals); i += 2 { + if v, ok := keyvals[i].(*levelValue); ok { + hasLevel = true + levelAllowed = l.allowed&v.level != 0 + break + } + } + if !hasLevel && l.squelchNoLevel { + return l.errNoLevel + } + if hasLevel && !levelAllowed { + return l.errNotAllowed + } + return l.next.Log(keyvals...) +} + +// Option sets a parameter for the leveled logger. +type Option func(*logger) + +// AllowAll is an alias for AllowDebug. +func AllowAll() Option { + return AllowDebug() +} + +// AllowDebug allows error, warn, info and debug level log events to pass. +func AllowDebug() Option { + return allowed(levelError | levelWarn | levelInfo | levelDebug) +} + +// AllowInfo allows error, warn and info level log events to pass. +func AllowInfo() Option { + return allowed(levelError | levelWarn | levelInfo) +} + +// AllowWarn allows error and warn level log events to pass. +func AllowWarn() Option { + return allowed(levelError | levelWarn) +} + +// AllowError allows only error level log events to pass. +func AllowError() Option { + return allowed(levelError) +} + +// AllowNone allows no leveled log events to pass. +func AllowNone() Option { + return allowed(0) +} + +func allowed(allowed level) Option { + return func(l *logger) { l.allowed = allowed } +} + +// ErrNotAllowed sets the error to return from Log when it squelches a log +// event disallowed by the configured Allow[Level] option. By default, +// ErrNotAllowed is nil; in this case the log event is squelched with no +// error. +func ErrNotAllowed(err error) Option { + return func(l *logger) { l.errNotAllowed = err } +} + +// SquelchNoLevel instructs Log to squelch log events with no level, so that +// they don't proceed through to the wrapped logger. If SquelchNoLevel is set +// to true and a log event is squelched in this way, the error value +// configured with ErrNoLevel is returned to the caller. +func SquelchNoLevel(squelch bool) Option { + return func(l *logger) { l.squelchNoLevel = squelch } +} + +// ErrNoLevel sets the error to return from Log when it squelches a log event +// with no level. By default, ErrNoLevel is nil; in this case the log event is +// squelched with no error. +func ErrNoLevel(err error) Option { + return func(l *logger) { l.errNoLevel = err } +} + +// NewInjector wraps next and returns a logger that adds a Key/level pair to +// the beginning of log events that don't already contain a level. In effect, +// this gives a default level to logs without a level. +func NewInjector(next log.Logger, level Value) log.Logger { + return &injector{ + next: next, + level: level, + } +} + +type injector struct { + next log.Logger + level interface{} +} + +func (l *injector) Log(keyvals ...interface{}) error { + for i := 1; i < len(keyvals); i += 2 { + if _, ok := keyvals[i].(*levelValue); ok { + return l.next.Log(keyvals...) + } + } + kvs := make([]interface{}, len(keyvals)+2) + kvs[0], kvs[1] = key, l.level + copy(kvs[2:], keyvals) + return l.next.Log(kvs...) +} + +// Value is the interface that each of the canonical level values implement. +// It contains unexported methods that prevent types from other packages from +// implementing it and guaranteeing that NewFilter can distinguish the levels +// defined in this package from all other values. +type Value interface { + String() string + levelVal() +} + +// Key returns the unique key added to log events by the loggers in this +// package. +func Key() interface{} { return key } + +// ErrorValue returns the unique value added to log events by Error. +func ErrorValue() Value { return errorValue } + +// WarnValue returns the unique value added to log events by Warn. +func WarnValue() Value { return warnValue } + +// InfoValue returns the unique value added to log events by Info. +func InfoValue() Value { return infoValue } + +// DebugValue returns the unique value added to log events by Warn. +func DebugValue() Value { return debugValue } + +var ( + // key is of type interfae{} so that it allocates once during package + // initialization and avoids allocating every type the value is added to a + // []interface{} later. + key interface{} = "level" + + errorValue = &levelValue{level: levelError, name: "error"} + warnValue = &levelValue{level: levelWarn, name: "warn"} + infoValue = &levelValue{level: levelInfo, name: "info"} + debugValue = &levelValue{level: levelDebug, name: "debug"} +) + +type level byte + +const ( + levelDebug level = 1 << iota + levelInfo + levelWarn + levelError +) + +type levelValue struct { + name string + level +} + +func (v *levelValue) String() string { return v.name } +func (v *levelValue) levelVal() {} diff --git a/vendor/github.com/go-kit/kit/log/log.go b/vendor/github.com/go-kit/kit/log/log.go new file mode 100644 index 000000000..66a9e2fde --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/log.go @@ -0,0 +1,135 @@ +package log + +import "errors" + +// Logger is the fundamental interface for all log operations. Log creates a +// log event from keyvals, a variadic sequence of alternating keys and values. +// Implementations must be safe for concurrent use by multiple goroutines. In +// particular, any implementation of Logger that appends to keyvals or +// modifies or retains any of its elements must make a copy first. +type Logger interface { + Log(keyvals ...interface{}) error +} + +// ErrMissingValue is appended to keyvals slices with odd length to substitute +// the missing value. +var ErrMissingValue = errors.New("(MISSING)") + +// With returns a new contextual logger with keyvals prepended to those passed +// to calls to Log. If logger is also a contextual logger created by With or +// WithPrefix, keyvals is appended to the existing context. +// +// The returned Logger replaces all value elements (odd indexes) containing a +// Valuer with their generated value for each call to its Log method. +func With(logger Logger, keyvals ...interface{}) Logger { + if len(keyvals) == 0 { + return logger + } + l := newContext(logger) + kvs := append(l.keyvals, keyvals...) + if len(kvs)%2 != 0 { + kvs = append(kvs, ErrMissingValue) + } + return &context{ + logger: l.logger, + // Limiting the capacity of the stored keyvals ensures that a new + // backing array is created if the slice must grow in Log or With. + // Using the extra capacity without copying risks a data race that + // would violate the Logger interface contract. + keyvals: kvs[:len(kvs):len(kvs)], + hasValuer: l.hasValuer || containsValuer(keyvals), + } +} + +// WithPrefix returns a new contextual logger with keyvals prepended to those +// passed to calls to Log. If logger is also a contextual logger created by +// With or WithPrefix, keyvals is prepended to the existing context. +// +// The returned Logger replaces all value elements (odd indexes) containing a +// Valuer with their generated value for each call to its Log method. +func WithPrefix(logger Logger, keyvals ...interface{}) Logger { + if len(keyvals) == 0 { + return logger + } + l := newContext(logger) + // Limiting the capacity of the stored keyvals ensures that a new + // backing array is created if the slice must grow in Log or With. + // Using the extra capacity without copying risks a data race that + // would violate the Logger interface contract. + n := len(l.keyvals) + len(keyvals) + if len(keyvals)%2 != 0 { + n++ + } + kvs := make([]interface{}, 0, n) + kvs = append(kvs, keyvals...) + if len(kvs)%2 != 0 { + kvs = append(kvs, ErrMissingValue) + } + kvs = append(kvs, l.keyvals...) + return &context{ + logger: l.logger, + keyvals: kvs, + hasValuer: l.hasValuer || containsValuer(keyvals), + } +} + +// context is the Logger implementation returned by With and WithPrefix. It +// wraps a Logger and holds keyvals that it includes in all log events. Its +// Log method calls bindValues to generate values for each Valuer in the +// context keyvals. +// +// A context must always have the same number of stack frames between calls to +// its Log method and the eventual binding of Valuers to their value. This +// requirement comes from the functional requirement to allow a context to +// resolve application call site information for a Caller stored in the +// context. To do this we must be able to predict the number of logging +// functions on the stack when bindValues is called. +// +// Two implementation details provide the needed stack depth consistency. +// +// 1. newContext avoids introducing an additional layer when asked to +// wrap another context. +// 2. With and WithPrefix avoid introducing an additional layer by +// returning a newly constructed context with a merged keyvals rather +// than simply wrapping the existing context. +type context struct { + logger Logger + keyvals []interface{} + hasValuer bool +} + +func newContext(logger Logger) *context { + if c, ok := logger.(*context); ok { + return c + } + return &context{logger: logger} +} + +// Log replaces all value elements (odd indexes) containing a Valuer in the +// stored context with their generated value, appends keyvals, and passes the +// result to the wrapped Logger. +func (l *context) Log(keyvals ...interface{}) error { + kvs := append(l.keyvals, keyvals...) + if len(kvs)%2 != 0 { + kvs = append(kvs, ErrMissingValue) + } + if l.hasValuer { + // If no keyvals were appended above then we must copy l.keyvals so + // that future log events will reevaluate the stored Valuers. + if len(keyvals) == 0 { + kvs = append([]interface{}{}, l.keyvals...) + } + bindValues(kvs[:len(l.keyvals)]) + } + return l.logger.Log(kvs...) +} + +// LoggerFunc is an adapter to allow use of ordinary functions as Loggers. If +// f is a function with the appropriate signature, LoggerFunc(f) is a Logger +// object that calls f. +type LoggerFunc func(...interface{}) error + +// Log implements Logger by calling f(keyvals...). +func (f LoggerFunc) Log(keyvals ...interface{}) error { + return f(keyvals...) +} diff --git a/vendor/github.com/go-kit/kit/log/logfmt_logger.go b/vendor/github.com/go-kit/kit/log/logfmt_logger.go new file mode 100644 index 000000000..a00305298 --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/logfmt_logger.go @@ -0,0 +1,62 @@ +package log + +import ( + "bytes" + "io" + "sync" + + "github.com/go-logfmt/logfmt" +) + +type logfmtEncoder struct { + *logfmt.Encoder + buf bytes.Buffer +} + +func (l *logfmtEncoder) Reset() { + l.Encoder.Reset() + l.buf.Reset() +} + +var logfmtEncoderPool = sync.Pool{ + New: func() interface{} { + var enc logfmtEncoder + enc.Encoder = logfmt.NewEncoder(&enc.buf) + return &enc + }, +} + +type logfmtLogger struct { + w io.Writer +} + +// NewLogfmtLogger returns a logger that encodes keyvals to the Writer in +// logfmt format. Each log event produces no more than one call to w.Write. +// The passed Writer must be safe for concurrent use by multiple goroutines if +// the returned Logger will be used concurrently. +func NewLogfmtLogger(w io.Writer) Logger { + return &logfmtLogger{w} +} + +func (l logfmtLogger) Log(keyvals ...interface{}) error { + enc := logfmtEncoderPool.Get().(*logfmtEncoder) + enc.Reset() + defer logfmtEncoderPool.Put(enc) + + if err := enc.EncodeKeyvals(keyvals...); err != nil { + return err + } + + // Add newline to the end of the buffer + if err := enc.EndRecord(); err != nil { + return err + } + + // The Logger interface requires implementations to be safe for concurrent + // use by multiple goroutines. For this implementation that means making + // only one call to l.w.Write() for each call to Log. + if _, err := l.w.Write(enc.buf.Bytes()); err != nil { + return err + } + return nil +} diff --git a/vendor/github.com/go-kit/kit/log/nop_logger.go b/vendor/github.com/go-kit/kit/log/nop_logger.go new file mode 100644 index 000000000..1047d626c --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/nop_logger.go @@ -0,0 +1,8 @@ +package log + +type nopLogger struct{} + +// NewNopLogger returns a logger that doesn't do anything. +func NewNopLogger() Logger { return nopLogger{} } + +func (nopLogger) Log(...interface{}) error { return nil } diff --git a/vendor/github.com/go-kit/kit/log/stdlib.go b/vendor/github.com/go-kit/kit/log/stdlib.go new file mode 100644 index 000000000..ff96b5dee --- /dev/null +++ b/vendor/github.com/go-kit/kit/log/stdlib.go @@ -0,0 +1,116 @@ +package log + +import ( + "io" + "log" + "regexp" + "strings" +) + +// StdlibWriter implements io.Writer by invoking the stdlib log.Print. It's +// designed to be passed to a Go kit logger as the writer, for cases where +// it's necessary to redirect all Go kit log output to the stdlib logger. +// +// If you have any choice in the matter, you shouldn't use this. Prefer to +// redirect the stdlib log to the Go kit logger via NewStdlibAdapter. +type StdlibWriter struct{} + +// Write implements io.Writer. +func (w StdlibWriter) Write(p []byte) (int, error) { + log.Print(strings.TrimSpace(string(p))) + return len(p), nil +} + +// StdlibAdapter wraps a Logger and allows it to be passed to the stdlib +// logger's SetOutput. It will extract date/timestamps, filenames, and +// messages, and place them under relevant keys. +type StdlibAdapter struct { + Logger + timestampKey string + fileKey string + messageKey string +} + +// StdlibAdapterOption sets a parameter for the StdlibAdapter. +type StdlibAdapterOption func(*StdlibAdapter) + +// TimestampKey sets the key for the timestamp field. By default, it's "ts". +func TimestampKey(key string) StdlibAdapterOption { + return func(a *StdlibAdapter) { a.timestampKey = key } +} + +// FileKey sets the key for the file and line field. By default, it's "caller". +func FileKey(key string) StdlibAdapterOption { + return func(a *StdlibAdapter) { a.fileKey = key } +} + +// MessageKey sets the key for the actual log message. By default, it's "msg". +func MessageKey(key string) StdlibAdapterOption { + return func(a *StdlibAdapter) { a.messageKey = key } +} + +// NewStdlibAdapter returns a new StdlibAdapter wrapper around the passed +// logger. It's designed to be passed to log.SetOutput. +func NewStdlibAdapter(logger Logger, options ...StdlibAdapterOption) io.Writer { + a := StdlibAdapter{ + Logger: logger, + timestampKey: "ts", + fileKey: "caller", + messageKey: "msg", + } + for _, option := range options { + option(&a) + } + return a +} + +func (a StdlibAdapter) Write(p []byte) (int, error) { + result := subexps(p) + keyvals := []interface{}{} + var timestamp string + if date, ok := result["date"]; ok && date != "" { + timestamp = date + } + if time, ok := result["time"]; ok && time != "" { + if timestamp != "" { + timestamp += " " + } + timestamp += time + } + if timestamp != "" { + keyvals = append(keyvals, a.timestampKey, timestamp) + } + if file, ok := result["file"]; ok && file != "" { + keyvals = append(keyvals, a.fileKey, file) + } + if msg, ok := result["msg"]; ok { + keyvals = append(keyvals, a.messageKey, msg) + } + if err := a.Logger.Log(keyvals...); err != nil { + return 0, err + } + return len(p), nil +} + +const ( + logRegexpDate = `(?P[0-9]{4}/[0-9]{2}/[0-9]{2})?[ ]?` + logRegexpTime = `(?P