mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 18:13:42 +08:00 
			
		
		
		
	
							
								
								
									
										13
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								go.mod
									
									
									
									
									
								
							@@ -3,7 +3,6 @@ module github.com/docker/buildx
 | 
				
			|||||||
require (
 | 
					require (
 | 
				
			||||||
	github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
 | 
						github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
 | 
				
			||||||
	github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
 | 
						github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
 | 
				
			||||||
	github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
 | 
					 | 
				
			||||||
	github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 // indirect
 | 
						github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 // indirect
 | 
				
			||||||
	github.com/bugsnag/bugsnag-go v1.4.1 // indirect
 | 
						github.com/bugsnag/bugsnag-go v1.4.1 // indirect
 | 
				
			||||||
	github.com/bugsnag/panicwrap v1.2.0 // indirect
 | 
						github.com/bugsnag/panicwrap v1.2.0 // indirect
 | 
				
			||||||
@@ -24,14 +23,14 @@ require (
 | 
				
			|||||||
	github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484 // indirect
 | 
						github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484 // indirect
 | 
				
			||||||
	github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect
 | 
						github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect
 | 
				
			||||||
	github.com/go-sql-driver/mysql v1.4.1 // indirect
 | 
						github.com/go-sql-driver/mysql v1.4.1 // indirect
 | 
				
			||||||
	github.com/gofrs/flock v0.7.0
 | 
						github.com/gofrs/flock v0.7.2
 | 
				
			||||||
	github.com/gofrs/uuid v3.2.0+incompatible // indirect
 | 
						github.com/gofrs/uuid v3.2.0+incompatible // indirect
 | 
				
			||||||
	github.com/google/certificate-transparency-go v1.0.21 // indirect
 | 
						github.com/google/certificate-transparency-go v1.0.21 // indirect
 | 
				
			||||||
	github.com/google/shlex v0.0.0-20150127133951-6f45313302b9
 | 
						github.com/google/shlex v0.0.0-20150127133951-6f45313302b9
 | 
				
			||||||
	github.com/googleapis/gnostic v0.3.1 // indirect
 | 
						github.com/googleapis/gnostic v0.3.1 // indirect
 | 
				
			||||||
	github.com/gophercloud/gophercloud v0.6.0 // indirect
 | 
						github.com/gophercloud/gophercloud v0.6.0 // indirect
 | 
				
			||||||
	github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
 | 
						github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
 | 
				
			||||||
	github.com/hashicorp/hcl/v2 v2.4.0
 | 
						github.com/hashicorp/hcl/v2 v2.6.0
 | 
				
			||||||
	github.com/jinzhu/gorm v1.9.2 // indirect
 | 
						github.com/jinzhu/gorm v1.9.2 // indirect
 | 
				
			||||||
	github.com/jinzhu/inflection v0.0.0-20180308033659-04140366298a // indirect
 | 
						github.com/jinzhu/inflection v0.0.0-20180308033659-04140366298a // indirect
 | 
				
			||||||
	github.com/jinzhu/now v1.0.0 // indirect
 | 
						github.com/jinzhu/now v1.0.0 // indirect
 | 
				
			||||||
@@ -40,17 +39,15 @@ require (
 | 
				
			|||||||
	github.com/mattn/go-shellwords v1.0.5 // indirect
 | 
						github.com/mattn/go-shellwords v1.0.5 // indirect
 | 
				
			||||||
	github.com/mattn/go-sqlite3 v1.10.0 // indirect
 | 
						github.com/mattn/go-sqlite3 v1.10.0 // indirect
 | 
				
			||||||
	github.com/miekg/pkcs11 v0.0.0-20190322140431-074fd7a1ed19 // indirect
 | 
						github.com/miekg/pkcs11 v0.0.0-20190322140431-074fd7a1ed19 // indirect
 | 
				
			||||||
	github.com/moby/buildkit v0.7.0
 | 
						github.com/moby/buildkit v0.7.2
 | 
				
			||||||
	github.com/opencontainers/go-digest v1.0.0-rc1
 | 
						github.com/opencontainers/go-digest v1.0.0-rc1
 | 
				
			||||||
	github.com/opencontainers/image-spec v1.0.1
 | 
						github.com/opencontainers/image-spec v1.0.1
 | 
				
			||||||
	github.com/opencontainers/selinux v1.3.3 // indirect
 | 
						github.com/opencontainers/selinux v1.3.3 // indirect
 | 
				
			||||||
	github.com/pkg/errors v0.9.1
 | 
						github.com/pkg/errors v0.9.1
 | 
				
			||||||
	github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1 // indirect
 | 
					 | 
				
			||||||
	github.com/serialx/hashring v0.0.0-20190422032157-8b2912629002
 | 
						github.com/serialx/hashring v0.0.0-20190422032157-8b2912629002
 | 
				
			||||||
	github.com/sirupsen/logrus v1.4.2
 | 
						github.com/sirupsen/logrus v1.6.0
 | 
				
			||||||
	github.com/spf13/cobra v0.0.3
 | 
						github.com/spf13/cobra v1.0.0
 | 
				
			||||||
	github.com/spf13/pflag v1.0.5
 | 
						github.com/spf13/pflag v1.0.5
 | 
				
			||||||
	github.com/spf13/viper v1.3.2 // indirect
 | 
					 | 
				
			||||||
	github.com/stretchr/testify v1.4.0
 | 
						github.com/stretchr/testify v1.4.0
 | 
				
			||||||
	github.com/theupdateframework/notary v0.6.1 // indirect
 | 
						github.com/theupdateframework/notary v0.6.1 // indirect
 | 
				
			||||||
	github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea
 | 
						github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										87
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										87
									
								
								go.sum
									
									
									
									
									
								
							@@ -27,6 +27,7 @@ github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXn
 | 
				
			|||||||
github.com/Microsoft/hcsshim v0.8.7 h1:ptnOoufxGSzauVTsdE+wMYnCWA301PdoN4xg5oRdZpg=
 | 
					github.com/Microsoft/hcsshim v0.8.7 h1:ptnOoufxGSzauVTsdE+wMYnCWA301PdoN4xg5oRdZpg=
 | 
				
			||||||
github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ=
 | 
					github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ=
 | 
				
			||||||
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
 | 
					github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
 | 
				
			||||||
 | 
					github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
 | 
				
			||||||
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
 | 
					github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
 | 
				
			||||||
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
 | 
					github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
 | 
				
			||||||
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d h1:UrqY+r/OJnIp5u0s1SbQ8dVfLCZJsnvazdBP5hS4iRs=
 | 
					github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d h1:UrqY+r/OJnIp5u0s1SbQ8dVfLCZJsnvazdBP5hS4iRs=
 | 
				
			||||||
@@ -35,6 +36,8 @@ github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tj
 | 
				
			|||||||
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
 | 
					github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
 | 
				
			||||||
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 h1:w1UutsfOrms1J05zt7ISrnJIXKzwaspym5BTKGx93EI=
 | 
					github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 h1:w1UutsfOrms1J05zt7ISrnJIXKzwaspym5BTKGx93EI=
 | 
				
			||||||
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0=
 | 
					github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0=
 | 
				
			||||||
 | 
					github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
 | 
				
			||||||
 | 
					github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
 | 
				
			||||||
github.com/apache/thrift v0.0.0-20161221203622-b2a4d4ae21c7/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
 | 
					github.com/apache/thrift v0.0.0-20161221203622-b2a4d4ae21c7/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
 | 
				
			||||||
github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
 | 
					github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
 | 
				
			||||||
github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0=
 | 
					github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0=
 | 
				
			||||||
@@ -46,6 +49,8 @@ github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZo
 | 
				
			|||||||
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
 | 
					github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
 | 
				
			||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
 | 
					github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
 | 
				
			||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
 | 
					github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
 | 
				
			||||||
 | 
					github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
 | 
				
			||||||
 | 
					github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
 | 
				
			||||||
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY=
 | 
					github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY=
 | 
				
			||||||
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=
 | 
					github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=
 | 
				
			||||||
github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=
 | 
					github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=
 | 
				
			||||||
@@ -64,6 +69,7 @@ github.com/bugsnag/panicwrap v1.2.0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywR
 | 
				
			|||||||
github.com/cenkalti/backoff v2.1.1+incompatible h1:tKJnvO2kl0zmb/jA5UKAt4VoEVw1qxKWjE/Bpp46npY=
 | 
					github.com/cenkalti/backoff v2.1.1+incompatible h1:tKJnvO2kl0zmb/jA5UKAt4VoEVw1qxKWjE/Bpp46npY=
 | 
				
			||||||
github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
 | 
					github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
 | 
				
			||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
 | 
					github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
 | 
				
			||||||
 | 
					github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
 | 
				
			||||||
github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg=
 | 
					github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg=
 | 
				
			||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
 | 
					github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
 | 
				
			||||||
github.com/cloudflare/cfssl v0.0.0-20181213083726-b94e044bb51e h1:Qux+lbuMaRzkQyTdzgtz8MgzPtzmaPQy6DXmxpdxT3U=
 | 
					github.com/cloudflare/cfssl v0.0.0-20181213083726-b94e044bb51e h1:Qux+lbuMaRzkQyTdzgtz8MgzPtzmaPQy6DXmxpdxT3U=
 | 
				
			||||||
@@ -99,13 +105,14 @@ github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd/go.mod h1:GeKYz
 | 
				
			|||||||
github.com/containerd/typeurl v0.0.0-20200205145503-b45ef1f1f737 h1:HovfQDS/K3Mr7eyS0QJLxE1CbVUhjZCl6g3OhFJgP1o=
 | 
					github.com/containerd/typeurl v0.0.0-20200205145503-b45ef1f1f737 h1:HovfQDS/K3Mr7eyS0QJLxE1CbVUhjZCl6g3OhFJgP1o=
 | 
				
			||||||
github.com/containerd/typeurl v0.0.0-20200205145503-b45ef1f1f737/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg=
 | 
					github.com/containerd/typeurl v0.0.0-20200205145503-b45ef1f1f737/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg=
 | 
				
			||||||
github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
 | 
					github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
 | 
				
			||||||
 | 
					github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
 | 
				
			||||||
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
 | 
					github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
 | 
				
			||||||
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
 | 
					 | 
				
			||||||
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
 | 
					github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
 | 
				
			||||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8=
 | 
					github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8=
 | 
				
			||||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
 | 
					github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
 | 
				
			||||||
github.com/coreos/go-systemd/v22 v22.0.0 h1:XJIw/+VlJ+87J+doOxznsAWIdmWuViOVhkQamW5YV28=
 | 
					github.com/coreos/go-systemd/v22 v22.0.0 h1:XJIw/+VlJ+87J+doOxznsAWIdmWuViOVhkQamW5YV28=
 | 
				
			||||||
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
 | 
					github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
 | 
				
			||||||
 | 
					github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
 | 
				
			||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
 | 
					github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
 | 
				
			||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
 | 
					github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
 | 
				
			||||||
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
					github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
				
			||||||
@@ -117,6 +124,7 @@ github.com/denisenkom/go-mssqldb v0.0.0-20190315220205-a8ed825ac853/go.mod h1:xN
 | 
				
			|||||||
github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0=
 | 
					github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0=
 | 
				
			||||||
github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
 | 
					github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
 | 
				
			||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
 | 
					github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
 | 
				
			||||||
 | 
					github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
 | 
				
			||||||
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
 | 
					github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
 | 
				
			||||||
github.com/docker/cli v0.0.0-20200227165822-2298e6a3fe24 h1:bjsfAvm8BVtvQFxV7TYznmKa35J8+fmgrRJWvcS3yJo=
 | 
					github.com/docker/cli v0.0.0-20200227165822-2298e6a3fe24 h1:bjsfAvm8BVtvQFxV7TYznmKa35J8+fmgrRJWvcS3yJo=
 | 
				
			||||||
github.com/docker/cli v0.0.0-20200227165822-2298e6a3fe24/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
 | 
					github.com/docker/cli v0.0.0-20200227165822-2298e6a3fe24/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
 | 
				
			||||||
@@ -167,7 +175,11 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV
 | 
				
			|||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
 | 
					github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
 | 
				
			||||||
github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
 | 
					github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
 | 
				
			||||||
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 | 
					github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 | 
				
			||||||
 | 
					github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 | 
				
			||||||
github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
 | 
					github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
 | 
				
			||||||
 | 
					github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
 | 
				
			||||||
 | 
					github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
 | 
				
			||||||
 | 
					github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
 | 
				
			||||||
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
 | 
					github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
 | 
				
			||||||
github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
 | 
					github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
 | 
				
			||||||
github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
 | 
					github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
 | 
				
			||||||
@@ -175,6 +187,7 @@ github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nA
 | 
				
			|||||||
github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
 | 
					github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
 | 
				
			||||||
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
 | 
					github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
 | 
				
			||||||
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
 | 
					github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
 | 
				
			||||||
 | 
					github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
 | 
				
			||||||
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
 | 
					github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
 | 
				
			||||||
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
 | 
					github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
 | 
				
			||||||
github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e h1:BWhy2j3IXJhjCbC68FptL43tDKIq8FladmaTs3Xs7Z8=
 | 
					github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e h1:BWhy2j3IXJhjCbC68FptL43tDKIq8FladmaTs3Xs7Z8=
 | 
				
			||||||
@@ -183,10 +196,13 @@ github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME=
 | 
				
			|||||||
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
 | 
					github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
 | 
				
			||||||
github.com/gofrs/flock v0.7.0 h1:pGFUjl501gafK9HBt1VGL1KCOd/YhIooID+xgyJCf3g=
 | 
					github.com/gofrs/flock v0.7.0 h1:pGFUjl501gafK9HBt1VGL1KCOd/YhIooID+xgyJCf3g=
 | 
				
			||||||
github.com/gofrs/flock v0.7.0/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
 | 
					github.com/gofrs/flock v0.7.0/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
 | 
				
			||||||
 | 
					github.com/gofrs/flock v0.7.2 h1:JkFf/PGP1ZOSzUHY03OQp06aeiIim523smfhMdFvP+o=
 | 
				
			||||||
 | 
					github.com/gofrs/flock v0.7.2/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
 | 
				
			||||||
github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=
 | 
					github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=
 | 
				
			||||||
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
 | 
					github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
 | 
				
			||||||
github.com/gogo/googleapis v1.3.2 h1:kX1es4djPJrsDhY7aZKJy7aZasdcB5oSOEphMjSB53c=
 | 
					github.com/gogo/googleapis v1.3.2 h1:kX1es4djPJrsDhY7aZKJy7aZasdcB5oSOEphMjSB53c=
 | 
				
			||||||
github.com/gogo/googleapis v1.3.2/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c=
 | 
					github.com/gogo/googleapis v1.3.2/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c=
 | 
				
			||||||
 | 
					github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
 | 
				
			||||||
github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
 | 
					github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
 | 
				
			||||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
 | 
					github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
 | 
				
			||||||
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
 | 
					github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
 | 
				
			||||||
@@ -196,6 +212,7 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP
 | 
				
			|||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
 | 
					github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
 | 
				
			||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
 | 
					github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
 | 
				
			||||||
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
 | 
					github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
 | 
				
			||||||
 | 
					github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
 | 
				
			||||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
 | 
					github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
 | 
				
			||||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
 | 
					github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
 | 
				
			||||||
github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 | 
					github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 | 
				
			||||||
@@ -208,6 +225,7 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
 | 
				
			|||||||
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
 | 
					github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
 | 
				
			||||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
 | 
					github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
 | 
				
			||||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
 | 
					github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
 | 
				
			||||||
 | 
					github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
 | 
				
			||||||
github.com/google/certificate-transparency-go v1.0.21 h1:Yf1aXowfZ2nuboBsg7iYGLmwsOARdV86pfH3g95wXmE=
 | 
					github.com/google/certificate-transparency-go v1.0.21 h1:Yf1aXowfZ2nuboBsg7iYGLmwsOARdV86pfH3g95wXmE=
 | 
				
			||||||
github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg=
 | 
					github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg=
 | 
				
			||||||
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
 | 
					github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
 | 
				
			||||||
@@ -236,8 +254,12 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR
 | 
				
			|||||||
github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
 | 
					github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
 | 
				
			||||||
github.com/gorilla/mux v1.7.2 h1:zoNxOV7WjqXptQOVngLmcSQgXmgk4NMz1HibBchjl/I=
 | 
					github.com/gorilla/mux v1.7.2 h1:zoNxOV7WjqXptQOVngLmcSQgXmgk4NMz1HibBchjl/I=
 | 
				
			||||||
github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
 | 
					github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
 | 
				
			||||||
 | 
					github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
 | 
				
			||||||
github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY=
 | 
					github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY=
 | 
				
			||||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
 | 
					github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
 | 
				
			||||||
 | 
					github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
 | 
				
			||||||
 | 
					github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
 | 
				
			||||||
 | 
					github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
 | 
				
			||||||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 h1:MJG/KsmcqMwFAkh8mTnAwhyKoB+sTAnY4CACC110tbU=
 | 
					github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 h1:MJG/KsmcqMwFAkh8mTnAwhyKoB+sTAnY4CACC110tbU=
 | 
				
			||||||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw=
 | 
					github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw=
 | 
				
			||||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8=
 | 
					github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8=
 | 
				
			||||||
@@ -251,8 +273,8 @@ github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+
 | 
				
			|||||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
 | 
					github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
 | 
				
			||||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
 | 
					github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
 | 
				
			||||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
 | 
					github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
 | 
				
			||||||
github.com/hashicorp/hcl/v2 v2.4.0 h1:xwVa1aj4nCSoAjUnFPBAIfqlzPgSZEVMdkJv/mgj4jY=
 | 
					github.com/hashicorp/hcl/v2 v2.6.0 h1:3krZOfGY6SziUXa6H9PJU6TyohHn7I+ARYnhbeNBz+o=
 | 
				
			||||||
github.com/hashicorp/hcl/v2 v2.4.0/go.mod h1:bQTN5mpo+jewjJgh8jr0JUguIi7qPHUF6yIfAEN3jqY=
 | 
					github.com/hashicorp/hcl/v2 v2.6.0/go.mod h1:bQTN5mpo+jewjJgh8jr0JUguIi7qPHUF6yIfAEN3jqY=
 | 
				
			||||||
github.com/hashicorp/uuid v0.0.0-20160311170451-ebb0a03e909c/go.mod h1:fHzc09UnyJyqyW+bFuq864eh+wC7dj65aXmXLRe5to0=
 | 
					github.com/hashicorp/uuid v0.0.0-20160311170451-ebb0a03e909c/go.mod h1:fHzc09UnyJyqyW+bFuq864eh+wC7dj65aXmXLRe5to0=
 | 
				
			||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
 | 
					github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
 | 
				
			||||||
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
 | 
					github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
 | 
				
			||||||
@@ -269,11 +291,13 @@ github.com/jinzhu/now v1.0.0 h1:6WV8LvwPpDhKjo5U9O6b4+xdG/jTXNPwlDme/MTo8Ns=
 | 
				
			|||||||
github.com/jinzhu/now v1.0.0/go.mod h1:oHTiXerJ20+SfYcrdlBO7rzZRJWGwSTQ0iUY2jI6Gfc=
 | 
					github.com/jinzhu/now v1.0.0/go.mod h1:oHTiXerJ20+SfYcrdlBO7rzZRJWGwSTQ0iUY2jI6Gfc=
 | 
				
			||||||
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
 | 
					github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
 | 
				
			||||||
github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
 | 
					github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
 | 
				
			||||||
 | 
					github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
 | 
				
			||||||
github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
 | 
					github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
 | 
				
			||||||
github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo=
 | 
					github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo=
 | 
				
			||||||
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
 | 
					github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
 | 
				
			||||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
 | 
					github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
 | 
				
			||||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
 | 
					github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
 | 
				
			||||||
 | 
					github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
 | 
				
			||||||
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA=
 | 
					github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA=
 | 
				
			||||||
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
 | 
					github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
 | 
				
			||||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
 | 
					github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
 | 
				
			||||||
@@ -283,6 +307,9 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGi
 | 
				
			|||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 | 
					github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 | 
				
			||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
 | 
					github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
 | 
				
			||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 | 
					github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 | 
				
			||||||
 | 
					github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
 | 
				
			||||||
 | 
					github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 | 
				
			||||||
 | 
					github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
 | 
				
			||||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
 | 
					github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
 | 
				
			||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
 | 
					github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
 | 
				
			||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 | 
					github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 | 
				
			||||||
@@ -304,14 +331,15 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j
 | 
				
			|||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
 | 
					github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
 | 
				
			||||||
github.com/miekg/pkcs11 v0.0.0-20190322140431-074fd7a1ed19 h1:UEWeJCqsIp+93IcMCuqA3KFln2LAUd/tDtoItl0bgJM=
 | 
					github.com/miekg/pkcs11 v0.0.0-20190322140431-074fd7a1ed19 h1:UEWeJCqsIp+93IcMCuqA3KFln2LAUd/tDtoItl0bgJM=
 | 
				
			||||||
github.com/miekg/pkcs11 v0.0.0-20190322140431-074fd7a1ed19/go.mod h1:WCBAbTOdfhHhz7YXujeZMF7owC4tPb1naKFsgfUISjo=
 | 
					github.com/miekg/pkcs11 v0.0.0-20190322140431-074fd7a1ed19/go.mod h1:WCBAbTOdfhHhz7YXujeZMF7owC4tPb1naKFsgfUISjo=
 | 
				
			||||||
 | 
					github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
 | 
				
			||||||
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM=
 | 
					github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM=
 | 
				
			||||||
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
 | 
					github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
 | 
				
			||||||
github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ=
 | 
					github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ=
 | 
				
			||||||
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
 | 
					github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
 | 
				
			||||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
 | 
					github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
 | 
				
			||||||
github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A=
 | 
					github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A=
 | 
				
			||||||
github.com/moby/buildkit v0.7.0 h1:5T41l8i0f+OqHvRThh2NKVXiLpclXYmgO8QePoyIJrw=
 | 
					github.com/moby/buildkit v0.7.2 h1:wp4R0QMXSqwjTJKhhWlJNOCSQ/OVPnsCf3N8rs09+vQ=
 | 
				
			||||||
github.com/moby/buildkit v0.7.0/go.mod h1:zOhLO1TiQepuSfzoNDQ542IGJQy0CHr79T4MOJvaewY=
 | 
					github.com/moby/buildkit v0.7.2/go.mod h1:D3DN/Nl4DyMH1LkwpRUJuoghqdigdXd1A6HXt5aZS40=
 | 
				
			||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
 | 
					github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
 | 
				
			||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
 | 
					github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
 | 
				
			||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
 | 
					github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
 | 
				
			||||||
@@ -322,8 +350,10 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
 | 
				
			|||||||
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c h1:nXxl5PrvVm2L/wCy8dQu6DMTwH4oIuGN8GJDAlqDdVE=
 | 
					github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c h1:nXxl5PrvVm2L/wCy8dQu6DMTwH4oIuGN8GJDAlqDdVE=
 | 
				
			||||||
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
 | 
					github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
 | 
				
			||||||
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
 | 
					github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
 | 
				
			||||||
 | 
					github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
 | 
				
			||||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
 | 
					github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
 | 
				
			||||||
github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
 | 
					github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
 | 
				
			||||||
 | 
					github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
 | 
				
			||||||
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 | 
					github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 | 
				
			||||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 | 
					github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 | 
				
			||||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 | 
					github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 | 
				
			||||||
@@ -373,16 +403,26 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
 | 
				
			|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 | 
					github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 | 
				
			||||||
github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06 h1:BqJUZe1wY8984P2XGsGIGieuao8wucwOwaTS10L9Lj8=
 | 
					github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06 h1:BqJUZe1wY8984P2XGsGIGieuao8wucwOwaTS10L9Lj8=
 | 
				
			||||||
github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
 | 
					github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
 | 
				
			||||||
 | 
					github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
 | 
				
			||||||
 | 
					github.com/prometheus/client_golang v0.9.3 h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8=
 | 
				
			||||||
 | 
					github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
 | 
				
			||||||
github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
 | 
					github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
 | 
				
			||||||
 | 
					github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
 | 
				
			||||||
 | 
					github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
 | 
				
			||||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=
 | 
					github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=
 | 
				
			||||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
 | 
					github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
 | 
				
			||||||
github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
 | 
					github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
 | 
				
			||||||
github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1 h1:osmNoEW2SCW3L7EX0km2LYM8HKpNWRiouxjE3XHkyGc=
 | 
					github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
 | 
				
			||||||
github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
 | 
					github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM=
 | 
				
			||||||
 | 
					github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
 | 
				
			||||||
github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
 | 
					github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
 | 
				
			||||||
 | 
					github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
 | 
				
			||||||
 | 
					github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
 | 
				
			||||||
github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
 | 
					github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
 | 
				
			||||||
github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8=
 | 
					github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8=
 | 
				
			||||||
github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
 | 
					github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
 | 
				
			||||||
 | 
					github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
 | 
				
			||||||
 | 
					github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
 | 
				
			||||||
github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
 | 
					github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
 | 
				
			||||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
 | 
					github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
 | 
				
			||||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
 | 
					github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
 | 
				
			||||||
@@ -393,12 +433,17 @@ github.com/serialx/hashring v0.0.0-20190422032157-8b2912629002/go.mod h1:/yeG0My
 | 
				
			|||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
 | 
					github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
 | 
				
			||||||
github.com/sirupsen/logrus v1.0.3/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
 | 
					github.com/sirupsen/logrus v1.0.3/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
 | 
				
			||||||
github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
 | 
					github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
 | 
				
			||||||
 | 
					github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
 | 
				
			||||||
github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k=
 | 
					github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k=
 | 
				
			||||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
 | 
					github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
 | 
				
			||||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
 | 
					github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
 | 
				
			||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
 | 
					github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
 | 
				
			||||||
 | 
					github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
 | 
				
			||||||
 | 
					github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
 | 
				
			||||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
 | 
					github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
 | 
				
			||||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
 | 
					github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
 | 
				
			||||||
 | 
					github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
 | 
				
			||||||
 | 
					github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
 | 
				
			||||||
github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
 | 
					github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
 | 
				
			||||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
 | 
					github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
 | 
				
			||||||
github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc=
 | 
					github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc=
 | 
				
			||||||
@@ -408,6 +453,8 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU
 | 
				
			|||||||
github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
 | 
					github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
 | 
				
			||||||
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
 | 
					github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
 | 
				
			||||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
 | 
					github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
 | 
				
			||||||
 | 
					github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8=
 | 
				
			||||||
 | 
					github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
 | 
				
			||||||
github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
 | 
					github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
 | 
				
			||||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
 | 
					github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
 | 
				
			||||||
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
 | 
					github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
 | 
				
			||||||
@@ -417,8 +464,8 @@ github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
 | 
				
			|||||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
 | 
					github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
 | 
				
			||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
 | 
					github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
 | 
				
			||||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
 | 
					github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
 | 
				
			||||||
github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M=
 | 
					github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU=
 | 
				
			||||||
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
 | 
					github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
 | 
				
			||||||
github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
					github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
				
			||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
					github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
				
			||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
					github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
				
			||||||
@@ -434,15 +481,16 @@ github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 h1:b6uOv7YOFK0
 | 
				
			|||||||
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
 | 
					github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
 | 
				
			||||||
github.com/theupdateframework/notary v0.6.1 h1:7wshjstgS9x9F5LuB1L5mBI2xNMObWqjz+cjWoom6l0=
 | 
					github.com/theupdateframework/notary v0.6.1 h1:7wshjstgS9x9F5LuB1L5mBI2xNMObWqjz+cjWoom6l0=
 | 
				
			||||||
github.com/theupdateframework/notary v0.6.1/go.mod h1:MOfgIfmox8s7/7fduvB2xyPPMJCrjRLRizA8OFwpnKY=
 | 
					github.com/theupdateframework/notary v0.6.1/go.mod h1:MOfgIfmox8s7/7fduvB2xyPPMJCrjRLRizA8OFwpnKY=
 | 
				
			||||||
github.com/tonistiigi/fsutil v0.0.0-20200225063759-013a9fe6aee2 h1:RCy9Kde5WFuCrGYznzS1dFANTwqvAzFDoih8L3sE0UY=
 | 
					github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
 | 
				
			||||||
github.com/tonistiigi/fsutil v0.0.0-20200225063759-013a9fe6aee2/go.mod h1:0G1sLZ/0ttFf09xvh7GR4AEECnjifHRNJN/sYbLianU=
 | 
					github.com/tonistiigi/fsutil v0.0.0-20200326231323-c2c7d7b0e144 h1:6RY1EKxCnPQShPM46xFDHta2JSOd+YKCgHyyBHtKuo8=
 | 
				
			||||||
 | 
					github.com/tonistiigi/fsutil v0.0.0-20200326231323-c2c7d7b0e144/go.mod h1:0G1sLZ/0ttFf09xvh7GR4AEECnjifHRNJN/sYbLianU=
 | 
				
			||||||
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea h1:SXhTLE6pb6eld/v/cCndK0AMpt1wiVFb/YYmqB3/QG0=
 | 
					github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea h1:SXhTLE6pb6eld/v/cCndK0AMpt1wiVFb/YYmqB3/QG0=
 | 
				
			||||||
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6cRcDZSUvVmezrxJPkiO87ThFYsoUiMwWNDJk=
 | 
					github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6cRcDZSUvVmezrxJPkiO87ThFYsoUiMwWNDJk=
 | 
				
			||||||
github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305 h1:y/1cL5AL2oRcfzz8CAHHhR6kDDfIOT0WEyH5k40sccM=
 | 
					github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305 h1:y/1cL5AL2oRcfzz8CAHHhR6kDDfIOT0WEyH5k40sccM=
 | 
				
			||||||
github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305/go.mod h1:gXOLibKqQTRAVuVZ9gX7G9Ykky8ll8yb4slxsEMoY0c=
 | 
					github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305/go.mod h1:gXOLibKqQTRAVuVZ9gX7G9Ykky8ll8yb4slxsEMoY0c=
 | 
				
			||||||
github.com/uber/jaeger-client-go v0.0.0-20180103221425-e02c85f9069e/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
 | 
					github.com/uber/jaeger-client-go v0.0.0-20180103221425-e02c85f9069e/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
 | 
				
			||||||
github.com/uber/jaeger-lib v1.2.1/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
 | 
					github.com/uber/jaeger-lib v1.2.1/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
 | 
				
			||||||
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
 | 
					github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
 | 
				
			||||||
github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
 | 
					github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
 | 
				
			||||||
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
 | 
					github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
 | 
				
			||||||
github.com/vishvananda/netlink v1.0.0/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
 | 
					github.com/vishvananda/netlink v1.0.0/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
 | 
				
			||||||
@@ -454,6 +502,7 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo
 | 
				
			|||||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
 | 
					github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
 | 
				
			||||||
github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f h1:mvXjJIHRZyhNuGassLTcXTwjiWq7NmjdavZsUnmFybQ=
 | 
					github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f h1:mvXjJIHRZyhNuGassLTcXTwjiWq7NmjdavZsUnmFybQ=
 | 
				
			||||||
github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs=
 | 
					github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs=
 | 
				
			||||||
 | 
					github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
 | 
				
			||||||
github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1 h1:j2hhcujLRHAg872RWAV5yaUrEjHEObwDv3aImCaNLek=
 | 
					github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1 h1:j2hhcujLRHAg872RWAV5yaUrEjHEObwDv3aImCaNLek=
 | 
				
			||||||
github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1/go.mod h1:QcJo0QPSfTONNIgpN5RA8prR7fF8nkF6cTWTcNerRO8=
 | 
					github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1/go.mod h1:QcJo0QPSfTONNIgpN5RA8prR7fF8nkF6cTWTcNerRO8=
 | 
				
			||||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
 | 
					github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
 | 
				
			||||||
@@ -464,14 +513,17 @@ github.com/zclconf/go-cty v1.2.0 h1:sPHsy7ADcIZQP3vILvTjrh74ZA175TFP5vqiNK1UmlI=
 | 
				
			|||||||
github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
 | 
					github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
 | 
				
			||||||
github.com/zclconf/go-cty v1.4.0 h1:+q+tmgyUB94HIdH/uVTIi/+kt3pt4sHwEZAcTyLoGsQ=
 | 
					github.com/zclconf/go-cty v1.4.0 h1:+q+tmgyUB94HIdH/uVTIi/+kt3pt4sHwEZAcTyLoGsQ=
 | 
				
			||||||
github.com/zclconf/go-cty v1.4.0/go.mod h1:nHzOclRkoj++EU9ZjSrZvRG0BXIWt8c7loYc0qXAFGQ=
 | 
					github.com/zclconf/go-cty v1.4.0/go.mod h1:nHzOclRkoj++EU9ZjSrZvRG0BXIWt8c7loYc0qXAFGQ=
 | 
				
			||||||
 | 
					go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
 | 
				
			||||||
go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk=
 | 
					go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk=
 | 
				
			||||||
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
 | 
					go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
 | 
				
			||||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
 | 
					go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
 | 
				
			||||||
go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4=
 | 
					go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4=
 | 
				
			||||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
 | 
					go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
 | 
				
			||||||
 | 
					go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
 | 
				
			||||||
 | 
					go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
 | 
				
			||||||
 | 
					go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
 | 
				
			||||||
golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
 | 
					golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
 | 
				
			||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
 | 
					golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
 | 
				
			||||||
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
 | 
					 | 
				
			||||||
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
 | 
					golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
 | 
				
			||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
 | 
					golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
 | 
				
			||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 | 
					golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 | 
				
			||||||
@@ -492,6 +544,8 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r
 | 
				
			|||||||
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
					golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
				
			||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
					golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
				
			||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
					golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
				
			||||||
 | 
					golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
				
			||||||
 | 
					golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
				
			||||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
					golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
				
			||||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
					golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
				
			||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
 | 
					golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
 | 
				
			||||||
@@ -499,6 +553,7 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn
 | 
				
			|||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
 | 
					golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
 | 
				
			||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 | 
					golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 | 
				
			||||||
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 | 
					golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 | 
				
			||||||
 | 
					golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
 | 
				
			||||||
golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 | 
					golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 | 
				
			||||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 | 
					golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 | 
				
			||||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8=
 | 
					golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8=
 | 
				
			||||||
@@ -521,7 +576,8 @@ golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5h
 | 
				
			|||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
					golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
					golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
					golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
					golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
					golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
					golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
					golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
				
			||||||
@@ -597,6 +653,7 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8
 | 
				
			|||||||
google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk=
 | 
					google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk=
 | 
				
			||||||
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
 | 
					google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
 | 
				
			||||||
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
 | 
					gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
 | 
				
			||||||
 | 
					gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
 | 
				
			||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 | 
					gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 | 
				
			||||||
gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 | 
					gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 | 
				
			||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
 | 
					gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
 | 
				
			||||||
@@ -611,7 +668,9 @@ gopkg.in/gorethink/gorethink.v3 v3.0.5 h1:e2Uc/Xe+hpcVQFsj6MuHlYog3r0JYpnTzwDj/y
 | 
				
			|||||||
gopkg.in/gorethink/gorethink.v3 v3.0.5/go.mod h1:+3yIIHJUGMBK+wyPH+iN5TP+88ikFDfZdqTlK3Y9q8I=
 | 
					gopkg.in/gorethink/gorethink.v3 v3.0.5/go.mod h1:+3yIIHJUGMBK+wyPH+iN5TP+88ikFDfZdqTlK3Y9q8I=
 | 
				
			||||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
 | 
					gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
 | 
				
			||||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
 | 
					gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
 | 
				
			||||||
 | 
					gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
 | 
				
			||||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
 | 
					gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
 | 
				
			||||||
 | 
					gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
 | 
				
			||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 | 
					gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 | 
				
			||||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
 | 
					gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
 | 
				
			||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 | 
					gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								vendor/github.com/gofrs/flock/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/gofrs/flock/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,7 +1,8 @@
 | 
				
			|||||||
# flock
 | 
					# flock
 | 
				
			||||||
[](https://travis-ci.org/gofrs/flock)
 | 
					[](https://travis-ci.org/gofrs/flock)
 | 
				
			||||||
[](https://godoc.org/github.com/gofrs/flock)
 | 
					[](https://godoc.org/github.com/gofrs/flock)
 | 
				
			||||||
[](https://github.com/gofrs/flock/blob/master/LICENSE)
 | 
					[](https://github.com/gofrs/flock/blob/master/LICENSE)
 | 
				
			||||||
 | 
					[](https://goreportcard.com/report/github.com/gofrs/flock)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
`flock` implements a thread-safe sync.Locker interface for file locking. It also
 | 
					`flock` implements a thread-safe sync.Locker interface for file locking. It also
 | 
				
			||||||
includes a non-blocking TryLock() function to allow locking without blocking execution.
 | 
					includes a non-blocking TryLock() function to allow locking without blocking execution.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										18
									
								
								vendor/github.com/gofrs/flock/flock.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								vendor/github.com/gofrs/flock/flock.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -2,7 +2,7 @@
 | 
				
			|||||||
// Use of this source code is governed by the BSD 3-Clause
 | 
					// Use of this source code is governed by the BSD 3-Clause
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Package flock implements a thread-safe sync.Locker interface for file locking.
 | 
					// Package flock implements a thread-safe interface for file locking.
 | 
				
			||||||
// It also includes a non-blocking TryLock() function to allow locking
 | 
					// It also includes a non-blocking TryLock() function to allow locking
 | 
				
			||||||
// without blocking execution.
 | 
					// without blocking execution.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
@@ -13,7 +13,7 @@
 | 
				
			|||||||
// guaranteed to be the same on each platform. For example, some UNIX-like
 | 
					// guaranteed to be the same on each platform. For example, some UNIX-like
 | 
				
			||||||
// operating systems will transparently convert a shared lock to an exclusive
 | 
					// operating systems will transparently convert a shared lock to an exclusive
 | 
				
			||||||
// lock. If you Unlock() the flock from a location where you believe that you
 | 
					// lock. If you Unlock() the flock from a location where you believe that you
 | 
				
			||||||
// have the shared lock, you may accidently drop the exclusive lock.
 | 
					// have the shared lock, you may accidentally drop the exclusive lock.
 | 
				
			||||||
package flock
 | 
					package flock
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
@@ -86,17 +86,17 @@ func (f *Flock) String() string {
 | 
				
			|||||||
// conditions is met: TryLock succeeds, TryLock fails with error, or Context
 | 
					// conditions is met: TryLock succeeds, TryLock fails with error, or Context
 | 
				
			||||||
// Done channel is closed.
 | 
					// Done channel is closed.
 | 
				
			||||||
func (f *Flock) TryLockContext(ctx context.Context, retryDelay time.Duration) (bool, error) {
 | 
					func (f *Flock) TryLockContext(ctx context.Context, retryDelay time.Duration) (bool, error) {
 | 
				
			||||||
	return tryCtx(f.TryLock, ctx, retryDelay)
 | 
						return tryCtx(ctx, f.TryLock, retryDelay)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TryRLockContext repeatedly tries to take a shared lock until one of the
 | 
					// TryRLockContext repeatedly tries to take a shared lock until one of the
 | 
				
			||||||
// conditions is met: TryRLock succeeds, TryRLock fails with error, or Context
 | 
					// conditions is met: TryRLock succeeds, TryRLock fails with error, or Context
 | 
				
			||||||
// Done channel is closed.
 | 
					// Done channel is closed.
 | 
				
			||||||
func (f *Flock) TryRLockContext(ctx context.Context, retryDelay time.Duration) (bool, error) {
 | 
					func (f *Flock) TryRLockContext(ctx context.Context, retryDelay time.Duration) (bool, error) {
 | 
				
			||||||
	return tryCtx(f.TryRLock, ctx, retryDelay)
 | 
						return tryCtx(ctx, f.TryRLock, retryDelay)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func tryCtx(fn func() (bool, error), ctx context.Context, retryDelay time.Duration) (bool, error) {
 | 
					func tryCtx(ctx context.Context, fn func() (bool, error), retryDelay time.Duration) (bool, error) {
 | 
				
			||||||
	if ctx.Err() != nil {
 | 
						if ctx.Err() != nil {
 | 
				
			||||||
		return false, ctx.Err()
 | 
							return false, ctx.Err()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -125,3 +125,11 @@ func (f *Flock) setFh() error {
 | 
				
			|||||||
	f.fh = fh
 | 
						f.fh = fh
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ensure the file handle is closed if no lock is held
 | 
				
			||||||
 | 
					func (f *Flock) ensureFhState() {
 | 
				
			||||||
 | 
						if !f.l && !f.r && f.fh != nil {
 | 
				
			||||||
 | 
							f.fh.Close()
 | 
				
			||||||
 | 
							f.fh = nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								vendor/github.com/gofrs/flock/flock_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/gofrs/flock/flock_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -51,6 +51,7 @@ func (f *Flock) lock(locked *bool, flag int) error {
 | 
				
			|||||||
		if err := f.setFh(); err != nil {
 | 
							if err := f.setFh(); err != nil {
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							defer f.ensureFhState()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err := syscall.Flock(int(f.fh.Fd()), flag); err != nil {
 | 
						if err := syscall.Flock(int(f.fh.Fd()), flag); err != nil {
 | 
				
			||||||
@@ -142,6 +143,7 @@ func (f *Flock) try(locked *bool, flag int) (bool, error) {
 | 
				
			|||||||
		if err := f.setFh(); err != nil {
 | 
							if err := f.setFh(); err != nil {
 | 
				
			||||||
			return false, err
 | 
								return false, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							defer f.ensureFhState()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var retried bool
 | 
						var retried bool
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								vendor/github.com/gofrs/flock/flock_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/gofrs/flock/flock_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -46,6 +46,7 @@ func (f *Flock) lock(locked *bool, flag uint32) error {
 | 
				
			|||||||
		if err := f.setFh(); err != nil {
 | 
							if err := f.setFh(); err != nil {
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							defer f.ensureFhState()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if _, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag, 0, 1, 0, &syscall.Overlapped{}); errNo > 0 {
 | 
						if _, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag, 0, 1, 0, &syscall.Overlapped{}); errNo > 0 {
 | 
				
			||||||
@@ -122,6 +123,7 @@ func (f *Flock) try(locked *bool, flag uint32) (bool, error) {
 | 
				
			|||||||
		if err := f.setFh(); err != nil {
 | 
							if err := f.setFh(); err != nil {
 | 
				
			||||||
			return false, err
 | 
								return false, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							defer f.ensureFhState()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag|winLockfileFailImmediately, 0, 1, 0, &syscall.Overlapped{})
 | 
						_, errNo := lockFileEx(syscall.Handle(f.fh.Fd()), flag|winLockfileFailImmediately, 0, 1, 0, &syscall.Overlapped{})
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										24
									
								
								vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,29 @@
 | 
				
			|||||||
# HCL Changelog
 | 
					# HCL Changelog
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## v2.6.0 (June 4, 2020)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Enhancements
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* hcldec: Add a new `Spec`, `ValidateSpec`, which allows custom validation of values at decode-time. ([#387](https://github.com/hashicorp/hcl/pull/387))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Bugs Fixed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* hclsyntax: Fix panic with combination of sequences and null arguments ([#386](https://github.com/hashicorp/hcl/pull/386))
 | 
				
			||||||
 | 
					* hclsyntax: Fix handling of unknown values and sequences ([#386](https://github.com/hashicorp/hcl/pull/386))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## v2.5.1 (May 14, 2020)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Bugs Fixed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* hclwrite: handle legacy dot access of numeric indexes. ([#369](https://github.com/hashicorp/hcl/pull/369))
 | 
				
			||||||
 | 
					* hclwrite: Fix panic for dotted full splat (`foo.*`) ([#374](https://github.com/hashicorp/hcl/pull/374))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## v2.5.0 (May 6, 2020)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Enhancements
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* hclwrite: Generate multi-line objects and maps. ([#372](https://github.com/hashicorp/hcl/pull/372))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## v2.4.0 (Apr 13, 2020)
 | 
					## v2.4.0 (Apr 13, 2020)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Enhancements
 | 
					### Enhancements
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								vendor/github.com/hashicorp/hcl/v2/diagnostic.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/hashicorp/hcl/v2/diagnostic.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -22,14 +22,14 @@ const (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Diagnostic represents information to be presented to a user about an
 | 
					// Diagnostic represents information to be presented to a user about an
 | 
				
			||||||
// error or anomoly in parsing or evaluating configuration.
 | 
					// error or anomaly in parsing or evaluating configuration.
 | 
				
			||||||
type Diagnostic struct {
 | 
					type Diagnostic struct {
 | 
				
			||||||
	Severity DiagnosticSeverity
 | 
						Severity DiagnosticSeverity
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Summary and Detail contain the English-language description of the
 | 
						// Summary and Detail contain the English-language description of the
 | 
				
			||||||
	// problem. Summary is a terse description of the general problem and
 | 
						// problem. Summary is a terse description of the general problem and
 | 
				
			||||||
	// detail is a more elaborate, often-multi-sentence description of
 | 
						// detail is a more elaborate, often-multi-sentence description of
 | 
				
			||||||
	// the probem and what might be done to solve it.
 | 
						// the problem and what might be done to solve it.
 | 
				
			||||||
	Summary string
 | 
						Summary string
 | 
				
			||||||
	Detail  string
 | 
						Detail  string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										31
									
								
								vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										31
									
								
								vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -260,6 +260,20 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		switch {
 | 
							switch {
 | 
				
			||||||
 | 
							case expandVal.Type().Equals(cty.DynamicPseudoType):
 | 
				
			||||||
 | 
								if expandVal.IsNull() {
 | 
				
			||||||
 | 
									diags = append(diags, &hcl.Diagnostic{
 | 
				
			||||||
 | 
										Severity:    hcl.DiagError,
 | 
				
			||||||
 | 
										Summary:     "Invalid expanding argument value",
 | 
				
			||||||
 | 
										Detail:      "The expanding argument (indicated by ...) must not be null.",
 | 
				
			||||||
 | 
										Subject:     expandExpr.Range().Ptr(),
 | 
				
			||||||
 | 
										Context:     e.Range().Ptr(),
 | 
				
			||||||
 | 
										Expression:  expandExpr,
 | 
				
			||||||
 | 
										EvalContext: ctx,
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
									return cty.DynamicVal, diags
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return cty.DynamicVal, diags
 | 
				
			||||||
		case expandVal.Type().IsTupleType() || expandVal.Type().IsListType() || expandVal.Type().IsSetType():
 | 
							case expandVal.Type().IsTupleType() || expandVal.Type().IsListType() || expandVal.Type().IsSetType():
 | 
				
			||||||
			if expandVal.IsNull() {
 | 
								if expandVal.IsNull() {
 | 
				
			||||||
				diags = append(diags, &hcl.Diagnostic{
 | 
									diags = append(diags, &hcl.Diagnostic{
 | 
				
			||||||
@@ -406,6 +420,22 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti
 | 
				
			|||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				param = varParam
 | 
									param = varParam
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// this can happen if an argument is (incorrectly) null.
 | 
				
			||||||
 | 
								if i > len(e.Args)-1 {
 | 
				
			||||||
 | 
									diags = append(diags, &hcl.Diagnostic{
 | 
				
			||||||
 | 
										Severity: hcl.DiagError,
 | 
				
			||||||
 | 
										Summary:  "Invalid function argument",
 | 
				
			||||||
 | 
										Detail: fmt.Sprintf(
 | 
				
			||||||
 | 
											"Invalid value for %q parameter: %s.",
 | 
				
			||||||
 | 
											param.Name, err,
 | 
				
			||||||
 | 
										),
 | 
				
			||||||
 | 
										Subject:     args[len(params)].StartRange().Ptr(),
 | 
				
			||||||
 | 
										Context:     e.Range().Ptr(),
 | 
				
			||||||
 | 
										Expression:  e,
 | 
				
			||||||
 | 
										EvalContext: ctx,
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
				argExpr := e.Args[i]
 | 
									argExpr := e.Args[i]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// TODO: we should also unpick a PathError here and show the
 | 
									// TODO: we should also unpick a PathError here and show the
 | 
				
			||||||
@@ -422,6 +452,7 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti
 | 
				
			|||||||
					Expression:  argExpr,
 | 
										Expression:  argExpr,
 | 
				
			||||||
					EvalContext: ctx,
 | 
										EvalContext: ctx,
 | 
				
			||||||
				})
 | 
									})
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
			diags = append(diags, &hcl.Diagnostic{
 | 
								diags = append(diags, &hcl.Diagnostic{
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -670,6 +670,7 @@ Traversal:
 | 
				
			|||||||
				trav := make(hcl.Traversal, 0, 1)
 | 
									trav := make(hcl.Traversal, 0, 1)
 | 
				
			||||||
				var firstRange, lastRange hcl.Range
 | 
									var firstRange, lastRange hcl.Range
 | 
				
			||||||
				firstRange = p.NextRange()
 | 
									firstRange = p.NextRange()
 | 
				
			||||||
 | 
									lastRange = marker.Range
 | 
				
			||||||
				for p.Peek().Type == TokenDot {
 | 
									for p.Peek().Type == TokenDot {
 | 
				
			||||||
					dot := p.Read()
 | 
										dot := p.Read()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										16
									
								
								vendor/github.com/hashicorp/hcl/v2/hclwrite/generate.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								vendor/github.com/hashicorp/hcl/v2/hclwrite/generate.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -119,15 +119,15 @@ func appendTokensForValue(val cty.Value, toks Tokens) Tokens {
 | 
				
			|||||||
			Type:  hclsyntax.TokenOBrace,
 | 
								Type:  hclsyntax.TokenOBrace,
 | 
				
			||||||
			Bytes: []byte{'{'},
 | 
								Bytes: []byte{'{'},
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
 | 
							if val.LengthInt() > 0 {
 | 
				
			||||||
 | 
								toks = append(toks, &Token{
 | 
				
			||||||
 | 
									Type:  hclsyntax.TokenNewline,
 | 
				
			||||||
 | 
									Bytes: []byte{'\n'},
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		i := 0
 | 
							i := 0
 | 
				
			||||||
		for it := val.ElementIterator(); it.Next(); {
 | 
							for it := val.ElementIterator(); it.Next(); {
 | 
				
			||||||
			if i > 0 {
 | 
					 | 
				
			||||||
				toks = append(toks, &Token{
 | 
					 | 
				
			||||||
					Type:  hclsyntax.TokenComma,
 | 
					 | 
				
			||||||
					Bytes: []byte{','},
 | 
					 | 
				
			||||||
				})
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			eKey, eVal := it.Element()
 | 
								eKey, eVal := it.Element()
 | 
				
			||||||
			if hclsyntax.ValidIdentifier(eKey.AsString()) {
 | 
								if hclsyntax.ValidIdentifier(eKey.AsString()) {
 | 
				
			||||||
				toks = append(toks, &Token{
 | 
									toks = append(toks, &Token{
 | 
				
			||||||
@@ -142,6 +142,10 @@ func appendTokensForValue(val cty.Value, toks Tokens) Tokens {
 | 
				
			|||||||
				Bytes: []byte{'='},
 | 
									Bytes: []byte{'='},
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
			toks = appendTokensForValue(eVal, toks)
 | 
								toks = appendTokensForValue(eVal, toks)
 | 
				
			||||||
 | 
								toks = append(toks, &Token{
 | 
				
			||||||
 | 
									Type:  hclsyntax.TokenNewline,
 | 
				
			||||||
 | 
									Bytes: []byte{'\n'},
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
			i++
 | 
								i++
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										27
									
								
								vendor/github.com/hashicorp/hcl/v2/hclwrite/parser.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										27
									
								
								vendor/github.com/hashicorp/hcl/v2/hclwrite/parser.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -88,6 +88,16 @@ func (it inputTokens) PartitionType(ty hclsyntax.TokenType) (before, within, aft
 | 
				
			|||||||
	panic(fmt.Sprintf("didn't find any token of type %s", ty))
 | 
						panic(fmt.Sprintf("didn't find any token of type %s", ty))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (it inputTokens) PartitionTypeOk(ty hclsyntax.TokenType) (before, within, after inputTokens, ok bool) {
 | 
				
			||||||
 | 
						for i, t := range it.writerTokens {
 | 
				
			||||||
 | 
							if t.Type == ty {
 | 
				
			||||||
 | 
								return it.Slice(0, i), it.Slice(i, i+1), it.Slice(i+1, len(it.nativeTokens)), true
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return inputTokens{}, inputTokens{}, inputTokens{}, false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (it inputTokens) PartitionTypeSingle(ty hclsyntax.TokenType) (before inputTokens, found *Token, after inputTokens) {
 | 
					func (it inputTokens) PartitionTypeSingle(ty hclsyntax.TokenType) (before inputTokens, found *Token, after inputTokens) {
 | 
				
			||||||
	before, within, after := it.PartitionType(ty)
 | 
						before, within, after := it.PartitionType(ty)
 | 
				
			||||||
	if within.Len() != 1 {
 | 
						if within.Len() != 1 {
 | 
				
			||||||
@@ -404,6 +414,19 @@ func parseTraversalStep(nativeStep hcl.Traverser, from inputTokens) (before inpu
 | 
				
			|||||||
		children = step.inTree.children
 | 
							children = step.inTree.children
 | 
				
			||||||
		before, from, after = from.Partition(nativeStep.SourceRange())
 | 
							before, from, after = from.Partition(nativeStep.SourceRange())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if inBefore, dot, from, ok := from.PartitionTypeOk(hclsyntax.TokenDot); ok {
 | 
				
			||||||
 | 
								children.AppendUnstructuredTokens(inBefore.Tokens())
 | 
				
			||||||
 | 
								children.AppendUnstructuredTokens(dot.Tokens())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								valBefore, valToken, valAfter := from.PartitionTypeSingle(hclsyntax.TokenNumberLit)
 | 
				
			||||||
 | 
								children.AppendUnstructuredTokens(valBefore.Tokens())
 | 
				
			||||||
 | 
								key := newNumber(valToken)
 | 
				
			||||||
 | 
								step.key = children.Append(key)
 | 
				
			||||||
 | 
								children.AppendUnstructuredTokens(valAfter.Tokens())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								return before, newNode(step), after
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		var inBefore, oBrack, keyTokens, cBrack inputTokens
 | 
							var inBefore, oBrack, keyTokens, cBrack inputTokens
 | 
				
			||||||
		inBefore, oBrack, from = from.PartitionType(hclsyntax.TokenOBrack)
 | 
							inBefore, oBrack, from = from.PartitionType(hclsyntax.TokenOBrack)
 | 
				
			||||||
		children.AppendUnstructuredTokens(inBefore.Tokens())
 | 
							children.AppendUnstructuredTokens(inBefore.Tokens())
 | 
				
			||||||
@@ -498,8 +521,8 @@ func writerTokens(nativeTokens hclsyntax.Tokens) Tokens {
 | 
				
			|||||||
// The tokens are assumed to be in source order and non-overlapping, which
 | 
					// The tokens are assumed to be in source order and non-overlapping, which
 | 
				
			||||||
// will be true if the token sequence from the scanner is used directly.
 | 
					// will be true if the token sequence from the scanner is used directly.
 | 
				
			||||||
func partitionTokens(toks hclsyntax.Tokens, rng hcl.Range) (start, end int) {
 | 
					func partitionTokens(toks hclsyntax.Tokens, rng hcl.Range) (start, end int) {
 | 
				
			||||||
	// We us a linear search here because we assume tha in most cases our
 | 
						// We use a linear search here because we assume that in most cases our
 | 
				
			||||||
	// target range is close to the beginning of the sequence, and the seqences
 | 
						// target range is close to the beginning of the sequence, and the sequences
 | 
				
			||||||
	// are generally small for most reasonable files anyway.
 | 
						// are generally small for most reasonable files anyway.
 | 
				
			||||||
	for i := 0; ; i++ {
 | 
						for i := 0; ; i++ {
 | 
				
			||||||
		if i >= len(toks) {
 | 
							if i >= len(toks) {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								vendor/github.com/konsorten/go-windows-terminal-sequences/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/konsorten/go-windows-terminal-sequences/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -27,6 +27,7 @@ We thank all the authors who provided code to this library:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
* Felix Kollmann
 | 
					* Felix Kollmann
 | 
				
			||||||
* Nicolas Perraut
 | 
					* Nicolas Perraut
 | 
				
			||||||
 | 
					* @dirty49374
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## License
 | 
					## License
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								vendor/github.com/konsorten/go-windows-terminal-sequences/sequences.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/konsorten/go-windows-terminal-sequences/sequences.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -4,7 +4,6 @@ package sequences
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"syscall"
 | 
						"syscall"
 | 
				
			||||||
	"unsafe"
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
@@ -27,7 +26,7 @@ func EnableVirtualTerminalProcessing(stream syscall.Handle, enable bool) error {
 | 
				
			|||||||
		mode &^= ENABLE_VIRTUAL_TERMINAL_PROCESSING
 | 
							mode &^= ENABLE_VIRTUAL_TERMINAL_PROCESSING
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret, _, err := setConsoleMode.Call(uintptr(unsafe.Pointer(stream)), uintptr(mode))
 | 
						ret, _, err := setConsoleMode.Call(uintptr(stream), uintptr(mode))
 | 
				
			||||||
	if ret == 0 {
 | 
						if ret == 0 {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -32,6 +32,9 @@ const (
 | 
				
			|||||||
	// CapFrontendInputs is a capability to request frontend inputs from the
 | 
						// CapFrontendInputs is a capability to request frontend inputs from the
 | 
				
			||||||
	// LLBBridge GRPC server.
 | 
						// LLBBridge GRPC server.
 | 
				
			||||||
	CapFrontendInputs apicaps.CapID = "frontend.inputs"
 | 
						CapFrontendInputs apicaps.CapID = "frontend.inputs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// CapGatewaySolveMetadata can be used to check if solve calls from gateway reliably return metadata
 | 
				
			||||||
 | 
						CapGatewaySolveMetadata apicaps.CapID = "gateway.solve.metadata"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
@@ -126,4 +129,11 @@ func init() {
 | 
				
			|||||||
		Enabled: true,
 | 
							Enabled: true,
 | 
				
			||||||
		Status:  apicaps.CapStatusExperimental,
 | 
							Status:  apicaps.CapStatusExperimental,
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Caps.Init(apicaps.Cap{
 | 
				
			||||||
 | 
							ID:      CapGatewaySolveMetadata,
 | 
				
			||||||
 | 
							Name:    "gateway metadata",
 | 
				
			||||||
 | 
							Enabled: true,
 | 
				
			||||||
 | 
							Status:  apicaps.CapStatusExperimental,
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										9
									
								
								vendor/github.com/moby/buildkit/session/filesync/filesync.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/github.com/moby/buildkit/session/filesync/filesync.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -255,7 +255,7 @@ func (sp *fsSyncTarget) Register(server *grpc.Server) {
 | 
				
			|||||||
	RegisterFileSendServer(server, sp)
 | 
						RegisterFileSendServer(server, sp)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (sp *fsSyncTarget) DiffCopy(stream FileSend_DiffCopyServer) error {
 | 
					func (sp *fsSyncTarget) DiffCopy(stream FileSend_DiffCopyServer) (err error) {
 | 
				
			||||||
	if sp.outdir != "" {
 | 
						if sp.outdir != "" {
 | 
				
			||||||
		return syncTargetDiffCopy(stream, sp.outdir)
 | 
							return syncTargetDiffCopy(stream, sp.outdir)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -277,7 +277,12 @@ func (sp *fsSyncTarget) DiffCopy(stream FileSend_DiffCopyServer) error {
 | 
				
			|||||||
	if wc == nil {
 | 
						if wc == nil {
 | 
				
			||||||
		return status.Errorf(codes.AlreadyExists, "target already exists")
 | 
							return status.Errorf(codes.AlreadyExists, "target already exists")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	defer wc.Close()
 | 
						defer func() {
 | 
				
			||||||
 | 
							err1 := wc.Close()
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								err = err1
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
	return writeTargetFile(stream, wc)
 | 
						return writeTargetFile(stream, wc)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								vendor/github.com/moby/buildkit/util/entitlements/entitlements.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/moby/buildkit/util/entitlements/entitlements.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -43,7 +43,7 @@ func WhiteList(allowed, supported []Entitlement) (Set, error) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		if supported != nil {
 | 
							if supported != nil {
 | 
				
			||||||
			if !supm.Allowed(e) {
 | 
								if !supm.Allowed(e) {
 | 
				
			||||||
				return nil, errors.Errorf("entitlement %s is not allowed", e)
 | 
									return nil, errors.Errorf("granting entitlement %s is not allowed by build daemon configuration", e)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		m[e] = struct{}{}
 | 
							m[e] = struct{}{}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										73
									
								
								vendor/github.com/prometheus/client_golang/prometheus/collector.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										73
									
								
								vendor/github.com/prometheus/client_golang/prometheus/collector.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -29,27 +29,72 @@ type Collector interface {
 | 
				
			|||||||
	// collected by this Collector to the provided channel and returns once
 | 
						// collected by this Collector to the provided channel and returns once
 | 
				
			||||||
	// the last descriptor has been sent. The sent descriptors fulfill the
 | 
						// the last descriptor has been sent. The sent descriptors fulfill the
 | 
				
			||||||
	// consistency and uniqueness requirements described in the Desc
 | 
						// consistency and uniqueness requirements described in the Desc
 | 
				
			||||||
	// documentation. (It is valid if one and the same Collector sends
 | 
						// documentation.
 | 
				
			||||||
	// duplicate descriptors. Those duplicates are simply ignored. However,
 | 
						//
 | 
				
			||||||
	// two different Collectors must not send duplicate descriptors.) This
 | 
						// It is valid if one and the same Collector sends duplicate
 | 
				
			||||||
	// method idempotently sends the same descriptors throughout the
 | 
						// descriptors. Those duplicates are simply ignored. However, two
 | 
				
			||||||
	// lifetime of the Collector. If a Collector encounters an error while
 | 
						// different Collectors must not send duplicate descriptors.
 | 
				
			||||||
	// executing this method, it must send an invalid descriptor (created
 | 
						//
 | 
				
			||||||
	// with NewInvalidDesc) to signal the error to the registry.
 | 
						// Sending no descriptor at all marks the Collector as “unchecked”,
 | 
				
			||||||
 | 
						// i.e. no checks will be performed at registration time, and the
 | 
				
			||||||
 | 
						// Collector may yield any Metric it sees fit in its Collect method.
 | 
				
			||||||
 | 
						//
 | 
				
			||||||
 | 
						// This method idempotently sends the same descriptors throughout the
 | 
				
			||||||
 | 
						// lifetime of the Collector. It may be called concurrently and
 | 
				
			||||||
 | 
						// therefore must be implemented in a concurrency safe way.
 | 
				
			||||||
 | 
						//
 | 
				
			||||||
 | 
						// If a Collector encounters an error while executing this method, it
 | 
				
			||||||
 | 
						// must send an invalid descriptor (created with NewInvalidDesc) to
 | 
				
			||||||
 | 
						// signal the error to the registry.
 | 
				
			||||||
	Describe(chan<- *Desc)
 | 
						Describe(chan<- *Desc)
 | 
				
			||||||
	// Collect is called by the Prometheus registry when collecting
 | 
						// Collect is called by the Prometheus registry when collecting
 | 
				
			||||||
	// metrics. The implementation sends each collected metric via the
 | 
						// metrics. The implementation sends each collected metric via the
 | 
				
			||||||
	// provided channel and returns once the last metric has been sent. The
 | 
						// provided channel and returns once the last metric has been sent. The
 | 
				
			||||||
	// descriptor of each sent metric is one of those returned by
 | 
						// descriptor of each sent metric is one of those returned by Describe
 | 
				
			||||||
	// Describe. Returned metrics that share the same descriptor must differ
 | 
						// (unless the Collector is unchecked, see above). Returned metrics that
 | 
				
			||||||
	// in their variable label values. This method may be called
 | 
						// share the same descriptor must differ in their variable label
 | 
				
			||||||
	// concurrently and must therefore be implemented in a concurrency safe
 | 
						// values.
 | 
				
			||||||
	// way. Blocking occurs at the expense of total performance of rendering
 | 
						//
 | 
				
			||||||
	// all registered metrics. Ideally, Collector implementations support
 | 
						// This method may be called concurrently and must therefore be
 | 
				
			||||||
	// concurrent readers.
 | 
						// implemented in a concurrency safe way. Blocking occurs at the expense
 | 
				
			||||||
 | 
						// of total performance of rendering all registered metrics. Ideally,
 | 
				
			||||||
 | 
						// Collector implementations support concurrent readers.
 | 
				
			||||||
	Collect(chan<- Metric)
 | 
						Collect(chan<- Metric)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// DescribeByCollect is a helper to implement the Describe method of a custom
 | 
				
			||||||
 | 
					// Collector. It collects the metrics from the provided Collector and sends
 | 
				
			||||||
 | 
					// their descriptors to the provided channel.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// If a Collector collects the same metrics throughout its lifetime, its
 | 
				
			||||||
 | 
					// Describe method can simply be implemented as:
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//   func (c customCollector) Describe(ch chan<- *Desc) {
 | 
				
			||||||
 | 
					//   	DescribeByCollect(c, ch)
 | 
				
			||||||
 | 
					//   }
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// However, this will not work if the metrics collected change dynamically over
 | 
				
			||||||
 | 
					// the lifetime of the Collector in a way that their combined set of descriptors
 | 
				
			||||||
 | 
					// changes as well. The shortcut implementation will then violate the contract
 | 
				
			||||||
 | 
					// of the Describe method. If a Collector sometimes collects no metrics at all
 | 
				
			||||||
 | 
					// (for example vectors like CounterVec, GaugeVec, etc., which only collect
 | 
				
			||||||
 | 
					// metrics after a metric with a fully specified label set has been accessed),
 | 
				
			||||||
 | 
					// it might even get registered as an unchecked Collector (cf. the Register
 | 
				
			||||||
 | 
					// method of the Registerer interface). Hence, only use this shortcut
 | 
				
			||||||
 | 
					// implementation of Describe if you are certain to fulfill the contract.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// The Collector example demonstrates a use of DescribeByCollect.
 | 
				
			||||||
 | 
					func DescribeByCollect(c Collector, descs chan<- *Desc) {
 | 
				
			||||||
 | 
						metrics := make(chan Metric)
 | 
				
			||||||
 | 
						go func() {
 | 
				
			||||||
 | 
							c.Collect(metrics)
 | 
				
			||||||
 | 
							close(metrics)
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
 | 
						for m := range metrics {
 | 
				
			||||||
 | 
							descs <- m.Desc()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// selfCollector implements Collector for a single Metric so that the Metric
 | 
					// selfCollector implements Collector for a single Metric so that the Metric
 | 
				
			||||||
// collects itself. Add it as an anonymous field to a struct that implements
 | 
					// collects itself. Add it as an anonymous field to a struct that implements
 | 
				
			||||||
// Metric, and call init with the Metric itself as an argument.
 | 
					// Metric, and call init with the Metric itself as an argument.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								vendor/github.com/prometheus/client_golang/prometheus/counter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/prometheus/client_golang/prometheus/counter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -136,7 +136,7 @@ func NewCounterVec(opts CounterOpts, labelNames []string) *CounterVec {
 | 
				
			|||||||
	return &CounterVec{
 | 
						return &CounterVec{
 | 
				
			||||||
		metricVec: newMetricVec(desc, func(lvs ...string) Metric {
 | 
							metricVec: newMetricVec(desc, func(lvs ...string) Metric {
 | 
				
			||||||
			if len(lvs) != len(desc.variableLabels) {
 | 
								if len(lvs) != len(desc.variableLabels) {
 | 
				
			||||||
				panic(errInconsistentCardinality)
 | 
									panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, lvs))
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			result := &counter{desc: desc, labelPairs: makeLabelPairs(desc, lvs)}
 | 
								result := &counter{desc: desc, labelPairs: makeLabelPairs(desc, lvs)}
 | 
				
			||||||
			result.init(result) // Init self-collection.
 | 
								result.init(result) // Init self-collection.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								vendor/github.com/prometheus/client_golang/prometheus/desc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/prometheus/client_golang/prometheus/desc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -67,7 +67,7 @@ type Desc struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// NewDesc allocates and initializes a new Desc. Errors are recorded in the Desc
 | 
					// NewDesc allocates and initializes a new Desc. Errors are recorded in the Desc
 | 
				
			||||||
// and will be reported on registration time. variableLabels and constLabels can
 | 
					// and will be reported on registration time. variableLabels and constLabels can
 | 
				
			||||||
// be nil if no such labels should be set. fqName and help must not be empty.
 | 
					// be nil if no such labels should be set. fqName must not be empty.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// variableLabels only contain the label names. Their label values are variable
 | 
					// variableLabels only contain the label names. Their label values are variable
 | 
				
			||||||
// and therefore not part of the Desc. (They are managed within the Metric.)
 | 
					// and therefore not part of the Desc. (They are managed within the Metric.)
 | 
				
			||||||
@@ -80,10 +80,6 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *
 | 
				
			|||||||
		help:           help,
 | 
							help:           help,
 | 
				
			||||||
		variableLabels: variableLabels,
 | 
							variableLabels: variableLabels,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if help == "" {
 | 
					 | 
				
			||||||
		d.err = errors.New("empty help string")
 | 
					 | 
				
			||||||
		return d
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if !model.IsValidMetricName(model.LabelValue(fqName)) {
 | 
						if !model.IsValidMetricName(model.LabelValue(fqName)) {
 | 
				
			||||||
		d.err = fmt.Errorf("%q is not a valid metric name", fqName)
 | 
							d.err = fmt.Errorf("%q is not a valid metric name", fqName)
 | 
				
			||||||
		return d
 | 
							return d
 | 
				
			||||||
@@ -97,7 +93,7 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *
 | 
				
			|||||||
	// First add only the const label names and sort them...
 | 
						// First add only the const label names and sort them...
 | 
				
			||||||
	for labelName := range constLabels {
 | 
						for labelName := range constLabels {
 | 
				
			||||||
		if !checkLabelName(labelName) {
 | 
							if !checkLabelName(labelName) {
 | 
				
			||||||
			d.err = fmt.Errorf("%q is not a valid label name", labelName)
 | 
								d.err = fmt.Errorf("%q is not a valid label name for metric %q", labelName, fqName)
 | 
				
			||||||
			return d
 | 
								return d
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		labelNames = append(labelNames, labelName)
 | 
							labelNames = append(labelNames, labelName)
 | 
				
			||||||
@@ -119,7 +115,7 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *
 | 
				
			|||||||
	// dimension with a different mix between preset and variable labels.
 | 
						// dimension with a different mix between preset and variable labels.
 | 
				
			||||||
	for _, labelName := range variableLabels {
 | 
						for _, labelName := range variableLabels {
 | 
				
			||||||
		if !checkLabelName(labelName) {
 | 
							if !checkLabelName(labelName) {
 | 
				
			||||||
			d.err = fmt.Errorf("%q is not a valid label name", labelName)
 | 
								d.err = fmt.Errorf("%q is not a valid label name for metric %q", labelName, fqName)
 | 
				
			||||||
			return d
 | 
								return d
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		labelNames = append(labelNames, "$"+labelName)
 | 
							labelNames = append(labelNames, "$"+labelName)
 | 
				
			||||||
@@ -156,7 +152,7 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *
 | 
				
			|||||||
			Value: proto.String(v),
 | 
								Value: proto.String(v),
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	sort.Sort(LabelPairSorter(d.constLabelPairs))
 | 
						sort.Sort(labelPairSorter(d.constLabelPairs))
 | 
				
			||||||
	return d
 | 
						return d
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										27
									
								
								vendor/github.com/prometheus/client_golang/prometheus/doc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										27
									
								
								vendor/github.com/prometheus/client_golang/prometheus/doc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -11,10 +11,12 @@
 | 
				
			|||||||
// See the License for the specific language governing permissions and
 | 
					// See the License for the specific language governing permissions and
 | 
				
			||||||
// limitations under the License.
 | 
					// limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Package prometheus provides metrics primitives to instrument code for
 | 
					// Package prometheus is the core instrumentation package. It provides metrics
 | 
				
			||||||
// monitoring. It also offers a registry for metrics. Sub-packages allow to
 | 
					// primitives to instrument code for monitoring. It also offers a registry for
 | 
				
			||||||
// expose the registered metrics via HTTP (package promhttp) or push them to a
 | 
					// metrics. Sub-packages allow to expose the registered metrics via HTTP
 | 
				
			||||||
// Pushgateway (package push).
 | 
					// (package promhttp) or push them to a Pushgateway (package push). There is
 | 
				
			||||||
 | 
					// also a sub-package promauto, which provides metrics constructors with
 | 
				
			||||||
 | 
					// automatic registration.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// All exported functions and methods are safe to be used concurrently unless
 | 
					// All exported functions and methods are safe to be used concurrently unless
 | 
				
			||||||
// specified otherwise.
 | 
					// specified otherwise.
 | 
				
			||||||
@@ -72,7 +74,10 @@
 | 
				
			|||||||
// The number of exported identifiers in this package might appear a bit
 | 
					// The number of exported identifiers in this package might appear a bit
 | 
				
			||||||
// overwhelming. However, in addition to the basic plumbing shown in the example
 | 
					// overwhelming. However, in addition to the basic plumbing shown in the example
 | 
				
			||||||
// above, you only need to understand the different metric types and their
 | 
					// above, you only need to understand the different metric types and their
 | 
				
			||||||
// vector versions for basic usage.
 | 
					// vector versions for basic usage. Furthermore, if you are not concerned with
 | 
				
			||||||
 | 
					// fine-grained control of when and how to register metrics with the registry,
 | 
				
			||||||
 | 
					// have a look at the promauto package, which will effectively allow you to
 | 
				
			||||||
 | 
					// ignore registration altogether in simple cases.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Above, you have already touched the Counter and the Gauge. There are two more
 | 
					// Above, you have already touched the Counter and the Gauge. There are two more
 | 
				
			||||||
// advanced metric types: the Summary and Histogram. A more thorough description
 | 
					// advanced metric types: the Summary and Histogram. A more thorough description
 | 
				
			||||||
@@ -116,7 +121,17 @@
 | 
				
			|||||||
// NewConstSummary (and their respective Must… versions). That will happen in
 | 
					// NewConstSummary (and their respective Must… versions). That will happen in
 | 
				
			||||||
// the Collect method. The Describe method has to return separate Desc
 | 
					// the Collect method. The Describe method has to return separate Desc
 | 
				
			||||||
// instances, representative of the “throw-away” metrics to be created later.
 | 
					// instances, representative of the “throw-away” metrics to be created later.
 | 
				
			||||||
// NewDesc comes in handy to create those Desc instances.
 | 
					// NewDesc comes in handy to create those Desc instances. Alternatively, you
 | 
				
			||||||
 | 
					// could return no Desc at all, which will mark the Collector “unchecked”.  No
 | 
				
			||||||
 | 
					// checks are performed at registration time, but metric consistency will still
 | 
				
			||||||
 | 
					// be ensured at scrape time, i.e. any inconsistencies will lead to scrape
 | 
				
			||||||
 | 
					// errors. Thus, with unchecked Collectors, the responsibility to not collect
 | 
				
			||||||
 | 
					// metrics that lead to inconsistencies in the total scrape result lies with the
 | 
				
			||||||
 | 
					// implementer of the Collector. While this is not a desirable state, it is
 | 
				
			||||||
 | 
					// sometimes necessary. The typical use case is a situation where the exact
 | 
				
			||||||
 | 
					// metrics to be returned by a Collector cannot be predicted at registration
 | 
				
			||||||
 | 
					// time, but the implementer has sufficient knowledge of the whole system to
 | 
				
			||||||
 | 
					// guarantee metric consistency.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// The Collector example illustrates the use case. You can also look at the
 | 
					// The Collector example illustrates the use case. You can also look at the
 | 
				
			||||||
// source code of the processCollector (mirroring process metrics), the
 | 
					// source code of the processCollector (mirroring process metrics), the
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								vendor/github.com/prometheus/client_golang/prometheus/fnv.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								vendor/github.com/prometheus/client_golang/prometheus/fnv.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,3 +1,16 @@
 | 
				
			|||||||
 | 
					// Copyright 2018 The Prometheus Authors
 | 
				
			||||||
 | 
					// Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 | 
					// you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
					// You may obtain a copy of the License at
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// http://www.apache.org/licenses/LICENSE-2.0
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Unless required by applicable law or agreed to in writing, software
 | 
				
			||||||
 | 
					// distributed under the License is distributed on an "AS IS" BASIS,
 | 
				
			||||||
 | 
					// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
				
			||||||
 | 
					// See the License for the specific language governing permissions and
 | 
				
			||||||
 | 
					// limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package prometheus
 | 
					package prometheus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Inline and byte-free variant of hash/fnv's fnv64a.
 | 
					// Inline and byte-free variant of hash/fnv's fnv64a.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								vendor/github.com/prometheus/client_golang/prometheus/gauge.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/prometheus/client_golang/prometheus/gauge.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -147,7 +147,7 @@ func NewGaugeVec(opts GaugeOpts, labelNames []string) *GaugeVec {
 | 
				
			|||||||
	return &GaugeVec{
 | 
						return &GaugeVec{
 | 
				
			||||||
		metricVec: newMetricVec(desc, func(lvs ...string) Metric {
 | 
							metricVec: newMetricVec(desc, func(lvs ...string) Metric {
 | 
				
			||||||
			if len(lvs) != len(desc.variableLabels) {
 | 
								if len(lvs) != len(desc.variableLabels) {
 | 
				
			||||||
				panic(errInconsistentCardinality)
 | 
									panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, lvs))
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			result := &gauge{desc: desc, labelPairs: makeLabelPairs(desc, lvs)}
 | 
								result := &gauge{desc: desc, labelPairs: makeLabelPairs(desc, lvs)}
 | 
				
			||||||
			result.init(result) // Init self-collection.
 | 
								result.init(result) // Init self-collection.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										106
									
								
								vendor/github.com/prometheus/client_golang/prometheus/go_collector.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										106
									
								
								vendor/github.com/prometheus/client_golang/prometheus/go_collector.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,9 +1,22 @@
 | 
				
			|||||||
 | 
					// Copyright 2018 The Prometheus Authors
 | 
				
			||||||
 | 
					// Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 | 
					// you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
					// You may obtain a copy of the License at
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// http://www.apache.org/licenses/LICENSE-2.0
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Unless required by applicable law or agreed to in writing, software
 | 
				
			||||||
 | 
					// distributed under the License is distributed on an "AS IS" BASIS,
 | 
				
			||||||
 | 
					// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
				
			||||||
 | 
					// See the License for the specific language governing permissions and
 | 
				
			||||||
 | 
					// limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package prometheus
 | 
					package prometheus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
					 | 
				
			||||||
	"runtime"
 | 
						"runtime"
 | 
				
			||||||
	"runtime/debug"
 | 
						"runtime/debug"
 | 
				
			||||||
 | 
						"sync"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -13,12 +26,41 @@ type goCollector struct {
 | 
				
			|||||||
	gcDesc         *Desc
 | 
						gcDesc         *Desc
 | 
				
			||||||
	goInfoDesc     *Desc
 | 
						goInfoDesc     *Desc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// metrics to describe and collect
 | 
						// ms... are memstats related.
 | 
				
			||||||
	metrics memStatsMetrics
 | 
						msLast          *runtime.MemStats // Previously collected memstats.
 | 
				
			||||||
 | 
						msLastTimestamp time.Time
 | 
				
			||||||
 | 
						msMtx           sync.Mutex // Protects msLast and msLastTimestamp.
 | 
				
			||||||
 | 
						msMetrics       memStatsMetrics
 | 
				
			||||||
 | 
						msRead          func(*runtime.MemStats) // For mocking in tests.
 | 
				
			||||||
 | 
						msMaxWait       time.Duration           // Wait time for fresh memstats.
 | 
				
			||||||
 | 
						msMaxAge        time.Duration           // Maximum allowed age of old memstats.
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NewGoCollector returns a collector which exports metrics about the current
 | 
					// NewGoCollector returns a collector which exports metrics about the current Go
 | 
				
			||||||
// go process.
 | 
					// process. This includes memory stats. To collect those, runtime.ReadMemStats
 | 
				
			||||||
 | 
					// is called. This requires to “stop the world”, which usually only happens for
 | 
				
			||||||
 | 
					// garbage collection (GC). Take the following implications into account when
 | 
				
			||||||
 | 
					// deciding whether to use the Go collector:
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// 1. The performance impact of stopping the world is the more relevant the more
 | 
				
			||||||
 | 
					// frequently metrics are collected. However, with Go1.9 or later the
 | 
				
			||||||
 | 
					// stop-the-world time per metrics collection is very short (~25µs) so that the
 | 
				
			||||||
 | 
					// performance impact will only matter in rare cases. However, with older Go
 | 
				
			||||||
 | 
					// versions, the stop-the-world duration depends on the heap size and can be
 | 
				
			||||||
 | 
					// quite significant (~1.7 ms/GiB as per
 | 
				
			||||||
 | 
					// https://go-review.googlesource.com/c/go/+/34937).
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// 2. During an ongoing GC, nothing else can stop the world. Therefore, if the
 | 
				
			||||||
 | 
					// metrics collection happens to coincide with GC, it will only complete after
 | 
				
			||||||
 | 
					// GC has finished. Usually, GC is fast enough to not cause problems. However,
 | 
				
			||||||
 | 
					// with a very large heap, GC might take multiple seconds, which is enough to
 | 
				
			||||||
 | 
					// cause scrape timeouts in common setups. To avoid this problem, the Go
 | 
				
			||||||
 | 
					// collector will use the memstats from a previous collection if
 | 
				
			||||||
 | 
					// runtime.ReadMemStats takes more than 1s. However, if there are no previously
 | 
				
			||||||
 | 
					// collected memstats, or their collection is more than 5m ago, the collection
 | 
				
			||||||
 | 
					// will block until runtime.ReadMemStats succeeds. (The problem might be solved
 | 
				
			||||||
 | 
					// in Go1.13, see https://github.com/golang/go/issues/19812 for the related Go
 | 
				
			||||||
 | 
					// issue.)
 | 
				
			||||||
func NewGoCollector() Collector {
 | 
					func NewGoCollector() Collector {
 | 
				
			||||||
	return &goCollector{
 | 
						return &goCollector{
 | 
				
			||||||
		goroutinesDesc: NewDesc(
 | 
							goroutinesDesc: NewDesc(
 | 
				
			||||||
@@ -37,7 +79,11 @@ func NewGoCollector() Collector {
 | 
				
			|||||||
			"go_info",
 | 
								"go_info",
 | 
				
			||||||
			"Information about the Go environment.",
 | 
								"Information about the Go environment.",
 | 
				
			||||||
			nil, Labels{"version": runtime.Version()}),
 | 
								nil, Labels{"version": runtime.Version()}),
 | 
				
			||||||
		metrics: memStatsMetrics{
 | 
							msLast:    &runtime.MemStats{},
 | 
				
			||||||
 | 
							msRead:    runtime.ReadMemStats,
 | 
				
			||||||
 | 
							msMaxWait: time.Second,
 | 
				
			||||||
 | 
							msMaxAge:  5 * time.Minute,
 | 
				
			||||||
 | 
							msMetrics: memStatsMetrics{
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				desc: NewDesc(
 | 
									desc: NewDesc(
 | 
				
			||||||
					memstatNamespace("alloc_bytes"),
 | 
										memstatNamespace("alloc_bytes"),
 | 
				
			||||||
@@ -236,7 +282,7 @@ func NewGoCollector() Collector {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func memstatNamespace(s string) string {
 | 
					func memstatNamespace(s string) string {
 | 
				
			||||||
	return fmt.Sprintf("go_memstats_%s", s)
 | 
						return "go_memstats_" + s
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Describe returns all descriptions of the collector.
 | 
					// Describe returns all descriptions of the collector.
 | 
				
			||||||
@@ -245,13 +291,27 @@ func (c *goCollector) Describe(ch chan<- *Desc) {
 | 
				
			|||||||
	ch <- c.threadsDesc
 | 
						ch <- c.threadsDesc
 | 
				
			||||||
	ch <- c.gcDesc
 | 
						ch <- c.gcDesc
 | 
				
			||||||
	ch <- c.goInfoDesc
 | 
						ch <- c.goInfoDesc
 | 
				
			||||||
	for _, i := range c.metrics {
 | 
						for _, i := range c.msMetrics {
 | 
				
			||||||
		ch <- i.desc
 | 
							ch <- i.desc
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Collect returns the current state of all metrics of the collector.
 | 
					// Collect returns the current state of all metrics of the collector.
 | 
				
			||||||
func (c *goCollector) Collect(ch chan<- Metric) {
 | 
					func (c *goCollector) Collect(ch chan<- Metric) {
 | 
				
			||||||
 | 
						var (
 | 
				
			||||||
 | 
							ms   = &runtime.MemStats{}
 | 
				
			||||||
 | 
							done = make(chan struct{})
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
						// Start reading memstats first as it might take a while.
 | 
				
			||||||
 | 
						go func() {
 | 
				
			||||||
 | 
							c.msRead(ms)
 | 
				
			||||||
 | 
							c.msMtx.Lock()
 | 
				
			||||||
 | 
							c.msLast = ms
 | 
				
			||||||
 | 
							c.msLastTimestamp = time.Now()
 | 
				
			||||||
 | 
							c.msMtx.Unlock()
 | 
				
			||||||
 | 
							close(done)
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ch <- MustNewConstMetric(c.goroutinesDesc, GaugeValue, float64(runtime.NumGoroutine()))
 | 
						ch <- MustNewConstMetric(c.goroutinesDesc, GaugeValue, float64(runtime.NumGoroutine()))
 | 
				
			||||||
	n, _ := runtime.ThreadCreateProfile(nil)
 | 
						n, _ := runtime.ThreadCreateProfile(nil)
 | 
				
			||||||
	ch <- MustNewConstMetric(c.threadsDesc, GaugeValue, float64(n))
 | 
						ch <- MustNewConstMetric(c.threadsDesc, GaugeValue, float64(n))
 | 
				
			||||||
@@ -265,13 +325,35 @@ func (c *goCollector) Collect(ch chan<- Metric) {
 | 
				
			|||||||
		quantiles[float64(idx+1)/float64(len(stats.PauseQuantiles)-1)] = pq.Seconds()
 | 
							quantiles[float64(idx+1)/float64(len(stats.PauseQuantiles)-1)] = pq.Seconds()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	quantiles[0.0] = stats.PauseQuantiles[0].Seconds()
 | 
						quantiles[0.0] = stats.PauseQuantiles[0].Seconds()
 | 
				
			||||||
	ch <- MustNewConstSummary(c.gcDesc, uint64(stats.NumGC), float64(stats.PauseTotal.Seconds()), quantiles)
 | 
						ch <- MustNewConstSummary(c.gcDesc, uint64(stats.NumGC), stats.PauseTotal.Seconds(), quantiles)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ch <- MustNewConstMetric(c.goInfoDesc, GaugeValue, 1)
 | 
						ch <- MustNewConstMetric(c.goInfoDesc, GaugeValue, 1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ms := &runtime.MemStats{}
 | 
						timer := time.NewTimer(c.msMaxWait)
 | 
				
			||||||
	runtime.ReadMemStats(ms)
 | 
						select {
 | 
				
			||||||
	for _, i := range c.metrics {
 | 
						case <-done: // Our own ReadMemStats succeeded in time. Use it.
 | 
				
			||||||
 | 
							timer.Stop() // Important for high collection frequencies to not pile up timers.
 | 
				
			||||||
 | 
							c.msCollect(ch, ms)
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						case <-timer.C: // Time out, use last memstats if possible. Continue below.
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						c.msMtx.Lock()
 | 
				
			||||||
 | 
						if time.Since(c.msLastTimestamp) < c.msMaxAge {
 | 
				
			||||||
 | 
							// Last memstats are recent enough. Collect from them under the lock.
 | 
				
			||||||
 | 
							c.msCollect(ch, c.msLast)
 | 
				
			||||||
 | 
							c.msMtx.Unlock()
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						// If we are here, the last memstats are too old or don't exist. We have
 | 
				
			||||||
 | 
						// to wait until our own ReadMemStats finally completes. For that to
 | 
				
			||||||
 | 
						// happen, we have to release the lock.
 | 
				
			||||||
 | 
						c.msMtx.Unlock()
 | 
				
			||||||
 | 
						<-done
 | 
				
			||||||
 | 
						c.msCollect(ch, ms)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (c *goCollector) msCollect(ch chan<- Metric, ms *runtime.MemStats) {
 | 
				
			||||||
 | 
						for _, i := range c.msMetrics {
 | 
				
			||||||
		ch <- MustNewConstMetric(i.desc, i.valType, i.eval(ms))
 | 
							ch <- MustNewConstMetric(i.desc, i.valType, i.eval(ms))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										133
									
								
								vendor/github.com/prometheus/client_golang/prometheus/histogram.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										133
									
								
								vendor/github.com/prometheus/client_golang/prometheus/histogram.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -16,7 +16,9 @@ package prometheus
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"math"
 | 
						"math"
 | 
				
			||||||
 | 
						"runtime"
 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
 | 
						"sync"
 | 
				
			||||||
	"sync/atomic"
 | 
						"sync/atomic"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/golang/protobuf/proto"
 | 
						"github.com/golang/protobuf/proto"
 | 
				
			||||||
@@ -108,8 +110,9 @@ func ExponentialBuckets(start, factor float64, count int) []float64 {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HistogramOpts bundles the options for creating a Histogram metric. It is
 | 
					// HistogramOpts bundles the options for creating a Histogram metric. It is
 | 
				
			||||||
// mandatory to set Name and Help to a non-empty string. All other fields are
 | 
					// mandatory to set Name to a non-empty string. All other fields are optional
 | 
				
			||||||
// optional and can safely be left at their zero value.
 | 
					// and can safely be left at their zero value, although it is strongly
 | 
				
			||||||
 | 
					// encouraged to set a Help string.
 | 
				
			||||||
type HistogramOpts struct {
 | 
					type HistogramOpts struct {
 | 
				
			||||||
	// Namespace, Subsystem, and Name are components of the fully-qualified
 | 
						// Namespace, Subsystem, and Name are components of the fully-qualified
 | 
				
			||||||
	// name of the Histogram (created by joining these components with
 | 
						// name of the Histogram (created by joining these components with
 | 
				
			||||||
@@ -120,7 +123,7 @@ type HistogramOpts struct {
 | 
				
			|||||||
	Subsystem string
 | 
						Subsystem string
 | 
				
			||||||
	Name      string
 | 
						Name      string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Help provides information about this Histogram. Mandatory!
 | 
						// Help provides information about this Histogram.
 | 
				
			||||||
	//
 | 
						//
 | 
				
			||||||
	// Metrics with the same fully-qualified name must have the same Help
 | 
						// Metrics with the same fully-qualified name must have the same Help
 | 
				
			||||||
	// string.
 | 
						// string.
 | 
				
			||||||
@@ -162,7 +165,7 @@ func NewHistogram(opts HistogramOpts) Histogram {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogram {
 | 
					func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogram {
 | 
				
			||||||
	if len(desc.variableLabels) != len(labelValues) {
 | 
						if len(desc.variableLabels) != len(labelValues) {
 | 
				
			||||||
		panic(errInconsistentCardinality)
 | 
							panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, labelValues))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, n := range desc.variableLabels {
 | 
						for _, n := range desc.variableLabels {
 | 
				
			||||||
@@ -184,6 +187,7 @@ func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogr
 | 
				
			|||||||
		desc:        desc,
 | 
							desc:        desc,
 | 
				
			||||||
		upperBounds: opts.Buckets,
 | 
							upperBounds: opts.Buckets,
 | 
				
			||||||
		labelPairs:  makeLabelPairs(desc, labelValues),
 | 
							labelPairs:  makeLabelPairs(desc, labelValues),
 | 
				
			||||||
 | 
							counts:      [2]*histogramCounts{&histogramCounts{}, &histogramCounts{}},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for i, upperBound := range h.upperBounds {
 | 
						for i, upperBound := range h.upperBounds {
 | 
				
			||||||
		if i < len(h.upperBounds)-1 {
 | 
							if i < len(h.upperBounds)-1 {
 | 
				
			||||||
@@ -200,29 +204,55 @@ func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogr
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Finally we know the final length of h.upperBounds and can make counts.
 | 
						// Finally we know the final length of h.upperBounds and can make buckets
 | 
				
			||||||
	h.counts = make([]uint64, len(h.upperBounds))
 | 
						// for both counts:
 | 
				
			||||||
 | 
						h.counts[0].buckets = make([]uint64, len(h.upperBounds))
 | 
				
			||||||
 | 
						h.counts[1].buckets = make([]uint64, len(h.upperBounds))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	h.init(h) // Init self-collection.
 | 
						h.init(h) // Init self-collection.
 | 
				
			||||||
	return h
 | 
						return h
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type histogram struct {
 | 
					type histogramCounts struct {
 | 
				
			||||||
	// sumBits contains the bits of the float64 representing the sum of all
 | 
						// sumBits contains the bits of the float64 representing the sum of all
 | 
				
			||||||
	// observations. sumBits and count have to go first in the struct to
 | 
						// observations. sumBits and count have to go first in the struct to
 | 
				
			||||||
	// guarantee alignment for atomic operations.
 | 
						// guarantee alignment for atomic operations.
 | 
				
			||||||
	// http://golang.org/pkg/sync/atomic/#pkg-note-BUG
 | 
						// http://golang.org/pkg/sync/atomic/#pkg-note-BUG
 | 
				
			||||||
	sumBits uint64
 | 
						sumBits uint64
 | 
				
			||||||
	count   uint64
 | 
						count   uint64
 | 
				
			||||||
 | 
						buckets []uint64
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type histogram struct {
 | 
				
			||||||
 | 
						// countAndHotIdx enables lock-free writes with use of atomic updates.
 | 
				
			||||||
 | 
						// The most significant bit is the hot index [0 or 1] of the count field
 | 
				
			||||||
 | 
						// below. Observe calls update the hot one. All remaining bits count the
 | 
				
			||||||
 | 
						// number of Observe calls. Observe starts by incrementing this counter,
 | 
				
			||||||
 | 
						// and finish by incrementing the count field in the respective
 | 
				
			||||||
 | 
						// histogramCounts, as a marker for completion.
 | 
				
			||||||
 | 
						//
 | 
				
			||||||
 | 
						// Calls of the Write method (which are non-mutating reads from the
 | 
				
			||||||
 | 
						// perspective of the histogram) swap the hot–cold under the writeMtx
 | 
				
			||||||
 | 
						// lock. A cooldown is awaited (while locked) by comparing the number of
 | 
				
			||||||
 | 
						// observations with the initiation count. Once they match, then the
 | 
				
			||||||
 | 
						// last observation on the now cool one has completed. All cool fields must
 | 
				
			||||||
 | 
						// be merged into the new hot before releasing writeMtx.
 | 
				
			||||||
 | 
						//
 | 
				
			||||||
 | 
						// Fields with atomic access first! See alignment constraint:
 | 
				
			||||||
 | 
						// http://golang.org/pkg/sync/atomic/#pkg-note-BUG
 | 
				
			||||||
 | 
						countAndHotIdx uint64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	selfCollector
 | 
						selfCollector
 | 
				
			||||||
	// Note that there is no mutex required.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	desc     *Desc
 | 
						desc     *Desc
 | 
				
			||||||
 | 
						writeMtx sync.Mutex // Only used in the Write method.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Two counts, one is "hot" for lock-free observations, the other is
 | 
				
			||||||
 | 
						// "cold" for writing out a dto.Metric. It has to be an array of
 | 
				
			||||||
 | 
						// pointers to guarantee 64bit alignment of the histogramCounts, see
 | 
				
			||||||
 | 
						// http://golang.org/pkg/sync/atomic/#pkg-note-BUG.
 | 
				
			||||||
 | 
						counts [2]*histogramCounts
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	upperBounds []float64
 | 
						upperBounds []float64
 | 
				
			||||||
	counts      []uint64
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	labelPairs  []*dto.LabelPair
 | 
						labelPairs  []*dto.LabelPair
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -241,36 +271,84 @@ func (h *histogram) Observe(v float64) {
 | 
				
			|||||||
	// 100 buckets: 78.1 ns/op linear - binary 54.9 ns/op
 | 
						// 100 buckets: 78.1 ns/op linear - binary 54.9 ns/op
 | 
				
			||||||
	// 300 buckets: 154 ns/op linear - binary 61.6 ns/op
 | 
						// 300 buckets: 154 ns/op linear - binary 61.6 ns/op
 | 
				
			||||||
	i := sort.SearchFloat64s(h.upperBounds, v)
 | 
						i := sort.SearchFloat64s(h.upperBounds, v)
 | 
				
			||||||
	if i < len(h.counts) {
 | 
					
 | 
				
			||||||
		atomic.AddUint64(&h.counts[i], 1)
 | 
						// We increment h.countAndHotIdx so that the counter in the lower
 | 
				
			||||||
 | 
						// 63 bits gets incremented. At the same time, we get the new value
 | 
				
			||||||
 | 
						// back, which we can use to find the currently-hot counts.
 | 
				
			||||||
 | 
						n := atomic.AddUint64(&h.countAndHotIdx, 1)
 | 
				
			||||||
 | 
						hotCounts := h.counts[n>>63]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if i < len(h.upperBounds) {
 | 
				
			||||||
 | 
							atomic.AddUint64(&hotCounts.buckets[i], 1)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	atomic.AddUint64(&h.count, 1)
 | 
					 | 
				
			||||||
	for {
 | 
						for {
 | 
				
			||||||
		oldBits := atomic.LoadUint64(&h.sumBits)
 | 
							oldBits := atomic.LoadUint64(&hotCounts.sumBits)
 | 
				
			||||||
		newBits := math.Float64bits(math.Float64frombits(oldBits) + v)
 | 
							newBits := math.Float64bits(math.Float64frombits(oldBits) + v)
 | 
				
			||||||
		if atomic.CompareAndSwapUint64(&h.sumBits, oldBits, newBits) {
 | 
							if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) {
 | 
				
			||||||
			break
 | 
								break
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						// Increment count last as we take it as a signal that the observation
 | 
				
			||||||
 | 
						// is complete.
 | 
				
			||||||
 | 
						atomic.AddUint64(&hotCounts.count, 1)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (h *histogram) Write(out *dto.Metric) error {
 | 
					func (h *histogram) Write(out *dto.Metric) error {
 | 
				
			||||||
	his := &dto.Histogram{}
 | 
						// For simplicity, we protect this whole method by a mutex. It is not in
 | 
				
			||||||
	buckets := make([]*dto.Bucket, len(h.upperBounds))
 | 
						// the hot path, i.e. Observe is called much more often than Write. The
 | 
				
			||||||
 | 
						// complication of making Write lock-free isn't worth it, if possible at
 | 
				
			||||||
 | 
						// all.
 | 
				
			||||||
 | 
						h.writeMtx.Lock()
 | 
				
			||||||
 | 
						defer h.writeMtx.Unlock()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	his.SampleSum = proto.Float64(math.Float64frombits(atomic.LoadUint64(&h.sumBits)))
 | 
						// Adding 1<<63 switches the hot index (from 0 to 1 or from 1 to 0)
 | 
				
			||||||
	his.SampleCount = proto.Uint64(atomic.LoadUint64(&h.count))
 | 
						// without touching the count bits. See the struct comments for a full
 | 
				
			||||||
	var count uint64
 | 
						// description of the algorithm.
 | 
				
			||||||
 | 
						n := atomic.AddUint64(&h.countAndHotIdx, 1<<63)
 | 
				
			||||||
 | 
						// count is contained unchanged in the lower 63 bits.
 | 
				
			||||||
 | 
						count := n & ((1 << 63) - 1)
 | 
				
			||||||
 | 
						// The most significant bit tells us which counts is hot. The complement
 | 
				
			||||||
 | 
						// is thus the cold one.
 | 
				
			||||||
 | 
						hotCounts := h.counts[n>>63]
 | 
				
			||||||
 | 
						coldCounts := h.counts[(^n)>>63]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Await cooldown.
 | 
				
			||||||
 | 
						for count != atomic.LoadUint64(&coldCounts.count) {
 | 
				
			||||||
 | 
							runtime.Gosched() // Let observations get work done.
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						his := &dto.Histogram{
 | 
				
			||||||
 | 
							Bucket:      make([]*dto.Bucket, len(h.upperBounds)),
 | 
				
			||||||
 | 
							SampleCount: proto.Uint64(count),
 | 
				
			||||||
 | 
							SampleSum:   proto.Float64(math.Float64frombits(atomic.LoadUint64(&coldCounts.sumBits))),
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						var cumCount uint64
 | 
				
			||||||
	for i, upperBound := range h.upperBounds {
 | 
						for i, upperBound := range h.upperBounds {
 | 
				
			||||||
		count += atomic.LoadUint64(&h.counts[i])
 | 
							cumCount += atomic.LoadUint64(&coldCounts.buckets[i])
 | 
				
			||||||
		buckets[i] = &dto.Bucket{
 | 
							his.Bucket[i] = &dto.Bucket{
 | 
				
			||||||
			CumulativeCount: proto.Uint64(count),
 | 
								CumulativeCount: proto.Uint64(cumCount),
 | 
				
			||||||
			UpperBound:      proto.Float64(upperBound),
 | 
								UpperBound:      proto.Float64(upperBound),
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	his.Bucket = buckets
 | 
					
 | 
				
			||||||
	out.Histogram = his
 | 
						out.Histogram = his
 | 
				
			||||||
	out.Label = h.labelPairs
 | 
						out.Label = h.labelPairs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Finally add all the cold counts to the new hot counts and reset the cold counts.
 | 
				
			||||||
 | 
						atomic.AddUint64(&hotCounts.count, count)
 | 
				
			||||||
 | 
						atomic.StoreUint64(&coldCounts.count, 0)
 | 
				
			||||||
 | 
						for {
 | 
				
			||||||
 | 
							oldBits := atomic.LoadUint64(&hotCounts.sumBits)
 | 
				
			||||||
 | 
							newBits := math.Float64bits(math.Float64frombits(oldBits) + his.GetSampleSum())
 | 
				
			||||||
 | 
							if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) {
 | 
				
			||||||
 | 
								atomic.StoreUint64(&coldCounts.sumBits, 0)
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						for i := range h.upperBounds {
 | 
				
			||||||
 | 
							atomic.AddUint64(&hotCounts.buckets[i], atomic.LoadUint64(&coldCounts.buckets[i]))
 | 
				
			||||||
 | 
							atomic.StoreUint64(&coldCounts.buckets[i], 0)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -454,7 +532,7 @@ func (h *constHistogram) Write(out *dto.Metric) error {
 | 
				
			|||||||
// bucket.
 | 
					// bucket.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// NewConstHistogram returns an error if the length of labelValues is not
 | 
					// NewConstHistogram returns an error if the length of labelValues is not
 | 
				
			||||||
// consistent with the variable labels in Desc.
 | 
					// consistent with the variable labels in Desc or if Desc is invalid.
 | 
				
			||||||
func NewConstHistogram(
 | 
					func NewConstHistogram(
 | 
				
			||||||
	desc *Desc,
 | 
						desc *Desc,
 | 
				
			||||||
	count uint64,
 | 
						count uint64,
 | 
				
			||||||
@@ -462,6 +540,9 @@ func NewConstHistogram(
 | 
				
			|||||||
	buckets map[float64]uint64,
 | 
						buckets map[float64]uint64,
 | 
				
			||||||
	labelValues ...string,
 | 
						labelValues ...string,
 | 
				
			||||||
) (Metric, error) {
 | 
					) (Metric, error) {
 | 
				
			||||||
 | 
						if desc.err != nil {
 | 
				
			||||||
 | 
							return nil, desc.err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil {
 | 
						if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										150
									
								
								vendor/github.com/prometheus/client_golang/prometheus/http.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										150
									
								
								vendor/github.com/prometheus/client_golang/prometheus/http.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -15,9 +15,7 @@ package prometheus
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"bufio"
 | 
						"bufio"
 | 
				
			||||||
	"bytes"
 | 
					 | 
				
			||||||
	"compress/gzip"
 | 
						"compress/gzip"
 | 
				
			||||||
	"fmt"
 | 
					 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"net"
 | 
						"net"
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
@@ -36,24 +34,14 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const (
 | 
					const (
 | 
				
			||||||
	contentTypeHeader     = "Content-Type"
 | 
						contentTypeHeader     = "Content-Type"
 | 
				
			||||||
	contentLengthHeader   = "Content-Length"
 | 
					 | 
				
			||||||
	contentEncodingHeader = "Content-Encoding"
 | 
						contentEncodingHeader = "Content-Encoding"
 | 
				
			||||||
	acceptEncodingHeader  = "Accept-Encoding"
 | 
						acceptEncodingHeader  = "Accept-Encoding"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var bufPool sync.Pool
 | 
					var gzipPool = sync.Pool{
 | 
				
			||||||
 | 
						New: func() interface{} {
 | 
				
			||||||
func getBuf() *bytes.Buffer {
 | 
							return gzip.NewWriter(nil)
 | 
				
			||||||
	buf := bufPool.Get()
 | 
						},
 | 
				
			||||||
	if buf == nil {
 | 
					 | 
				
			||||||
		return &bytes.Buffer{}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return buf.(*bytes.Buffer)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func giveBuf(buf *bytes.Buffer) {
 | 
					 | 
				
			||||||
	buf.Reset()
 | 
					 | 
				
			||||||
	bufPool.Put(buf)
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Handler returns an HTTP handler for the DefaultGatherer. It is
 | 
					// Handler returns an HTTP handler for the DefaultGatherer. It is
 | 
				
			||||||
@@ -61,68 +49,50 @@ func giveBuf(buf *bytes.Buffer) {
 | 
				
			|||||||
// name).
 | 
					// name).
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Deprecated: Please note the issues described in the doc comment of
 | 
					// Deprecated: Please note the issues described in the doc comment of
 | 
				
			||||||
// InstrumentHandler. You might want to consider using
 | 
					// InstrumentHandler. You might want to consider using promhttp.Handler instead.
 | 
				
			||||||
// promhttp.InstrumentedHandler instead.
 | 
					 | 
				
			||||||
func Handler() http.Handler {
 | 
					func Handler() http.Handler {
 | 
				
			||||||
	return InstrumentHandler("prometheus", UninstrumentedHandler())
 | 
						return InstrumentHandler("prometheus", UninstrumentedHandler())
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// UninstrumentedHandler returns an HTTP handler for the DefaultGatherer.
 | 
					// UninstrumentedHandler returns an HTTP handler for the DefaultGatherer.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Deprecated: Use promhttp.Handler instead. See there for further documentation.
 | 
					// Deprecated: Use promhttp.HandlerFor(DefaultGatherer, promhttp.HandlerOpts{})
 | 
				
			||||||
 | 
					// instead. See there for further documentation.
 | 
				
			||||||
func UninstrumentedHandler() http.Handler {
 | 
					func UninstrumentedHandler() http.Handler {
 | 
				
			||||||
	return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 | 
						return http.HandlerFunc(func(rsp http.ResponseWriter, req *http.Request) {
 | 
				
			||||||
		mfs, err := DefaultGatherer.Gather()
 | 
							mfs, err := DefaultGatherer.Gather()
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			http.Error(w, "An error has occurred during metrics collection:\n\n"+err.Error(), http.StatusInternalServerError)
 | 
								httpError(rsp, err)
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		contentType := expfmt.Negotiate(req.Header)
 | 
							contentType := expfmt.Negotiate(req.Header)
 | 
				
			||||||
		buf := getBuf()
 | 
							header := rsp.Header()
 | 
				
			||||||
		defer giveBuf(buf)
 | 
							header.Set(contentTypeHeader, string(contentType))
 | 
				
			||||||
		writer, encoding := decorateWriter(req, buf)
 | 
					
 | 
				
			||||||
		enc := expfmt.NewEncoder(writer, contentType)
 | 
							w := io.Writer(rsp)
 | 
				
			||||||
		var lastErr error
 | 
							if gzipAccepted(req.Header) {
 | 
				
			||||||
 | 
								header.Set(contentEncodingHeader, "gzip")
 | 
				
			||||||
 | 
								gz := gzipPool.Get().(*gzip.Writer)
 | 
				
			||||||
 | 
								defer gzipPool.Put(gz)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								gz.Reset(w)
 | 
				
			||||||
 | 
								defer gz.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								w = gz
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							enc := expfmt.NewEncoder(w, contentType)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for _, mf := range mfs {
 | 
							for _, mf := range mfs {
 | 
				
			||||||
			if err := enc.Encode(mf); err != nil {
 | 
								if err := enc.Encode(mf); err != nil {
 | 
				
			||||||
				lastErr = err
 | 
									httpError(rsp, err)
 | 
				
			||||||
				http.Error(w, "An error has occurred during metrics encoding:\n\n"+err.Error(), http.StatusInternalServerError)
 | 
					 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if closer, ok := writer.(io.Closer); ok {
 | 
					 | 
				
			||||||
			closer.Close()
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if lastErr != nil && buf.Len() == 0 {
 | 
					 | 
				
			||||||
			http.Error(w, "No metrics encoded, last error:\n\n"+lastErr.Error(), http.StatusInternalServerError)
 | 
					 | 
				
			||||||
			return
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		header := w.Header()
 | 
					 | 
				
			||||||
		header.Set(contentTypeHeader, string(contentType))
 | 
					 | 
				
			||||||
		header.Set(contentLengthHeader, fmt.Sprint(buf.Len()))
 | 
					 | 
				
			||||||
		if encoding != "" {
 | 
					 | 
				
			||||||
			header.Set(contentEncodingHeader, encoding)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		w.Write(buf.Bytes())
 | 
					 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// decorateWriter wraps a writer to handle gzip compression if requested.  It
 | 
					 | 
				
			||||||
// returns the decorated writer and the appropriate "Content-Encoding" header
 | 
					 | 
				
			||||||
// (which is empty if no compression is enabled).
 | 
					 | 
				
			||||||
func decorateWriter(request *http.Request, writer io.Writer) (io.Writer, string) {
 | 
					 | 
				
			||||||
	header := request.Header.Get(acceptEncodingHeader)
 | 
					 | 
				
			||||||
	parts := strings.Split(header, ",")
 | 
					 | 
				
			||||||
	for _, part := range parts {
 | 
					 | 
				
			||||||
		part := strings.TrimSpace(part)
 | 
					 | 
				
			||||||
		if part == "gzip" || strings.HasPrefix(part, "gzip;") {
 | 
					 | 
				
			||||||
			return gzip.NewWriter(writer), "gzip"
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return writer, ""
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var instLabels = []string{"method", "code"}
 | 
					var instLabels = []string{"method", "code"}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type nower interface {
 | 
					type nower interface {
 | 
				
			||||||
@@ -139,16 +109,6 @@ var now nower = nowFunc(func() time.Time {
 | 
				
			|||||||
	return time.Now()
 | 
						return time.Now()
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func nowSeries(t ...time.Time) nower {
 | 
					 | 
				
			||||||
	return nowFunc(func() time.Time {
 | 
					 | 
				
			||||||
		defer func() {
 | 
					 | 
				
			||||||
			t = t[1:]
 | 
					 | 
				
			||||||
		}()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		return t[0]
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// InstrumentHandler wraps the given HTTP handler for instrumentation. It
 | 
					// InstrumentHandler wraps the given HTTP handler for instrumentation. It
 | 
				
			||||||
// registers four metric collectors (if not already done) and reports HTTP
 | 
					// registers four metric collectors (if not already done) and reports HTTP
 | 
				
			||||||
// metrics to the (newly or already) registered collectors: http_requests_total
 | 
					// metrics to the (newly or already) registered collectors: http_requests_total
 | 
				
			||||||
@@ -159,21 +119,14 @@ func nowSeries(t ...time.Time) nower {
 | 
				
			|||||||
// (label name "method") and HTTP status code (label name "code").
 | 
					// (label name "method") and HTTP status code (label name "code").
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Deprecated: InstrumentHandler has several issues. Use the tooling provided in
 | 
					// Deprecated: InstrumentHandler has several issues. Use the tooling provided in
 | 
				
			||||||
// package promhttp instead. The issues are the following:
 | 
					// package promhttp instead. The issues are the following: (1) It uses Summaries
 | 
				
			||||||
//
 | 
					// rather than Histograms. Summaries are not useful if aggregation across
 | 
				
			||||||
// - It uses Summaries rather than Histograms. Summaries are not useful if
 | 
					// multiple instances is required. (2) It uses microseconds as unit, which is
 | 
				
			||||||
// aggregation across multiple instances is required.
 | 
					// deprecated and should be replaced by seconds. (3) The size of the request is
 | 
				
			||||||
//
 | 
					// calculated in a separate goroutine. Since this calculator requires access to
 | 
				
			||||||
// - It uses microseconds as unit, which is deprecated and should be replaced by
 | 
					// the request header, it creates a race with any writes to the header performed
 | 
				
			||||||
// seconds.
 | 
					// during request handling.  httputil.ReverseProxy is a prominent example for a
 | 
				
			||||||
//
 | 
					// handler performing such writes. (4) It has additional issues with HTTP/2, cf.
 | 
				
			||||||
// - The size of the request is calculated in a separate goroutine. Since this
 | 
					 | 
				
			||||||
// calculator requires access to the request header, it creates a race with
 | 
					 | 
				
			||||||
// any writes to the header performed during request handling.
 | 
					 | 
				
			||||||
// httputil.ReverseProxy is a prominent example for a handler
 | 
					 | 
				
			||||||
// performing such writes.
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// - It has additional issues with HTTP/2, cf.
 | 
					 | 
				
			||||||
// https://github.com/prometheus/client_golang/issues/272.
 | 
					// https://github.com/prometheus/client_golang/issues/272.
 | 
				
			||||||
func InstrumentHandler(handlerName string, handler http.Handler) http.HandlerFunc {
 | 
					func InstrumentHandler(handlerName string, handler http.Handler) http.HandlerFunc {
 | 
				
			||||||
	return InstrumentHandlerFunc(handlerName, handler.ServeHTTP)
 | 
						return InstrumentHandlerFunc(handlerName, handler.ServeHTTP)
 | 
				
			||||||
@@ -317,7 +270,7 @@ func InstrumentHandlerFuncWithOpts(opts SummaryOpts, handlerFunc func(http.Respo
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func computeApproximateRequestSize(r *http.Request) <-chan int {
 | 
					func computeApproximateRequestSize(r *http.Request) <-chan int {
 | 
				
			||||||
	// Get URL length in current go routine for avoiding a race condition.
 | 
						// Get URL length in current goroutine for avoiding a race condition.
 | 
				
			||||||
	// HandlerFunc that runs in parallel may modify the URL.
 | 
						// HandlerFunc that runs in parallel may modify the URL.
 | 
				
			||||||
	s := 0
 | 
						s := 0
 | 
				
			||||||
	if r.URL != nil {
 | 
						if r.URL != nil {
 | 
				
			||||||
@@ -352,7 +305,6 @@ func computeApproximateRequestSize(r *http.Request) <-chan int {
 | 
				
			|||||||
type responseWriterDelegator struct {
 | 
					type responseWriterDelegator struct {
 | 
				
			||||||
	http.ResponseWriter
 | 
						http.ResponseWriter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	handler, method string
 | 
					 | 
				
			||||||
	status      int
 | 
						status      int
 | 
				
			||||||
	written     int64
 | 
						written     int64
 | 
				
			||||||
	wroteHeader bool
 | 
						wroteHeader bool
 | 
				
			||||||
@@ -378,6 +330,8 @@ type fancyResponseWriterDelegator struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (f *fancyResponseWriterDelegator) CloseNotify() <-chan bool {
 | 
					func (f *fancyResponseWriterDelegator) CloseNotify() <-chan bool {
 | 
				
			||||||
 | 
						//lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
 | 
				
			||||||
 | 
						//remove support from client_golang yet.
 | 
				
			||||||
	return f.ResponseWriter.(http.CloseNotifier).CloseNotify()
 | 
						return f.ResponseWriter.(http.CloseNotifier).CloseNotify()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -521,3 +475,31 @@ func sanitizeCode(s int) string {
 | 
				
			|||||||
		return strconv.Itoa(s)
 | 
							return strconv.Itoa(s)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// gzipAccepted returns whether the client will accept gzip-encoded content.
 | 
				
			||||||
 | 
					func gzipAccepted(header http.Header) bool {
 | 
				
			||||||
 | 
						a := header.Get(acceptEncodingHeader)
 | 
				
			||||||
 | 
						parts := strings.Split(a, ",")
 | 
				
			||||||
 | 
						for _, part := range parts {
 | 
				
			||||||
 | 
							part = strings.TrimSpace(part)
 | 
				
			||||||
 | 
							if part == "gzip" || strings.HasPrefix(part, "gzip;") {
 | 
				
			||||||
 | 
								return true
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// httpError removes any content-encoding header and then calls http.Error with
 | 
				
			||||||
 | 
					// the provided error and http.StatusInternalServerErrer. Error contents is
 | 
				
			||||||
 | 
					// supposed to be uncompressed plain text. However, same as with a plain
 | 
				
			||||||
 | 
					// http.Error, any header settings will be void if the header has already been
 | 
				
			||||||
 | 
					// sent. The error message will still be written to the writer, but it will
 | 
				
			||||||
 | 
					// probably be of limited use.
 | 
				
			||||||
 | 
					func httpError(rsp http.ResponseWriter, err error) {
 | 
				
			||||||
 | 
						rsp.Header().Del(contentEncodingHeader)
 | 
				
			||||||
 | 
						http.Error(
 | 
				
			||||||
 | 
							rsp,
 | 
				
			||||||
 | 
							"An error has occurred while serving metrics:\n\n"+err.Error(),
 | 
				
			||||||
 | 
							http.StatusInternalServerError,
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										85
									
								
								vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,85 @@
 | 
				
			|||||||
 | 
					// Copyright 2018 The Prometheus Authors
 | 
				
			||||||
 | 
					// Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 | 
					// you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
					// You may obtain a copy of the License at
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// http://www.apache.org/licenses/LICENSE-2.0
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Unless required by applicable law or agreed to in writing, software
 | 
				
			||||||
 | 
					// distributed under the License is distributed on an "AS IS" BASIS,
 | 
				
			||||||
 | 
					// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
				
			||||||
 | 
					// See the License for the specific language governing permissions and
 | 
				
			||||||
 | 
					// limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package internal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"sort"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						dto "github.com/prometheus/client_model/go"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// metricSorter is a sortable slice of *dto.Metric.
 | 
				
			||||||
 | 
					type metricSorter []*dto.Metric
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (s metricSorter) Len() int {
 | 
				
			||||||
 | 
						return len(s)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (s metricSorter) Swap(i, j int) {
 | 
				
			||||||
 | 
						s[i], s[j] = s[j], s[i]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (s metricSorter) Less(i, j int) bool {
 | 
				
			||||||
 | 
						if len(s[i].Label) != len(s[j].Label) {
 | 
				
			||||||
 | 
							// This should not happen. The metrics are
 | 
				
			||||||
 | 
							// inconsistent. However, we have to deal with the fact, as
 | 
				
			||||||
 | 
							// people might use custom collectors or metric family injection
 | 
				
			||||||
 | 
							// to create inconsistent metrics. So let's simply compare the
 | 
				
			||||||
 | 
							// number of labels in this case. That will still yield
 | 
				
			||||||
 | 
							// reproducible sorting.
 | 
				
			||||||
 | 
							return len(s[i].Label) < len(s[j].Label)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						for n, lp := range s[i].Label {
 | 
				
			||||||
 | 
							vi := lp.GetValue()
 | 
				
			||||||
 | 
							vj := s[j].Label[n].GetValue()
 | 
				
			||||||
 | 
							if vi != vj {
 | 
				
			||||||
 | 
								return vi < vj
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// We should never arrive here. Multiple metrics with the same
 | 
				
			||||||
 | 
						// label set in the same scrape will lead to undefined ingestion
 | 
				
			||||||
 | 
						// behavior. However, as above, we have to provide stable sorting
 | 
				
			||||||
 | 
						// here, even for inconsistent metrics. So sort equal metrics
 | 
				
			||||||
 | 
						// by their timestamp, with missing timestamps (implying "now")
 | 
				
			||||||
 | 
						// coming last.
 | 
				
			||||||
 | 
						if s[i].TimestampMs == nil {
 | 
				
			||||||
 | 
							return false
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if s[j].TimestampMs == nil {
 | 
				
			||||||
 | 
							return true
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return s[i].GetTimestampMs() < s[j].GetTimestampMs()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// NormalizeMetricFamilies returns a MetricFamily slice with empty
 | 
				
			||||||
 | 
					// MetricFamilies pruned and the remaining MetricFamilies sorted by name within
 | 
				
			||||||
 | 
					// the slice, with the contained Metrics sorted within each MetricFamily.
 | 
				
			||||||
 | 
					func NormalizeMetricFamilies(metricFamiliesByName map[string]*dto.MetricFamily) []*dto.MetricFamily {
 | 
				
			||||||
 | 
						for _, mf := range metricFamiliesByName {
 | 
				
			||||||
 | 
							sort.Sort(metricSorter(mf.Metric))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						names := make([]string, 0, len(metricFamiliesByName))
 | 
				
			||||||
 | 
						for name, mf := range metricFamiliesByName {
 | 
				
			||||||
 | 
							if len(mf.Metric) > 0 {
 | 
				
			||||||
 | 
								names = append(names, name)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						sort.Strings(names)
 | 
				
			||||||
 | 
						result := make([]*dto.MetricFamily, 0, len(names))
 | 
				
			||||||
 | 
						for _, name := range names {
 | 
				
			||||||
 | 
							result = append(result, metricFamiliesByName[name])
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return result
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										34
									
								
								vendor/github.com/prometheus/client_golang/prometheus/labels.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										34
									
								
								vendor/github.com/prometheus/client_golang/prometheus/labels.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,3 +1,16 @@
 | 
				
			|||||||
 | 
					// Copyright 2018 The Prometheus Authors
 | 
				
			||||||
 | 
					// Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 | 
					// you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
					// You may obtain a copy of the License at
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// http://www.apache.org/licenses/LICENSE-2.0
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Unless required by applicable law or agreed to in writing, software
 | 
				
			||||||
 | 
					// distributed under the License is distributed on an "AS IS" BASIS,
 | 
				
			||||||
 | 
					// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
				
			||||||
 | 
					// See the License for the specific language governing permissions and
 | 
				
			||||||
 | 
					// limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package prometheus
 | 
					package prometheus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
@@ -24,9 +37,22 @@ const reservedLabelPrefix = "__"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
var errInconsistentCardinality = errors.New("inconsistent label cardinality")
 | 
					var errInconsistentCardinality = errors.New("inconsistent label cardinality")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func makeInconsistentCardinalityError(fqName string, labels, labelValues []string) error {
 | 
				
			||||||
 | 
						return fmt.Errorf(
 | 
				
			||||||
 | 
							"%s: %q has %d variable labels named %q but %d values %q were provided",
 | 
				
			||||||
 | 
							errInconsistentCardinality, fqName,
 | 
				
			||||||
 | 
							len(labels), labels,
 | 
				
			||||||
 | 
							len(labelValues), labelValues,
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func validateValuesInLabels(labels Labels, expectedNumberOfValues int) error {
 | 
					func validateValuesInLabels(labels Labels, expectedNumberOfValues int) error {
 | 
				
			||||||
	if len(labels) != expectedNumberOfValues {
 | 
						if len(labels) != expectedNumberOfValues {
 | 
				
			||||||
		return errInconsistentCardinality
 | 
							return fmt.Errorf(
 | 
				
			||||||
 | 
								"%s: expected %d label values but got %d in %#v",
 | 
				
			||||||
 | 
								errInconsistentCardinality, expectedNumberOfValues,
 | 
				
			||||||
 | 
								len(labels), labels,
 | 
				
			||||||
 | 
							)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for name, val := range labels {
 | 
						for name, val := range labels {
 | 
				
			||||||
@@ -40,7 +66,11 @@ func validateValuesInLabels(labels Labels, expectedNumberOfValues int) error {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func validateLabelValues(vals []string, expectedNumberOfValues int) error {
 | 
					func validateLabelValues(vals []string, expectedNumberOfValues int) error {
 | 
				
			||||||
	if len(vals) != expectedNumberOfValues {
 | 
						if len(vals) != expectedNumberOfValues {
 | 
				
			||||||
		return errInconsistentCardinality
 | 
							return fmt.Errorf(
 | 
				
			||||||
 | 
								"%s: expected %d label values but got %d in %#v",
 | 
				
			||||||
 | 
								errInconsistentCardinality, expectedNumberOfValues,
 | 
				
			||||||
 | 
								len(vals), vals,
 | 
				
			||||||
 | 
							)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, val := range vals {
 | 
						for _, val := range vals {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										70
									
								
								vendor/github.com/prometheus/client_golang/prometheus/metric.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										70
									
								
								vendor/github.com/prometheus/client_golang/prometheus/metric.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -15,6 +15,9 @@ package prometheus
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/golang/protobuf/proto"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dto "github.com/prometheus/client_model/go"
 | 
						dto "github.com/prometheus/client_model/go"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@@ -43,9 +46,8 @@ type Metric interface {
 | 
				
			|||||||
	// While populating dto.Metric, it is the responsibility of the
 | 
						// While populating dto.Metric, it is the responsibility of the
 | 
				
			||||||
	// implementation to ensure validity of the Metric protobuf (like valid
 | 
						// implementation to ensure validity of the Metric protobuf (like valid
 | 
				
			||||||
	// UTF-8 strings or syntactically valid metric and label names). It is
 | 
						// UTF-8 strings or syntactically valid metric and label names). It is
 | 
				
			||||||
	// recommended to sort labels lexicographically. (Implementers may find
 | 
						// recommended to sort labels lexicographically. Callers of Write should
 | 
				
			||||||
	// LabelPairSorter useful for that.) Callers of Write should still make
 | 
						// still make sure of sorting if they depend on it.
 | 
				
			||||||
	// sure of sorting if they depend on it.
 | 
					 | 
				
			||||||
	Write(*dto.Metric) error
 | 
						Write(*dto.Metric) error
 | 
				
			||||||
	// TODO(beorn7): The original rationale of passing in a pre-allocated
 | 
						// TODO(beorn7): The original rationale of passing in a pre-allocated
 | 
				
			||||||
	// dto.Metric protobuf to save allocations has disappeared. The
 | 
						// dto.Metric protobuf to save allocations has disappeared. The
 | 
				
			||||||
@@ -57,8 +59,9 @@ type Metric interface {
 | 
				
			|||||||
// implementation XXX has its own XXXOpts type, but in most cases, it is just be
 | 
					// implementation XXX has its own XXXOpts type, but in most cases, it is just be
 | 
				
			||||||
// an alias of this type (which might change when the requirement arises.)
 | 
					// an alias of this type (which might change when the requirement arises.)
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// It is mandatory to set Name and Help to a non-empty string. All other fields
 | 
					// It is mandatory to set Name to a non-empty string. All other fields are
 | 
				
			||||||
// are optional and can safely be left at their zero value.
 | 
					// optional and can safely be left at their zero value, although it is strongly
 | 
				
			||||||
 | 
					// encouraged to set a Help string.
 | 
				
			||||||
type Opts struct {
 | 
					type Opts struct {
 | 
				
			||||||
	// Namespace, Subsystem, and Name are components of the fully-qualified
 | 
						// Namespace, Subsystem, and Name are components of the fully-qualified
 | 
				
			||||||
	// name of the Metric (created by joining these components with
 | 
						// name of the Metric (created by joining these components with
 | 
				
			||||||
@@ -69,7 +72,7 @@ type Opts struct {
 | 
				
			|||||||
	Subsystem string
 | 
						Subsystem string
 | 
				
			||||||
	Name      string
 | 
						Name      string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Help provides information about this metric. Mandatory!
 | 
						// Help provides information about this metric.
 | 
				
			||||||
	//
 | 
						//
 | 
				
			||||||
	// Metrics with the same fully-qualified name must have the same Help
 | 
						// Metrics with the same fully-qualified name must have the same Help
 | 
				
			||||||
	// string.
 | 
						// string.
 | 
				
			||||||
@@ -110,37 +113,22 @@ func BuildFQName(namespace, subsystem, name string) string {
 | 
				
			|||||||
	return name
 | 
						return name
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// LabelPairSorter implements sort.Interface. It is used to sort a slice of
 | 
					// labelPairSorter implements sort.Interface. It is used to sort a slice of
 | 
				
			||||||
// dto.LabelPair pointers. This is useful for implementing the Write method of
 | 
					// dto.LabelPair pointers.
 | 
				
			||||||
// custom metrics.
 | 
					type labelPairSorter []*dto.LabelPair
 | 
				
			||||||
type LabelPairSorter []*dto.LabelPair
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s LabelPairSorter) Len() int {
 | 
					func (s labelPairSorter) Len() int {
 | 
				
			||||||
	return len(s)
 | 
						return len(s)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s LabelPairSorter) Swap(i, j int) {
 | 
					func (s labelPairSorter) Swap(i, j int) {
 | 
				
			||||||
	s[i], s[j] = s[j], s[i]
 | 
						s[i], s[j] = s[j], s[i]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s LabelPairSorter) Less(i, j int) bool {
 | 
					func (s labelPairSorter) Less(i, j int) bool {
 | 
				
			||||||
	return s[i].GetName() < s[j].GetName()
 | 
						return s[i].GetName() < s[j].GetName()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type hashSorter []uint64
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func (s hashSorter) Len() int {
 | 
					 | 
				
			||||||
	return len(s)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func (s hashSorter) Swap(i, j int) {
 | 
					 | 
				
			||||||
	s[i], s[j] = s[j], s[i]
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func (s hashSorter) Less(i, j int) bool {
 | 
					 | 
				
			||||||
	return s[i] < s[j]
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
type invalidMetric struct {
 | 
					type invalidMetric struct {
 | 
				
			||||||
	desc *Desc
 | 
						desc *Desc
 | 
				
			||||||
	err  error
 | 
						err  error
 | 
				
			||||||
@@ -156,3 +144,31 @@ func NewInvalidMetric(desc *Desc, err error) Metric {
 | 
				
			|||||||
func (m *invalidMetric) Desc() *Desc { return m.desc }
 | 
					func (m *invalidMetric) Desc() *Desc { return m.desc }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (m *invalidMetric) Write(*dto.Metric) error { return m.err }
 | 
					func (m *invalidMetric) Write(*dto.Metric) error { return m.err }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type timestampedMetric struct {
 | 
				
			||||||
 | 
						Metric
 | 
				
			||||||
 | 
						t time.Time
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (m timestampedMetric) Write(pb *dto.Metric) error {
 | 
				
			||||||
 | 
						e := m.Metric.Write(pb)
 | 
				
			||||||
 | 
						pb.TimestampMs = proto.Int64(m.t.Unix()*1000 + int64(m.t.Nanosecond()/1000000))
 | 
				
			||||||
 | 
						return e
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// NewMetricWithTimestamp returns a new Metric wrapping the provided Metric in a
 | 
				
			||||||
 | 
					// way that it has an explicit timestamp set to the provided Time. This is only
 | 
				
			||||||
 | 
					// useful in rare cases as the timestamp of a Prometheus metric should usually
 | 
				
			||||||
 | 
					// be set by the Prometheus server during scraping. Exceptions include mirroring
 | 
				
			||||||
 | 
					// metrics with given timestamps from other metric
 | 
				
			||||||
 | 
					// sources.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// NewMetricWithTimestamp works best with MustNewConstMetric,
 | 
				
			||||||
 | 
					// MustNewConstHistogram, and MustNewConstSummary, see example.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Currently, the exposition formats used by Prometheus are limited to
 | 
				
			||||||
 | 
					// millisecond resolution. Thus, the provided time will be rounded down to the
 | 
				
			||||||
 | 
					// next full millisecond value.
 | 
				
			||||||
 | 
					func NewMetricWithTimestamp(t time.Time, m Metric) Metric {
 | 
				
			||||||
 | 
						return timestampedMetric{Metric: m, t: t}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										116
									
								
								vendor/github.com/prometheus/client_golang/prometheus/process_collector.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										116
									
								
								vendor/github.com/prometheus/client_golang/prometheus/process_collector.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -13,46 +13,74 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package prometheus
 | 
					package prometheus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import "github.com/prometheus/procfs"
 | 
					import (
 | 
				
			||||||
 | 
						"errors"
 | 
				
			||||||
 | 
						"os"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/prometheus/procfs"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type processCollector struct {
 | 
					type processCollector struct {
 | 
				
			||||||
	pid             int
 | 
					 | 
				
			||||||
	collectFn       func(chan<- Metric)
 | 
						collectFn       func(chan<- Metric)
 | 
				
			||||||
	pidFn           func() (int, error)
 | 
						pidFn           func() (int, error)
 | 
				
			||||||
 | 
						reportErrors    bool
 | 
				
			||||||
	cpuTotal        *Desc
 | 
						cpuTotal        *Desc
 | 
				
			||||||
	openFDs, maxFDs *Desc
 | 
						openFDs, maxFDs *Desc
 | 
				
			||||||
	vsize, rss      *Desc
 | 
						vsize, maxVsize *Desc
 | 
				
			||||||
 | 
						rss             *Desc
 | 
				
			||||||
	startTime       *Desc
 | 
						startTime       *Desc
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ProcessCollectorOpts defines the behavior of a process metrics collector
 | 
				
			||||||
 | 
					// created with NewProcessCollector.
 | 
				
			||||||
 | 
					type ProcessCollectorOpts struct {
 | 
				
			||||||
 | 
						// PidFn returns the PID of the process the collector collects metrics
 | 
				
			||||||
 | 
						// for. It is called upon each collection. By default, the PID of the
 | 
				
			||||||
 | 
						// current process is used, as determined on construction time by
 | 
				
			||||||
 | 
						// calling os.Getpid().
 | 
				
			||||||
 | 
						PidFn func() (int, error)
 | 
				
			||||||
 | 
						// If non-empty, each of the collected metrics is prefixed by the
 | 
				
			||||||
 | 
						// provided string and an underscore ("_").
 | 
				
			||||||
 | 
						Namespace string
 | 
				
			||||||
 | 
						// If true, any error encountered during collection is reported as an
 | 
				
			||||||
 | 
						// invalid metric (see NewInvalidMetric). Otherwise, errors are ignored
 | 
				
			||||||
 | 
						// and the collected metrics will be incomplete. (Possibly, no metrics
 | 
				
			||||||
 | 
						// will be collected at all.) While that's usually not desired, it is
 | 
				
			||||||
 | 
						// appropriate for the common "mix-in" of process metrics, where process
 | 
				
			||||||
 | 
						// metrics are nice to have, but failing to collect them should not
 | 
				
			||||||
 | 
						// disrupt the collection of the remaining metrics.
 | 
				
			||||||
 | 
						ReportErrors bool
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NewProcessCollector returns a collector which exports the current state of
 | 
					// NewProcessCollector returns a collector which exports the current state of
 | 
				
			||||||
// process metrics including CPU, memory and file descriptor usage as well as
 | 
					// process metrics including CPU, memory and file descriptor usage as well as
 | 
				
			||||||
// the process start time for the given process ID under the given namespace.
 | 
					// the process start time. The detailed behavior is defined by the provided
 | 
				
			||||||
 | 
					// ProcessCollectorOpts. The zero value of ProcessCollectorOpts creates a
 | 
				
			||||||
 | 
					// collector for the current process with an empty namespace string and no error
 | 
				
			||||||
 | 
					// reporting.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Currently, the collector depends on a Linux-style proc filesystem and
 | 
					// Currently, the collector depends on a Linux-style proc filesystem and
 | 
				
			||||||
// therefore only exports metrics for Linux.
 | 
					// therefore only exports metrics for Linux.
 | 
				
			||||||
func NewProcessCollector(pid int, namespace string) Collector {
 | 
					//
 | 
				
			||||||
	return NewProcessCollectorPIDFn(
 | 
					// Note: An older version of this function had the following signature:
 | 
				
			||||||
		func() (int, error) { return pid, nil },
 | 
					//
 | 
				
			||||||
		namespace,
 | 
					//     NewProcessCollector(pid int, namespace string) Collector
 | 
				
			||||||
	)
 | 
					//
 | 
				
			||||||
}
 | 
					// Most commonly, it was called as
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
// NewProcessCollectorPIDFn works like NewProcessCollector but the process ID is
 | 
					//     NewProcessCollector(os.Getpid(), "")
 | 
				
			||||||
// determined on each collect anew by calling the given pidFn function.
 | 
					//
 | 
				
			||||||
func NewProcessCollectorPIDFn(
 | 
					// The following call of the current version is equivalent to the above:
 | 
				
			||||||
	pidFn func() (int, error),
 | 
					//
 | 
				
			||||||
	namespace string,
 | 
					//     NewProcessCollector(ProcessCollectorOpts{})
 | 
				
			||||||
) Collector {
 | 
					func NewProcessCollector(opts ProcessCollectorOpts) Collector {
 | 
				
			||||||
	ns := ""
 | 
						ns := ""
 | 
				
			||||||
	if len(namespace) > 0 {
 | 
						if len(opts.Namespace) > 0 {
 | 
				
			||||||
		ns = namespace + "_"
 | 
							ns = opts.Namespace + "_"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	c := processCollector{
 | 
						c := &processCollector{
 | 
				
			||||||
		pidFn:     pidFn,
 | 
							reportErrors: opts.ReportErrors,
 | 
				
			||||||
		collectFn: func(chan<- Metric) {},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		cpuTotal: NewDesc(
 | 
							cpuTotal: NewDesc(
 | 
				
			||||||
			ns+"process_cpu_seconds_total",
 | 
								ns+"process_cpu_seconds_total",
 | 
				
			||||||
			"Total user and system CPU time spent in seconds.",
 | 
								"Total user and system CPU time spent in seconds.",
 | 
				
			||||||
@@ -73,6 +101,11 @@ func NewProcessCollectorPIDFn(
 | 
				
			|||||||
			"Virtual memory size in bytes.",
 | 
								"Virtual memory size in bytes.",
 | 
				
			||||||
			nil, nil,
 | 
								nil, nil,
 | 
				
			||||||
		),
 | 
							),
 | 
				
			||||||
 | 
							maxVsize: NewDesc(
 | 
				
			||||||
 | 
								ns+"process_virtual_memory_max_bytes",
 | 
				
			||||||
 | 
								"Maximum amount of virtual memory available in bytes.",
 | 
				
			||||||
 | 
								nil, nil,
 | 
				
			||||||
 | 
							),
 | 
				
			||||||
		rss: NewDesc(
 | 
							rss: NewDesc(
 | 
				
			||||||
			ns+"process_resident_memory_bytes",
 | 
								ns+"process_resident_memory_bytes",
 | 
				
			||||||
			"Resident memory size in bytes.",
 | 
								"Resident memory size in bytes.",
 | 
				
			||||||
@@ -85,12 +118,23 @@ func NewProcessCollectorPIDFn(
 | 
				
			|||||||
		),
 | 
							),
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if opts.PidFn == nil {
 | 
				
			||||||
 | 
							pid := os.Getpid()
 | 
				
			||||||
 | 
							c.pidFn = func() (int, error) { return pid, nil }
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							c.pidFn = opts.PidFn
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Set up process metric collection if supported by the runtime.
 | 
						// Set up process metric collection if supported by the runtime.
 | 
				
			||||||
	if _, err := procfs.NewStat(); err == nil {
 | 
						if _, err := procfs.NewStat(); err == nil {
 | 
				
			||||||
		c.collectFn = c.processCollect
 | 
							c.collectFn = c.processCollect
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							c.collectFn = func(ch chan<- Metric) {
 | 
				
			||||||
 | 
								c.reportError(ch, nil, errors.New("process metrics not supported on this platform"))
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return &c
 | 
						return c
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Describe returns all descriptions of the collector.
 | 
					// Describe returns all descriptions of the collector.
 | 
				
			||||||
@@ -99,6 +143,7 @@ func (c *processCollector) Describe(ch chan<- *Desc) {
 | 
				
			|||||||
	ch <- c.openFDs
 | 
						ch <- c.openFDs
 | 
				
			||||||
	ch <- c.maxFDs
 | 
						ch <- c.maxFDs
 | 
				
			||||||
	ch <- c.vsize
 | 
						ch <- c.vsize
 | 
				
			||||||
 | 
						ch <- c.maxVsize
 | 
				
			||||||
	ch <- c.rss
 | 
						ch <- c.rss
 | 
				
			||||||
	ch <- c.startTime
 | 
						ch <- c.startTime
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -108,16 +153,16 @@ func (c *processCollector) Collect(ch chan<- Metric) {
 | 
				
			|||||||
	c.collectFn(ch)
 | 
						c.collectFn(ch)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO(ts): Bring back error reporting by reverting 7faf9e7 as soon as the
 | 
					 | 
				
			||||||
// client allows users to configure the error behavior.
 | 
					 | 
				
			||||||
func (c *processCollector) processCollect(ch chan<- Metric) {
 | 
					func (c *processCollector) processCollect(ch chan<- Metric) {
 | 
				
			||||||
	pid, err := c.pidFn()
 | 
						pid, err := c.pidFn()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 | 
							c.reportError(ch, nil, err)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p, err := procfs.NewProc(pid)
 | 
						p, err := procfs.NewProc(pid)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 | 
							c.reportError(ch, nil, err)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -127,14 +172,33 @@ func (c *processCollector) processCollect(ch chan<- Metric) {
 | 
				
			|||||||
		ch <- MustNewConstMetric(c.rss, GaugeValue, float64(stat.ResidentMemory()))
 | 
							ch <- MustNewConstMetric(c.rss, GaugeValue, float64(stat.ResidentMemory()))
 | 
				
			||||||
		if startTime, err := stat.StartTime(); err == nil {
 | 
							if startTime, err := stat.StartTime(); err == nil {
 | 
				
			||||||
			ch <- MustNewConstMetric(c.startTime, GaugeValue, startTime)
 | 
								ch <- MustNewConstMetric(c.startTime, GaugeValue, startTime)
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								c.reportError(ch, c.startTime, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							c.reportError(ch, nil, err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if fds, err := p.FileDescriptorsLen(); err == nil {
 | 
						if fds, err := p.FileDescriptorsLen(); err == nil {
 | 
				
			||||||
		ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(fds))
 | 
							ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(fds))
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							c.reportError(ch, c.openFDs, err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if limits, err := p.NewLimits(); err == nil {
 | 
						if limits, err := p.NewLimits(); err == nil {
 | 
				
			||||||
		ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(limits.OpenFiles))
 | 
							ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(limits.OpenFiles))
 | 
				
			||||||
 | 
							ch <- MustNewConstMetric(c.maxVsize, GaugeValue, float64(limits.AddressSpace))
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							c.reportError(ch, nil, err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (c *processCollector) reportError(ch chan<- Metric, desc *Desc, err error) {
 | 
				
			||||||
 | 
						if !c.reportErrors {
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if desc == nil {
 | 
				
			||||||
 | 
							desc = NewInvalidDesc(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						ch <- NewInvalidMetric(desc, err)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										196
									
								
								vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										196
									
								
								vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -38,7 +38,6 @@ type delegator interface {
 | 
				
			|||||||
type responseWriterDelegator struct {
 | 
					type responseWriterDelegator struct {
 | 
				
			||||||
	http.ResponseWriter
 | 
						http.ResponseWriter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	handler, method    string
 | 
					 | 
				
			||||||
	status             int
 | 
						status             int
 | 
				
			||||||
	written            int64
 | 
						written            int64
 | 
				
			||||||
	wroteHeader        bool
 | 
						wroteHeader        bool
 | 
				
			||||||
@@ -75,17 +74,20 @@ type closeNotifierDelegator struct{ *responseWriterDelegator }
 | 
				
			|||||||
type flusherDelegator struct{ *responseWriterDelegator }
 | 
					type flusherDelegator struct{ *responseWriterDelegator }
 | 
				
			||||||
type hijackerDelegator struct{ *responseWriterDelegator }
 | 
					type hijackerDelegator struct{ *responseWriterDelegator }
 | 
				
			||||||
type readerFromDelegator struct{ *responseWriterDelegator }
 | 
					type readerFromDelegator struct{ *responseWriterDelegator }
 | 
				
			||||||
 | 
					type pusherDelegator struct{ *responseWriterDelegator }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (d *closeNotifierDelegator) CloseNotify() <-chan bool {
 | 
					func (d closeNotifierDelegator) CloseNotify() <-chan bool {
 | 
				
			||||||
 | 
						//lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
 | 
				
			||||||
 | 
						//remove support from client_golang yet.
 | 
				
			||||||
	return d.ResponseWriter.(http.CloseNotifier).CloseNotify()
 | 
						return d.ResponseWriter.(http.CloseNotifier).CloseNotify()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
func (d *flusherDelegator) Flush() {
 | 
					func (d flusherDelegator) Flush() {
 | 
				
			||||||
	d.ResponseWriter.(http.Flusher).Flush()
 | 
						d.ResponseWriter.(http.Flusher).Flush()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
func (d *hijackerDelegator) Hijack() (net.Conn, *bufio.ReadWriter, error) {
 | 
					func (d hijackerDelegator) Hijack() (net.Conn, *bufio.ReadWriter, error) {
 | 
				
			||||||
	return d.ResponseWriter.(http.Hijacker).Hijack()
 | 
						return d.ResponseWriter.(http.Hijacker).Hijack()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
func (d *readerFromDelegator) ReadFrom(re io.Reader) (int64, error) {
 | 
					func (d readerFromDelegator) ReadFrom(re io.Reader) (int64, error) {
 | 
				
			||||||
	if !d.wroteHeader {
 | 
						if !d.wroteHeader {
 | 
				
			||||||
		d.WriteHeader(http.StatusOK)
 | 
							d.WriteHeader(http.StatusOK)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -93,6 +95,9 @@ func (d *readerFromDelegator) ReadFrom(re io.Reader) (int64, error) {
 | 
				
			|||||||
	d.written += n
 | 
						d.written += n
 | 
				
			||||||
	return n, err
 | 
						return n, err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					func (d pusherDelegator) Push(target string, opts *http.PushOptions) error {
 | 
				
			||||||
 | 
						return d.ResponseWriter.(http.Pusher).Push(target, opts)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var pickDelegator = make([]func(*responseWriterDelegator) delegator, 32)
 | 
					var pickDelegator = make([]func(*responseWriterDelegator) delegator, 32)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -102,34 +107,34 @@ func init() {
 | 
				
			|||||||
		return d
 | 
							return d
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[closeNotifier] = func(d *responseWriterDelegator) delegator { // 1
 | 
						pickDelegator[closeNotifier] = func(d *responseWriterDelegator) delegator { // 1
 | 
				
			||||||
		return &closeNotifierDelegator{d}
 | 
							return closeNotifierDelegator{d}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[flusher] = func(d *responseWriterDelegator) delegator { // 2
 | 
						pickDelegator[flusher] = func(d *responseWriterDelegator) delegator { // 2
 | 
				
			||||||
		return &flusherDelegator{d}
 | 
							return flusherDelegator{d}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 3
 | 
						pickDelegator[flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 3
 | 
				
			||||||
		return struct {
 | 
							return struct {
 | 
				
			||||||
			*responseWriterDelegator
 | 
								*responseWriterDelegator
 | 
				
			||||||
			http.Flusher
 | 
								http.Flusher
 | 
				
			||||||
			http.CloseNotifier
 | 
								http.CloseNotifier
 | 
				
			||||||
		}{d, &flusherDelegator{d}, &closeNotifierDelegator{d}}
 | 
							}{d, flusherDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[hijacker] = func(d *responseWriterDelegator) delegator { // 4
 | 
						pickDelegator[hijacker] = func(d *responseWriterDelegator) delegator { // 4
 | 
				
			||||||
		return &hijackerDelegator{d}
 | 
							return hijackerDelegator{d}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 5
 | 
						pickDelegator[hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 5
 | 
				
			||||||
		return struct {
 | 
							return struct {
 | 
				
			||||||
			*responseWriterDelegator
 | 
								*responseWriterDelegator
 | 
				
			||||||
			http.Hijacker
 | 
								http.Hijacker
 | 
				
			||||||
			http.CloseNotifier
 | 
								http.CloseNotifier
 | 
				
			||||||
		}{d, &hijackerDelegator{d}, &closeNotifierDelegator{d}}
 | 
							}{d, hijackerDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 6
 | 
						pickDelegator[hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 6
 | 
				
			||||||
		return struct {
 | 
							return struct {
 | 
				
			||||||
			*responseWriterDelegator
 | 
								*responseWriterDelegator
 | 
				
			||||||
			http.Hijacker
 | 
								http.Hijacker
 | 
				
			||||||
			http.Flusher
 | 
								http.Flusher
 | 
				
			||||||
		}{d, &hijackerDelegator{d}, &flusherDelegator{d}}
 | 
							}{d, hijackerDelegator{d}, flusherDelegator{d}}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 7
 | 
						pickDelegator[hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 7
 | 
				
			||||||
		return struct {
 | 
							return struct {
 | 
				
			||||||
@@ -137,7 +142,7 @@ func init() {
 | 
				
			|||||||
			http.Hijacker
 | 
								http.Hijacker
 | 
				
			||||||
			http.Flusher
 | 
								http.Flusher
 | 
				
			||||||
			http.CloseNotifier
 | 
								http.CloseNotifier
 | 
				
			||||||
		}{d, &hijackerDelegator{d}, &flusherDelegator{d}, &closeNotifierDelegator{d}}
 | 
							}{d, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[readerFrom] = func(d *responseWriterDelegator) delegator { // 8
 | 
						pickDelegator[readerFrom] = func(d *responseWriterDelegator) delegator { // 8
 | 
				
			||||||
		return readerFromDelegator{d}
 | 
							return readerFromDelegator{d}
 | 
				
			||||||
@@ -147,14 +152,14 @@ func init() {
 | 
				
			|||||||
			*responseWriterDelegator
 | 
								*responseWriterDelegator
 | 
				
			||||||
			io.ReaderFrom
 | 
								io.ReaderFrom
 | 
				
			||||||
			http.CloseNotifier
 | 
								http.CloseNotifier
 | 
				
			||||||
		}{d, &readerFromDelegator{d}, &closeNotifierDelegator{d}}
 | 
							}{d, readerFromDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[readerFrom+flusher] = func(d *responseWriterDelegator) delegator { // 10
 | 
						pickDelegator[readerFrom+flusher] = func(d *responseWriterDelegator) delegator { // 10
 | 
				
			||||||
		return struct {
 | 
							return struct {
 | 
				
			||||||
			*responseWriterDelegator
 | 
								*responseWriterDelegator
 | 
				
			||||||
			io.ReaderFrom
 | 
								io.ReaderFrom
 | 
				
			||||||
			http.Flusher
 | 
								http.Flusher
 | 
				
			||||||
		}{d, &readerFromDelegator{d}, &flusherDelegator{d}}
 | 
							}{d, readerFromDelegator{d}, flusherDelegator{d}}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[readerFrom+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 11
 | 
						pickDelegator[readerFrom+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 11
 | 
				
			||||||
		return struct {
 | 
							return struct {
 | 
				
			||||||
@@ -162,14 +167,14 @@ func init() {
 | 
				
			|||||||
			io.ReaderFrom
 | 
								io.ReaderFrom
 | 
				
			||||||
			http.Flusher
 | 
								http.Flusher
 | 
				
			||||||
			http.CloseNotifier
 | 
								http.CloseNotifier
 | 
				
			||||||
		}{d, &readerFromDelegator{d}, &flusherDelegator{d}, &closeNotifierDelegator{d}}
 | 
							}{d, readerFromDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[readerFrom+hijacker] = func(d *responseWriterDelegator) delegator { // 12
 | 
						pickDelegator[readerFrom+hijacker] = func(d *responseWriterDelegator) delegator { // 12
 | 
				
			||||||
		return struct {
 | 
							return struct {
 | 
				
			||||||
			*responseWriterDelegator
 | 
								*responseWriterDelegator
 | 
				
			||||||
			io.ReaderFrom
 | 
								io.ReaderFrom
 | 
				
			||||||
			http.Hijacker
 | 
								http.Hijacker
 | 
				
			||||||
		}{d, &readerFromDelegator{d}, &hijackerDelegator{d}}
 | 
							}{d, readerFromDelegator{d}, hijackerDelegator{d}}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[readerFrom+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 13
 | 
						pickDelegator[readerFrom+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 13
 | 
				
			||||||
		return struct {
 | 
							return struct {
 | 
				
			||||||
@@ -177,7 +182,7 @@ func init() {
 | 
				
			|||||||
			io.ReaderFrom
 | 
								io.ReaderFrom
 | 
				
			||||||
			http.Hijacker
 | 
								http.Hijacker
 | 
				
			||||||
			http.CloseNotifier
 | 
								http.CloseNotifier
 | 
				
			||||||
		}{d, &readerFromDelegator{d}, &hijackerDelegator{d}, &closeNotifierDelegator{d}}
 | 
							}{d, readerFromDelegator{d}, hijackerDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[readerFrom+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 14
 | 
						pickDelegator[readerFrom+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 14
 | 
				
			||||||
		return struct {
 | 
							return struct {
 | 
				
			||||||
@@ -185,7 +190,7 @@ func init() {
 | 
				
			|||||||
			io.ReaderFrom
 | 
								io.ReaderFrom
 | 
				
			||||||
			http.Hijacker
 | 
								http.Hijacker
 | 
				
			||||||
			http.Flusher
 | 
								http.Flusher
 | 
				
			||||||
		}{d, &readerFromDelegator{d}, &hijackerDelegator{d}, &flusherDelegator{d}}
 | 
							}{d, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pickDelegator[readerFrom+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 15
 | 
						pickDelegator[readerFrom+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 15
 | 
				
			||||||
		return struct {
 | 
							return struct {
 | 
				
			||||||
@@ -194,6 +199,159 @@ func init() {
 | 
				
			|||||||
			http.Hijacker
 | 
								http.Hijacker
 | 
				
			||||||
			http.Flusher
 | 
								http.Flusher
 | 
				
			||||||
			http.CloseNotifier
 | 
								http.CloseNotifier
 | 
				
			||||||
		}{d, &readerFromDelegator{d}, &hijackerDelegator{d}, &flusherDelegator{d}, &closeNotifierDelegator{d}}
 | 
							}{d, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher] = func(d *responseWriterDelegator) delegator { // 16
 | 
				
			||||||
 | 
							return pusherDelegator{d}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 17
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								http.CloseNotifier
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+flusher] = func(d *responseWriterDelegator) delegator { // 18
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								http.Flusher
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, flusherDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 19
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								http.Flusher
 | 
				
			||||||
 | 
								http.CloseNotifier
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+hijacker] = func(d *responseWriterDelegator) delegator { // 20
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								http.Hijacker
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, hijackerDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 21
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								http.Hijacker
 | 
				
			||||||
 | 
								http.CloseNotifier
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, hijackerDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 22
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								http.Hijacker
 | 
				
			||||||
 | 
								http.Flusher
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { //23
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								http.Hijacker
 | 
				
			||||||
 | 
								http.Flusher
 | 
				
			||||||
 | 
								http.CloseNotifier
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+readerFrom] = func(d *responseWriterDelegator) delegator { // 24
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								io.ReaderFrom
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, readerFromDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+readerFrom+closeNotifier] = func(d *responseWriterDelegator) delegator { // 25
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								io.ReaderFrom
 | 
				
			||||||
 | 
								http.CloseNotifier
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, readerFromDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+readerFrom+flusher] = func(d *responseWriterDelegator) delegator { // 26
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								io.ReaderFrom
 | 
				
			||||||
 | 
								http.Flusher
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, readerFromDelegator{d}, flusherDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+readerFrom+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 27
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								io.ReaderFrom
 | 
				
			||||||
 | 
								http.Flusher
 | 
				
			||||||
 | 
								http.CloseNotifier
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, readerFromDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+readerFrom+hijacker] = func(d *responseWriterDelegator) delegator { // 28
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								io.ReaderFrom
 | 
				
			||||||
 | 
								http.Hijacker
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+readerFrom+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 29
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								io.ReaderFrom
 | 
				
			||||||
 | 
								http.Hijacker
 | 
				
			||||||
 | 
								http.CloseNotifier
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+readerFrom+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 30
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								io.ReaderFrom
 | 
				
			||||||
 | 
								http.Hijacker
 | 
				
			||||||
 | 
								http.Flusher
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						pickDelegator[pusher+readerFrom+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 31
 | 
				
			||||||
 | 
							return struct {
 | 
				
			||||||
 | 
								*responseWriterDelegator
 | 
				
			||||||
 | 
								http.Pusher
 | 
				
			||||||
 | 
								io.ReaderFrom
 | 
				
			||||||
 | 
								http.Hijacker
 | 
				
			||||||
 | 
								http.Flusher
 | 
				
			||||||
 | 
								http.CloseNotifier
 | 
				
			||||||
 | 
							}{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func newDelegator(w http.ResponseWriter, observeWriteHeaderFunc func(int)) delegator {
 | 
				
			||||||
 | 
						d := &responseWriterDelegator{
 | 
				
			||||||
 | 
							ResponseWriter:     w,
 | 
				
			||||||
 | 
							observeWriteHeader: observeWriteHeaderFunc,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						id := 0
 | 
				
			||||||
 | 
						//lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
 | 
				
			||||||
 | 
						//remove support from client_golang yet.
 | 
				
			||||||
 | 
						if _, ok := w.(http.CloseNotifier); ok {
 | 
				
			||||||
 | 
							id += closeNotifier
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if _, ok := w.(http.Flusher); ok {
 | 
				
			||||||
 | 
							id += flusher
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if _, ok := w.(http.Hijacker); ok {
 | 
				
			||||||
 | 
							id += hijacker
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if _, ok := w.(io.ReaderFrom); ok {
 | 
				
			||||||
 | 
							id += readerFrom
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if _, ok := w.(http.Pusher); ok {
 | 
				
			||||||
 | 
							id += pusher
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return pickDelegator[id](d)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										181
									
								
								vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator_1_8.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										181
									
								
								vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator_1_8.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,181 +0,0 @@
 | 
				
			|||||||
// Copyright 2017 The Prometheus Authors
 | 
					 | 
				
			||||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 | 
				
			||||||
// you may not use this file except in compliance with the License.
 | 
					 | 
				
			||||||
// You may obtain a copy of the License at
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// http://www.apache.org/licenses/LICENSE-2.0
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// Unless required by applicable law or agreed to in writing, software
 | 
					 | 
				
			||||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
					 | 
				
			||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					 | 
				
			||||||
// See the License for the specific language governing permissions and
 | 
					 | 
				
			||||||
// limitations under the License.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// +build go1.8
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
package promhttp
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import (
 | 
					 | 
				
			||||||
	"io"
 | 
					 | 
				
			||||||
	"net/http"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
type pusherDelegator struct{ *responseWriterDelegator }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func (d *pusherDelegator) Push(target string, opts *http.PushOptions) error {
 | 
					 | 
				
			||||||
	return d.ResponseWriter.(http.Pusher).Push(target, opts)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func init() {
 | 
					 | 
				
			||||||
	pickDelegator[pusher] = func(d *responseWriterDelegator) delegator { // 16
 | 
					 | 
				
			||||||
		return &pusherDelegator{d}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 17
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			http.CloseNotifier
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &closeNotifierDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+flusher] = func(d *responseWriterDelegator) delegator { // 18
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			http.Flusher
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &flusherDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 19
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			http.Flusher
 | 
					 | 
				
			||||||
			http.CloseNotifier
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &flusherDelegator{d}, &closeNotifierDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+hijacker] = func(d *responseWriterDelegator) delegator { // 20
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			http.Hijacker
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &hijackerDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 21
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			http.Hijacker
 | 
					 | 
				
			||||||
			http.CloseNotifier
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &hijackerDelegator{d}, &closeNotifierDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 22
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			http.Hijacker
 | 
					 | 
				
			||||||
			http.Flusher
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &hijackerDelegator{d}, &flusherDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { //23
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			http.Hijacker
 | 
					 | 
				
			||||||
			http.Flusher
 | 
					 | 
				
			||||||
			http.CloseNotifier
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &hijackerDelegator{d}, &flusherDelegator{d}, &closeNotifierDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+readerFrom] = func(d *responseWriterDelegator) delegator { // 24
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			io.ReaderFrom
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &readerFromDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+readerFrom+closeNotifier] = func(d *responseWriterDelegator) delegator { // 25
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			io.ReaderFrom
 | 
					 | 
				
			||||||
			http.CloseNotifier
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &readerFromDelegator{d}, &closeNotifierDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+readerFrom+flusher] = func(d *responseWriterDelegator) delegator { // 26
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			io.ReaderFrom
 | 
					 | 
				
			||||||
			http.Flusher
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &readerFromDelegator{d}, &flusherDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+readerFrom+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 27
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			io.ReaderFrom
 | 
					 | 
				
			||||||
			http.Flusher
 | 
					 | 
				
			||||||
			http.CloseNotifier
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &readerFromDelegator{d}, &flusherDelegator{d}, &closeNotifierDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+readerFrom+hijacker] = func(d *responseWriterDelegator) delegator { // 28
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			io.ReaderFrom
 | 
					 | 
				
			||||||
			http.Hijacker
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &readerFromDelegator{d}, &hijackerDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+readerFrom+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 29
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			io.ReaderFrom
 | 
					 | 
				
			||||||
			http.Hijacker
 | 
					 | 
				
			||||||
			http.CloseNotifier
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &readerFromDelegator{d}, &hijackerDelegator{d}, &closeNotifierDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+readerFrom+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 30
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			io.ReaderFrom
 | 
					 | 
				
			||||||
			http.Hijacker
 | 
					 | 
				
			||||||
			http.Flusher
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &readerFromDelegator{d}, &hijackerDelegator{d}, &flusherDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	pickDelegator[pusher+readerFrom+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 31
 | 
					 | 
				
			||||||
		return struct {
 | 
					 | 
				
			||||||
			*responseWriterDelegator
 | 
					 | 
				
			||||||
			http.Pusher
 | 
					 | 
				
			||||||
			io.ReaderFrom
 | 
					 | 
				
			||||||
			http.Hijacker
 | 
					 | 
				
			||||||
			http.Flusher
 | 
					 | 
				
			||||||
			http.CloseNotifier
 | 
					 | 
				
			||||||
		}{d, &pusherDelegator{d}, &readerFromDelegator{d}, &hijackerDelegator{d}, &flusherDelegator{d}, &closeNotifierDelegator{d}}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func newDelegator(w http.ResponseWriter, observeWriteHeaderFunc func(int)) delegator {
 | 
					 | 
				
			||||||
	d := &responseWriterDelegator{
 | 
					 | 
				
			||||||
		ResponseWriter:     w,
 | 
					 | 
				
			||||||
		observeWriteHeader: observeWriteHeaderFunc,
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	id := 0
 | 
					 | 
				
			||||||
	if _, ok := w.(http.CloseNotifier); ok {
 | 
					 | 
				
			||||||
		id += closeNotifier
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if _, ok := w.(http.Flusher); ok {
 | 
					 | 
				
			||||||
		id += flusher
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if _, ok := w.(http.Hijacker); ok {
 | 
					 | 
				
			||||||
		id += hijacker
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if _, ok := w.(io.ReaderFrom); ok {
 | 
					 | 
				
			||||||
		id += readerFrom
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if _, ok := w.(http.Pusher); ok {
 | 
					 | 
				
			||||||
		id += pusher
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return pickDelegator[id](d)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										44
									
								
								vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator_pre_1_8.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										44
									
								
								vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator_pre_1_8.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,44 +0,0 @@
 | 
				
			|||||||
// Copyright 2017 The Prometheus Authors
 | 
					 | 
				
			||||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 | 
				
			||||||
// you may not use this file except in compliance with the License.
 | 
					 | 
				
			||||||
// You may obtain a copy of the License at
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// http://www.apache.org/licenses/LICENSE-2.0
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// Unless required by applicable law or agreed to in writing, software
 | 
					 | 
				
			||||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
					 | 
				
			||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					 | 
				
			||||||
// See the License for the specific language governing permissions and
 | 
					 | 
				
			||||||
// limitations under the License.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// +build !go1.8
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
package promhttp
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import (
 | 
					 | 
				
			||||||
	"io"
 | 
					 | 
				
			||||||
	"net/http"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func newDelegator(w http.ResponseWriter, observeWriteHeaderFunc func(int)) delegator {
 | 
					 | 
				
			||||||
	d := &responseWriterDelegator{
 | 
					 | 
				
			||||||
		ResponseWriter:     w,
 | 
					 | 
				
			||||||
		observeWriteHeader: observeWriteHeaderFunc,
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	id := 0
 | 
					 | 
				
			||||||
	if _, ok := w.(http.CloseNotifier); ok {
 | 
					 | 
				
			||||||
		id += closeNotifier
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if _, ok := w.(http.Flusher); ok {
 | 
					 | 
				
			||||||
		id += flusher
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if _, ok := w.(http.Hijacker); ok {
 | 
					 | 
				
			||||||
		id += hijacker
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if _, ok := w.(io.ReaderFrom); ok {
 | 
					 | 
				
			||||||
		id += readerFrom
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return pickDelegator[id](d)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										143
									
								
								vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										143
									
								
								vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -32,13 +32,13 @@
 | 
				
			|||||||
package promhttp
 | 
					package promhttp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"bytes"
 | 
					 | 
				
			||||||
	"compress/gzip"
 | 
						"compress/gzip"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/prometheus/common/expfmt"
 | 
						"github.com/prometheus/common/expfmt"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -47,24 +47,14 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const (
 | 
					const (
 | 
				
			||||||
	contentTypeHeader     = "Content-Type"
 | 
						contentTypeHeader     = "Content-Type"
 | 
				
			||||||
	contentLengthHeader   = "Content-Length"
 | 
					 | 
				
			||||||
	contentEncodingHeader = "Content-Encoding"
 | 
						contentEncodingHeader = "Content-Encoding"
 | 
				
			||||||
	acceptEncodingHeader  = "Accept-Encoding"
 | 
						acceptEncodingHeader  = "Accept-Encoding"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var bufPool sync.Pool
 | 
					var gzipPool = sync.Pool{
 | 
				
			||||||
 | 
						New: func() interface{} {
 | 
				
			||||||
func getBuf() *bytes.Buffer {
 | 
							return gzip.NewWriter(nil)
 | 
				
			||||||
	buf := bufPool.Get()
 | 
						},
 | 
				
			||||||
	if buf == nil {
 | 
					 | 
				
			||||||
		return &bytes.Buffer{}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return buf.(*bytes.Buffer)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func giveBuf(buf *bytes.Buffer) {
 | 
					 | 
				
			||||||
	buf.Reset()
 | 
					 | 
				
			||||||
	bufPool.Put(buf)
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Handler returns an http.Handler for the prometheus.DefaultGatherer, using
 | 
					// Handler returns an http.Handler for the prometheus.DefaultGatherer, using
 | 
				
			||||||
@@ -94,7 +84,23 @@ func Handler() http.Handler {
 | 
				
			|||||||
// instrumentation. Use the InstrumentMetricHandler function to apply the same
 | 
					// instrumentation. Use the InstrumentMetricHandler function to apply the same
 | 
				
			||||||
// kind of instrumentation as it is used by the Handler function.
 | 
					// kind of instrumentation as it is used by the Handler function.
 | 
				
			||||||
func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler {
 | 
					func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler {
 | 
				
			||||||
	return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 | 
						var inFlightSem chan struct{}
 | 
				
			||||||
 | 
						if opts.MaxRequestsInFlight > 0 {
 | 
				
			||||||
 | 
							inFlightSem = make(chan struct{}, opts.MaxRequestsInFlight)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						h := http.HandlerFunc(func(rsp http.ResponseWriter, req *http.Request) {
 | 
				
			||||||
 | 
							if inFlightSem != nil {
 | 
				
			||||||
 | 
								select {
 | 
				
			||||||
 | 
								case inFlightSem <- struct{}{}: // All good, carry on.
 | 
				
			||||||
 | 
									defer func() { <-inFlightSem }()
 | 
				
			||||||
 | 
								default:
 | 
				
			||||||
 | 
									http.Error(rsp, fmt.Sprintf(
 | 
				
			||||||
 | 
										"Limit of concurrent requests reached (%d), try again later.", opts.MaxRequestsInFlight,
 | 
				
			||||||
 | 
									), http.StatusServiceUnavailable)
 | 
				
			||||||
 | 
									return
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		mfs, err := reg.Gather()
 | 
							mfs, err := reg.Gather()
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			if opts.ErrorLog != nil {
 | 
								if opts.ErrorLog != nil {
 | 
				
			||||||
@@ -105,26 +111,40 @@ func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler {
 | 
				
			|||||||
				panic(err)
 | 
									panic(err)
 | 
				
			||||||
			case ContinueOnError:
 | 
								case ContinueOnError:
 | 
				
			||||||
				if len(mfs) == 0 {
 | 
									if len(mfs) == 0 {
 | 
				
			||||||
					http.Error(w, "No metrics gathered, last error:\n\n"+err.Error(), http.StatusInternalServerError)
 | 
										// Still report the error if no metrics have been gathered.
 | 
				
			||||||
 | 
										httpError(rsp, err)
 | 
				
			||||||
					return
 | 
										return
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			case HTTPErrorOnError:
 | 
								case HTTPErrorOnError:
 | 
				
			||||||
				http.Error(w, "An error has occurred during metrics gathering:\n\n"+err.Error(), http.StatusInternalServerError)
 | 
									httpError(rsp, err)
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		contentType := expfmt.Negotiate(req.Header)
 | 
							contentType := expfmt.Negotiate(req.Header)
 | 
				
			||||||
		buf := getBuf()
 | 
							header := rsp.Header()
 | 
				
			||||||
		defer giveBuf(buf)
 | 
							header.Set(contentTypeHeader, string(contentType))
 | 
				
			||||||
		writer, encoding := decorateWriter(req, buf, opts.DisableCompression)
 | 
					
 | 
				
			||||||
		enc := expfmt.NewEncoder(writer, contentType)
 | 
							w := io.Writer(rsp)
 | 
				
			||||||
 | 
							if !opts.DisableCompression && gzipAccepted(req.Header) {
 | 
				
			||||||
 | 
								header.Set(contentEncodingHeader, "gzip")
 | 
				
			||||||
 | 
								gz := gzipPool.Get().(*gzip.Writer)
 | 
				
			||||||
 | 
								defer gzipPool.Put(gz)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								gz.Reset(w)
 | 
				
			||||||
 | 
								defer gz.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								w = gz
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							enc := expfmt.NewEncoder(w, contentType)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		var lastErr error
 | 
							var lastErr error
 | 
				
			||||||
		for _, mf := range mfs {
 | 
							for _, mf := range mfs {
 | 
				
			||||||
			if err := enc.Encode(mf); err != nil {
 | 
								if err := enc.Encode(mf); err != nil {
 | 
				
			||||||
				lastErr = err
 | 
									lastErr = err
 | 
				
			||||||
				if opts.ErrorLog != nil {
 | 
									if opts.ErrorLog != nil {
 | 
				
			||||||
					opts.ErrorLog.Println("error encoding metric family:", err)
 | 
										opts.ErrorLog.Println("error encoding and sending metric family:", err)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				switch opts.ErrorHandling {
 | 
									switch opts.ErrorHandling {
 | 
				
			||||||
				case PanicOnError:
 | 
									case PanicOnError:
 | 
				
			||||||
@@ -132,27 +152,24 @@ func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler {
 | 
				
			|||||||
				case ContinueOnError:
 | 
									case ContinueOnError:
 | 
				
			||||||
					// Handled later.
 | 
										// Handled later.
 | 
				
			||||||
				case HTTPErrorOnError:
 | 
									case HTTPErrorOnError:
 | 
				
			||||||
					http.Error(w, "An error has occurred during metrics encoding:\n\n"+err.Error(), http.StatusInternalServerError)
 | 
										httpError(rsp, err)
 | 
				
			||||||
					return
 | 
										return
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if closer, ok := writer.(io.Closer); ok {
 | 
					
 | 
				
			||||||
			closer.Close()
 | 
							if lastErr != nil {
 | 
				
			||||||
 | 
								httpError(rsp, lastErr)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if lastErr != nil && buf.Len() == 0 {
 | 
					 | 
				
			||||||
			http.Error(w, "No metrics encoded, last error:\n\n"+lastErr.Error(), http.StatusInternalServerError)
 | 
					 | 
				
			||||||
			return
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		header := w.Header()
 | 
					 | 
				
			||||||
		header.Set(contentTypeHeader, string(contentType))
 | 
					 | 
				
			||||||
		header.Set(contentLengthHeader, fmt.Sprint(buf.Len()))
 | 
					 | 
				
			||||||
		if encoding != "" {
 | 
					 | 
				
			||||||
			header.Set(contentEncodingHeader, encoding)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		w.Write(buf.Bytes())
 | 
					 | 
				
			||||||
		// TODO(beorn7): Consider streaming serving of metrics.
 | 
					 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if opts.Timeout <= 0 {
 | 
				
			||||||
 | 
							return h
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return http.TimeoutHandler(h, opts.Timeout, fmt.Sprintf(
 | 
				
			||||||
 | 
							"Exceeded configured timeout of %v.\n",
 | 
				
			||||||
 | 
							opts.Timeout,
 | 
				
			||||||
 | 
						))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// InstrumentMetricHandler is usually used with an http.Handler returned by the
 | 
					// InstrumentMetricHandler is usually used with an http.Handler returned by the
 | 
				
			||||||
@@ -182,6 +199,7 @@ func InstrumentMetricHandler(reg prometheus.Registerer, handler http.Handler) ht
 | 
				
			|||||||
	// Initialize the most likely HTTP status codes.
 | 
						// Initialize the most likely HTTP status codes.
 | 
				
			||||||
	cnt.WithLabelValues("200")
 | 
						cnt.WithLabelValues("200")
 | 
				
			||||||
	cnt.WithLabelValues("500")
 | 
						cnt.WithLabelValues("500")
 | 
				
			||||||
 | 
						cnt.WithLabelValues("503")
 | 
				
			||||||
	if err := reg.Register(cnt); err != nil {
 | 
						if err := reg.Register(cnt); err != nil {
 | 
				
			||||||
		if are, ok := err.(prometheus.AlreadyRegisteredError); ok {
 | 
							if are, ok := err.(prometheus.AlreadyRegisteredError); ok {
 | 
				
			||||||
			cnt = are.ExistingCollector.(*prometheus.CounterVec)
 | 
								cnt = are.ExistingCollector.(*prometheus.CounterVec)
 | 
				
			||||||
@@ -246,22 +264,47 @@ type HandlerOpts struct {
 | 
				
			|||||||
	// If DisableCompression is true, the handler will never compress the
 | 
						// If DisableCompression is true, the handler will never compress the
 | 
				
			||||||
	// response, even if requested by the client.
 | 
						// response, even if requested by the client.
 | 
				
			||||||
	DisableCompression bool
 | 
						DisableCompression bool
 | 
				
			||||||
 | 
						// The number of concurrent HTTP requests is limited to
 | 
				
			||||||
 | 
						// MaxRequestsInFlight. Additional requests are responded to with 503
 | 
				
			||||||
 | 
						// Service Unavailable and a suitable message in the body. If
 | 
				
			||||||
 | 
						// MaxRequestsInFlight is 0 or negative, no limit is applied.
 | 
				
			||||||
 | 
						MaxRequestsInFlight int
 | 
				
			||||||
 | 
						// If handling a request takes longer than Timeout, it is responded to
 | 
				
			||||||
 | 
						// with 503 ServiceUnavailable and a suitable Message. No timeout is
 | 
				
			||||||
 | 
						// applied if Timeout is 0 or negative. Note that with the current
 | 
				
			||||||
 | 
						// implementation, reaching the timeout simply ends the HTTP requests as
 | 
				
			||||||
 | 
						// described above (and even that only if sending of the body hasn't
 | 
				
			||||||
 | 
						// started yet), while the bulk work of gathering all the metrics keeps
 | 
				
			||||||
 | 
						// running in the background (with the eventual result to be thrown
 | 
				
			||||||
 | 
						// away). Until the implementation is improved, it is recommended to
 | 
				
			||||||
 | 
						// implement a separate timeout in potentially slow Collectors.
 | 
				
			||||||
 | 
						Timeout time.Duration
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// decorateWriter wraps a writer to handle gzip compression if requested.  It
 | 
					// gzipAccepted returns whether the client will accept gzip-encoded content.
 | 
				
			||||||
// returns the decorated writer and the appropriate "Content-Encoding" header
 | 
					func gzipAccepted(header http.Header) bool {
 | 
				
			||||||
// (which is empty if no compression is enabled).
 | 
						a := header.Get(acceptEncodingHeader)
 | 
				
			||||||
func decorateWriter(request *http.Request, writer io.Writer, compressionDisabled bool) (io.Writer, string) {
 | 
						parts := strings.Split(a, ",")
 | 
				
			||||||
	if compressionDisabled {
 | 
					 | 
				
			||||||
		return writer, ""
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	header := request.Header.Get(acceptEncodingHeader)
 | 
					 | 
				
			||||||
	parts := strings.Split(header, ",")
 | 
					 | 
				
			||||||
	for _, part := range parts {
 | 
						for _, part := range parts {
 | 
				
			||||||
		part := strings.TrimSpace(part)
 | 
							part = strings.TrimSpace(part)
 | 
				
			||||||
		if part == "gzip" || strings.HasPrefix(part, "gzip;") {
 | 
							if part == "gzip" || strings.HasPrefix(part, "gzip;") {
 | 
				
			||||||
			return gzip.NewWriter(writer), "gzip"
 | 
								return true
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return writer, ""
 | 
						return false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// httpError removes any content-encoding header and then calls http.Error with
 | 
				
			||||||
 | 
					// the provided error and http.StatusInternalServerErrer. Error contents is
 | 
				
			||||||
 | 
					// supposed to be uncompressed plain text. However, same as with a plain
 | 
				
			||||||
 | 
					// http.Error, any header settings will be void if the header has already been
 | 
				
			||||||
 | 
					// sent. The error message will still be written to the writer, but it will
 | 
				
			||||||
 | 
					// probably be of limited use.
 | 
				
			||||||
 | 
					func httpError(rsp http.ResponseWriter, err error) {
 | 
				
			||||||
 | 
						rsp.Header().Del(contentEncodingHeader)
 | 
				
			||||||
 | 
						http.Error(
 | 
				
			||||||
 | 
							rsp,
 | 
				
			||||||
 | 
							"An error has occurred while serving metrics:\n\n"+err.Error(),
 | 
				
			||||||
 | 
							http.StatusInternalServerError,
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										122
									
								
								vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										122
									
								
								vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -14,7 +14,9 @@
 | 
				
			|||||||
package promhttp
 | 
					package promhttp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"crypto/tls"
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
 | 
						"net/http/httptrace"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/prometheus/client_golang/prometheus"
 | 
						"github.com/prometheus/client_golang/prometheus"
 | 
				
			||||||
@@ -95,3 +97,123 @@ func InstrumentRoundTripperDuration(obs prometheus.ObserverVec, next http.RoundT
 | 
				
			|||||||
		return resp, err
 | 
							return resp, err
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// InstrumentTrace is used to offer flexibility in instrumenting the available
 | 
				
			||||||
 | 
					// httptrace.ClientTrace hook functions. Each function is passed a float64
 | 
				
			||||||
 | 
					// representing the time in seconds since the start of the http request. A user
 | 
				
			||||||
 | 
					// may choose to use separately buckets Histograms, or implement custom
 | 
				
			||||||
 | 
					// instance labels on a per function basis.
 | 
				
			||||||
 | 
					type InstrumentTrace struct {
 | 
				
			||||||
 | 
						GotConn              func(float64)
 | 
				
			||||||
 | 
						PutIdleConn          func(float64)
 | 
				
			||||||
 | 
						GotFirstResponseByte func(float64)
 | 
				
			||||||
 | 
						Got100Continue       func(float64)
 | 
				
			||||||
 | 
						DNSStart             func(float64)
 | 
				
			||||||
 | 
						DNSDone              func(float64)
 | 
				
			||||||
 | 
						ConnectStart         func(float64)
 | 
				
			||||||
 | 
						ConnectDone          func(float64)
 | 
				
			||||||
 | 
						TLSHandshakeStart    func(float64)
 | 
				
			||||||
 | 
						TLSHandshakeDone     func(float64)
 | 
				
			||||||
 | 
						WroteHeaders         func(float64)
 | 
				
			||||||
 | 
						Wait100Continue      func(float64)
 | 
				
			||||||
 | 
						WroteRequest         func(float64)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// InstrumentRoundTripperTrace is a middleware that wraps the provided
 | 
				
			||||||
 | 
					// RoundTripper and reports times to hook functions provided in the
 | 
				
			||||||
 | 
					// InstrumentTrace struct. Hook functions that are not present in the provided
 | 
				
			||||||
 | 
					// InstrumentTrace struct are ignored. Times reported to the hook functions are
 | 
				
			||||||
 | 
					// time since the start of the request. Only with Go1.9+, those times are
 | 
				
			||||||
 | 
					// guaranteed to never be negative. (Earlier Go versions are not using a
 | 
				
			||||||
 | 
					// monotonic clock.) Note that partitioning of Histograms is expensive and
 | 
				
			||||||
 | 
					// should be used judiciously.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// For hook functions that receive an error as an argument, no observations are
 | 
				
			||||||
 | 
					// made in the event of a non-nil error value.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// See the example for ExampleInstrumentRoundTripperDuration for example usage.
 | 
				
			||||||
 | 
					func InstrumentRoundTripperTrace(it *InstrumentTrace, next http.RoundTripper) RoundTripperFunc {
 | 
				
			||||||
 | 
						return RoundTripperFunc(func(r *http.Request) (*http.Response, error) {
 | 
				
			||||||
 | 
							start := time.Now()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							trace := &httptrace.ClientTrace{
 | 
				
			||||||
 | 
								GotConn: func(_ httptrace.GotConnInfo) {
 | 
				
			||||||
 | 
									if it.GotConn != nil {
 | 
				
			||||||
 | 
										it.GotConn(time.Since(start).Seconds())
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								PutIdleConn: func(err error) {
 | 
				
			||||||
 | 
									if err != nil {
 | 
				
			||||||
 | 
										return
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									if it.PutIdleConn != nil {
 | 
				
			||||||
 | 
										it.PutIdleConn(time.Since(start).Seconds())
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								DNSStart: func(_ httptrace.DNSStartInfo) {
 | 
				
			||||||
 | 
									if it.DNSStart != nil {
 | 
				
			||||||
 | 
										it.DNSStart(time.Since(start).Seconds())
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								DNSDone: func(_ httptrace.DNSDoneInfo) {
 | 
				
			||||||
 | 
									if it.DNSDone != nil {
 | 
				
			||||||
 | 
										it.DNSDone(time.Since(start).Seconds())
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								ConnectStart: func(_, _ string) {
 | 
				
			||||||
 | 
									if it.ConnectStart != nil {
 | 
				
			||||||
 | 
										it.ConnectStart(time.Since(start).Seconds())
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								ConnectDone: func(_, _ string, err error) {
 | 
				
			||||||
 | 
									if err != nil {
 | 
				
			||||||
 | 
										return
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									if it.ConnectDone != nil {
 | 
				
			||||||
 | 
										it.ConnectDone(time.Since(start).Seconds())
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								GotFirstResponseByte: func() {
 | 
				
			||||||
 | 
									if it.GotFirstResponseByte != nil {
 | 
				
			||||||
 | 
										it.GotFirstResponseByte(time.Since(start).Seconds())
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								Got100Continue: func() {
 | 
				
			||||||
 | 
									if it.Got100Continue != nil {
 | 
				
			||||||
 | 
										it.Got100Continue(time.Since(start).Seconds())
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								TLSHandshakeStart: func() {
 | 
				
			||||||
 | 
									if it.TLSHandshakeStart != nil {
 | 
				
			||||||
 | 
										it.TLSHandshakeStart(time.Since(start).Seconds())
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								TLSHandshakeDone: func(_ tls.ConnectionState, err error) {
 | 
				
			||||||
 | 
									if err != nil {
 | 
				
			||||||
 | 
										return
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									if it.TLSHandshakeDone != nil {
 | 
				
			||||||
 | 
										it.TLSHandshakeDone(time.Since(start).Seconds())
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								WroteHeaders: func() {
 | 
				
			||||||
 | 
									if it.WroteHeaders != nil {
 | 
				
			||||||
 | 
										it.WroteHeaders(time.Since(start).Seconds())
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								Wait100Continue: func() {
 | 
				
			||||||
 | 
									if it.Wait100Continue != nil {
 | 
				
			||||||
 | 
										it.Wait100Continue(time.Since(start).Seconds())
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								WroteRequest: func(_ httptrace.WroteRequestInfo) {
 | 
				
			||||||
 | 
									if it.WroteRequest != nil {
 | 
				
			||||||
 | 
										it.WroteRequest(time.Since(start).Seconds())
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							r = r.WithContext(httptrace.WithClientTrace(r.Context(), trace))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return next.RoundTrip(r)
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										144
									
								
								vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client_1_8.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										144
									
								
								vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client_1_8.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,144 +0,0 @@
 | 
				
			|||||||
// Copyright 2017 The Prometheus Authors
 | 
					 | 
				
			||||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 | 
				
			||||||
// you may not use this file except in compliance with the License.
 | 
					 | 
				
			||||||
// You may obtain a copy of the License at
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// http://www.apache.org/licenses/LICENSE-2.0
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// Unless required by applicable law or agreed to in writing, software
 | 
					 | 
				
			||||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
					 | 
				
			||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					 | 
				
			||||||
// See the License for the specific language governing permissions and
 | 
					 | 
				
			||||||
// limitations under the License.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// +build go1.8
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
package promhttp
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import (
 | 
					 | 
				
			||||||
	"context"
 | 
					 | 
				
			||||||
	"crypto/tls"
 | 
					 | 
				
			||||||
	"net/http"
 | 
					 | 
				
			||||||
	"net/http/httptrace"
 | 
					 | 
				
			||||||
	"time"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// InstrumentTrace is used to offer flexibility in instrumenting the available
 | 
					 | 
				
			||||||
// httptrace.ClientTrace hook functions. Each function is passed a float64
 | 
					 | 
				
			||||||
// representing the time in seconds since the start of the http request. A user
 | 
					 | 
				
			||||||
// may choose to use separately buckets Histograms, or implement custom
 | 
					 | 
				
			||||||
// instance labels on a per function basis.
 | 
					 | 
				
			||||||
type InstrumentTrace struct {
 | 
					 | 
				
			||||||
	GotConn              func(float64)
 | 
					 | 
				
			||||||
	PutIdleConn          func(float64)
 | 
					 | 
				
			||||||
	GotFirstResponseByte func(float64)
 | 
					 | 
				
			||||||
	Got100Continue       func(float64)
 | 
					 | 
				
			||||||
	DNSStart             func(float64)
 | 
					 | 
				
			||||||
	DNSDone              func(float64)
 | 
					 | 
				
			||||||
	ConnectStart         func(float64)
 | 
					 | 
				
			||||||
	ConnectDone          func(float64)
 | 
					 | 
				
			||||||
	TLSHandshakeStart    func(float64)
 | 
					 | 
				
			||||||
	TLSHandshakeDone     func(float64)
 | 
					 | 
				
			||||||
	WroteHeaders         func(float64)
 | 
					 | 
				
			||||||
	Wait100Continue      func(float64)
 | 
					 | 
				
			||||||
	WroteRequest         func(float64)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// InstrumentRoundTripperTrace is a middleware that wraps the provided
 | 
					 | 
				
			||||||
// RoundTripper and reports times to hook functions provided in the
 | 
					 | 
				
			||||||
// InstrumentTrace struct. Hook functions that are not present in the provided
 | 
					 | 
				
			||||||
// InstrumentTrace struct are ignored. Times reported to the hook functions are
 | 
					 | 
				
			||||||
// time since the start of the request. Only with Go1.9+, those times are
 | 
					 | 
				
			||||||
// guaranteed to never be negative. (Earlier Go versions are not using a
 | 
					 | 
				
			||||||
// monotonic clock.) Note that partitioning of Histograms is expensive and
 | 
					 | 
				
			||||||
// should be used judiciously.
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// For hook functions that receive an error as an argument, no observations are
 | 
					 | 
				
			||||||
// made in the event of a non-nil error value.
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// See the example for ExampleInstrumentRoundTripperDuration for example usage.
 | 
					 | 
				
			||||||
func InstrumentRoundTripperTrace(it *InstrumentTrace, next http.RoundTripper) RoundTripperFunc {
 | 
					 | 
				
			||||||
	return RoundTripperFunc(func(r *http.Request) (*http.Response, error) {
 | 
					 | 
				
			||||||
		start := time.Now()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		trace := &httptrace.ClientTrace{
 | 
					 | 
				
			||||||
			GotConn: func(_ httptrace.GotConnInfo) {
 | 
					 | 
				
			||||||
				if it.GotConn != nil {
 | 
					 | 
				
			||||||
					it.GotConn(time.Since(start).Seconds())
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			PutIdleConn: func(err error) {
 | 
					 | 
				
			||||||
				if err != nil {
 | 
					 | 
				
			||||||
					return
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				if it.PutIdleConn != nil {
 | 
					 | 
				
			||||||
					it.PutIdleConn(time.Since(start).Seconds())
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			DNSStart: func(_ httptrace.DNSStartInfo) {
 | 
					 | 
				
			||||||
				if it.DNSStart != nil {
 | 
					 | 
				
			||||||
					it.DNSStart(time.Since(start).Seconds())
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			DNSDone: func(_ httptrace.DNSDoneInfo) {
 | 
					 | 
				
			||||||
				if it.DNSStart != nil {
 | 
					 | 
				
			||||||
					it.DNSStart(time.Since(start).Seconds())
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			ConnectStart: func(_, _ string) {
 | 
					 | 
				
			||||||
				if it.ConnectStart != nil {
 | 
					 | 
				
			||||||
					it.ConnectStart(time.Since(start).Seconds())
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			ConnectDone: func(_, _ string, err error) {
 | 
					 | 
				
			||||||
				if err != nil {
 | 
					 | 
				
			||||||
					return
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				if it.ConnectDone != nil {
 | 
					 | 
				
			||||||
					it.ConnectDone(time.Since(start).Seconds())
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			GotFirstResponseByte: func() {
 | 
					 | 
				
			||||||
				if it.GotFirstResponseByte != nil {
 | 
					 | 
				
			||||||
					it.GotFirstResponseByte(time.Since(start).Seconds())
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			Got100Continue: func() {
 | 
					 | 
				
			||||||
				if it.Got100Continue != nil {
 | 
					 | 
				
			||||||
					it.Got100Continue(time.Since(start).Seconds())
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			TLSHandshakeStart: func() {
 | 
					 | 
				
			||||||
				if it.TLSHandshakeStart != nil {
 | 
					 | 
				
			||||||
					it.TLSHandshakeStart(time.Since(start).Seconds())
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			TLSHandshakeDone: func(_ tls.ConnectionState, err error) {
 | 
					 | 
				
			||||||
				if err != nil {
 | 
					 | 
				
			||||||
					return
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				if it.TLSHandshakeDone != nil {
 | 
					 | 
				
			||||||
					it.TLSHandshakeDone(time.Since(start).Seconds())
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			WroteHeaders: func() {
 | 
					 | 
				
			||||||
				if it.WroteHeaders != nil {
 | 
					 | 
				
			||||||
					it.WroteHeaders(time.Since(start).Seconds())
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			Wait100Continue: func() {
 | 
					 | 
				
			||||||
				if it.Wait100Continue != nil {
 | 
					 | 
				
			||||||
					it.Wait100Continue(time.Since(start).Seconds())
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			WroteRequest: func(_ httptrace.WroteRequestInfo) {
 | 
					 | 
				
			||||||
				if it.WroteRequest != nil {
 | 
					 | 
				
			||||||
					it.WroteRequest(time.Since(start).Seconds())
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		r = r.WithContext(httptrace.WithClientTrace(context.Background(), trace))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		return next.RoundTrip(r)
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										418
									
								
								vendor/github.com/prometheus/client_golang/prometheus/registry.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										418
									
								
								vendor/github.com/prometheus/client_golang/prometheus/registry.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -15,17 +15,22 @@ package prometheus
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"bytes"
 | 
						"bytes"
 | 
				
			||||||
	"errors"
 | 
					 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
 | 
						"io/ioutil"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
 | 
						"path/filepath"
 | 
				
			||||||
	"runtime"
 | 
						"runtime"
 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
 | 
						"strings"
 | 
				
			||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
	"unicode/utf8"
 | 
						"unicode/utf8"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/golang/protobuf/proto"
 | 
						"github.com/golang/protobuf/proto"
 | 
				
			||||||
 | 
						"github.com/prometheus/common/expfmt"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dto "github.com/prometheus/client_model/go"
 | 
						dto "github.com/prometheus/client_model/go"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/prometheus/client_golang/prometheus/internal"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const (
 | 
					const (
 | 
				
			||||||
@@ -38,12 +43,13 @@ const (
 | 
				
			|||||||
// Registerer and Gatherer interface a number of convenience functions in this
 | 
					// Registerer and Gatherer interface a number of convenience functions in this
 | 
				
			||||||
// package act on. Initially, both variables point to the same Registry, which
 | 
					// package act on. Initially, both variables point to the same Registry, which
 | 
				
			||||||
// has a process collector (currently on Linux only, see NewProcessCollector)
 | 
					// has a process collector (currently on Linux only, see NewProcessCollector)
 | 
				
			||||||
// and a Go collector (see NewGoCollector) already registered. This approach to
 | 
					// and a Go collector (see NewGoCollector, in particular the note about
 | 
				
			||||||
// keep default instances as global state mirrors the approach of other packages
 | 
					// stop-the-world implication with Go versions older than 1.9) already
 | 
				
			||||||
// in the Go standard library. Note that there are caveats. Change the variables
 | 
					// registered. This approach to keep default instances as global state mirrors
 | 
				
			||||||
// with caution and only if you understand the consequences. Users who want to
 | 
					// the approach of other packages in the Go standard library. Note that there
 | 
				
			||||||
// avoid global state altogether should not use the convenience functions and
 | 
					// are caveats. Change the variables with caution and only if you understand the
 | 
				
			||||||
// act on custom instances instead.
 | 
					// consequences. Users who want to avoid global state altogether should not use
 | 
				
			||||||
 | 
					// the convenience functions and act on custom instances instead.
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
	defaultRegistry              = NewRegistry()
 | 
						defaultRegistry              = NewRegistry()
 | 
				
			||||||
	DefaultRegisterer Registerer = defaultRegistry
 | 
						DefaultRegisterer Registerer = defaultRegistry
 | 
				
			||||||
@@ -51,7 +57,7 @@ var (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
	MustRegister(NewProcessCollector(os.Getpid(), ""))
 | 
						MustRegister(NewProcessCollector(ProcessCollectorOpts{}))
 | 
				
			||||||
	MustRegister(NewGoCollector())
 | 
						MustRegister(NewGoCollector())
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -67,7 +73,8 @@ func NewRegistry() *Registry {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// NewPedanticRegistry returns a registry that checks during collection if each
 | 
					// NewPedanticRegistry returns a registry that checks during collection if each
 | 
				
			||||||
// collected Metric is consistent with its reported Desc, and if the Desc has
 | 
					// collected Metric is consistent with its reported Desc, and if the Desc has
 | 
				
			||||||
// actually been registered with the registry.
 | 
					// actually been registered with the registry. Unchecked Collectors (those whose
 | 
				
			||||||
 | 
					// Describe methed does not yield any descriptors) are excluded from the check.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Usually, a Registry will be happy as long as the union of all collected
 | 
					// Usually, a Registry will be happy as long as the union of all collected
 | 
				
			||||||
// Metrics is consistent and valid even if some metrics are not consistent with
 | 
					// Metrics is consistent and valid even if some metrics are not consistent with
 | 
				
			||||||
@@ -97,8 +104,13 @@ type Registerer interface {
 | 
				
			|||||||
	// returned error is an instance of AlreadyRegisteredError, which
 | 
						// returned error is an instance of AlreadyRegisteredError, which
 | 
				
			||||||
	// contains the previously registered Collector.
 | 
						// contains the previously registered Collector.
 | 
				
			||||||
	//
 | 
						//
 | 
				
			||||||
	// It is in general not safe to register the same Collector multiple
 | 
						// A Collector whose Describe method does not yield any Desc is treated
 | 
				
			||||||
	// times concurrently.
 | 
						// as unchecked. Registration will always succeed. No check for
 | 
				
			||||||
 | 
						// re-registering (see previous paragraph) is performed. Thus, the
 | 
				
			||||||
 | 
						// caller is responsible for not double-registering the same unchecked
 | 
				
			||||||
 | 
						// Collector, and for providing a Collector that will not cause
 | 
				
			||||||
 | 
						// inconsistent metrics on collection. (This would lead to scrape
 | 
				
			||||||
 | 
						// errors.)
 | 
				
			||||||
	Register(Collector) error
 | 
						Register(Collector) error
 | 
				
			||||||
	// MustRegister works like Register but registers any number of
 | 
						// MustRegister works like Register but registers any number of
 | 
				
			||||||
	// Collectors and panics upon the first registration that causes an
 | 
						// Collectors and panics upon the first registration that causes an
 | 
				
			||||||
@@ -107,7 +119,9 @@ type Registerer interface {
 | 
				
			|||||||
	// Unregister unregisters the Collector that equals the Collector passed
 | 
						// Unregister unregisters the Collector that equals the Collector passed
 | 
				
			||||||
	// in as an argument.  (Two Collectors are considered equal if their
 | 
						// in as an argument.  (Two Collectors are considered equal if their
 | 
				
			||||||
	// Describe method yields the same set of descriptors.) The function
 | 
						// Describe method yields the same set of descriptors.) The function
 | 
				
			||||||
	// returns whether a Collector was unregistered.
 | 
						// returns whether a Collector was unregistered. Note that an unchecked
 | 
				
			||||||
 | 
						// Collector cannot be unregistered (as its Describe method does not
 | 
				
			||||||
 | 
						// yield any descriptor).
 | 
				
			||||||
	//
 | 
						//
 | 
				
			||||||
	// Note that even after unregistering, it will not be possible to
 | 
						// Note that even after unregistering, it will not be possible to
 | 
				
			||||||
	// register a new Collector that is inconsistent with the unregistered
 | 
						// register a new Collector that is inconsistent with the unregistered
 | 
				
			||||||
@@ -125,15 +139,23 @@ type Registerer interface {
 | 
				
			|||||||
type Gatherer interface {
 | 
					type Gatherer interface {
 | 
				
			||||||
	// Gather calls the Collect method of the registered Collectors and then
 | 
						// Gather calls the Collect method of the registered Collectors and then
 | 
				
			||||||
	// gathers the collected metrics into a lexicographically sorted slice
 | 
						// gathers the collected metrics into a lexicographically sorted slice
 | 
				
			||||||
	// of MetricFamily protobufs. Even if an error occurs, Gather attempts
 | 
						// of uniquely named MetricFamily protobufs. Gather ensures that the
 | 
				
			||||||
	// to gather as many metrics as possible. Hence, if a non-nil error is
 | 
						// returned slice is valid and self-consistent so that it can be used
 | 
				
			||||||
	// returned, the returned MetricFamily slice could be nil (in case of a
 | 
						// for valid exposition. As an exception to the strict consistency
 | 
				
			||||||
	// fatal error that prevented any meaningful metric collection) or
 | 
						// requirements described for metric.Desc, Gather will tolerate
 | 
				
			||||||
	// contain a number of MetricFamily protobufs, some of which might be
 | 
						// different sets of label names for metrics of the same metric family.
 | 
				
			||||||
	// incomplete, and some might be missing altogether. The returned error
 | 
						//
 | 
				
			||||||
	// (which might be a MultiError) explains the details. In scenarios
 | 
						// Even if an error occurs, Gather attempts to gather as many metrics as
 | 
				
			||||||
	// where complete collection is critical, the returned MetricFamily
 | 
						// possible. Hence, if a non-nil error is returned, the returned
 | 
				
			||||||
	// protobufs should be disregarded if the returned error is non-nil.
 | 
						// MetricFamily slice could be nil (in case of a fatal error that
 | 
				
			||||||
 | 
						// prevented any meaningful metric collection) or contain a number of
 | 
				
			||||||
 | 
						// MetricFamily protobufs, some of which might be incomplete, and some
 | 
				
			||||||
 | 
						// might be missing altogether. The returned error (which might be a
 | 
				
			||||||
 | 
						// MultiError) explains the details. Note that this is mostly useful for
 | 
				
			||||||
 | 
						// debugging purposes. If the gathered protobufs are to be used for
 | 
				
			||||||
 | 
						// exposition in actual monitoring, it is almost always better to not
 | 
				
			||||||
 | 
						// expose an incomplete result and instead disregard the returned
 | 
				
			||||||
 | 
						// MetricFamily protobufs in case the returned error is non-nil.
 | 
				
			||||||
	Gather() ([]*dto.MetricFamily, error)
 | 
						Gather() ([]*dto.MetricFamily, error)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -234,6 +256,7 @@ type Registry struct {
 | 
				
			|||||||
	collectorsByID        map[uint64]Collector // ID is a hash of the descIDs.
 | 
						collectorsByID        map[uint64]Collector // ID is a hash of the descIDs.
 | 
				
			||||||
	descIDs               map[uint64]struct{}
 | 
						descIDs               map[uint64]struct{}
 | 
				
			||||||
	dimHashesByName       map[string]uint64
 | 
						dimHashesByName       map[string]uint64
 | 
				
			||||||
 | 
						uncheckedCollectors   []Collector
 | 
				
			||||||
	pedanticChecksEnabled bool
 | 
						pedanticChecksEnabled bool
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -251,7 +274,12 @@ func (r *Registry) Register(c Collector) error {
 | 
				
			|||||||
		close(descChan)
 | 
							close(descChan)
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
	r.mtx.Lock()
 | 
						r.mtx.Lock()
 | 
				
			||||||
	defer r.mtx.Unlock()
 | 
						defer func() {
 | 
				
			||||||
 | 
							// Drain channel in case of premature return to not leak a goroutine.
 | 
				
			||||||
 | 
							for range descChan {
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							r.mtx.Unlock()
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
	// Conduct various tests...
 | 
						// Conduct various tests...
 | 
				
			||||||
	for desc := range descChan {
 | 
						for desc := range descChan {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -291,9 +319,10 @@ func (r *Registry) Register(c Collector) error {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Did anything happen at all?
 | 
						// A Collector yielding no Desc at all is considered unchecked.
 | 
				
			||||||
	if len(newDescIDs) == 0 {
 | 
						if len(newDescIDs) == 0 {
 | 
				
			||||||
		return errors.New("collector has no descriptors")
 | 
							r.uncheckedCollectors = append(r.uncheckedCollectors, c)
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if existing, exists := r.collectorsByID[collectorID]; exists {
 | 
						if existing, exists := r.collectorsByID[collectorID]; exists {
 | 
				
			||||||
		return AlreadyRegisteredError{
 | 
							return AlreadyRegisteredError{
 | 
				
			||||||
@@ -367,20 +396,24 @@ func (r *Registry) MustRegister(cs ...Collector) {
 | 
				
			|||||||
// Gather implements Gatherer.
 | 
					// Gather implements Gatherer.
 | 
				
			||||||
func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
 | 
					func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
 | 
				
			||||||
	var (
 | 
						var (
 | 
				
			||||||
		metricChan        = make(chan Metric, capMetricChan)
 | 
							checkedMetricChan   = make(chan Metric, capMetricChan)
 | 
				
			||||||
 | 
							uncheckedMetricChan = make(chan Metric, capMetricChan)
 | 
				
			||||||
		metricHashes        = map[uint64]struct{}{}
 | 
							metricHashes        = map[uint64]struct{}{}
 | 
				
			||||||
		dimHashes         = map[string]uint64{}
 | 
					 | 
				
			||||||
		wg                  sync.WaitGroup
 | 
							wg                  sync.WaitGroup
 | 
				
			||||||
		errs                MultiError          // The collected errors to return in the end.
 | 
							errs                MultiError          // The collected errors to return in the end.
 | 
				
			||||||
		registeredDescIDs   map[uint64]struct{} // Only used for pedantic checks
 | 
							registeredDescIDs   map[uint64]struct{} // Only used for pedantic checks
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	r.mtx.RLock()
 | 
						r.mtx.RLock()
 | 
				
			||||||
	goroutineBudget := len(r.collectorsByID)
 | 
						goroutineBudget := len(r.collectorsByID) + len(r.uncheckedCollectors)
 | 
				
			||||||
	metricFamiliesByName := make(map[string]*dto.MetricFamily, len(r.dimHashesByName))
 | 
						metricFamiliesByName := make(map[string]*dto.MetricFamily, len(r.dimHashesByName))
 | 
				
			||||||
	collectors := make(chan Collector, len(r.collectorsByID))
 | 
						checkedCollectors := make(chan Collector, len(r.collectorsByID))
 | 
				
			||||||
 | 
						uncheckedCollectors := make(chan Collector, len(r.uncheckedCollectors))
 | 
				
			||||||
	for _, collector := range r.collectorsByID {
 | 
						for _, collector := range r.collectorsByID {
 | 
				
			||||||
		collectors <- collector
 | 
							checkedCollectors <- collector
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						for _, collector := range r.uncheckedCollectors {
 | 
				
			||||||
 | 
							uncheckedCollectors <- collector
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// In case pedantic checks are enabled, we have to copy the map before
 | 
						// In case pedantic checks are enabled, we have to copy the map before
 | 
				
			||||||
	// giving up the RLock.
 | 
						// giving up the RLock.
 | 
				
			||||||
@@ -397,12 +430,14 @@ func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
 | 
				
			|||||||
	collectWorker := func() {
 | 
						collectWorker := func() {
 | 
				
			||||||
		for {
 | 
							for {
 | 
				
			||||||
			select {
 | 
								select {
 | 
				
			||||||
			case collector := <-collectors:
 | 
								case collector := <-checkedCollectors:
 | 
				
			||||||
				collector.Collect(metricChan)
 | 
									collector.Collect(checkedMetricChan)
 | 
				
			||||||
				wg.Done()
 | 
								case collector := <-uncheckedCollectors:
 | 
				
			||||||
 | 
									collector.Collect(uncheckedMetricChan)
 | 
				
			||||||
			default:
 | 
								default:
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								wg.Done()
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -410,53 +445,128 @@ func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
 | 
				
			|||||||
	go collectWorker()
 | 
						go collectWorker()
 | 
				
			||||||
	goroutineBudget--
 | 
						goroutineBudget--
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Close the metricChan once all collectors are collected.
 | 
						// Close checkedMetricChan and uncheckedMetricChan once all collectors
 | 
				
			||||||
 | 
						// are collected.
 | 
				
			||||||
	go func() {
 | 
						go func() {
 | 
				
			||||||
		wg.Wait()
 | 
							wg.Wait()
 | 
				
			||||||
		close(metricChan)
 | 
							close(checkedMetricChan)
 | 
				
			||||||
 | 
							close(uncheckedMetricChan)
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Drain metricChan in case of premature return.
 | 
						// Drain checkedMetricChan and uncheckedMetricChan in case of premature return.
 | 
				
			||||||
	defer func() {
 | 
						defer func() {
 | 
				
			||||||
		for range metricChan {
 | 
							if checkedMetricChan != nil {
 | 
				
			||||||
 | 
								for range checkedMetricChan {
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if uncheckedMetricChan != nil {
 | 
				
			||||||
 | 
								for range uncheckedMetricChan {
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
collectLoop:
 | 
						// Copy the channel references so we can nil them out later to remove
 | 
				
			||||||
 | 
						// them from the select statements below.
 | 
				
			||||||
 | 
						cmc := checkedMetricChan
 | 
				
			||||||
 | 
						umc := uncheckedMetricChan
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for {
 | 
						for {
 | 
				
			||||||
		select {
 | 
							select {
 | 
				
			||||||
		case metric, ok := <-metricChan:
 | 
							case metric, ok := <-cmc:
 | 
				
			||||||
			if !ok {
 | 
								if !ok {
 | 
				
			||||||
				// metricChan is closed, we are done.
 | 
									cmc = nil
 | 
				
			||||||
				break collectLoop
 | 
									break
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			errs.Append(processMetric(
 | 
								errs.Append(processMetric(
 | 
				
			||||||
				metric, metricFamiliesByName,
 | 
									metric, metricFamiliesByName,
 | 
				
			||||||
				metricHashes, dimHashes,
 | 
									metricHashes,
 | 
				
			||||||
				registeredDescIDs,
 | 
									registeredDescIDs,
 | 
				
			||||||
			))
 | 
								))
 | 
				
			||||||
 | 
							case metric, ok := <-umc:
 | 
				
			||||||
 | 
								if !ok {
 | 
				
			||||||
 | 
									umc = nil
 | 
				
			||||||
 | 
									break
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								errs.Append(processMetric(
 | 
				
			||||||
 | 
									metric, metricFamiliesByName,
 | 
				
			||||||
 | 
									metricHashes,
 | 
				
			||||||
 | 
									nil,
 | 
				
			||||||
 | 
								))
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
			if goroutineBudget <= 0 || len(collectors) == 0 {
 | 
								if goroutineBudget <= 0 || len(checkedCollectors)+len(uncheckedCollectors) == 0 {
 | 
				
			||||||
				// All collectors are aleady being worked on or
 | 
									// All collectors are already being worked on or
 | 
				
			||||||
				// we have already as many goroutines started as
 | 
									// we have already as many goroutines started as
 | 
				
			||||||
				// there are collectors. Just process metrics
 | 
									// there are collectors. Do the same as above,
 | 
				
			||||||
				// from now on.
 | 
									// just without the default.
 | 
				
			||||||
				for metric := range metricChan {
 | 
									select {
 | 
				
			||||||
 | 
									case metric, ok := <-cmc:
 | 
				
			||||||
 | 
										if !ok {
 | 
				
			||||||
 | 
											cmc = nil
 | 
				
			||||||
 | 
											break
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
					errs.Append(processMetric(
 | 
										errs.Append(processMetric(
 | 
				
			||||||
						metric, metricFamiliesByName,
 | 
											metric, metricFamiliesByName,
 | 
				
			||||||
						metricHashes, dimHashes,
 | 
											metricHashes,
 | 
				
			||||||
						registeredDescIDs,
 | 
											registeredDescIDs,
 | 
				
			||||||
					))
 | 
										))
 | 
				
			||||||
 | 
									case metric, ok := <-umc:
 | 
				
			||||||
 | 
										if !ok {
 | 
				
			||||||
 | 
											umc = nil
 | 
				
			||||||
 | 
											break
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				break collectLoop
 | 
										errs.Append(processMetric(
 | 
				
			||||||
 | 
											metric, metricFamiliesByName,
 | 
				
			||||||
 | 
											metricHashes,
 | 
				
			||||||
 | 
											nil,
 | 
				
			||||||
 | 
										))
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									break
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			// Start more workers.
 | 
								// Start more workers.
 | 
				
			||||||
			go collectWorker()
 | 
								go collectWorker()
 | 
				
			||||||
			goroutineBudget--
 | 
								goroutineBudget--
 | 
				
			||||||
			runtime.Gosched()
 | 
								runtime.Gosched()
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							// Once both checkedMetricChan and uncheckdMetricChan are closed
 | 
				
			||||||
 | 
							// and drained, the contraption above will nil out cmc and umc,
 | 
				
			||||||
 | 
							// and then we can leave the collect loop here.
 | 
				
			||||||
 | 
							if cmc == nil && umc == nil {
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	return normalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap()
 | 
						}
 | 
				
			||||||
 | 
						return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// WriteToTextfile calls Gather on the provided Gatherer, encodes the result in the
 | 
				
			||||||
 | 
					// Prometheus text format, and writes it to a temporary file. Upon success, the
 | 
				
			||||||
 | 
					// temporary file is renamed to the provided filename.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// This is intended for use with the textfile collector of the node exporter.
 | 
				
			||||||
 | 
					// Note that the node exporter expects the filename to be suffixed with ".prom".
 | 
				
			||||||
 | 
					func WriteToTextfile(filename string, g Gatherer) error {
 | 
				
			||||||
 | 
						tmp, err := ioutil.TempFile(filepath.Dir(filename), filepath.Base(filename))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						defer os.Remove(tmp.Name())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						mfs, err := g.Gather()
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						for _, mf := range mfs {
 | 
				
			||||||
 | 
							if _, err := expfmt.MetricFamilyToText(tmp, mf); err != nil {
 | 
				
			||||||
 | 
								return err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if err := tmp.Close(); err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if err := os.Chmod(tmp.Name(), 0644); err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return os.Rename(tmp.Name(), filename)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// processMetric is an internal helper method only used by the Gather method.
 | 
					// processMetric is an internal helper method only used by the Gather method.
 | 
				
			||||||
@@ -464,16 +574,20 @@ func processMetric(
 | 
				
			|||||||
	metric Metric,
 | 
						metric Metric,
 | 
				
			||||||
	metricFamiliesByName map[string]*dto.MetricFamily,
 | 
						metricFamiliesByName map[string]*dto.MetricFamily,
 | 
				
			||||||
	metricHashes map[uint64]struct{},
 | 
						metricHashes map[uint64]struct{},
 | 
				
			||||||
	dimHashes map[string]uint64,
 | 
					 | 
				
			||||||
	registeredDescIDs map[uint64]struct{},
 | 
						registeredDescIDs map[uint64]struct{},
 | 
				
			||||||
) error {
 | 
					) error {
 | 
				
			||||||
	desc := metric.Desc()
 | 
						desc := metric.Desc()
 | 
				
			||||||
 | 
						// Wrapped metrics collected by an unchecked Collector can have an
 | 
				
			||||||
 | 
						// invalid Desc.
 | 
				
			||||||
 | 
						if desc.err != nil {
 | 
				
			||||||
 | 
							return desc.err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	dtoMetric := &dto.Metric{}
 | 
						dtoMetric := &dto.Metric{}
 | 
				
			||||||
	if err := metric.Write(dtoMetric); err != nil {
 | 
						if err := metric.Write(dtoMetric); err != nil {
 | 
				
			||||||
		return fmt.Errorf("error collecting metric %v: %s", desc, err)
 | 
							return fmt.Errorf("error collecting metric %v: %s", desc, err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	metricFamily, ok := metricFamiliesByName[desc.fqName]
 | 
						metricFamily, ok := metricFamiliesByName[desc.fqName]
 | 
				
			||||||
	if ok {
 | 
						if ok { // Existing name.
 | 
				
			||||||
		if metricFamily.GetHelp() != desc.help {
 | 
							if metricFamily.GetHelp() != desc.help {
 | 
				
			||||||
			return fmt.Errorf(
 | 
								return fmt.Errorf(
 | 
				
			||||||
				"collected metric %s %s has help %q but should have %q",
 | 
									"collected metric %s %s has help %q but should have %q",
 | 
				
			||||||
@@ -520,7 +634,7 @@ func processMetric(
 | 
				
			|||||||
		default:
 | 
							default:
 | 
				
			||||||
			panic("encountered MetricFamily with invalid type")
 | 
								panic("encountered MetricFamily with invalid type")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else { // New name.
 | 
				
			||||||
		metricFamily = &dto.MetricFamily{}
 | 
							metricFamily = &dto.MetricFamily{}
 | 
				
			||||||
		metricFamily.Name = proto.String(desc.fqName)
 | 
							metricFamily.Name = proto.String(desc.fqName)
 | 
				
			||||||
		metricFamily.Help = proto.String(desc.help)
 | 
							metricFamily.Help = proto.String(desc.help)
 | 
				
			||||||
@@ -539,9 +653,12 @@ func processMetric(
 | 
				
			|||||||
		default:
 | 
							default:
 | 
				
			||||||
			return fmt.Errorf("empty metric collected: %s", dtoMetric)
 | 
								return fmt.Errorf("empty metric collected: %s", dtoMetric)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							if err := checkSuffixCollisions(metricFamily, metricFamiliesByName); err != nil {
 | 
				
			||||||
 | 
								return err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		metricFamiliesByName[desc.fqName] = metricFamily
 | 
							metricFamiliesByName[desc.fqName] = metricFamily
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if err := checkMetricConsistency(metricFamily, dtoMetric, metricHashes, dimHashes); err != nil {
 | 
						if err := checkMetricConsistency(metricFamily, dtoMetric, metricHashes); err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if registeredDescIDs != nil {
 | 
						if registeredDescIDs != nil {
 | 
				
			||||||
@@ -563,7 +680,7 @@ func processMetric(
 | 
				
			|||||||
// Gatherers is a slice of Gatherer instances that implements the Gatherer
 | 
					// Gatherers is a slice of Gatherer instances that implements the Gatherer
 | 
				
			||||||
// interface itself. Its Gather method calls Gather on all Gatherers in the
 | 
					// interface itself. Its Gather method calls Gather on all Gatherers in the
 | 
				
			||||||
// slice in order and returns the merged results. Errors returned from the
 | 
					// slice in order and returns the merged results. Errors returned from the
 | 
				
			||||||
// Gather calles are all returned in a flattened MultiError. Duplicate and
 | 
					// Gather calls are all returned in a flattened MultiError. Duplicate and
 | 
				
			||||||
// inconsistent Metrics are skipped (first occurrence in slice order wins) and
 | 
					// inconsistent Metrics are skipped (first occurrence in slice order wins) and
 | 
				
			||||||
// reported in the returned error.
 | 
					// reported in the returned error.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
@@ -583,7 +700,6 @@ func (gs Gatherers) Gather() ([]*dto.MetricFamily, error) {
 | 
				
			|||||||
	var (
 | 
						var (
 | 
				
			||||||
		metricFamiliesByName = map[string]*dto.MetricFamily{}
 | 
							metricFamiliesByName = map[string]*dto.MetricFamily{}
 | 
				
			||||||
		metricHashes         = map[uint64]struct{}{}
 | 
							metricHashes         = map[uint64]struct{}{}
 | 
				
			||||||
		dimHashes            = map[string]uint64{}
 | 
					 | 
				
			||||||
		errs                 MultiError // The collected errors to return in the end.
 | 
							errs                 MultiError // The collected errors to return in the end.
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -620,10 +736,14 @@ func (gs Gatherers) Gather() ([]*dto.MetricFamily, error) {
 | 
				
			|||||||
				existingMF.Name = mf.Name
 | 
									existingMF.Name = mf.Name
 | 
				
			||||||
				existingMF.Help = mf.Help
 | 
									existingMF.Help = mf.Help
 | 
				
			||||||
				existingMF.Type = mf.Type
 | 
									existingMF.Type = mf.Type
 | 
				
			||||||
 | 
									if err := checkSuffixCollisions(existingMF, metricFamiliesByName); err != nil {
 | 
				
			||||||
 | 
										errs = append(errs, err)
 | 
				
			||||||
 | 
										continue
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
				metricFamiliesByName[mf.GetName()] = existingMF
 | 
									metricFamiliesByName[mf.GetName()] = existingMF
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			for _, m := range mf.Metric {
 | 
								for _, m := range mf.Metric {
 | 
				
			||||||
				if err := checkMetricConsistency(existingMF, m, metricHashes, dimHashes); err != nil {
 | 
									if err := checkMetricConsistency(existingMF, m, metricHashes); err != nil {
 | 
				
			||||||
					errs = append(errs, err)
 | 
										errs = append(errs, err)
 | 
				
			||||||
					continue
 | 
										continue
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
@@ -631,88 +751,80 @@ func (gs Gatherers) Gather() ([]*dto.MetricFamily, error) {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return normalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap()
 | 
						return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// metricSorter is a sortable slice of *dto.Metric.
 | 
					// checkSuffixCollisions checks for collisions with the “magic” suffixes the
 | 
				
			||||||
type metricSorter []*dto.Metric
 | 
					// Prometheus text format and the internal metric representation of the
 | 
				
			||||||
 | 
					// Prometheus server add while flattening Summaries and Histograms.
 | 
				
			||||||
func (s metricSorter) Len() int {
 | 
					func checkSuffixCollisions(mf *dto.MetricFamily, mfs map[string]*dto.MetricFamily) error {
 | 
				
			||||||
	return len(s)
 | 
						var (
 | 
				
			||||||
}
 | 
							newName              = mf.GetName()
 | 
				
			||||||
 | 
							newType              = mf.GetType()
 | 
				
			||||||
func (s metricSorter) Swap(i, j int) {
 | 
							newNameWithoutSuffix = ""
 | 
				
			||||||
	s[i], s[j] = s[j], s[i]
 | 
						)
 | 
				
			||||||
}
 | 
						switch {
 | 
				
			||||||
 | 
						case strings.HasSuffix(newName, "_count"):
 | 
				
			||||||
func (s metricSorter) Less(i, j int) bool {
 | 
							newNameWithoutSuffix = newName[:len(newName)-6]
 | 
				
			||||||
	if len(s[i].Label) != len(s[j].Label) {
 | 
						case strings.HasSuffix(newName, "_sum"):
 | 
				
			||||||
		// This should not happen. The metrics are
 | 
							newNameWithoutSuffix = newName[:len(newName)-4]
 | 
				
			||||||
		// inconsistent. However, we have to deal with the fact, as
 | 
						case strings.HasSuffix(newName, "_bucket"):
 | 
				
			||||||
		// people might use custom collectors or metric family injection
 | 
							newNameWithoutSuffix = newName[:len(newName)-7]
 | 
				
			||||||
		// to create inconsistent metrics. So let's simply compare the
 | 
					 | 
				
			||||||
		// number of labels in this case. That will still yield
 | 
					 | 
				
			||||||
		// reproducible sorting.
 | 
					 | 
				
			||||||
		return len(s[i].Label) < len(s[j].Label)
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for n, lp := range s[i].Label {
 | 
						if newNameWithoutSuffix != "" {
 | 
				
			||||||
		vi := lp.GetValue()
 | 
							if existingMF, ok := mfs[newNameWithoutSuffix]; ok {
 | 
				
			||||||
		vj := s[j].Label[n].GetValue()
 | 
								switch existingMF.GetType() {
 | 
				
			||||||
		if vi != vj {
 | 
								case dto.MetricType_SUMMARY:
 | 
				
			||||||
			return vi < vj
 | 
									if !strings.HasSuffix(newName, "_bucket") {
 | 
				
			||||||
 | 
										return fmt.Errorf(
 | 
				
			||||||
 | 
											"collected metric named %q collides with previously collected summary named %q",
 | 
				
			||||||
 | 
											newName, newNameWithoutSuffix,
 | 
				
			||||||
 | 
										)
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								case dto.MetricType_HISTOGRAM:
 | 
				
			||||||
 | 
									return fmt.Errorf(
 | 
				
			||||||
 | 
										"collected metric named %q collides with previously collected histogram named %q",
 | 
				
			||||||
 | 
										newName, newNameWithoutSuffix,
 | 
				
			||||||
 | 
									)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					 | 
				
			||||||
	// We should never arrive here. Multiple metrics with the same
 | 
					 | 
				
			||||||
	// label set in the same scrape will lead to undefined ingestion
 | 
					 | 
				
			||||||
	// behavior. However, as above, we have to provide stable sorting
 | 
					 | 
				
			||||||
	// here, even for inconsistent metrics. So sort equal metrics
 | 
					 | 
				
			||||||
	// by their timestamp, with missing timestamps (implying "now")
 | 
					 | 
				
			||||||
	// coming last.
 | 
					 | 
				
			||||||
	if s[i].TimestampMs == nil {
 | 
					 | 
				
			||||||
		return false
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if s[j].TimestampMs == nil {
 | 
						if newType == dto.MetricType_SUMMARY || newType == dto.MetricType_HISTOGRAM {
 | 
				
			||||||
		return true
 | 
							if _, ok := mfs[newName+"_count"]; ok {
 | 
				
			||||||
 | 
								return fmt.Errorf(
 | 
				
			||||||
 | 
									"collected histogram or summary named %q collides with previously collected metric named %q",
 | 
				
			||||||
 | 
									newName, newName+"_count",
 | 
				
			||||||
 | 
								)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	return s[i].GetTimestampMs() < s[j].GetTimestampMs()
 | 
							if _, ok := mfs[newName+"_sum"]; ok {
 | 
				
			||||||
}
 | 
								return fmt.Errorf(
 | 
				
			||||||
 | 
									"collected histogram or summary named %q collides with previously collected metric named %q",
 | 
				
			||||||
// normalizeMetricFamilies returns a MetricFamily slice with empty
 | 
									newName, newName+"_sum",
 | 
				
			||||||
// MetricFamilies pruned and the remaining MetricFamilies sorted by name within
 | 
								)
 | 
				
			||||||
// the slice, with the contained Metrics sorted within each MetricFamily.
 | 
					 | 
				
			||||||
func normalizeMetricFamilies(metricFamiliesByName map[string]*dto.MetricFamily) []*dto.MetricFamily {
 | 
					 | 
				
			||||||
	for _, mf := range metricFamiliesByName {
 | 
					 | 
				
			||||||
		sort.Sort(metricSorter(mf.Metric))
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	names := make([]string, 0, len(metricFamiliesByName))
 | 
					 | 
				
			||||||
	for name, mf := range metricFamiliesByName {
 | 
					 | 
				
			||||||
		if len(mf.Metric) > 0 {
 | 
					 | 
				
			||||||
			names = append(names, name)
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	sort.Strings(names)
 | 
						if newType == dto.MetricType_HISTOGRAM {
 | 
				
			||||||
	result := make([]*dto.MetricFamily, 0, len(names))
 | 
							if _, ok := mfs[newName+"_bucket"]; ok {
 | 
				
			||||||
	for _, name := range names {
 | 
								return fmt.Errorf(
 | 
				
			||||||
		result = append(result, metricFamiliesByName[name])
 | 
									"collected histogram named %q collides with previously collected metric named %q",
 | 
				
			||||||
 | 
									newName, newName+"_bucket",
 | 
				
			||||||
 | 
								)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	return result
 | 
						}
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// checkMetricConsistency checks if the provided Metric is consistent with the
 | 
					// checkMetricConsistency checks if the provided Metric is consistent with the
 | 
				
			||||||
// provided MetricFamily. It also hashed the Metric labels and the MetricFamily
 | 
					// provided MetricFamily. It also hashes the Metric labels and the MetricFamily
 | 
				
			||||||
// name. If the resulting hash is already in the provided metricHashes, an error
 | 
					// name. If the resulting hash is already in the provided metricHashes, an error
 | 
				
			||||||
// is returned. If not, it is added to metricHashes. The provided dimHashes maps
 | 
					// is returned. If not, it is added to metricHashes.
 | 
				
			||||||
// MetricFamily names to their dimHash (hashed sorted label names). If dimHashes
 | 
					 | 
				
			||||||
// doesn't yet contain a hash for the provided MetricFamily, it is
 | 
					 | 
				
			||||||
// added. Otherwise, an error is returned if the existing dimHashes in not equal
 | 
					 | 
				
			||||||
// the calculated dimHash.
 | 
					 | 
				
			||||||
func checkMetricConsistency(
 | 
					func checkMetricConsistency(
 | 
				
			||||||
	metricFamily *dto.MetricFamily,
 | 
						metricFamily *dto.MetricFamily,
 | 
				
			||||||
	dtoMetric *dto.Metric,
 | 
						dtoMetric *dto.Metric,
 | 
				
			||||||
	metricHashes map[uint64]struct{},
 | 
						metricHashes map[uint64]struct{},
 | 
				
			||||||
	dimHashes map[string]uint64,
 | 
					 | 
				
			||||||
) error {
 | 
					) error {
 | 
				
			||||||
 | 
						name := metricFamily.GetName()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Type consistency with metric family.
 | 
						// Type consistency with metric family.
 | 
				
			||||||
	if metricFamily.GetType() == dto.MetricType_GAUGE && dtoMetric.Gauge == nil ||
 | 
						if metricFamily.GetType() == dto.MetricType_GAUGE && dtoMetric.Gauge == nil ||
 | 
				
			||||||
		metricFamily.GetType() == dto.MetricType_COUNTER && dtoMetric.Counter == nil ||
 | 
							metricFamily.GetType() == dto.MetricType_COUNTER && dtoMetric.Counter == nil ||
 | 
				
			||||||
@@ -720,47 +832,65 @@ func checkMetricConsistency(
 | 
				
			|||||||
		metricFamily.GetType() == dto.MetricType_HISTOGRAM && dtoMetric.Histogram == nil ||
 | 
							metricFamily.GetType() == dto.MetricType_HISTOGRAM && dtoMetric.Histogram == nil ||
 | 
				
			||||||
		metricFamily.GetType() == dto.MetricType_UNTYPED && dtoMetric.Untyped == nil {
 | 
							metricFamily.GetType() == dto.MetricType_UNTYPED && dtoMetric.Untyped == nil {
 | 
				
			||||||
		return fmt.Errorf(
 | 
							return fmt.Errorf(
 | 
				
			||||||
			"collected metric %s %s is not a %s",
 | 
								"collected metric %q { %s} is not a %s",
 | 
				
			||||||
			metricFamily.GetName(), dtoMetric, metricFamily.GetType(),
 | 
								name, dtoMetric, metricFamily.GetType(),
 | 
				
			||||||
		)
 | 
							)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						previousLabelName := ""
 | 
				
			||||||
	for _, labelPair := range dtoMetric.GetLabel() {
 | 
						for _, labelPair := range dtoMetric.GetLabel() {
 | 
				
			||||||
		if !utf8.ValidString(*labelPair.Value) {
 | 
							labelName := labelPair.GetName()
 | 
				
			||||||
			return fmt.Errorf("collected metric's label %s is not utf8: %#v", *labelPair.Name, *labelPair.Value)
 | 
							if labelName == previousLabelName {
 | 
				
			||||||
 | 
								return fmt.Errorf(
 | 
				
			||||||
 | 
									"collected metric %q { %s} has two or more labels with the same name: %s",
 | 
				
			||||||
 | 
									name, dtoMetric, labelName,
 | 
				
			||||||
 | 
								)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							if !checkLabelName(labelName) {
 | 
				
			||||||
 | 
								return fmt.Errorf(
 | 
				
			||||||
 | 
									"collected metric %q { %s} has a label with an invalid name: %s",
 | 
				
			||||||
 | 
									name, dtoMetric, labelName,
 | 
				
			||||||
 | 
								)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if dtoMetric.Summary != nil && labelName == quantileLabel {
 | 
				
			||||||
 | 
								return fmt.Errorf(
 | 
				
			||||||
 | 
									"collected metric %q { %s} must not have an explicit %q label",
 | 
				
			||||||
 | 
									name, dtoMetric, quantileLabel,
 | 
				
			||||||
 | 
								)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if !utf8.ValidString(labelPair.GetValue()) {
 | 
				
			||||||
 | 
								return fmt.Errorf(
 | 
				
			||||||
 | 
									"collected metric %q { %s} has a label named %q whose value is not utf8: %#v",
 | 
				
			||||||
 | 
									name, dtoMetric, labelName, labelPair.GetValue())
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							previousLabelName = labelName
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Is the metric unique (i.e. no other metric with the same name and the same label values)?
 | 
						// Is the metric unique (i.e. no other metric with the same name and the same labels)?
 | 
				
			||||||
	h := hashNew()
 | 
						h := hashNew()
 | 
				
			||||||
	h = hashAdd(h, metricFamily.GetName())
 | 
						h = hashAdd(h, name)
 | 
				
			||||||
	h = hashAddByte(h, separatorByte)
 | 
						h = hashAddByte(h, separatorByte)
 | 
				
			||||||
	dh := hashNew()
 | 
					 | 
				
			||||||
	// Make sure label pairs are sorted. We depend on it for the consistency
 | 
						// Make sure label pairs are sorted. We depend on it for the consistency
 | 
				
			||||||
	// check.
 | 
						// check.
 | 
				
			||||||
	sort.Sort(LabelPairSorter(dtoMetric.Label))
 | 
						if !sort.IsSorted(labelPairSorter(dtoMetric.Label)) {
 | 
				
			||||||
 | 
							// We cannot sort dtoMetric.Label in place as it is immutable by contract.
 | 
				
			||||||
 | 
							copiedLabels := make([]*dto.LabelPair, len(dtoMetric.Label))
 | 
				
			||||||
 | 
							copy(copiedLabels, dtoMetric.Label)
 | 
				
			||||||
 | 
							sort.Sort(labelPairSorter(copiedLabels))
 | 
				
			||||||
 | 
							dtoMetric.Label = copiedLabels
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	for _, lp := range dtoMetric.Label {
 | 
						for _, lp := range dtoMetric.Label {
 | 
				
			||||||
 | 
							h = hashAdd(h, lp.GetName())
 | 
				
			||||||
 | 
							h = hashAddByte(h, separatorByte)
 | 
				
			||||||
		h = hashAdd(h, lp.GetValue())
 | 
							h = hashAdd(h, lp.GetValue())
 | 
				
			||||||
		h = hashAddByte(h, separatorByte)
 | 
							h = hashAddByte(h, separatorByte)
 | 
				
			||||||
		dh = hashAdd(dh, lp.GetName())
 | 
					 | 
				
			||||||
		dh = hashAddByte(dh, separatorByte)
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if _, exists := metricHashes[h]; exists {
 | 
						if _, exists := metricHashes[h]; exists {
 | 
				
			||||||
		return fmt.Errorf(
 | 
							return fmt.Errorf(
 | 
				
			||||||
			"collected metric %s %s was collected before with the same name and label values",
 | 
								"collected metric %q { %s} was collected before with the same name and label values",
 | 
				
			||||||
			metricFamily.GetName(), dtoMetric,
 | 
								name, dtoMetric,
 | 
				
			||||||
		)
 | 
							)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if dimHash, ok := dimHashes[metricFamily.GetName()]; ok {
 | 
					 | 
				
			||||||
		if dimHash != dh {
 | 
					 | 
				
			||||||
			return fmt.Errorf(
 | 
					 | 
				
			||||||
				"collected metric %s %s has label dimensions inconsistent with previously collected metrics in the same metric family",
 | 
					 | 
				
			||||||
				metricFamily.GetName(), dtoMetric,
 | 
					 | 
				
			||||||
			)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		dimHashes[metricFamily.GetName()] = dh
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	metricHashes[h] = struct{}{}
 | 
						metricHashes[h] = struct{}{}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -779,8 +909,8 @@ func checkDescConsistency(
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Is the desc consistent with the content of the metric?
 | 
						// Is the desc consistent with the content of the metric?
 | 
				
			||||||
	lpsFromDesc := make([]*dto.LabelPair, 0, len(dtoMetric.Label))
 | 
						lpsFromDesc := make([]*dto.LabelPair, len(desc.constLabelPairs), len(dtoMetric.Label))
 | 
				
			||||||
	lpsFromDesc = append(lpsFromDesc, desc.constLabelPairs...)
 | 
						copy(lpsFromDesc, desc.constLabelPairs)
 | 
				
			||||||
	for _, l := range desc.variableLabels {
 | 
						for _, l := range desc.variableLabels {
 | 
				
			||||||
		lpsFromDesc = append(lpsFromDesc, &dto.LabelPair{
 | 
							lpsFromDesc = append(lpsFromDesc, &dto.LabelPair{
 | 
				
			||||||
			Name: proto.String(l),
 | 
								Name: proto.String(l),
 | 
				
			||||||
@@ -792,7 +922,7 @@ func checkDescConsistency(
 | 
				
			|||||||
			metricFamily.GetName(), dtoMetric, desc,
 | 
								metricFamily.GetName(), dtoMetric, desc,
 | 
				
			||||||
		)
 | 
							)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	sort.Sort(LabelPairSorter(lpsFromDesc))
 | 
						sort.Sort(labelPairSorter(lpsFromDesc))
 | 
				
			||||||
	for i, lpFromDesc := range lpsFromDesc {
 | 
						for i, lpFromDesc := range lpsFromDesc {
 | 
				
			||||||
		lpFromMetric := dtoMetric.Label[i]
 | 
							lpFromMetric := dtoMetric.Label[i]
 | 
				
			||||||
		if lpFromDesc.GetName() != lpFromMetric.GetName() ||
 | 
							if lpFromDesc.GetName() != lpFromMetric.GetName() ||
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										165
									
								
								vendor/github.com/prometheus/client_golang/prometheus/summary.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										165
									
								
								vendor/github.com/prometheus/client_golang/prometheus/summary.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -16,8 +16,10 @@ package prometheus
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"math"
 | 
						"math"
 | 
				
			||||||
 | 
						"runtime"
 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
 | 
						"sync/atomic"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/beorn7/perks/quantile"
 | 
						"github.com/beorn7/perks/quantile"
 | 
				
			||||||
@@ -37,7 +39,7 @@ const quantileLabel = "quantile"
 | 
				
			|||||||
// A typical use-case is the observation of request latencies. By default, a
 | 
					// A typical use-case is the observation of request latencies. By default, a
 | 
				
			||||||
// Summary provides the median, the 90th and the 99th percentile of the latency
 | 
					// Summary provides the median, the 90th and the 99th percentile of the latency
 | 
				
			||||||
// as rank estimations. However, the default behavior will change in the
 | 
					// as rank estimations. However, the default behavior will change in the
 | 
				
			||||||
// upcoming v0.10 of the library. There will be no rank estiamtions at all by
 | 
					// upcoming v0.10 of the library. There will be no rank estimations at all by
 | 
				
			||||||
// default. For a sane transition, it is recommended to set the desired rank
 | 
					// default. For a sane transition, it is recommended to set the desired rank
 | 
				
			||||||
// estimations explicitly.
 | 
					// estimations explicitly.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
@@ -81,10 +83,10 @@ const (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// SummaryOpts bundles the options for creating a Summary metric. It is
 | 
					// SummaryOpts bundles the options for creating a Summary metric. It is
 | 
				
			||||||
// mandatory to set Name and Help to a non-empty string. While all other fields
 | 
					// mandatory to set Name to a non-empty string. While all other fields are
 | 
				
			||||||
// are optional and can safely be left at their zero value, it is recommended to
 | 
					// optional and can safely be left at their zero value, it is recommended to set
 | 
				
			||||||
// explicitly set the Objectives field to the desired value as the default value
 | 
					// a help string and to explicitly set the Objectives field to the desired value
 | 
				
			||||||
// will change in the upcoming v0.10 of the library.
 | 
					// as the default value will change in the upcoming v0.10 of the library.
 | 
				
			||||||
type SummaryOpts struct {
 | 
					type SummaryOpts struct {
 | 
				
			||||||
	// Namespace, Subsystem, and Name are components of the fully-qualified
 | 
						// Namespace, Subsystem, and Name are components of the fully-qualified
 | 
				
			||||||
	// name of the Summary (created by joining these components with
 | 
						// name of the Summary (created by joining these components with
 | 
				
			||||||
@@ -95,7 +97,7 @@ type SummaryOpts struct {
 | 
				
			|||||||
	Subsystem string
 | 
						Subsystem string
 | 
				
			||||||
	Name      string
 | 
						Name      string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Help provides information about this Summary. Mandatory!
 | 
						// Help provides information about this Summary.
 | 
				
			||||||
	//
 | 
						//
 | 
				
			||||||
	// Metrics with the same fully-qualified name must have the same Help
 | 
						// Metrics with the same fully-qualified name must have the same Help
 | 
				
			||||||
	// string.
 | 
						// string.
 | 
				
			||||||
@@ -105,6 +107,11 @@ type SummaryOpts struct {
 | 
				
			|||||||
	// with the same fully-qualified name must have the same label names in
 | 
						// with the same fully-qualified name must have the same label names in
 | 
				
			||||||
	// their ConstLabels.
 | 
						// their ConstLabels.
 | 
				
			||||||
	//
 | 
						//
 | 
				
			||||||
 | 
						// Due to the way a Summary is represented in the Prometheus text format
 | 
				
			||||||
 | 
						// and how it is handled by the Prometheus server internally, “quantile”
 | 
				
			||||||
 | 
						// is an illegal label name. Construction of a Summary or SummaryVec
 | 
				
			||||||
 | 
						// will panic if this label name is used in ConstLabels.
 | 
				
			||||||
 | 
						//
 | 
				
			||||||
	// ConstLabels are only used rarely. In particular, do not use them to
 | 
						// ConstLabels are only used rarely. In particular, do not use them to
 | 
				
			||||||
	// attach the same labels to all your metrics. Those use cases are
 | 
						// attach the same labels to all your metrics. Those use cases are
 | 
				
			||||||
	// better covered by target labels set by the scraping Prometheus
 | 
						// better covered by target labels set by the scraping Prometheus
 | 
				
			||||||
@@ -120,9 +127,10 @@ type SummaryOpts struct {
 | 
				
			|||||||
	// its zero value (i.e. nil). To create a Summary without Objectives,
 | 
						// its zero value (i.e. nil). To create a Summary without Objectives,
 | 
				
			||||||
	// set it to an empty map (i.e. map[float64]float64{}).
 | 
						// set it to an empty map (i.e. map[float64]float64{}).
 | 
				
			||||||
	//
 | 
						//
 | 
				
			||||||
	// Deprecated: Note that the current value of DefObjectives is
 | 
						// Note that the current value of DefObjectives is deprecated. It will
 | 
				
			||||||
	// deprecated. It will be replaced by an empty map in v0.10 of the
 | 
						// be replaced by an empty map in v0.10 of the library. Please
 | 
				
			||||||
	// library. Please explicitly set Objectives to the desired value.
 | 
						// explicitly set Objectives to the desired value to avoid problems
 | 
				
			||||||
 | 
						// during the transition.
 | 
				
			||||||
	Objectives map[float64]float64
 | 
						Objectives map[float64]float64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// MaxAge defines the duration for which an observation stays relevant
 | 
						// MaxAge defines the duration for which an observation stays relevant
 | 
				
			||||||
@@ -146,7 +154,7 @@ type SummaryOpts struct {
 | 
				
			|||||||
	BufCap uint32
 | 
						BufCap uint32
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Great fuck-up with the sliding-window decay algorithm... The Merge method of
 | 
					// Problem with the sliding-window decay algorithm... The Merge method of
 | 
				
			||||||
// perk/quantile is actually not working as advertised - and it might be
 | 
					// perk/quantile is actually not working as advertised - and it might be
 | 
				
			||||||
// unfixable, as the underlying algorithm is apparently not capable of merging
 | 
					// unfixable, as the underlying algorithm is apparently not capable of merging
 | 
				
			||||||
// summaries in the first place. To avoid using Merge, we are currently adding
 | 
					// summaries in the first place. To avoid using Merge, we are currently adding
 | 
				
			||||||
@@ -176,7 +184,7 @@ func NewSummary(opts SummaryOpts) Summary {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary {
 | 
					func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary {
 | 
				
			||||||
	if len(desc.variableLabels) != len(labelValues) {
 | 
						if len(desc.variableLabels) != len(labelValues) {
 | 
				
			||||||
		panic(errInconsistentCardinality)
 | 
							panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, labelValues))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, n := range desc.variableLabels {
 | 
						for _, n := range desc.variableLabels {
 | 
				
			||||||
@@ -209,6 +217,17 @@ func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary {
 | 
				
			|||||||
		opts.BufCap = DefBufCap
 | 
							opts.BufCap = DefBufCap
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if len(opts.Objectives) == 0 {
 | 
				
			||||||
 | 
							// Use the lock-free implementation of a Summary without objectives.
 | 
				
			||||||
 | 
							s := &noObjectivesSummary{
 | 
				
			||||||
 | 
								desc:       desc,
 | 
				
			||||||
 | 
								labelPairs: makeLabelPairs(desc, labelValues),
 | 
				
			||||||
 | 
								counts:     [2]*summaryCounts{&summaryCounts{}, &summaryCounts{}},
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							s.init(s) // Init self-collection.
 | 
				
			||||||
 | 
							return s
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	s := &summary{
 | 
						s := &summary{
 | 
				
			||||||
		desc: desc,
 | 
							desc: desc,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -377,6 +396,116 @@ func (s *summary) swapBufs(now time.Time) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type summaryCounts struct {
 | 
				
			||||||
 | 
						// sumBits contains the bits of the float64 representing the sum of all
 | 
				
			||||||
 | 
						// observations. sumBits and count have to go first in the struct to
 | 
				
			||||||
 | 
						// guarantee alignment for atomic operations.
 | 
				
			||||||
 | 
						// http://golang.org/pkg/sync/atomic/#pkg-note-BUG
 | 
				
			||||||
 | 
						sumBits uint64
 | 
				
			||||||
 | 
						count   uint64
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type noObjectivesSummary struct {
 | 
				
			||||||
 | 
						// countAndHotIdx enables lock-free writes with use of atomic updates.
 | 
				
			||||||
 | 
						// The most significant bit is the hot index [0 or 1] of the count field
 | 
				
			||||||
 | 
						// below. Observe calls update the hot one. All remaining bits count the
 | 
				
			||||||
 | 
						// number of Observe calls. Observe starts by incrementing this counter,
 | 
				
			||||||
 | 
						// and finish by incrementing the count field in the respective
 | 
				
			||||||
 | 
						// summaryCounts, as a marker for completion.
 | 
				
			||||||
 | 
						//
 | 
				
			||||||
 | 
						// Calls of the Write method (which are non-mutating reads from the
 | 
				
			||||||
 | 
						// perspective of the summary) swap the hot–cold under the writeMtx
 | 
				
			||||||
 | 
						// lock. A cooldown is awaited (while locked) by comparing the number of
 | 
				
			||||||
 | 
						// observations with the initiation count. Once they match, then the
 | 
				
			||||||
 | 
						// last observation on the now cool one has completed. All cool fields must
 | 
				
			||||||
 | 
						// be merged into the new hot before releasing writeMtx.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Fields with atomic access first! See alignment constraint:
 | 
				
			||||||
 | 
						// http://golang.org/pkg/sync/atomic/#pkg-note-BUG
 | 
				
			||||||
 | 
						countAndHotIdx uint64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						selfCollector
 | 
				
			||||||
 | 
						desc     *Desc
 | 
				
			||||||
 | 
						writeMtx sync.Mutex // Only used in the Write method.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Two counts, one is "hot" for lock-free observations, the other is
 | 
				
			||||||
 | 
						// "cold" for writing out a dto.Metric. It has to be an array of
 | 
				
			||||||
 | 
						// pointers to guarantee 64bit alignment of the histogramCounts, see
 | 
				
			||||||
 | 
						// http://golang.org/pkg/sync/atomic/#pkg-note-BUG.
 | 
				
			||||||
 | 
						counts [2]*summaryCounts
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						labelPairs []*dto.LabelPair
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (s *noObjectivesSummary) Desc() *Desc {
 | 
				
			||||||
 | 
						return s.desc
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (s *noObjectivesSummary) Observe(v float64) {
 | 
				
			||||||
 | 
						// We increment h.countAndHotIdx so that the counter in the lower
 | 
				
			||||||
 | 
						// 63 bits gets incremented. At the same time, we get the new value
 | 
				
			||||||
 | 
						// back, which we can use to find the currently-hot counts.
 | 
				
			||||||
 | 
						n := atomic.AddUint64(&s.countAndHotIdx, 1)
 | 
				
			||||||
 | 
						hotCounts := s.counts[n>>63]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for {
 | 
				
			||||||
 | 
							oldBits := atomic.LoadUint64(&hotCounts.sumBits)
 | 
				
			||||||
 | 
							newBits := math.Float64bits(math.Float64frombits(oldBits) + v)
 | 
				
			||||||
 | 
							if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) {
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						// Increment count last as we take it as a signal that the observation
 | 
				
			||||||
 | 
						// is complete.
 | 
				
			||||||
 | 
						atomic.AddUint64(&hotCounts.count, 1)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (s *noObjectivesSummary) Write(out *dto.Metric) error {
 | 
				
			||||||
 | 
						// For simplicity, we protect this whole method by a mutex. It is not in
 | 
				
			||||||
 | 
						// the hot path, i.e. Observe is called much more often than Write. The
 | 
				
			||||||
 | 
						// complication of making Write lock-free isn't worth it, if possible at
 | 
				
			||||||
 | 
						// all.
 | 
				
			||||||
 | 
						s.writeMtx.Lock()
 | 
				
			||||||
 | 
						defer s.writeMtx.Unlock()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Adding 1<<63 switches the hot index (from 0 to 1 or from 1 to 0)
 | 
				
			||||||
 | 
						// without touching the count bits. See the struct comments for a full
 | 
				
			||||||
 | 
						// description of the algorithm.
 | 
				
			||||||
 | 
						n := atomic.AddUint64(&s.countAndHotIdx, 1<<63)
 | 
				
			||||||
 | 
						// count is contained unchanged in the lower 63 bits.
 | 
				
			||||||
 | 
						count := n & ((1 << 63) - 1)
 | 
				
			||||||
 | 
						// The most significant bit tells us which counts is hot. The complement
 | 
				
			||||||
 | 
						// is thus the cold one.
 | 
				
			||||||
 | 
						hotCounts := s.counts[n>>63]
 | 
				
			||||||
 | 
						coldCounts := s.counts[(^n)>>63]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Await cooldown.
 | 
				
			||||||
 | 
						for count != atomic.LoadUint64(&coldCounts.count) {
 | 
				
			||||||
 | 
							runtime.Gosched() // Let observations get work done.
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						sum := &dto.Summary{
 | 
				
			||||||
 | 
							SampleCount: proto.Uint64(count),
 | 
				
			||||||
 | 
							SampleSum:   proto.Float64(math.Float64frombits(atomic.LoadUint64(&coldCounts.sumBits))),
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						out.Summary = sum
 | 
				
			||||||
 | 
						out.Label = s.labelPairs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Finally add all the cold counts to the new hot counts and reset the cold counts.
 | 
				
			||||||
 | 
						atomic.AddUint64(&hotCounts.count, count)
 | 
				
			||||||
 | 
						atomic.StoreUint64(&coldCounts.count, 0)
 | 
				
			||||||
 | 
						for {
 | 
				
			||||||
 | 
							oldBits := atomic.LoadUint64(&hotCounts.sumBits)
 | 
				
			||||||
 | 
							newBits := math.Float64bits(math.Float64frombits(oldBits) + sum.GetSampleSum())
 | 
				
			||||||
 | 
							if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) {
 | 
				
			||||||
 | 
								atomic.StoreUint64(&coldCounts.sumBits, 0)
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type quantSort []*dto.Quantile
 | 
					type quantSort []*dto.Quantile
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s quantSort) Len() int {
 | 
					func (s quantSort) Len() int {
 | 
				
			||||||
@@ -402,7 +531,16 @@ type SummaryVec struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// NewSummaryVec creates a new SummaryVec based on the provided SummaryOpts and
 | 
					// NewSummaryVec creates a new SummaryVec based on the provided SummaryOpts and
 | 
				
			||||||
// partitioned by the given label names.
 | 
					// partitioned by the given label names.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Due to the way a Summary is represented in the Prometheus text format and how
 | 
				
			||||||
 | 
					// it is handled by the Prometheus server internally, “quantile” is an illegal
 | 
				
			||||||
 | 
					// label name. NewSummaryVec will panic if this label name is used.
 | 
				
			||||||
func NewSummaryVec(opts SummaryOpts, labelNames []string) *SummaryVec {
 | 
					func NewSummaryVec(opts SummaryOpts, labelNames []string) *SummaryVec {
 | 
				
			||||||
 | 
						for _, ln := range labelNames {
 | 
				
			||||||
 | 
							if ln == quantileLabel {
 | 
				
			||||||
 | 
								panic(errQuantileLabelNotAllowed)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	desc := NewDesc(
 | 
						desc := NewDesc(
 | 
				
			||||||
		BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
 | 
							BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
 | 
				
			||||||
		opts.Help,
 | 
							opts.Help,
 | 
				
			||||||
@@ -572,7 +710,7 @@ func (s *constSummary) Write(out *dto.Metric) error {
 | 
				
			|||||||
//     map[float64]float64{0.5: 0.23, 0.99: 0.56}
 | 
					//     map[float64]float64{0.5: 0.23, 0.99: 0.56}
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// NewConstSummary returns an error if the length of labelValues is not
 | 
					// NewConstSummary returns an error if the length of labelValues is not
 | 
				
			||||||
// consistent with the variable labels in Desc.
 | 
					// consistent with the variable labels in Desc or if Desc is invalid.
 | 
				
			||||||
func NewConstSummary(
 | 
					func NewConstSummary(
 | 
				
			||||||
	desc *Desc,
 | 
						desc *Desc,
 | 
				
			||||||
	count uint64,
 | 
						count uint64,
 | 
				
			||||||
@@ -580,6 +718,9 @@ func NewConstSummary(
 | 
				
			|||||||
	quantiles map[float64]float64,
 | 
						quantiles map[float64]float64,
 | 
				
			||||||
	labelValues ...string,
 | 
						labelValues ...string,
 | 
				
			||||||
) (Metric, error) {
 | 
					) (Metric, error) {
 | 
				
			||||||
 | 
						if desc.err != nil {
 | 
				
			||||||
 | 
							return nil, desc.err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil {
 | 
						if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								vendor/github.com/prometheus/client_golang/prometheus/timer.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								vendor/github.com/prometheus/client_golang/prometheus/timer.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -39,13 +39,16 @@ func NewTimer(o Observer) *Timer {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// ObserveDuration records the duration passed since the Timer was created with
 | 
					// ObserveDuration records the duration passed since the Timer was created with
 | 
				
			||||||
// NewTimer. It calls the Observe method of the Observer provided during
 | 
					// NewTimer. It calls the Observe method of the Observer provided during
 | 
				
			||||||
// construction with the duration in seconds as an argument. ObserveDuration is
 | 
					// construction with the duration in seconds as an argument. The observed
 | 
				
			||||||
// usually called with a defer statement.
 | 
					// duration is also returned. ObserveDuration is usually called with a defer
 | 
				
			||||||
 | 
					// statement.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Note that this method is only guaranteed to never observe negative durations
 | 
					// Note that this method is only guaranteed to never observe negative durations
 | 
				
			||||||
// if used with Go1.9+.
 | 
					// if used with Go1.9+.
 | 
				
			||||||
func (t *Timer) ObserveDuration() {
 | 
					func (t *Timer) ObserveDuration() time.Duration {
 | 
				
			||||||
 | 
						d := time.Since(t.begin)
 | 
				
			||||||
	if t.observer != nil {
 | 
						if t.observer != nil {
 | 
				
			||||||
		t.observer.Observe(time.Since(t.begin).Seconds())
 | 
							t.observer.Observe(d.Seconds())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						return d
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										16
									
								
								vendor/github.com/prometheus/client_golang/prometheus/value.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								vendor/github.com/prometheus/client_golang/prometheus/value.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -17,9 +17,9 @@ import (
 | 
				
			|||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dto "github.com/prometheus/client_model/go"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	"github.com/golang/protobuf/proto"
 | 
						"github.com/golang/protobuf/proto"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						dto "github.com/prometheus/client_model/go"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ValueType is an enumeration of metric types that represent a simple value.
 | 
					// ValueType is an enumeration of metric types that represent a simple value.
 | 
				
			||||||
@@ -77,8 +77,12 @@ func (v *valueFunc) Write(out *dto.Metric) error {
 | 
				
			|||||||
// operations. However, when implementing custom Collectors, it is useful as a
 | 
					// operations. However, when implementing custom Collectors, it is useful as a
 | 
				
			||||||
// throw-away metric that is generated on the fly to send it to Prometheus in
 | 
					// throw-away metric that is generated on the fly to send it to Prometheus in
 | 
				
			||||||
// the Collect method. NewConstMetric returns an error if the length of
 | 
					// the Collect method. NewConstMetric returns an error if the length of
 | 
				
			||||||
// labelValues is not consistent with the variable labels in Desc.
 | 
					// labelValues is not consistent with the variable labels in Desc or if Desc is
 | 
				
			||||||
 | 
					// invalid.
 | 
				
			||||||
func NewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues ...string) (Metric, error) {
 | 
					func NewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues ...string) (Metric, error) {
 | 
				
			||||||
 | 
						if desc.err != nil {
 | 
				
			||||||
 | 
							return nil, desc.err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil {
 | 
						if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -152,9 +156,7 @@ func makeLabelPairs(desc *Desc, labelValues []string) []*dto.LabelPair {
 | 
				
			|||||||
			Value: proto.String(labelValues[i]),
 | 
								Value: proto.String(labelValues[i]),
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for _, lp := range desc.constLabelPairs {
 | 
						labelPairs = append(labelPairs, desc.constLabelPairs...)
 | 
				
			||||||
		labelPairs = append(labelPairs, lp)
 | 
						sort.Sort(labelPairSorter(labelPairs))
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	sort.Sort(LabelPairSorter(labelPairs))
 | 
					 | 
				
			||||||
	return labelPairs
 | 
						return labelPairs
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								vendor/github.com/prometheus/client_golang/prometheus/vec.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/prometheus/client_golang/prometheus/vec.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -277,6 +277,9 @@ func (m *metricMap) deleteByHashWithLabelValues(
 | 
				
			|||||||
func (m *metricMap) deleteByHashWithLabels(
 | 
					func (m *metricMap) deleteByHashWithLabels(
 | 
				
			||||||
	h uint64, labels Labels, curry []curriedLabelValue,
 | 
						h uint64, labels Labels, curry []curriedLabelValue,
 | 
				
			||||||
) bool {
 | 
					) bool {
 | 
				
			||||||
 | 
						m.mtx.Lock()
 | 
				
			||||||
 | 
						defer m.mtx.Unlock()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	metrics, ok := m.metrics[h]
 | 
						metrics, ok := m.metrics[h]
 | 
				
			||||||
	if !ok {
 | 
						if !ok {
 | 
				
			||||||
		return false
 | 
							return false
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										179
									
								
								vendor/github.com/prometheus/client_golang/prometheus/wrap.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										179
									
								
								vendor/github.com/prometheus/client_golang/prometheus/wrap.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,179 @@
 | 
				
			|||||||
 | 
					// Copyright 2018 The Prometheus Authors
 | 
				
			||||||
 | 
					// Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 | 
					// you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
					// You may obtain a copy of the License at
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// http://www.apache.org/licenses/LICENSE-2.0
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Unless required by applicable law or agreed to in writing, software
 | 
				
			||||||
 | 
					// distributed under the License is distributed on an "AS IS" BASIS,
 | 
				
			||||||
 | 
					// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
				
			||||||
 | 
					// See the License for the specific language governing permissions and
 | 
				
			||||||
 | 
					// limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package prometheus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"fmt"
 | 
				
			||||||
 | 
						"sort"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/golang/protobuf/proto"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						dto "github.com/prometheus/client_model/go"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// WrapRegistererWith returns a Registerer wrapping the provided
 | 
				
			||||||
 | 
					// Registerer. Collectors registered with the returned Registerer will be
 | 
				
			||||||
 | 
					// registered with the wrapped Registerer in a modified way. The modified
 | 
				
			||||||
 | 
					// Collector adds the provided Labels to all Metrics it collects (as
 | 
				
			||||||
 | 
					// ConstLabels). The Metrics collected by the unmodified Collector must not
 | 
				
			||||||
 | 
					// duplicate any of those labels.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// WrapRegistererWith provides a way to add fixed labels to a subset of
 | 
				
			||||||
 | 
					// Collectors. It should not be used to add fixed labels to all metrics exposed.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// The Collector example demonstrates a use of WrapRegistererWith.
 | 
				
			||||||
 | 
					func WrapRegistererWith(labels Labels, reg Registerer) Registerer {
 | 
				
			||||||
 | 
						return &wrappingRegisterer{
 | 
				
			||||||
 | 
							wrappedRegisterer: reg,
 | 
				
			||||||
 | 
							labels:            labels,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// WrapRegistererWithPrefix returns a Registerer wrapping the provided
 | 
				
			||||||
 | 
					// Registerer. Collectors registered with the returned Registerer will be
 | 
				
			||||||
 | 
					// registered with the wrapped Registerer in a modified way. The modified
 | 
				
			||||||
 | 
					// Collector adds the provided prefix to the name of all Metrics it collects.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// WrapRegistererWithPrefix is useful to have one place to prefix all metrics of
 | 
				
			||||||
 | 
					// a sub-system. To make this work, register metrics of the sub-system with the
 | 
				
			||||||
 | 
					// wrapping Registerer returned by WrapRegistererWithPrefix. It is rarely useful
 | 
				
			||||||
 | 
					// to use the same prefix for all metrics exposed. In particular, do not prefix
 | 
				
			||||||
 | 
					// metric names that are standardized across applications, as that would break
 | 
				
			||||||
 | 
					// horizontal monitoring, for example the metrics provided by the Go collector
 | 
				
			||||||
 | 
					// (see NewGoCollector) and the process collector (see NewProcessCollector). (In
 | 
				
			||||||
 | 
					// fact, those metrics are already prefixed with “go_” or “process_”,
 | 
				
			||||||
 | 
					// respectively.)
 | 
				
			||||||
 | 
					func WrapRegistererWithPrefix(prefix string, reg Registerer) Registerer {
 | 
				
			||||||
 | 
						return &wrappingRegisterer{
 | 
				
			||||||
 | 
							wrappedRegisterer: reg,
 | 
				
			||||||
 | 
							prefix:            prefix,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type wrappingRegisterer struct {
 | 
				
			||||||
 | 
						wrappedRegisterer Registerer
 | 
				
			||||||
 | 
						prefix            string
 | 
				
			||||||
 | 
						labels            Labels
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (r *wrappingRegisterer) Register(c Collector) error {
 | 
				
			||||||
 | 
						return r.wrappedRegisterer.Register(&wrappingCollector{
 | 
				
			||||||
 | 
							wrappedCollector: c,
 | 
				
			||||||
 | 
							prefix:           r.prefix,
 | 
				
			||||||
 | 
							labels:           r.labels,
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (r *wrappingRegisterer) MustRegister(cs ...Collector) {
 | 
				
			||||||
 | 
						for _, c := range cs {
 | 
				
			||||||
 | 
							if err := r.Register(c); err != nil {
 | 
				
			||||||
 | 
								panic(err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (r *wrappingRegisterer) Unregister(c Collector) bool {
 | 
				
			||||||
 | 
						return r.wrappedRegisterer.Unregister(&wrappingCollector{
 | 
				
			||||||
 | 
							wrappedCollector: c,
 | 
				
			||||||
 | 
							prefix:           r.prefix,
 | 
				
			||||||
 | 
							labels:           r.labels,
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type wrappingCollector struct {
 | 
				
			||||||
 | 
						wrappedCollector Collector
 | 
				
			||||||
 | 
						prefix           string
 | 
				
			||||||
 | 
						labels           Labels
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (c *wrappingCollector) Collect(ch chan<- Metric) {
 | 
				
			||||||
 | 
						wrappedCh := make(chan Metric)
 | 
				
			||||||
 | 
						go func() {
 | 
				
			||||||
 | 
							c.wrappedCollector.Collect(wrappedCh)
 | 
				
			||||||
 | 
							close(wrappedCh)
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
 | 
						for m := range wrappedCh {
 | 
				
			||||||
 | 
							ch <- &wrappingMetric{
 | 
				
			||||||
 | 
								wrappedMetric: m,
 | 
				
			||||||
 | 
								prefix:        c.prefix,
 | 
				
			||||||
 | 
								labels:        c.labels,
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (c *wrappingCollector) Describe(ch chan<- *Desc) {
 | 
				
			||||||
 | 
						wrappedCh := make(chan *Desc)
 | 
				
			||||||
 | 
						go func() {
 | 
				
			||||||
 | 
							c.wrappedCollector.Describe(wrappedCh)
 | 
				
			||||||
 | 
							close(wrappedCh)
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
 | 
						for desc := range wrappedCh {
 | 
				
			||||||
 | 
							ch <- wrapDesc(desc, c.prefix, c.labels)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type wrappingMetric struct {
 | 
				
			||||||
 | 
						wrappedMetric Metric
 | 
				
			||||||
 | 
						prefix        string
 | 
				
			||||||
 | 
						labels        Labels
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (m *wrappingMetric) Desc() *Desc {
 | 
				
			||||||
 | 
						return wrapDesc(m.wrappedMetric.Desc(), m.prefix, m.labels)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (m *wrappingMetric) Write(out *dto.Metric) error {
 | 
				
			||||||
 | 
						if err := m.wrappedMetric.Write(out); err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if len(m.labels) == 0 {
 | 
				
			||||||
 | 
							// No wrapping labels.
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						for ln, lv := range m.labels {
 | 
				
			||||||
 | 
							out.Label = append(out.Label, &dto.LabelPair{
 | 
				
			||||||
 | 
								Name:  proto.String(ln),
 | 
				
			||||||
 | 
								Value: proto.String(lv),
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						sort.Sort(labelPairSorter(out.Label))
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func wrapDesc(desc *Desc, prefix string, labels Labels) *Desc {
 | 
				
			||||||
 | 
						constLabels := Labels{}
 | 
				
			||||||
 | 
						for _, lp := range desc.constLabelPairs {
 | 
				
			||||||
 | 
							constLabels[*lp.Name] = *lp.Value
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						for ln, lv := range labels {
 | 
				
			||||||
 | 
							if _, alreadyUsed := constLabels[ln]; alreadyUsed {
 | 
				
			||||||
 | 
								return &Desc{
 | 
				
			||||||
 | 
									fqName:          desc.fqName,
 | 
				
			||||||
 | 
									help:            desc.help,
 | 
				
			||||||
 | 
									variableLabels:  desc.variableLabels,
 | 
				
			||||||
 | 
									constLabelPairs: desc.constLabelPairs,
 | 
				
			||||||
 | 
									err:             fmt.Errorf("attempted wrapping with already existing label name %q", ln),
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							constLabels[ln] = lv
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						// NewDesc will do remaining validations.
 | 
				
			||||||
 | 
						newDesc := NewDesc(prefix+desc.fqName, desc.help, desc.variableLabels, constLabels)
 | 
				
			||||||
 | 
						// Propagate errors if there was any. This will override any errer
 | 
				
			||||||
 | 
						// created by NewDesc above, i.e. earlier errors get precedence.
 | 
				
			||||||
 | 
						if desc.err != nil {
 | 
				
			||||||
 | 
							newDesc.err = desc.err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return newDesc
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										365
									
								
								vendor/github.com/prometheus/common/expfmt/text_create.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										365
									
								
								vendor/github.com/prometheus/common/expfmt/text_create.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -14,13 +14,45 @@
 | 
				
			|||||||
package expfmt
 | 
					package expfmt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"bytes"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"math"
 | 
						"math"
 | 
				
			||||||
 | 
						"strconv"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
						"sync"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/prometheus/common/model"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dto "github.com/prometheus/client_model/go"
 | 
						dto "github.com/prometheus/client_model/go"
 | 
				
			||||||
	"github.com/prometheus/common/model"
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// enhancedWriter has all the enhanced write functions needed here. bytes.Buffer
 | 
				
			||||||
 | 
					// implements it.
 | 
				
			||||||
 | 
					type enhancedWriter interface {
 | 
				
			||||||
 | 
						io.Writer
 | 
				
			||||||
 | 
						WriteRune(r rune) (n int, err error)
 | 
				
			||||||
 | 
						WriteString(s string) (n int, err error)
 | 
				
			||||||
 | 
						WriteByte(c byte) error
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const (
 | 
				
			||||||
 | 
						initialBufSize    = 512
 | 
				
			||||||
 | 
						initialNumBufSize = 24
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var (
 | 
				
			||||||
 | 
						bufPool = sync.Pool{
 | 
				
			||||||
 | 
							New: func() interface{} {
 | 
				
			||||||
 | 
								return bytes.NewBuffer(make([]byte, 0, initialBufSize))
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						numBufPool = sync.Pool{
 | 
				
			||||||
 | 
							New: func() interface{} {
 | 
				
			||||||
 | 
								b := make([]byte, 0, initialNumBufSize)
 | 
				
			||||||
 | 
								return &b
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// MetricFamilyToText converts a MetricFamily proto message into text format and
 | 
					// MetricFamilyToText converts a MetricFamily proto message into text format and
 | 
				
			||||||
@@ -32,37 +64,92 @@ import (
 | 
				
			|||||||
// will result in invalid text format output.
 | 
					// will result in invalid text format output.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// This method fulfills the type 'prometheus.encoder'.
 | 
					// This method fulfills the type 'prometheus.encoder'.
 | 
				
			||||||
func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
 | 
					func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err error) {
 | 
				
			||||||
	var written int
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Fail-fast checks.
 | 
						// Fail-fast checks.
 | 
				
			||||||
	if len(in.Metric) == 0 {
 | 
						if len(in.Metric) == 0 {
 | 
				
			||||||
		return written, fmt.Errorf("MetricFamily has no metrics: %s", in)
 | 
							return 0, fmt.Errorf("MetricFamily has no metrics: %s", in)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	name := in.GetName()
 | 
						name := in.GetName()
 | 
				
			||||||
	if name == "" {
 | 
						if name == "" {
 | 
				
			||||||
		return written, fmt.Errorf("MetricFamily has no name: %s", in)
 | 
							return 0, fmt.Errorf("MetricFamily has no name: %s", in)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Try the interface upgrade. If it doesn't work, we'll use a
 | 
				
			||||||
 | 
						// bytes.Buffer from the sync.Pool and write out its content to out in a
 | 
				
			||||||
 | 
						// single go in the end.
 | 
				
			||||||
 | 
						w, ok := out.(enhancedWriter)
 | 
				
			||||||
 | 
						if !ok {
 | 
				
			||||||
 | 
							b := bufPool.Get().(*bytes.Buffer)
 | 
				
			||||||
 | 
							b.Reset()
 | 
				
			||||||
 | 
							w = b
 | 
				
			||||||
 | 
							defer func() {
 | 
				
			||||||
 | 
								bWritten, bErr := out.Write(b.Bytes())
 | 
				
			||||||
 | 
								written = bWritten
 | 
				
			||||||
 | 
								if err == nil {
 | 
				
			||||||
 | 
									err = bErr
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								bufPool.Put(b)
 | 
				
			||||||
 | 
							}()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var n int
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Comments, first HELP, then TYPE.
 | 
						// Comments, first HELP, then TYPE.
 | 
				
			||||||
	if in.Help != nil {
 | 
						if in.Help != nil {
 | 
				
			||||||
		n, err := fmt.Fprintf(
 | 
							n, err = w.WriteString("# HELP ")
 | 
				
			||||||
			out, "# HELP %s %s\n",
 | 
					 | 
				
			||||||
			name, escapeString(*in.Help, false),
 | 
					 | 
				
			||||||
		)
 | 
					 | 
				
			||||||
		written += n
 | 
							written += n
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return written, err
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							n, err = w.WriteString(name)
 | 
				
			||||||
 | 
							written += n
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							err = w.WriteByte(' ')
 | 
				
			||||||
 | 
							written++
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							n, err = writeEscapedString(w, *in.Help, false)
 | 
				
			||||||
 | 
							written += n
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							err = w.WriteByte('\n')
 | 
				
			||||||
 | 
							written++
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						n, err = w.WriteString("# TYPE ")
 | 
				
			||||||
 | 
						written += n
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						n, err = w.WriteString(name)
 | 
				
			||||||
 | 
						written += n
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	metricType := in.GetType()
 | 
						metricType := in.GetType()
 | 
				
			||||||
	n, err := fmt.Fprintf(
 | 
						switch metricType {
 | 
				
			||||||
		out, "# TYPE %s %s\n",
 | 
						case dto.MetricType_COUNTER:
 | 
				
			||||||
		name, strings.ToLower(metricType.String()),
 | 
							n, err = w.WriteString(" counter\n")
 | 
				
			||||||
	)
 | 
						case dto.MetricType_GAUGE:
 | 
				
			||||||
 | 
							n, err = w.WriteString(" gauge\n")
 | 
				
			||||||
 | 
						case dto.MetricType_SUMMARY:
 | 
				
			||||||
 | 
							n, err = w.WriteString(" summary\n")
 | 
				
			||||||
 | 
						case dto.MetricType_UNTYPED:
 | 
				
			||||||
 | 
							n, err = w.WriteString(" untyped\n")
 | 
				
			||||||
 | 
						case dto.MetricType_HISTOGRAM:
 | 
				
			||||||
 | 
							n, err = w.WriteString(" histogram\n")
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							return written, fmt.Errorf("unknown metric type %s", metricType.String())
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	written += n
 | 
						written += n
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return written, err
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Finally the samples, one line for each.
 | 
						// Finally the samples, one line for each.
 | 
				
			||||||
@@ -75,9 +162,8 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
 | 
				
			|||||||
				)
 | 
									)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			n, err = writeSample(
 | 
								n, err = writeSample(
 | 
				
			||||||
				name, metric, "", "",
 | 
									w, name, "", metric, "", 0,
 | 
				
			||||||
				metric.Counter.GetValue(),
 | 
									metric.Counter.GetValue(),
 | 
				
			||||||
				out,
 | 
					 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
		case dto.MetricType_GAUGE:
 | 
							case dto.MetricType_GAUGE:
 | 
				
			||||||
			if metric.Gauge == nil {
 | 
								if metric.Gauge == nil {
 | 
				
			||||||
@@ -86,9 +172,8 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
 | 
				
			|||||||
				)
 | 
									)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			n, err = writeSample(
 | 
								n, err = writeSample(
 | 
				
			||||||
				name, metric, "", "",
 | 
									w, name, "", metric, "", 0,
 | 
				
			||||||
				metric.Gauge.GetValue(),
 | 
									metric.Gauge.GetValue(),
 | 
				
			||||||
				out,
 | 
					 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
		case dto.MetricType_UNTYPED:
 | 
							case dto.MetricType_UNTYPED:
 | 
				
			||||||
			if metric.Untyped == nil {
 | 
								if metric.Untyped == nil {
 | 
				
			||||||
@@ -97,9 +182,8 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
 | 
				
			|||||||
				)
 | 
									)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			n, err = writeSample(
 | 
								n, err = writeSample(
 | 
				
			||||||
				name, metric, "", "",
 | 
									w, name, "", metric, "", 0,
 | 
				
			||||||
				metric.Untyped.GetValue(),
 | 
									metric.Untyped.GetValue(),
 | 
				
			||||||
				out,
 | 
					 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
		case dto.MetricType_SUMMARY:
 | 
							case dto.MetricType_SUMMARY:
 | 
				
			||||||
			if metric.Summary == nil {
 | 
								if metric.Summary == nil {
 | 
				
			||||||
@@ -109,29 +193,26 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			for _, q := range metric.Summary.Quantile {
 | 
								for _, q := range metric.Summary.Quantile {
 | 
				
			||||||
				n, err = writeSample(
 | 
									n, err = writeSample(
 | 
				
			||||||
					name, metric,
 | 
										w, name, "", metric,
 | 
				
			||||||
					model.QuantileLabel, fmt.Sprint(q.GetQuantile()),
 | 
										model.QuantileLabel, q.GetQuantile(),
 | 
				
			||||||
					q.GetValue(),
 | 
										q.GetValue(),
 | 
				
			||||||
					out,
 | 
					 | 
				
			||||||
				)
 | 
									)
 | 
				
			||||||
				written += n
 | 
									written += n
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
					return written, err
 | 
										return
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			n, err = writeSample(
 | 
								n, err = writeSample(
 | 
				
			||||||
				name+"_sum", metric, "", "",
 | 
									w, name, "_sum", metric, "", 0,
 | 
				
			||||||
				metric.Summary.GetSampleSum(),
 | 
									metric.Summary.GetSampleSum(),
 | 
				
			||||||
				out,
 | 
					 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
			if err != nil {
 | 
					 | 
				
			||||||
				return written, err
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			written += n
 | 
								written += n
 | 
				
			||||||
 | 
								if err != nil {
 | 
				
			||||||
 | 
									return
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			n, err = writeSample(
 | 
								n, err = writeSample(
 | 
				
			||||||
				name+"_count", metric, "", "",
 | 
									w, name, "_count", metric, "", 0,
 | 
				
			||||||
				float64(metric.Summary.GetSampleCount()),
 | 
									float64(metric.Summary.GetSampleCount()),
 | 
				
			||||||
				out,
 | 
					 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
		case dto.MetricType_HISTOGRAM:
 | 
							case dto.MetricType_HISTOGRAM:
 | 
				
			||||||
			if metric.Histogram == nil {
 | 
								if metric.Histogram == nil {
 | 
				
			||||||
@@ -140,46 +221,42 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
 | 
				
			|||||||
				)
 | 
									)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			infSeen := false
 | 
								infSeen := false
 | 
				
			||||||
			for _, q := range metric.Histogram.Bucket {
 | 
								for _, b := range metric.Histogram.Bucket {
 | 
				
			||||||
				n, err = writeSample(
 | 
									n, err = writeSample(
 | 
				
			||||||
					name+"_bucket", metric,
 | 
										w, name, "_bucket", metric,
 | 
				
			||||||
					model.BucketLabel, fmt.Sprint(q.GetUpperBound()),
 | 
										model.BucketLabel, b.GetUpperBound(),
 | 
				
			||||||
					float64(q.GetCumulativeCount()),
 | 
										float64(b.GetCumulativeCount()),
 | 
				
			||||||
					out,
 | 
					 | 
				
			||||||
				)
 | 
									)
 | 
				
			||||||
				written += n
 | 
									written += n
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
					return written, err
 | 
										return
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				if math.IsInf(q.GetUpperBound(), +1) {
 | 
									if math.IsInf(b.GetUpperBound(), +1) {
 | 
				
			||||||
					infSeen = true
 | 
										infSeen = true
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if !infSeen {
 | 
								if !infSeen {
 | 
				
			||||||
				n, err = writeSample(
 | 
									n, err = writeSample(
 | 
				
			||||||
					name+"_bucket", metric,
 | 
										w, name, "_bucket", metric,
 | 
				
			||||||
					model.BucketLabel, "+Inf",
 | 
										model.BucketLabel, math.Inf(+1),
 | 
				
			||||||
					float64(metric.Histogram.GetSampleCount()),
 | 
										float64(metric.Histogram.GetSampleCount()),
 | 
				
			||||||
					out,
 | 
					 | 
				
			||||||
				)
 | 
									)
 | 
				
			||||||
				if err != nil {
 | 
					 | 
				
			||||||
					return written, err
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				written += n
 | 
									written += n
 | 
				
			||||||
 | 
									if err != nil {
 | 
				
			||||||
 | 
										return
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			n, err = writeSample(
 | 
								n, err = writeSample(
 | 
				
			||||||
				name+"_sum", metric, "", "",
 | 
									w, name, "_sum", metric, "", 0,
 | 
				
			||||||
				metric.Histogram.GetSampleSum(),
 | 
									metric.Histogram.GetSampleSum(),
 | 
				
			||||||
				out,
 | 
					 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
			if err != nil {
 | 
					 | 
				
			||||||
				return written, err
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			written += n
 | 
								written += n
 | 
				
			||||||
 | 
								if err != nil {
 | 
				
			||||||
 | 
									return
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			n, err = writeSample(
 | 
								n, err = writeSample(
 | 
				
			||||||
				name+"_count", metric, "", "",
 | 
									w, name, "_count", metric, "", 0,
 | 
				
			||||||
				float64(metric.Histogram.GetSampleCount()),
 | 
									float64(metric.Histogram.GetSampleCount()),
 | 
				
			||||||
				out,
 | 
					 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
			return written, fmt.Errorf(
 | 
								return written, fmt.Errorf(
 | 
				
			||||||
@@ -188,116 +265,204 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		written += n
 | 
							written += n
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return written, err
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return written, nil
 | 
						return
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// writeSample writes a single sample in text format to out, given the metric
 | 
					// writeSample writes a single sample in text format to w, given the metric
 | 
				
			||||||
// name, the metric proto message itself, optionally an additional label name
 | 
					// name, the metric proto message itself, optionally an additional label name
 | 
				
			||||||
// and value (use empty strings if not required), and the value. The function
 | 
					// with a float64 value (use empty string as label name if not required), and
 | 
				
			||||||
// returns the number of bytes written and any error encountered.
 | 
					// the value. The function returns the number of bytes written and any error
 | 
				
			||||||
 | 
					// encountered.
 | 
				
			||||||
func writeSample(
 | 
					func writeSample(
 | 
				
			||||||
	name string,
 | 
						w enhancedWriter,
 | 
				
			||||||
 | 
						name, suffix string,
 | 
				
			||||||
	metric *dto.Metric,
 | 
						metric *dto.Metric,
 | 
				
			||||||
	additionalLabelName, additionalLabelValue string,
 | 
						additionalLabelName string, additionalLabelValue float64,
 | 
				
			||||||
	value float64,
 | 
						value float64,
 | 
				
			||||||
	out io.Writer,
 | 
					 | 
				
			||||||
) (int, error) {
 | 
					) (int, error) {
 | 
				
			||||||
	var written int
 | 
						var written int
 | 
				
			||||||
	n, err := fmt.Fprint(out, name)
 | 
						n, err := w.WriteString(name)
 | 
				
			||||||
	written += n
 | 
						written += n
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return written, err
 | 
							return written, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	n, err = labelPairsToText(
 | 
						if suffix != "" {
 | 
				
			||||||
		metric.Label,
 | 
							n, err = w.WriteString(suffix)
 | 
				
			||||||
		additionalLabelName, additionalLabelValue,
 | 
							written += n
 | 
				
			||||||
		out,
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return written, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						n, err = writeLabelPairs(
 | 
				
			||||||
 | 
							w, metric.Label, additionalLabelName, additionalLabelValue,
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
	written += n
 | 
						written += n
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return written, err
 | 
							return written, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	n, err = fmt.Fprintf(out, " %v", value)
 | 
						err = w.WriteByte(' ')
 | 
				
			||||||
 | 
						written++
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return written, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						n, err = writeFloat(w, value)
 | 
				
			||||||
	written += n
 | 
						written += n
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return written, err
 | 
							return written, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if metric.TimestampMs != nil {
 | 
						if metric.TimestampMs != nil {
 | 
				
			||||||
		n, err = fmt.Fprintf(out, " %v", *metric.TimestampMs)
 | 
							err = w.WriteByte(' ')
 | 
				
			||||||
 | 
							written++
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return written, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							n, err = writeInt(w, *metric.TimestampMs)
 | 
				
			||||||
		written += n
 | 
							written += n
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return written, err
 | 
								return written, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	n, err = out.Write([]byte{'\n'})
 | 
						err = w.WriteByte('\n')
 | 
				
			||||||
	written += n
 | 
						written++
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return written, err
 | 
							return written, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return written, nil
 | 
						return written, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// labelPairsToText converts a slice of LabelPair proto messages plus the
 | 
					// writeLabelPairs converts a slice of LabelPair proto messages plus the
 | 
				
			||||||
// explicitly given additional label pair into text formatted as required by the
 | 
					// explicitly given additional label pair into text formatted as required by the
 | 
				
			||||||
// text format and writes it to 'out'. An empty slice in combination with an
 | 
					// text format and writes it to 'w'. An empty slice in combination with an empty
 | 
				
			||||||
// empty string 'additionalLabelName' results in nothing being
 | 
					// string 'additionalLabelName' results in nothing being written. Otherwise, the
 | 
				
			||||||
// written. Otherwise, the label pairs are written, escaped as required by the
 | 
					// label pairs are written, escaped as required by the text format, and enclosed
 | 
				
			||||||
// text format, and enclosed in '{...}'. The function returns the number of
 | 
					// in '{...}'. The function returns the number of bytes written and any error
 | 
				
			||||||
// bytes written and any error encountered.
 | 
					// encountered.
 | 
				
			||||||
func labelPairsToText(
 | 
					func writeLabelPairs(
 | 
				
			||||||
 | 
						w enhancedWriter,
 | 
				
			||||||
	in []*dto.LabelPair,
 | 
						in []*dto.LabelPair,
 | 
				
			||||||
	additionalLabelName, additionalLabelValue string,
 | 
						additionalLabelName string, additionalLabelValue float64,
 | 
				
			||||||
	out io.Writer,
 | 
					 | 
				
			||||||
) (int, error) {
 | 
					) (int, error) {
 | 
				
			||||||
	if len(in) == 0 && additionalLabelName == "" {
 | 
						if len(in) == 0 && additionalLabelName == "" {
 | 
				
			||||||
		return 0, nil
 | 
							return 0, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	var written int
 | 
						var (
 | 
				
			||||||
	separator := '{'
 | 
							written   int
 | 
				
			||||||
	for _, lp := range in {
 | 
							separator byte = '{'
 | 
				
			||||||
		n, err := fmt.Fprintf(
 | 
					 | 
				
			||||||
			out, `%c%s="%s"`,
 | 
					 | 
				
			||||||
			separator, lp.GetName(), escapeString(lp.GetValue(), true),
 | 
					 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
 | 
						for _, lp := range in {
 | 
				
			||||||
 | 
							err := w.WriteByte(separator)
 | 
				
			||||||
 | 
							written++
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return written, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							n, err := w.WriteString(lp.GetName())
 | 
				
			||||||
		written += n
 | 
							written += n
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return written, err
 | 
								return written, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							n, err = w.WriteString(`="`)
 | 
				
			||||||
 | 
							written += n
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return written, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							n, err = writeEscapedString(w, lp.GetValue(), true)
 | 
				
			||||||
 | 
							written += n
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return written, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							err = w.WriteByte('"')
 | 
				
			||||||
 | 
							written++
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return written, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		separator = ','
 | 
							separator = ','
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if additionalLabelName != "" {
 | 
						if additionalLabelName != "" {
 | 
				
			||||||
		n, err := fmt.Fprintf(
 | 
							err := w.WriteByte(separator)
 | 
				
			||||||
			out, `%c%s="%s"`,
 | 
							written++
 | 
				
			||||||
			separator, additionalLabelName,
 | 
							if err != nil {
 | 
				
			||||||
			escapeString(additionalLabelValue, true),
 | 
								return written, err
 | 
				
			||||||
		)
 | 
							}
 | 
				
			||||||
 | 
							n, err := w.WriteString(additionalLabelName)
 | 
				
			||||||
		written += n
 | 
							written += n
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return written, err
 | 
								return written, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
							n, err = w.WriteString(`="`)
 | 
				
			||||||
	n, err := out.Write([]byte{'}'})
 | 
					 | 
				
			||||||
		written += n
 | 
							written += n
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return written, err
 | 
								return written, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							n, err = writeFloat(w, additionalLabelValue)
 | 
				
			||||||
 | 
							written += n
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return written, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							err = w.WriteByte('"')
 | 
				
			||||||
 | 
							written++
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return written, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						err := w.WriteByte('}')
 | 
				
			||||||
 | 
						written++
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return written, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return written, nil
 | 
						return written, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// writeEscapedString replaces '\' by '\\', new line character by '\n', and - if
 | 
				
			||||||
 | 
					// includeDoubleQuote is true - '"' by '\"'.
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
	escape                = strings.NewReplacer("\\", `\\`, "\n", `\n`)
 | 
						escaper       = strings.NewReplacer("\\", `\\`, "\n", `\n`)
 | 
				
			||||||
	escapeWithDoubleQuote = strings.NewReplacer("\\", `\\`, "\n", `\n`, "\"", `\"`)
 | 
						quotedEscaper = strings.NewReplacer("\\", `\\`, "\n", `\n`, "\"", `\"`)
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// escapeString replaces '\' by '\\', new line character by '\n', and - if
 | 
					func writeEscapedString(w enhancedWriter, v string, includeDoubleQuote bool) (int, error) {
 | 
				
			||||||
// includeDoubleQuote is true - '"' by '\"'.
 | 
					 | 
				
			||||||
func escapeString(v string, includeDoubleQuote bool) string {
 | 
					 | 
				
			||||||
	if includeDoubleQuote {
 | 
						if includeDoubleQuote {
 | 
				
			||||||
		return escapeWithDoubleQuote.Replace(v)
 | 
							return quotedEscaper.WriteString(w, v)
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							return escaper.WriteString(w, v)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
	return escape.Replace(v)
 | 
					
 | 
				
			||||||
 | 
					// writeFloat is equivalent to fmt.Fprint with a float64 argument but hardcodes
 | 
				
			||||||
 | 
					// a few common cases for increased efficiency. For non-hardcoded cases, it uses
 | 
				
			||||||
 | 
					// strconv.AppendFloat to avoid allocations, similar to writeInt.
 | 
				
			||||||
 | 
					func writeFloat(w enhancedWriter, f float64) (int, error) {
 | 
				
			||||||
 | 
						switch {
 | 
				
			||||||
 | 
						case f == 1:
 | 
				
			||||||
 | 
							return 1, w.WriteByte('1')
 | 
				
			||||||
 | 
						case f == 0:
 | 
				
			||||||
 | 
							return 1, w.WriteByte('0')
 | 
				
			||||||
 | 
						case f == -1:
 | 
				
			||||||
 | 
							return w.WriteString("-1")
 | 
				
			||||||
 | 
						case math.IsNaN(f):
 | 
				
			||||||
 | 
							return w.WriteString("NaN")
 | 
				
			||||||
 | 
						case math.IsInf(f, +1):
 | 
				
			||||||
 | 
							return w.WriteString("+Inf")
 | 
				
			||||||
 | 
						case math.IsInf(f, -1):
 | 
				
			||||||
 | 
							return w.WriteString("-Inf")
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							bp := numBufPool.Get().(*[]byte)
 | 
				
			||||||
 | 
							*bp = strconv.AppendFloat((*bp)[:0], f, 'g', -1, 64)
 | 
				
			||||||
 | 
							written, err := w.Write(*bp)
 | 
				
			||||||
 | 
							numBufPool.Put(bp)
 | 
				
			||||||
 | 
							return written, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// writeInt is equivalent to fmt.Fprint with an int64 argument but uses
 | 
				
			||||||
 | 
					// strconv.AppendInt with a byte slice taken from a sync.Pool to avoid
 | 
				
			||||||
 | 
					// allocations.
 | 
				
			||||||
 | 
					func writeInt(w enhancedWriter, i int64) (int, error) {
 | 
				
			||||||
 | 
						bp := numBufPool.Get().(*[]byte)
 | 
				
			||||||
 | 
						*bp = strconv.AppendInt((*bp)[:0], i, 10)
 | 
				
			||||||
 | 
						written, err := w.Write(*bp)
 | 
				
			||||||
 | 
						numBufPool.Put(bp)
 | 
				
			||||||
 | 
						return written, err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								vendor/github.com/prometheus/common/expfmt/text_parse.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/prometheus/common/expfmt/text_parse.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -359,7 +359,7 @@ func (p *TextParser) startLabelValue() stateFn {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		return p.readingValue
 | 
							return p.readingValue
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		p.parseError(fmt.Sprintf("unexpected end of label value %q", p.currentLabelPair.Value))
 | 
							p.parseError(fmt.Sprintf("unexpected end of label value %q", p.currentLabelPair.GetValue()))
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,12 +1,12 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 | 
					Copyright (c) 2011, Open Knowledge Foundation Ltd.
 | 
				
			||||||
 | 
					All rights reserved.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HTTP Content-Type Autonegotiation.
 | 
					HTTP Content-Type Autonegotiation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The functions in this package implement the behaviour specified in
 | 
					The functions in this package implement the behaviour specified in
 | 
				
			||||||
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
 | 
					http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Copyright (c) 2011, Open Knowledge Foundation Ltd.
 | 
					 | 
				
			||||||
All rights reserved.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Redistribution and use in source and binary forms, with or without
 | 
					Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
modification, are permitted provided that the following conditions are
 | 
					modification, are permitted provided that the following conditions are
 | 
				
			||||||
met:
 | 
					met:
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								vendor/github.com/prometheus/common/model/metric.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/prometheus/common/model/metric.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -21,7 +21,6 @@ import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
	separator = []byte{0}
 | 
					 | 
				
			||||||
	// MetricNameRE is a regular expression matching valid metric
 | 
						// MetricNameRE is a regular expression matching valid metric
 | 
				
			||||||
	// names. Note that the IsValidMetricName function performs the same
 | 
						// names. Note that the IsValidMetricName function performs the same
 | 
				
			||||||
	// check but faster than a match with this regular expression.
 | 
						// check but faster than a match with this regular expression.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								vendor/github.com/prometheus/common/model/time.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/prometheus/common/model/time.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -43,7 +43,7 @@ const (
 | 
				
			|||||||
// (1970-01-01 00:00 UTC) excluding leap seconds.
 | 
					// (1970-01-01 00:00 UTC) excluding leap seconds.
 | 
				
			||||||
type Time int64
 | 
					type Time int64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Interval describes and interval between two timestamps.
 | 
					// Interval describes an interval between two timestamps.
 | 
				
			||||||
type Interval struct {
 | 
					type Interval struct {
 | 
				
			||||||
	Start, End Time
 | 
						Start, End Time
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										40
									
								
								vendor/github.com/sirupsen/logrus/.golangci.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								vendor/github.com/sirupsen/logrus/.golangci.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					run:
 | 
				
			||||||
 | 
					  # do not run on test files yet
 | 
				
			||||||
 | 
					  tests: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# all available settings of specific linters
 | 
				
			||||||
 | 
					linters-settings:
 | 
				
			||||||
 | 
					  errcheck:
 | 
				
			||||||
 | 
					    # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
 | 
				
			||||||
 | 
					    # default is false: such cases aren't reported by default.
 | 
				
			||||||
 | 
					    check-type-assertions: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
 | 
				
			||||||
 | 
					    # default is false: such cases aren't reported by default.
 | 
				
			||||||
 | 
					    check-blank: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  lll:
 | 
				
			||||||
 | 
					    line-length: 100
 | 
				
			||||||
 | 
					    tab-width: 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  prealloc:
 | 
				
			||||||
 | 
					    simple: false
 | 
				
			||||||
 | 
					    range-loops: false
 | 
				
			||||||
 | 
					    for-loops: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  whitespace:
 | 
				
			||||||
 | 
					    multi-if: false   # Enforces newlines (or comments) after every multi-line if statement
 | 
				
			||||||
 | 
					    multi-func: false # Enforces newlines (or comments) after every multi-line function signature
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					linters:
 | 
				
			||||||
 | 
					  enable:
 | 
				
			||||||
 | 
					    - megacheck
 | 
				
			||||||
 | 
					    - govet
 | 
				
			||||||
 | 
					  disable:
 | 
				
			||||||
 | 
					    - maligned
 | 
				
			||||||
 | 
					    - prealloc
 | 
				
			||||||
 | 
					  disable-all: false
 | 
				
			||||||
 | 
					  presets:
 | 
				
			||||||
 | 
					    - bugs
 | 
				
			||||||
 | 
					    - unused
 | 
				
			||||||
 | 
					  fast: false
 | 
				
			||||||
							
								
								
									
										14
									
								
								vendor/github.com/sirupsen/logrus/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/sirupsen/logrus/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -4,21 +4,13 @@ git:
 | 
				
			|||||||
  depth: 1
 | 
					  depth: 1
 | 
				
			||||||
env:
 | 
					env:
 | 
				
			||||||
  - GO111MODULE=on
 | 
					  - GO111MODULE=on
 | 
				
			||||||
  - GO111MODULE=off
 | 
					go: [1.13.x, 1.14.x]
 | 
				
			||||||
go: [ 1.11.x, 1.12.x ]
 | 
					os: [linux, osx]
 | 
				
			||||||
os: [ linux, osx ]
 | 
					 | 
				
			||||||
matrix:
 | 
					 | 
				
			||||||
  exclude:
 | 
					 | 
				
			||||||
    - go: 1.12.x
 | 
					 | 
				
			||||||
      env: GO111MODULE=off
 | 
					 | 
				
			||||||
    - go: 1.11.x
 | 
					 | 
				
			||||||
      os: osx
 | 
					 | 
				
			||||||
install:
 | 
					install:
 | 
				
			||||||
  - ./travis/install.sh
 | 
					  - ./travis/install.sh
 | 
				
			||||||
  - if [[ "$GO111MODULE" ==  "on" ]]; then go mod download; fi
 | 
					 | 
				
			||||||
  - if [[ "$GO111MODULE" == "off" ]]; then go get github.com/stretchr/testify/assert golang.org/x/sys/unix github.com/konsorten/go-windows-terminal-sequences; fi
 | 
					 | 
				
			||||||
script:
 | 
					script:
 | 
				
			||||||
  - ./travis/cross_build.sh
 | 
					  - ./travis/cross_build.sh
 | 
				
			||||||
 | 
					  - ./travis/lint.sh
 | 
				
			||||||
  - export GOMAXPROCS=4
 | 
					  - export GOMAXPROCS=4
 | 
				
			||||||
  - export GORACE=halt_on_error=1
 | 
					  - export GORACE=halt_on_error=1
 | 
				
			||||||
  - go test -race -v ./...
 | 
					  - go test -race -v ./...
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										25
									
								
								vendor/github.com/sirupsen/logrus/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										25
									
								
								vendor/github.com/sirupsen/logrus/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,3 +1,26 @@
 | 
				
			|||||||
 | 
					# 1.6.0
 | 
				
			||||||
 | 
					Fixes:
 | 
				
			||||||
 | 
					  * end of line cleanup
 | 
				
			||||||
 | 
					  * revert the entry concurrency bug fix whic leads to deadlock under some circumstances
 | 
				
			||||||
 | 
					  * update dependency on go-windows-terminal-sequences to fix a crash with go 1.14
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Features:
 | 
				
			||||||
 | 
					  * add an option to the `TextFormatter` to completely disable fields quoting
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# 1.5.0
 | 
				
			||||||
 | 
					Code quality:
 | 
				
			||||||
 | 
					  * add golangci linter run on travis
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Fixes:
 | 
				
			||||||
 | 
					  * add mutex for hooks concurrent access on `Entry` data
 | 
				
			||||||
 | 
					  * caller function field for go1.14
 | 
				
			||||||
 | 
					  * fix build issue for gopherjs target
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Feature:
 | 
				
			||||||
 | 
					  * add an hooks/writer sub-package whose goal is to split output on different stream depending on the trace level
 | 
				
			||||||
 | 
					  * add a `DisableHTMLEscape` option in the `JSONFormatter`
 | 
				
			||||||
 | 
					  * add `ForceQuote` and `PadLevelText` options in the `TextFormatter`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 1.4.2
 | 
					# 1.4.2
 | 
				
			||||||
  * Fixes build break for plan9, nacl, solaris
 | 
					  * Fixes build break for plan9, nacl, solaris
 | 
				
			||||||
# 1.4.1
 | 
					# 1.4.1
 | 
				
			||||||
@@ -11,7 +34,7 @@ Fixes:
 | 
				
			|||||||
# 1.4.0
 | 
					# 1.4.0
 | 
				
			||||||
This new release introduces:
 | 
					This new release introduces:
 | 
				
			||||||
  * Add `DeferExitHandler`, similar to `RegisterExitHandler` but prepending the handler to the list of handlers (semantically like `defer`) (#848).
 | 
					  * Add `DeferExitHandler`, similar to `RegisterExitHandler` but prepending the handler to the list of handlers (semantically like `defer`) (#848).
 | 
				
			||||||
  * Add `CallerPrettyfier` to `JSONFormatter` and `TextFormatter (#909, #911)
 | 
					  * Add `CallerPrettyfier` to `JSONFormatter` and `TextFormatter` (#909, #911)
 | 
				
			||||||
  * Add `Entry.WithContext()` and `Entry.Context`, to set a context on entries to be used e.g. in hooks (#919).
 | 
					  * Add `Entry.WithContext()` and `Entry.Context`, to set a context on entries to be used e.g. in hooks (#919).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Fixes:
 | 
					Fixes:
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										44
									
								
								vendor/github.com/sirupsen/logrus/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										44
									
								
								vendor/github.com/sirupsen/logrus/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,8 +1,28 @@
 | 
				
			|||||||
# Logrus <img src="http://i.imgur.com/hTeVwmJ.png" width="40" height="40" alt=":walrus:" class="emoji" title=":walrus:"/> [](https://travis-ci.org/sirupsen/logrus) [](https://godoc.org/github.com/sirupsen/logrus)
 | 
					# Logrus <img src="http://i.imgur.com/hTeVwmJ.png" width="40" height="40" alt=":walrus:" class="emoji" title=":walrus:"/> [](https://travis-ci.org/sirupsen/logrus) [](https://godoc.org/github.com/sirupsen/logrus)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Logrus is a structured logger for Go (golang), completely API compatible with
 | 
					Logrus is a structured logger for Go (golang), completely API compatible with
 | 
				
			||||||
the standard library logger.
 | 
					the standard library logger.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Logrus is in maintenance-mode.** We will not be introducing new features. It's
 | 
				
			||||||
 | 
					simply too hard to do in a way that won't break many people's projects, which is
 | 
				
			||||||
 | 
					the last thing you want from your Logging library (again...).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This does not mean Logrus is dead. Logrus will continue to be maintained for
 | 
				
			||||||
 | 
					security, (backwards compatible) bug fixes, and performance (where we are
 | 
				
			||||||
 | 
					limited by the interface). 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					I believe Logrus' biggest contribution is to have played a part in today's
 | 
				
			||||||
 | 
					widespread use of structured logging in Golang. There doesn't seem to be a
 | 
				
			||||||
 | 
					reason to do a major, breaking iteration into Logrus V2, since the fantastic Go
 | 
				
			||||||
 | 
					community has built those independently. Many fantastic alternatives have sprung
 | 
				
			||||||
 | 
					up. Logrus would look like those, had it been re-designed with what we know
 | 
				
			||||||
 | 
					about structured logging in Go today. Check out, for example,
 | 
				
			||||||
 | 
					[Zerolog][zerolog], [Zap][zap], and [Apex][apex].
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[zerolog]: https://github.com/rs/zerolog
 | 
				
			||||||
 | 
					[zap]: https://github.com/uber-go/zap
 | 
				
			||||||
 | 
					[apex]: https://github.com/apex/log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Seeing weird case-sensitive problems?** It's in the past been possible to
 | 
					**Seeing weird case-sensitive problems?** It's in the past been possible to
 | 
				
			||||||
import Logrus as both upper- and lower-case. Due to the Go package environment,
 | 
					import Logrus as both upper- and lower-case. Due to the Go package environment,
 | 
				
			||||||
this caused issues in the community and we needed a standard. Some environments
 | 
					this caused issues in the community and we needed a standard. Some environments
 | 
				
			||||||
@@ -15,11 +35,6 @@ comments](https://github.com/sirupsen/logrus/issues/553#issuecomment-306591437).
 | 
				
			|||||||
For an in-depth explanation of the casing issue, see [this
 | 
					For an in-depth explanation of the casing issue, see [this
 | 
				
			||||||
comment](https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276).
 | 
					comment](https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Are you interested in assisting in maintaining Logrus?** Currently I have a
 | 
					 | 
				
			||||||
lot of obligations, and I am unable to provide Logrus with the maintainership it
 | 
					 | 
				
			||||||
needs. If you'd like to help, please reach out to me at `simon at author's
 | 
					 | 
				
			||||||
username dot com`.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Nicely color-coded in development (when a TTY is attached, otherwise just
 | 
					Nicely color-coded in development (when a TTY is attached, otherwise just
 | 
				
			||||||
plain text):
 | 
					plain text):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -187,7 +202,7 @@ func main() {
 | 
				
			|||||||
  log.Out = os.Stdout
 | 
					  log.Out = os.Stdout
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // You could set this to any `io.Writer` such as a file
 | 
					  // You could set this to any `io.Writer` such as a file
 | 
				
			||||||
  // file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY, 0666)
 | 
					  // file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
 | 
				
			||||||
  // if err == nil {
 | 
					  // if err == nil {
 | 
				
			||||||
  //  log.Out = file
 | 
					  //  log.Out = file
 | 
				
			||||||
  // } else {
 | 
					  // } else {
 | 
				
			||||||
@@ -272,7 +287,7 @@ func init() {
 | 
				
			|||||||
```
 | 
					```
 | 
				
			||||||
Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). For the detail, please check the [syslog hook README](hooks/syslog/README.md).
 | 
					Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). For the detail, please check the [syslog hook README](hooks/syslog/README.md).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A list of currently known of service hook can be found in this wiki [page](https://github.com/sirupsen/logrus/wiki/Hooks)
 | 
					A list of currently known service hooks can be found in this wiki [page](https://github.com/sirupsen/logrus/wiki/Hooks)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### Level logging
 | 
					#### Level logging
 | 
				
			||||||
@@ -354,6 +369,7 @@ The built-in logging formatters are:
 | 
				
			|||||||
    [github.com/mattn/go-colorable](https://github.com/mattn/go-colorable).
 | 
					    [github.com/mattn/go-colorable](https://github.com/mattn/go-colorable).
 | 
				
			||||||
  * When colors are enabled, levels are truncated to 4 characters by default. To disable
 | 
					  * When colors are enabled, levels are truncated to 4 characters by default. To disable
 | 
				
			||||||
    truncation set the `DisableLevelTruncation` field to `true`.
 | 
					    truncation set the `DisableLevelTruncation` field to `true`.
 | 
				
			||||||
 | 
					  * When outputting to a TTY, it's often helpful to visually scan down a column where all the levels are the same width. Setting the `PadLevelText` field to `true` enables this behavior, by adding padding to the level text.
 | 
				
			||||||
  * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#TextFormatter).
 | 
					  * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#TextFormatter).
 | 
				
			||||||
* `logrus.JSONFormatter`. Logs fields as JSON.
 | 
					* `logrus.JSONFormatter`. Logs fields as JSON.
 | 
				
			||||||
  * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#JSONFormatter).
 | 
					  * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#JSONFormatter).
 | 
				
			||||||
@@ -364,8 +380,10 @@ Third party logging formatters:
 | 
				
			|||||||
* [`GELF`](https://github.com/fabienm/go-logrus-formatters). Formats entries so they comply to Graylog's [GELF 1.1 specification](http://docs.graylog.org/en/2.4/pages/gelf.html).
 | 
					* [`GELF`](https://github.com/fabienm/go-logrus-formatters). Formats entries so they comply to Graylog's [GELF 1.1 specification](http://docs.graylog.org/en/2.4/pages/gelf.html).
 | 
				
			||||||
* [`logstash`](https://github.com/bshuster-repo/logrus-logstash-hook). Logs fields as [Logstash](http://logstash.net) Events.
 | 
					* [`logstash`](https://github.com/bshuster-repo/logrus-logstash-hook). Logs fields as [Logstash](http://logstash.net) Events.
 | 
				
			||||||
* [`prefixed`](https://github.com/x-cray/logrus-prefixed-formatter). Displays log entry source along with alternative layout.
 | 
					* [`prefixed`](https://github.com/x-cray/logrus-prefixed-formatter). Displays log entry source along with alternative layout.
 | 
				
			||||||
* [`zalgo`](https://github.com/aybabtme/logzalgo). Invoking the P͉̫o̳̼̊w̖͈̰͎e̬͔̭͂r͚̼̹̲ ̫͓͉̳͈ō̠͕͖̚f̝͍̠ ͕̲̞͖͑Z̖̫̤̫ͪa͉̬͈̗l͖͎g̳̥o̰̥̅!̣͔̲̻͊̄ ̙̘̦̹̦.
 | 
					* [`zalgo`](https://github.com/aybabtme/logzalgo). Invoking the Power of Zalgo.
 | 
				
			||||||
* [`nested-logrus-formatter`](https://github.com/antonfisher/nested-logrus-formatter). Converts logrus fields to a nested structure.
 | 
					* [`nested-logrus-formatter`](https://github.com/antonfisher/nested-logrus-formatter). Converts logrus fields to a nested structure.
 | 
				
			||||||
 | 
					* [`powerful-logrus-formatter`](https://github.com/zput/zxcTool). get fileName, log's line number and the latest function's name when print log; Sava log to files.
 | 
				
			||||||
 | 
					* [`caption-json-formatter`](https://github.com/nolleh/caption_json_formatter). logrus's message json formatter with human-readable caption added.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You can define your formatter by implementing the `Formatter` interface,
 | 
					You can define your formatter by implementing the `Formatter` interface,
 | 
				
			||||||
requiring a `Format` method. `Format` takes an `*Entry`. `entry.Data` is a
 | 
					requiring a `Format` method. `Format` takes an `*Entry`. `entry.Data` is a
 | 
				
			||||||
@@ -430,14 +448,14 @@ entries. It should not be a feature of the application-level logger.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
| Tool | Description |
 | 
					| Tool | Description |
 | 
				
			||||||
| ---- | ----------- |
 | 
					| ---- | ----------- |
 | 
				
			||||||
|[Logrus Mate](https://github.com/gogap/logrus_mate)|Logrus mate is a tool for Logrus to manage loggers, you can initial logger's level, hook and formatter by config file, the logger will generated with different config at different environment.|
 | 
					|[Logrus Mate](https://github.com/gogap/logrus_mate)|Logrus mate is a tool for Logrus to manage loggers, you can initial logger's level, hook and formatter by config file, the logger will be generated with different configs in different environments.|
 | 
				
			||||||
|[Logrus Viper Helper](https://github.com/heirko/go-contrib/tree/master/logrusHelper)|An Helper around Logrus to wrap with spf13/Viper to load configuration with fangs! And to simplify Logrus configuration use some behavior of [Logrus Mate](https://github.com/gogap/logrus_mate). [sample](https://github.com/heirko/iris-contrib/blob/master/middleware/logrus-logger/example) |
 | 
					|[Logrus Viper Helper](https://github.com/heirko/go-contrib/tree/master/logrusHelper)|An Helper around Logrus to wrap with spf13/Viper to load configuration with fangs! And to simplify Logrus configuration use some behavior of [Logrus Mate](https://github.com/gogap/logrus_mate). [sample](https://github.com/heirko/iris-contrib/blob/master/middleware/logrus-logger/example) |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### Testing
 | 
					#### Testing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Logrus has a built in facility for asserting the presence of log messages. This is implemented through the `test` hook and provides:
 | 
					Logrus has a built in facility for asserting the presence of log messages. This is implemented through the `test` hook and provides:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* decorators for existing logger (`test.NewLocal` and `test.NewGlobal`) which basically just add the `test` hook
 | 
					* decorators for existing logger (`test.NewLocal` and `test.NewGlobal`) which basically just adds the `test` hook
 | 
				
			||||||
* a test logger (`test.NewNullLogger`) that just records log messages (and does not output any):
 | 
					* a test logger (`test.NewNullLogger`) that just records log messages (and does not output any):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```go
 | 
					```go
 | 
				
			||||||
@@ -465,7 +483,7 @@ func TestSomething(t*testing.T){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Logrus can register one or more functions that will be called when any `fatal`
 | 
					Logrus can register one or more functions that will be called when any `fatal`
 | 
				
			||||||
level message is logged. The registered handlers will be executed before
 | 
					level message is logged. The registered handlers will be executed before
 | 
				
			||||||
logrus performs a `os.Exit(1)`. This behavior may be helpful if callers need
 | 
					logrus performs an `os.Exit(1)`. This behavior may be helpful if callers need
 | 
				
			||||||
to gracefully shutdown. Unlike a `panic("Something went wrong...")` call which can be intercepted with a deferred `recover` a call to `os.Exit(1)` can not be intercepted.
 | 
					to gracefully shutdown. Unlike a `panic("Something went wrong...")` call which can be intercepted with a deferred `recover` a call to `os.Exit(1)` can not be intercepted.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
@@ -490,6 +508,6 @@ Situation when locking is not needed includes:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  1) logger.Out is protected by locks.
 | 
					  1) logger.Out is protected by locks.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  2) logger.Out is a os.File handler opened with `O_APPEND` flag, and every write is smaller than 4k. (This allow multi-thread/multi-process writing)
 | 
					  2) logger.Out is an os.File handler opened with `O_APPEND` flag, and every write is smaller than 4k. (This allows multi-thread/multi-process writing)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     (Refer to http://www.notthewizard.com/2014/06/17/are-files-appends-really-atomic/)
 | 
					     (Refer to http://www.notthewizard.com/2014/06/17/are-files-appends-really-atomic/)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										45
									
								
								vendor/github.com/sirupsen/logrus/entry.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										45
									
								
								vendor/github.com/sirupsen/logrus/entry.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -85,10 +85,15 @@ func NewEntry(logger *Logger) *Entry {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Returns the bytes representation of this entry from the formatter.
 | 
				
			||||||
 | 
					func (entry *Entry) Bytes() ([]byte, error) {
 | 
				
			||||||
 | 
						return entry.Logger.Formatter.Format(entry)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Returns the string representation from the reader and ultimately the
 | 
					// Returns the string representation from the reader and ultimately the
 | 
				
			||||||
// formatter.
 | 
					// formatter.
 | 
				
			||||||
func (entry *Entry) String() (string, error) {
 | 
					func (entry *Entry) String() (string, error) {
 | 
				
			||||||
	serialized, err := entry.Logger.Formatter.Format(entry)
 | 
						serialized, err := entry.Bytes()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return "", err
 | 
							return "", err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -103,7 +108,11 @@ func (entry *Entry) WithError(err error) *Entry {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Add a context to the Entry.
 | 
					// Add a context to the Entry.
 | 
				
			||||||
func (entry *Entry) WithContext(ctx context.Context) *Entry {
 | 
					func (entry *Entry) WithContext(ctx context.Context) *Entry {
 | 
				
			||||||
	return &Entry{Logger: entry.Logger, Data: entry.Data, Time: entry.Time, err: entry.err, Context: ctx}
 | 
						dataCopy := make(Fields, len(entry.Data))
 | 
				
			||||||
 | 
						for k, v := range entry.Data {
 | 
				
			||||||
 | 
							dataCopy[k] = v
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return &Entry{Logger: entry.Logger, Data: dataCopy, Time: entry.Time, err: entry.err, Context: ctx}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Add a single field to the Entry.
 | 
					// Add a single field to the Entry.
 | 
				
			||||||
@@ -144,7 +153,11 @@ func (entry *Entry) WithFields(fields Fields) *Entry {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Overrides the time of the Entry.
 | 
					// Overrides the time of the Entry.
 | 
				
			||||||
func (entry *Entry) WithTime(t time.Time) *Entry {
 | 
					func (entry *Entry) WithTime(t time.Time) *Entry {
 | 
				
			||||||
	return &Entry{Logger: entry.Logger, Data: entry.Data, Time: t, err: entry.err, Context: entry.Context}
 | 
						dataCopy := make(Fields, len(entry.Data))
 | 
				
			||||||
 | 
						for k, v := range entry.Data {
 | 
				
			||||||
 | 
							dataCopy[k] = v
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return &Entry{Logger: entry.Logger, Data: dataCopy, Time: t, err: entry.err, Context: entry.Context}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// getPackageName reduces a fully qualified function name to the package name
 | 
					// getPackageName reduces a fully qualified function name to the package name
 | 
				
			||||||
@@ -165,15 +178,20 @@ func getPackageName(f string) string {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// getCaller retrieves the name of the first non-logrus calling function
 | 
					// getCaller retrieves the name of the first non-logrus calling function
 | 
				
			||||||
func getCaller() *runtime.Frame {
 | 
					func getCaller() *runtime.Frame {
 | 
				
			||||||
 | 
					 | 
				
			||||||
	// cache this package's fully-qualified name
 | 
						// cache this package's fully-qualified name
 | 
				
			||||||
	callerInitOnce.Do(func() {
 | 
						callerInitOnce.Do(func() {
 | 
				
			||||||
		pcs := make([]uintptr, 2)
 | 
							pcs := make([]uintptr, maximumCallerDepth)
 | 
				
			||||||
		_ = runtime.Callers(0, pcs)
 | 
							_ = runtime.Callers(0, pcs)
 | 
				
			||||||
		logrusPackage = getPackageName(runtime.FuncForPC(pcs[1]).Name())
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// now that we have the cache, we can skip a minimum count of known-logrus functions
 | 
							// dynamic get the package name and the minimum caller depth
 | 
				
			||||||
		// XXX this is dubious, the number of frames may vary
 | 
							for i := 0; i < maximumCallerDepth; i++ {
 | 
				
			||||||
 | 
								funcName := runtime.FuncForPC(pcs[i]).Name()
 | 
				
			||||||
 | 
								if strings.Contains(funcName, "getCaller") {
 | 
				
			||||||
 | 
									logrusPackage = getPackageName(funcName)
 | 
				
			||||||
 | 
									break
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		minimumCallerDepth = knownLogrusFrames
 | 
							minimumCallerDepth = knownLogrusFrames
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -187,7 +205,7 @@ func getCaller() *runtime.Frame {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		// If the caller isn't part of this package, we're done
 | 
							// If the caller isn't part of this package, we're done
 | 
				
			||||||
		if pkg != logrusPackage {
 | 
							if pkg != logrusPackage {
 | 
				
			||||||
			return &f
 | 
								return &f //nolint:scopelint
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -217,9 +235,11 @@ func (entry Entry) log(level Level, msg string) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	entry.Level = level
 | 
						entry.Level = level
 | 
				
			||||||
	entry.Message = msg
 | 
						entry.Message = msg
 | 
				
			||||||
 | 
						entry.Logger.mu.Lock()
 | 
				
			||||||
	if entry.Logger.ReportCaller {
 | 
						if entry.Logger.ReportCaller {
 | 
				
			||||||
		entry.Caller = getCaller()
 | 
							entry.Caller = getCaller()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						entry.Logger.mu.Unlock()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	entry.fireHooks()
 | 
						entry.fireHooks()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -255,11 +275,10 @@ func (entry *Entry) write() {
 | 
				
			|||||||
	serialized, err := entry.Logger.Formatter.Format(entry)
 | 
						serialized, err := entry.Logger.Formatter.Format(entry)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
 | 
							fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
 | 
				
			||||||
	} else {
 | 
							return
 | 
				
			||||||
		_, err = entry.Logger.Out.Write(serialized)
 | 
					 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if _, err = entry.Logger.Out.Write(serialized); err != nil {
 | 
				
			||||||
 | 
							fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								vendor/github.com/sirupsen/logrus/exported.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/sirupsen/logrus/exported.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -80,7 +80,7 @@ func WithFields(fields Fields) *Entry {
 | 
				
			|||||||
	return std.WithFields(fields)
 | 
						return std.WithFields(fields)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// WithTime creats an entry from the standard logger and overrides the time of
 | 
					// WithTime creates an entry from the standard logger and overrides the time of
 | 
				
			||||||
// logs generated with it.
 | 
					// logs generated with it.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
 | 
					// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								vendor/github.com/sirupsen/logrus/go.mod
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								vendor/github.com/sirupsen/logrus/go.mod
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -2,9 +2,10 @@ module github.com/sirupsen/logrus
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
require (
 | 
					require (
 | 
				
			||||||
	github.com/davecgh/go-spew v1.1.1 // indirect
 | 
						github.com/davecgh/go-spew v1.1.1 // indirect
 | 
				
			||||||
	github.com/konsorten/go-windows-terminal-sequences v1.0.1
 | 
						github.com/konsorten/go-windows-terminal-sequences v1.0.3
 | 
				
			||||||
	github.com/pmezard/go-difflib v1.0.0 // indirect
 | 
						github.com/pmezard/go-difflib v1.0.0 // indirect
 | 
				
			||||||
	github.com/stretchr/objx v0.1.1 // indirect
 | 
					 | 
				
			||||||
	github.com/stretchr/testify v1.2.2
 | 
						github.com/stretchr/testify v1.2.2
 | 
				
			||||||
	golang.org/x/sys v0.0.0-20190422165155-953cdadca894
 | 
						golang.org/x/sys v0.0.0-20190422165155-953cdadca894
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					go 1.13
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								vendor/github.com/sirupsen/logrus/go.sum
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/sirupsen/logrus/go.sum
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,16 +1,12 @@
 | 
				
			|||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 | 
					github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 | 
				
			||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
					github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
				
			||||||
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe h1:CHRGQ8V7OlCYtwaKPJi3iA7J+YdNKdo8j7nG5IgDhjs=
 | 
					 | 
				
			||||||
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 | 
					 | 
				
			||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
 | 
					github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
 | 
				
			||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 | 
					github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 | 
				
			||||||
 | 
					github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
 | 
				
			||||||
 | 
					github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 | 
				
			||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 | 
					github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 | 
				
			||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 | 
					github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 | 
				
			||||||
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
 | 
					 | 
				
			||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
					 | 
				
			||||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
 | 
					github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
 | 
				
			||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 | 
					github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 | 
				
			||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
 | 
					 | 
				
			||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
					 | 
				
			||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
 | 
					golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
 | 
				
			||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
					golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								vendor/github.com/sirupsen/logrus/json_formatter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/sirupsen/logrus/json_formatter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -28,6 +28,9 @@ type JSONFormatter struct {
 | 
				
			|||||||
	// DisableTimestamp allows disabling automatic timestamps in output
 | 
						// DisableTimestamp allows disabling automatic timestamps in output
 | 
				
			||||||
	DisableTimestamp bool
 | 
						DisableTimestamp bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// DisableHTMLEscape allows disabling html escaping in output
 | 
				
			||||||
 | 
						DisableHTMLEscape bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// DataKey allows users to put all the log entry parameters into a nested dictionary at a given key.
 | 
						// DataKey allows users to put all the log entry parameters into a nested dictionary at a given key.
 | 
				
			||||||
	DataKey string
 | 
						DataKey string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -110,6 +113,7 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	encoder := json.NewEncoder(b)
 | 
						encoder := json.NewEncoder(b)
 | 
				
			||||||
 | 
						encoder.SetEscapeHTML(!f.DisableHTMLEscape)
 | 
				
			||||||
	if f.PrettyPrint {
 | 
						if f.PrettyPrint {
 | 
				
			||||||
		encoder.SetIndent("", "  ")
 | 
							encoder.SetIndent("", "  ")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								vendor/github.com/sirupsen/logrus/logger.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								vendor/github.com/sirupsen/logrus/logger.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -68,10 +68,10 @@ func (mw *MutexWrap) Disable() {
 | 
				
			|||||||
// `Out` and `Hooks` directly on the default logger instance. You can also just
 | 
					// `Out` and `Hooks` directly on the default logger instance. You can also just
 | 
				
			||||||
// instantiate your own:
 | 
					// instantiate your own:
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
//    var log = &Logger{
 | 
					//    var log = &logrus.Logger{
 | 
				
			||||||
//      Out: os.Stderr,
 | 
					//      Out: os.Stderr,
 | 
				
			||||||
//      Formatter: new(JSONFormatter),
 | 
					//      Formatter: new(logrus.JSONFormatter),
 | 
				
			||||||
//      Hooks: make(LevelHooks),
 | 
					//      Hooks: make(logrus.LevelHooks),
 | 
				
			||||||
//      Level: logrus.DebugLevel,
 | 
					//      Level: logrus.DebugLevel,
 | 
				
			||||||
//    }
 | 
					//    }
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
@@ -100,8 +100,9 @@ func (logger *Logger) releaseEntry(entry *Entry) {
 | 
				
			|||||||
	logger.entryPool.Put(entry)
 | 
						logger.entryPool.Put(entry)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Adds a field to the log entry, note that it doesn't log until you call
 | 
					// WithField allocates a new entry and adds a field to it.
 | 
				
			||||||
// Debug, Print, Info, Warn, Error, Fatal or Panic. It only creates a log entry.
 | 
					// Debug, Print, Info, Warn, Error, Fatal or Panic must be then applied to
 | 
				
			||||||
 | 
					// this new returned entry.
 | 
				
			||||||
// If you want multiple fields, use `WithFields`.
 | 
					// If you want multiple fields, use `WithFields`.
 | 
				
			||||||
func (logger *Logger) WithField(key string, value interface{}) *Entry {
 | 
					func (logger *Logger) WithField(key string, value interface{}) *Entry {
 | 
				
			||||||
	entry := logger.newEntry()
 | 
						entry := logger.newEntry()
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								vendor/github.com/sirupsen/logrus/logrus.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/sirupsen/logrus/logrus.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -51,7 +51,7 @@ func (level *Level) UnmarshalText(text []byte) error {
 | 
				
			|||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*level = Level(l)
 | 
						*level = l
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								vendor/github.com/sirupsen/logrus/terminal_check_bsd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/sirupsen/logrus/terminal_check_bsd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,4 +1,5 @@
 | 
				
			|||||||
// +build darwin dragonfly freebsd netbsd openbsd
 | 
					// +build darwin dragonfly freebsd netbsd openbsd
 | 
				
			||||||
 | 
					// +build !js
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package logrus
 | 
					package logrus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -10,4 +11,3 @@ func isTerminal(fd int) bool {
 | 
				
			|||||||
	_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
 | 
						_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
 | 
				
			||||||
	return err == nil
 | 
						return err == nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7
									
								
								vendor/github.com/sirupsen/logrus/terminal_check_js.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								vendor/github.com/sirupsen/logrus/terminal_check_js.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					// +build js
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package logrus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func isTerminal(fd int) bool {
 | 
				
			||||||
 | 
						return false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										2
									
								
								vendor/github.com/sirupsen/logrus/terminal_check_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/sirupsen/logrus/terminal_check_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,4 +1,5 @@
 | 
				
			|||||||
// +build linux aix
 | 
					// +build linux aix
 | 
				
			||||||
 | 
					// +build !js
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package logrus
 | 
					package logrus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -10,4 +11,3 @@ func isTerminal(fd int) bool {
 | 
				
			|||||||
	_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
 | 
						_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
 | 
				
			||||||
	return err == nil
 | 
						return err == nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										55
									
								
								vendor/github.com/sirupsen/logrus/text_formatter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										55
									
								
								vendor/github.com/sirupsen/logrus/text_formatter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -6,9 +6,11 @@ import (
 | 
				
			|||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"runtime"
 | 
						"runtime"
 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
 | 
						"strconv"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
						"unicode/utf8"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const (
 | 
					const (
 | 
				
			||||||
@@ -32,6 +34,14 @@ type TextFormatter struct {
 | 
				
			|||||||
	// Force disabling colors.
 | 
						// Force disabling colors.
 | 
				
			||||||
	DisableColors bool
 | 
						DisableColors bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Force quoting of all values
 | 
				
			||||||
 | 
						ForceQuote bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// DisableQuote disables quoting for all values.
 | 
				
			||||||
 | 
						// DisableQuote will have a lower priority than ForceQuote.
 | 
				
			||||||
 | 
						// If both of them are set to true, quote will be forced on all values.
 | 
				
			||||||
 | 
						DisableQuote bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Override coloring based on CLICOLOR and CLICOLOR_FORCE. - https://bixense.com/clicolors/
 | 
						// Override coloring based on CLICOLOR and CLICOLOR_FORCE. - https://bixense.com/clicolors/
 | 
				
			||||||
	EnvironmentOverrideColors bool
 | 
						EnvironmentOverrideColors bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -57,6 +67,10 @@ type TextFormatter struct {
 | 
				
			|||||||
	// Disables the truncation of the level text to 4 characters.
 | 
						// Disables the truncation of the level text to 4 characters.
 | 
				
			||||||
	DisableLevelTruncation bool
 | 
						DisableLevelTruncation bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// PadLevelText Adds padding the level text so that all the levels output at the same length
 | 
				
			||||||
 | 
						// PadLevelText is a superset of the DisableLevelTruncation option
 | 
				
			||||||
 | 
						PadLevelText bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// QuoteEmptyFields will wrap empty fields in quotes if true
 | 
						// QuoteEmptyFields will wrap empty fields in quotes if true
 | 
				
			||||||
	QuoteEmptyFields bool
 | 
						QuoteEmptyFields bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -79,23 +93,32 @@ type TextFormatter struct {
 | 
				
			|||||||
	CallerPrettyfier func(*runtime.Frame) (function string, file string)
 | 
						CallerPrettyfier func(*runtime.Frame) (function string, file string)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	terminalInitOnce sync.Once
 | 
						terminalInitOnce sync.Once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// The max length of the level text, generated dynamically on init
 | 
				
			||||||
 | 
						levelTextMaxLength int
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (f *TextFormatter) init(entry *Entry) {
 | 
					func (f *TextFormatter) init(entry *Entry) {
 | 
				
			||||||
	if entry.Logger != nil {
 | 
						if entry.Logger != nil {
 | 
				
			||||||
		f.isTerminal = checkIfTerminal(entry.Logger.Out)
 | 
							f.isTerminal = checkIfTerminal(entry.Logger.Out)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						// Get the max length of the level text
 | 
				
			||||||
 | 
						for _, level := range AllLevels {
 | 
				
			||||||
 | 
							levelTextLength := utf8.RuneCount([]byte(level.String()))
 | 
				
			||||||
 | 
							if levelTextLength > f.levelTextMaxLength {
 | 
				
			||||||
 | 
								f.levelTextMaxLength = levelTextLength
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (f *TextFormatter) isColored() bool {
 | 
					func (f *TextFormatter) isColored() bool {
 | 
				
			||||||
	isColored := f.ForceColors || (f.isTerminal && (runtime.GOOS != "windows"))
 | 
						isColored := f.ForceColors || (f.isTerminal && (runtime.GOOS != "windows"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if f.EnvironmentOverrideColors {
 | 
						if f.EnvironmentOverrideColors {
 | 
				
			||||||
		if force, ok := os.LookupEnv("CLICOLOR_FORCE"); ok && force != "0" {
 | 
							switch force, ok := os.LookupEnv("CLICOLOR_FORCE"); {
 | 
				
			||||||
 | 
							case ok && force != "0":
 | 
				
			||||||
			isColored = true
 | 
								isColored = true
 | 
				
			||||||
		} else if ok && force == "0" {
 | 
							case ok && force == "0", os.Getenv("CLICOLOR") == "0":
 | 
				
			||||||
			isColored = false
 | 
					 | 
				
			||||||
		} else if os.Getenv("CLICOLOR") == "0" {
 | 
					 | 
				
			||||||
			isColored = false
 | 
								isColored = false
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -217,9 +240,18 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	levelText := strings.ToUpper(entry.Level.String())
 | 
						levelText := strings.ToUpper(entry.Level.String())
 | 
				
			||||||
	if !f.DisableLevelTruncation {
 | 
						if !f.DisableLevelTruncation && !f.PadLevelText {
 | 
				
			||||||
		levelText = levelText[0:4]
 | 
							levelText = levelText[0:4]
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if f.PadLevelText {
 | 
				
			||||||
 | 
							// Generates the format string used in the next line, for example "%-6s" or "%-7s".
 | 
				
			||||||
 | 
							// Based on the max level text length.
 | 
				
			||||||
 | 
							formatString := "%-" + strconv.Itoa(f.levelTextMaxLength) + "s"
 | 
				
			||||||
 | 
							// Formats the level text by appending spaces up to the max length, for example:
 | 
				
			||||||
 | 
							// 	- "INFO   "
 | 
				
			||||||
 | 
							//	- "WARNING"
 | 
				
			||||||
 | 
							levelText = fmt.Sprintf(formatString, levelText)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Remove a single newline if it already exists in the message to keep
 | 
						// Remove a single newline if it already exists in the message to keep
 | 
				
			||||||
	// the behavior of logrus text_formatter the same as the stdlib log package
 | 
						// the behavior of logrus text_formatter the same as the stdlib log package
 | 
				
			||||||
@@ -243,11 +275,12 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if f.DisableTimestamp {
 | 
						switch {
 | 
				
			||||||
 | 
						case f.DisableTimestamp:
 | 
				
			||||||
		fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m%s %-44s ", levelColor, levelText, caller, entry.Message)
 | 
							fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m%s %-44s ", levelColor, levelText, caller, entry.Message)
 | 
				
			||||||
	} else if !f.FullTimestamp {
 | 
						case !f.FullTimestamp:
 | 
				
			||||||
		fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d]%s %-44s ", levelColor, levelText, int(entry.Time.Sub(baseTimestamp)/time.Second), caller, entry.Message)
 | 
							fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d]%s %-44s ", levelColor, levelText, int(entry.Time.Sub(baseTimestamp)/time.Second), caller, entry.Message)
 | 
				
			||||||
	} else {
 | 
						default:
 | 
				
			||||||
		fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s]%s %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), caller, entry.Message)
 | 
							fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s]%s %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), caller, entry.Message)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for _, k := range keys {
 | 
						for _, k := range keys {
 | 
				
			||||||
@@ -258,9 +291,15 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (f *TextFormatter) needsQuoting(text string) bool {
 | 
					func (f *TextFormatter) needsQuoting(text string) bool {
 | 
				
			||||||
 | 
						if f.ForceQuote {
 | 
				
			||||||
 | 
							return true
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if f.QuoteEmptyFields && len(text) == 0 {
 | 
						if f.QuoteEmptyFields && len(text) == 0 {
 | 
				
			||||||
		return true
 | 
							return true
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if f.DisableQuote {
 | 
				
			||||||
 | 
							return false
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	for _, ch := range text {
 | 
						for _, ch := range text {
 | 
				
			||||||
		if !((ch >= 'a' && ch <= 'z') ||
 | 
							if !((ch >= 'a' && ch <= 'z') ||
 | 
				
			||||||
			(ch >= 'A' && ch <= 'Z') ||
 | 
								(ch >= 'A' && ch <= 'Z') ||
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								vendor/github.com/sirupsen/logrus/writer.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/github.com/sirupsen/logrus/writer.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -6,10 +6,16 @@ import (
 | 
				
			|||||||
	"runtime"
 | 
						"runtime"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Writer at INFO level. See WriterLevel for details.
 | 
				
			||||||
func (logger *Logger) Writer() *io.PipeWriter {
 | 
					func (logger *Logger) Writer() *io.PipeWriter {
 | 
				
			||||||
	return logger.WriterLevel(InfoLevel)
 | 
						return logger.WriterLevel(InfoLevel)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// WriterLevel returns an io.Writer that can be used to write arbitrary text to
 | 
				
			||||||
 | 
					// the logger at the given log level. Each line written to the writer will be
 | 
				
			||||||
 | 
					// printed in the usual way using formatters and hooks. The writer is part of an
 | 
				
			||||||
 | 
					// io.Pipe and it is the callers responsibility to close the writer when done.
 | 
				
			||||||
 | 
					// This can be used to override the standard library logger easily.
 | 
				
			||||||
func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
 | 
					func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
 | 
				
			||||||
	return NewEntry(logger).WriterLevel(level)
 | 
						return NewEntry(logger).WriterLevel(level)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								vendor/github.com/spf13/cobra/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								vendor/github.com/spf13/cobra/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -32,5 +32,8 @@ Session.vim
 | 
				
			|||||||
tags
 | 
					tags
 | 
				
			||||||
 | 
					
 | 
				
			||||||
*.exe
 | 
					*.exe
 | 
				
			||||||
 | 
					 | 
				
			||||||
cobra.test
 | 
					cobra.test
 | 
				
			||||||
 | 
					bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.idea/
 | 
				
			||||||
 | 
					*.iml
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										40
									
								
								vendor/github.com/spf13/cobra/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										40
									
								
								vendor/github.com/spf13/cobra/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,21 +1,29 @@
 | 
				
			|||||||
language: go
 | 
					language: go
 | 
				
			||||||
 | 
					
 | 
				
			||||||
matrix:
 | 
					stages:
 | 
				
			||||||
  include:
 | 
					  - diff
 | 
				
			||||||
    - go: 1.9.4
 | 
					  - test
 | 
				
			||||||
    - go: 1.10.0
 | 
					  - build
 | 
				
			||||||
    - go: tip
 | 
					
 | 
				
			||||||
  allow_failures:
 | 
					go:
 | 
				
			||||||
    - go: tip
 | 
					  - 1.12.x
 | 
				
			||||||
 | 
					  - 1.13.x
 | 
				
			||||||
 | 
					  - tip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
before_install:
 | 
					before_install:
 | 
				
			||||||
  - mkdir -p bin
 | 
					  - go get -u github.com/kyoh86/richgo
 | 
				
			||||||
  - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.3/shellcheck
 | 
					  - go get -u github.com/mitchellh/gox
 | 
				
			||||||
  - chmod +x bin/shellcheck
 | 
					
 | 
				
			||||||
 | 
					matrix:
 | 
				
			||||||
 | 
					  allow_failures:
 | 
				
			||||||
 | 
					    - go: tip
 | 
				
			||||||
 | 
					  include:
 | 
				
			||||||
 | 
					    - stage: diff
 | 
				
			||||||
 | 
					      go: 1.13.x
 | 
				
			||||||
 | 
					      script: make fmt
 | 
				
			||||||
 | 
					    - stage: build
 | 
				
			||||||
 | 
					      go: 1.13.x
 | 
				
			||||||
 | 
					      script: make cobra_generator
 | 
				
			||||||
 | 
					
 | 
				
			||||||
script: 
 | 
					script: 
 | 
				
			||||||
  - PATH=$PATH:$PWD/bin go test -v ./...
 | 
					 - make test
 | 
				
			||||||
  - go build
 | 
					 | 
				
			||||||
  - diff -u <(echo -n) <(gofmt -d -s .)
 | 
					 | 
				
			||||||
  - if [ -z $NOVET ]; then
 | 
					 | 
				
			||||||
      diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										36
									
								
								vendor/github.com/spf13/cobra/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								vendor/github.com/spf13/cobra/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					BIN="./bin"
 | 
				
			||||||
 | 
					SRC=$(shell find . -name "*.go")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ifeq (, $(shell which richgo))
 | 
				
			||||||
 | 
					$(warning "could not find richgo in $(PATH), run: go get github.com/kyoh86/richgo")
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: fmt vet test cobra_generator install_deps clean
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					default: all
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					all: fmt vet test cobra_generator	
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fmt:
 | 
				
			||||||
 | 
						$(info ******************** checking formatting ********************)
 | 
				
			||||||
 | 
						@test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					test: install_deps vet
 | 
				
			||||||
 | 
						$(info ******************** running tests ********************)
 | 
				
			||||||
 | 
						richgo test -v ./...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cobra_generator: install_deps
 | 
				
			||||||
 | 
						$(info ******************** building generator ********************)
 | 
				
			||||||
 | 
						mkdir -p $(BIN)
 | 
				
			||||||
 | 
						make -C cobra all
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					install_deps:
 | 
				
			||||||
 | 
						$(info ******************** downloading dependencies ********************)
 | 
				
			||||||
 | 
						go get -v ./...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					vet:
 | 
				
			||||||
 | 
						$(info ******************** vetting ********************)
 | 
				
			||||||
 | 
						go vet ./...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					clean:
 | 
				
			||||||
 | 
						rm -rf $(BIN)
 | 
				
			||||||
							
								
								
									
										116
									
								
								vendor/github.com/spf13/cobra/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										116
									
								
								vendor/github.com/spf13/cobra/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -2,29 +2,35 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Cobra is both a library for creating powerful modern CLI applications as well as a program to generate applications and command files.
 | 
					Cobra is both a library for creating powerful modern CLI applications as well as a program to generate applications and command files.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Many of the most widely used Go projects are built using Cobra including:
 | 
					Many of the most widely used Go projects are built using Cobra, such as:
 | 
				
			||||||
 | 
					[Kubernetes](http://kubernetes.io/),
 | 
				
			||||||
* [Kubernetes](http://kubernetes.io/)
 | 
					[Hugo](http://gohugo.io),
 | 
				
			||||||
* [Hugo](http://gohugo.io)
 | 
					[rkt](https://github.com/coreos/rkt),
 | 
				
			||||||
* [rkt](https://github.com/coreos/rkt)
 | 
					[etcd](https://github.com/coreos/etcd),
 | 
				
			||||||
* [etcd](https://github.com/coreos/etcd)
 | 
					[Moby (former Docker)](https://github.com/moby/moby),
 | 
				
			||||||
* [Moby (former Docker)](https://github.com/moby/moby)
 | 
					[Docker (distribution)](https://github.com/docker/distribution),
 | 
				
			||||||
* [Docker (distribution)](https://github.com/docker/distribution)
 | 
					[OpenShift](https://www.openshift.com/),
 | 
				
			||||||
* [OpenShift](https://www.openshift.com/)
 | 
					[Delve](https://github.com/derekparker/delve),
 | 
				
			||||||
* [Delve](https://github.com/derekparker/delve)
 | 
					[GopherJS](http://www.gopherjs.org/),
 | 
				
			||||||
* [GopherJS](http://www.gopherjs.org/)
 | 
					[CockroachDB](http://www.cockroachlabs.com/),
 | 
				
			||||||
* [CockroachDB](http://www.cockroachlabs.com/)
 | 
					[Bleve](http://www.blevesearch.com/),
 | 
				
			||||||
* [Bleve](http://www.blevesearch.com/)
 | 
					[ProjectAtomic (enterprise)](http://www.projectatomic.io/),
 | 
				
			||||||
* [ProjectAtomic (enterprise)](http://www.projectatomic.io/)
 | 
					[Giant Swarm's gsctl](https://github.com/giantswarm/gsctl),
 | 
				
			||||||
* [GiantSwarm's swarm](https://github.com/giantswarm/cli)
 | 
					[Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack),
 | 
				
			||||||
* [Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack)
 | 
					[rclone](http://rclone.org/),
 | 
				
			||||||
* [rclone](http://rclone.org/)
 | 
					[nehm](https://github.com/bogem/nehm),
 | 
				
			||||||
* [nehm](https://github.com/bogem/nehm)
 | 
					[Pouch](https://github.com/alibaba/pouch),
 | 
				
			||||||
* [Pouch](https://github.com/alibaba/pouch)
 | 
					[Istio](https://istio.io),
 | 
				
			||||||
 | 
					[Prototool](https://github.com/uber/prototool),
 | 
				
			||||||
 | 
					[mattermost-server](https://github.com/mattermost/mattermost-server),
 | 
				
			||||||
 | 
					[Gardener](https://github.com/gardener/gardenctl),
 | 
				
			||||||
 | 
					[Linkerd](https://linkerd.io/),
 | 
				
			||||||
 | 
					[Github CLI](https://github.com/cli/cli)
 | 
				
			||||||
 | 
					etc.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[](https://travis-ci.org/spf13/cobra)
 | 
					[](https://travis-ci.org/spf13/cobra)
 | 
				
			||||||
[](https://circleci.com/gh/spf13/cobra)
 | 
					 | 
				
			||||||
[](https://godoc.org/github.com/spf13/cobra)
 | 
					[](https://godoc.org/github.com/spf13/cobra)
 | 
				
			||||||
 | 
					[](https://goreportcard.com/report/github.com/spf13/cobra)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Table of Contents
 | 
					# Table of Contents
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -45,6 +51,7 @@ Many of the most widely used Go projects are built using Cobra including:
 | 
				
			|||||||
  * [Suggestions when "unknown command" happens](#suggestions-when-unknown-command-happens)
 | 
					  * [Suggestions when "unknown command" happens](#suggestions-when-unknown-command-happens)
 | 
				
			||||||
  * [Generating documentation for your command](#generating-documentation-for-your-command)
 | 
					  * [Generating documentation for your command](#generating-documentation-for-your-command)
 | 
				
			||||||
  * [Generating bash completions](#generating-bash-completions)
 | 
					  * [Generating bash completions](#generating-bash-completions)
 | 
				
			||||||
 | 
					  * [Generating zsh completions](#generating-zsh-completions)
 | 
				
			||||||
- [Contributing](#contributing)
 | 
					- [Contributing](#contributing)
 | 
				
			||||||
- [License](#license)
 | 
					- [License](#license)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -152,9 +159,6 @@ In a Cobra app, typically the main.go file is very bare. It serves one purpose:
 | 
				
			|||||||
package main
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
  "fmt"
 | 
					 | 
				
			||||||
  "os"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  "{pathToYourApp}/cmd"
 | 
					  "{pathToYourApp}/cmd"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -206,6 +210,8 @@ You will additionally define flags and handle configuration in your init() funct
 | 
				
			|||||||
For example cmd/root.go:
 | 
					For example cmd/root.go:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```go
 | 
					```go
 | 
				
			||||||
 | 
					package cmd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
@@ -215,22 +221,47 @@ import (
 | 
				
			|||||||
	"github.com/spf13/viper"
 | 
						"github.com/spf13/viper"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var (
 | 
				
			||||||
 | 
						// Used for flags.
 | 
				
			||||||
 | 
						cfgFile     string
 | 
				
			||||||
 | 
						userLicense string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						rootCmd = &cobra.Command{
 | 
				
			||||||
 | 
							Use:   "cobra",
 | 
				
			||||||
 | 
							Short: "A generator for Cobra based Applications",
 | 
				
			||||||
 | 
							Long: `Cobra is a CLI library for Go that empowers applications.
 | 
				
			||||||
 | 
					This application is a tool to generate the needed files
 | 
				
			||||||
 | 
					to quickly create a Cobra application.`,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Execute executes the root command.
 | 
				
			||||||
 | 
					func Execute() error {
 | 
				
			||||||
 | 
						return rootCmd.Execute()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
	cobra.OnInitialize(initConfig)
 | 
						cobra.OnInitialize(initConfig)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)")
 | 
						rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)")
 | 
				
			||||||
  rootCmd.PersistentFlags().StringVarP(&projectBase, "projectbase", "b", "", "base project directory eg. github.com/spf13/")
 | 
						rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "author name for copyright attribution")
 | 
				
			||||||
  rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "Author name for copyright attribution")
 | 
						rootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "name of license for the project")
 | 
				
			||||||
  rootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "Name of license for the project (can provide `licensetext` in config)")
 | 
						rootCmd.PersistentFlags().Bool("viper", true, "use Viper for configuration")
 | 
				
			||||||
  rootCmd.PersistentFlags().Bool("viper", true, "Use Viper for configuration")
 | 
					 | 
				
			||||||
	viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author"))
 | 
						viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author"))
 | 
				
			||||||
  viper.BindPFlag("projectbase", rootCmd.PersistentFlags().Lookup("projectbase"))
 | 
					 | 
				
			||||||
	viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper"))
 | 
						viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper"))
 | 
				
			||||||
	viper.SetDefault("author", "NAME HERE <EMAIL ADDRESS>")
 | 
						viper.SetDefault("author", "NAME HERE <EMAIL ADDRESS>")
 | 
				
			||||||
	viper.SetDefault("license", "apache")
 | 
						viper.SetDefault("license", "apache")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						rootCmd.AddCommand(addCmd)
 | 
				
			||||||
 | 
						rootCmd.AddCommand(initCmd)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func er(msg interface{}) {
 | 
				
			||||||
 | 
						fmt.Println("Error:", msg)
 | 
				
			||||||
 | 
						os.Exit(1)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func initConfig() {
 | 
					func initConfig() {
 | 
				
			||||||
  // Don't forget to read config either from cfgFile or from home directory!
 | 
					 | 
				
			||||||
	if cfgFile != "" {
 | 
						if cfgFile != "" {
 | 
				
			||||||
		// Use config file from the flag.
 | 
							// Use config file from the flag.
 | 
				
			||||||
		viper.SetConfigFile(cfgFile)
 | 
							viper.SetConfigFile(cfgFile)
 | 
				
			||||||
@@ -238,8 +269,7 @@ func initConfig() {
 | 
				
			|||||||
		// Find home directory.
 | 
							// Find home directory.
 | 
				
			||||||
		home, err := homedir.Dir()
 | 
							home, err := homedir.Dir()
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
      fmt.Println(err)
 | 
								er(err)
 | 
				
			||||||
      os.Exit(1)
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Search config in home directory with name ".cobra" (without extension).
 | 
							// Search config in home directory with name ".cobra" (without extension).
 | 
				
			||||||
@@ -247,9 +277,10 @@ func initConfig() {
 | 
				
			|||||||
		viper.SetConfigName(".cobra")
 | 
							viper.SetConfigName(".cobra")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if err := viper.ReadInConfig(); err != nil {
 | 
						viper.AutomaticEnv()
 | 
				
			||||||
    fmt.Println("Can't read config:", err)
 | 
					
 | 
				
			||||||
    os.Exit(1)
 | 
						if err := viper.ReadInConfig(); err == nil {
 | 
				
			||||||
 | 
							fmt.Println("Using config file:", viper.ConfigFileUsed())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
@@ -265,9 +296,6 @@ In a Cobra app, typically the main.go file is very bare. It serves, one purpose,
 | 
				
			|||||||
package main
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
  "fmt"
 | 
					 | 
				
			||||||
  "os"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  "{pathToYourApp}/cmd"
 | 
					  "{pathToYourApp}/cmd"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -339,7 +367,7 @@ rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose out
 | 
				
			|||||||
A flag can also be assigned locally which will only apply to that specific command.
 | 
					A flag can also be assigned locally which will only apply to that specific command.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```go
 | 
					```go
 | 
				
			||||||
rootCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from")
 | 
					localCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from")
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Local Flag on Parent Commands
 | 
					### Local Flag on Parent Commands
 | 
				
			||||||
@@ -395,6 +423,7 @@ The following validators are built in:
 | 
				
			|||||||
- `MinimumNArgs(int)` - the command will report an error if there are not at least N positional args.
 | 
					- `MinimumNArgs(int)` - the command will report an error if there are not at least N positional args.
 | 
				
			||||||
- `MaximumNArgs(int)` - the command will report an error if there are more than N positional args.
 | 
					- `MaximumNArgs(int)` - the command will report an error if there are more than N positional args.
 | 
				
			||||||
- `ExactArgs(int)` - the command will report an error if there are not exactly N positional args.
 | 
					- `ExactArgs(int)` - the command will report an error if there are not exactly N positional args.
 | 
				
			||||||
 | 
					- `ExactValidArgs(int)` - the command will report an error if there are not exactly N positional args OR if there are any positional args that are not in the `ValidArgs` field of `Command`
 | 
				
			||||||
- `RangeArgs(min, max)` - the command will report an error if the number of args is not between the minimum and maximum number of expected args.
 | 
					- `RangeArgs(min, max)` - the command will report an error if the number of args is not between the minimum and maximum number of expected args.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
An example of setting the custom validator:
 | 
					An example of setting the custom validator:
 | 
				
			||||||
@@ -404,7 +433,7 @@ var cmd = &cobra.Command{
 | 
				
			|||||||
  Short: "hello",
 | 
					  Short: "hello",
 | 
				
			||||||
  Args: func(cmd *cobra.Command, args []string) error {
 | 
					  Args: func(cmd *cobra.Command, args []string) error {
 | 
				
			||||||
    if len(args) < 1 {
 | 
					    if len(args) < 1 {
 | 
				
			||||||
      return errors.New("requires at least one arg")
 | 
					      return errors.New("requires a color argument")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if myapp.IsValidColor(args[0]) {
 | 
					    if myapp.IsValidColor(args[0]) {
 | 
				
			||||||
      return nil
 | 
					      return nil
 | 
				
			||||||
@@ -459,12 +488,12 @@ For many years people have printed back to the screen.`,
 | 
				
			|||||||
Echo works a lot like print, except it has a child command.`,
 | 
					Echo works a lot like print, except it has a child command.`,
 | 
				
			||||||
    Args: cobra.MinimumNArgs(1),
 | 
					    Args: cobra.MinimumNArgs(1),
 | 
				
			||||||
    Run: func(cmd *cobra.Command, args []string) {
 | 
					    Run: func(cmd *cobra.Command, args []string) {
 | 
				
			||||||
      fmt.Println("Print: " + strings.Join(args, " "))
 | 
					      fmt.Println("Echo: " + strings.Join(args, " "))
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  var cmdTimes = &cobra.Command{
 | 
					  var cmdTimes = &cobra.Command{
 | 
				
			||||||
    Use:   "times [# times] [string to echo]",
 | 
					    Use:   "times [string to echo]",
 | 
				
			||||||
    Short: "Echo anything to the screen more times",
 | 
					    Short: "Echo anything to the screen more times",
 | 
				
			||||||
    Long: `echo things multiple times back to the user by providing
 | 
					    Long: `echo things multiple times back to the user by providing
 | 
				
			||||||
a count and a string.`,
 | 
					a count and a string.`,
 | 
				
			||||||
@@ -721,6 +750,11 @@ Cobra can generate documentation based on subcommands, flags, etc. in the follow
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Cobra can generate a bash-completion file. If you add more information to your command, these completions can be amazingly powerful and flexible.  Read more about it in [Bash Completions](bash_completions.md).
 | 
					Cobra can generate a bash-completion file. If you add more information to your command, these completions can be amazingly powerful and flexible.  Read more about it in [Bash Completions](bash_completions.md).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Generating zsh completions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Cobra can generate zsh-completion file. Read more about it in
 | 
				
			||||||
 | 
					[Zsh Completions](zsh_completions.md).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Contributing
 | 
					# Contributing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
1. Fork it
 | 
					1. Fork it
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										22
									
								
								vendor/github.com/spf13/cobra/args.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								vendor/github.com/spf13/cobra/args.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -2,6 +2,7 @@ package cobra
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
 | 
						"strings"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type PositionalArgs func(cmd *Command, args []string) error
 | 
					type PositionalArgs func(cmd *Command, args []string) error
 | 
				
			||||||
@@ -34,8 +35,15 @@ func NoArgs(cmd *Command, args []string) error {
 | 
				
			|||||||
// OnlyValidArgs returns an error if any args are not in the list of ValidArgs.
 | 
					// OnlyValidArgs returns an error if any args are not in the list of ValidArgs.
 | 
				
			||||||
func OnlyValidArgs(cmd *Command, args []string) error {
 | 
					func OnlyValidArgs(cmd *Command, args []string) error {
 | 
				
			||||||
	if len(cmd.ValidArgs) > 0 {
 | 
						if len(cmd.ValidArgs) > 0 {
 | 
				
			||||||
 | 
							// Remove any description that may be included in ValidArgs.
 | 
				
			||||||
 | 
							// A description is following a tab character.
 | 
				
			||||||
 | 
							var validArgs []string
 | 
				
			||||||
 | 
							for _, v := range cmd.ValidArgs {
 | 
				
			||||||
 | 
								validArgs = append(validArgs, strings.Split(v, "\t")[0])
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for _, v := range args {
 | 
							for _, v := range args {
 | 
				
			||||||
			if !stringInSlice(v, cmd.ValidArgs) {
 | 
								if !stringInSlice(v, validArgs) {
 | 
				
			||||||
				return fmt.Errorf("invalid argument %q for %q%s", v, cmd.CommandPath(), cmd.findSuggestions(args[0]))
 | 
									return fmt.Errorf("invalid argument %q for %q%s", v, cmd.CommandPath(), cmd.findSuggestions(args[0]))
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -78,6 +86,18 @@ func ExactArgs(n int) PositionalArgs {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ExactValidArgs returns an error if
 | 
				
			||||||
 | 
					// there are not exactly N positional args OR
 | 
				
			||||||
 | 
					// there are any positional args that are not in the `ValidArgs` field of `Command`
 | 
				
			||||||
 | 
					func ExactValidArgs(n int) PositionalArgs {
 | 
				
			||||||
 | 
						return func(cmd *Command, args []string) error {
 | 
				
			||||||
 | 
							if err := ExactArgs(n)(cmd, args); err != nil {
 | 
				
			||||||
 | 
								return err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return OnlyValidArgs(cmd, args)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// RangeArgs returns an error if the number of args is not within the expected range.
 | 
					// RangeArgs returns an error if the number of args is not within the expected range.
 | 
				
			||||||
func RangeArgs(min int, max int) PositionalArgs {
 | 
					func RangeArgs(min int, max int) PositionalArgs {
 | 
				
			||||||
	return func(cmd *Command, args []string) error {
 | 
						return func(cmd *Command, args []string) error {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										165
									
								
								vendor/github.com/spf13/cobra/bash_completions.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										165
									
								
								vendor/github.com/spf13/cobra/bash_completions.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -58,9 +58,71 @@ __%[1]s_contains_word()
 | 
				
			|||||||
    return 1
 | 
					    return 1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__%[1]s_handle_go_custom_completion()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    __%[1]s_debug "${FUNCNAME[0]}: cur is ${cur}, words[*] is ${words[*]}, #words[@] is ${#words[@]}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    local out requestComp lastParam lastChar comp directive args
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Prepare the command to request completions for the program.
 | 
				
			||||||
 | 
					    # Calling ${words[0]} instead of directly %[1]s allows to handle aliases
 | 
				
			||||||
 | 
					    args=("${words[@]:1}")
 | 
				
			||||||
 | 
					    requestComp="${words[0]} %[2]s ${args[*]}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    lastParam=${words[$((${#words[@]}-1))]}
 | 
				
			||||||
 | 
					    lastChar=${lastParam:$((${#lastParam}-1)):1}
 | 
				
			||||||
 | 
					    __%[1]s_debug "${FUNCNAME[0]}: lastParam ${lastParam}, lastChar ${lastChar}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [ -z "${cur}" ] && [ "${lastChar}" != "=" ]; then
 | 
				
			||||||
 | 
					        # If the last parameter is complete (there is a space following it)
 | 
				
			||||||
 | 
					        # We add an extra empty parameter so we can indicate this to the go method.
 | 
				
			||||||
 | 
					        __%[1]s_debug "${FUNCNAME[0]}: Adding extra empty parameter"
 | 
				
			||||||
 | 
					        requestComp="${requestComp} \"\""
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __%[1]s_debug "${FUNCNAME[0]}: calling ${requestComp}"
 | 
				
			||||||
 | 
					    # Use eval to handle any environment variables and such
 | 
				
			||||||
 | 
					    out=$(eval "${requestComp}" 2>/dev/null)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Extract the directive integer at the very end of the output following a colon (:)
 | 
				
			||||||
 | 
					    directive=${out##*:}
 | 
				
			||||||
 | 
					    # Remove the directive
 | 
				
			||||||
 | 
					    out=${out%%:*}
 | 
				
			||||||
 | 
					    if [ "${directive}" = "${out}" ]; then
 | 
				
			||||||
 | 
					        # There is not directive specified
 | 
				
			||||||
 | 
					        directive=0
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					    __%[1]s_debug "${FUNCNAME[0]}: the completion directive is: ${directive}"
 | 
				
			||||||
 | 
					    __%[1]s_debug "${FUNCNAME[0]}: the completions are: ${out[*]}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [ $((directive & %[3]d)) -ne 0 ]; then
 | 
				
			||||||
 | 
					        # Error code.  No completion.
 | 
				
			||||||
 | 
					        __%[1]s_debug "${FUNCNAME[0]}: received error from custom completion go code"
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        if [ $((directive & %[4]d)) -ne 0 ]; then
 | 
				
			||||||
 | 
					            if [[ $(type -t compopt) = "builtin" ]]; then
 | 
				
			||||||
 | 
					                __%[1]s_debug "${FUNCNAME[0]}: activating no space"
 | 
				
			||||||
 | 
					                compopt -o nospace
 | 
				
			||||||
 | 
					            fi
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					        if [ $((directive & %[5]d)) -ne 0 ]; then
 | 
				
			||||||
 | 
					            if [[ $(type -t compopt) = "builtin" ]]; then
 | 
				
			||||||
 | 
					                __%[1]s_debug "${FUNCNAME[0]}: activating no file completion"
 | 
				
			||||||
 | 
					                compopt +o default
 | 
				
			||||||
 | 
					            fi
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        while IFS='' read -r comp; do
 | 
				
			||||||
 | 
					            COMPREPLY+=("$comp")
 | 
				
			||||||
 | 
					        done < <(compgen -W "${out[*]}" -- "$cur")
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__%[1]s_handle_reply()
 | 
					__%[1]s_handle_reply()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    __%[1]s_debug "${FUNCNAME[0]}"
 | 
					    __%[1]s_debug "${FUNCNAME[0]}"
 | 
				
			||||||
 | 
					    local comp
 | 
				
			||||||
    case $cur in
 | 
					    case $cur in
 | 
				
			||||||
        -*)
 | 
					        -*)
 | 
				
			||||||
            if [[ $(type -t compopt) = "builtin" ]]; then
 | 
					            if [[ $(type -t compopt) = "builtin" ]]; then
 | 
				
			||||||
@@ -72,7 +134,9 @@ __%[1]s_handle_reply()
 | 
				
			|||||||
            else
 | 
					            else
 | 
				
			||||||
                allflags=("${flags[*]} ${two_word_flags[*]}")
 | 
					                allflags=("${flags[*]} ${two_word_flags[*]}")
 | 
				
			||||||
            fi
 | 
					            fi
 | 
				
			||||||
            COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") )
 | 
					            while IFS='' read -r comp; do
 | 
				
			||||||
 | 
					                COMPREPLY+=("$comp")
 | 
				
			||||||
 | 
					            done < <(compgen -W "${allflags[*]}" -- "$cur")
 | 
				
			||||||
            if [[ $(type -t compopt) = "builtin" ]]; then
 | 
					            if [[ $(type -t compopt) = "builtin" ]]; then
 | 
				
			||||||
                [[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace
 | 
					                [[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace
 | 
				
			||||||
            fi
 | 
					            fi
 | 
				
			||||||
@@ -118,19 +182,33 @@ __%[1]s_handle_reply()
 | 
				
			|||||||
    completions=("${commands[@]}")
 | 
					    completions=("${commands[@]}")
 | 
				
			||||||
    if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then
 | 
					    if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then
 | 
				
			||||||
        completions=("${must_have_one_noun[@]}")
 | 
					        completions=("${must_have_one_noun[@]}")
 | 
				
			||||||
 | 
					    elif [[ -n "${has_completion_function}" ]]; then
 | 
				
			||||||
 | 
					        # if a go completion function is provided, defer to that function
 | 
				
			||||||
 | 
					        completions=()
 | 
				
			||||||
 | 
					        __%[1]s_handle_go_custom_completion
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
 | 
					    if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
 | 
				
			||||||
        completions+=("${must_have_one_flag[@]}")
 | 
					        completions+=("${must_have_one_flag[@]}")
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") )
 | 
					    while IFS='' read -r comp; do
 | 
				
			||||||
 | 
					        COMPREPLY+=("$comp")
 | 
				
			||||||
 | 
					    done < <(compgen -W "${completions[*]}" -- "$cur")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then
 | 
					    if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then
 | 
				
			||||||
        COMPREPLY=( $(compgen -W "${noun_aliases[*]}" -- "$cur") )
 | 
					        while IFS='' read -r comp; do
 | 
				
			||||||
 | 
					            COMPREPLY+=("$comp")
 | 
				
			||||||
 | 
					        done < <(compgen -W "${noun_aliases[*]}" -- "$cur")
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
 | 
					    if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
 | 
				
			||||||
 | 
							if declare -F __%[1]s_custom_func >/dev/null; then
 | 
				
			||||||
 | 
								# try command name qualified custom func
 | 
				
			||||||
 | 
								__%[1]s_custom_func
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								# otherwise fall back to unqualified for compatibility
 | 
				
			||||||
			declare -F __custom_func >/dev/null && __custom_func
 | 
								declare -F __custom_func >/dev/null && __custom_func
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # available in bash-completion >= 2, not always present on macOS
 | 
					    # available in bash-completion >= 2, not always present on macOS
 | 
				
			||||||
    if declare -F __ltrim_colon_completions >/dev/null; then
 | 
					    if declare -F __ltrim_colon_completions >/dev/null; then
 | 
				
			||||||
@@ -154,7 +232,7 @@ __%[1]s_handle_filename_extension_flag()
 | 
				
			|||||||
__%[1]s_handle_subdirs_in_dir_flag()
 | 
					__%[1]s_handle_subdirs_in_dir_flag()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    local dir="$1"
 | 
					    local dir="$1"
 | 
				
			||||||
    pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1
 | 
					    pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || return
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__%[1]s_handle_flag()
 | 
					__%[1]s_handle_flag()
 | 
				
			||||||
@@ -193,7 +271,8 @@ __%[1]s_handle_flag()
 | 
				
			|||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # skip the argument to a two word flag
 | 
					    # skip the argument to a two word flag
 | 
				
			||||||
    if __%[1]s_contains_word "${words[c]}" "${two_word_flags[@]}"; then
 | 
					    if [[ ${words[c]} != *"="* ]] && __%[1]s_contains_word "${words[c]}" "${two_word_flags[@]}"; then
 | 
				
			||||||
 | 
								  __%[1]s_debug "${FUNCNAME[0]}: found a flag ${words[c]}, skip the next argument"
 | 
				
			||||||
        c=$((c+1))
 | 
					        c=$((c+1))
 | 
				
			||||||
        # if we are looking for a flags value, don't show commands
 | 
					        # if we are looking for a flags value, don't show commands
 | 
				
			||||||
        if [[ $c -eq $cword ]]; then
 | 
					        if [[ $c -eq $cword ]]; then
 | 
				
			||||||
@@ -265,7 +344,7 @@ __%[1]s_handle_word()
 | 
				
			|||||||
    __%[1]s_handle_word
 | 
					    __%[1]s_handle_word
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
`, name))
 | 
					`, name, ShellCompNoDescRequestCmd, ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func writePostscript(buf *bytes.Buffer, name string) {
 | 
					func writePostscript(buf *bytes.Buffer, name string) {
 | 
				
			||||||
@@ -290,6 +369,7 @@ func writePostscript(buf *bytes.Buffer, name string) {
 | 
				
			|||||||
    local commands=("%[1]s")
 | 
					    local commands=("%[1]s")
 | 
				
			||||||
    local must_have_one_flag=()
 | 
					    local must_have_one_flag=()
 | 
				
			||||||
    local must_have_one_noun=()
 | 
					    local must_have_one_noun=()
 | 
				
			||||||
 | 
					    local has_completion_function
 | 
				
			||||||
    local last_command
 | 
					    local last_command
 | 
				
			||||||
    local nouns=()
 | 
					    local nouns=()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -373,6 +453,10 @@ func writeFlag(buf *bytes.Buffer, flag *pflag.Flag, cmd *Command) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	format += "\")\n"
 | 
						format += "\")\n"
 | 
				
			||||||
	buf.WriteString(fmt.Sprintf(format, name))
 | 
						buf.WriteString(fmt.Sprintf(format, name))
 | 
				
			||||||
 | 
						if len(flag.NoOptDefVal) == 0 {
 | 
				
			||||||
 | 
							format = "    two_word_flags+=(\"--%s\")\n"
 | 
				
			||||||
 | 
							buf.WriteString(fmt.Sprintf(format, name))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	writeFlagHandler(buf, "--"+name, flag.Annotations, cmd)
 | 
						writeFlagHandler(buf, "--"+name, flag.Annotations, cmd)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -386,7 +470,22 @@ func writeLocalNonPersistentFlag(buf *bytes.Buffer, flag *pflag.Flag) {
 | 
				
			|||||||
	buf.WriteString(fmt.Sprintf(format, name))
 | 
						buf.WriteString(fmt.Sprintf(format, name))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Setup annotations for go completions for registered flags
 | 
				
			||||||
 | 
					func prepareCustomAnnotationsForFlags(cmd *Command) {
 | 
				
			||||||
 | 
						for flag := range flagCompletionFunctions {
 | 
				
			||||||
 | 
							// Make sure the completion script calls the __*_go_custom_completion function for
 | 
				
			||||||
 | 
							// every registered flag.  We need to do this here (and not when the flag was registered
 | 
				
			||||||
 | 
							// for completion) so that we can know the root command name for the prefix
 | 
				
			||||||
 | 
							// of __<prefix>_go_custom_completion
 | 
				
			||||||
 | 
							if flag.Annotations == nil {
 | 
				
			||||||
 | 
								flag.Annotations = map[string][]string{}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							flag.Annotations[BashCompCustom] = []string{fmt.Sprintf("__%[1]s_handle_go_custom_completion", cmd.Root().Name())}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func writeFlags(buf *bytes.Buffer, cmd *Command) {
 | 
					func writeFlags(buf *bytes.Buffer, cmd *Command) {
 | 
				
			||||||
 | 
						prepareCustomAnnotationsForFlags(cmd)
 | 
				
			||||||
	buf.WriteString(`    flags=()
 | 
						buf.WriteString(`    flags=()
 | 
				
			||||||
    two_word_flags=()
 | 
					    two_word_flags=()
 | 
				
			||||||
    local_nonpersistent_flags=()
 | 
					    local_nonpersistent_flags=()
 | 
				
			||||||
@@ -449,8 +548,14 @@ func writeRequiredNouns(buf *bytes.Buffer, cmd *Command) {
 | 
				
			|||||||
	buf.WriteString("    must_have_one_noun=()\n")
 | 
						buf.WriteString("    must_have_one_noun=()\n")
 | 
				
			||||||
	sort.Sort(sort.StringSlice(cmd.ValidArgs))
 | 
						sort.Sort(sort.StringSlice(cmd.ValidArgs))
 | 
				
			||||||
	for _, value := range cmd.ValidArgs {
 | 
						for _, value := range cmd.ValidArgs {
 | 
				
			||||||
 | 
							// Remove any description that may be included following a tab character.
 | 
				
			||||||
 | 
							// Descriptions are not supported by bash completion.
 | 
				
			||||||
 | 
							value = strings.Split(value, "\t")[0]
 | 
				
			||||||
		buf.WriteString(fmt.Sprintf("    must_have_one_noun+=(%q)\n", value))
 | 
							buf.WriteString(fmt.Sprintf("    must_have_one_noun+=(%q)\n", value))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if cmd.ValidArgsFunction != nil {
 | 
				
			||||||
 | 
							buf.WriteString("    has_completion_function=1\n")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func writeCmdAliases(buf *bytes.Buffer, cmd *Command) {
 | 
					func writeCmdAliases(buf *bytes.Buffer, cmd *Command) {
 | 
				
			||||||
@@ -534,51 +639,3 @@ func (c *Command) GenBashCompletionFile(filename string) error {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	return c.GenBashCompletion(outFile)
 | 
						return c.GenBashCompletion(outFile)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag if it exists,
 | 
					 | 
				
			||||||
// and causes your command to report an error if invoked without the flag.
 | 
					 | 
				
			||||||
func (c *Command) MarkFlagRequired(name string) error {
 | 
					 | 
				
			||||||
	return MarkFlagRequired(c.Flags(), name)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// MarkPersistentFlagRequired adds the BashCompOneRequiredFlag annotation to the named persistent flag if it exists,
 | 
					 | 
				
			||||||
// and causes your command to report an error if invoked without the flag.
 | 
					 | 
				
			||||||
func (c *Command) MarkPersistentFlagRequired(name string) error {
 | 
					 | 
				
			||||||
	return MarkFlagRequired(c.PersistentFlags(), name)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag if it exists,
 | 
					 | 
				
			||||||
// and causes your command to report an error if invoked without the flag.
 | 
					 | 
				
			||||||
func MarkFlagRequired(flags *pflag.FlagSet, name string) error {
 | 
					 | 
				
			||||||
	return flags.SetAnnotation(name, BashCompOneRequiredFlag, []string{"true"})
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag, if it exists.
 | 
					 | 
				
			||||||
// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided.
 | 
					 | 
				
			||||||
func (c *Command) MarkFlagFilename(name string, extensions ...string) error {
 | 
					 | 
				
			||||||
	return MarkFlagFilename(c.Flags(), name, extensions...)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists.
 | 
					 | 
				
			||||||
// Generated bash autocompletion will call the bash function f for the flag.
 | 
					 | 
				
			||||||
func (c *Command) MarkFlagCustom(name string, f string) error {
 | 
					 | 
				
			||||||
	return MarkFlagCustom(c.Flags(), name, f)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// MarkPersistentFlagFilename adds the BashCompFilenameExt annotation to the named persistent flag, if it exists.
 | 
					 | 
				
			||||||
// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided.
 | 
					 | 
				
			||||||
func (c *Command) MarkPersistentFlagFilename(name string, extensions ...string) error {
 | 
					 | 
				
			||||||
	return MarkFlagFilename(c.PersistentFlags(), name, extensions...)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag in the flag set, if it exists.
 | 
					 | 
				
			||||||
// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided.
 | 
					 | 
				
			||||||
func MarkFlagFilename(flags *pflag.FlagSet, name string, extensions ...string) error {
 | 
					 | 
				
			||||||
	return flags.SetAnnotation(name, BashCompFilenameExt, extensions)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// MarkFlagCustom adds the BashCompCustom annotation to the named flag in the flag set, if it exists.
 | 
					 | 
				
			||||||
// Generated bash autocompletion will call the bash function f for the flag.
 | 
					 | 
				
			||||||
func MarkFlagCustom(flags *pflag.FlagSet, name string, f string) error {
 | 
					 | 
				
			||||||
	return flags.SetAnnotation(name, BashCompCustom, []string{f})
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										278
									
								
								vendor/github.com/spf13/cobra/bash_completions.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										278
									
								
								vendor/github.com/spf13/cobra/bash_completions.md
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,40 @@
 | 
				
			|||||||
# Generating Bash Completions For Your Own cobra.Command
 | 
					# Generating Bash Completions For Your Own cobra.Command
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you are using the generator you can create a completion command by running
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					cobra add completion
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Update the help text show how to install the bash_completion Linux show here [Kubectl docs show mac options](https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Writing the shell script to stdout allows the most flexible use.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```go
 | 
				
			||||||
 | 
					// completionCmd represents the completion command
 | 
				
			||||||
 | 
					var completionCmd = &cobra.Command{
 | 
				
			||||||
 | 
						Use:   "completion",
 | 
				
			||||||
 | 
						Short: "Generates bash completion scripts",
 | 
				
			||||||
 | 
						Long: `To load completion run
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					. <(bitbucket completion)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To configure your bash shell to load completions for each session add to your bashrc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ~/.bashrc or ~/.profile
 | 
				
			||||||
 | 
					. <(bitbucket completion)
 | 
				
			||||||
 | 
					`,
 | 
				
			||||||
 | 
						Run: func(cmd *cobra.Command, args []string) {
 | 
				
			||||||
 | 
							rootCmd.GenBashCompletion(os.Stdout);
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Note:** The cobra generator may include messages printed to stdout for example if the config file is loaded, this will break the auto complete script
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Example from kubectl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Generating bash completions from a cobra command is incredibly easy. An actual program which does so for the kubernetes kubectl binary is as follows:
 | 
					Generating bash completions from a cobra command is incredibly easy. An actual program which does so for the kubernetes kubectl binary is as follows:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```go
 | 
					```go
 | 
				
			||||||
@@ -21,7 +56,149 @@ func main() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
`out.sh` will get you completions of subcommands and flags. Copy it to `/etc/bash_completion.d/` as described [here](https://debian-administration.org/article/316/An_introduction_to_bash_completion_part_1) and reset your terminal to use autocompletion. If you make additional annotations to your code, you can get even more intelligent and flexible behavior.
 | 
					`out.sh` will get you completions of subcommands and flags. Copy it to `/etc/bash_completion.d/` as described [here](https://debian-administration.org/article/316/An_introduction_to_bash_completion_part_1) and reset your terminal to use autocompletion. If you make additional annotations to your code, you can get even more intelligent and flexible behavior.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Creating your own custom functions
 | 
					## Have the completions code complete your 'nouns'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Static completion of nouns
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This method allows you to provide a pre-defined list of completion choices for your nouns using the `validArgs` field.
 | 
				
			||||||
 | 
					For example, if you want `kubectl get [tab][tab]` to show a list of valid "nouns" you have to set them. Simplified code from `kubectl get` looks like:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```go
 | 
				
			||||||
 | 
					validArgs []string = { "pod", "node", "service", "replicationcontroller" }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cmd := &cobra.Command{
 | 
				
			||||||
 | 
						Use:     "get [(-o|--output=)json|yaml|template|...] (RESOURCE [NAME] | RESOURCE/NAME ...)",
 | 
				
			||||||
 | 
						Short:   "Display one or many resources",
 | 
				
			||||||
 | 
						Long:    get_long,
 | 
				
			||||||
 | 
						Example: get_example,
 | 
				
			||||||
 | 
						Run: func(cmd *cobra.Command, args []string) {
 | 
				
			||||||
 | 
							err := RunGet(f, out, cmd, args)
 | 
				
			||||||
 | 
							util.CheckErr(err)
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						ValidArgs: validArgs,
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Notice we put the "ValidArgs" on the "get" subcommand. Doing so will give results like
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					# kubectl get [tab][tab]
 | 
				
			||||||
 | 
					node                 pod                    replicationcontroller  service
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Plural form and shortcuts for nouns
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If your nouns have a number of aliases, you can define them alongside `ValidArgs` using `ArgAliases`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```go
 | 
				
			||||||
 | 
					argAliases []string = { "pods", "nodes", "services", "svc", "replicationcontrollers", "rc" }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cmd := &cobra.Command{
 | 
				
			||||||
 | 
					    ...
 | 
				
			||||||
 | 
						ValidArgs:  validArgs,
 | 
				
			||||||
 | 
						ArgAliases: argAliases
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The aliases are not shown to the user on tab completion, but they are accepted as valid nouns by
 | 
				
			||||||
 | 
					the completion algorithm if entered manually, e.g. in:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					# kubectl get rc [tab][tab]
 | 
				
			||||||
 | 
					backend        frontend       database 
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Note that without declaring `rc` as an alias, the completion algorithm would show the list of nouns
 | 
				
			||||||
 | 
					in this example again instead of the replication controllers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Dynamic completion of nouns
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In some cases it is not possible to provide a list of possible completions in advance.  Instead, the list of completions must be determined at execution-time.  Cobra provides two ways of defining such dynamic completion of nouns. Note that both these methods can be used along-side each other as long as they are not both used for the same command.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Note**: *Custom Completions written in Go* will automatically work for other shell-completion scripts (e.g., Fish shell), while *Custom Completions written in Bash* will only work for Bash shell-completion.  It is therefore recommended to use *Custom Completions written in Go*.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### 1. Custom completions of nouns written in Go
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In a similar fashion as for static completions, you can use the `ValidArgsFunction` field to provide a Go function that Cobra will execute when it needs the list of completion choices for the nouns of a command.  Note that either `ValidArgs` or `ValidArgsFunction` can be used for a single cobra command, but not both.
 | 
				
			||||||
 | 
					Simplified code from `helm status` looks like:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```go
 | 
				
			||||||
 | 
					cmd := &cobra.Command{
 | 
				
			||||||
 | 
						Use:   "status RELEASE_NAME",
 | 
				
			||||||
 | 
						Short: "Display the status of the named release",
 | 
				
			||||||
 | 
						Long:  status_long,
 | 
				
			||||||
 | 
						RunE: func(cmd *cobra.Command, args []string) {
 | 
				
			||||||
 | 
							RunGet(args[0])
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
 | 
				
			||||||
 | 
							if len(args) != 0 {
 | 
				
			||||||
 | 
								return nil, cobra.ShellCompDirectiveNoFileComp
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return getReleasesFromCluster(toComplete), cobra.ShellCompDirectiveNoFileComp
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					Where `getReleasesFromCluster()` is a Go function that obtains the list of current Helm releases running on the Kubernetes cluster.
 | 
				
			||||||
 | 
					Notice we put the `ValidArgsFunction` on the `status` subcommand. Let's assume the Helm releases on the cluster are: `harbor`, `notary`, `rook` and `thanos` then this dynamic completion will give results like
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					# helm status [tab][tab]
 | 
				
			||||||
 | 
					harbor notary rook thanos
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					You may have noticed the use of `cobra.ShellCompDirective`.  These directives are bit fields allowing to control some shell completion behaviors for your particular completion.  You can combine them with the bit-or operator such as `cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp`
 | 
				
			||||||
 | 
					```go
 | 
				
			||||||
 | 
					// Indicates an error occurred and completions should be ignored.
 | 
				
			||||||
 | 
					ShellCompDirectiveError
 | 
				
			||||||
 | 
					// Indicates that the shell should not add a space after the completion,
 | 
				
			||||||
 | 
					// even if there is a single completion provided.
 | 
				
			||||||
 | 
					ShellCompDirectiveNoSpace
 | 
				
			||||||
 | 
					// Indicates that the shell should not provide file completion even when
 | 
				
			||||||
 | 
					// no completion is provided.
 | 
				
			||||||
 | 
					// This currently does not work for zsh or bash < 4
 | 
				
			||||||
 | 
					ShellCompDirectiveNoFileComp
 | 
				
			||||||
 | 
					// Indicates that the shell will perform its default behavior after completions
 | 
				
			||||||
 | 
					// have been provided (this implies !ShellCompDirectiveNoSpace && !ShellCompDirectiveNoFileComp).
 | 
				
			||||||
 | 
					ShellCompDirectiveDefault
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					When using the `ValidArgsFunction`, Cobra will call your registered function after having parsed all flags and arguments provided in the command-line.  You therefore don't need to do this parsing yourself.  For example, when a user calls `helm status --namespace my-rook-ns [tab][tab]`, Cobra will call your registered `ValidArgsFunction` after having parsed the `--namespace` flag, as it would have done when calling the `RunE` function.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##### Debugging
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Cobra achieves dynamic completions written in Go through the use of a hidden command called by the completion script.  To debug your Go completion code, you can call this hidden command directly:
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					# helm __complete status har<ENTER>
 | 
				
			||||||
 | 
					harbor
 | 
				
			||||||
 | 
					:4
 | 
				
			||||||
 | 
					Completion ended with directive: ShellCompDirectiveNoFileComp # This is on stderr
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					***Important:*** If the noun to complete is empty, you must pass an empty parameter to the `__complete` command:
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					# helm __complete status ""<ENTER>
 | 
				
			||||||
 | 
					harbor
 | 
				
			||||||
 | 
					notary
 | 
				
			||||||
 | 
					rook
 | 
				
			||||||
 | 
					thanos
 | 
				
			||||||
 | 
					:4
 | 
				
			||||||
 | 
					Completion ended with directive: ShellCompDirectiveNoFileComp # This is on stderr
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					Calling the `__complete` command directly allows you to run the Go debugger to troubleshoot your code.  You can also add printouts to your code; Cobra provides the following functions to use for printouts in Go completion code:
 | 
				
			||||||
 | 
					```go
 | 
				
			||||||
 | 
					// Prints to the completion script debug file (if BASH_COMP_DEBUG_FILE
 | 
				
			||||||
 | 
					// is set to a file path) and optionally prints to stderr.
 | 
				
			||||||
 | 
					cobra.CompDebug(msg string, printToStdErr bool) {
 | 
				
			||||||
 | 
					cobra.CompDebugln(msg string, printToStdErr bool)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Prints to the completion script debug file (if BASH_COMP_DEBUG_FILE
 | 
				
			||||||
 | 
					// is set to a file path) and to stderr.
 | 
				
			||||||
 | 
					cobra.CompError(msg string)
 | 
				
			||||||
 | 
					cobra.CompErrorln(msg string)
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					***Important:*** You should **not** leave traces that print to stdout in your completion code as they will be interpreted as completion choices by the completion script.  Instead, use the cobra-provided debugging traces functions mentioned above.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### 2. Custom completions of nouns written in Bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This method allows you to inject bash functions into the completion script.  Those bash functions are responsible for providing the completion choices for your own completions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Some more actual code that works in kubernetes:
 | 
					Some more actual code that works in kubernetes:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -47,7 +224,7 @@ __kubectl_get_resource()
 | 
				
			|||||||
    fi
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__custom_func() {
 | 
					__kubectl_custom_func() {
 | 
				
			||||||
    case ${last_command} in
 | 
					    case ${last_command} in
 | 
				
			||||||
        kubectl_get | kubectl_describe | kubectl_delete | kubectl_stop)
 | 
					        kubectl_get | kubectl_describe | kubectl_delete | kubectl_stop)
 | 
				
			||||||
            __kubectl_get_resource
 | 
					            __kubectl_get_resource
 | 
				
			||||||
@@ -74,59 +251,7 @@ Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__custom_func()` to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`.  `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`.  So it will call `__kubectl_parse_get pod`.  `__kubectl_parse_get` will actually call out to kubernetes and get any pods.  It will then set `COMPREPLY` to valid pods!
 | 
					The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__kubectl_custom_func()` (`__<command-use>_custom_func()`) to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__kubectl_customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__kubectl_custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`.  `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`.  So it will call `__kubectl_parse_get pod`.  `__kubectl_parse_get` will actually call out to kubernetes and get any pods.  It will then set `COMPREPLY` to valid pods!
 | 
				
			||||||
 | 
					 | 
				
			||||||
## Have the completions code complete your 'nouns'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
In the above example "pod" was assumed to already be typed. But if you want `kubectl get [tab][tab]` to show a list of valid "nouns" you have to set them. Simplified code from `kubectl get` looks like:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```go
 | 
					 | 
				
			||||||
validArgs []string = { "pod", "node", "service", "replicationcontroller" }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cmd := &cobra.Command{
 | 
					 | 
				
			||||||
	Use:     "get [(-o|--output=)json|yaml|template|...] (RESOURCE [NAME] | RESOURCE/NAME ...)",
 | 
					 | 
				
			||||||
	Short:   "Display one or many resources",
 | 
					 | 
				
			||||||
	Long:    get_long,
 | 
					 | 
				
			||||||
	Example: get_example,
 | 
					 | 
				
			||||||
	Run: func(cmd *cobra.Command, args []string) {
 | 
					 | 
				
			||||||
		err := RunGet(f, out, cmd, args)
 | 
					 | 
				
			||||||
		util.CheckErr(err)
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
	ValidArgs: validArgs,
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Notice we put the "ValidArgs" on the "get" subcommand. Doing so will give results like
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
# kubectl get [tab][tab]
 | 
					 | 
				
			||||||
node                 pod                    replicationcontroller  service
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Plural form and shortcuts for nouns
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
If your nouns have a number of aliases, you can define them alongside `ValidArgs` using `ArgAliases`:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```go
 | 
					 | 
				
			||||||
argAliases []string = { "pods", "nodes", "services", "svc", "replicationcontrollers", "rc" }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cmd := &cobra.Command{
 | 
					 | 
				
			||||||
    ...
 | 
					 | 
				
			||||||
	ValidArgs:  validArgs,
 | 
					 | 
				
			||||||
	ArgAliases: argAliases
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The aliases are not shown to the user on tab completion, but they are accepted as valid nouns by
 | 
					 | 
				
			||||||
the completion algorithm if entered manually, e.g. in:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
# kubectl get rc [tab][tab]
 | 
					 | 
				
			||||||
backend        frontend       database 
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Note that without declaring `rc` as an alias, the completion algorithm would show the list of nouns
 | 
					 | 
				
			||||||
in this example again instead of the replication controllers.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Mark flags as required
 | 
					## Mark flags as required
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -176,8 +301,45 @@ So while there are many other files in the CWD it only shows me subdirs and thos
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Specify custom flag completion
 | 
					# Specify custom flag completion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Similar to the filename completion and filtering using cobra.BashCompFilenameExt, you can specify
 | 
					As for nouns, Cobra provides two ways of defining dynamic completion of flags.  Note that both these methods can be used along-side each other as long as they are not both used for the same flag.
 | 
				
			||||||
a custom flag completion function with cobra.BashCompCustom:
 | 
					
 | 
				
			||||||
 | 
					**Note**: *Custom Completions written in Go* will automatically work for other shell-completion scripts (e.g., Fish shell), while *Custom Completions written in Bash* will only work for Bash shell-completion.  It is therefore recommended to use *Custom Completions written in Go*.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 1. Custom completions of flags written in Go
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To provide a Go function that Cobra will execute when it needs the list of completion choices for a flag, you must register the function in the following manner:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```go
 | 
				
			||||||
 | 
					flagName := "output"
 | 
				
			||||||
 | 
					cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
 | 
				
			||||||
 | 
						return []string{"json", "table", "yaml"}, cobra.ShellCompDirectiveDefault
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					Notice that calling `RegisterFlagCompletionFunc()` is done through the `command` with which the flag is associated.  In our example this dynamic completion will give results like so:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					# helm status --output [tab][tab]
 | 
				
			||||||
 | 
					json table yaml
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Debugging
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can also easily debug your Go completion code for flags:
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					# helm __complete status --output ""
 | 
				
			||||||
 | 
					json
 | 
				
			||||||
 | 
					table
 | 
				
			||||||
 | 
					yaml
 | 
				
			||||||
 | 
					:4
 | 
				
			||||||
 | 
					Completion ended with directive: ShellCompDirectiveNoFileComp # This is on stderr
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					***Important:*** You should **not** leave traces that print to stdout in your completion code as they will be interpreted as completion choices by the completion script.  Instead, use the cobra-provided debugging traces functions mentioned in the above section.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 2. Custom completions of flags written in Bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Alternatively, you can use bash code for flag custom completion. Similar to the filename
 | 
				
			||||||
 | 
					completion and filtering using `cobra.BashCompFilenameExt`, you can specify
 | 
				
			||||||
 | 
					a custom flag completion bash function with `cobra.BashCompCustom`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```go
 | 
					```go
 | 
				
			||||||
	annotation := make(map[string][]string)
 | 
						annotation := make(map[string][]string)
 | 
				
			||||||
@@ -191,7 +353,7 @@ a custom flag completion function with cobra.BashCompCustom:
 | 
				
			|||||||
	cmd.Flags().AddFlag(flag)
 | 
						cmd.Flags().AddFlag(flag)
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
In addition add the `__handle_namespace_flag` implementation in the `BashCompletionFunction`
 | 
					In addition add the `__kubectl_get_namespaces` implementation in the `BashCompletionFunction`
 | 
				
			||||||
value, e.g.:
 | 
					value, e.g.:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```bash
 | 
					```bash
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										9
									
								
								vendor/github.com/spf13/cobra/cobra.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/github.com/spf13/cobra/cobra.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -23,6 +23,7 @@ import (
 | 
				
			|||||||
	"strconv"
 | 
						"strconv"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
	"text/template"
 | 
						"text/template"
 | 
				
			||||||
 | 
						"time"
 | 
				
			||||||
	"unicode"
 | 
						"unicode"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -51,11 +52,17 @@ var EnableCommandSorting = true
 | 
				
			|||||||
// if the CLI is started from explorer.exe.
 | 
					// if the CLI is started from explorer.exe.
 | 
				
			||||||
// To disable the mousetrap, just set this variable to blank string ("").
 | 
					// To disable the mousetrap, just set this variable to blank string ("").
 | 
				
			||||||
// Works only on Microsoft Windows.
 | 
					// Works only on Microsoft Windows.
 | 
				
			||||||
var MousetrapHelpText string = `This is a command line tool.
 | 
					var MousetrapHelpText = `This is a command line tool.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You need to open cmd.exe and run it from there.
 | 
					You need to open cmd.exe and run it from there.
 | 
				
			||||||
`
 | 
					`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// MousetrapDisplayDuration controls how long the MousetrapHelpText message is displayed on Windows
 | 
				
			||||||
 | 
					// if the CLI is started from explorer.exe. Set to 0 to wait for the return key to be pressed.
 | 
				
			||||||
 | 
					// To disable the mousetrap, just set MousetrapHelpText to blank string ("").
 | 
				
			||||||
 | 
					// Works only on Microsoft Windows.
 | 
				
			||||||
 | 
					var MousetrapDisplayDuration = 5 * time.Second
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// AddTemplateFunc adds a template function that's available to Usage and Help
 | 
					// AddTemplateFunc adds a template function that's available to Usage and Help
 | 
				
			||||||
// template generation.
 | 
					// template generation.
 | 
				
			||||||
func AddTemplateFunc(name string, tmplFunc interface{}) {
 | 
					func AddTemplateFunc(name string, tmplFunc interface{}) {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										149
									
								
								vendor/github.com/spf13/cobra/command.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										149
									
								
								vendor/github.com/spf13/cobra/command.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -17,6 +17,7 @@ package cobra
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"bytes"
 | 
						"bytes"
 | 
				
			||||||
 | 
						"context"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
@@ -56,6 +57,10 @@ type Command struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// ValidArgs is list of all valid non-flag arguments that are accepted in bash completions
 | 
						// ValidArgs is list of all valid non-flag arguments that are accepted in bash completions
 | 
				
			||||||
	ValidArgs []string
 | 
						ValidArgs []string
 | 
				
			||||||
 | 
						// ValidArgsFunction is an optional function that provides valid non-flag arguments for bash completion.
 | 
				
			||||||
 | 
						// It is a dynamic version of using ValidArgs.
 | 
				
			||||||
 | 
						// Only one of ValidArgs and ValidArgsFunction can be used for a command.
 | 
				
			||||||
 | 
						ValidArgsFunction func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Expected arguments
 | 
						// Expected arguments
 | 
				
			||||||
	Args PositionalArgs
 | 
						Args PositionalArgs
 | 
				
			||||||
@@ -80,7 +85,8 @@ type Command struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// Version defines the version for this command. If this value is non-empty and the command does not
 | 
						// Version defines the version for this command. If this value is non-empty and the command does not
 | 
				
			||||||
	// define a "version" flag, a "version" boolean flag will be added to the command and, if specified,
 | 
						// define a "version" flag, a "version" boolean flag will be added to the command and, if specified,
 | 
				
			||||||
	// will print content of the "Version" variable.
 | 
						// will print content of the "Version" variable. A shorthand "v" flag will also be added if the
 | 
				
			||||||
 | 
						// command does not define one.
 | 
				
			||||||
	Version string
 | 
						Version string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// The *Run functions are executed in the following order:
 | 
						// The *Run functions are executed in the following order:
 | 
				
			||||||
@@ -140,9 +146,11 @@ type Command struct {
 | 
				
			|||||||
	// TraverseChildren parses flags on all parents before executing child command.
 | 
						// TraverseChildren parses flags on all parents before executing child command.
 | 
				
			||||||
	TraverseChildren bool
 | 
						TraverseChildren bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//FParseErrWhitelist flag parse errors to be ignored
 | 
						// FParseErrWhitelist flag parse errors to be ignored
 | 
				
			||||||
	FParseErrWhitelist FParseErrWhitelist
 | 
						FParseErrWhitelist FParseErrWhitelist
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ctx context.Context
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// commands is the list of commands supported by this program.
 | 
						// commands is the list of commands supported by this program.
 | 
				
			||||||
	commands []*Command
 | 
						commands []*Command
 | 
				
			||||||
	// parent is a parent command for this command.
 | 
						// parent is a parent command for this command.
 | 
				
			||||||
@@ -177,8 +185,6 @@ type Command struct {
 | 
				
			|||||||
	// that we can use on every pflag set and children commands
 | 
						// that we can use on every pflag set and children commands
 | 
				
			||||||
	globNormFunc func(f *flag.FlagSet, name string) flag.NormalizedName
 | 
						globNormFunc func(f *flag.FlagSet, name string) flag.NormalizedName
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// output is an output writer defined by user.
 | 
					 | 
				
			||||||
	output io.Writer
 | 
					 | 
				
			||||||
	// usageFunc is usage func defined by user.
 | 
						// usageFunc is usage func defined by user.
 | 
				
			||||||
	usageFunc func(*Command) error
 | 
						usageFunc func(*Command) error
 | 
				
			||||||
	// usageTemplate is usage template defined by user.
 | 
						// usageTemplate is usage template defined by user.
 | 
				
			||||||
@@ -195,6 +201,19 @@ type Command struct {
 | 
				
			|||||||
	helpCommand *Command
 | 
						helpCommand *Command
 | 
				
			||||||
	// versionTemplate is the version template defined by user.
 | 
						// versionTemplate is the version template defined by user.
 | 
				
			||||||
	versionTemplate string
 | 
						versionTemplate string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// inReader is a reader defined by the user that replaces stdin
 | 
				
			||||||
 | 
						inReader io.Reader
 | 
				
			||||||
 | 
						// outWriter is a writer defined by the user that replaces stdout
 | 
				
			||||||
 | 
						outWriter io.Writer
 | 
				
			||||||
 | 
						// errWriter is a writer defined by the user that replaces stderr
 | 
				
			||||||
 | 
						errWriter io.Writer
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Context returns underlying command context. If command wasn't
 | 
				
			||||||
 | 
					// executed with ExecuteContext Context returns Background context.
 | 
				
			||||||
 | 
					func (c *Command) Context() context.Context {
 | 
				
			||||||
 | 
						return c.ctx
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden
 | 
					// SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden
 | 
				
			||||||
@@ -205,8 +224,28 @@ func (c *Command) SetArgs(a []string) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// SetOutput sets the destination for usage and error messages.
 | 
					// SetOutput sets the destination for usage and error messages.
 | 
				
			||||||
// If output is nil, os.Stderr is used.
 | 
					// If output is nil, os.Stderr is used.
 | 
				
			||||||
 | 
					// Deprecated: Use SetOut and/or SetErr instead
 | 
				
			||||||
func (c *Command) SetOutput(output io.Writer) {
 | 
					func (c *Command) SetOutput(output io.Writer) {
 | 
				
			||||||
	c.output = output
 | 
						c.outWriter = output
 | 
				
			||||||
 | 
						c.errWriter = output
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SetOut sets the destination for usage messages.
 | 
				
			||||||
 | 
					// If newOut is nil, os.Stdout is used.
 | 
				
			||||||
 | 
					func (c *Command) SetOut(newOut io.Writer) {
 | 
				
			||||||
 | 
						c.outWriter = newOut
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SetErr sets the destination for error messages.
 | 
				
			||||||
 | 
					// If newErr is nil, os.Stderr is used.
 | 
				
			||||||
 | 
					func (c *Command) SetErr(newErr io.Writer) {
 | 
				
			||||||
 | 
						c.errWriter = newErr
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SetIn sets the source for input data
 | 
				
			||||||
 | 
					// If newIn is nil, os.Stdin is used.
 | 
				
			||||||
 | 
					func (c *Command) SetIn(newIn io.Reader) {
 | 
				
			||||||
 | 
						c.inReader = newIn
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// SetUsageFunc sets usage function. Usage can be defined by application.
 | 
					// SetUsageFunc sets usage function. Usage can be defined by application.
 | 
				
			||||||
@@ -267,9 +306,19 @@ func (c *Command) OutOrStderr() io.Writer {
 | 
				
			|||||||
	return c.getOut(os.Stderr)
 | 
						return c.getOut(os.Stderr)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ErrOrStderr returns output to stderr
 | 
				
			||||||
 | 
					func (c *Command) ErrOrStderr() io.Writer {
 | 
				
			||||||
 | 
						return c.getErr(os.Stderr)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// InOrStdin returns input to stdin
 | 
				
			||||||
 | 
					func (c *Command) InOrStdin() io.Reader {
 | 
				
			||||||
 | 
						return c.getIn(os.Stdin)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (c *Command) getOut(def io.Writer) io.Writer {
 | 
					func (c *Command) getOut(def io.Writer) io.Writer {
 | 
				
			||||||
	if c.output != nil {
 | 
						if c.outWriter != nil {
 | 
				
			||||||
		return c.output
 | 
							return c.outWriter
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if c.HasParent() {
 | 
						if c.HasParent() {
 | 
				
			||||||
		return c.parent.getOut(def)
 | 
							return c.parent.getOut(def)
 | 
				
			||||||
@@ -277,6 +326,26 @@ func (c *Command) getOut(def io.Writer) io.Writer {
 | 
				
			|||||||
	return def
 | 
						return def
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (c *Command) getErr(def io.Writer) io.Writer {
 | 
				
			||||||
 | 
						if c.errWriter != nil {
 | 
				
			||||||
 | 
							return c.errWriter
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if c.HasParent() {
 | 
				
			||||||
 | 
							return c.parent.getErr(def)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return def
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (c *Command) getIn(def io.Reader) io.Reader {
 | 
				
			||||||
 | 
						if c.inReader != nil {
 | 
				
			||||||
 | 
							return c.inReader
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if c.HasParent() {
 | 
				
			||||||
 | 
							return c.parent.getIn(def)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return def
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// UsageFunc returns either the function set by SetUsageFunc for this command
 | 
					// UsageFunc returns either the function set by SetUsageFunc for this command
 | 
				
			||||||
// or a parent, or it returns a default usage function.
 | 
					// or a parent, or it returns a default usage function.
 | 
				
			||||||
func (c *Command) UsageFunc() (f func(*Command) error) {
 | 
					func (c *Command) UsageFunc() (f func(*Command) error) {
 | 
				
			||||||
@@ -314,6 +383,8 @@ func (c *Command) HelpFunc() func(*Command, []string) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	return func(c *Command, a []string) {
 | 
						return func(c *Command, a []string) {
 | 
				
			||||||
		c.mergePersistentFlags()
 | 
							c.mergePersistentFlags()
 | 
				
			||||||
 | 
							// The help should be sent to stdout
 | 
				
			||||||
 | 
							// See https://github.com/spf13/cobra/issues/1002
 | 
				
			||||||
		err := tmpl(c.OutOrStdout(), c.HelpTemplate(), c)
 | 
							err := tmpl(c.OutOrStdout(), c.HelpTemplate(), c)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			c.Println(err)
 | 
								c.Println(err)
 | 
				
			||||||
@@ -329,13 +400,22 @@ func (c *Command) Help() error {
 | 
				
			|||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// UsageString return usage string.
 | 
					// UsageString returns usage string.
 | 
				
			||||||
func (c *Command) UsageString() string {
 | 
					func (c *Command) UsageString() string {
 | 
				
			||||||
	tmpOutput := c.output
 | 
						// Storing normal writers
 | 
				
			||||||
 | 
						tmpOutput := c.outWriter
 | 
				
			||||||
 | 
						tmpErr := c.errWriter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bb := new(bytes.Buffer)
 | 
						bb := new(bytes.Buffer)
 | 
				
			||||||
	c.SetOutput(bb)
 | 
						c.outWriter = bb
 | 
				
			||||||
 | 
						c.errWriter = bb
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	c.Usage()
 | 
						c.Usage()
 | 
				
			||||||
	c.output = tmpOutput
 | 
					
 | 
				
			||||||
 | 
						// Setting things back to normal
 | 
				
			||||||
 | 
						c.outWriter = tmpOutput
 | 
				
			||||||
 | 
						c.errWriter = tmpErr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return bb.String()
 | 
						return bb.String()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -793,6 +873,13 @@ func (c *Command) preRun() {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ExecuteContext is the same as Execute(), but sets the ctx on the command.
 | 
				
			||||||
 | 
					// Retrieve ctx by calling cmd.Context() inside your *Run lifecycle functions.
 | 
				
			||||||
 | 
					func (c *Command) ExecuteContext(ctx context.Context) error {
 | 
				
			||||||
 | 
						c.ctx = ctx
 | 
				
			||||||
 | 
						return c.Execute()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Execute uses the args (os.Args[1:] by default)
 | 
					// Execute uses the args (os.Args[1:] by default)
 | 
				
			||||||
// and run through the command tree finding appropriate matches
 | 
					// and run through the command tree finding appropriate matches
 | 
				
			||||||
// for commands and then corresponding flags.
 | 
					// for commands and then corresponding flags.
 | 
				
			||||||
@@ -803,6 +890,10 @@ func (c *Command) Execute() error {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// ExecuteC executes the command.
 | 
					// ExecuteC executes the command.
 | 
				
			||||||
func (c *Command) ExecuteC() (cmd *Command, err error) {
 | 
					func (c *Command) ExecuteC() (cmd *Command, err error) {
 | 
				
			||||||
 | 
						if c.ctx == nil {
 | 
				
			||||||
 | 
							c.ctx = context.Background()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Regardless of what command execute is called on, run on Root only
 | 
						// Regardless of what command execute is called on, run on Root only
 | 
				
			||||||
	if c.HasParent() {
 | 
						if c.HasParent() {
 | 
				
			||||||
		return c.Root().ExecuteC()
 | 
							return c.Root().ExecuteC()
 | 
				
			||||||
@@ -817,15 +908,16 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
 | 
				
			|||||||
	// overriding
 | 
						// overriding
 | 
				
			||||||
	c.InitDefaultHelpCmd()
 | 
						c.InitDefaultHelpCmd()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var args []string
 | 
						args := c.args
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Workaround FAIL with "go test -v" or "cobra.test -test.v", see #155
 | 
						// Workaround FAIL with "go test -v" or "cobra.test -test.v", see #155
 | 
				
			||||||
	if c.args == nil && filepath.Base(os.Args[0]) != "cobra.test" {
 | 
						if c.args == nil && filepath.Base(os.Args[0]) != "cobra.test" {
 | 
				
			||||||
		args = os.Args[1:]
 | 
							args = os.Args[1:]
 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		args = c.args
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// initialize the hidden command to be used for bash completion
 | 
				
			||||||
 | 
						c.initCompleteCmd(args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var flags []string
 | 
						var flags []string
 | 
				
			||||||
	if c.TraverseChildren {
 | 
						if c.TraverseChildren {
 | 
				
			||||||
		cmd, flags, err = c.Traverse(args)
 | 
							cmd, flags, err = c.Traverse(args)
 | 
				
			||||||
@@ -849,6 +941,12 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
 | 
				
			|||||||
		cmd.commandCalledAs.name = cmd.Name()
 | 
							cmd.commandCalledAs.name = cmd.Name()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// We have to pass global context to children command
 | 
				
			||||||
 | 
						// if context is present on the parent command.
 | 
				
			||||||
 | 
						if cmd.ctx == nil {
 | 
				
			||||||
 | 
							cmd.ctx = c.ctx
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = cmd.execute(flags)
 | 
						err = cmd.execute(flags)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		// Always show help if requested, even if SilenceErrors is in
 | 
							// Always show help if requested, even if SilenceErrors is in
 | 
				
			||||||
@@ -932,8 +1030,12 @@ func (c *Command) InitDefaultVersionFlag() {
 | 
				
			|||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			usage += c.Name()
 | 
								usage += c.Name()
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							if c.Flags().ShorthandLookup("v") == nil {
 | 
				
			||||||
 | 
								c.Flags().BoolP("version", "v", false, usage)
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
			c.Flags().Bool("version", false, usage)
 | 
								c.Flags().Bool("version", false, usage)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// InitDefaultHelpCmd adds default help command to c.
 | 
					// InitDefaultHelpCmd adds default help command to c.
 | 
				
			||||||
@@ -1070,6 +1172,21 @@ func (c *Command) Printf(format string, i ...interface{}) {
 | 
				
			|||||||
	c.Print(fmt.Sprintf(format, i...))
 | 
						c.Print(fmt.Sprintf(format, i...))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// PrintErr is a convenience method to Print to the defined Err output, fallback to Stderr if not set.
 | 
				
			||||||
 | 
					func (c *Command) PrintErr(i ...interface{}) {
 | 
				
			||||||
 | 
						fmt.Fprint(c.ErrOrStderr(), i...)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// PrintErrln is a convenience method to Println to the defined Err output, fallback to Stderr if not set.
 | 
				
			||||||
 | 
					func (c *Command) PrintErrln(i ...interface{}) {
 | 
				
			||||||
 | 
						c.Print(fmt.Sprintln(i...))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// PrintErrf is a convenience method to Printf to the defined Err output, fallback to Stderr if not set.
 | 
				
			||||||
 | 
					func (c *Command) PrintErrf(format string, i ...interface{}) {
 | 
				
			||||||
 | 
						c.Print(fmt.Sprintf(format, i...))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// CommandPath returns the full path to this command.
 | 
					// CommandPath returns the full path to this command.
 | 
				
			||||||
func (c *Command) CommandPath() string {
 | 
					func (c *Command) CommandPath() string {
 | 
				
			||||||
	if c.HasParent() {
 | 
						if c.HasParent() {
 | 
				
			||||||
@@ -1335,7 +1452,7 @@ func (c *Command) LocalFlags() *flag.FlagSet {
 | 
				
			|||||||
	return c.lflags
 | 
						return c.lflags
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// InheritedFlags returns all flags which were inherited from parents commands.
 | 
					// InheritedFlags returns all flags which were inherited from parent commands.
 | 
				
			||||||
func (c *Command) InheritedFlags() *flag.FlagSet {
 | 
					func (c *Command) InheritedFlags() *flag.FlagSet {
 | 
				
			||||||
	c.mergePersistentFlags()
 | 
						c.mergePersistentFlags()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1470,7 +1587,7 @@ func (c *Command) ParseFlags(args []string) error {
 | 
				
			|||||||
	beforeErrorBufLen := c.flagErrorBuf.Len()
 | 
						beforeErrorBufLen := c.flagErrorBuf.Len()
 | 
				
			||||||
	c.mergePersistentFlags()
 | 
						c.mergePersistentFlags()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//do it here after merging all flags and just before parse
 | 
						// do it here after merging all flags and just before parse
 | 
				
			||||||
	c.Flags().ParseErrorsWhitelist = flag.ParseErrorsWhitelist(c.FParseErrWhitelist)
 | 
						c.Flags().ParseErrorsWhitelist = flag.ParseErrorsWhitelist(c.FParseErrWhitelist)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err := c.Flags().Parse(args)
 | 
						err := c.Flags().Parse(args)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								vendor/github.com/spf13/cobra/command_win.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/spf13/cobra/command_win.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -3,6 +3,7 @@
 | 
				
			|||||||
package cobra
 | 
					package cobra
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"fmt"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -14,7 +15,12 @@ var preExecHookFn = preExecHook
 | 
				
			|||||||
func preExecHook(c *Command) {
 | 
					func preExecHook(c *Command) {
 | 
				
			||||||
	if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {
 | 
						if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {
 | 
				
			||||||
		c.Print(MousetrapHelpText)
 | 
							c.Print(MousetrapHelpText)
 | 
				
			||||||
		time.Sleep(5 * time.Second)
 | 
							if MousetrapDisplayDuration > 0 {
 | 
				
			||||||
 | 
								time.Sleep(MousetrapDisplayDuration)
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								c.Println("Press return to continue...")
 | 
				
			||||||
 | 
								fmt.Scanln()
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		os.Exit(1)
 | 
							os.Exit(1)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										384
									
								
								vendor/github.com/spf13/cobra/custom_completions.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										384
									
								
								vendor/github.com/spf13/cobra/custom_completions.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,384 @@
 | 
				
			|||||||
 | 
					package cobra
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"errors"
 | 
				
			||||||
 | 
						"fmt"
 | 
				
			||||||
 | 
						"os"
 | 
				
			||||||
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/spf13/pflag"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const (
 | 
				
			||||||
 | 
						// ShellCompRequestCmd is the name of the hidden command that is used to request
 | 
				
			||||||
 | 
						// completion results from the program.  It is used by the shell completion scripts.
 | 
				
			||||||
 | 
						ShellCompRequestCmd = "__complete"
 | 
				
			||||||
 | 
						// ShellCompNoDescRequestCmd is the name of the hidden command that is used to request
 | 
				
			||||||
 | 
						// completion results without their description.  It is used by the shell completion scripts.
 | 
				
			||||||
 | 
						ShellCompNoDescRequestCmd = "__completeNoDesc"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Global map of flag completion functions.
 | 
				
			||||||
 | 
					var flagCompletionFunctions = map[*pflag.Flag]func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective){}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ShellCompDirective is a bit map representing the different behaviors the shell
 | 
				
			||||||
 | 
					// can be instructed to have once completions have been provided.
 | 
				
			||||||
 | 
					type ShellCompDirective int
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const (
 | 
				
			||||||
 | 
						// ShellCompDirectiveError indicates an error occurred and completions should be ignored.
 | 
				
			||||||
 | 
						ShellCompDirectiveError ShellCompDirective = 1 << iota
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// ShellCompDirectiveNoSpace indicates that the shell should not add a space
 | 
				
			||||||
 | 
						// after the completion even if there is a single completion provided.
 | 
				
			||||||
 | 
						ShellCompDirectiveNoSpace
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// ShellCompDirectiveNoFileComp indicates that the shell should not provide
 | 
				
			||||||
 | 
						// file completion even when no completion is provided.
 | 
				
			||||||
 | 
						// This currently does not work for zsh or bash < 4
 | 
				
			||||||
 | 
						ShellCompDirectiveNoFileComp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// ShellCompDirectiveDefault indicates to let the shell perform its default
 | 
				
			||||||
 | 
						// behavior after completions have been provided.
 | 
				
			||||||
 | 
						ShellCompDirectiveDefault ShellCompDirective = 0
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// RegisterFlagCompletionFunc should be called to register a function to provide completion for a flag.
 | 
				
			||||||
 | 
					func (c *Command) RegisterFlagCompletionFunc(flagName string, f func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective)) error {
 | 
				
			||||||
 | 
						flag := c.Flag(flagName)
 | 
				
			||||||
 | 
						if flag == nil {
 | 
				
			||||||
 | 
							return fmt.Errorf("RegisterFlagCompletionFunc: flag '%s' does not exist", flagName)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if _, exists := flagCompletionFunctions[flag]; exists {
 | 
				
			||||||
 | 
							return fmt.Errorf("RegisterFlagCompletionFunc: flag '%s' already registered", flagName)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						flagCompletionFunctions[flag] = f
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Returns a string listing the different directive enabled in the specified parameter
 | 
				
			||||||
 | 
					func (d ShellCompDirective) string() string {
 | 
				
			||||||
 | 
						var directives []string
 | 
				
			||||||
 | 
						if d&ShellCompDirectiveError != 0 {
 | 
				
			||||||
 | 
							directives = append(directives, "ShellCompDirectiveError")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if d&ShellCompDirectiveNoSpace != 0 {
 | 
				
			||||||
 | 
							directives = append(directives, "ShellCompDirectiveNoSpace")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if d&ShellCompDirectiveNoFileComp != 0 {
 | 
				
			||||||
 | 
							directives = append(directives, "ShellCompDirectiveNoFileComp")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if len(directives) == 0 {
 | 
				
			||||||
 | 
							directives = append(directives, "ShellCompDirectiveDefault")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if d > ShellCompDirectiveError+ShellCompDirectiveNoSpace+ShellCompDirectiveNoFileComp {
 | 
				
			||||||
 | 
							return fmt.Sprintf("ERROR: unexpected ShellCompDirective value: %d", d)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return strings.Join(directives, ", ")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Adds a special hidden command that can be used to request custom completions.
 | 
				
			||||||
 | 
					func (c *Command) initCompleteCmd(args []string) {
 | 
				
			||||||
 | 
						completeCmd := &Command{
 | 
				
			||||||
 | 
							Use:                   fmt.Sprintf("%s [command-line]", ShellCompRequestCmd),
 | 
				
			||||||
 | 
							Aliases:               []string{ShellCompNoDescRequestCmd},
 | 
				
			||||||
 | 
							DisableFlagsInUseLine: true,
 | 
				
			||||||
 | 
							Hidden:                true,
 | 
				
			||||||
 | 
							DisableFlagParsing:    true,
 | 
				
			||||||
 | 
							Args:                  MinimumNArgs(1),
 | 
				
			||||||
 | 
							Short:                 "Request shell completion choices for the specified command-line",
 | 
				
			||||||
 | 
							Long: fmt.Sprintf("%[2]s is a special command that is used by the shell completion logic\n%[1]s",
 | 
				
			||||||
 | 
								"to request completion choices for the specified command-line.", ShellCompRequestCmd),
 | 
				
			||||||
 | 
							Run: func(cmd *Command, args []string) {
 | 
				
			||||||
 | 
								finalCmd, completions, directive, err := cmd.getCompletions(args)
 | 
				
			||||||
 | 
								if err != nil {
 | 
				
			||||||
 | 
									CompErrorln(err.Error())
 | 
				
			||||||
 | 
									// Keep going for multiple reasons:
 | 
				
			||||||
 | 
									// 1- There could be some valid completions even though there was an error
 | 
				
			||||||
 | 
									// 2- Even without completions, we need to print the directive
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								noDescriptions := (cmd.CalledAs() == ShellCompNoDescRequestCmd)
 | 
				
			||||||
 | 
								for _, comp := range completions {
 | 
				
			||||||
 | 
									if noDescriptions {
 | 
				
			||||||
 | 
										// Remove any description that may be included following a tab character.
 | 
				
			||||||
 | 
										comp = strings.Split(comp, "\t")[0]
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									// Print each possible completion to stdout for the completion script to consume.
 | 
				
			||||||
 | 
									fmt.Fprintln(finalCmd.OutOrStdout(), comp)
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if directive > ShellCompDirectiveError+ShellCompDirectiveNoSpace+ShellCompDirectiveNoFileComp {
 | 
				
			||||||
 | 
									directive = ShellCompDirectiveDefault
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// As the last printout, print the completion directive for the completion script to parse.
 | 
				
			||||||
 | 
								// The directive integer must be that last character following a single colon (:).
 | 
				
			||||||
 | 
								// The completion script expects :<directive>
 | 
				
			||||||
 | 
								fmt.Fprintf(finalCmd.OutOrStdout(), ":%d\n", directive)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Print some helpful info to stderr for the user to understand.
 | 
				
			||||||
 | 
								// Output from stderr must be ignored by the completion script.
 | 
				
			||||||
 | 
								fmt.Fprintf(finalCmd.ErrOrStderr(), "Completion ended with directive: %s\n", directive.string())
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						c.AddCommand(completeCmd)
 | 
				
			||||||
 | 
						subCmd, _, err := c.Find(args)
 | 
				
			||||||
 | 
						if err != nil || subCmd.Name() != ShellCompRequestCmd {
 | 
				
			||||||
 | 
							// Only create this special command if it is actually being called.
 | 
				
			||||||
 | 
							// This reduces possible side-effects of creating such a command;
 | 
				
			||||||
 | 
							// for example, having this command would cause problems to a
 | 
				
			||||||
 | 
							// cobra program that only consists of the root command, since this
 | 
				
			||||||
 | 
							// command would cause the root command to suddenly have a subcommand.
 | 
				
			||||||
 | 
							c.RemoveCommand(completeCmd)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDirective, error) {
 | 
				
			||||||
 | 
						var completions []string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// The last argument, which is not completely typed by the user,
 | 
				
			||||||
 | 
						// should not be part of the list of arguments
 | 
				
			||||||
 | 
						toComplete := args[len(args)-1]
 | 
				
			||||||
 | 
						trimmedArgs := args[:len(args)-1]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Find the real command for which completion must be performed
 | 
				
			||||||
 | 
						finalCmd, finalArgs, err := c.Root().Find(trimmedArgs)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							// Unable to find the real command. E.g., <program> someInvalidCmd <TAB>
 | 
				
			||||||
 | 
							return c, completions, ShellCompDirectiveDefault, fmt.Errorf("Unable to find a command for arguments: %v", trimmedArgs)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// When doing completion of a flag name, as soon as an argument starts with
 | 
				
			||||||
 | 
						// a '-' we know it is a flag.  We cannot use isFlagArg() here as it requires
 | 
				
			||||||
 | 
						// the flag to be complete
 | 
				
			||||||
 | 
						if len(toComplete) > 0 && toComplete[0] == '-' && !strings.Contains(toComplete, "=") {
 | 
				
			||||||
 | 
							// We are completing a flag name
 | 
				
			||||||
 | 
							finalCmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) {
 | 
				
			||||||
 | 
								completions = append(completions, getFlagNameCompletions(flag, toComplete)...)
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
							finalCmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) {
 | 
				
			||||||
 | 
								completions = append(completions, getFlagNameCompletions(flag, toComplete)...)
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							directive := ShellCompDirectiveDefault
 | 
				
			||||||
 | 
							if len(completions) > 0 {
 | 
				
			||||||
 | 
								if strings.HasSuffix(completions[0], "=") {
 | 
				
			||||||
 | 
									directive = ShellCompDirectiveNoSpace
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return finalCmd, completions, directive, nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var flag *pflag.Flag
 | 
				
			||||||
 | 
						if !finalCmd.DisableFlagParsing {
 | 
				
			||||||
 | 
							// We only do flag completion if we are allowed to parse flags
 | 
				
			||||||
 | 
							// This is important for commands which have requested to do their own flag completion.
 | 
				
			||||||
 | 
							flag, finalArgs, toComplete, err = checkIfFlagCompletion(finalCmd, finalArgs, toComplete)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								// Error while attempting to parse flags
 | 
				
			||||||
 | 
								return finalCmd, completions, ShellCompDirectiveDefault, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if flag == nil {
 | 
				
			||||||
 | 
							// Complete subcommand names
 | 
				
			||||||
 | 
							for _, subCmd := range finalCmd.Commands() {
 | 
				
			||||||
 | 
								if subCmd.IsAvailableCommand() && strings.HasPrefix(subCmd.Name(), toComplete) {
 | 
				
			||||||
 | 
									completions = append(completions, fmt.Sprintf("%s\t%s", subCmd.Name(), subCmd.Short))
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if len(finalCmd.ValidArgs) > 0 {
 | 
				
			||||||
 | 
								// Always complete ValidArgs, even if we are completing a subcommand name.
 | 
				
			||||||
 | 
								// This is for commands that have both subcommands and ValidArgs.
 | 
				
			||||||
 | 
								for _, validArg := range finalCmd.ValidArgs {
 | 
				
			||||||
 | 
									if strings.HasPrefix(validArg, toComplete) {
 | 
				
			||||||
 | 
										completions = append(completions, validArg)
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// If there are ValidArgs specified (even if they don't match), we stop completion.
 | 
				
			||||||
 | 
								// Only one of ValidArgs or ValidArgsFunction can be used for a single command.
 | 
				
			||||||
 | 
								return finalCmd, completions, ShellCompDirectiveNoFileComp, nil
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Always let the logic continue so as to add any ValidArgsFunction completions,
 | 
				
			||||||
 | 
							// even if we already found sub-commands.
 | 
				
			||||||
 | 
							// This is for commands that have subcommands but also specify a ValidArgsFunction.
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Parse the flags and extract the arguments to prepare for calling the completion function
 | 
				
			||||||
 | 
						if err = finalCmd.ParseFlags(finalArgs); err != nil {
 | 
				
			||||||
 | 
							return finalCmd, completions, ShellCompDirectiveDefault, fmt.Errorf("Error while parsing flags from args %v: %s", finalArgs, err.Error())
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// We only remove the flags from the arguments if DisableFlagParsing is not set.
 | 
				
			||||||
 | 
						// This is important for commands which have requested to do their own flag completion.
 | 
				
			||||||
 | 
						if !finalCmd.DisableFlagParsing {
 | 
				
			||||||
 | 
							finalArgs = finalCmd.Flags().Args()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Find the completion function for the flag or command
 | 
				
			||||||
 | 
						var completionFn func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective)
 | 
				
			||||||
 | 
						if flag != nil {
 | 
				
			||||||
 | 
							completionFn = flagCompletionFunctions[flag]
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							completionFn = finalCmd.ValidArgsFunction
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if completionFn == nil {
 | 
				
			||||||
 | 
							// Go custom completion not supported/needed for this flag or command
 | 
				
			||||||
 | 
							return finalCmd, completions, ShellCompDirectiveDefault, nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Call the registered completion function to get the completions
 | 
				
			||||||
 | 
						comps, directive := completionFn(finalCmd, finalArgs, toComplete)
 | 
				
			||||||
 | 
						completions = append(completions, comps...)
 | 
				
			||||||
 | 
						return finalCmd, completions, directive, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func getFlagNameCompletions(flag *pflag.Flag, toComplete string) []string {
 | 
				
			||||||
 | 
						if nonCompletableFlag(flag) {
 | 
				
			||||||
 | 
							return []string{}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var completions []string
 | 
				
			||||||
 | 
						flagName := "--" + flag.Name
 | 
				
			||||||
 | 
						if strings.HasPrefix(flagName, toComplete) {
 | 
				
			||||||
 | 
							// Flag without the =
 | 
				
			||||||
 | 
							completions = append(completions, fmt.Sprintf("%s\t%s", flagName, flag.Usage))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if len(flag.NoOptDefVal) == 0 {
 | 
				
			||||||
 | 
								// Flag requires a value, so it can be suffixed with =
 | 
				
			||||||
 | 
								flagName += "="
 | 
				
			||||||
 | 
								completions = append(completions, fmt.Sprintf("%s\t%s", flagName, flag.Usage))
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						flagName = "-" + flag.Shorthand
 | 
				
			||||||
 | 
						if len(flag.Shorthand) > 0 && strings.HasPrefix(flagName, toComplete) {
 | 
				
			||||||
 | 
							completions = append(completions, fmt.Sprintf("%s\t%s", flagName, flag.Usage))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return completions
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func checkIfFlagCompletion(finalCmd *Command, args []string, lastArg string) (*pflag.Flag, []string, string, error) {
 | 
				
			||||||
 | 
						var flagName string
 | 
				
			||||||
 | 
						trimmedArgs := args
 | 
				
			||||||
 | 
						flagWithEqual := false
 | 
				
			||||||
 | 
						if isFlagArg(lastArg) {
 | 
				
			||||||
 | 
							if index := strings.Index(lastArg, "="); index >= 0 {
 | 
				
			||||||
 | 
								flagName = strings.TrimLeft(lastArg[:index], "-")
 | 
				
			||||||
 | 
								lastArg = lastArg[index+1:]
 | 
				
			||||||
 | 
								flagWithEqual = true
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								return nil, nil, "", errors.New("Unexpected completion request for flag")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if len(flagName) == 0 {
 | 
				
			||||||
 | 
							if len(args) > 0 {
 | 
				
			||||||
 | 
								prevArg := args[len(args)-1]
 | 
				
			||||||
 | 
								if isFlagArg(prevArg) {
 | 
				
			||||||
 | 
									// Only consider the case where the flag does not contain an =.
 | 
				
			||||||
 | 
									// If the flag contains an = it means it has already been fully processed,
 | 
				
			||||||
 | 
									// so we don't need to deal with it here.
 | 
				
			||||||
 | 
									if index := strings.Index(prevArg, "="); index < 0 {
 | 
				
			||||||
 | 
										flagName = strings.TrimLeft(prevArg, "-")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										// Remove the uncompleted flag or else there could be an error created
 | 
				
			||||||
 | 
										// for an invalid value for that flag
 | 
				
			||||||
 | 
										trimmedArgs = args[:len(args)-1]
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if len(flagName) == 0 {
 | 
				
			||||||
 | 
							// Not doing flag completion
 | 
				
			||||||
 | 
							return nil, trimmedArgs, lastArg, nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						flag := findFlag(finalCmd, flagName)
 | 
				
			||||||
 | 
						if flag == nil {
 | 
				
			||||||
 | 
							// Flag not supported by this command, nothing to complete
 | 
				
			||||||
 | 
							err := fmt.Errorf("Subcommand '%s' does not support flag '%s'", finalCmd.Name(), flagName)
 | 
				
			||||||
 | 
							return nil, nil, "", err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if !flagWithEqual {
 | 
				
			||||||
 | 
							if len(flag.NoOptDefVal) != 0 {
 | 
				
			||||||
 | 
								// We had assumed dealing with a two-word flag but the flag is a boolean flag.
 | 
				
			||||||
 | 
								// In that case, there is no value following it, so we are not really doing flag completion.
 | 
				
			||||||
 | 
								// Reset everything to do noun completion.
 | 
				
			||||||
 | 
								trimmedArgs = args
 | 
				
			||||||
 | 
								flag = nil
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return flag, trimmedArgs, lastArg, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func findFlag(cmd *Command, name string) *pflag.Flag {
 | 
				
			||||||
 | 
						flagSet := cmd.Flags()
 | 
				
			||||||
 | 
						if len(name) == 1 {
 | 
				
			||||||
 | 
							// First convert the short flag into a long flag
 | 
				
			||||||
 | 
							// as the cmd.Flag() search only accepts long flags
 | 
				
			||||||
 | 
							if short := flagSet.ShorthandLookup(name); short != nil {
 | 
				
			||||||
 | 
								name = short.Name
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								set := cmd.InheritedFlags()
 | 
				
			||||||
 | 
								if short = set.ShorthandLookup(name); short != nil {
 | 
				
			||||||
 | 
									name = short.Name
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									return nil
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return cmd.Flag(name)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// CompDebug prints the specified string to the same file as where the
 | 
				
			||||||
 | 
					// completion script prints its logs.
 | 
				
			||||||
 | 
					// Note that completion printouts should never be on stdout as they would
 | 
				
			||||||
 | 
					// be wrongly interpreted as actual completion choices by the completion script.
 | 
				
			||||||
 | 
					func CompDebug(msg string, printToStdErr bool) {
 | 
				
			||||||
 | 
						msg = fmt.Sprintf("[Debug] %s", msg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Such logs are only printed when the user has set the environment
 | 
				
			||||||
 | 
						// variable BASH_COMP_DEBUG_FILE to the path of some file to be used.
 | 
				
			||||||
 | 
						if path := os.Getenv("BASH_COMP_DEBUG_FILE"); path != "" {
 | 
				
			||||||
 | 
							f, err := os.OpenFile(path,
 | 
				
			||||||
 | 
								os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
 | 
				
			||||||
 | 
							if err == nil {
 | 
				
			||||||
 | 
								defer f.Close()
 | 
				
			||||||
 | 
								f.WriteString(msg)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if printToStdErr {
 | 
				
			||||||
 | 
							// Must print to stderr for this not to be read by the completion script.
 | 
				
			||||||
 | 
							fmt.Fprintf(os.Stderr, msg)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// CompDebugln prints the specified string with a newline at the end
 | 
				
			||||||
 | 
					// to the same file as where the completion script prints its logs.
 | 
				
			||||||
 | 
					// Such logs are only printed when the user has set the environment
 | 
				
			||||||
 | 
					// variable BASH_COMP_DEBUG_FILE to the path of some file to be used.
 | 
				
			||||||
 | 
					func CompDebugln(msg string, printToStdErr bool) {
 | 
				
			||||||
 | 
						CompDebug(fmt.Sprintf("%s\n", msg), printToStdErr)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// CompError prints the specified completion message to stderr.
 | 
				
			||||||
 | 
					func CompError(msg string) {
 | 
				
			||||||
 | 
						msg = fmt.Sprintf("[Error] %s", msg)
 | 
				
			||||||
 | 
						CompDebug(msg, true)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// CompErrorln prints the specified completion message to stderr with a newline at the end.
 | 
				
			||||||
 | 
					func CompErrorln(msg string) {
 | 
				
			||||||
 | 
						CompError(fmt.Sprintf("%s\n", msg))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										172
									
								
								vendor/github.com/spf13/cobra/fish_completions.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										172
									
								
								vendor/github.com/spf13/cobra/fish_completions.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,172 @@
 | 
				
			|||||||
 | 
					package cobra
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"bytes"
 | 
				
			||||||
 | 
						"fmt"
 | 
				
			||||||
 | 
						"io"
 | 
				
			||||||
 | 
						"os"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func genFishComp(buf *bytes.Buffer, name string, includeDesc bool) {
 | 
				
			||||||
 | 
						compCmd := ShellCompRequestCmd
 | 
				
			||||||
 | 
						if !includeDesc {
 | 
				
			||||||
 | 
							compCmd = ShellCompNoDescRequestCmd
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						buf.WriteString(fmt.Sprintf("# fish completion for %-36s -*- shell-script -*-\n", name))
 | 
				
			||||||
 | 
						buf.WriteString(fmt.Sprintf(`
 | 
				
			||||||
 | 
					function __%[1]s_debug
 | 
				
			||||||
 | 
					    set file "$BASH_COMP_DEBUG_FILE"
 | 
				
			||||||
 | 
					    if test -n "$file"
 | 
				
			||||||
 | 
					        echo "$argv" >> $file
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function __%[1]s_perform_completion
 | 
				
			||||||
 | 
					    __%[1]s_debug "Starting __%[1]s_perform_completion with: $argv"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    set args (string split -- " " "$argv")
 | 
				
			||||||
 | 
					    set lastArg "$args[-1]"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __%[1]s_debug "args: $args"
 | 
				
			||||||
 | 
					    __%[1]s_debug "last arg: $lastArg"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    set emptyArg ""
 | 
				
			||||||
 | 
					    if test -z "$lastArg"
 | 
				
			||||||
 | 
					        __%[1]s_debug "Setting emptyArg"
 | 
				
			||||||
 | 
					        set emptyArg \"\"
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					    __%[1]s_debug "emptyArg: $emptyArg"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    set requestComp "$args[1] %[2]s $args[2..-1] $emptyArg"
 | 
				
			||||||
 | 
					    __%[1]s_debug "Calling $requestComp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    set results (eval $requestComp 2> /dev/null)
 | 
				
			||||||
 | 
					    set comps $results[1..-2]
 | 
				
			||||||
 | 
					    set directiveLine $results[-1]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # For Fish, when completing a flag with an = (e.g., <program> -n=<TAB>)
 | 
				
			||||||
 | 
					    # completions must be prefixed with the flag
 | 
				
			||||||
 | 
					    set flagPrefix (string match -r -- '-.*=' "$lastArg")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __%[1]s_debug "Comps: $comps"
 | 
				
			||||||
 | 
					    __%[1]s_debug "DirectiveLine: $directiveLine"
 | 
				
			||||||
 | 
					    __%[1]s_debug "flagPrefix: $flagPrefix"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for comp in $comps
 | 
				
			||||||
 | 
					        printf "%%s%%s\n" "$flagPrefix" "$comp"
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf "%%s\n" "$directiveLine"
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# This function does three things:
 | 
				
			||||||
 | 
					# 1- Obtain the completions and store them in the global __%[1]s_comp_results
 | 
				
			||||||
 | 
					# 2- Set the __%[1]s_comp_do_file_comp flag if file completion should be performed
 | 
				
			||||||
 | 
					#    and unset it otherwise
 | 
				
			||||||
 | 
					# 3- Return true if the completion results are not empty
 | 
				
			||||||
 | 
					function __%[1]s_prepare_completions
 | 
				
			||||||
 | 
					    # Start fresh
 | 
				
			||||||
 | 
					    set --erase __%[1]s_comp_do_file_comp
 | 
				
			||||||
 | 
					    set --erase __%[1]s_comp_results
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Check if the command-line is already provided.  This is useful for testing.
 | 
				
			||||||
 | 
					    if not set --query __%[1]s_comp_commandLine
 | 
				
			||||||
 | 
					        set __%[1]s_comp_commandLine (commandline)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					    __%[1]s_debug "commandLine is: $__%[1]s_comp_commandLine"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    set results (__%[1]s_perform_completion "$__%[1]s_comp_commandLine")
 | 
				
			||||||
 | 
					    set --erase __%[1]s_comp_commandLine
 | 
				
			||||||
 | 
					    __%[1]s_debug "Completion results: $results"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if test -z "$results"
 | 
				
			||||||
 | 
					        __%[1]s_debug "No completion, probably due to a failure"
 | 
				
			||||||
 | 
					        # Might as well do file completion, in case it helps
 | 
				
			||||||
 | 
					        set --global __%[1]s_comp_do_file_comp 1
 | 
				
			||||||
 | 
					        return 0
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    set directive (string sub --start 2 $results[-1])
 | 
				
			||||||
 | 
					    set --global __%[1]s_comp_results $results[1..-2]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __%[1]s_debug "Completions are: $__%[1]s_comp_results"
 | 
				
			||||||
 | 
					    __%[1]s_debug "Directive is: $directive"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if test -z "$directive"
 | 
				
			||||||
 | 
					        set directive 0
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    set compErr (math (math --scale 0 $directive / %[3]d) %% 2)
 | 
				
			||||||
 | 
					    if test $compErr -eq 1
 | 
				
			||||||
 | 
					        __%[1]s_debug "Received error directive: aborting."
 | 
				
			||||||
 | 
					        # Might as well do file completion, in case it helps
 | 
				
			||||||
 | 
					        set --global __%[1]s_comp_do_file_comp 1
 | 
				
			||||||
 | 
					        return 0
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    set nospace (math (math --scale 0 $directive / %[4]d) %% 2)
 | 
				
			||||||
 | 
					    set nofiles (math (math --scale 0 $directive / %[5]d) %% 2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __%[1]s_debug "nospace: $nospace, nofiles: $nofiles"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Important not to quote the variable for count to work
 | 
				
			||||||
 | 
					    set numComps (count $__%[1]s_comp_results)
 | 
				
			||||||
 | 
					    __%[1]s_debug "numComps: $numComps"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if test $numComps -eq 1; and test $nospace -ne 0
 | 
				
			||||||
 | 
					        # To support the "nospace" directive we trick the shell
 | 
				
			||||||
 | 
					        # by outputting an extra, longer completion.
 | 
				
			||||||
 | 
					        __%[1]s_debug "Adding second completion to perform nospace directive"
 | 
				
			||||||
 | 
					        set --append __%[1]s_comp_results $__%[1]s_comp_results[1].
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if test $numComps -eq 0; and test $nofiles -eq 0
 | 
				
			||||||
 | 
					        __%[1]s_debug "Requesting file completion"
 | 
				
			||||||
 | 
					        set --global __%[1]s_comp_do_file_comp 1
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # If we don't want file completion, we must return true even if there
 | 
				
			||||||
 | 
					    # are no completions found.  This is because fish will perform the last
 | 
				
			||||||
 | 
					    # completion command, even if its condition is false, if no other
 | 
				
			||||||
 | 
					    # completion command was triggered
 | 
				
			||||||
 | 
					    return (not set --query __%[1]s_comp_do_file_comp)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Remove any pre-existing completions for the program since we will be handling all of them
 | 
				
			||||||
 | 
					# TODO this cleanup is not sufficient.  Fish completions are only loaded once the user triggers
 | 
				
			||||||
 | 
					# them, so the below deletion will not work as it is run too early.  What else can we do?
 | 
				
			||||||
 | 
					complete -c %[1]s -e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# The order in which the below two lines are defined is very important so that __%[1]s_prepare_completions
 | 
				
			||||||
 | 
					# is called first.  It is __%[1]s_prepare_completions that sets up the __%[1]s_comp_do_file_comp variable.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# This completion will be run second as complete commands are added FILO.
 | 
				
			||||||
 | 
					# It triggers file completion choices when __%[1]s_comp_do_file_comp is set.
 | 
				
			||||||
 | 
					complete -c %[1]s -n 'set --query __%[1]s_comp_do_file_comp'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# This completion will be run first as complete commands are added FILO.
 | 
				
			||||||
 | 
					# The call to __%[1]s_prepare_completions will setup both __%[1]s_comp_results abd __%[1]s_comp_do_file_comp.
 | 
				
			||||||
 | 
					# It provides the program's completion choices.
 | 
				
			||||||
 | 
					complete -c %[1]s -n '__%[1]s_prepare_completions' -f -a '$__%[1]s_comp_results'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`, name, compCmd, ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GenFishCompletion generates fish completion file and writes to the passed writer.
 | 
				
			||||||
 | 
					func (c *Command) GenFishCompletion(w io.Writer, includeDesc bool) error {
 | 
				
			||||||
 | 
						buf := new(bytes.Buffer)
 | 
				
			||||||
 | 
						genFishComp(buf, c.Name(), includeDesc)
 | 
				
			||||||
 | 
						_, err := buf.WriteTo(w)
 | 
				
			||||||
 | 
						return err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GenFishCompletionFile generates fish completion file.
 | 
				
			||||||
 | 
					func (c *Command) GenFishCompletionFile(filename string, includeDesc bool) error {
 | 
				
			||||||
 | 
						outFile, err := os.Create(filename)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						defer outFile.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return c.GenFishCompletion(outFile, includeDesc)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										7
									
								
								vendor/github.com/spf13/cobra/fish_completions.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								vendor/github.com/spf13/cobra/fish_completions.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					## Generating Fish Completions for your own cobra.Command
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Cobra supports native Fish completions generated from the root `cobra.Command`.  You can use the `command.GenFishCompletion()` or `command.GenFishCompletionFile()` functions. You must provide these functions with a parameter indicating if the completions should be annotated with a description; Cobra will provide the description automatically based on usage information.  You can choose to make this option configurable by your users.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Limitations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Custom completions implemented using the `ValidArgsFunction` and `RegisterFlagCompletionFunc()` are supported automatically but the ones implemented in Bash scripting are not.
 | 
				
			||||||
							
								
								
									
										12
									
								
								vendor/github.com/spf13/cobra/go.mod
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/spf13/cobra/go.mod
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					module github.com/spf13/cobra
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					go 1.12
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require (
 | 
				
			||||||
 | 
						github.com/cpuguy83/go-md2man/v2 v2.0.0
 | 
				
			||||||
 | 
						github.com/inconshreveable/mousetrap v1.0.0
 | 
				
			||||||
 | 
						github.com/mitchellh/go-homedir v1.1.0
 | 
				
			||||||
 | 
						github.com/spf13/pflag v1.0.3
 | 
				
			||||||
 | 
						github.com/spf13/viper v1.4.0
 | 
				
			||||||
 | 
						gopkg.in/yaml.v2 v2.2.2
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
							
								
								
									
										149
									
								
								vendor/github.com/spf13/cobra/go.sum
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										149
									
								
								vendor/github.com/spf13/cobra/go.sum
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,149 @@
 | 
				
			|||||||
 | 
					cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 | 
				
			||||||
 | 
					github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
 | 
				
			||||||
 | 
					github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 | 
				
			||||||
 | 
					github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
 | 
				
			||||||
 | 
					github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
 | 
				
			||||||
 | 
					github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
 | 
				
			||||||
 | 
					github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
 | 
				
			||||||
 | 
					github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
 | 
				
			||||||
 | 
					github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
 | 
				
			||||||
 | 
					github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
 | 
				
			||||||
 | 
					github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
 | 
				
			||||||
 | 
					github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
 | 
				
			||||||
 | 
					github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
 | 
				
			||||||
 | 
					github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
 | 
				
			||||||
 | 
					github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
 | 
				
			||||||
 | 
					github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
 | 
				
			||||||
 | 
					github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
 | 
				
			||||||
 | 
					github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
 | 
				
			||||||
 | 
					github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 | 
				
			||||||
 | 
					github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
				
			||||||
 | 
					github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
 | 
				
			||||||
 | 
					github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
 | 
				
			||||||
 | 
					github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
 | 
				
			||||||
 | 
					github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
 | 
				
			||||||
 | 
					github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 | 
				
			||||||
 | 
					github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
 | 
				
			||||||
 | 
					github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
 | 
				
			||||||
 | 
					github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
 | 
				
			||||||
 | 
					github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
 | 
				
			||||||
 | 
					github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
 | 
				
			||||||
 | 
					github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
 | 
				
			||||||
 | 
					github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
 | 
				
			||||||
 | 
					github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
 | 
				
			||||||
 | 
					github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
 | 
				
			||||||
 | 
					github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 | 
				
			||||||
 | 
					github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 | 
				
			||||||
 | 
					github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
 | 
				
			||||||
 | 
					github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
 | 
				
			||||||
 | 
					github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
 | 
				
			||||||
 | 
					github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
 | 
				
			||||||
 | 
					github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
 | 
				
			||||||
 | 
					github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
 | 
				
			||||||
 | 
					github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
 | 
				
			||||||
 | 
					github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
 | 
				
			||||||
 | 
					github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
 | 
				
			||||||
 | 
					github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
 | 
				
			||||||
 | 
					github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
 | 
				
			||||||
 | 
					github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
 | 
				
			||||||
 | 
					github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
 | 
				
			||||||
 | 
					github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
 | 
				
			||||||
 | 
					github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 | 
				
			||||||
 | 
					github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
 | 
				
			||||||
 | 
					github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
 | 
				
			||||||
 | 
					github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
 | 
				
			||||||
 | 
					github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 | 
				
			||||||
 | 
					github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
 | 
				
			||||||
 | 
					github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 | 
				
			||||||
 | 
					github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
 | 
				
			||||||
 | 
					github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
 | 
				
			||||||
 | 
					github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
 | 
				
			||||||
 | 
					github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
 | 
				
			||||||
 | 
					github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
 | 
				
			||||||
 | 
					github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
 | 
				
			||||||
 | 
					github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
 | 
				
			||||||
 | 
					github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
 | 
				
			||||||
 | 
					github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
 | 
				
			||||||
 | 
					github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
 | 
				
			||||||
 | 
					github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
 | 
				
			||||||
 | 
					github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 | 
				
			||||||
 | 
					github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 | 
				
			||||||
 | 
					github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 | 
				
			||||||
 | 
					github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
 | 
				
			||||||
 | 
					github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
 | 
				
			||||||
 | 
					github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
 | 
				
			||||||
 | 
					github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
 | 
				
			||||||
 | 
					github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
 | 
				
			||||||
 | 
					github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
 | 
				
			||||||
 | 
					github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
 | 
				
			||||||
 | 
					github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
 | 
				
			||||||
 | 
					github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
 | 
				
			||||||
 | 
					github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
 | 
				
			||||||
 | 
					github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
 | 
				
			||||||
 | 
					github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
 | 
				
			||||||
 | 
					github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
 | 
				
			||||||
 | 
					github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
 | 
				
			||||||
 | 
					github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
 | 
				
			||||||
 | 
					github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
 | 
				
			||||||
 | 
					github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
 | 
				
			||||||
 | 
					github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
 | 
				
			||||||
 | 
					github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
 | 
				
			||||||
 | 
					github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=
 | 
				
			||||||
 | 
					github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
 | 
				
			||||||
 | 
					github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
 | 
				
			||||||
 | 
					github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
 | 
				
			||||||
 | 
					github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
 | 
				
			||||||
 | 
					github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
 | 
				
			||||||
 | 
					github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU=
 | 
				
			||||||
 | 
					github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
 | 
				
			||||||
 | 
					github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
				
			||||||
 | 
					github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
 | 
				
			||||||
 | 
					github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 | 
				
			||||||
 | 
					github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
 | 
				
			||||||
 | 
					github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
 | 
				
			||||||
 | 
					github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
 | 
				
			||||||
 | 
					github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
 | 
				
			||||||
 | 
					go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
 | 
				
			||||||
 | 
					go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
 | 
				
			||||||
 | 
					go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
 | 
				
			||||||
 | 
					go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
 | 
				
			||||||
 | 
					golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
 | 
				
			||||||
 | 
					golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 | 
				
			||||||
 | 
					golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
 | 
				
			||||||
 | 
					golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
 | 
				
			||||||
 | 
					golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
				
			||||||
 | 
					golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
				
			||||||
 | 
					golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
				
			||||||
 | 
					golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 | 
				
			||||||
 | 
					golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
 | 
				
			||||||
 | 
					golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 | 
				
			||||||
 | 
					golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 | 
				
			||||||
 | 
					golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 | 
				
			||||||
 | 
					golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
				
			||||||
 | 
					golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
 | 
				
			||||||
 | 
					golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 | 
				
			||||||
 | 
					golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 | 
				
			||||||
 | 
					golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 | 
				
			||||||
 | 
					golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 | 
				
			||||||
 | 
					golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
 | 
				
			||||||
 | 
					google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
 | 
				
			||||||
 | 
					google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
 | 
				
			||||||
 | 
					google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
 | 
				
			||||||
 | 
					google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
 | 
				
			||||||
 | 
					gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
 | 
				
			||||||
 | 
					gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
 | 
				
			||||||
 | 
					gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 | 
				
			||||||
 | 
					gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
 | 
				
			||||||
 | 
					gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 | 
				
			||||||
 | 
					gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
 | 
				
			||||||
 | 
					gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
 | 
				
			||||||
 | 
					gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 | 
				
			||||||
 | 
					gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
 | 
				
			||||||
 | 
					gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 | 
				
			||||||
 | 
					honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 | 
				
			||||||
							
								
								
									
										100
									
								
								vendor/github.com/spf13/cobra/powershell_completions.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								vendor/github.com/spf13/cobra/powershell_completions.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,100 @@
 | 
				
			|||||||
 | 
					// PowerShell completions are based on the amazing work from clap:
 | 
				
			||||||
 | 
					// https://github.com/clap-rs/clap/blob/3294d18efe5f264d12c9035f404c7d189d4824e1/src/completions/powershell.rs
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// The generated scripts require PowerShell v5.0+ (which comes Windows 10, but
 | 
				
			||||||
 | 
					// can be downloaded separately for windows 7 or 8.1).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package cobra
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"bytes"
 | 
				
			||||||
 | 
						"fmt"
 | 
				
			||||||
 | 
						"io"
 | 
				
			||||||
 | 
						"os"
 | 
				
			||||||
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/spf13/pflag"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var powerShellCompletionTemplate = `using namespace System.Management.Automation
 | 
				
			||||||
 | 
					using namespace System.Management.Automation.Language
 | 
				
			||||||
 | 
					Register-ArgumentCompleter -Native -CommandName '%s' -ScriptBlock {
 | 
				
			||||||
 | 
					    param($wordToComplete, $commandAst, $cursorPosition)
 | 
				
			||||||
 | 
					    $commandElements = $commandAst.CommandElements
 | 
				
			||||||
 | 
					    $command = @(
 | 
				
			||||||
 | 
					        '%s'
 | 
				
			||||||
 | 
					        for ($i = 1; $i -lt $commandElements.Count; $i++) {
 | 
				
			||||||
 | 
					            $element = $commandElements[$i]
 | 
				
			||||||
 | 
					            if ($element -isnot [StringConstantExpressionAst] -or
 | 
				
			||||||
 | 
					                $element.StringConstantType -ne [StringConstantType]::BareWord -or
 | 
				
			||||||
 | 
					                $element.Value.StartsWith('-')) {
 | 
				
			||||||
 | 
					                break
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            $element.Value
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    ) -join ';'
 | 
				
			||||||
 | 
					    $completions = @(switch ($command) {%s
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    $completions.Where{ $_.CompletionText -like "$wordToComplete*" } |
 | 
				
			||||||
 | 
					        Sort-Object -Property ListItemText
 | 
				
			||||||
 | 
					}`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func generatePowerShellSubcommandCases(out io.Writer, cmd *Command, previousCommandName string) {
 | 
				
			||||||
 | 
						var cmdName string
 | 
				
			||||||
 | 
						if previousCommandName == "" {
 | 
				
			||||||
 | 
							cmdName = cmd.Name()
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							cmdName = fmt.Sprintf("%s;%s", previousCommandName, cmd.Name())
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fmt.Fprintf(out, "\n        '%s' {", cmdName)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						cmd.Flags().VisitAll(func(flag *pflag.Flag) {
 | 
				
			||||||
 | 
							if nonCompletableFlag(flag) {
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							usage := escapeStringForPowerShell(flag.Usage)
 | 
				
			||||||
 | 
							if len(flag.Shorthand) > 0 {
 | 
				
			||||||
 | 
								fmt.Fprintf(out, "\n            [CompletionResult]::new('-%s', '%s', [CompletionResultType]::ParameterName, '%s')", flag.Shorthand, flag.Shorthand, usage)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							fmt.Fprintf(out, "\n            [CompletionResult]::new('--%s', '%s', [CompletionResultType]::ParameterName, '%s')", flag.Name, flag.Name, usage)
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for _, subCmd := range cmd.Commands() {
 | 
				
			||||||
 | 
							usage := escapeStringForPowerShell(subCmd.Short)
 | 
				
			||||||
 | 
							fmt.Fprintf(out, "\n            [CompletionResult]::new('%s', '%s', [CompletionResultType]::ParameterValue, '%s')", subCmd.Name(), subCmd.Name(), usage)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fmt.Fprint(out, "\n            break\n        }")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for _, subCmd := range cmd.Commands() {
 | 
				
			||||||
 | 
							generatePowerShellSubcommandCases(out, subCmd, cmdName)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func escapeStringForPowerShell(s string) string {
 | 
				
			||||||
 | 
						return strings.Replace(s, "'", "''", -1)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GenPowerShellCompletion generates PowerShell completion file and writes to the passed writer.
 | 
				
			||||||
 | 
					func (c *Command) GenPowerShellCompletion(w io.Writer) error {
 | 
				
			||||||
 | 
						buf := new(bytes.Buffer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var subCommandCases bytes.Buffer
 | 
				
			||||||
 | 
						generatePowerShellSubcommandCases(&subCommandCases, c, "")
 | 
				
			||||||
 | 
						fmt.Fprintf(buf, powerShellCompletionTemplate, c.Name(), c.Name(), subCommandCases.String())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						_, err := buf.WriteTo(w)
 | 
				
			||||||
 | 
						return err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GenPowerShellCompletionFile generates PowerShell completion file.
 | 
				
			||||||
 | 
					func (c *Command) GenPowerShellCompletionFile(filename string) error {
 | 
				
			||||||
 | 
						outFile, err := os.Create(filename)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						defer outFile.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return c.GenPowerShellCompletion(outFile)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										14
									
								
								vendor/github.com/spf13/cobra/powershell_completions.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/spf13/cobra/powershell_completions.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					# Generating PowerShell Completions For Your Own cobra.Command
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Cobra can generate PowerShell completion scripts. Users need PowerShell version 5.0 or above, which comes with Windows 10 and can be downloaded separately for Windows 7 or 8.1. They can then write the completions to a file and source this file from their PowerShell profile, which is referenced by the `$Profile` environment variable. See `Get-Help about_Profiles` for more info about PowerShell profiles.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# What's supported
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Completion for subcommands using their `.Short` description
 | 
				
			||||||
 | 
					- Completion for non-hidden flags using their `.Name` and `.Shorthand`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# What's not yet supported
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Command aliases
 | 
				
			||||||
 | 
					- Required, filename or custom flags (they will work like normal flags)
 | 
				
			||||||
 | 
					- Custom completion scripts
 | 
				
			||||||
							
								
								
									
										85
									
								
								vendor/github.com/spf13/cobra/shell_completions.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								vendor/github.com/spf13/cobra/shell_completions.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,85 @@
 | 
				
			|||||||
 | 
					package cobra
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"github.com/spf13/pflag"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag if it exists,
 | 
				
			||||||
 | 
					// and causes your command to report an error if invoked without the flag.
 | 
				
			||||||
 | 
					func (c *Command) MarkFlagRequired(name string) error {
 | 
				
			||||||
 | 
						return MarkFlagRequired(c.Flags(), name)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// MarkPersistentFlagRequired adds the BashCompOneRequiredFlag annotation to the named persistent flag if it exists,
 | 
				
			||||||
 | 
					// and causes your command to report an error if invoked without the flag.
 | 
				
			||||||
 | 
					func (c *Command) MarkPersistentFlagRequired(name string) error {
 | 
				
			||||||
 | 
						return MarkFlagRequired(c.PersistentFlags(), name)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag if it exists,
 | 
				
			||||||
 | 
					// and causes your command to report an error if invoked without the flag.
 | 
				
			||||||
 | 
					func MarkFlagRequired(flags *pflag.FlagSet, name string) error {
 | 
				
			||||||
 | 
						return flags.SetAnnotation(name, BashCompOneRequiredFlag, []string{"true"})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag, if it exists.
 | 
				
			||||||
 | 
					// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided.
 | 
				
			||||||
 | 
					func (c *Command) MarkFlagFilename(name string, extensions ...string) error {
 | 
				
			||||||
 | 
						return MarkFlagFilename(c.Flags(), name, extensions...)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists.
 | 
				
			||||||
 | 
					// Generated bash autocompletion will call the bash function f for the flag.
 | 
				
			||||||
 | 
					func (c *Command) MarkFlagCustom(name string, f string) error {
 | 
				
			||||||
 | 
						return MarkFlagCustom(c.Flags(), name, f)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// MarkPersistentFlagFilename instructs the various shell completion
 | 
				
			||||||
 | 
					// implementations to limit completions for this persistent flag to the
 | 
				
			||||||
 | 
					// specified extensions (patterns).
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Shell Completion compatibility matrix: bash, zsh
 | 
				
			||||||
 | 
					func (c *Command) MarkPersistentFlagFilename(name string, extensions ...string) error {
 | 
				
			||||||
 | 
						return MarkFlagFilename(c.PersistentFlags(), name, extensions...)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// MarkFlagFilename instructs the various shell completion implementations to
 | 
				
			||||||
 | 
					// limit completions for this flag to the specified extensions (patterns).
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Shell Completion compatibility matrix: bash, zsh
 | 
				
			||||||
 | 
					func MarkFlagFilename(flags *pflag.FlagSet, name string, extensions ...string) error {
 | 
				
			||||||
 | 
						return flags.SetAnnotation(name, BashCompFilenameExt, extensions)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// MarkFlagCustom instructs the various shell completion implementations to
 | 
				
			||||||
 | 
					// limit completions for this flag to the specified extensions (patterns).
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Shell Completion compatibility matrix: bash, zsh
 | 
				
			||||||
 | 
					func MarkFlagCustom(flags *pflag.FlagSet, name string, f string) error {
 | 
				
			||||||
 | 
						return flags.SetAnnotation(name, BashCompCustom, []string{f})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// MarkFlagDirname instructs the various shell completion implementations to
 | 
				
			||||||
 | 
					// complete only directories with this named flag.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Shell Completion compatibility matrix: zsh
 | 
				
			||||||
 | 
					func (c *Command) MarkFlagDirname(name string) error {
 | 
				
			||||||
 | 
						return MarkFlagDirname(c.Flags(), name)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// MarkPersistentFlagDirname instructs the various shell completion
 | 
				
			||||||
 | 
					// implementations to complete only directories with this persistent named flag.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Shell Completion compatibility matrix: zsh
 | 
				
			||||||
 | 
					func (c *Command) MarkPersistentFlagDirname(name string) error {
 | 
				
			||||||
 | 
						return MarkFlagDirname(c.PersistentFlags(), name)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// MarkFlagDirname instructs the various shell completion implementations to
 | 
				
			||||||
 | 
					// complete only directories with this specified flag.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Shell Completion compatibility matrix: zsh
 | 
				
			||||||
 | 
					func MarkFlagDirname(flags *pflag.FlagSet, name string) error {
 | 
				
			||||||
 | 
						zshPattern := "-(/)"
 | 
				
			||||||
 | 
						return flags.SetAnnotation(name, zshCompDirname, []string{zshPattern})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										364
									
								
								vendor/github.com/spf13/cobra/zsh_completions.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										364
									
								
								vendor/github.com/spf13/cobra/zsh_completions.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,13 +1,102 @@
 | 
				
			|||||||
package cobra
 | 
					package cobra
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"bytes"
 | 
						"encoding/json"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
 | 
						"sort"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
						"text/template"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/spf13/pflag"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const (
 | 
				
			||||||
 | 
						zshCompArgumentAnnotation   = "cobra_annotations_zsh_completion_argument_annotation"
 | 
				
			||||||
 | 
						zshCompArgumentFilenameComp = "cobra_annotations_zsh_completion_argument_file_completion"
 | 
				
			||||||
 | 
						zshCompArgumentWordComp     = "cobra_annotations_zsh_completion_argument_word_completion"
 | 
				
			||||||
 | 
						zshCompDirname              = "cobra_annotations_zsh_dirname"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var (
 | 
				
			||||||
 | 
						zshCompFuncMap = template.FuncMap{
 | 
				
			||||||
 | 
							"genZshFuncName":              zshCompGenFuncName,
 | 
				
			||||||
 | 
							"extractFlags":                zshCompExtractFlag,
 | 
				
			||||||
 | 
							"genFlagEntryForZshArguments": zshCompGenFlagEntryForArguments,
 | 
				
			||||||
 | 
							"extractArgsCompletions":      zshCompExtractArgumentCompletionHintsForRendering,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						zshCompletionText = `
 | 
				
			||||||
 | 
					{{/* should accept Command (that contains subcommands) as parameter */}}
 | 
				
			||||||
 | 
					{{define "argumentsC" -}}
 | 
				
			||||||
 | 
					{{ $cmdPath := genZshFuncName .}}
 | 
				
			||||||
 | 
					function {{$cmdPath}} {
 | 
				
			||||||
 | 
					  local -a commands
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  _arguments -C \{{- range extractFlags .}}
 | 
				
			||||||
 | 
					    {{genFlagEntryForZshArguments .}} \{{- end}}
 | 
				
			||||||
 | 
					    "1: :->cmnds" \
 | 
				
			||||||
 | 
					    "*::arg:->args"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  case $state in
 | 
				
			||||||
 | 
					  cmnds)
 | 
				
			||||||
 | 
					    commands=({{range .Commands}}{{if not .Hidden}}
 | 
				
			||||||
 | 
					      "{{.Name}}:{{.Short}}"{{end}}{{end}}
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    _describe "command" commands
 | 
				
			||||||
 | 
					    ;;
 | 
				
			||||||
 | 
					  esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  case "$words[1]" in {{- range .Commands}}{{if not .Hidden}}
 | 
				
			||||||
 | 
					  {{.Name}})
 | 
				
			||||||
 | 
					    {{$cmdPath}}_{{.Name}}
 | 
				
			||||||
 | 
					    ;;{{end}}{{end}}
 | 
				
			||||||
 | 
					  esac
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					{{range .Commands}}{{if not .Hidden}}
 | 
				
			||||||
 | 
					{{template "selectCmdTemplate" .}}
 | 
				
			||||||
 | 
					{{- end}}{{end}}
 | 
				
			||||||
 | 
					{{- end}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{{/* should accept Command without subcommands as parameter */}}
 | 
				
			||||||
 | 
					{{define "arguments" -}}
 | 
				
			||||||
 | 
					function {{genZshFuncName .}} {
 | 
				
			||||||
 | 
					{{"  _arguments"}}{{range extractFlags .}} \
 | 
				
			||||||
 | 
					    {{genFlagEntryForZshArguments . -}}
 | 
				
			||||||
 | 
					{{end}}{{range extractArgsCompletions .}} \
 | 
				
			||||||
 | 
					    {{.}}{{end}}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					{{end}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{{/* dispatcher for commands with or without subcommands */}}
 | 
				
			||||||
 | 
					{{define "selectCmdTemplate" -}}
 | 
				
			||||||
 | 
					{{if .Hidden}}{{/* ignore hidden*/}}{{else -}}
 | 
				
			||||||
 | 
					{{if .Commands}}{{template "argumentsC" .}}{{else}}{{template "arguments" .}}{{end}}
 | 
				
			||||||
 | 
					{{- end}}
 | 
				
			||||||
 | 
					{{- end}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{{/* template entry point */}}
 | 
				
			||||||
 | 
					{{define "Main" -}}
 | 
				
			||||||
 | 
					#compdef _{{.Name}} {{.Name}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{{template "selectCmdTemplate" .}}
 | 
				
			||||||
 | 
					{{end}}
 | 
				
			||||||
 | 
					`
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// zshCompArgsAnnotation is used to encode/decode zsh completion for
 | 
				
			||||||
 | 
					// arguments to/from Command.Annotations.
 | 
				
			||||||
 | 
					type zshCompArgsAnnotation map[int]zshCompArgHint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type zshCompArgHint struct {
 | 
				
			||||||
 | 
						// Indicates the type of the completion to use. One of:
 | 
				
			||||||
 | 
						// zshCompArgumentFilenameComp or zshCompArgumentWordComp
 | 
				
			||||||
 | 
						Tipe string `json:"type"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// A value for the type above (globs for file completion or words)
 | 
				
			||||||
 | 
						Options []string `json:"options"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GenZshCompletionFile generates zsh completion file.
 | 
					// GenZshCompletionFile generates zsh completion file.
 | 
				
			||||||
func (c *Command) GenZshCompletionFile(filename string) error {
 | 
					func (c *Command) GenZshCompletionFile(filename string) error {
 | 
				
			||||||
	outFile, err := os.Create(filename)
 | 
						outFile, err := os.Create(filename)
 | 
				
			||||||
@@ -19,108 +108,229 @@ func (c *Command) GenZshCompletionFile(filename string) error {
 | 
				
			|||||||
	return c.GenZshCompletion(outFile)
 | 
						return c.GenZshCompletion(outFile)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GenZshCompletion generates a zsh completion file and writes to the passed writer.
 | 
					// GenZshCompletion generates a zsh completion file and writes to the passed
 | 
				
			||||||
 | 
					// writer. The completion always run on the root command regardless of the
 | 
				
			||||||
 | 
					// command it was called from.
 | 
				
			||||||
func (c *Command) GenZshCompletion(w io.Writer) error {
 | 
					func (c *Command) GenZshCompletion(w io.Writer) error {
 | 
				
			||||||
	buf := new(bytes.Buffer)
 | 
						tmpl, err := template.New("Main").Funcs(zshCompFuncMap).Parse(zshCompletionText)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return fmt.Errorf("error creating zsh completion template: %v", err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return tmpl.Execute(w, c.Root())
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	writeHeader(buf, c)
 | 
					// MarkZshCompPositionalArgumentFile marks the specified argument (first
 | 
				
			||||||
	maxDepth := maxDepth(c)
 | 
					// argument is 1) as completed by file selection. patterns (e.g. "*.txt") are
 | 
				
			||||||
	writeLevelMapping(buf, maxDepth)
 | 
					// optional - if not provided the completion will search for all files.
 | 
				
			||||||
	writeLevelCases(buf, maxDepth, c)
 | 
					func (c *Command) MarkZshCompPositionalArgumentFile(argPosition int, patterns ...string) error {
 | 
				
			||||||
 | 
						if argPosition < 1 {
 | 
				
			||||||
	_, err := buf.WriteTo(w)
 | 
							return fmt.Errorf("Invalid argument position (%d)", argPosition)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						annotation, err := c.zshCompGetArgsAnnotations()
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if c.zshcompArgsAnnotationnIsDuplicatePosition(annotation, argPosition) {
 | 
				
			||||||
 | 
							return fmt.Errorf("Duplicate annotation for positional argument at index %d", argPosition)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						annotation[argPosition] = zshCompArgHint{
 | 
				
			||||||
 | 
							Tipe:    zshCompArgumentFilenameComp,
 | 
				
			||||||
 | 
							Options: patterns,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return c.zshCompSetArgsAnnotations(annotation)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func writeHeader(w io.Writer, cmd *Command) {
 | 
					// MarkZshCompPositionalArgumentWords marks the specified positional argument
 | 
				
			||||||
	fmt.Fprintf(w, "#compdef %s\n\n", cmd.Name())
 | 
					// (first argument is 1) as completed by the provided words. At east one word
 | 
				
			||||||
 | 
					// must be provided, spaces within words will be offered completion with
 | 
				
			||||||
 | 
					// "word\ word".
 | 
				
			||||||
 | 
					func (c *Command) MarkZshCompPositionalArgumentWords(argPosition int, words ...string) error {
 | 
				
			||||||
 | 
						if argPosition < 1 {
 | 
				
			||||||
 | 
							return fmt.Errorf("Invalid argument position (%d)", argPosition)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if len(words) == 0 {
 | 
				
			||||||
 | 
							return fmt.Errorf("Trying to set empty word list for positional argument %d", argPosition)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						annotation, err := c.zshCompGetArgsAnnotations()
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if c.zshcompArgsAnnotationnIsDuplicatePosition(annotation, argPosition) {
 | 
				
			||||||
 | 
							return fmt.Errorf("Duplicate annotation for positional argument at index %d", argPosition)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						annotation[argPosition] = zshCompArgHint{
 | 
				
			||||||
 | 
							Tipe:    zshCompArgumentWordComp,
 | 
				
			||||||
 | 
							Options: words,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return c.zshCompSetArgsAnnotations(annotation)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func maxDepth(c *Command) int {
 | 
					func zshCompExtractArgumentCompletionHintsForRendering(c *Command) ([]string, error) {
 | 
				
			||||||
	if len(c.Commands()) == 0 {
 | 
						var result []string
 | 
				
			||||||
		return 0
 | 
						annotation, err := c.zshCompGetArgsAnnotations()
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	maxDepthSub := 0
 | 
						for k, v := range annotation {
 | 
				
			||||||
	for _, s := range c.Commands() {
 | 
							s, err := zshCompRenderZshCompArgHint(k, v)
 | 
				
			||||||
		subDepth := maxDepth(s)
 | 
							if err != nil {
 | 
				
			||||||
		if subDepth > maxDepthSub {
 | 
								return nil, err
 | 
				
			||||||
			maxDepthSub = subDepth
 | 
							}
 | 
				
			||||||
 | 
							result = append(result, s)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if len(c.ValidArgs) > 0 {
 | 
				
			||||||
 | 
							if _, positionOneExists := annotation[1]; !positionOneExists {
 | 
				
			||||||
 | 
								s, err := zshCompRenderZshCompArgHint(1, zshCompArgHint{
 | 
				
			||||||
 | 
									Tipe:    zshCompArgumentWordComp,
 | 
				
			||||||
 | 
									Options: c.ValidArgs,
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
								if err != nil {
 | 
				
			||||||
 | 
									return nil, err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								result = append(result, s)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 1 + maxDepthSub
 | 
						sort.Strings(result)
 | 
				
			||||||
 | 
						return result, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func writeLevelMapping(w io.Writer, numLevels int) {
 | 
					func zshCompRenderZshCompArgHint(i int, z zshCompArgHint) (string, error) {
 | 
				
			||||||
	fmt.Fprintln(w, `_arguments \`)
 | 
						switch t := z.Tipe; t {
 | 
				
			||||||
	for i := 1; i <= numLevels; i++ {
 | 
						case zshCompArgumentFilenameComp:
 | 
				
			||||||
		fmt.Fprintf(w, `  '%d: :->level%d' \`, i, i)
 | 
							var globs []string
 | 
				
			||||||
		fmt.Fprintln(w)
 | 
							for _, g := range z.Options {
 | 
				
			||||||
 | 
								globs = append(globs, fmt.Sprintf(`-g "%s"`, g))
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return fmt.Sprintf(`'%d: :_files %s'`, i, strings.Join(globs, " ")), nil
 | 
				
			||||||
 | 
						case zshCompArgumentWordComp:
 | 
				
			||||||
 | 
							var words []string
 | 
				
			||||||
 | 
							for _, w := range z.Options {
 | 
				
			||||||
 | 
								words = append(words, fmt.Sprintf("%q", w))
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return fmt.Sprintf(`'%d: :(%s)'`, i, strings.Join(words, " ")), nil
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							return "", fmt.Errorf("Invalid zsh argument completion annotation: %s", t)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	fmt.Fprintf(w, `  '%d: :%s'`, numLevels+1, "_files")
 | 
					 | 
				
			||||||
	fmt.Fprintln(w)
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func writeLevelCases(w io.Writer, maxDepth int, root *Command) {
 | 
					func (c *Command) zshcompArgsAnnotationnIsDuplicatePosition(annotation zshCompArgsAnnotation, position int) bool {
 | 
				
			||||||
	fmt.Fprintln(w, "case $state in")
 | 
						_, dup := annotation[position]
 | 
				
			||||||
	defer fmt.Fprintln(w, "esac")
 | 
						return dup
 | 
				
			||||||
 | 
					 | 
				
			||||||
	for i := 1; i <= maxDepth; i++ {
 | 
					 | 
				
			||||||
		fmt.Fprintf(w, "  level%d)\n", i)
 | 
					 | 
				
			||||||
		writeLevel(w, root, i)
 | 
					 | 
				
			||||||
		fmt.Fprintln(w, "  ;;")
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	fmt.Fprintln(w, "  *)")
 | 
					 | 
				
			||||||
	fmt.Fprintln(w, "    _arguments '*: :_files'")
 | 
					 | 
				
			||||||
	fmt.Fprintln(w, "  ;;")
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func writeLevel(w io.Writer, root *Command, i int) {
 | 
					func (c *Command) zshCompGetArgsAnnotations() (zshCompArgsAnnotation, error) {
 | 
				
			||||||
	fmt.Fprintf(w, "    case $words[%d] in\n", i)
 | 
						annotation := make(zshCompArgsAnnotation)
 | 
				
			||||||
	defer fmt.Fprintln(w, "    esac")
 | 
						annotationString, ok := c.Annotations[zshCompArgumentAnnotation]
 | 
				
			||||||
 | 
						if !ok {
 | 
				
			||||||
	commands := filterByLevel(root, i)
 | 
							return annotation, nil
 | 
				
			||||||
	byParent := groupByParent(commands)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for p, c := range byParent {
 | 
					 | 
				
			||||||
		names := names(c)
 | 
					 | 
				
			||||||
		fmt.Fprintf(w, "      %s)\n", p)
 | 
					 | 
				
			||||||
		fmt.Fprintf(w, "        _arguments '%d: :(%s)'\n", i, strings.Join(names, " "))
 | 
					 | 
				
			||||||
		fmt.Fprintln(w, "      ;;")
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	fmt.Fprintln(w, "      *)")
 | 
						err := json.Unmarshal([]byte(annotationString), &annotation)
 | 
				
			||||||
	fmt.Fprintln(w, "        _arguments '*: :_files'")
 | 
						if err != nil {
 | 
				
			||||||
	fmt.Fprintln(w, "      ;;")
 | 
							return annotation, fmt.Errorf("Error unmarshaling zsh argument annotation: %v", err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return annotation, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func filterByLevel(c *Command, l int) []*Command {
 | 
					func (c *Command) zshCompSetArgsAnnotations(annotation zshCompArgsAnnotation) error {
 | 
				
			||||||
	cs := make([]*Command, 0)
 | 
						jsn, err := json.Marshal(annotation)
 | 
				
			||||||
	if l == 0 {
 | 
						if err != nil {
 | 
				
			||||||
		cs = append(cs, c)
 | 
							return fmt.Errorf("Error marshaling zsh argument annotation: %v", err)
 | 
				
			||||||
		return cs
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for _, s := range c.Commands() {
 | 
						if c.Annotations == nil {
 | 
				
			||||||
		cs = append(cs, filterByLevel(s, l-1)...)
 | 
							c.Annotations = make(map[string]string)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return cs
 | 
						c.Annotations[zshCompArgumentAnnotation] = string(jsn)
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func groupByParent(commands []*Command) map[string][]*Command {
 | 
					func zshCompGenFuncName(c *Command) string {
 | 
				
			||||||
	m := make(map[string][]*Command)
 | 
						if c.HasParent() {
 | 
				
			||||||
	for _, c := range commands {
 | 
							return zshCompGenFuncName(c.Parent()) + "_" + c.Name()
 | 
				
			||||||
		parent := c.Parent()
 | 
					 | 
				
			||||||
		if parent == nil {
 | 
					 | 
				
			||||||
			continue
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
		m[parent.Name()] = append(m[parent.Name()], c)
 | 
						return "_" + c.Name()
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return m
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func names(commands []*Command) []string {
 | 
					func zshCompExtractFlag(c *Command) []*pflag.Flag {
 | 
				
			||||||
	ns := make([]string, len(commands))
 | 
						var flags []*pflag.Flag
 | 
				
			||||||
	for i, c := range commands {
 | 
						c.LocalFlags().VisitAll(func(f *pflag.Flag) {
 | 
				
			||||||
		ns[i] = c.Name()
 | 
							if !f.Hidden {
 | 
				
			||||||
 | 
								flags = append(flags, f)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	return ns
 | 
						})
 | 
				
			||||||
 | 
						c.InheritedFlags().VisitAll(func(f *pflag.Flag) {
 | 
				
			||||||
 | 
							if !f.Hidden {
 | 
				
			||||||
 | 
								flags = append(flags, f)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
						return flags
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// zshCompGenFlagEntryForArguments returns an entry that matches _arguments
 | 
				
			||||||
 | 
					// zsh-completion parameters. It's too complicated to generate in a template.
 | 
				
			||||||
 | 
					func zshCompGenFlagEntryForArguments(f *pflag.Flag) string {
 | 
				
			||||||
 | 
						if f.Name == "" || f.Shorthand == "" {
 | 
				
			||||||
 | 
							return zshCompGenFlagEntryForSingleOptionFlag(f)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return zshCompGenFlagEntryForMultiOptionFlag(f)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func zshCompGenFlagEntryForSingleOptionFlag(f *pflag.Flag) string {
 | 
				
			||||||
 | 
						var option, multiMark, extras string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if zshCompFlagCouldBeSpecifiedMoreThenOnce(f) {
 | 
				
			||||||
 | 
							multiMark = "*"
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						option = "--" + f.Name
 | 
				
			||||||
 | 
						if option == "--" {
 | 
				
			||||||
 | 
							option = "-" + f.Shorthand
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						extras = zshCompGenFlagEntryExtras(f)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return fmt.Sprintf(`'%s%s[%s]%s'`, multiMark, option, zshCompQuoteFlagDescription(f.Usage), extras)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func zshCompGenFlagEntryForMultiOptionFlag(f *pflag.Flag) string {
 | 
				
			||||||
 | 
						var options, parenMultiMark, curlyMultiMark, extras string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if zshCompFlagCouldBeSpecifiedMoreThenOnce(f) {
 | 
				
			||||||
 | 
							parenMultiMark = "*"
 | 
				
			||||||
 | 
							curlyMultiMark = "\\*"
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						options = fmt.Sprintf(`'(%s-%s %s--%s)'{%s-%s,%s--%s}`,
 | 
				
			||||||
 | 
							parenMultiMark, f.Shorthand, parenMultiMark, f.Name, curlyMultiMark, f.Shorthand, curlyMultiMark, f.Name)
 | 
				
			||||||
 | 
						extras = zshCompGenFlagEntryExtras(f)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return fmt.Sprintf(`%s'[%s]%s'`, options, zshCompQuoteFlagDescription(f.Usage), extras)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func zshCompGenFlagEntryExtras(f *pflag.Flag) string {
 | 
				
			||||||
 | 
						if f.NoOptDefVal != "" {
 | 
				
			||||||
 | 
							return ""
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						extras := ":" // allow options for flag (even without assistance)
 | 
				
			||||||
 | 
						for key, values := range f.Annotations {
 | 
				
			||||||
 | 
							switch key {
 | 
				
			||||||
 | 
							case zshCompDirname:
 | 
				
			||||||
 | 
								extras = fmt.Sprintf(":filename:_files -g %q", values[0])
 | 
				
			||||||
 | 
							case BashCompFilenameExt:
 | 
				
			||||||
 | 
								extras = ":filename:_files"
 | 
				
			||||||
 | 
								for _, pattern := range values {
 | 
				
			||||||
 | 
									extras = extras + fmt.Sprintf(` -g "%s"`, pattern)
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return extras
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func zshCompFlagCouldBeSpecifiedMoreThenOnce(f *pflag.Flag) bool {
 | 
				
			||||||
 | 
						return strings.Contains(f.Value.Type(), "Slice") ||
 | 
				
			||||||
 | 
							strings.Contains(f.Value.Type(), "Array")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func zshCompQuoteFlagDescription(s string) string {
 | 
				
			||||||
 | 
						return strings.Replace(s, "'", `'\''`, -1)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										39
									
								
								vendor/github.com/spf13/cobra/zsh_completions.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								vendor/github.com/spf13/cobra/zsh_completions.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
				
			|||||||
 | 
					## Generating Zsh Completion for your cobra.Command
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Cobra supports native Zsh completion generated from the root `cobra.Command`.
 | 
				
			||||||
 | 
					The generated completion script should be put somewhere in your `$fpath` named
 | 
				
			||||||
 | 
					`_<YOUR COMMAND>`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### What's Supported
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Completion for all non-hidden subcommands using their `.Short` description.
 | 
				
			||||||
 | 
					* Completion for all non-hidden flags using the following rules:
 | 
				
			||||||
 | 
					  * Filename completion works by marking the flag with `cmd.MarkFlagFilename...`
 | 
				
			||||||
 | 
					    family of commands.
 | 
				
			||||||
 | 
					  * The requirement for argument to the flag is decided by the `.NoOptDefVal`
 | 
				
			||||||
 | 
					    flag value - if it's empty then completion will expect an argument.
 | 
				
			||||||
 | 
					  * Flags of one of the various `*Array` and `*Slice` types supports multiple
 | 
				
			||||||
 | 
					    specifications (with or without argument depending on the specific type).
 | 
				
			||||||
 | 
					* Completion of positional arguments using the following rules:
 | 
				
			||||||
 | 
					  * Argument position for all options below starts at `1`. If argument position
 | 
				
			||||||
 | 
					    `0` is requested it will raise an error.
 | 
				
			||||||
 | 
					  * Use `command.MarkZshCompPositionalArgumentFile` to complete filenames. Glob
 | 
				
			||||||
 | 
					    patterns (e.g. `"*.log"`) are optional - if not specified it will offer to
 | 
				
			||||||
 | 
					    complete all file types.
 | 
				
			||||||
 | 
					  * Use `command.MarkZshCompPositionalArgumentWords` to offer specific words for
 | 
				
			||||||
 | 
					    completion. At least one word is required.
 | 
				
			||||||
 | 
					  * It's possible to specify completion for some arguments and leave some
 | 
				
			||||||
 | 
					    unspecified (e.g. offer words for second argument but nothing for first
 | 
				
			||||||
 | 
					    argument). This will cause no completion for first argument but words
 | 
				
			||||||
 | 
					    completion for second argument.
 | 
				
			||||||
 | 
					  * If no argument completion was specified for 1st argument (but optionally was
 | 
				
			||||||
 | 
					    specified for 2nd) and the command has `ValidArgs` it will be used as
 | 
				
			||||||
 | 
					    completion options for 1st argument.
 | 
				
			||||||
 | 
					  * Argument completions only offered for commands with no subcommands.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### What's not yet Supported
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Custom completion scripts are not supported yet (We should probably create zsh
 | 
				
			||||||
 | 
					  specific one, doesn't make sense to re-use the bash one as the functions will
 | 
				
			||||||
 | 
					  be different).
 | 
				
			||||||
 | 
					* Whatever other feature you're looking for and doesn't exist :)
 | 
				
			||||||
							
								
								
									
										4
									
								
								vendor/github.com/tonistiigi/fsutil/tarwriter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/tonistiigi/fsutil/tarwriter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -37,8 +37,12 @@ func WriteTar(ctx context.Context, fs FS, w io.Writer) error {
 | 
				
			|||||||
		hdr.Linkname = stat.Linkname
 | 
							hdr.Linkname = stat.Linkname
 | 
				
			||||||
		if hdr.Linkname != "" {
 | 
							if hdr.Linkname != "" {
 | 
				
			||||||
			hdr.Size = 0
 | 
								hdr.Size = 0
 | 
				
			||||||
 | 
								if fi.Mode() & os.ModeSymlink != 0 {
 | 
				
			||||||
 | 
									hdr.Typeflag = tar.TypeSymlink
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
				hdr.Typeflag = tar.TypeLink
 | 
									hdr.Typeflag = tar.TypeLink
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if len(stat.Xattrs) > 0 {
 | 
							if len(stat.Xattrs) > 0 {
 | 
				
			||||||
			hdr.PAXRecords = map[string]string{}
 | 
								hdr.PAXRecords = map[string]string{}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										21
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							@@ -32,7 +32,7 @@ github.com/agl/ed25519
 | 
				
			|||||||
github.com/agl/ed25519/edwards25519
 | 
					github.com/agl/ed25519/edwards25519
 | 
				
			||||||
# github.com/apparentlymart/go-textseg/v12 v12.0.0
 | 
					# github.com/apparentlymart/go-textseg/v12 v12.0.0
 | 
				
			||||||
github.com/apparentlymart/go-textseg/v12/textseg
 | 
					github.com/apparentlymart/go-textseg/v12/textseg
 | 
				
			||||||
# github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
 | 
					# github.com/beorn7/perks v1.0.0
 | 
				
			||||||
github.com/beorn7/perks/quantile
 | 
					github.com/beorn7/perks/quantile
 | 
				
			||||||
# github.com/containerd/cgroups v0.0.0-20200217135630-d732e370d46d
 | 
					# github.com/containerd/cgroups v0.0.0-20200217135630-d732e370d46d
 | 
				
			||||||
github.com/containerd/cgroups/stats/v1
 | 
					github.com/containerd/cgroups/stats/v1
 | 
				
			||||||
@@ -164,7 +164,7 @@ github.com/docker/go-units
 | 
				
			|||||||
# github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c
 | 
					# github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c
 | 
				
			||||||
github.com/docker/spdystream
 | 
					github.com/docker/spdystream
 | 
				
			||||||
github.com/docker/spdystream/spdy
 | 
					github.com/docker/spdystream/spdy
 | 
				
			||||||
# github.com/gofrs/flock v0.7.0
 | 
					# github.com/gofrs/flock v0.7.2
 | 
				
			||||||
github.com/gofrs/flock
 | 
					github.com/gofrs/flock
 | 
				
			||||||
# github.com/gogo/googleapis v1.3.2
 | 
					# github.com/gogo/googleapis v1.3.2
 | 
				
			||||||
github.com/gogo/googleapis/google/rpc
 | 
					github.com/gogo/googleapis/google/rpc
 | 
				
			||||||
@@ -208,7 +208,7 @@ github.com/gorilla/mux
 | 
				
			|||||||
github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc
 | 
					github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc
 | 
				
			||||||
# github.com/hashicorp/golang-lru v0.5.1
 | 
					# github.com/hashicorp/golang-lru v0.5.1
 | 
				
			||||||
github.com/hashicorp/golang-lru/simplelru
 | 
					github.com/hashicorp/golang-lru/simplelru
 | 
				
			||||||
# github.com/hashicorp/hcl/v2 v2.4.0
 | 
					# github.com/hashicorp/hcl/v2 v2.6.0
 | 
				
			||||||
github.com/hashicorp/hcl/v2
 | 
					github.com/hashicorp/hcl/v2
 | 
				
			||||||
github.com/hashicorp/hcl/v2/ext/customdecode
 | 
					github.com/hashicorp/hcl/v2/ext/customdecode
 | 
				
			||||||
github.com/hashicorp/hcl/v2/ext/userfunc
 | 
					github.com/hashicorp/hcl/v2/ext/userfunc
 | 
				
			||||||
@@ -225,7 +225,7 @@ github.com/inconshreveable/mousetrap
 | 
				
			|||||||
github.com/jaguilar/vt100
 | 
					github.com/jaguilar/vt100
 | 
				
			||||||
# github.com/json-iterator/go v1.1.7
 | 
					# github.com/json-iterator/go v1.1.7
 | 
				
			||||||
github.com/json-iterator/go
 | 
					github.com/json-iterator/go
 | 
				
			||||||
# github.com/konsorten/go-windows-terminal-sequences v1.0.2
 | 
					# github.com/konsorten/go-windows-terminal-sequences v1.0.3
 | 
				
			||||||
github.com/konsorten/go-windows-terminal-sequences
 | 
					github.com/konsorten/go-windows-terminal-sequences
 | 
				
			||||||
# github.com/mattn/go-shellwords v1.0.5
 | 
					# github.com/mattn/go-shellwords v1.0.5
 | 
				
			||||||
github.com/mattn/go-shellwords
 | 
					github.com/mattn/go-shellwords
 | 
				
			||||||
@@ -237,7 +237,7 @@ github.com/miekg/pkcs11
 | 
				
			|||||||
github.com/mitchellh/go-wordwrap
 | 
					github.com/mitchellh/go-wordwrap
 | 
				
			||||||
# github.com/mitchellh/mapstructure v1.1.2
 | 
					# github.com/mitchellh/mapstructure v1.1.2
 | 
				
			||||||
github.com/mitchellh/mapstructure
 | 
					github.com/mitchellh/mapstructure
 | 
				
			||||||
# github.com/moby/buildkit v0.7.0
 | 
					# github.com/moby/buildkit v0.7.2
 | 
				
			||||||
github.com/moby/buildkit/api/services/control
 | 
					github.com/moby/buildkit/api/services/control
 | 
				
			||||||
github.com/moby/buildkit/api/types
 | 
					github.com/moby/buildkit/api/types
 | 
				
			||||||
github.com/moby/buildkit/client
 | 
					github.com/moby/buildkit/client
 | 
				
			||||||
@@ -291,12 +291,13 @@ github.com/opentracing/opentracing-go/log
 | 
				
			|||||||
github.com/pkg/errors
 | 
					github.com/pkg/errors
 | 
				
			||||||
# github.com/pmezard/go-difflib v1.0.0
 | 
					# github.com/pmezard/go-difflib v1.0.0
 | 
				
			||||||
github.com/pmezard/go-difflib/difflib
 | 
					github.com/pmezard/go-difflib/difflib
 | 
				
			||||||
# github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06
 | 
					# github.com/prometheus/client_golang v0.9.3
 | 
				
			||||||
github.com/prometheus/client_golang/prometheus
 | 
					github.com/prometheus/client_golang/prometheus
 | 
				
			||||||
 | 
					github.com/prometheus/client_golang/prometheus/internal
 | 
				
			||||||
github.com/prometheus/client_golang/prometheus/promhttp
 | 
					github.com/prometheus/client_golang/prometheus/promhttp
 | 
				
			||||||
# github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4
 | 
					# github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4
 | 
				
			||||||
github.com/prometheus/client_model/go
 | 
					github.com/prometheus/client_model/go
 | 
				
			||||||
# github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1
 | 
					# github.com/prometheus/common v0.4.0
 | 
				
			||||||
github.com/prometheus/common/expfmt
 | 
					github.com/prometheus/common/expfmt
 | 
				
			||||||
github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg
 | 
					github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg
 | 
				
			||||||
github.com/prometheus/common/model
 | 
					github.com/prometheus/common/model
 | 
				
			||||||
@@ -306,9 +307,9 @@ github.com/prometheus/procfs/internal/fs
 | 
				
			|||||||
github.com/prometheus/procfs/internal/util
 | 
					github.com/prometheus/procfs/internal/util
 | 
				
			||||||
# github.com/serialx/hashring v0.0.0-20190422032157-8b2912629002
 | 
					# github.com/serialx/hashring v0.0.0-20190422032157-8b2912629002
 | 
				
			||||||
github.com/serialx/hashring
 | 
					github.com/serialx/hashring
 | 
				
			||||||
# github.com/sirupsen/logrus v1.4.2
 | 
					# github.com/sirupsen/logrus v1.6.0
 | 
				
			||||||
github.com/sirupsen/logrus
 | 
					github.com/sirupsen/logrus
 | 
				
			||||||
# github.com/spf13/cobra v0.0.3
 | 
					# github.com/spf13/cobra v1.0.0
 | 
				
			||||||
github.com/spf13/cobra
 | 
					github.com/spf13/cobra
 | 
				
			||||||
# github.com/spf13/pflag v1.0.5
 | 
					# github.com/spf13/pflag v1.0.5
 | 
				
			||||||
github.com/spf13/pflag
 | 
					github.com/spf13/pflag
 | 
				
			||||||
@@ -330,7 +331,7 @@ github.com/theupdateframework/notary/tuf/data
 | 
				
			|||||||
github.com/theupdateframework/notary/tuf/signed
 | 
					github.com/theupdateframework/notary/tuf/signed
 | 
				
			||||||
github.com/theupdateframework/notary/tuf/utils
 | 
					github.com/theupdateframework/notary/tuf/utils
 | 
				
			||||||
github.com/theupdateframework/notary/tuf/validation
 | 
					github.com/theupdateframework/notary/tuf/validation
 | 
				
			||||||
# github.com/tonistiigi/fsutil v0.0.0-20200225063759-013a9fe6aee2
 | 
					# github.com/tonistiigi/fsutil v0.0.0-20200326231323-c2c7d7b0e144
 | 
				
			||||||
github.com/tonistiigi/fsutil
 | 
					github.com/tonistiigi/fsutil
 | 
				
			||||||
github.com/tonistiigi/fsutil/types
 | 
					github.com/tonistiigi/fsutil/types
 | 
				
			||||||
# github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea
 | 
					# github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user