mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-16 16:37:10 +08:00
vendor: update buildkit to opentelemetry support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
4
vendor/github.com/tonistiigi/fsutil/Dockerfile
generated
vendored
4
vendor/github.com/tonistiigi/fsutil/Dockerfile
generated
vendored
@ -1,5 +1,5 @@
|
||||
#syntax=docker/dockerfile:1.1-experimental
|
||||
ARG GO_VERSION=1.13
|
||||
#syntax=docker/dockerfile:1.2
|
||||
ARG GO_VERSION=1.16
|
||||
|
||||
FROM --platform=amd64 tonistiigi/xx:golang AS goxx
|
||||
|
||||
|
51
vendor/github.com/tonistiigi/fsutil/diff_containerd.go
generated
vendored
51
vendor/github.com/tonistiigi/fsutil/diff_containerd.go
generated
vendored
@ -1,7 +1,9 @@
|
||||
package fsutil
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@ -35,6 +37,8 @@ const (
|
||||
// computed during a directory changes calculation.
|
||||
type ChangeFunc func(ChangeKind, string, os.FileInfo, error) error
|
||||
|
||||
const compareChunkSize = 32 * 1024
|
||||
|
||||
type currentPath struct {
|
||||
path string
|
||||
stat *types.Stat
|
||||
@ -42,7 +46,7 @@ type currentPath struct {
|
||||
}
|
||||
|
||||
// doubleWalkDiff walks both directories to create a diff
|
||||
func doubleWalkDiff(ctx context.Context, changeFn ChangeFunc, a, b walkerFn, filter FilterFunc) (err error) {
|
||||
func doubleWalkDiff(ctx context.Context, changeFn ChangeFunc, a, b walkerFn, filter FilterFunc, differ DiffType) (err error) {
|
||||
g, ctx := errgroup.WithContext(ctx)
|
||||
|
||||
var (
|
||||
@ -116,7 +120,7 @@ func doubleWalkDiff(ctx context.Context, changeFn ChangeFunc, a, b walkerFn, fil
|
||||
}
|
||||
f1 = nil
|
||||
case ChangeKindModify:
|
||||
same, err := sameFile(f1, f2copy)
|
||||
same, err := sameFile(f1, f2copy, differ)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -165,7 +169,10 @@ func pathChange(lower, upper *currentPath) (ChangeKind, string) {
|
||||
}
|
||||
}
|
||||
|
||||
func sameFile(f1, f2 *currentPath) (same bool, retErr error) {
|
||||
func sameFile(f1, f2 *currentPath, differ DiffType) (same bool, retErr error) {
|
||||
if differ == DiffNone {
|
||||
return false, nil
|
||||
}
|
||||
// If not a directory also check size, modtime, and content
|
||||
if !f1.stat.IsDir() {
|
||||
if f1.stat.Size_ != f2.stat.Size_ {
|
||||
@ -177,7 +184,43 @@ func sameFile(f1, f2 *currentPath) (same bool, retErr error) {
|
||||
}
|
||||
}
|
||||
|
||||
return compareStat(f1.stat, f2.stat)
|
||||
same, err := compareStat(f1.stat, f2.stat)
|
||||
if err != nil || !same || differ == DiffMetadata {
|
||||
return same, err
|
||||
}
|
||||
return compareFileContent(f1.path, f2.path)
|
||||
}
|
||||
|
||||
func compareFileContent(p1, p2 string) (bool, error) {
|
||||
f1, err := os.Open(p1)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
defer f1.Close()
|
||||
f2, err := os.Open(p2)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
defer f2.Close()
|
||||
|
||||
b1 := make([]byte, compareChunkSize)
|
||||
b2 := make([]byte, compareChunkSize)
|
||||
for {
|
||||
n1, err1 := f1.Read(b1)
|
||||
if err1 != nil && err1 != io.EOF {
|
||||
return false, err1
|
||||
}
|
||||
n2, err2 := f2.Read(b2)
|
||||
if err2 != nil && err2 != io.EOF {
|
||||
return false, err2
|
||||
}
|
||||
if n1 != n2 || !bytes.Equal(b1[:n1], b2[:n2]) {
|
||||
return false, nil
|
||||
}
|
||||
if err1 == io.EOF && err2 == io.EOF {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// compareStat returns whether the stats are equivalent,
|
||||
|
13
vendor/github.com/tonistiigi/fsutil/docker-bake.hcl
generated
vendored
13
vendor/github.com/tonistiigi/fsutil/docker-bake.hcl
generated
vendored
@ -1,5 +1,5 @@
|
||||
variable "GO_VERSION" {
|
||||
default = "1.13"
|
||||
default = "1.16"
|
||||
}
|
||||
|
||||
group "default" {
|
||||
@ -28,11 +28,20 @@ target "test-noroot" {
|
||||
|
||||
target "lint" {
|
||||
dockerfile = "./hack/dockerfiles/lint.Dockerfile"
|
||||
args = {
|
||||
GO_VERSION = "${GO_VERSION}"
|
||||
}
|
||||
}
|
||||
|
||||
target "validate-gomod" {
|
||||
dockerfile = "./hack/dockerfiles/gomod.Dockerfile"
|
||||
target = "validate"
|
||||
args = {
|
||||
# go mod may produce different results between go versions,
|
||||
# if this becomes a problem, this should be switched to use
|
||||
# a fixed go version.
|
||||
GO_VERSION = "${GO_VERSION}"
|
||||
}
|
||||
}
|
||||
|
||||
target "gomod" {
|
||||
@ -54,5 +63,5 @@ target "shfmt" {
|
||||
|
||||
target "cross" {
|
||||
inherits = ["build"]
|
||||
platforms = ["linux/amd64", "linux/arm64", "linux/arm", "linux/ppc64le", "linux/s390x"]
|
||||
platforms = ["linux/amd64", "linux/386", "linux/arm64", "linux/arm", "linux/ppc64le", "linux/s390x"]
|
||||
}
|
||||
|
24
vendor/github.com/tonistiigi/fsutil/go.mod
generated
vendored
24
vendor/github.com/tonistiigi/fsutil/go.mod
generated
vendored
@ -3,18 +3,18 @@ module github.com/tonistiigi/fsutil
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/Microsoft/hcsshim v0.8.9 // indirect
|
||||
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc
|
||||
github.com/docker/docker v0.0.0-20200511152416-a93e9eb0e95c
|
||||
github.com/gogo/protobuf v1.3.1
|
||||
github.com/moby/sys/mount v0.1.0 // indirect
|
||||
github.com/moby/sys/mountinfo v0.1.3 // indirect
|
||||
github.com/containerd/continuity v0.1.0
|
||||
github.com/docker/docker v20.10.3-0.20210609071616-4c2ec79bf2a8+incompatible // master (v21.xx-dev)
|
||||
github.com/gogo/protobuf v1.3.2
|
||||
github.com/golang/protobuf v1.4.3 // indirect
|
||||
github.com/google/go-cmp v0.5.2 // indirect
|
||||
github.com/kr/pretty v0.2.0 // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0
|
||||
github.com/opencontainers/image-spec v1.0.1 // indirect
|
||||
github.com/opencontainers/runc v1.0.0-rc10 // indirect
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/stretchr/testify v1.5.1
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58
|
||||
golang.org/x/sys v0.0.0-20200917073148-efd3b9a0ff20
|
||||
gotest.tools/v3 v3.0.2 // indirect
|
||||
github.com/stretchr/testify v1.7.0
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||
golang.org/x/sys v0.0.0-20210313202042-bd2e13477e9c
|
||||
google.golang.org/protobuf v1.25.0 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
|
||||
gotest.tools/v3 v3.0.3 // indirect
|
||||
)
|
||||
|
243
vendor/github.com/tonistiigi/fsutil/go.sum
generated
vendored
243
vendor/github.com/tonistiigi/fsutil/go.sum
generated
vendored
@ -1,145 +1,230 @@
|
||||
bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
|
||||
github.com/Microsoft/hcsshim v0.8.9 h1:VrfodqvztU8YSOvygU+DN1BGaSGxmrNfqOv5oOuX2Bk=
|
||||
github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg38RRsjT5y8=
|
||||
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/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko=
|
||||
github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw=
|
||||
github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
|
||||
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc h1:TP+534wVlf61smEIq1nwLLAjQVEK2EADoW3CX9AuT+8=
|
||||
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
|
||||
github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI=
|
||||
github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0=
|
||||
github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o=
|
||||
github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc=
|
||||
github.com/containerd/continuity v0.1.0 h1:UFRRY5JemiAhPZrr/uE0n8fMTLcZsUvySPr1+D7pgr8=
|
||||
github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM=
|
||||
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/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
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/docker/docker v0.0.0-20200511152416-a93e9eb0e95c h1:lT1n7uwNkk4AYaLA9RUKqWHP0OflD1Zif6mfOAvEyEA=
|
||||
github.com/docker/docker v0.0.0-20200511152416-a93e9eb0e95c/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
|
||||
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
|
||||
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/docker/docker v20.10.3-0.20210609071616-4c2ec79bf2a8+incompatible h1:vDUpBEVNJURujPYAl6dHaG0UDLJ7vl7m8/ZZOjAP3gg=
|
||||
github.com/docker/docker v20.10.3-0.20210609071616-4c2ec79bf2a8+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
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/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
|
||||
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
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 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||
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/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
|
||||
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
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/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
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/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
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/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
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/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
|
||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
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/moby/sys/mount v0.1.0 h1:Ytx78EatgFKtrqZ0BvJ0UtJE472ZvawVmil6pIfuCCU=
|
||||
github.com/moby/sys/mount v0.1.0/go.mod h1:FVQFLDRWwyBjDTBNQXDlWnSFREqOo3OKX9aqhmeoo74=
|
||||
github.com/moby/sys/mountinfo v0.1.0/go.mod h1:w2t2Avltqx8vE7gX5l+QiBKxODu2TX0+Syr3h52Tw4o=
|
||||
github.com/moby/sys/mountinfo v0.1.3 h1:KIrhRO14+AkwKvG/g2yIpNMOUVZ02xNhOw8KY1WsLOI=
|
||||
github.com/moby/sys/mountinfo v0.1.3/go.mod h1:w2t2Avltqx8vE7gX5l+QiBKxODu2TX0+Syr3h52Tw4o=
|
||||
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
|
||||
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/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
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/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||
github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI=
|
||||
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||
github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
|
||||
github.com/opencontainers/runc v1.0.0-rc10 h1:AbmCEuSZXVflng0/cboQkpdEOeBsPMjz6tmq4Pv8MZw=
|
||||
github.com/opencontainers/runc v1.0.0-rc10/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
|
||||
github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
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/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/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/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
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/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
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/client_model v0.0.0-20190812154241-14fe0d1b01d4/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/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
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/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
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/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
|
||||
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/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
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=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
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/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/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-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-20190213061140-3a22650c66bd/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-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/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-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||
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-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/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/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3 h1:7TYNF4UdlohbFwpNH04CoPMp1cHUZgO1Ebq5r2hIjfo=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200917073148-efd3b9a0ff20 h1:4X356008q5SA3YXu8PiRap39KFmy4Lf6sGlceJKZQsU=
|
||||
golang.org/x/sys v0.0.0-20200917073148-efd3b9a0ff20/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210313202042-bd2e13477e9c h1:coiPEfMv+ThsjULRDygLrJVlNE1gDdL2g65s0LhV2os=
|
||||
golang.org/x/sys v0.0.0-20210313202042-bd2e13477e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
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-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/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-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
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 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/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/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/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
||||
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||
gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E=
|
||||
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0=
|
||||
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
45
vendor/github.com/tonistiigi/fsutil/prefix/match.go
generated
vendored
Normal file
45
vendor/github.com/tonistiigi/fsutil/prefix/match.go
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
package prefix
|
||||
|
||||
import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Match matches a path against a pattern. It returns m = true if the path
|
||||
// matches the pattern, and partial = true if the pattern has more separators
|
||||
// than the path and the common components match (for example, name = foo and
|
||||
// pattern = foo/bar/*). slashSeparator determines whether the path and pattern
|
||||
// are '/' delimited (true) or use the native path separator (false).
|
||||
func Match(pattern, name string, slashSeparator bool) (m bool, partial bool) {
|
||||
separator := filepath.Separator
|
||||
if slashSeparator {
|
||||
separator = '/'
|
||||
}
|
||||
count := strings.Count(name, string(separator))
|
||||
if strings.Count(pattern, string(separator)) > count {
|
||||
pattern = trimUntilIndex(pattern, string(separator), count)
|
||||
partial = true
|
||||
}
|
||||
if slashSeparator {
|
||||
m, _ = path.Match(pattern, name)
|
||||
} else {
|
||||
m, _ = filepath.Match(pattern, name)
|
||||
}
|
||||
return m, partial
|
||||
}
|
||||
|
||||
func trimUntilIndex(str, sep string, count int) string {
|
||||
s := str
|
||||
i := 0
|
||||
c := 0
|
||||
for {
|
||||
idx := strings.Index(s, sep)
|
||||
s = s[idx+len(sep):]
|
||||
i += idx + len(sep)
|
||||
c++
|
||||
if c > count {
|
||||
return str[:i-len(sep)]
|
||||
}
|
||||
}
|
||||
}
|
13
vendor/github.com/tonistiigi/fsutil/receive.go
generated
vendored
13
vendor/github.com/tonistiigi/fsutil/receive.go
generated
vendored
@ -11,12 +11,21 @@ import (
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
type DiffType int
|
||||
|
||||
const (
|
||||
DiffMetadata DiffType = iota
|
||||
DiffNone
|
||||
DiffContent
|
||||
)
|
||||
|
||||
type ReceiveOpt struct {
|
||||
NotifyHashed ChangeFunc
|
||||
ContentHasher ContentHasher
|
||||
ProgressCb func(int, bool)
|
||||
Merge bool
|
||||
Filter FilterFunc
|
||||
Differ DiffType
|
||||
}
|
||||
|
||||
func Receive(ctx context.Context, conn Stream, dest string, opt ReceiveOpt) error {
|
||||
@ -33,6 +42,7 @@ func Receive(ctx context.Context, conn Stream, dest string, opt ReceiveOpt) erro
|
||||
progressCb: opt.ProgressCb,
|
||||
merge: opt.Merge,
|
||||
filter: opt.Filter,
|
||||
differ: opt.Differ,
|
||||
}
|
||||
return r.run(ctx)
|
||||
}
|
||||
@ -47,6 +57,7 @@ type receiver struct {
|
||||
progressCb func(int, bool)
|
||||
merge bool
|
||||
filter FilterFunc
|
||||
differ DiffType
|
||||
|
||||
notifyHashed ChangeFunc
|
||||
contentHasher ContentHasher
|
||||
@ -132,7 +143,7 @@ func (r *receiver) run(ctx context.Context) error {
|
||||
if !r.merge {
|
||||
destWalker = getWalkerFn(r.dest)
|
||||
}
|
||||
err := doubleWalkDiff(ctx, dw.HandleChange, destWalker, w.fill, r.filter)
|
||||
err := doubleWalkDiff(ctx, dw.HandleChange, destWalker, w.fill, r.filter, r.differ)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
31
vendor/github.com/tonistiigi/fsutil/walker.go
generated
vendored
31
vendor/github.com/tonistiigi/fsutil/walker.go
generated
vendored
@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/docker/docker/pkg/fileutils"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tonistiigi/fsutil/prefix"
|
||||
"github.com/tonistiigi/fsutil/types"
|
||||
)
|
||||
|
||||
@ -96,8 +97,8 @@ func Walk(ctx context.Context, p string, opt *WalkOpt, fn filepath.WalkFunc) err
|
||||
if !skip {
|
||||
matched := false
|
||||
partial := true
|
||||
for _, p := range includePatterns {
|
||||
if ok, p := matchPrefix(p, path); ok {
|
||||
for _, pattern := range includePatterns {
|
||||
if ok, p := prefix.Match(pattern, path, false); ok {
|
||||
matched = true
|
||||
if !p {
|
||||
partial = false
|
||||
@ -190,32 +191,6 @@ func (s *StatInfo) Sys() interface{} {
|
||||
return s.Stat
|
||||
}
|
||||
|
||||
func matchPrefix(pattern, name string) (bool, bool) {
|
||||
count := strings.Count(name, string(filepath.Separator))
|
||||
partial := false
|
||||
if strings.Count(pattern, string(filepath.Separator)) > count {
|
||||
pattern = trimUntilIndex(pattern, string(filepath.Separator), count)
|
||||
partial = true
|
||||
}
|
||||
m, _ := filepath.Match(pattern, name)
|
||||
return m, partial
|
||||
}
|
||||
|
||||
func trimUntilIndex(str, sep string, count int) string {
|
||||
s := str
|
||||
i := 0
|
||||
c := 0
|
||||
for {
|
||||
idx := strings.Index(s, sep)
|
||||
s = s[idx+len(sep):]
|
||||
i += idx + len(sep)
|
||||
c++
|
||||
if c > count {
|
||||
return str[:i-len(sep)]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func isNotExist(err error) bool {
|
||||
return errors.Is(err, os.ErrNotExist) || errors.Is(err, syscall.ENOTDIR)
|
||||
}
|
||||
|
1
vendor/github.com/tonistiigi/vt100/.travis.yml
generated
vendored
Normal file
1
vendor/github.com/tonistiigi/vt100/.travis.yml
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
language: go
|
22
vendor/github.com/tonistiigi/vt100/LICENSE
generated
vendored
Normal file
22
vendor/github.com/tonistiigi/vt100/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 James Aguilar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
30
vendor/github.com/tonistiigi/vt100/README.md
generated
vendored
Normal file
30
vendor/github.com/tonistiigi/vt100/README.md
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
#VT100
|
||||
|
||||
[](https://godoc.org/github.com/tonistiigi/vt100)
|
||||
|
||||
This project was based on [jaguilar/vt100](https://github.com/jaguilar/vt100)
|
||||
|
||||
This is a vt100 screen reader. It seems to do a pretty
|
||||
decent job of parsing the nethack input stream, which
|
||||
is all I want it for anyway.
|
||||
|
||||
Here is a screenshot of the HTML-formatted screen data:
|
||||
|
||||

|
||||
|
||||
The features we currently support:
|
||||
|
||||
* Cursor movement
|
||||
* Erasing
|
||||
* Many of the text properties -- underline, inverse, blink, etc.
|
||||
* Sixteen colors
|
||||
* Cursor saving and unsaving
|
||||
* UTF-8
|
||||
* Scrolling
|
||||
|
||||
Not currently supported (and no plans to support):
|
||||
|
||||
* Prompts
|
||||
* Other cooked mode features
|
||||
|
||||
The API is not stable! This is a v0 package.
|
288
vendor/github.com/tonistiigi/vt100/command.go
generated
vendored
Normal file
288
vendor/github.com/tonistiigi/vt100/command.go
generated
vendored
Normal file
@ -0,0 +1,288 @@
|
||||
package vt100
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"expvar"
|
||||
"fmt"
|
||||
"image/color"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// UnsupportedError indicates that we parsed an operation that this
|
||||
// terminal does not implement. Such errors indicate that the client
|
||||
// program asked us to perform an action that we don't know how to.
|
||||
// It MAY be safe to continue trying to do additional operations.
|
||||
// This is a distinct category of errors from things we do know how
|
||||
// to do, but are badly encoded, or errors from the underlying io.RuneScanner
|
||||
// that we're reading commands from.
|
||||
type UnsupportedError struct {
|
||||
error
|
||||
}
|
||||
|
||||
var (
|
||||
supportErrors = expvar.NewMap("vt100-unsupported-operations")
|
||||
)
|
||||
|
||||
func supportError(e error) error {
|
||||
supportErrors.Add(e.Error(), 1)
|
||||
return UnsupportedError{e}
|
||||
}
|
||||
|
||||
// Command is a type of object that the terminal can process to perform
|
||||
// an update.
|
||||
type Command interface {
|
||||
display(v *VT100) error
|
||||
}
|
||||
|
||||
// runeCommand is a simple command that just writes a rune
|
||||
// to the current cell and advances the cursor.
|
||||
type runeCommand rune
|
||||
|
||||
func (r runeCommand) display(v *VT100) error {
|
||||
v.put(rune(r))
|
||||
return nil
|
||||
}
|
||||
|
||||
// escapeCommand is a control sequence command. It includes a variety
|
||||
// of control and escape sequences that move and modify the cursor
|
||||
// or the terminal.
|
||||
type escapeCommand struct {
|
||||
cmd rune
|
||||
args string
|
||||
}
|
||||
|
||||
func (c escapeCommand) String() string {
|
||||
return fmt.Sprintf("[%q %U](%v)", c.cmd, c.cmd, c.args)
|
||||
}
|
||||
|
||||
type intHandler func(*VT100, []int) error
|
||||
|
||||
var (
|
||||
// intHandlers are handlers for which all arguments are numbers.
|
||||
// This is most of them -- all the ones that we process. Eventually,
|
||||
// we may add handlers that support non-int args. Those handlers
|
||||
// will instead receive []string, and they'll have to choose on their
|
||||
// own how they might be parsed.
|
||||
intHandlers = map[rune]intHandler{
|
||||
's': save,
|
||||
'7': save,
|
||||
'u': unsave,
|
||||
'8': unsave,
|
||||
'A': relativeMove(-1, 0),
|
||||
'B': relativeMove(1, 0),
|
||||
'C': relativeMove(0, 1),
|
||||
'D': relativeMove(0, -1),
|
||||
'K': eraseColumns,
|
||||
'J': eraseLines,
|
||||
'H': home,
|
||||
'f': home,
|
||||
'm': updateAttributes,
|
||||
}
|
||||
)
|
||||
|
||||
func save(v *VT100, _ []int) error {
|
||||
v.save()
|
||||
return nil
|
||||
}
|
||||
|
||||
func unsave(v *VT100, _ []int) error {
|
||||
v.unsave()
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
codeColors = []color.RGBA{
|
||||
Black,
|
||||
Red,
|
||||
Green,
|
||||
Yellow,
|
||||
Blue,
|
||||
Magenta,
|
||||
Cyan,
|
||||
White,
|
||||
{}, // Not used.
|
||||
DefaultColor,
|
||||
}
|
||||
)
|
||||
|
||||
// A command to update the attributes of the cursor based on the arg list.
|
||||
func updateAttributes(v *VT100, args []int) error {
|
||||
f := &v.Cursor.F
|
||||
|
||||
var unsupported []int
|
||||
for _, x := range args {
|
||||
switch x {
|
||||
case 0:
|
||||
*f = Format{}
|
||||
case 1:
|
||||
f.Intensity = Bright
|
||||
case 2:
|
||||
f.Intensity = Dim
|
||||
case 22:
|
||||
f.Intensity = Normal
|
||||
case 4:
|
||||
f.Underscore = true
|
||||
case 24:
|
||||
f.Underscore = false
|
||||
case 5, 6:
|
||||
f.Blink = true // We don't distinguish between blink speeds.
|
||||
case 25:
|
||||
f.Blink = false
|
||||
case 7:
|
||||
f.Inverse = true
|
||||
case 27:
|
||||
f.Inverse = false
|
||||
case 8:
|
||||
f.Conceal = true
|
||||
case 28:
|
||||
f.Conceal = false
|
||||
case 30, 31, 32, 33, 34, 35, 36, 37, 39:
|
||||
f.Fg = codeColors[x-30]
|
||||
case 40, 41, 42, 43, 44, 45, 46, 47, 49:
|
||||
f.Bg = codeColors[x-40]
|
||||
// 38 and 48 not supported. Maybe someday.
|
||||
default:
|
||||
unsupported = append(unsupported, x)
|
||||
}
|
||||
}
|
||||
|
||||
if unsupported != nil {
|
||||
return supportError(fmt.Errorf("unknown attributes: %v", unsupported))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func relativeMove(y, x int) func(*VT100, []int) error {
|
||||
return func(v *VT100, args []int) error {
|
||||
c := 1
|
||||
if len(args) >= 1 {
|
||||
c = args[0]
|
||||
}
|
||||
// home is 1-indexed, because that's what the terminal sends us. We want to
|
||||
// reuse its sanitization scheme, so we'll just modify our args by that amount.
|
||||
return home(v, []int{v.Cursor.Y + y*c + 1, v.Cursor.X + x*c + 1})
|
||||
}
|
||||
}
|
||||
|
||||
func eraseColumns(v *VT100, args []int) error {
|
||||
d := eraseForward
|
||||
if len(args) > 0 {
|
||||
d = eraseDirection(args[0])
|
||||
}
|
||||
if d > eraseAll {
|
||||
return fmt.Errorf("unknown erase direction: %d", d)
|
||||
}
|
||||
v.eraseColumns(d)
|
||||
return nil
|
||||
}
|
||||
|
||||
func eraseLines(v *VT100, args []int) error {
|
||||
d := eraseForward
|
||||
if len(args) > 0 {
|
||||
d = eraseDirection(args[0])
|
||||
}
|
||||
if d > eraseAll {
|
||||
return fmt.Errorf("unknown erase direction: %d", d)
|
||||
}
|
||||
v.eraseLines(d)
|
||||
return nil
|
||||
}
|
||||
|
||||
func sanitize(v *VT100, y, x int) (int, int, error) {
|
||||
var err error
|
||||
if y < 0 || y >= v.Height || x < 0 || x >= v.Width {
|
||||
err = fmt.Errorf("out of bounds (%d, %d)", y, x)
|
||||
} else {
|
||||
return y, x, nil
|
||||
}
|
||||
|
||||
if y < 0 {
|
||||
y = 0
|
||||
}
|
||||
if y >= v.Height {
|
||||
y = v.Height - 1
|
||||
}
|
||||
if x < 0 {
|
||||
x = 0
|
||||
}
|
||||
if x >= v.Width {
|
||||
x = v.Width - 1
|
||||
}
|
||||
return y, x, err
|
||||
}
|
||||
|
||||
func home(v *VT100, args []int) error {
|
||||
var y, x int
|
||||
if len(args) >= 2 {
|
||||
y, x = args[0]-1, args[1]-1 // home args are 1-indexed.
|
||||
}
|
||||
y, x, err := sanitize(v, y, x) // Clamp y and x to the bounds of the terminal.
|
||||
v.home(y, x) // Try to do something like what the client asked.
|
||||
return err
|
||||
}
|
||||
|
||||
func (c escapeCommand) display(v *VT100) error {
|
||||
f, ok := intHandlers[c.cmd]
|
||||
if !ok {
|
||||
return supportError(c.err(errors.New("unsupported command")))
|
||||
}
|
||||
|
||||
args, err := c.argInts()
|
||||
if err != nil {
|
||||
return c.err(fmt.Errorf("while parsing int args: %v", err))
|
||||
}
|
||||
|
||||
return f(v, args)
|
||||
}
|
||||
|
||||
// err enhances e with information about the current escape command
|
||||
func (c escapeCommand) err(e error) error {
|
||||
return fmt.Errorf("%s: %s", c, e)
|
||||
}
|
||||
|
||||
var csArgsRe = regexp.MustCompile("^([^0-9]*)(.*)$")
|
||||
|
||||
// argInts parses c.args as a slice of at least arity ints. If the number
|
||||
// of ; separated arguments is less than arity, the remaining elements of
|
||||
// the result will be zero. errors only on integer parsing failure.
|
||||
func (c escapeCommand) argInts() ([]int, error) {
|
||||
if len(c.args) == 0 {
|
||||
return make([]int, 0), nil
|
||||
}
|
||||
args := strings.Split(c.args, ";")
|
||||
out := make([]int, len(args))
|
||||
for i, s := range args {
|
||||
x, err := strconv.ParseInt(s, 10, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out[i] = int(x)
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type controlCommand rune
|
||||
|
||||
const (
|
||||
backspace controlCommand = '\b'
|
||||
_horizontalTab = '\t'
|
||||
linefeed = '\n'
|
||||
_verticalTab = '\v'
|
||||
_formfeed = '\f'
|
||||
carriageReturn = '\r'
|
||||
)
|
||||
|
||||
func (c controlCommand) display(v *VT100) error {
|
||||
switch c {
|
||||
case backspace:
|
||||
v.backspace()
|
||||
case linefeed:
|
||||
v.Cursor.Y++
|
||||
v.Cursor.X = 0
|
||||
case carriageReturn:
|
||||
v.Cursor.X = 0
|
||||
}
|
||||
return nil
|
||||
}
|
5
vendor/github.com/tonistiigi/vt100/go.mod
generated
vendored
Normal file
5
vendor/github.com/tonistiigi/vt100/go.mod
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
module github.com/tonistiigi/vt100
|
||||
|
||||
go 1.12
|
||||
|
||||
require github.com/stretchr/testify v1.3.0
|
7
vendor/github.com/tonistiigi/vt100/go.sum
generated
vendored
Normal file
7
vendor/github.com/tonistiigi/vt100/go.sum
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
97
vendor/github.com/tonistiigi/vt100/scanner.go
generated
vendored
Normal file
97
vendor/github.com/tonistiigi/vt100/scanner.go
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
package vt100
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
// Decode decodes one ANSI terminal command from s.
|
||||
//
|
||||
// s should be connected to a client program that expects an
|
||||
// ANSI terminal on the other end. It will push bytes to us that we are meant
|
||||
// to intepret as terminal control codes, or text to place onto the terminal.
|
||||
//
|
||||
// This Command alone does not actually update the terminal. You need to pass
|
||||
// it to VT100.Process().
|
||||
//
|
||||
// You should not share s with any other reader, because it could leave
|
||||
// the stream in an invalid state.
|
||||
func Decode(s io.RuneScanner) (Command, error) {
|
||||
r, size, err := s.ReadRune()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if r == unicode.ReplacementChar && size == 1 {
|
||||
return nil, fmt.Errorf("non-utf8 data from reader")
|
||||
}
|
||||
|
||||
if r == escape || r == monogramCsi { // At beginning of escape sequence.
|
||||
s.UnreadRune()
|
||||
return scanEscapeCommand(s)
|
||||
}
|
||||
|
||||
if unicode.IsControl(r) {
|
||||
return controlCommand(r), nil
|
||||
}
|
||||
|
||||
return runeCommand(r), nil
|
||||
}
|
||||
|
||||
const (
|
||||
// There are two ways to begin an escape sequence. One is to put the escape byte.
|
||||
// The other is to put the single-rune control sequence indicator, which is equivalent
|
||||
// to putting "\u001b[".
|
||||
escape = '\u001b'
|
||||
monogramCsi = '\u009b'
|
||||
)
|
||||
|
||||
var (
|
||||
csEnd = &unicode.RangeTable{R16: []unicode.Range16{{Lo: 64, Hi: 126, Stride: 1}}}
|
||||
)
|
||||
|
||||
// scanEscapeCommand scans to the end of the current escape sequence. The scanner
|
||||
// must be positioned at an escape rune (esc or the unicode CSI).
|
||||
func scanEscapeCommand(s io.RuneScanner) (Command, error) {
|
||||
csi := false
|
||||
esc, _, err := s.ReadRune()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if esc != escape && esc != monogramCsi {
|
||||
return nil, fmt.Errorf("invalid content")
|
||||
}
|
||||
if esc == monogramCsi {
|
||||
csi = true
|
||||
}
|
||||
|
||||
var args bytes.Buffer
|
||||
quote := false
|
||||
for i := 0; ; i++ {
|
||||
r, _, err := s.ReadRune()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if i == 0 && r == '[' {
|
||||
csi = true
|
||||
continue
|
||||
}
|
||||
|
||||
if !csi {
|
||||
return escapeCommand{r, ""}, nil
|
||||
} else if quote == false && unicode.Is(csEnd, r) {
|
||||
return escapeCommand{r, args.String()}, nil
|
||||
}
|
||||
|
||||
if r == '"' {
|
||||
quote = !quote
|
||||
}
|
||||
|
||||
// Otherwise, we're still in the args, and this rune is one of those args.
|
||||
if _, err := args.WriteRune(r); err != nil {
|
||||
panic(err) // WriteRune cannot return an error from bytes.Buffer.
|
||||
}
|
||||
}
|
||||
}
|
435
vendor/github.com/tonistiigi/vt100/vt100.go
generated
vendored
Normal file
435
vendor/github.com/tonistiigi/vt100/vt100.go
generated
vendored
Normal file
@ -0,0 +1,435 @@
|
||||
// package vt100 implements a quick-and-dirty programmable ANSI terminal emulator.
|
||||
//
|
||||
// You could, for example, use it to run a program like nethack that expects
|
||||
// a terminal as a subprocess. It tracks the position of the cursor,
|
||||
// colors, and various other aspects of the terminal's state, and
|
||||
// allows you to inspect them.
|
||||
//
|
||||
// We do very much mean the dirty part. It's not that we think it might have
|
||||
// bugs. It's that we're SURE it does. Currently, we only handle raw mode, with no
|
||||
// cooked mode features like scrolling. We also misinterpret some of the control
|
||||
// codes, which may or may not matter for your purpose.
|
||||
package vt100
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"image/color"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Intensity int
|
||||
|
||||
const (
|
||||
Normal Intensity = 0
|
||||
Bright = 1
|
||||
Dim = 2
|
||||
// TODO(jaguilar): Should this be in a subpackage, since the names are pretty collide-y?
|
||||
)
|
||||
|
||||
var (
|
||||
// Technically RGBAs are supposed to be premultiplied. But CSS doesn't expect them
|
||||
// that way, so we won't do it in this file.
|
||||
DefaultColor = color.RGBA{0, 0, 0, 0}
|
||||
// Our black has 255 alpha, so it will compare negatively with DefaultColor.
|
||||
Black = color.RGBA{0, 0, 0, 255}
|
||||
Red = color.RGBA{255, 0, 0, 255}
|
||||
Green = color.RGBA{0, 255, 0, 255}
|
||||
Yellow = color.RGBA{255, 255, 0, 255}
|
||||
Blue = color.RGBA{0, 0, 255, 255}
|
||||
Magenta = color.RGBA{255, 0, 255, 255}
|
||||
Cyan = color.RGBA{0, 255, 255, 255}
|
||||
White = color.RGBA{255, 255, 255, 255}
|
||||
)
|
||||
|
||||
func (i Intensity) alpha() uint8 {
|
||||
switch i {
|
||||
case Bright:
|
||||
return 255
|
||||
case Normal:
|
||||
return 170
|
||||
case Dim:
|
||||
return 85
|
||||
default:
|
||||
return 170
|
||||
}
|
||||
}
|
||||
|
||||
// Format represents the display format of text on a terminal.
|
||||
type Format struct {
|
||||
// Fg is the foreground color.
|
||||
Fg color.RGBA
|
||||
// Bg is the background color.
|
||||
Bg color.RGBA
|
||||
// Intensity is the text intensity (bright, normal, dim).
|
||||
Intensity Intensity
|
||||
// Various text properties.
|
||||
Underscore, Conceal, Negative, Blink, Inverse bool
|
||||
}
|
||||
|
||||
func toCss(c color.RGBA) string {
|
||||
return fmt.Sprintf("rgba(%d, %d, %d, %f)", c.R, c.G, c.B, float32(c.A)/255)
|
||||
}
|
||||
|
||||
func (f Format) css() string {
|
||||
parts := make([]string, 0)
|
||||
fg, bg := f.Fg, f.Bg
|
||||
if f.Inverse {
|
||||
bg, fg = fg, bg
|
||||
}
|
||||
|
||||
if f.Intensity != Normal {
|
||||
// Intensity only applies to the text -- i.e., the foreground.
|
||||
fg.A = f.Intensity.alpha()
|
||||
}
|
||||
|
||||
if fg != DefaultColor {
|
||||
parts = append(parts, "color:"+toCss(fg))
|
||||
}
|
||||
if bg != DefaultColor {
|
||||
parts = append(parts, "background-color:"+toCss(bg))
|
||||
}
|
||||
if f.Underscore {
|
||||
parts = append(parts, "text-decoration:underline")
|
||||
}
|
||||
if f.Conceal {
|
||||
parts = append(parts, "display:none")
|
||||
}
|
||||
if f.Blink {
|
||||
parts = append(parts, "text-decoration:blink")
|
||||
}
|
||||
|
||||
// We're not in performance sensitive code. Although this sort
|
||||
// isn't strictly necessary, it gives us the nice property that
|
||||
// the style of a particular set of attributes will always be
|
||||
// generated the same way. As a result, we can use the html
|
||||
// output in tests.
|
||||
sort.StringSlice(parts).Sort()
|
||||
|
||||
return strings.Join(parts, ";")
|
||||
}
|
||||
|
||||
// Cursor represents both the position and text type of the cursor.
|
||||
type Cursor struct {
|
||||
// Y and X are the coordinates.
|
||||
Y, X int
|
||||
|
||||
// F is the format that will be displayed.
|
||||
F Format
|
||||
}
|
||||
|
||||
// VT100 represents a simplified, raw VT100 terminal.
|
||||
type VT100 struct {
|
||||
// Height and Width are the dimensions of the terminal.
|
||||
Height, Width int
|
||||
|
||||
// Content is the text in the terminal.
|
||||
Content [][]rune
|
||||
|
||||
// Format is the display properties of each cell.
|
||||
Format [][]Format
|
||||
|
||||
// Cursor is the current state of the cursor.
|
||||
Cursor Cursor
|
||||
|
||||
// savedCursor is the state of the cursor last time save() was called.
|
||||
savedCursor Cursor
|
||||
|
||||
unparsed []byte
|
||||
}
|
||||
|
||||
// NewVT100 creates a new VT100 object with the specified dimensions. y and x
|
||||
// must both be greater than zero.
|
||||
//
|
||||
// Each cell is set to contain a ' ' rune, and all formats are left as the
|
||||
// default.
|
||||
func NewVT100(y, x int) *VT100 {
|
||||
if y == 0 || x == 0 {
|
||||
panic(fmt.Errorf("invalid dim (%d, %d)", y, x))
|
||||
}
|
||||
|
||||
v := &VT100{
|
||||
Height: y,
|
||||
Width: x,
|
||||
Content: make([][]rune, y),
|
||||
Format: make([][]Format, y),
|
||||
}
|
||||
|
||||
for row := 0; row < y; row++ {
|
||||
v.Content[row] = make([]rune, x)
|
||||
v.Format[row] = make([]Format, x)
|
||||
|
||||
for col := 0; col < x; col++ {
|
||||
v.clear(row, col)
|
||||
}
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func (v *VT100) UsedHeight() int {
|
||||
count := 0
|
||||
for _, l := range v.Content {
|
||||
for _, r := range l {
|
||||
if r != ' ' {
|
||||
count++
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
func (v *VT100) Resize(y, x int) {
|
||||
if y > v.Height {
|
||||
n := y - v.Height
|
||||
for row := 0; row < n; row++ {
|
||||
v.Content = append(v.Content, make([]rune, v.Width))
|
||||
v.Format = append(v.Format, make([]Format, v.Width))
|
||||
for col := 0; col < v.Width; col++ {
|
||||
v.clear(v.Height+row, col)
|
||||
}
|
||||
}
|
||||
v.Height = y
|
||||
} else if y < v.Height {
|
||||
v.Content = v.Content[:y]
|
||||
v.Height = y
|
||||
}
|
||||
|
||||
if x > v.Width {
|
||||
for i := range v.Content {
|
||||
row := make([]rune, x)
|
||||
copy(row, v.Content[i])
|
||||
v.Content[i] = row
|
||||
format := make([]Format, x)
|
||||
copy(format, v.Format[i])
|
||||
v.Format[i] = format
|
||||
for j := v.Width; j < x; j++ {
|
||||
v.clear(i, j)
|
||||
}
|
||||
}
|
||||
v.Width = x
|
||||
} else if x < v.Width {
|
||||
for i := range v.Content {
|
||||
v.Content[i] = v.Content[i][:x]
|
||||
v.Format[i] = v.Format[i][:x]
|
||||
}
|
||||
v.Width = x
|
||||
}
|
||||
}
|
||||
|
||||
func (v *VT100) Write(dt []byte) (int, error) {
|
||||
n := len(dt)
|
||||
if len(v.unparsed) > 0 {
|
||||
dt = append(v.unparsed, dt...) // this almost never happens
|
||||
v.unparsed = nil
|
||||
}
|
||||
buf := bytes.NewBuffer(dt)
|
||||
for {
|
||||
if buf.Len() == 0 {
|
||||
return n, nil
|
||||
}
|
||||
cmd, err := Decode(buf)
|
||||
if err != nil {
|
||||
if l := buf.Len(); l > 0 && l < 12 { // on small leftover handle unparsed, otherwise skip
|
||||
v.unparsed = buf.Bytes()
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
v.Process(cmd) // ignore error
|
||||
}
|
||||
}
|
||||
|
||||
// Process handles a single ANSI terminal command, updating the terminal
|
||||
// appropriately.
|
||||
//
|
||||
// One special kind of error that this can return is an UnsupportedError. It's
|
||||
// probably best to check for these and skip, because they are likely recoverable.
|
||||
// Support errors are exported as expvars, so it is possibly not necessary to log
|
||||
// them. If you want to check what's failed, start a debug http server and examine
|
||||
// the vt100-unsupported-commands field in /debug/vars.
|
||||
func (v *VT100) Process(c Command) error {
|
||||
return c.display(v)
|
||||
}
|
||||
|
||||
// HTML renders v as an HTML fragment. One idea for how to use this is to debug
|
||||
// the current state of the screen reader.
|
||||
func (v *VT100) HTML() string {
|
||||
var buf bytes.Buffer
|
||||
buf.WriteString(`<pre style="color:white;background-color:black;">`)
|
||||
|
||||
// Iterate each row. When the css changes, close the previous span, and open
|
||||
// a new one. No need to close a span when the css is empty, we won't have
|
||||
// opened one in the past.
|
||||
var lastFormat Format
|
||||
for y, row := range v.Content {
|
||||
for x, r := range row {
|
||||
f := v.Format[y][x]
|
||||
if f != lastFormat {
|
||||
if lastFormat != (Format{}) {
|
||||
buf.WriteString("</span>")
|
||||
}
|
||||
if f != (Format{}) {
|
||||
buf.WriteString(`<span style="` + f.css() + `">`)
|
||||
}
|
||||
lastFormat = f
|
||||
}
|
||||
if s := maybeEscapeRune(r); s != "" {
|
||||
buf.WriteString(s)
|
||||
} else {
|
||||
buf.WriteRune(r)
|
||||
}
|
||||
}
|
||||
buf.WriteRune('\n')
|
||||
}
|
||||
buf.WriteString("</pre>")
|
||||
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// maybeEscapeRune potentially escapes a rune for display in an html document.
|
||||
// It only escapes the things that html.EscapeString does, but it works without allocating
|
||||
// a string to hold r. Returns an empty string if there is no need to escape.
|
||||
func maybeEscapeRune(r rune) string {
|
||||
switch r {
|
||||
case '&':
|
||||
return "&"
|
||||
case '\'':
|
||||
return "'"
|
||||
case '<':
|
||||
return "<"
|
||||
case '>':
|
||||
return ">"
|
||||
case '"':
|
||||
return """
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// put puts r onto the current cursor's position, then advances the cursor.
|
||||
func (v *VT100) put(r rune) {
|
||||
v.scrollIfNeeded()
|
||||
v.Content[v.Cursor.Y][v.Cursor.X] = r
|
||||
v.Format[v.Cursor.Y][v.Cursor.X] = v.Cursor.F
|
||||
v.advance()
|
||||
}
|
||||
|
||||
// advance advances the cursor, wrapping to the next line if need be.
|
||||
func (v *VT100) advance() {
|
||||
v.Cursor.X++
|
||||
if v.Cursor.X >= v.Width {
|
||||
v.Cursor.X = 0
|
||||
v.Cursor.Y++
|
||||
}
|
||||
// if v.Cursor.Y >= v.Height {
|
||||
// // TODO(jaguilar): if we implement scroll, this should probably scroll.
|
||||
// // v.Cursor.Y = 0
|
||||
// v.scroll()
|
||||
// }
|
||||
}
|
||||
|
||||
func (v *VT100) scrollIfNeeded() {
|
||||
if v.Cursor.Y >= v.Height {
|
||||
first := v.Content[0]
|
||||
copy(v.Content, v.Content[1:])
|
||||
for i := range first {
|
||||
first[i] = ' '
|
||||
}
|
||||
v.Content[v.Height-1] = first
|
||||
v.Cursor.Y = v.Height - 1
|
||||
}
|
||||
}
|
||||
|
||||
// home moves the cursor to the coordinates y x. If y x are out of bounds, v.Err
|
||||
// is set.
|
||||
func (v *VT100) home(y, x int) {
|
||||
v.Cursor.Y, v.Cursor.X = y, x
|
||||
}
|
||||
|
||||
// eraseDirection is the logical direction in which an erase command happens,
|
||||
// from the cursor. For both erase commands, forward is 0, backward is 1,
|
||||
// and everything is 2.
|
||||
type eraseDirection int
|
||||
|
||||
const (
|
||||
// From the cursor to the end, inclusive.
|
||||
eraseForward eraseDirection = iota
|
||||
|
||||
// From the beginning to the cursor, inclusive.
|
||||
eraseBack
|
||||
|
||||
// Everything.
|
||||
eraseAll
|
||||
)
|
||||
|
||||
// eraseColumns erases columns from the current line.
|
||||
func (v *VT100) eraseColumns(d eraseDirection) {
|
||||
y, x := v.Cursor.Y, v.Cursor.X // Aliases for simplicity.
|
||||
switch d {
|
||||
case eraseBack:
|
||||
v.eraseRegion(y, 0, y, x)
|
||||
case eraseForward:
|
||||
v.eraseRegion(y, x, y, v.Width-1)
|
||||
case eraseAll:
|
||||
v.eraseRegion(y, 0, y, v.Width-1)
|
||||
}
|
||||
}
|
||||
|
||||
// eraseLines erases lines from the current terminal. Note that
|
||||
// no matter what is selected, the entire current line is erased.
|
||||
func (v *VT100) eraseLines(d eraseDirection) {
|
||||
y := v.Cursor.Y // Alias for simplicity.
|
||||
switch d {
|
||||
case eraseBack:
|
||||
v.eraseRegion(0, 0, y, v.Width-1)
|
||||
case eraseForward:
|
||||
v.eraseRegion(y, 0, v.Height-1, v.Width-1)
|
||||
case eraseAll:
|
||||
v.eraseRegion(0, 0, v.Height-1, v.Width-1)
|
||||
}
|
||||
}
|
||||
|
||||
func (v *VT100) eraseRegion(y1, x1, y2, x2 int) {
|
||||
// Do not sanitize or bounds-check these coordinates, since they come from the
|
||||
// programmer (me). We should panic if any of them are out of bounds.
|
||||
if y1 > y2 {
|
||||
y1, y2 = y2, y1
|
||||
}
|
||||
if x1 > x2 {
|
||||
x1, x2 = x2, x1
|
||||
}
|
||||
|
||||
for y := y1; y <= y2; y++ {
|
||||
for x := x1; x <= x2; x++ {
|
||||
v.clear(y, x)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (v *VT100) clear(y, x int) {
|
||||
if y >= len(v.Content) || x >= len(v.Content[0]) {
|
||||
return
|
||||
}
|
||||
v.Content[y][x] = ' '
|
||||
v.Format[y][x] = Format{}
|
||||
}
|
||||
|
||||
func (v *VT100) backspace() {
|
||||
v.Cursor.X--
|
||||
if v.Cursor.X < 0 {
|
||||
if v.Cursor.Y == 0 {
|
||||
v.Cursor.X = 0
|
||||
} else {
|
||||
v.Cursor.Y--
|
||||
v.Cursor.X = v.Width - 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (v *VT100) save() {
|
||||
v.savedCursor = v.Cursor
|
||||
}
|
||||
|
||||
func (v *VT100) unsave() {
|
||||
v.Cursor = v.savedCursor
|
||||
}
|
Reference in New Issue
Block a user