From ebec88714922e35815525ce0910cf9f1c8cf1287 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Thu, 11 Jul 2024 09:49:14 +1000 Subject: [PATCH 1/3] Move to using bingo for tools --- .bingo/.gitignore | 13 + .bingo/README.md | 14 + .bingo/Variables.mk | 91 ++ .bingo/bingo.mod | 5 + .bingo/bingo.sum | 29 + .bingo/client-gen.mod | 5 + .bingo/client-gen.sum | 46 + .bingo/controller-gen.mod | 5 + .bingo/controller-gen.sum | 908 +++++++++++++++++ .bingo/enumer.mod | 5 + .bingo/enumer.sum | 11 + .bingo/gencosmosdb.mod | 5 + .bingo/gencosmosdb.sum | 4 + .bingo/go-bindata.mod | 5 + .bingo/go-bindata.sum | 2 + .bingo/go.mod | 1 + .bingo/gocov-xml.mod | 5 + .bingo/gocov-xml.sum | 16 + .bingo/gocov.mod | 5 + .bingo/gocov.sum | 15 + .bingo/goimports.mod | 5 + .bingo/goimports.sum | 6 + .bingo/golangci-lint.mod | 5 + .bingo/golangci-lint.sum | 910 ++++++++++++++++++ .bingo/gotestsum.mod | 5 + .bingo/gotestsum.sum | 89 ++ .bingo/mockgen.mod | 5 + .bingo/mockgen.sum | 29 + .bingo/variables.env | 34 + .github/workflows/ci-go.yml | 10 +- .github/workflows/golint.yml | 2 +- .pipelines/ci.yml | 8 +- Dockerfile.aro-e2e | 1 + Dockerfile.aro-multistage | 1 + Dockerfile.ci-rp | 12 +- Dockerfile.ci-rp.dockerignore | 2 +- Makefile | 43 +- deps.go | 9 +- go.mod | 11 - go.sum | 19 - hack/build-client.sh | 7 +- hack/lint-go.sh | 18 - pkg/api/admin/generate.go | 2 +- pkg/api/generate.go | 6 +- pkg/cluster/generate.go | 8 +- pkg/cluster/graph/generate.go | 4 +- pkg/database/cosmosdb/generate.go | 8 +- pkg/deploy/vmsscleaner/generate.go | 4 +- pkg/env/generate.go | 6 +- pkg/frontend/adminactions/generate.go | 4 +- pkg/frontend/generate.go | 4 +- pkg/hive/generate.go | 4 +- pkg/metrics/generate.go | 4 +- pkg/operator/controllers/rbac/generate.go | 2 +- .../controllers/workaround/generate.go | 4 +- pkg/operator/deploy/generate.go | 4 +- pkg/operator/generate.go | 8 +- pkg/portal/cluster/generate.go | 2 +- pkg/proxy/generate.go | 4 +- pkg/util/azblob/generate.go | 4 +- .../azureclient/authz/remotepdp/generate.go | 4 +- .../azureclient/azuresdk/armdns/generate.go | 4 +- .../azuresdk/armnetwork/generate.go | 4 +- .../azuresdk/armstorage/generate.go | 4 +- .../azureclient/azuresdk/azcore/generate.go | 4 +- pkg/util/azureclient/keyvault/generate.go | 4 +- .../mgmt/authorization/generate.go | 4 +- pkg/util/azureclient/mgmt/compute/generate.go | 4 +- .../mgmt/containerregistry/generate.go | 4 +- .../mgmt/containerservice/generate.go | 4 +- pkg/util/azureclient/mgmt/dns/generate.go | 4 +- .../azureclient/mgmt/features/generate.go | 4 +- pkg/util/azureclient/mgmt/msi/generate.go | 4 +- pkg/util/azureclient/mgmt/network/generate.go | 4 +- .../azureclient/mgmt/privatedns/generate.go | 4 +- pkg/util/azureclient/mgmt/storage/generate.go | 4 +- pkg/util/billing/generate.go | 4 +- pkg/util/clusterdata/generate.go | 4 +- pkg/util/deployer/generate.go | 4 +- pkg/util/dns/generate.go | 4 +- pkg/util/dynamichelper/generate.go | 4 +- pkg/util/encryption/generate.go | 4 +- pkg/util/instancemetadata/generate.go | 4 +- pkg/util/keyvault/generate.go | 4 +- pkg/util/mocks/env/core.go | 5 +- pkg/util/net/generate.go | 4 +- pkg/util/storage/generate.go | 4 +- pkg/util/subnet/generate.go | 4 +- pkg/validate/dynamic/generate.go | 4 +- 89 files changed, 2434 insertions(+), 186 deletions(-) create mode 100644 .bingo/.gitignore create mode 100644 .bingo/README.md create mode 100644 .bingo/Variables.mk create mode 100644 .bingo/bingo.mod create mode 100644 .bingo/bingo.sum create mode 100644 .bingo/client-gen.mod create mode 100644 .bingo/client-gen.sum create mode 100644 .bingo/controller-gen.mod create mode 100644 .bingo/controller-gen.sum create mode 100644 .bingo/enumer.mod create mode 100644 .bingo/enumer.sum create mode 100644 .bingo/gencosmosdb.mod create mode 100644 .bingo/gencosmosdb.sum create mode 100644 .bingo/go-bindata.mod create mode 100644 .bingo/go-bindata.sum create mode 100644 .bingo/go.mod create mode 100644 .bingo/gocov-xml.mod create mode 100644 .bingo/gocov-xml.sum create mode 100644 .bingo/gocov.mod create mode 100644 .bingo/gocov.sum create mode 100644 .bingo/goimports.mod create mode 100644 .bingo/goimports.sum create mode 100644 .bingo/golangci-lint.mod create mode 100644 .bingo/golangci-lint.sum create mode 100644 .bingo/gotestsum.mod create mode 100644 .bingo/gotestsum.sum create mode 100644 .bingo/mockgen.mod create mode 100644 .bingo/mockgen.sum create mode 100644 .bingo/variables.env delete mode 100755 hack/lint-go.sh diff --git a/.bingo/.gitignore b/.bingo/.gitignore new file mode 100644 index 00000000000..9efccf683cd --- /dev/null +++ b/.bingo/.gitignore @@ -0,0 +1,13 @@ + +# Ignore everything +* + +# But not these files: +!.gitignore +!*.mod +!*.sum +!README.md +!Variables.mk +!variables.env + +*tmp.mod diff --git a/.bingo/README.md b/.bingo/README.md new file mode 100644 index 00000000000..7a5c2d4f6da --- /dev/null +++ b/.bingo/README.md @@ -0,0 +1,14 @@ +# Project Development Dependencies. + +This is directory which stores Go modules with pinned buildable package that is used within this repository, managed by https://github.com/bwplotka/bingo. + +* Run `bingo get` to install all tools having each own module file in this directory. +* Run `bingo get ` to install that have own module file in this directory. +* For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use $() variable where is the .bingo/.mod. +* For shell: Run `source .bingo/variables.env` to source all environment variable for each tool. +* For go: Import `.bingo/variables.go` to for variable names. +* See https://github.com/bwplotka/bingo or -h on how to add, remove or change binaries dependencies. + +## Requirements + +* Go 1.14+ diff --git a/.bingo/Variables.mk b/.bingo/Variables.mk new file mode 100644 index 00000000000..326833f5b4c --- /dev/null +++ b/.bingo/Variables.mk @@ -0,0 +1,91 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.9. DO NOT EDIT. +# All tools are designed to be build inside $GOBIN. +BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +GOPATH ?= $(shell go env GOPATH) +GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin +GO ?= $(shell which go) + +# Below generated variables ensure that every time a tool under each variable is invoked, the correct version +# will be used; reinstalling only if needed. +# For example for bingo variable: +# +# In your main Makefile (for non array binaries): +# +#include .bingo/Variables.mk # Assuming -dir was set to .bingo . +# +#command: $(BINGO) +# @echo "Running bingo" +# @$(BINGO) +# +BINGO := $(GOBIN)/bingo-v0.9.0 +$(BINGO): $(BINGO_DIR)/bingo.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/bingo-v0.9.0" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=bingo.mod -o=$(GOBIN)/bingo-v0.9.0 "github.com/bwplotka/bingo" + +CLIENT_GEN := $(GOBIN)/client-gen-v0.25.16 +$(CLIENT_GEN): $(BINGO_DIR)/client-gen.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/client-gen-v0.25.16" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=client-gen.mod -o=$(GOBIN)/client-gen-v0.25.16 "k8s.io/code-generator/cmd/client-gen" + +CONTROLLER_GEN := $(GOBIN)/controller-gen-v0.9.0 +$(CONTROLLER_GEN): $(BINGO_DIR)/controller-gen.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/controller-gen-v0.9.0" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=controller-gen.mod -o=$(GOBIN)/controller-gen-v0.9.0 "sigs.k8s.io/controller-tools/cmd/controller-gen" + +ENUMER := $(GOBIN)/enumer-v1.1.2 +$(ENUMER): $(BINGO_DIR)/enumer.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/enumer-v1.1.2" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=enumer.mod -o=$(GOBIN)/enumer-v1.1.2 "github.com/alvaroloes/enumer" + +GENCOSMOSDB := $(GOBIN)/gencosmosdb-v0.0.0-20240729051124-c9cf2c4f6aa1 +$(GENCOSMOSDB): $(BINGO_DIR)/gencosmosdb.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/gencosmosdb-v0.0.0-20240729051124-c9cf2c4f6aa1" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=gencosmosdb.mod -o=$(GOBIN)/gencosmosdb-v0.0.0-20240729051124-c9cf2c4f6aa1 "github.com/jewzaam/go-cosmosdb/cmd/gencosmosdb" + +GO_BINDATA := $(GOBIN)/go-bindata-v3.1.2+incompatible +$(GO_BINDATA): $(BINGO_DIR)/go-bindata.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/go-bindata-v3.1.2+incompatible" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=go-bindata.mod -o=$(GOBIN)/go-bindata-v3.1.2+incompatible "github.com/go-bindata/go-bindata/go-bindata" + +GOCOV_XML := $(GOBIN)/gocov-xml-v1.1.0 +$(GOCOV_XML): $(BINGO_DIR)/gocov-xml.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/gocov-xml-v1.1.0" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=gocov-xml.mod -o=$(GOBIN)/gocov-xml-v1.1.0 "github.com/AlekSi/gocov-xml" + +GOCOV := $(GOBIN)/gocov-v1.1.0 +$(GOCOV): $(BINGO_DIR)/gocov.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/gocov-v1.1.0" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=gocov.mod -o=$(GOBIN)/gocov-v1.1.0 "github.com/axw/gocov/gocov" + +GOIMPORTS := $(GOBIN)/goimports-v0.23.0 +$(GOIMPORTS): $(BINGO_DIR)/goimports.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/goimports-v0.23.0" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=goimports.mod -o=$(GOBIN)/goimports-v0.23.0 "golang.org/x/tools/cmd/goimports" + +GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.59.1 +$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/golangci-lint-v1.59.1" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.59.1 "github.com/golangci/golangci-lint/cmd/golangci-lint" + +GOTESTSUM := $(GOBIN)/gotestsum-v1.11.0 +$(GOTESTSUM): $(BINGO_DIR)/gotestsum.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/gotestsum-v1.11.0" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=gotestsum.mod -o=$(GOBIN)/gotestsum-v1.11.0 "gotest.tools/gotestsum" + +MOCKGEN := $(GOBIN)/mockgen-v1.6.0 +$(MOCKGEN): $(BINGO_DIR)/mockgen.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/mockgen-v1.6.0" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=mockgen.mod -o=$(GOBIN)/mockgen-v1.6.0 "github.com/golang/mock/mockgen" + diff --git a/.bingo/bingo.mod b/.bingo/bingo.mod new file mode 100644 index 00000000000..4adabc310e9 --- /dev/null +++ b/.bingo/bingo.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.21 + +require github.com/bwplotka/bingo v0.9.0 diff --git a/.bingo/bingo.sum b/.bingo/bingo.sum new file mode 100644 index 00000000000..f231dd11b3a --- /dev/null +++ b/.bingo/bingo.sum @@ -0,0 +1,29 @@ +github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= +github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/bwplotka/bingo v0.9.0 h1:slnsdJYExR4iRalHR6/ZiYnr9vSazOuFGmc2LdX293g= +github.com/bwplotka/bingo v0.9.0/go.mod h1:GxC/y/xbmOK5P29cn+B3HuOSw0s2gruddT3r+rDizDw= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/efficientgo/core v1.0.0-rc.0 h1:jJoA0N+C4/knWYVZ6GrdHOtDyrg8Y/TR4vFpTaqTsqs= +github.com/efficientgo/core v1.0.0-rc.0/go.mod h1:kQa0V74HNYMfuJH6jiPiwNdpWXl4xd/K4tzlrcvYDQI= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= +github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= +github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +mvdan.cc/sh/v3 v3.7.0 h1:lSTjdP/1xsddtaKfGg7Myu7DnlHItd3/M2tomOcNNBg= +mvdan.cc/sh/v3 v3.7.0/go.mod h1:K2gwkaesF/D7av7Kxl0HbF5kGOd2ArupNTX3X44+8l8= diff --git a/.bingo/client-gen.mod b/.bingo/client-gen.mod new file mode 100644 index 00000000000..a347cfe05fb --- /dev/null +++ b/.bingo/client-gen.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.21 + +require k8s.io/code-generator v0.25.16 // cmd/client-gen diff --git a/.bingo/client-gen.sum b/.bingo/client-gen.sum new file mode 100644 index 00000000000..fed8cf56b53 --- /dev/null +++ b/.bingo/client-gen.sum @@ -0,0 +1,46 @@ +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +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/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +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/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +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/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +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/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/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.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +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= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +k8s.io/code-generator v0.25.16 h1:+GlLubryRmKHHb486r3OS0XbPOk8LTC/PcqQOfGLwYw= +k8s.io/code-generator v0.25.16/go.mod h1:rv2rN7kkHpAMnEULzXSC380Tsj1rN7nkpzVqT59ptjk= +k8s.io/gengo v0.0.0-20211129171323-c02415ce4185 h1:TT1WdmqqXareKxZ/oNXEUSwKlLiHzPMyB0t8BaFeBYI= +k8s.io/gengo v0.0.0-20211129171323-c02415ce4185/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.70.1 h1:7aaoSdahviPmR+XkS7FyxlkkXs6tHISSG03RxleQAVQ= +k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= diff --git a/.bingo/controller-gen.mod b/.bingo/controller-gen.mod new file mode 100644 index 00000000000..e79573282eb --- /dev/null +++ b/.bingo/controller-gen.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.21 + +require sigs.k8s.io/controller-tools v0.9.0 // cmd/controller-gen diff --git a/.bingo/controller-gen.sum b/.bingo/controller-gen.sum new file mode 100644 index 00000000000..d96d5a673bb --- /dev/null +++ b/.bingo/controller-gen.sum @@ -0,0 +1,908 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= +github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= +github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= +github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= +github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= +github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210826220005-b48c857c3a0e/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +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/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= +github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= +github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= +github.com/coreos/go-semver v0.3.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/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +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/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc= +github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= +github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +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-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= +github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.2.0 h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE= +github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/zapr v1.2.0/go.mod h1:Qa4Bsj2Vb+FAVeAKsLD8RLQ+YRJB8YDmOAKxaBQf7Ro= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobuffalo/flect v0.2.5 h1:H6vvsv2an0lalEaCDRThvtBfmg44W/QHXBCYUXf/6S4= +github.com/gobuffalo/flect v0.2.5/go.mod h1:1ZyCLIbg0YD7sDkzvFdPoOydPtD8y9JQnrOROolUcM8= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +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/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/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +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.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +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/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +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.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +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/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= +github.com/google/cel-go v0.10.1/go.mod h1:U7ayypeSkw23szu4GaQTPJGx66c20mx8JklMSxrmI1w= +github.com/google/cel-spec v0.6.0/go.mod h1:Nwjgxy5CbjlPrtCWjeDjUyKMl8w41YBYGjsyDdqk0xA= +github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +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.4.1/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.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= +github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +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-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +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-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/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/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +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/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +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/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +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/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +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/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= +github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= +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/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +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 v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +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/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= +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_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +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/client_model v0.2.0/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/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +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.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +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/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +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.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= +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/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= +github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= +github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= +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/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= +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.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= +go.etcd.io/etcd/client/v3 v3.5.1/go.mod h1:OnjH4M8OnAotwaB2l9bVgZzRFKru7/ZMoS46OtKyd3Q= +go.etcd.io/etcd/pkg/v3 v3.5.0/go.mod h1:UzJGatBQ1lXChBkQF0AuAtkRQMYnHubxAEYIrC3MSsE= +go.etcd.io/etcd/raft/v3 v3.5.0/go.mod h1:UFOHSIvO/nKwd4lhkwabrTD3cqW5yVyYYf/KlD00Szc= +go.etcd.io/etcd/server/v3 v3.5.0/go.mod h1:3Ah5ruV+M+7RZr0+Y/5mNLwC+eQlni+mQmOVdCRJoS4= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0/go.mod h1:oVGt1LRbBOBq1A5BQLlUg9UaU/54aiHw8cgjV3aWZ/E= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1:2AboqHi0CiIZU0qwhtUfCYD1GeUzvvIXWNkhDt7ZMG4= +go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= +go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM= +go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= +go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= +go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= +go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi+bJK+Dr8NQCh0qGhm1KDnNlE= +go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE= +go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/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-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +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/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +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-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +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/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +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-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/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-20181201002055-351d144fa1fc/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-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-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-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/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-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +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/sync v0.0.0-20190227155943-e225da77a7e6/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-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/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/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/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-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/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-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +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-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220209214540-3681064d5158 h1:rm+CHSpPEEW2IsXUib1ThaHIjuBVZjxNgSKmBLFfD4c= +golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/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/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/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-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.10-0.20220218145154-897bd77cd717 h1:hI3jKY4Hpf63ns040onEbB3dAkR/H/P83hw1TG8dD3Y= +golang.org/x/tools v0.1.10-0.20220218145154-897bd77cd717/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +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/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +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/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +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-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201102152239-715cce707fb0/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +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.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +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.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +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.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= +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-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +k8s.io/api v0.24.0 h1:J0hann2hfxWr1hinZIDefw7Q96wmCBx6SSB8IY0MdDg= +k8s.io/api v0.24.0/go.mod h1:5Jl90IUrJHUJYEMANRURMiVvJ0g7Ax7r3R1bqO8zx8I= +k8s.io/apiextensions-apiserver v0.24.0 h1:JfgFqbA8gKJ/uDT++feAqk9jBIwNnL9YGdQvaI9DLtY= +k8s.io/apiextensions-apiserver v0.24.0/go.mod h1:iuVe4aEpe6827lvO6yWQVxiPSpPoSKVjkq+MIdg84cM= +k8s.io/apimachinery v0.24.0 h1:ydFCyC/DjCvFCHK5OPMKBlxayQytB8pxy8YQInd5UyQ= +k8s.io/apimachinery v0.24.0/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM= +k8s.io/apiserver v0.24.0/go.mod h1:WFx2yiOMawnogNToVvUYT9nn1jaIkMKj41ZYCVycsBA= +k8s.io/client-go v0.24.0/go.mod h1:VFPQET+cAFpYxh6Bq6f4xyMY80G6jKKktU6G0m00VDw= +k8s.io/code-generator v0.24.0/go.mod h1:dpVhs00hTuTdTY6jvVxvTFCk6gSMrtfRydbhZwHI15w= +k8s.io/component-base v0.24.0/go.mod h1:Dgazgon0i7KYUsS8krG8muGiMVtUZxG037l1MKyXgrA= +k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/gengo v0.0.0-20211129171323-c02415ce4185/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= +k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.60.1 h1:VW25q3bZx9uE3vvdL6M8ezOX79vA2Aq1nEWLqNQclHc= +k8s.io/klog/v2 v2.60.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42/go.mod h1:Z/45zLw8lUo4wdiUkI+v/ImEGAvu3WatcZl3lPMR4Rk= +k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc= +k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30/go.mod h1:fEO7lRTdivWO2qYVCVG7dEADOMo/MLDCVr8So2g88Uw= +sigs.k8s.io/controller-tools v0.9.0 h1:b/vSEPpA8hiMiyzDfLbZdCn3hoAcy3/868OHhYtHY9w= +sigs.k8s.io/controller-tools v0.9.0/go.mod h1:NUkn8FTV3Sad3wWpSK7dt/145qfuQ8CKJV6j4jHC5rM= +sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 h1:kDi4JBNAsJWfz1aEXhO8Jg87JJaPNLh5tIzYHgStQ9Y= +sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2/go.mod h1:B+TnT182UBxE84DiCz4CVE26eOSDAeYCpfDnC2kdKMY= +sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.2.1 h1:bKCqE9GvQ5tiVHn5rfn1r+yao3aLQEaLzkkmAkf+A6Y= +sigs.k8s.io/structured-merge-diff/v4 v4.2.1/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/.bingo/enumer.mod b/.bingo/enumer.mod new file mode 100644 index 00000000000..1f3aa238cc1 --- /dev/null +++ b/.bingo/enumer.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.21 + +require github.com/alvaroloes/enumer v1.1.2 diff --git a/.bingo/enumer.sum b/.bingo/enumer.sum new file mode 100644 index 00000000000..60b017122e2 --- /dev/null +++ b/.bingo/enumer.sum @@ -0,0 +1,11 @@ +github.com/alvaroloes/enumer v1.1.2 h1:5khqHB33TZy1GWCO/lZwcroBFh7u+0j40T83VUbfAMY= +github.com/alvaroloes/enumer v1.1.2/go.mod h1:FxrjvuXoDAx9isTJrv4c+T410zFi0DtXIT0m65DJ+Wo= +github.com/pascaldekloe/name v0.0.0-20180628100202-0fd16699aae1 h1:/I3lTljEEDNYLho3/FUB7iD/oc2cEFgVmbHzV+O0PtU= +github.com/pascaldekloe/name v0.0.0-20180628100202-0fd16699aae1/go.mod h1:eD5JxqMiuNYyFNmyY9rkJ/slN8y59oEu4Ei7F8OoKWQ= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190524210228-3d17549cdc6b h1:iEAPfYPbYbxG/2lNN4cMOHkmgKNsCuUwkxlDCK46UlU= +golang.org/x/tools v0.0.0-20190524210228-3d17549cdc6b/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= diff --git a/.bingo/gencosmosdb.mod b/.bingo/gencosmosdb.mod new file mode 100644 index 00000000000..565b819dffc --- /dev/null +++ b/.bingo/gencosmosdb.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.21 + +require github.com/jewzaam/go-cosmosdb v0.0.0-20240729051124-c9cf2c4f6aa1 // cmd/gencosmosdb diff --git a/.bingo/gencosmosdb.sum b/.bingo/gencosmosdb.sum new file mode 100644 index 00000000000..83cbdf6d316 --- /dev/null +++ b/.bingo/gencosmosdb.sum @@ -0,0 +1,4 @@ +github.com/jewzaam/go-cosmosdb v0.0.0-20240723075448-058185e3c66d h1:2Xp2eP830w13cWq6sombl3EsBM46xYkdkLog8BgFWyQ= +github.com/jewzaam/go-cosmosdb v0.0.0-20240723075448-058185e3c66d/go.mod h1:hEk8/SoE/NBT9ofV69Gzs98vbGyF155SaYl1p9bxKb8= +github.com/jewzaam/go-cosmosdb v0.0.0-20240729051124-c9cf2c4f6aa1 h1:7EGTuO4I+1fln9rQ50K4ysZSejU2gFC2Oz8UyrySYtw= +github.com/jewzaam/go-cosmosdb v0.0.0-20240729051124-c9cf2c4f6aa1/go.mod h1:+G8ranhkJ4x2BUFTyh3b7Ap0KkDZwAwd/0OqtIVR63c= diff --git a/.bingo/go-bindata.mod b/.bingo/go-bindata.mod new file mode 100644 index 00000000000..e00b3e0224c --- /dev/null +++ b/.bingo/go-bindata.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.21 + +require github.com/go-bindata/go-bindata v3.1.2+incompatible // go-bindata diff --git a/.bingo/go-bindata.sum b/.bingo/go-bindata.sum new file mode 100644 index 00000000000..402dde703b1 --- /dev/null +++ b/.bingo/go-bindata.sum @@ -0,0 +1,2 @@ +github.com/go-bindata/go-bindata v3.1.2+incompatible h1:5vjJMVhowQdPzjE1LdxyFF7YFTXg5IgGVW4gBr5IbvE= +github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo= diff --git a/.bingo/go.mod b/.bingo/go.mod new file mode 100644 index 00000000000..610249af0b0 --- /dev/null +++ b/.bingo/go.mod @@ -0,0 +1 @@ +module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files. \ No newline at end of file diff --git a/.bingo/gocov-xml.mod b/.bingo/gocov-xml.mod new file mode 100644 index 00000000000..a1d83567d12 --- /dev/null +++ b/.bingo/gocov-xml.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.21 + +require github.com/AlekSi/gocov-xml v1.1.0 diff --git a/.bingo/gocov-xml.sum b/.bingo/gocov-xml.sum new file mode 100644 index 00000000000..a83c3fb4b16 --- /dev/null +++ b/.bingo/gocov-xml.sum @@ -0,0 +1,16 @@ +github.com/AlekSi/gocov-xml v1.1.0 h1:iElWGi7s/MuL8/d8WDtI2fOAsN3ap9x8nK5RrAhaDng= +github.com/AlekSi/gocov-xml v1.1.0/go.mod h1:g1dRVOCHjKkMtlPfW6BokJ/qxoeZ1uPNAK7A/ii3CUo= +github.com/axw/gocov v1.1.0 h1:y5U1krExoJDlb/kNtzxyZQmNRprFOFCutWbNjcQvmVM= +github.com/axw/gocov v1.1.0/go.mod h1:H9G4tivgdN3pYSSVrTFBr6kGDCmAkgbJhtxFzAvgcdw= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/.bingo/gocov.mod b/.bingo/gocov.mod new file mode 100644 index 00000000000..8fd13396f04 --- /dev/null +++ b/.bingo/gocov.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.21 + +require github.com/axw/gocov v1.1.0 // gocov diff --git a/.bingo/gocov.sum b/.bingo/gocov.sum new file mode 100644 index 00000000000..0a8e8a7b675 --- /dev/null +++ b/.bingo/gocov.sum @@ -0,0 +1,15 @@ +github.com/axw/gocov v1.1.0 h1:y5U1krExoJDlb/kNtzxyZQmNRprFOFCutWbNjcQvmVM= +github.com/axw/gocov v1.1.0/go.mod h1:H9G4tivgdN3pYSSVrTFBr6kGDCmAkgbJhtxFzAvgcdw= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190617190820-da514acc4774 h1:CQVOmarCBFzTx0kbOU0ru54Cvot8SdSrNYjZPhQl+gk= +golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/.bingo/goimports.mod b/.bingo/goimports.mod new file mode 100644 index 00000000000..885e3a57c78 --- /dev/null +++ b/.bingo/goimports.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.21 + +require golang.org/x/tools v0.23.0 // cmd/goimports diff --git a/.bingo/goimports.sum b/.bingo/goimports.sum new file mode 100644 index 00000000000..4ef85421b15 --- /dev/null +++ b/.bingo/goimports.sum @@ -0,0 +1,6 @@ +golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8= +golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg= +golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI= diff --git a/.bingo/golangci-lint.mod b/.bingo/golangci-lint.mod new file mode 100644 index 00000000000..be62b4012e1 --- /dev/null +++ b/.bingo/golangci-lint.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.21 + +require github.com/golangci/golangci-lint v1.59.1 // cmd/golangci-lint diff --git a/.bingo/golangci-lint.sum b/.bingo/golangci-lint.sum new file mode 100644 index 00000000000..f143adb22ac --- /dev/null +++ b/.bingo/golangci-lint.sum @@ -0,0 +1,910 @@ +4d63.com/gocheckcompilerdirectives v1.2.1 h1:AHcMYuw56NPjq/2y615IGg2kYkBdTvOaojYCBcRE7MA= +4d63.com/gocheckcompilerdirectives v1.2.1/go.mod h1:yjDJSxmDTtIHHCqX0ufRYZDL6vQtMG7tJdKVeWwsqvs= +4d63.com/gochecknoglobals v0.2.1 h1:1eiorGsgHOFOuoOiJDy2psSrQbRdIHrlge0IJIkUgDc= +4d63.com/gochecknoglobals v0.2.1/go.mod h1:KRE8wtJB3CXCsb1xy421JfTHIIbmT3U5ruxw2Qu8fSU= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/4meepo/tagalign v1.3.4 h1:P51VcvBnf04YkHzjfclN6BbsopfJR5rxs1n+5zHt+w8= +github.com/4meepo/tagalign v1.3.4/go.mod h1:M+pnkHH2vG8+qhE5bVc/zeP7HS/j910Fwa9TUSyZVI0= +github.com/Abirdcfly/dupword v0.0.14 h1:3U4ulkc8EUo+CaT105/GJ1BQwtgyj6+VaBVbAX11Ba8= +github.com/Abirdcfly/dupword v0.0.14/go.mod h1:VKDAbxdY8YbKUByLGg8EETzYSuC4crm9WwI6Y3S0cLI= +github.com/Antonboom/errname v0.1.13 h1:JHICqsewj/fNckzrfVSe+T33svwQxmjC+1ntDsHOVvM= +github.com/Antonboom/errname v0.1.13/go.mod h1:uWyefRYRN54lBg6HseYCFhs6Qjcy41Y3Jl/dVhA87Ns= +github.com/Antonboom/nilnil v0.1.9 h1:eKFMejSxPSA9eLSensFmjW2XTgTwJMjZ8hUHtV4s/SQ= +github.com/Antonboom/nilnil v0.1.9/go.mod h1:iGe2rYwCq5/Me1khrysB4nwI7swQvjclR8/YRPl5ihQ= +github.com/Antonboom/testifylint v1.3.1 h1:Uam4q1Q+2b6H7gvk9RQFw6jyVDdpzIirFOOrbs14eG4= +github.com/Antonboom/testifylint v1.3.1/go.mod h1:NV0hTlteCkViPW9mSR4wEMfwp+Hs1T3dY60bkvSfhpM= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= +github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/Crocmagnon/fatcontext v0.2.2 h1:OrFlsDdOj9hW/oBEJBNSuH7QWf+E9WPVHw+x52bXVbk= +github.com/Crocmagnon/fatcontext v0.2.2/go.mod h1:WSn/c/+MMNiD8Pri0ahRj0o9jVpeowzavOQplBJw6u0= +github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= +github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0 h1:sATXp1x6/axKxz2Gjxv8MALP0bXaNRfQinEwyfMcx8c= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0/go.mod h1:Nl76DrGNJTA1KJ0LePKBw/vznBX1EHbAZX8mwjR82nI= +github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= +github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/OpenPeeDeeP/depguard/v2 v2.2.0 h1:vDfG60vDtIuf0MEOhmLlLLSzqaRM8EMcgJPdp74zmpA= +github.com/OpenPeeDeeP/depguard/v2 v2.2.0/go.mod h1:CIzddKRvLBC4Au5aYP/i3nyaWQ+ClszLIuVocRiCYFQ= +github.com/alecthomas/go-check-sumtype v0.1.4 h1:WCvlB3l5Vq5dZQTFmodqL2g68uHiSwwlWcT5a2FGK0c= +github.com/alecthomas/go-check-sumtype v0.1.4/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alexkohler/nakedret/v2 v2.0.4 h1:yZuKmjqGi0pSmjGpOC016LtPJysIL0WEUiaXW5SUnNg= +github.com/alexkohler/nakedret/v2 v2.0.4/go.mod h1:bF5i0zF2Wo2o4X4USt9ntUWve6JbFv02Ff4vlkmS/VU= +github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw= +github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= +github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= +github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= +github.com/ashanbrown/forbidigo v1.6.0 h1:D3aewfM37Yb3pxHujIPSpTf6oQk9sc9WZi8gerOIVIY= +github.com/ashanbrown/forbidigo v1.6.0/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= +github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= +github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= +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/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bkielbasa/cyclop v1.2.1 h1:AeF71HZDob1P2/pRm1so9cd1alZnrpyc4q2uP2l0gJY= +github.com/bkielbasa/cyclop v1.2.1/go.mod h1:K/dT/M0FPAiYjBgQGau7tz+3TMh4FWAEqlMhzFWCrgM= +github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= +github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= +github.com/bombsimon/wsl/v4 v4.2.1 h1:Cxg6u+XDWff75SIFFmNsqnIOgob+Q9hG6y/ioKbRFiM= +github.com/bombsimon/wsl/v4 v4.2.1/go.mod h1:Xu/kDxGZTofQcDGCtQe9KCzhHphIe0fDuyWTxER9Feo= +github.com/breml/bidichk v0.2.7 h1:dAkKQPLl/Qrk7hnP6P+E0xOodrq8Us7+U0o4UBOAlQY= +github.com/breml/bidichk v0.2.7/go.mod h1:YodjipAGI9fGcYM7II6wFvGhdMYsC5pHDlGzqvEW3tQ= +github.com/breml/errchkjson v0.3.6 h1:VLhVkqSBH96AvXEyclMR37rZslRrY2kcyq+31HCsVrA= +github.com/breml/errchkjson v0.3.6/go.mod h1:jhSDoFheAF2RSDOlCfhHO9KqhZgAYLyvHe7bRCX8f/U= +github.com/butuzov/ireturn v0.3.0 h1:hTjMqWw3y5JC3kpnC5vXmFJAWI/m31jaCYQqzkS6PL0= +github.com/butuzov/ireturn v0.3.0/go.mod h1:A09nIiwiqzN/IoVo9ogpa0Hzi9fex1kd9PSD6edP5ZA= +github.com/butuzov/mirror v1.2.0 h1:9YVK1qIjNspaqWutSv8gsge2e/Xpq1eqEkslEUHy5cs= +github.com/butuzov/mirror v1.2.0/go.mod h1:DqZZDtzm42wIAIyHXeN8W/qb1EPlb9Qn/if9icBOpdQ= +github.com/catenacyber/perfsprint v0.7.1 h1:PGW5G/Kxn+YrN04cRAZKC+ZuvlVwolYMrIyyTJ/rMmc= +github.com/catenacyber/perfsprint v0.7.1/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= +github.com/ccojocar/zxcvbn-go v1.0.2 h1:na/czXU8RrhXO4EZme6eQJLR4PzcGsahsBOAwU6I3Vg= +github.com/ccojocar/zxcvbn-go v1.0.2/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/charithe/durationcheck v0.0.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iyoHGPf5w4= +github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoGOY1C1L6uouGNreQ= +github.com/chavacava/garif v0.1.0 h1:2JHa3hbYf5D9dsgseMKAmc/MZ109otzgNFk5s87H9Pc= +github.com/chavacava/garif v0.1.0/go.mod h1:XMyYCkEL58DF0oyW4qDjjnPWONs2HBqYKI+UIPD+Gww= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/ckaznocha/intrange v0.1.2 h1:3Y4JAxcMntgb/wABQ6e8Q8leMd26JbX2790lIss9MTI= +github.com/ckaznocha/intrange v0.1.2/go.mod h1:RWffCw/vKBwHeOEwWdCikAtY0q4gGt8VhJZEEA5n+RE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= +github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= +github.com/daixiang0/gci v0.13.4 h1:61UGkmpoAcxHM2hhNkZEf5SzwQtWJXTSws7jaPyqwlw= +github.com/daixiang0/gci v0.13.4/go.mod h1:12etP2OniiIdP4q+kjUGrC/rUagga7ODbqsom5Eo5Yk= +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/denis-tingaikin/go-header v0.5.0 h1:SRdnP5ZKvcO9KKRP1KJrhFR3RrlGuD+42t4429eC9k8= +github.com/denis-tingaikin/go-header v0.5.0/go.mod h1:mMenU5bWrok6Wl2UsZjy+1okegmwQ3UgWl4V1D8gjlY= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q= +github.com/ettle/strcase v0.2.0/go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= +github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= +github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= +github.com/firefart/nonamedreturns v1.0.5 h1:tM+Me2ZaXs8tfdDw3X6DOX++wMCOqzYUho6tUTYIdRA= +github.com/firefart/nonamedreturns v1.0.5/go.mod h1:gHJjDqhGM4WyPt639SOZs+G89Ko7QKH5R5BhnO6xJhw= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= +github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= +github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= +github.com/ghostiam/protogetter v0.3.6 h1:R7qEWaSgFCsy20yYHNIJsU9ZOb8TziSRRxuAOTVKeOk= +github.com/ghostiam/protogetter v0.3.6/go.mod h1:7lpeDnEJ1ZjL/YtyoN99ljO4z0pd3H0d18/t2dPBxHw= +github.com/go-critic/go-critic v0.11.4 h1:O7kGOCx0NDIni4czrkRIXTnit0mkyKOCePh3My6OyEU= +github.com/go-critic/go-critic v0.11.4/go.mod h1:2QAdo4iuLik5S9YG0rT4wcZ8QxwHYkrr6/2MWAiv/vc= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +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-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= +github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= +github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= +github.com/go-toolsmith/astcopy v1.1.0/go.mod h1:hXM6gan18VA1T/daUEHCFcYiW8Ai1tIwIzHY6srfEAw= +github.com/go-toolsmith/astequal v1.0.3/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= +github.com/go-toolsmith/astequal v1.1.0/go.mod h1:sedf7VIdCL22LD8qIvv7Nn9MuWJruQA/ysswh64lffQ= +github.com/go-toolsmith/astequal v1.2.0 h1:3Fs3CYZ1k9Vo4FzFhwwewC3CHISHDnVUPC4x0bI2+Cw= +github.com/go-toolsmith/astequal v1.2.0/go.mod h1:c8NZ3+kSFtFY/8lPso4v8LuJjdJiUFVnSuU3s0qrrDY= +github.com/go-toolsmith/astfmt v1.1.0 h1:iJVPDPp6/7AaeLJEruMsBUlOYCmvg0MoCfJprsOmcco= +github.com/go-toolsmith/astfmt v1.1.0/go.mod h1:OrcLlRwu0CuiIBp/8b5PYF9ktGVZUjlNMV634mhwuQ4= +github.com/go-toolsmith/astp v1.1.0 h1:dXPuCl6u2llURjdPLLDxJeZInAeZ0/eZwFJmqZMnpQA= +github.com/go-toolsmith/astp v1.1.0/go.mod h1:0T1xFGz9hicKs8Z5MfAqSUitoUYS30pDMsRVIDHs8CA= +github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= +github.com/go-toolsmith/strparse v1.1.0 h1:GAioeZUK9TGxnLS+qfdqNbA4z0SSm5zVNtCQiyP2Bvw= +github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= +github.com/go-toolsmith/typep v1.1.0 h1:fIRYDyF+JywLfqzyhdiHzRop/GQDxxNhLGQ6gFUNHus= +github.com/go-toolsmith/typep v1.1.0/go.mod h1:fVIw+7zjdsMxDA3ITWnH1yOiw1rnTQKCsF/sk2H/qig= +github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= +github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80U= +github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= +github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +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.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +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/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +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.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= +github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= +github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= +github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= +github.com/golangci/golangci-lint v1.59.1 h1:CRRLu1JbhK5avLABFJ/OHVSQ0Ie5c4ulsOId1h3TTks= +github.com/golangci/golangci-lint v1.59.1/go.mod h1:jX5Oif4C7P0j9++YB2MMJmoNrb01NJ8ITqKWNLewThg= +github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs= +github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo= +github.com/golangci/modinfo v0.3.4 h1:oU5huX3fbxqQXdfspamej74DFX0kyGLkw1ppvXoJ8GA= +github.com/golangci/modinfo v0.3.4/go.mod h1:wytF1M5xl9u0ij8YSvhkEVPP3M5Mc7XLl1pxH3B2aUM= +github.com/golangci/plugin-module-register v0.1.1 h1:TCmesur25LnyJkpsVrupv1Cdzo+2f7zX0H6Jkw1Ol6c= +github.com/golangci/plugin-module-register v0.1.1/go.mod h1:TTpqoB6KkwOJMV8u7+NyXMrkwwESJLOkfl9TxR1DGFc= +github.com/golangci/revgrep v0.5.3 h1:3tL7c1XBMtWHHqVpS5ChmiAAoe4PF/d5+ULzV9sLAzs= +github.com/golangci/revgrep v0.5.3/go.mod h1:U4R/s9dlXZsg8uJmaR1GrloUr14D7qDl8gi2iPXJH8k= +github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed h1:IURFTjxeTfNFP0hTEi1YKjB/ub8zkpaOqFFMApi2EAs= +github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed/go.mod h1:XLXN8bNw4CGRPaqgl3bv/lhz7bsGPh4/xSaMTbo2vkQ= +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/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +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.4.1/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.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gordonklaus/ineffassign v0.1.0 h1:y2Gd/9I7MdY1oEIt+n+rowjBNDcLQq3RsH5hwJd0f9s= +github.com/gordonklaus/ineffassign v0.1.0/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= +github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= +github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= +github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= +github.com/gostaticanalysis/comment v1.4.2 h1:hlnx5+S2fY9Zo9ePo4AhgYsYHbM2+eAv8m/s1JiCd6Q= +github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= +github.com/gostaticanalysis/forcetypeassert v0.1.0 h1:6eUflI3DiGusXGK6X7cCcIgVCpZ2CiZ1Q7jl6ZxNV70= +github.com/gostaticanalysis/forcetypeassert v0.1.0/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= +github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3Uqrmrcpk= +github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= +github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= +github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/golang-lru v0.5.0/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/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jgautheron/goconst v1.7.1 h1:VpdAG7Ca7yvvJk5n8dMwQhfEZJh95kl/Hl9S1OI5Jkk= +github.com/jgautheron/goconst v1.7.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= +github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= +github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= +github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= +github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= +github.com/jjti/go-spancheck v0.6.1 h1:ZK/wE5Kyi1VX3PJpUO2oEgeoI4FWOUm7Shb2Gbv5obI= +github.com/jjti/go-spancheck v0.6.1/go.mod h1:vF1QkOO159prdo6mHRxak2CpzDpHAfKiPUDP/NeRnX8= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= +github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= +github.com/karamaru-alpha/copyloopvar v1.1.0 h1:x7gNyKcC2vRBO1H2Mks5u1VxQtYvFiym7fCjIP8RPos= +github.com/karamaru-alpha/copyloopvar v1.1.0/go.mod h1:u7CIfztblY0jZLOQZgH3oYsJzpC2A7S6u/lfgSXHy0k= +github.com/kisielk/errcheck v1.7.0 h1:+SbscKmWJ5mOK/bO1zS60F5I9WwZDWOfRsC4RwfwRV0= +github.com/kisielk/errcheck v1.7.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkHAIKE/contextcheck v1.1.5 h1:CdnJh63tcDe53vG+RebdpdXJTc9atMgGqdx8LXxiilg= +github.com/kkHAIKE/contextcheck v1.1.5/go.mod h1:O930cpht4xb1YQpK+1+AgoM3mFsvxr7uyFptcnWTYUA= +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/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/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= +github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= +github.com/kunwardeep/paralleltest v1.0.10 h1:wrodoaKYzS2mdNVnc4/w31YaXFtsc21PCTdvWJ/lDDs= +github.com/kunwardeep/paralleltest v1.0.10/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= +github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= +github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= +github.com/lasiar/canonicalheader v1.1.1 h1:wC+dY9ZfiqiPwAexUApFush/csSPXeIi4QqyxXmng8I= +github.com/lasiar/canonicalheader v1.1.1/go.mod h1:cXkb3Dlk6XXy+8MVQnF23CYKWlyA7kfQhSw2CcZtZb0= +github.com/ldez/gomoddirectives v0.2.4 h1:j3YjBIjEBbqZ0NKtBNzr8rtMHTOrLPeiwTkfUJZ3alg= +github.com/ldez/gomoddirectives v0.2.4/go.mod h1:oWu9i62VcQDYp9EQ0ONTfqLNh+mDLWWDO+SO0qSQw5g= +github.com/ldez/tagliatelle v0.5.0 h1:epgfuYt9v0CG3fms0pEgIMNPuFf/LpPIfjk4kyqSioo= +github.com/ldez/tagliatelle v0.5.0/go.mod h1:rj1HmWiL1MiKQuOONhd09iySTEkUuE/8+5jtPYz9xa4= +github.com/leonklingele/grouper v1.1.2 h1:o1ARBDLOmmasUaNDesWqWCIFH3u7hoFlM84YrjT3mIY= +github.com/leonklingele/grouper v1.1.2/go.mod h1:6D0M/HVkhs2yRKRFZUoGjeDy7EZTfFBE9gl4kjmIGkA= +github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= +github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= +github.com/macabu/inamedparam v0.1.3 h1:2tk/phHkMlEL/1GNe/Yf6kkR/hkcUdAEY3L0hjYV1Mk= +github.com/macabu/inamedparam v0.1.3/go.mod h1:93FLICAIk/quk7eaPPQvbzihUdn/QkGDwIZEoLtpH6I= +github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= +github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/maratori/testableexamples v1.0.0 h1:dU5alXRrD8WKSjOUnmJZuzdxWOEQ57+7s93SLMxb2vI= +github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKLyXp7K2u6HgraZCGzE= +github.com/maratori/testpackage v1.1.1 h1:S58XVV5AD7HADMmD0fNnziNHqKvSdDuEKdPD1rNTU04= +github.com/maratori/testpackage v1.1.1/go.mod h1:s4gRK/ym6AMrqpOa/kEbQTV4Q4jb7WeLZzVhVVVOQMc= +github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 h1:gWg6ZQ4JhDfJPqlo2srm/LN17lpybq15AryXIRcWYLE= +github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= +github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mgechev/revive v1.3.7 h1:502QY0vQGe9KtYJ9FpxMz9rL+Fc/P13CI5POL4uHCcE= +github.com/mgechev/revive v1.3.7/go.mod h1:RJ16jUbF0OWC3co/+XTxmFNgEpUPwnnA0BRllX2aDNA= +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.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/moricho/tparallel v0.3.1 h1:fQKD4U1wRMAYNngDonW5XupoB/ZGJHdpzrWqgyg9krA= +github.com/moricho/tparallel v0.3.1/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= +github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= +github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhKRf3Swg= +github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs= +github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= +github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= +github.com/nunnatsa/ginkgolinter v0.16.2 h1:8iLqHIZvN4fTLDC0Ke9tbSZVcyVHoBs0HIbnVSxfHJk= +github.com/nunnatsa/ginkgolinter v0.16.2/go.mod h1:4tWRinDN1FeJgU+iJANW/kz7xKN5nYRAOfJDQUS9dOQ= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= +github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= +github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= +github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= +github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +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/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/polyfloyd/go-errorlint v1.5.2 h1:SJhVik3Umsjh7mte1vE0fVZ5T1gznasQG3PV7U5xFdA= +github.com/polyfloyd/go-errorlint v1.5.2/go.mod h1:sH1QC1pxxi0fFecsVIzBmxtrgd9IF/SkJpA6wqyKAJs= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +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/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/quasilyte/go-ruleguard v0.4.2 h1:htXcXDK6/rO12kiTHKfHuqR4kr3Y4M0J0rOL6CH/BYs= +github.com/quasilyte/go-ruleguard v0.4.2/go.mod h1:GJLgqsLeo4qgavUoL8JeGFNS7qcisx3awV/w9eWTmNI= +github.com/quasilyte/go-ruleguard/dsl v0.3.22 h1:wd8zkOhSNr+I+8Qeciml08ivDt1pSXe60+5DqOpCjPE= +github.com/quasilyte/go-ruleguard/dsl v0.3.22/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= +github.com/quasilyte/gogrep v0.5.0/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng= +github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl980XxGFEZSS6KlBGIV0diGdySzxATTWoqaU= +github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= +github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= +github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryancurrah/gomodguard v1.3.2 h1:CuG27ulzEB1Gu5Dk5gP8PFxSOZ3ptSdP5iI/3IXxM18= +github.com/ryancurrah/gomodguard v1.3.2/go.mod h1:LqdemiFomEjcxOqirbQCb3JFvSxH2JUYMerTFd3sF2o= +github.com/ryanrolds/sqlclosecheck v0.5.1 h1:dibWW826u0P8jNLsLN+En7+RqWWTYrjCB9fJfSfdyCU= +github.com/ryanrolds/sqlclosecheck v0.5.1/go.mod h1:2g3dUjoS6AL4huFdv6wn55WpLIDjY7ZgUR4J8HOO/XQ= +github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/NsJFwFK7Uxc= +github.com/sanposhiho/wastedassign/v2 v2.0.7/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= +github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4= +github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= +github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= +github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= +github.com/sashamelentyev/usestdlibvars v1.26.0 h1:LONR2hNVKxRmzIrZR0PhSF3mhCAzvnr+DcUiHgREfXE= +github.com/sashamelentyev/usestdlibvars v1.26.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= +github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9 h1:rnO6Zp1YMQwv8AyxzuwsVohljJgp4L0ZqiCgtACsPsc= +github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9/go.mod h1:dg7lPlu/xK/Ut9SedURCoZbVCR4yC7fM65DtH9/CDHs= +github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= +github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE= +github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4= +github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= +github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= +github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= +github.com/sonatard/noctx v0.0.2/go.mod h1:kzFz+CzWSjQ2OzIm46uJZoXuBpa2+0y3T36U18dWqIo= +github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= +github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +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/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= +github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= +github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= +github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= +github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm07ysF0U6JQXczc= +github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= +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.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= +github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= +github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= +github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= +github.com/tdakkota/asciicheck v0.2.0/go.mod h1:Qb7Y9EgjCLJGup51gDHFzbI08/gbGhL/UVhYIPWG2rg= +github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= +github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= +github.com/tetafro/godot v1.4.16 h1:4ChfhveiNLk4NveAZ9Pu2AN8QZ2nkUGFuadM9lrr5D0= +github.com/tetafro/godot v1.4.16/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= +github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= +github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= +github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= +github.com/timonwong/loggercheck v0.9.4/go.mod h1:caz4zlPcgvpEkXgVnAJGowHAMW2NwHaNlpS8xDbVhTg= +github.com/tomarrell/wrapcheck/v2 v2.8.3 h1:5ov+Cbhlgi7s/a42BprYoxsr73CbdMUTzE3bRDFASUs= +github.com/tomarrell/wrapcheck/v2 v2.8.3/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo= +github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= +github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= +github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81vI= +github.com/ultraware/funlen v0.1.0/go.mod h1:XJqmOQja6DpxarLj6Jj1U7JuoS8PvL4nEqDaQhy22p4= +github.com/ultraware/whitespace v0.1.1 h1:bTPOGejYFulW3PkcrqkeQwOd6NKOOXvmGD9bo/Gk8VQ= +github.com/ultraware/whitespace v0.1.1/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= +github.com/uudashr/gocognit v1.1.2 h1:l6BAEKJqQH2UpKAPKdMfZf5kE4W/2xk8pfU1OVLvniI= +github.com/uudashr/gocognit v1.1.2/go.mod h1:aAVdLURqcanke8h3vg35BC++eseDm66Z7KmchI5et4k= +github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU= +github.com/xen0n/gosmopolitan v1.2.2/go.mod h1:7XX7Mj61uLYrj0qmeN0zi7XDon9JRAEhYQqAPLVNTeg= +github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= +github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= +github.com/yeya24/promlinter v0.3.0 h1:JVDbMp08lVCP7Y6NP3qHroGAO6z2yGKQtS5JsjqtoFs= +github.com/yeya24/promlinter v0.3.0/go.mod h1:cDfJQQYv9uYciW60QT0eeHlFodotkYZlL+YcPQN+mW4= +github.com/ykadowak/zerologlint v0.1.5 h1:Gy/fMz1dFQN9JZTPjv1hxEk+sRWm05row04Yoolgdiw= +github.com/ykadowak/zerologlint v0.1.5/go.mod h1:KaUskqF3e/v59oPmdq1U1DnKcuHokl2/K1U4pmIELKg= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +gitlab.com/bosi/decorder v0.4.2 h1:qbQaV3zgwnBZ4zPMhGLW4KZe7A7NwxEhJx39R3shffo= +gitlab.com/bosi/decorder v0.4.2/go.mod h1:muuhHoaJkA9QLcYHq4Mj8FJUwDZ+EirSHRiaTcTf6T8= +go-simpler.org/musttag v0.12.2 h1:J7lRc2ysXOq7eM8rwaTYnNrHd5JwjppzB6mScysB2Cs= +go-simpler.org/musttag v0.12.2/go.mod h1:uN1DVIasMTQKk6XSik7yrJoEysGtR2GRqvWnI9S7TYM= +go-simpler.org/sloglint v0.7.1 h1:qlGLiqHbN5islOxjeLXoPtUdZXb669RW+BDQ+xOSNoU= +go-simpler.org/sloglint v0.7.1/go.mod h1:OlaVDRh/FKKd4X4sIMbsz8st97vomydceL146Fthh/c= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= +go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= +go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= +go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= +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-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +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/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM= +golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f h1:phY1HzDcf18Aq9A8KkmRtY9WvOFIxN8wgfvy6Zm1DV8= +golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +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-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +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/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= +golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +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-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-20190311183353-d8887717615a/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-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/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-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +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/sync v0.0.0-20190227155943-e225da77a7e6/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-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/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/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +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-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-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +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-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/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/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/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-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= +golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= +golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= +golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= +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/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +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/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +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-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +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.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +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.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +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.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.4.7 h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs= +honnef.co/go/tools v0.4.7/go.mod h1:+rnGS1THNh8zMwnd2oVOTL9QF6vmfyG6ZXBULae2uc0= +mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= +mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA= +mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8XzX0u72NttUGVFjO3U= +mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f/go.mod h1:RSLa7mKKCNeTTMHBw5Hsy2rfJmd6O2ivt9Dw9ZqCQpQ= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/.bingo/gotestsum.mod b/.bingo/gotestsum.mod new file mode 100644 index 00000000000..b703b5fff8d --- /dev/null +++ b/.bingo/gotestsum.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.21 + +require gotest.tools/gotestsum v1.11.0 diff --git a/.bingo/gotestsum.sum b/.bingo/gotestsum.sum new file mode 100644 index 00000000000..23f8b971bb8 --- /dev/null +++ b/.bingo/gotestsum.sum @@ -0,0 +1,89 @@ +github.com/bitfield/gotestdox v0.2.1 h1:Zj8IMLAO5/oiAKoMmtN96eyFiPZraJRTH2p0zDgtxc0= +github.com/bitfield/gotestdox v0.2.1/go.mod h1:D+gwtS0urjBrzguAkTM2wodsTQYFHdpx8eqRJ3N+9pY= +github.com/dnephin/pflag v1.0.7 h1:oxONGlWxhmUct0YzKTgrpQv9AUA1wtPBn7zuSjJqptk= +github.com/dnephin/pflag v1.0.7/go.mod h1:uxE91IoWURlOiTUIA8Mq5ZZkAv3dPUfZNaT80Zm7OQE= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +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/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/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-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +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-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= +golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= +golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= +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/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gotest.tools/gotestsum v1.11.0 h1:A88/QWw7acMjZH1dMe6KZFhw32odUOIjCiAU/Q4n3mI= +gotest.tools/gotestsum v1.11.0/go.mod h1:cUOKgFEvWAP0twchmiOvdzX0SBZX0UI58bGRpRIu4xs= +gotest.tools/v3 v3.3.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A= diff --git a/.bingo/mockgen.mod b/.bingo/mockgen.mod new file mode 100644 index 00000000000..2c0b847554c --- /dev/null +++ b/.bingo/mockgen.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.21 + +require github.com/golang/mock v1.6.0 // mockgen diff --git a/.bingo/mockgen.sum b/.bingo/mockgen.sum new file mode 100644 index 00000000000..6904b3efe74 --- /dev/null +++ b/.bingo/mockgen.sum @@ -0,0 +1,29 @@ +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +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/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +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-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1 h1:wGiQel/hW0NnEkJUk8lbzkX2gFJU6PFxf1v5OlCfuOs= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +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-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/.bingo/variables.env b/.bingo/variables.env new file mode 100644 index 00000000000..a694309f8dd --- /dev/null +++ b/.bingo/variables.env @@ -0,0 +1,34 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.9. DO NOT EDIT. +# All tools are designed to be build inside $GOBIN. +# Those variables will work only until 'bingo get' was invoked, or if tools were installed via Makefile's Variables.mk. +GOBIN=${GOBIN:=$(go env GOBIN)} + +if [ -z "$GOBIN" ]; then + GOBIN="$(go env GOPATH)/bin" +fi + + +BINGO="${GOBIN}/bingo-v0.9.0" + +CLIENT_GEN="${GOBIN}/client-gen-v0.25.16" + +CONTROLLER_GEN="${GOBIN}/controller-gen-v0.9.0" + +ENUMER="${GOBIN}/enumer-v1.1.2" + +GENCOSMOSDB="${GOBIN}/gencosmosdb-v0.0.0-20240729051124-c9cf2c4f6aa1" + +GO_BINDATA="${GOBIN}/go-bindata-v3.1.2+incompatible" + +GOCOV_XML="${GOBIN}/gocov-xml-v1.1.0" + +GOCOV="${GOBIN}/gocov-v1.1.0" + +GOIMPORTS="${GOBIN}/goimports-v0.23.0" + +GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.59.1" + +GOTESTSUM="${GOBIN}/gotestsum-v1.11.0" + +MOCKGEN="${GOBIN}/mockgen-v1.6.0" + diff --git a/.github/workflows/ci-go.yml b/.github/workflows/ci-go.yml index 98e1188679c..852ad5ee39b 100644 --- a/.github/workflows/ci-go.yml +++ b/.github/workflows/ci-go.yml @@ -19,9 +19,9 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Install Go runtime deps + - name: Add GOBIN to PATH run: | - make install-go-tools + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Build all run: | make build-all @@ -36,6 +36,9 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Add GOBIN to PATH + run: | + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - run: | make go-verify hack/ci-utils/isClean.sh @@ -47,6 +50,9 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Add GOBIN to PATH + run: | + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Run make generate run: | make generate diff --git a/.github/workflows/golint.yml b/.github/workflows/golint.yml index 710879d1efb..178ac8806a7 100644 --- a/.github/workflows/golint.yml +++ b/.github/workflows/golint.yml @@ -27,7 +27,7 @@ jobs: - name: Run golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.56.2 + version: v1.59.1 args: -v --timeout 15m validate-go: diff --git a/.pipelines/ci.yml b/.pipelines/ci.yml index 797ad7e0b50..4c77ae9b890 100644 --- a/.pipelines/ci.yml +++ b/.pipelines/ci.yml @@ -69,6 +69,11 @@ stages: displayName: Print Go version & env target: golang + - script: | + echo "##vso[task.prependpath]$(go env GOPATH)/bin" + displayName: Add GOBIN to path + target: golang + - script: | set -xe # Required for podman 5 @@ -98,8 +103,7 @@ stages: condition: succeededOrFailed() - script: | - set -xe - go run github.com/axw/gocov/gocov@v1.1.0 convert cover.out | go run github.com/AlekSi/gocov-xml@v1.1.0 > coverage.xml + make xmlcov displayName: ⚙️ Process Reports condition: succeededOrFailed() target: golang diff --git a/Dockerfile.aro-e2e b/Dockerfile.aro-e2e index 74a2c978fe2..d1ada4cd188 100644 --- a/Dockerfile.aro-e2e +++ b/Dockerfile.aro-e2e @@ -9,6 +9,7 @@ RUN mkdir -p /app WORKDIR /app COPY . /app + RUN make aro RELEASE=${IS_OFFICIAL_RELEASE} -o generate && make validate-fips && make e2e.test e2etools FROM ${REGISTRY}/ubi8/ubi-minimal diff --git a/Dockerfile.aro-multistage b/Dockerfile.aro-multistage index a94dcbaee7d..b97c3ed6599 100644 --- a/Dockerfile.aro-multistage +++ b/Dockerfile.aro-multistage @@ -9,6 +9,7 @@ RUN mkdir -p /app WORKDIR /app COPY . /app + RUN make aro RELEASE=${IS_OFFICIAL_RELEASE} -o generate && make validate-fips && make e2e.test FROM ${REGISTRY}/ubi8/ubi-minimal diff --git a/Dockerfile.ci-rp b/Dockerfile.ci-rp index 432f51a3f90..219724c1974 100644 --- a/Dockerfile.ci-rp +++ b/Dockerfile.ci-rp @@ -32,6 +32,14 @@ WORKDIR /app ENV GOPATH=/root/go ENV GOFLAGS="-tags=containers_image_openpgp,exclude_graphdriver_btrfs,exclude_graphdriver_devicemapper" +COPY .bingo .bingo +RUN source .bingo/variables.env \ + # install bingo itself + && make -f .bingo/Variables.mk ${BINGO} \ + # and all the tools it manages + && ${BINGO} get -l +ENV PATH=$PATH:${GOPATH}/bin/ + # Copy dependencies and source files COPY go.mod go.sum ./ COPY vendor vendor @@ -48,8 +56,8 @@ COPY --from=portal-build /build/pkg/portal/assets/v2/build /app/pkg/portal/asset RUN go build -ldflags "-X github.com/Azure/ARO-RP/pkg/util/version.GitCommit=${ARO_VERSION}" ./cmd/aro RUN go test ./test/e2e/... -tags e2e,codec.safe -c -ldflags "-X github.com/Azure/ARO-RP/pkg/util/version.GitCommit=${ARO_VERSION}" -o e2e.test -# Run unit tests -RUN go run gotest.tools/gotestsum@v1.11.0 --format pkgname --junitfile report.xml -- -coverprofile=cover.out ./... +# Additional tests +RUN gotestsum --format pkgname --junitfile report.xml -- -coverprofile=cover.out ./... # Validate FIPS RUN hack/fips/validate-fips.sh ./aro diff --git a/Dockerfile.ci-rp.dockerignore b/Dockerfile.ci-rp.dockerignore index b0059ba4898..c3233e95992 100644 --- a/Dockerfile.ci-rp.dockerignore +++ b/Dockerfile.ci-rp.dockerignore @@ -10,6 +10,7 @@ !swagger !test !vendor +!.bingo # Ignore locally built NPM artifacts - using new automated process pkg/portal/assets/v2/build @@ -22,4 +23,3 @@ pkg/portal/assets/v2/build !portal/v2/tsconfig.json !portal/v2/.eslintrc.yml !portal/v2/.npmrc - diff --git a/Makefile b/Makefile index bccf1d42fc5..87c3429aaf0 100644 --- a/Makefile +++ b/Makefile @@ -15,11 +15,12 @@ FLUENTBIT_IMAGE ?= ${RP_IMAGE_ACR}.azurecr.io/fluentbit:$(FLUENTBIT_VERSION)-cm$ AUTOREST_VERSION = 3.6.3 AUTOREST_IMAGE = quay.io/openshift-on-azure/autorest:${AUTOREST_VERSION} GATEKEEPER_VERSION = v3.15.1 -GOTESTSUM = gotest.tools/gotestsum@v1.11.0 # Golang version go mod tidy compatibility GOLANG_VERSION ?= 1.21 +include .bingo/Variables.mk + ifneq ($(shell uname -s),Darwin) export CGO_CFLAGS=-Dgpgme_off_t=off_t endif @@ -84,7 +85,7 @@ clean: find -type d -name 'gomock_reflect_[0-9]*' -exec rm -rf {} \+ 2>/dev/null .PHONY: client -client: generate +client: generate $(GOIMPORTS) hack/build-client.sh "${AUTOREST_IMAGE}" 2020-04-30 2021-09-01-preview 2022-04-01 2022-09-04 2023-04-01 2023-07-01-preview 2023-09-04 2023-11-22 2024-08-12-preview # TODO: hard coding dev-config.yaml is clunky; it is also probably convenient to @@ -104,27 +105,27 @@ discoverycache: $(MAKE) generate .PHONY: generate -generate: +generate: install-tools go generate ./... # TODO: This does not work outside of GOROOT. We should replace all usage of the # clientset with controller-runtime so we don't need to generate it. .PHONY: generate-operator-apiclient -generate-operator-apiclient: - go run ./vendor/k8s.io/code-generator/cmd/client-gen --clientset-name versioned --input-base ./pkg/operator/apis --input aro.openshift.io/v1alpha1,preview.aro.openshift.io/v1alpha1 --output-package ./pkg/operator/clientset --go-header-file ./hack/licenses/boilerplate.go.txt +generate-operator-apiclient: $(GOIMPORTS) $(CLIENT_GEN) + $(CLIENT_GEN) --clientset-name versioned --input-base ./pkg/operator/apis --input aro.openshift.io/v1alpha1,preview.aro.openshift.io/v1alpha1 --output-package ./pkg/operator/clientset --go-header-file ./hack/licenses/boilerplate.go.txt gofmt -s -w ./pkg/operator/clientset - go run ./vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ./pkg/operator/clientset ./pkg/operator/apis + $(GOIMPORTS) -local=github.com/Azure/ARO-RP -e -w ./pkg/operator/clientset ./pkg/operator/apis .PHONY: generate-guardrails generate-guardrails: cd pkg/operator/controllers/guardrails/policies && ./scripts/generate.sh > /dev/null .PHONY: generate-kiota -generate-kiota: +generate-kiota: $(GOIMPORTS) kiota generate --clean-output -l go -o ./pkg/util/graph/graphsdk -n "github.com/Azure/ARO-RP/pkg/util/graph/graphsdk" -d hack/graphsdk/openapi.yaml -c GraphBaseServiceClient --additional-data=False --backing-store=True find ./pkg/util/graph/graphsdk -type f -name "*.go" -exec sed -i'' -e 's\github.com/azure/aro-rp\github.com/Azure/ARO-RP\g' {} + gofmt -s -w pkg/util/graph/graphsdk - go run ./vendor/golang.org/x/tools/cmd/goimports -w -local=github.com/Azure/ARO-RP pkg/util/graph/graphsdk + $(GOIMPORTS) -w -local=github.com/Azure/ARO-RP pkg/util/graph/graphsdk go run ./hack/validate-imports pkg/util/graph/graphsdk go run ./hack/licenses -dirs ./pkg/util/graph/graphsdk @@ -247,9 +248,9 @@ test-e2e: e2e.test test-go: generate build-all validate-go lint-go unit-test-go .PHONY: validate-go -validate-go: +validate-go: $(GOIMPORTS) gofmt -s -w cmd hack pkg test - go run ./vendor/golang.org/x/tools/cmd/goimports -w -local=github.com/Azure/ARO-RP cmd hack pkg test + $(GOIMPORTS) -w -local=github.com/Azure/ARO-RP cmd hack pkg test go run ./hack/validate-imports cmd hack pkg test go run ./hack/licenses @[ -z "$$(ls pkg/util/*.go 2>/dev/null)" ] || (echo error: go files are not allowed in pkg/util, use a subpackage; exit 1) @@ -270,16 +271,16 @@ validate-fips: hack/fips/validate-fips.sh ./aro .PHONY: unit-test-go -unit-test-go: - go run ${GOTESTSUM} --format pkgname --junitfile report.xml -- -coverprofile=cover.out ./... +unit-test-go: $(GOTESTSUM) + $(GOTESTSUM) --format pkgname --junitfile report.xml -- -coverprofile=cover.out ./... .PHONY: unit-test-go-coverpkg -unit-test-go-coverpkg: - go run ${GOTESTSUM} --format pkgname --junitfile report.xml -- -coverpkg=./... -coverprofile=cover_coverpkg.out ./... +unit-test-go-coverpkg: $(GOTESTSUM) + $(GOTESTSUM) --format pkgname --junitfile report.xml -- -coverpkg=./... -coverprofile=cover_coverpkg.out ./... .PHONY: lint-go lint-go: - hack/lint-go.sh + $(GOLANGCI_LINT) run --verbose .PHONY: lint-admin-portal lint-admin-portal: @@ -324,7 +325,7 @@ go-tidy: # Run go mod tidy - add missing and remove unused modules. go mod tidy -compat=${GOLANG_VERSION} .PHONY: go-vendor -go-vendor: # Run go mod vendor - only modules that are used in the source code will be vendored in (make vendored copy of dependencies). +go-vendor: # Run go mod vendor - only modules that are used in the source code will be vendored in (make vendored copy of dependencies). go mod vendor .PHONY: go-verify @@ -337,9 +338,13 @@ vendor: hack/update-go-module-dependencies.sh $(MAKE) go-verify +.PHONY: xmlcov +xmlcov: $(GOCOV) $(GOCOV_XML) + $(GOCOV) convert cover.out | $(GOCOV_XML) > coverage.xml + .PHONY: install-go-tools -install-go-tools: - go install ${GOTESTSUM} +install-go-tools: $(BINGO) + $(BINGO) get -l ############################################################################### # Containerized CI/CD RP @@ -532,4 +537,4 @@ run-rp: ci-rp podman-secrets --secret proxy-client.key,target=/app/secrets/proxy-client.key \ --secret proxy-client.crt,target=/app/secrets/proxy-client.crt \ --secret proxy.crt,target=/app/secrets/proxy.crt \ - $(LOCAL_ARO_RP_IMAGE):$(VERSION) rp \ No newline at end of file + $(LOCAL_ARO_RP_IMAGE):$(VERSION) rp diff --git a/deps.go b/deps.go index 9771c96bf78..e528b8928bc 100644 --- a/deps.go +++ b/deps.go @@ -7,12 +7,5 @@ package main // Licensed under the Apache License 2.0. import ( - _ "github.com/alvaroloes/enumer" - _ "github.com/go-bindata/go-bindata/go-bindata" - _ "github.com/golang/mock/mockgen" - _ "github.com/jewzaam/go-cosmosdb/cmd/gencosmosdb" - _ "github.com/onsi/ginkgo/v2/ginkgo" - _ "golang.org/x/tools/cmd/goimports" - _ "k8s.io/code-generator/cmd/client-gen" - _ "sigs.k8s.io/controller-tools/cmd/controller-gen" + _ "github.com/golang/mock/mockgen/model" ) diff --git a/go.mod b/go.mod index e5631d6adc7..b54f93a9da3 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,6 @@ require ( github.com/Azure/go-autorest/autorest/validation v0.3.1 github.com/Azure/go-autorest/tracing v0.6.0 github.com/Azure/msi-dataplane v0.0.3 - github.com/alvaroloes/enumer v1.1.2 github.com/apparentlymart/go-cidr v1.1.0 github.com/codahale/etm v0.0.0-20141003032925-c00c9e6fb4c9 github.com/containers/image/v5 v5.30.1 @@ -30,7 +29,6 @@ require ( github.com/coreos/ignition/v2 v2.14.0 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc github.com/form3tech-oss/jwt-go v3.2.5+incompatible - github.com/go-bindata/go-bindata v3.1.2+incompatible github.com/go-chi/chi/v5 v5.0.8 github.com/go-logr/logr v1.4.2 github.com/go-test/deep v1.1.0 @@ -46,7 +44,6 @@ require ( github.com/gorilla/sessions v1.2.2 github.com/hashicorp/go-multierror v1.1.1 github.com/itchyny/gojq v0.12.13 - github.com/jewzaam/go-cosmosdb v0.0.0-20240723075448-058185e3c66d github.com/jongio/azidext/go/azidext v0.5.0 github.com/microsoft/kiota-abstractions-go v1.2.0 github.com/microsoft/kiota-http-go v1.0.0 @@ -89,12 +86,10 @@ require ( k8s.io/apimachinery v0.30.3 k8s.io/cli-runtime v0.25.16 k8s.io/client-go v0.26.2 - k8s.io/code-generator v0.25.16 k8s.io/kubectl v0.24.17 k8s.io/kubernetes v1.28.4 k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 sigs.k8s.io/controller-runtime v0.13.1 - sigs.k8s.io/controller-tools v0.9.0 sigs.k8s.io/yaml v1.4.0 ) @@ -146,7 +141,6 @@ require ( github.com/emicklei/go-restful/v3 v3.10.1 // indirect github.com/evanphx/json-patch v5.6.0+incompatible // indirect github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect - github.com/fatih/color v1.15.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect @@ -169,7 +163,6 @@ require ( github.com/go-playground/validator/v10 v10.22.0 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect - github.com/gobuffalo/flect v0.2.5 // indirect github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect @@ -202,7 +195,6 @@ require ( github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mattn/go-shellwords v1.0.12 // indirect @@ -231,7 +223,6 @@ require ( github.com/opencontainers/selinux v1.11.0 // indirect github.com/openshift/custom-resource-status v1.1.3-0.20220503160415-f2fdb4999d87 // indirect github.com/ostreedev/ostree-go v0.0.0-20210805093236-719684c64e4f // indirect - github.com/pascaldekloe/name v0.0.0-20180628100202-0fd16699aae1 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pkg/sftp v1.13.6 // indirect @@ -286,7 +277,6 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiserver v0.26.2 // indirect k8s.io/component-base v0.26.2 // indirect - k8s.io/gengo v0.0.0-20211129171323-c02415ce4185 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-aggregator v0.24.1 // indirect k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect @@ -1593,7 +1583,6 @@ replace ( k8s.io/kubectl => k8s.io/kubectl v0.25.16 k8s.io/kubernetes => k8s.io/kubernetes v1.25.16 sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.11.2 - sigs.k8s.io/controller-tools => sigs.k8s.io/controller-tools v0.9.0 sigs.k8s.io/kustomize/api => sigs.k8s.io/kustomize/api v0.11.2 sigs.k8s.io/kustomize/kyaml => sigs.k8s.io/kustomize/kyaml v0.13.3 sigs.k8s.io/structured-merge-diff => sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06 diff --git a/go.sum b/go.sum index cd036e7224d..c7f77acd6a1 100644 --- a/go.sum +++ b/go.sum @@ -71,8 +71,6 @@ github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1o github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= -github.com/alvaroloes/enumer v1.1.2 h1:5khqHB33TZy1GWCO/lZwcroBFh7u+0j40T83VUbfAMY= -github.com/alvaroloes/enumer v1.1.2/go.mod h1:FxrjvuXoDAx9isTJrv4c+T410zFi0DtXIT0m65DJ+Wo= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220418222510-f25a4f6275ed h1:ue9pVfIcP+QMEjfgo/Ez4ZjNZfonGgR6NgjMaJMu1Cg= github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220418222510-f25a4f6275ed/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= @@ -204,8 +202,6 @@ github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCv github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f h1:Wl78ApPPB2Wvf/TIe2xdyJxTlb6obmF18d8QdkxNDu4= github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f/go.mod h1:OSYXu++VVOHnXeitef/D8n/6y4QV8uLHSFXX4NeXMGc= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/form3tech-oss/jwt-go v3.2.5+incompatible h1:/l4kBbb4/vGSsdtB5nUe8L7B9mImVMaBPw9L/0TBHU8= @@ -223,8 +219,6 @@ github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSy github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew= github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I= -github.com/go-bindata/go-bindata v3.1.2+incompatible h1:5vjJMVhowQdPzjE1LdxyFF7YFTXg5IgGVW4gBr5IbvE= -github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo= github.com/go-chi/chi/v5 v5.0.8 h1:lD+NLqFcAi1ovnVZpsnObHGW4xb4J8lNmoYVfECH1Y0= github.com/go-chi/chi/v5 v5.0.8/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= @@ -296,8 +290,6 @@ github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEe github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg= github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= -github.com/gobuffalo/flect v0.2.5 h1:H6vvsv2an0lalEaCDRThvtBfmg44W/QHXBCYUXf/6S4= -github.com/gobuffalo/flect v0.2.5/go.mod h1:1ZyCLIbg0YD7sDkzvFdPoOydPtD8y9JQnrOROolUcM8= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466 h1:sQspH8M4niEijh3PFscJRLDnkL547IeP7kpPe3uUhEg= @@ -384,8 +376,6 @@ github.com/itchyny/gojq v0.12.13/go.mod h1:JzwzAqenfhrPUuwbmEz3nu3JQmFLlQTQMUcOd github.com/itchyny/timefmt-go v0.1.5 h1:G0INE2la8S6ru/ZI5JecgyzbbJNs5lG1RcBqa7Jm6GE= github.com/itchyny/timefmt-go v0.1.5/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2stDBckWakZ8= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jewzaam/go-cosmosdb v0.0.0-20240723075448-058185e3c66d h1:2Xp2eP830w13cWq6sombl3EsBM46xYkdkLog8BgFWyQ= -github.com/jewzaam/go-cosmosdb v0.0.0-20240723075448-058185e3c66d/go.mod h1:hEk8/SoE/NBT9ofV69Gzs98vbGyF155SaYl1p9bxKb8= github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= @@ -437,9 +427,6 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= @@ -557,8 +544,6 @@ github.com/ostreedev/ostree-go v0.0.0-20210805093236-719684c64e4f h1:/UDgs8FGMqw github.com/ostreedev/ostree-go v0.0.0-20210805093236-719684c64e4f/go.mod h1:J6OG6YJVEWopen4avK3VNQSnALmmjvniMmni/YFYAwc= github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= -github.com/pascaldekloe/name v0.0.0-20180628100202-0fd16699aae1 h1:/I3lTljEEDNYLho3/FUB7iD/oc2cEFgVmbHzV+O0PtU= -github.com/pascaldekloe/name v0.0.0-20180628100202-0fd16699aae1/go.mod h1:eD5JxqMiuNYyFNmyY9rkJ/slN8y59oEu4Ei7F8OoKWQ= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/pin/tftp v2.1.0+incompatible/go.mod h1:xVpZOMCXTy+A5QMjEVN0Glwa1sUvaJhFXbr/aAxuxGY= @@ -783,11 +768,9 @@ k8s.io/cli-runtime v0.25.16 h1:u6Uzd1ZHAa9N8y0nXvevTn7+h+KSBJ1M0NAxD+wPVy8= k8s.io/cli-runtime v0.25.16/go.mod h1:aGnXwnp70LXzW7lyK4pOdWMTeunz1JL42JxcoW4B40c= k8s.io/client-go v0.25.16 h1:Lf8gd4vP9hR2sDuSU+9id9Mj23u8X58nESZ5m1JcI24= k8s.io/client-go v0.25.16/go.mod h1:6y5hyLavOErqO5LWUzk5rwKpRqmwZsE3oe3RW0cgs9s= -k8s.io/code-generator v0.25.16 h1:+GlLubryRmKHHb486r3OS0XbPOk8LTC/PcqQOfGLwYw= k8s.io/code-generator v0.25.16/go.mod h1:rv2rN7kkHpAMnEULzXSC380Tsj1rN7nkpzVqT59ptjk= k8s.io/component-base v0.25.16 h1:ywaMQRJoCCQwWSM6z9jC+RJWBY/CcJDVgnyyIhuNAkQ= k8s.io/component-base v0.25.16/go.mod h1:ZMFrcDjbpM12U5hvZ8bXgPf9U2Wrp0McSGMhoUkA9Mo= -k8s.io/gengo v0.0.0-20211129171323-c02415ce4185 h1:TT1WdmqqXareKxZ/oNXEUSwKlLiHzPMyB0t8BaFeBYI= k8s.io/gengo v0.0.0-20211129171323-c02415ce4185/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= @@ -803,8 +786,6 @@ k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1 k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/controller-runtime v0.11.2 h1:H5GTxQl0Mc9UjRJhORusqfJCIjBO8UtUxGggCwL1rLA= sigs.k8s.io/controller-runtime v0.11.2/go.mod h1:P6QCzrEjLaZGqHsfd+os7JQ+WFZhvB8MRFsn4dWF7O4= -sigs.k8s.io/controller-tools v0.9.0 h1:b/vSEPpA8hiMiyzDfLbZdCn3hoAcy3/868OHhYtHY9w= -sigs.k8s.io/controller-tools v0.9.0/go.mod h1:NUkn8FTV3Sad3wWpSK7dt/145qfuQ8CKJV6j4jHC5rM= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/kube-storage-version-migrator v0.0.4 h1:qsCecgZHgdismlTt8xCmS/3numvpxrj58RWJeIg76wc= diff --git a/hack/build-client.sh b/hack/build-client.sh index baffb73ef60..e820326d3c5 100755 --- a/hack/build-client.sh +++ b/hack/build-client.sh @@ -15,7 +15,7 @@ function checksum() { local API_VERSION=$1 local FOLDER=$2 - sha256sum swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/openshiftclusters/"$FOLDER"/"$API_VERSION"/redhatopenshift.json >> .sha256sum + sha256sum swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/"$FOLDER"/"$API_VERSION"/redhatopenshift.json >>.sha256sum } function generate_golang() { @@ -51,7 +51,7 @@ function generate_golang() { "/github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/${API_VERSION}/redhatopenshift/models.go" \ "/github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/${API_VERSION}/redhatopenshift/redhatopenshiftapi/interfaces.go" - go run ./vendor/golang.org/x/tools/cmd/goimports -w -local=github.com/Azure/ARO-RP pkg/client + goimports -w -local=github.com/Azure/ARO-RP pkg/client } function generate_python() { @@ -86,8 +86,7 @@ fi AUTOREST_IMAGE=$1 -for API_VERSION in "${@: 2}" -do +for API_VERSION in "${@:2}"; do FOLDER=stable if [[ "$API_VERSION" =~ .*preview ]]; then FOLDER=preview diff --git a/hack/lint-go.sh b/hack/lint-go.sh deleted file mode 100755 index 562db518dff..00000000000 --- a/hack/lint-go.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -e - -# lint-go.sh is used to run Go linting. This shell script is invoked by the Makefile. -# It is not used in our pipelines as we have a github action that does the Go linting, so this script -# is intended to be used locally when developing. - -# What does this script? -# It will try to execute the golangci-lint binary to check if there are any linter errors. -# In case the binary that is trying to execute does not exist, -# the script will print a message with instructions to download the binary and will exit with a non-zero exit code. - -if ! command -v golangci-lint &> /dev/null -then - echo "ERROR: golangci-lint could not be found, Go linting aborted. To install it visit https://golangci-lint.run/usage/install/#local-installation" - exit 1 -else - golangci-lint run --verbose -fi diff --git a/pkg/api/admin/generate.go b/pkg/api/admin/generate.go index c088ee90f8d..485102cb95d 100644 --- a/pkg/api/admin/generate.go +++ b/pkg/api/admin/generate.go @@ -3,4 +3,4 @@ package admin // Copyright (c) Microsoft Corporation. // Licensed under the Apache License 2.0. -//go:generate go run ../../../vendor/github.com/alvaroloes/enumer -type InstallPhase -output zz_generated_installphase_enumer.go +//go:generate enumer -type InstallPhase -output zz_generated_installphase_enumer.go diff --git a/pkg/api/generate.go b/pkg/api/generate.go index d58a0d64e7c..0d4004e4d6e 100644 --- a/pkg/api/generate.go +++ b/pkg/api/generate.go @@ -3,6 +3,6 @@ package api // Copyright (c) Microsoft Corporation. // Licensed under the Apache License 2.0. -//go:generate go run ../../vendor/github.com/alvaroloes/enumer -type InstallPhase -output zz_generated_installphase_enumer.go -//go:generate go run ../../vendor/github.com/golang/mock/mockgen -destination=../util/mocks/api/api.go github.com/Azure/ARO-RP/pkg/api SyncSetConverter,MachinePoolConverter,SyncIdentityProviderConverter,SecretConverter -//go:generate go run ../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/api/api.go +//go:generate enumer -type InstallPhase -output zz_generated_installphase_enumer.go +//go:generate mockgen -destination=../util/mocks/api/api.go github.com/Azure/ARO-RP/pkg/api SyncSetConverter,MachinePoolConverter,SyncIdentityProviderConverter,SecretConverter +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/api/api.go diff --git a/pkg/cluster/generate.go b/pkg/cluster/generate.go index 2eb197fb00b..3148e63dd09 100644 --- a/pkg/cluster/generate.go +++ b/pkg/cluster/generate.go @@ -3,7 +3,7 @@ package cluster // Copyright (c) Microsoft Corporation. // Licensed under the Apache License 2.0. -//go:generate go run ../../vendor/github.com/golang/mock/mockgen -destination=../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/$GOPACKAGE Interface -//go:generate go run ../../vendor/github.com/golang/mock/mockgen -destination=../util/mocks/samplesclient/versioned.go github.com/openshift/client-go/samples/clientset/versioned Interface -//go:generate go run ../../vendor/github.com/golang/mock/mockgen -destination=../util/mocks/samples/samples.go github.com/openshift/client-go/samples/clientset/versioned/typed/samples/v1 SamplesV1Interface,ConfigInterface -//go:generate go run ../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/$GOPACKAGE Interface +//go:generate mockgen -destination=../util/mocks/samplesclient/versioned.go github.com/openshift/client-go/samples/clientset/versioned Interface +//go:generate mockgen -destination=../util/mocks/samples/samples.go github.com/openshift/client-go/samples/clientset/versioned/typed/samples/v1 SamplesV1Interface,ConfigInterface +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/cluster/graph/generate.go b/pkg/cluster/graph/generate.go index 5fd91b14c4a..1de36444168 100644 --- a/pkg/cluster/graph/generate.go +++ b/pkg/cluster/graph/generate.go @@ -4,5 +4,5 @@ package graph // Licensed under the Apache License 2.0. //go:generate rm -rf ../../util/mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/cluster/$GOPACKAGE Manager -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../util/mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/cluster/$GOPACKAGE Manager +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../util/mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/database/cosmosdb/generate.go b/pkg/database/cosmosdb/generate.go index b89f19f2b1d..56bf0816e78 100644 --- a/pkg/database/cosmosdb/generate.go +++ b/pkg/database/cosmosdb/generate.go @@ -3,7 +3,7 @@ package cosmosdb // Copyright (c) Microsoft Corporation. // Licensed under the Apache License 2.0. -//go:generate go run ../../../vendor/github.com/jewzaam/go-cosmosdb/cmd/gencosmosdb github.com/Azure/ARO-RP/pkg/api,AsyncOperationDocument github.com/Azure/ARO-RP/pkg/api,BillingDocument github.com/Azure/ARO-RP/pkg/api,GatewayDocument github.com/Azure/ARO-RP/pkg/api,MonitorDocument github.com/Azure/ARO-RP/pkg/api,OpenShiftClusterDocument github.com/Azure/ARO-RP/pkg/api,SubscriptionDocument github.com/Azure/ARO-RP/pkg/api,OpenShiftVersionDocument github.com/Azure/ARO-RP/pkg/api,ClusterManagerConfigurationDocument github.com/Azure/ARO-RP/pkg/api,PlatformWorkloadIdentityRoleSetDocument -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ./ -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/database/$GOPACKAGE PermissionClient -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../util/mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate gencosmosdb github.com/Azure/ARO-RP/pkg/api,AsyncOperationDocument github.com/Azure/ARO-RP/pkg/api,BillingDocument github.com/Azure/ARO-RP/pkg/api,GatewayDocument github.com/Azure/ARO-RP/pkg/api,MonitorDocument github.com/Azure/ARO-RP/pkg/api,OpenShiftClusterDocument github.com/Azure/ARO-RP/pkg/api,SubscriptionDocument github.com/Azure/ARO-RP/pkg/api,OpenShiftVersionDocument github.com/Azure/ARO-RP/pkg/api,ClusterManagerConfigurationDocument github.com/Azure/ARO-RP/pkg/api,PlatformWorkloadIdentityRoleSetDocument +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ./ +//go:generate mockgen -destination=../../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/database/$GOPACKAGE PermissionClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../util/mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/deploy/vmsscleaner/generate.go b/pkg/deploy/vmsscleaner/generate.go index 6d47d788f58..ad1d97ebd13 100644 --- a/pkg/deploy/vmsscleaner/generate.go +++ b/pkg/deploy/vmsscleaner/generate.go @@ -4,5 +4,5 @@ package vmsscleaner // Licensed under the Apache License 2.0. //go:generate rm -rf ../../util/mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/deploy/$GOPACKAGE Interface -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../util/mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/deploy/$GOPACKAGE Interface +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../util/mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/env/generate.go b/pkg/env/generate.go index c6575e2b570..97490407bca 100644 --- a/pkg/env/generate.go +++ b/pkg/env/generate.go @@ -6,7 +6,7 @@ package env //go:generate rm -rf ../util/mocks/$GOPACKAGE // Need to use source mode as reflect mode always uses pkg "azcore/internal/exported" -//go:generate sh -c "for file in core env certificateRefresher; do go run ../../vendor/github.com/golang/mock/mockgen -destination=../util/mocks/$GOPACKAGE/${DOLLAR}file.go -source ${DOLLAR}file.go -aux_files github.com/Azure/ARO-RP/pkg/env=core.go,github.com/Azure/ARO-RP/pkg/env=armhelper.go; done" +//go:generate sh -c "for file in core env certificateRefresher; do mockgen -destination=../util/mocks/$GOPACKAGE/${DOLLAR}file.go -source ${DOLLAR}file.go -aux_files github.com/Azure/ARO-RP/pkg/env=core.go,github.com/Azure/ARO-RP/pkg/env=armhelper.go; done" -//go:generate go run ../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/$GOPACKAGE/$GOPACKAGE.go -//go:generate go run ../../vendor/github.com/alvaroloes/enumer -type Feature -output zz_generated_feature_enumer.go +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/$GOPACKAGE/ +//go:generate enumer -type Feature -output zz_generated_feature_enumer.go diff --git a/pkg/frontend/adminactions/generate.go b/pkg/frontend/adminactions/generate.go index 51fbe48cb6a..edbde1f11c7 100644 --- a/pkg/frontend/adminactions/generate.go +++ b/pkg/frontend/adminactions/generate.go @@ -4,5 +4,5 @@ package adminactions // Licensed under the Apache License 2.0. //go:generate rm -rf ../../util/mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/frontend/$GOPACKAGE KubeActions,AzureActions,AppLensActions -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../util/mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/frontend/$GOPACKAGE KubeActions,AzureActions,AppLensActions +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../util/mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/frontend/generate.go b/pkg/frontend/generate.go index fe017c4bd9f..7765d5be3b3 100644 --- a/pkg/frontend/generate.go +++ b/pkg/frontend/generate.go @@ -4,5 +4,5 @@ package frontend // Licensed under the Apache License 2.0. //go:generate rm -rf ../../util/mocks/$GOPACKAGE -//go:generate go run ../../vendor/github.com/golang/mock/mockgen -destination=../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/frontend StreamResponder,QuotaValidator,SkuValidator,ProvidersValidator -//go:generate go run ../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/frontend StreamResponder,QuotaValidator,SkuValidator,ProvidersValidator +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/hive/generate.go b/pkg/hive/generate.go index 4b2102e91ce..19fe4f890ef 100644 --- a/pkg/hive/generate.go +++ b/pkg/hive/generate.go @@ -4,5 +4,5 @@ package hive // Licensed under the Apache License 2.0. //go:generate rm -rf ../util/mocks/$GOPACKAGE -//go:generate go run ../../vendor/github.com/golang/mock/mockgen -destination=../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/$GOPACKAGE ClusterManager -//go:generate go run ../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/$GOPACKAGE ClusterManager +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/metrics/generate.go b/pkg/metrics/generate.go index 75228034917..810e6448c66 100644 --- a/pkg/metrics/generate.go +++ b/pkg/metrics/generate.go @@ -4,5 +4,5 @@ package metrics // Licensed under the Apache License 2.0. //go:generate rm -rf ../util/mocks/$GOPACKAGE -//go:generate go run ../../vendor/github.com/golang/mock/mockgen -destination=../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/$GOPACKAGE Emitter -//go:generate go run ../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/$GOPACKAGE Emitter +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/operator/controllers/rbac/generate.go b/pkg/operator/controllers/rbac/generate.go index a1f928a3483..737b924be45 100644 --- a/pkg/operator/controllers/rbac/generate.go +++ b/pkg/operator/controllers/rbac/generate.go @@ -3,5 +3,5 @@ package rbac // Copyright (c) Microsoft Corporation. // Licensed under the Apache License 2.0. -//go:generate go run ../../../../vendor/github.com/go-bindata/go-bindata/go-bindata -nometadata -pkg $GOPACKAGE -prefix staticresources staticresources/... +//go:generate go-bindata -nometadata -pkg $GOPACKAGE -prefix staticresources staticresources/... //go:generate gofmt -s -l -w bindata.go diff --git a/pkg/operator/controllers/workaround/generate.go b/pkg/operator/controllers/workaround/generate.go index 3b4f869488c..f233da3055d 100644 --- a/pkg/operator/controllers/workaround/generate.go +++ b/pkg/operator/controllers/workaround/generate.go @@ -4,5 +4,5 @@ package workaround // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../util/mocks/operator/controllers/$GOPACKAGE -//go:generate go run ../../../../vendor/github.com/golang/mock/mockgen -destination=../../../util/mocks/operator/controllers/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/operator/controllers/$GOPACKAGE Workaround -//go:generate go run ../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../util/mocks/operator/controllers/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../util/mocks/operator/controllers/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/operator/controllers/$GOPACKAGE Workaround +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../util/mocks/operator/controllers/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/operator/deploy/generate.go b/pkg/operator/deploy/generate.go index 43f129fd6c1..d254301c907 100644 --- a/pkg/operator/deploy/generate.go +++ b/pkg/operator/deploy/generate.go @@ -4,5 +4,5 @@ package deploy // Licensed under the Apache License 2.0. //go:generate rm -rf ../../util/mocks/operator/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../../util/mocks/operator/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/operator/$GOPACKAGE Operator -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../util/mocks/operator/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../util/mocks/operator/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/operator/$GOPACKAGE Operator +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../util/mocks/operator/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/operator/generate.go b/pkg/operator/generate.go index 4ee02572ce0..534c00a6789 100644 --- a/pkg/operator/generate.go +++ b/pkg/operator/generate.go @@ -4,12 +4,12 @@ package operator // Licensed under the Apache License 2.0. // build the Kubernetes objects -//go:generate go run ../../vendor/sigs.k8s.io/controller-tools/cmd/controller-gen object paths=./apis/... -//go:generate go run ../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ./apis +//go:generate controller-gen object paths=./apis/... +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ./apis // build the operator's CRD (based on the apis) // for master deployment -//go:generate go run ../../vendor/sigs.k8s.io/controller-tools/cmd/controller-gen crd paths="./apis/..." output:crd:dir=deploy/staticresources +//go:generate controller-gen crd paths="./apis/..." output:crd:dir=deploy/staticresources // for worker deployment - less privileges as it only runs the internetchecker // rbac (based on in-code tags - search for "+kubebuilder:rbac") -//go:generate go run ../../vendor/sigs.k8s.io/controller-tools/cmd/controller-gen rbac:roleName=aro-operator-worker paths="./controllers/checkers/internetchecker/..." output:dir=deploy/staticresources/worker +//go:generate controller-gen rbac:roleName=aro-operator-worker paths="./controllers/checkers/internetchecker/..." output:dir=deploy/staticresources/worker diff --git a/pkg/portal/cluster/generate.go b/pkg/portal/cluster/generate.go index 954d4af6aa4..b22089f6ab3 100644 --- a/pkg/portal/cluster/generate.go +++ b/pkg/portal/cluster/generate.go @@ -3,5 +3,5 @@ package cluster // Copyright (c) Microsoft Corporation. // Licensed under the Apache License 2.0. -//go:generate go run ../../../vendor/github.com/go-bindata/go-bindata/go-bindata -nometadata -pkg $GOPACKAGE -prefix testdocs testdocs/... +//go:generate go-bindata -nometadata -pkg $GOPACKAGE -prefix testdocs testdocs/... //go:generate gofmt -s -l -w bindata.go diff --git a/pkg/proxy/generate.go b/pkg/proxy/generate.go index f0c60a4ee3a..0fd64414619 100644 --- a/pkg/proxy/generate.go +++ b/pkg/proxy/generate.go @@ -4,5 +4,5 @@ package proxy // Licensed under the Apache License 2.0. //go:generate rm -rf ../util/mocks/$GOPACKAGE -//go:generate go run ../../vendor/github.com/golang/mock/mockgen -destination=../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/$GOPACKAGE Dialer -//go:generate go run ../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/$GOPACKAGE Dialer +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../util/mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azblob/generate.go b/pkg/util/azblob/generate.go index 566bc4d9def..dee2348965e 100644 --- a/pkg/util/azblob/generate.go +++ b/pkg/util/azblob/generate.go @@ -4,5 +4,5 @@ package azblob // Licensed under the Apache License 2.0. //go:generate rm -rf ../mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Manager,AZBlobClient -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Manager,AZBlobClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/authz/remotepdp/generate.go b/pkg/util/azureclient/authz/remotepdp/generate.go index 5fcb806f716..81b4b46d6ee 100644 --- a/pkg/util/azureclient/authz/remotepdp/generate.go +++ b/pkg/util/azureclient/authz/remotepdp/generate.go @@ -4,5 +4,5 @@ package remotepdp // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../../mocks/azureclient/authz/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../mocks/azureclient/authz/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/authz/$GOPACKAGE RemotePDPClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../mocks/azureclient/authz/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../mocks/azureclient/authz/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/authz/$GOPACKAGE RemotePDPClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../mocks/azureclient/authz/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/azuresdk/armdns/generate.go b/pkg/util/azureclient/azuresdk/armdns/generate.go index d5dd32797c8..f5e5ffb92bc 100644 --- a/pkg/util/azureclient/azuresdk/armdns/generate.go +++ b/pkg/util/azureclient/azuresdk/armdns/generate.go @@ -4,5 +4,5 @@ package armdns // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../../pkg/util/mocks/azureclient/azuresdk/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../mocks/azureclient/azuresdk/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/$GOPACKAGE RecordSetsClient,ZonesClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../mocks/azureclient/azuresdk/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../mocks/azureclient/azuresdk/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/$GOPACKAGE RecordSetsClient,ZonesClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../mocks/azureclient/azuresdk/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/azuresdk/armnetwork/generate.go b/pkg/util/azureclient/azuresdk/armnetwork/generate.go index a2029abccb2..186b52a70a6 100644 --- a/pkg/util/azureclient/azuresdk/armnetwork/generate.go +++ b/pkg/util/azureclient/azuresdk/armnetwork/generate.go @@ -4,5 +4,5 @@ package armnetwork // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../util/mocks/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../../util/mocks/azureclient/azuresdk/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/$GOPACKAGE InterfacesClient,LoadBalancersClient,LoadBalancerBackendAddressPoolsClient,PrivateEndpointsClient,PrivateLinkServicesClient,PublicIPAddressesClient,SecurityGroupsClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/azuresdk/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../../util/mocks/azureclient/azuresdk/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/$GOPACKAGE InterfacesClient,LoadBalancersClient,LoadBalancerBackendAddressPoolsClient,PrivateEndpointsClient,PrivateLinkServicesClient,PublicIPAddressesClient,SecurityGroupsClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/azuresdk/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/azuresdk/armstorage/generate.go b/pkg/util/azureclient/azuresdk/armstorage/generate.go index 71f5e3f4f1b..eb82c451089 100644 --- a/pkg/util/azureclient/azuresdk/armstorage/generate.go +++ b/pkg/util/azureclient/azuresdk/armstorage/generate.go @@ -4,5 +4,5 @@ package armstorage // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../util/mocks/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../../util/mocks/azureclient/azuresdk/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/$GOPACKAGE AccountsClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/azuresdk/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../../util/mocks/azureclient/azuresdk/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/$GOPACKAGE AccountsClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/azuresdk/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/azuresdk/azcore/generate.go b/pkg/util/azureclient/azuresdk/azcore/generate.go index 36b94bd829c..30b67c97f56 100644 --- a/pkg/util/azureclient/azuresdk/azcore/generate.go +++ b/pkg/util/azureclient/azuresdk/azcore/generate.go @@ -4,5 +4,5 @@ package azcore // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../../mocks/azureclient/azuresdk/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../mocks/azureclient/azuresdk/$GOPACKAGE/tokencredential.go -source=tokencredential.go -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../mocks/azureclient/azuresdk/$GOPACKAGE/tokencredential.go +//go:generate mockgen -destination=../../../mocks/azureclient/azuresdk/$GOPACKAGE/tokencredential.go -source=tokencredential.go +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../mocks/azureclient/azuresdk/$GOPACKAGE/tokencredential.go diff --git a/pkg/util/azureclient/keyvault/generate.go b/pkg/util/azureclient/keyvault/generate.go index 4344e554a1d..1c39fae880a 100644 --- a/pkg/util/azureclient/keyvault/generate.go +++ b/pkg/util/azureclient/keyvault/generate.go @@ -4,5 +4,5 @@ package keyvault // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../util/mocks/azureclient/$GOPACKAGE -//go:generate go run ../../../../vendor/github.com/golang/mock/mockgen -destination=../../../util/mocks/azureclient/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/$GOPACKAGE BaseClient -//go:generate go run ../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../util/mocks/azureclient/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../util/mocks/azureclient/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/$GOPACKAGE BaseClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../util/mocks/azureclient/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/mgmt/authorization/generate.go b/pkg/util/azureclient/mgmt/authorization/generate.go index d894dcbfadc..0b85d47dc66 100644 --- a/pkg/util/azureclient/mgmt/authorization/generate.go +++ b/pkg/util/azureclient/mgmt/authorization/generate.go @@ -4,5 +4,5 @@ package authorization // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../util/mocks/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE RoleAssignmentsClient,DenyAssignmentClient,RoleDefinitionsClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE RoleAssignmentsClient,DenyAssignmentClient,RoleDefinitionsClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/mgmt/compute/generate.go b/pkg/util/azureclient/mgmt/compute/generate.go index bb429a7da01..78915cab6a6 100644 --- a/pkg/util/azureclient/mgmt/compute/generate.go +++ b/pkg/util/azureclient/mgmt/compute/generate.go @@ -4,5 +4,5 @@ package compute // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../util/mocks/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE DisksClient,ResourceSkusClient,VirtualMachinesClient,UsageClient,VirtualMachineScaleSetVMsClient,VirtualMachineScaleSetsClient,DiskEncryptionSetsClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE DisksClient,ResourceSkusClient,VirtualMachinesClient,UsageClient,VirtualMachineScaleSetVMsClient,VirtualMachineScaleSetsClient,DiskEncryptionSetsClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/mgmt/containerregistry/generate.go b/pkg/util/azureclient/mgmt/containerregistry/generate.go index 326920a46bf..c262057d444 100644 --- a/pkg/util/azureclient/mgmt/containerregistry/generate.go +++ b/pkg/util/azureclient/mgmt/containerregistry/generate.go @@ -4,5 +4,5 @@ package containerregistry // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../util/mocks/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE TokensClient,RegistriesClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE TokensClient,RegistriesClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/mgmt/containerservice/generate.go b/pkg/util/azureclient/mgmt/containerservice/generate.go index 8dd9ed4dd06..4591da640ba 100644 --- a/pkg/util/azureclient/mgmt/containerservice/generate.go +++ b/pkg/util/azureclient/mgmt/containerservice/generate.go @@ -4,5 +4,5 @@ package containerservice // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../util/mocks/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE ManagedClustersClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE ManagedClustersClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/mgmt/dns/generate.go b/pkg/util/azureclient/mgmt/dns/generate.go index 9618eef583d..b9f58b74633 100644 --- a/pkg/util/azureclient/mgmt/dns/generate.go +++ b/pkg/util/azureclient/mgmt/dns/generate.go @@ -4,5 +4,5 @@ package dns // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../util/mocks/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE RecordSetsClient,ZonesClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE RecordSetsClient,ZonesClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/mgmt/features/generate.go b/pkg/util/azureclient/mgmt/features/generate.go index d6270d592a7..17a5d4b4c60 100644 --- a/pkg/util/azureclient/mgmt/features/generate.go +++ b/pkg/util/azureclient/mgmt/features/generate.go @@ -4,5 +4,5 @@ package features // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../util/mocks/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE DeploymentsClient,ProvidersClient,ResourceGroupsClient,ResourcesClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE DeploymentsClient,ProvidersClient,ResourceGroupsClient,ResourcesClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/mgmt/msi/generate.go b/pkg/util/azureclient/mgmt/msi/generate.go index f472fe1efcd..f9ec6b60fff 100644 --- a/pkg/util/azureclient/mgmt/msi/generate.go +++ b/pkg/util/azureclient/mgmt/msi/generate.go @@ -4,5 +4,5 @@ package msi // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../util/mocks/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE UserAssignedIdentitiesClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE UserAssignedIdentitiesClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/mgmt/network/generate.go b/pkg/util/azureclient/mgmt/network/generate.go index 7125831d5d1..8d281bd9714 100644 --- a/pkg/util/azureclient/mgmt/network/generate.go +++ b/pkg/util/azureclient/mgmt/network/generate.go @@ -4,5 +4,5 @@ package network // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../util/mocks/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE InterfacesClient,LoadBalancersClient,PrivateEndpointsClient,PrivateLinkServicesClient,PublicIPAddressesClient,LoadBalancerBackendAddressPoolsClient,RouteTablesClient,SubnetsClient,VirtualNetworksClient,SecurityGroupsClient,VirtualNetworkPeeringsClient,UsageClient,FlowLogsClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE InterfacesClient,LoadBalancersClient,PrivateEndpointsClient,PrivateLinkServicesClient,PublicIPAddressesClient,LoadBalancerBackendAddressPoolsClient,RouteTablesClient,SubnetsClient,VirtualNetworksClient,SecurityGroupsClient,VirtualNetworkPeeringsClient,UsageClient,FlowLogsClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/mgmt/privatedns/generate.go b/pkg/util/azureclient/mgmt/privatedns/generate.go index 62999e60227..4e28049702b 100644 --- a/pkg/util/azureclient/mgmt/privatedns/generate.go +++ b/pkg/util/azureclient/mgmt/privatedns/generate.go @@ -4,5 +4,5 @@ package privatedns // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../util/mocks/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE PrivateZonesClient,VirtualNetworkLinksClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE PrivateZonesClient,VirtualNetworkLinksClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/azureclient/mgmt/storage/generate.go b/pkg/util/azureclient/mgmt/storage/generate.go index 89cd32bdcb6..c69bfa4bd9f 100644 --- a/pkg/util/azureclient/mgmt/storage/generate.go +++ b/pkg/util/azureclient/mgmt/storage/generate.go @@ -4,5 +4,5 @@ package storage // Licensed under the Apache License 2.0. //go:generate rm -rf ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE -//go:generate go run ../../../../../vendor/github.com/golang/mock/mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE AccountsClient -//go:generate go run ../../../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/$GOPACKAGE AccountsClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../../util/mocks/azureclient/mgmt/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/billing/generate.go b/pkg/util/billing/generate.go index 9f6ff5dea3c..3e2c7533263 100644 --- a/pkg/util/billing/generate.go +++ b/pkg/util/billing/generate.go @@ -4,5 +4,5 @@ package billing // Licensed under the Apache License 2.0. //go:generate rm -rf ../../util/mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Manager -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../util/mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Manager +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../util/mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/clusterdata/generate.go b/pkg/util/clusterdata/generate.go index 10537296d78..9006c151a10 100644 --- a/pkg/util/clusterdata/generate.go +++ b/pkg/util/clusterdata/generate.go @@ -3,5 +3,5 @@ package clusterdata // Copyright (c) Microsoft Corporation. // Licensed under the Apache License 2.0. -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE ClusterEnricher,BestEffortEnricher -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE ClusterEnricher,BestEffortEnricher +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/deployer/generate.go b/pkg/util/deployer/generate.go index d83f7b25d15..044a7156326 100644 --- a/pkg/util/deployer/generate.go +++ b/pkg/util/deployer/generate.go @@ -3,5 +3,5 @@ package deployer // Copyright (c) Microsoft Corporation. // Licensed under the Apache License 2.0. -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Deployer -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Deployer +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/dns/generate.go b/pkg/util/dns/generate.go index ac1cde51fbb..d95688b618f 100644 --- a/pkg/util/dns/generate.go +++ b/pkg/util/dns/generate.go @@ -4,5 +4,5 @@ package dns // Licensed under the Apache License 2.0. //go:generate rm -rf ../mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Manager -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Manager +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/dynamichelper/generate.go b/pkg/util/dynamichelper/generate.go index bab62d1ec2f..693bd222349 100644 --- a/pkg/util/dynamichelper/generate.go +++ b/pkg/util/dynamichelper/generate.go @@ -4,5 +4,5 @@ package dynamichelper // Licensed under the Apache License 2.0. //go:generate rm -rf ../mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Interface -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Interface +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/encryption/generate.go b/pkg/util/encryption/generate.go index 4aed7da4843..a1acc67c98f 100644 --- a/pkg/util/encryption/generate.go +++ b/pkg/util/encryption/generate.go @@ -4,5 +4,5 @@ package encryption // Licensed under the Apache License 2.0. //go:generate rm -rf ../mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE AEAD -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE AEAD +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/instancemetadata/generate.go b/pkg/util/instancemetadata/generate.go index 471680826da..4acc3bf2609 100644 --- a/pkg/util/instancemetadata/generate.go +++ b/pkg/util/instancemetadata/generate.go @@ -4,5 +4,5 @@ package instancemetadata // Licensed under the Apache License 2.0. //go:generate rm -rf ../mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE InstanceMetadata -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE InstanceMetadata +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/keyvault/generate.go b/pkg/util/keyvault/generate.go index c52b4949996..8f8a748834b 100644 --- a/pkg/util/keyvault/generate.go +++ b/pkg/util/keyvault/generate.go @@ -4,5 +4,5 @@ package keyvault // Licensed under the Apache License 2.0. //go:generate rm -rf ../mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Manager -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Manager +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/mocks/env/core.go b/pkg/util/mocks/env/core.go index c32f4cdbc6c..2ecb7a88fd9 100644 --- a/pkg/util/mocks/env/core.go +++ b/pkg/util/mocks/env/core.go @@ -8,12 +8,13 @@ import ( context "context" reflect "reflect" - azureclient "github.com/Azure/ARO-RP/pkg/util/azureclient" - liveconfig "github.com/Azure/ARO-RP/pkg/util/liveconfig" azcore "github.com/Azure/azure-sdk-for-go/sdk/azcore" autorest "github.com/Azure/go-autorest/autorest" gomock "github.com/golang/mock/gomock" logrus "github.com/sirupsen/logrus" + + azureclient "github.com/Azure/ARO-RP/pkg/util/azureclient" + liveconfig "github.com/Azure/ARO-RP/pkg/util/liveconfig" ) // MockCore is a mock of Core interface. diff --git a/pkg/util/net/generate.go b/pkg/util/net/generate.go index 68d62f45635..dbf1a14aeeb 100644 --- a/pkg/util/net/generate.go +++ b/pkg/util/net/generate.go @@ -4,5 +4,5 @@ package net // Licensed under the Apache License 2.0. //go:generate rm -rf ../../util/mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../../../pkg/util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE DNSIClient -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../pkg/util/mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../pkg/util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE DNSIClient +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../pkg/util/mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/storage/generate.go b/pkg/util/storage/generate.go index 5049a5a6621..0f993a67f7e 100644 --- a/pkg/util/storage/generate.go +++ b/pkg/util/storage/generate.go @@ -4,5 +4,5 @@ package storage // Licensed under the Apache License 2.0. //go:generate rm -rf ../mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE BlobStorageClient,Manager -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE BlobStorageClient,Manager +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/util/subnet/generate.go b/pkg/util/subnet/generate.go index c1515e153c6..eab6ff1e8e5 100644 --- a/pkg/util/subnet/generate.go +++ b/pkg/util/subnet/generate.go @@ -4,5 +4,5 @@ package subnet // Licensed under the Apache License 2.0. //go:generate rm -rf ../mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Manager,KubeManager -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/util/$GOPACKAGE Manager,KubeManager +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../mocks/$GOPACKAGE/$GOPACKAGE.go diff --git a/pkg/validate/dynamic/generate.go b/pkg/validate/dynamic/generate.go index 4c439040fe9..9626a6c3efe 100644 --- a/pkg/validate/dynamic/generate.go +++ b/pkg/validate/dynamic/generate.go @@ -8,5 +8,5 @@ package dynamic // See https://github.com/golang/mock/issues/244 //go:generate rm -rf ../../../pkg/util/mocks/$GOPACKAGE -//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../../../pkg/util/mocks/$GOPACKAGE/$GOPACKAGE.go -source=dynamic.go -//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../../pkg/util/mocks/$GOPACKAGE/$GOPACKAGE.go +//go:generate mockgen -destination=../../../pkg/util/mocks/$GOPACKAGE/$GOPACKAGE.go -source=dynamic.go +//go:generate goimports -local=github.com/Azure/ARO-RP -e -w ../../../pkg/util/mocks/$GOPACKAGE/$GOPACKAGE.go From 367a3f935159aa1a2a7468aaf254d982b5d3fb5a Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Thu, 5 Sep 2024 10:59:37 +1000 Subject: [PATCH 2/3] go mod vendor --- .../github.com/alvaroloes/enumer/.gitignore | 28 - vendor/github.com/alvaroloes/enumer/LICENSE | 26 - vendor/github.com/alvaroloes/enumer/README.md | 147 -- vendor/github.com/alvaroloes/enumer/enumer.go | 157 -- vendor/github.com/alvaroloes/enumer/sql.go | 40 - .../github.com/alvaroloes/enumer/stringer.go | 738 ------- vendor/github.com/fatih/color/LICENSE.md | 20 - vendor/github.com/fatih/color/README.md | 176 -- vendor/github.com/fatih/color/color.go | 616 ------ .../github.com/fatih/color/color_windows.go | 19 - vendor/github.com/fatih/color/doc.go | 134 -- .../go-bindata/go-bindata/.gitignore | 16 - .../go-bindata/go-bindata/CONTRIBUTING.md | 79 - .../github.com/go-bindata/go-bindata/LICENSE | 3 - .../github.com/go-bindata/go-bindata/Makefile | 2 - .../go-bindata/go-bindata/README.md | 199 -- .../go-bindata/go-bindata/_config.yml | 1 - .../github.com/go-bindata/go-bindata/asset.go | 12 - .../go-bindata/go-bindata/bytewriter.go | 44 - .../go-bindata/go-bindata/config.go | 208 -- .../go-bindata/go-bindata/convert.go | 261 --- .../github.com/go-bindata/go-bindata/debug.go | 108 - .../github.com/go-bindata/go-bindata/doc.go | 129 -- .../github.com/go-bindata/go-bindata/file.go | 102 - .../go-bindata/go-bindata/.gitignore | 1 - .../go-bindata/go-bindata/AppendSliceValue.go | 22 - .../go-bindata/go-bindata/go-bindata/main.go | 108 - .../go-bindata/go-bindata/version.go | 31 - .../go-bindata/go-bindata/release.go | 473 ----- .../go-bindata/go-bindata/restore.go | 62 - .../go-bindata/go-bindata/stringwriter.go | 36 - .../github.com/go-bindata/go-bindata/toc.go | 288 --- vendor/github.com/gobuffalo/flect/.gitignore | 29 - .../gobuffalo/flect/.gometalinter.json | 3 - vendor/github.com/gobuffalo/flect/LICENSE | 21 - vendor/github.com/gobuffalo/flect/Makefile | 61 - vendor/github.com/gobuffalo/flect/README.md | 36 - .../github.com/gobuffalo/flect/SHOULDERS.md | 10 - vendor/github.com/gobuffalo/flect/acronyms.go | 152 -- vendor/github.com/gobuffalo/flect/camelize.go | 44 - .../github.com/gobuffalo/flect/capitalize.go | 24 - .../github.com/gobuffalo/flect/custom_data.go | 83 - .../github.com/gobuffalo/flect/dasherize.go | 34 - vendor/github.com/gobuffalo/flect/flect.go | 43 - vendor/github.com/gobuffalo/flect/humanize.go | 35 - vendor/github.com/gobuffalo/flect/ident.go | 122 -- .../github.com/gobuffalo/flect/lower_upper.go | 13 - .../github.com/gobuffalo/flect/ordinalize.go | 43 - .../github.com/gobuffalo/flect/pascalize.go | 32 - .../gobuffalo/flect/plural_rules.go | 287 --- .../github.com/gobuffalo/flect/pluralize.go | 59 - vendor/github.com/gobuffalo/flect/rule.go | 10 - .../gobuffalo/flect/singular_rules.go | 23 - .../github.com/gobuffalo/flect/singularize.go | 57 - vendor/github.com/gobuffalo/flect/titleize.go | 30 - .../github.com/gobuffalo/flect/underscore.go | 35 - vendor/github.com/gobuffalo/flect/version.go | 4 - .../github.com/golang/mock/mockgen/mockgen.go | 701 ------ .../github.com/golang/mock/mockgen/parse.go | 644 ------ .../github.com/golang/mock/mockgen/reflect.go | 256 --- .../golang/mock/mockgen/version.1.11.go | 26 - .../golang/mock/mockgen/version.1.12.go | 35 - vendor/github.com/jewzaam/go-cosmosdb/LICENSE | 202 -- .../cmd/gencosmosdb/gencosmosdb.go | 96 - .../go-cosmosdb/pkg/gencosmosdb/bindata.go | 451 ---- .../go-cosmosdb/pkg/gencosmosdb/generate.go | 3 - vendor/github.com/mattn/go-colorable/LICENSE | 21 - .../github.com/mattn/go-colorable/README.md | 48 - .../mattn/go-colorable/colorable_appengine.go | 38 - .../mattn/go-colorable/colorable_others.go | 38 - .../mattn/go-colorable/colorable_windows.go | 1047 --------- .../github.com/mattn/go-colorable/go.test.sh | 12 - .../mattn/go-colorable/noncolorable.go | 57 - .../github.com/pascaldekloe/name/.travis.yml | 1 - vendor/github.com/pascaldekloe/name/LICENSE | 5 - vendor/github.com/pascaldekloe/name/README.md | 18 - vendor/github.com/pascaldekloe/name/case.go | 115 - .../x/mod/internal/lazyregexp/lazyre.go | 78 - vendor/golang.org/x/mod/modfile/print.go | 184 -- vendor/golang.org/x/mod/modfile/read.go | 958 --------- vendor/golang.org/x/mod/modfile/rule.go | 1666 --------------- vendor/golang.org/x/mod/modfile/work.go | 285 --- vendor/golang.org/x/mod/module/module.go | 841 -------- vendor/golang.org/x/mod/module/pseudo.go | 250 --- .../golang.org/x/tools/cmd/goimports/doc.go | 50 - .../x/tools/cmd/goimports/goimports.go | 379 ---- .../x/tools/cmd/goimports/goimports_gc.go | 27 - .../x/tools/cmd/goimports/goimports_not_gc.go | 12 - vendor/golang.org/x/tools/imports/forward.go | 77 - .../x/tools/internal/gopathwalk/walk.go | 337 --- .../x/tools/internal/imports/fix.go | 1892 ----------------- .../x/tools/internal/imports/imports.go | 354 --- .../x/tools/internal/imports/mod.go | 841 -------- .../x/tools/internal/imports/mod_cache.go | 331 --- .../x/tools/internal/imports/sortimports.go | 297 --- vendor/k8s.io/code-generator/LICENSE | 202 -- .../code-generator/cmd/client-gen/OWNERS | 10 - .../code-generator/cmd/client-gen/README.md | 2 - .../cmd/client-gen/args/args.go | 133 -- .../cmd/client-gen/args/gvpackages.go | 173 -- .../cmd/client-gen/args/gvtype.go | 110 - .../client-gen/generators/client_generator.go | 403 ---- .../generators/fake/fake_client_generator.go | 131 -- .../fake/generator_fake_for_clientset.go | 170 -- .../fake/generator_fake_for_group.go | 130 -- .../fake/generator_fake_for_type.go | 589 ----- .../generators/generator_for_clientset.go | 210 -- .../generators/generator_for_expansion.go | 54 - .../generators/generator_for_group.go | 267 --- .../generators/generator_for_type.go | 760 ------- .../generators/scheme/generator_for_scheme.go | 187 -- .../client-gen/generators/util/gvpackages.go | 30 - .../cmd/client-gen/generators/util/tags.go | 344 --- .../code-generator/cmd/client-gen/main.go | 64 - .../cmd/client-gen/path/path.go | 31 - .../cmd/client-gen/types/helpers.go | 121 -- .../cmd/client-gen/types/types.go | 97 - .../code-generator/pkg/namer/tag-override.go | 58 - .../k8s.io/code-generator/pkg/util/build.go | 99 - .../pkg/util/plural_exceptions.go | 37 - vendor/k8s.io/gengo/LICENSE | 202 -- vendor/k8s.io/gengo/args/args.go | 218 -- .../gengo/generator/default_generator.go | 62 - .../k8s.io/gengo/generator/default_package.go | 75 - vendor/k8s.io/gengo/generator/doc.go | 31 - .../k8s.io/gengo/generator/error_tracker.go | 50 - vendor/k8s.io/gengo/generator/execute.go | 329 --- vendor/k8s.io/gengo/generator/generator.go | 259 --- .../k8s.io/gengo/generator/import_tracker.go | 70 - .../k8s.io/gengo/generator/snippet_writer.go | 154 -- .../gengo/generator/transitive_closure.go | 65 - vendor/k8s.io/gengo/namer/doc.go | 31 - vendor/k8s.io/gengo/namer/import_tracker.go | 112 - vendor/k8s.io/gengo/namer/namer.go | 394 ---- vendor/k8s.io/gengo/namer/order.go | 72 - vendor/k8s.io/gengo/namer/plural_namer.go | 120 -- vendor/k8s.io/gengo/parser/doc.go | 19 - vendor/k8s.io/gengo/parser/parse.go | 924 -------- vendor/k8s.io/gengo/types/comments.go | 82 - vendor/k8s.io/gengo/types/doc.go | 19 - vendor/k8s.io/gengo/types/flatten.go | 57 - vendor/k8s.io/gengo/types/types.go | 537 ----- vendor/modules.txt | 67 - vendor/sigs.k8s.io/controller-tools/LICENSE | 201 -- .../cmd/controller-gen/main.go | 263 --- .../controller-tools/pkg/crd/conv.go | 43 - .../controller-tools/pkg/crd/desc_visitor.go | 78 - .../controller-tools/pkg/crd/doc.go | 63 - .../controller-tools/pkg/crd/flatten.go | 441 ---- .../controller-tools/pkg/crd/gen.go | 293 --- .../controller-tools/pkg/crd/known_types.go | 179 -- .../controller-tools/pkg/crd/markers/crd.go | 347 --- .../controller-tools/pkg/crd/markers/doc.go | 46 - .../pkg/crd/markers/package.go | 40 - .../pkg/crd/markers/register.go | 83 - .../pkg/crd/markers/topology.go | 155 -- .../pkg/crd/markers/validation.go | 495 ----- .../crd/markers/zz_generated.markerhelp.go | 489 ----- .../controller-tools/pkg/crd/parser.go | 243 --- .../controller-tools/pkg/crd/schema.go | 464 ---- .../pkg/crd/schema_visitor.go | 131 -- .../controller-tools/pkg/crd/spec.go | 168 -- .../pkg/crd/zz_generated.markerhelp.go | 58 - .../controller-tools/pkg/deepcopy/doc.go | 23 - .../controller-tools/pkg/deepcopy/gen.go | 305 --- .../controller-tools/pkg/deepcopy/traverse.go | 829 -------- .../pkg/deepcopy/zz_generated.markerhelp.go | 46 - .../controller-tools/pkg/genall/doc.go | 58 - .../controller-tools/pkg/genall/genall.go | 269 --- .../controller-tools/pkg/genall/help/doc.go | 23 - .../pkg/genall/help/pretty/doc.go | 30 - .../pkg/genall/help/pretty/help.go | 171 -- .../pkg/genall/help/pretty/print.go | 304 --- .../pkg/genall/help/pretty/table.go | 64 - .../controller-tools/pkg/genall/help/sort.go | 106 - .../controller-tools/pkg/genall/help/types.go | 215 -- .../controller-tools/pkg/genall/input.go | 37 - .../controller-tools/pkg/genall/options.go | 192 -- .../controller-tools/pkg/genall/output.go | 160 -- .../pkg/genall/zz_generated.markerhelp.go | 90 - .../controller-tools/pkg/loader/doc.go | 60 - .../controller-tools/pkg/loader/errors.go | 67 - .../controller-tools/pkg/loader/loader.go | 592 ------ .../controller-tools/pkg/loader/paths.go | 32 - .../controller-tools/pkg/loader/refs.go | 273 --- .../controller-tools/pkg/loader/visit.go | 81 - .../controller-tools/pkg/markers/collect.go | 422 ---- .../controller-tools/pkg/markers/doc.go | 113 - .../controller-tools/pkg/markers/help.go | 81 - .../controller-tools/pkg/markers/parse.go | 963 --------- .../controller-tools/pkg/markers/reg.go | 153 -- .../controller-tools/pkg/markers/regutil.go | 36 - .../controller-tools/pkg/markers/zip.go | 201 -- .../controller-tools/pkg/rbac/parser.go | 267 --- .../pkg/rbac/zz_generated.markerhelp.go | 78 - .../controller-tools/pkg/schemapatcher/gen.go | 429 ---- .../schemapatcher/internal/yaml/convert.go | 61 - .../pkg/schemapatcher/internal/yaml/nested.go | 87 - .../pkg/schemapatcher/internal/yaml/set.go | 80 - .../schemapatcher/zz_generated.markerhelp.go | 50 - .../controller-tools/pkg/version/version.go | 49 - .../controller-tools/pkg/webhook/parser.go | 408 ---- .../pkg/webhook/zz_generated.markerhelp.go | 97 - 203 files changed, 38492 deletions(-) delete mode 100644 vendor/github.com/alvaroloes/enumer/.gitignore delete mode 100644 vendor/github.com/alvaroloes/enumer/LICENSE delete mode 100644 vendor/github.com/alvaroloes/enumer/README.md delete mode 100644 vendor/github.com/alvaroloes/enumer/enumer.go delete mode 100644 vendor/github.com/alvaroloes/enumer/sql.go delete mode 100644 vendor/github.com/alvaroloes/enumer/stringer.go delete mode 100644 vendor/github.com/fatih/color/LICENSE.md delete mode 100644 vendor/github.com/fatih/color/README.md delete mode 100644 vendor/github.com/fatih/color/color.go delete mode 100644 vendor/github.com/fatih/color/color_windows.go delete mode 100644 vendor/github.com/fatih/color/doc.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/.gitignore delete mode 100644 vendor/github.com/go-bindata/go-bindata/CONTRIBUTING.md delete mode 100644 vendor/github.com/go-bindata/go-bindata/LICENSE delete mode 100644 vendor/github.com/go-bindata/go-bindata/Makefile delete mode 100644 vendor/github.com/go-bindata/go-bindata/README.md delete mode 100644 vendor/github.com/go-bindata/go-bindata/_config.yml delete mode 100644 vendor/github.com/go-bindata/go-bindata/asset.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/bytewriter.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/config.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/convert.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/debug.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/doc.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/file.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/go-bindata/.gitignore delete mode 100644 vendor/github.com/go-bindata/go-bindata/go-bindata/AppendSliceValue.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/go-bindata/main.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/go-bindata/version.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/release.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/restore.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/stringwriter.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/toc.go delete mode 100644 vendor/github.com/gobuffalo/flect/.gitignore delete mode 100644 vendor/github.com/gobuffalo/flect/.gometalinter.json delete mode 100644 vendor/github.com/gobuffalo/flect/LICENSE delete mode 100644 vendor/github.com/gobuffalo/flect/Makefile delete mode 100644 vendor/github.com/gobuffalo/flect/README.md delete mode 100644 vendor/github.com/gobuffalo/flect/SHOULDERS.md delete mode 100644 vendor/github.com/gobuffalo/flect/acronyms.go delete mode 100644 vendor/github.com/gobuffalo/flect/camelize.go delete mode 100644 vendor/github.com/gobuffalo/flect/capitalize.go delete mode 100644 vendor/github.com/gobuffalo/flect/custom_data.go delete mode 100644 vendor/github.com/gobuffalo/flect/dasherize.go delete mode 100644 vendor/github.com/gobuffalo/flect/flect.go delete mode 100644 vendor/github.com/gobuffalo/flect/humanize.go delete mode 100644 vendor/github.com/gobuffalo/flect/ident.go delete mode 100644 vendor/github.com/gobuffalo/flect/lower_upper.go delete mode 100644 vendor/github.com/gobuffalo/flect/ordinalize.go delete mode 100644 vendor/github.com/gobuffalo/flect/pascalize.go delete mode 100644 vendor/github.com/gobuffalo/flect/plural_rules.go delete mode 100644 vendor/github.com/gobuffalo/flect/pluralize.go delete mode 100644 vendor/github.com/gobuffalo/flect/rule.go delete mode 100644 vendor/github.com/gobuffalo/flect/singular_rules.go delete mode 100644 vendor/github.com/gobuffalo/flect/singularize.go delete mode 100644 vendor/github.com/gobuffalo/flect/titleize.go delete mode 100644 vendor/github.com/gobuffalo/flect/underscore.go delete mode 100644 vendor/github.com/gobuffalo/flect/version.go delete mode 100644 vendor/github.com/golang/mock/mockgen/mockgen.go delete mode 100644 vendor/github.com/golang/mock/mockgen/parse.go delete mode 100644 vendor/github.com/golang/mock/mockgen/reflect.go delete mode 100644 vendor/github.com/golang/mock/mockgen/version.1.11.go delete mode 100644 vendor/github.com/golang/mock/mockgen/version.1.12.go delete mode 100644 vendor/github.com/jewzaam/go-cosmosdb/LICENSE delete mode 100644 vendor/github.com/jewzaam/go-cosmosdb/cmd/gencosmosdb/gencosmosdb.go delete mode 100644 vendor/github.com/jewzaam/go-cosmosdb/pkg/gencosmosdb/bindata.go delete mode 100644 vendor/github.com/jewzaam/go-cosmosdb/pkg/gencosmosdb/generate.go delete mode 100644 vendor/github.com/mattn/go-colorable/LICENSE delete mode 100644 vendor/github.com/mattn/go-colorable/README.md delete mode 100644 vendor/github.com/mattn/go-colorable/colorable_appengine.go delete mode 100644 vendor/github.com/mattn/go-colorable/colorable_others.go delete mode 100644 vendor/github.com/mattn/go-colorable/colorable_windows.go delete mode 100644 vendor/github.com/mattn/go-colorable/go.test.sh delete mode 100644 vendor/github.com/mattn/go-colorable/noncolorable.go delete mode 100644 vendor/github.com/pascaldekloe/name/.travis.yml delete mode 100644 vendor/github.com/pascaldekloe/name/LICENSE delete mode 100644 vendor/github.com/pascaldekloe/name/README.md delete mode 100644 vendor/github.com/pascaldekloe/name/case.go delete mode 100644 vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go delete mode 100644 vendor/golang.org/x/mod/modfile/print.go delete mode 100644 vendor/golang.org/x/mod/modfile/read.go delete mode 100644 vendor/golang.org/x/mod/modfile/rule.go delete mode 100644 vendor/golang.org/x/mod/modfile/work.go delete mode 100644 vendor/golang.org/x/mod/module/module.go delete mode 100644 vendor/golang.org/x/mod/module/pseudo.go delete mode 100644 vendor/golang.org/x/tools/cmd/goimports/doc.go delete mode 100644 vendor/golang.org/x/tools/cmd/goimports/goimports.go delete mode 100644 vendor/golang.org/x/tools/cmd/goimports/goimports_gc.go delete mode 100644 vendor/golang.org/x/tools/cmd/goimports/goimports_not_gc.go delete mode 100644 vendor/golang.org/x/tools/imports/forward.go delete mode 100644 vendor/golang.org/x/tools/internal/gopathwalk/walk.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/fix.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/imports.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/mod.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/mod_cache.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/sortimports.go delete mode 100644 vendor/k8s.io/code-generator/LICENSE delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/OWNERS delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/README.md delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/args/args.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/args/gvpackages.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/args/gvtype.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/fake_client_generator.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_clientset.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_group.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_type.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_clientset.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_expansion.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_group.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_type.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/generators/scheme/generator_for_scheme.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/generators/util/gvpackages.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/generators/util/tags.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/main.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/path/path.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/types/helpers.go delete mode 100644 vendor/k8s.io/code-generator/cmd/client-gen/types/types.go delete mode 100644 vendor/k8s.io/code-generator/pkg/namer/tag-override.go delete mode 100644 vendor/k8s.io/code-generator/pkg/util/build.go delete mode 100644 vendor/k8s.io/code-generator/pkg/util/plural_exceptions.go delete mode 100644 vendor/k8s.io/gengo/LICENSE delete mode 100644 vendor/k8s.io/gengo/args/args.go delete mode 100644 vendor/k8s.io/gengo/generator/default_generator.go delete mode 100644 vendor/k8s.io/gengo/generator/default_package.go delete mode 100644 vendor/k8s.io/gengo/generator/doc.go delete mode 100644 vendor/k8s.io/gengo/generator/error_tracker.go delete mode 100644 vendor/k8s.io/gengo/generator/execute.go delete mode 100644 vendor/k8s.io/gengo/generator/generator.go delete mode 100644 vendor/k8s.io/gengo/generator/import_tracker.go delete mode 100644 vendor/k8s.io/gengo/generator/snippet_writer.go delete mode 100644 vendor/k8s.io/gengo/generator/transitive_closure.go delete mode 100644 vendor/k8s.io/gengo/namer/doc.go delete mode 100644 vendor/k8s.io/gengo/namer/import_tracker.go delete mode 100644 vendor/k8s.io/gengo/namer/namer.go delete mode 100644 vendor/k8s.io/gengo/namer/order.go delete mode 100644 vendor/k8s.io/gengo/namer/plural_namer.go delete mode 100644 vendor/k8s.io/gengo/parser/doc.go delete mode 100644 vendor/k8s.io/gengo/parser/parse.go delete mode 100644 vendor/k8s.io/gengo/types/comments.go delete mode 100644 vendor/k8s.io/gengo/types/doc.go delete mode 100644 vendor/k8s.io/gengo/types/flatten.go delete mode 100644 vendor/k8s.io/gengo/types/types.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/LICENSE delete mode 100644 vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/conv.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/desc_visitor.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/doc.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/flatten.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/gen.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/known_types.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/crd.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/doc.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/package.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/register.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/topology.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/validation.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/zz_generated.markerhelp.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/parser.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/schema.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/schema_visitor.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/spec.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/crd/zz_generated.markerhelp.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/doc.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/gen.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/traverse.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/zz_generated.markerhelp.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/genall/doc.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/genall/genall.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/genall/help/doc.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/doc.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/help.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/print.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/table.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/genall/help/sort.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/genall/help/types.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/genall/input.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/genall/options.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/genall/output.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/genall/zz_generated.markerhelp.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/loader/doc.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/loader/errors.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/loader/loader.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/loader/paths.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/loader/refs.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/loader/visit.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/markers/collect.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/markers/doc.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/markers/help.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/markers/parse.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/markers/reg.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/markers/regutil.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/markers/zip.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/rbac/parser.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/rbac/zz_generated.markerhelp.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/gen.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml/convert.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml/nested.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml/set.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/zz_generated.markerhelp.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/version/version.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/webhook/parser.go delete mode 100644 vendor/sigs.k8s.io/controller-tools/pkg/webhook/zz_generated.markerhelp.go diff --git a/vendor/github.com/alvaroloes/enumer/.gitignore b/vendor/github.com/alvaroloes/enumer/.gitignore deleted file mode 100644 index 99f7832d45a..00000000000 --- a/vendor/github.com/alvaroloes/enumer/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -# Created by .ignore support plugin (hsz.mobi) -### Go template -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof - -.idea diff --git a/vendor/github.com/alvaroloes/enumer/LICENSE b/vendor/github.com/alvaroloes/enumer/LICENSE deleted file mode 100644 index 96e32476cdc..00000000000 --- a/vendor/github.com/alvaroloes/enumer/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2018, Álvaro López Espinosa -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those -of the authors and should not be interpreted as representing official policies, -either expressed or implied, of the FreeBSD Project. \ No newline at end of file diff --git a/vendor/github.com/alvaroloes/enumer/README.md b/vendor/github.com/alvaroloes/enumer/README.md deleted file mode 100644 index 5fb0434ca33..00000000000 --- a/vendor/github.com/alvaroloes/enumer/README.md +++ /dev/null @@ -1,147 +0,0 @@ -# Enumer [![GoDoc](https://godoc.org/github.com/alvaroloes/enumer?status.svg)](https://godoc.org/github.com/alvaroloes/enumer) [![Go Report Card](https://goreportcard.com/badge/github.com/alvaroloes/enumer)](https://goreportcard.com/report/github.com/alvaroloes/enumer) [![cover.run go](https://cover.run/go/github.com/alvaroloes/enumer.svg?tag=golang-1.10)](https://cover.run/go/github.com/alvaroloes/enumer?tag=golang-1.10) -Enumer is a tool to generate Go code that adds useful methods to Go enums (constants with a specific type). -It started as a fork of [Rob Pike’s Stringer tool](https://godoc.org/golang.org/x/tools/cmd/stringer). - -# Install - -``` -go get github.com/alvaroloes/enumer -``` - -## Generated functions and methods -When Enumer is applied to a type, it will generate: - -* The following basic methods/functions: - - * Method `String()`: returns the string representation of the enum value. This makes the enum conform -the `Stringer` interface, so whenever you print an enum value, you'll get the string name instead of a number. - * Function `String(s string)`: returns the enum value from its string representation. This is useful -when you need to read enum values from command line arguments, from a configuration file, or -from a REST API request... In short, from those places where using the real enum value (an integer) would -be almost meaningless or hard to trace or use by a human. - * Function `Values()`: returns a slice with all the values of the enum - * Method `IsA()`: returns true only if the current value is among the values of the enum. Useful for validations. -* When the flag `json` is provided, two additional methods will be generated, `MarshalJSON()` and `UnmarshalJSON()`. These make -the enum conform to the `json.Marshaler` and `json.Unmarshaler` interfaces. Very useful to use it in JSON APIs. -* When the flag `text` is provided, two additional methods will be generated, `MarshalText()` and `UnmarshalText()`. These make -the enum conform to the `encoding.TextMarshaler` and `encoding.TextUnmarshaler` interfaces. -**Note:** If you use your enum values as keys in a map and you encode the map as _JSON_, you need this flag set to true to properly -convert the map keys to json (strings). If not, the numeric values will be used instead -* When the flag `yaml` is provided, two additional methods will be generated, `MarshalYAML()` and `UnmarshalYAML()`. These make -the enum conform to the `gopkg.in/yaml.v2.Marshaler` and `gopkg.in/yaml.v2.Unmarshaler` interfaces. -* When the flag `sql` is provided, the methods for implementing the Scanner and Valuer interfaces will be also generated. -Useful when storing the enum in a database. - -For example, if we have an enum type called `Pill`, -```go -type Pill int - -const ( - Placebo Pill = iota - Aspirin - Ibuprofen - Paracetamol - Acetaminophen = Paracetamol -) -``` -executing `enumer -type=Pill -json` will generate a new file with four basic methods and two extra for JSON: -```go -func (i Pill) String() string { - //... -} - -func PillString(s string) (Pill, error) { - //... -} - -func PillValues() []Pill { - //... -} - -func (i Pill) IsAPill() bool { - //... -} - -func (i Pill) MarshalJSON() ([]byte, error) { - //... -} - -func (i *Pill) UnmarshalJSON(data []byte) error { - //... -} -``` -From now on, we can: -```go -// Convert any Pill value to string -var aspirinString string = Aspirin.String() -// (or use it in any place where a Stringer is accepted) -fmt.Println("I need ", Paracetamol) // Will print "I need Paracetamol" - -// Convert a string with the enum name to the corresponding enum value -pill, err := PillString("Ibuprofen") -if err != nil { - fmt.Println("Unrecognized pill: ", err) - return -} -// Now pill == Ibuprofen - -// Get all the values of the string -allPills := PillValues() -fmt.Println(allPills) // Will print [Placebo Aspirin Ibuprofen Paracetamol] - -// Check if a value belongs to the Pill enum values -var notAPill Pill = 42 -if (notAPill.IsAPill()) { - fmt.Println(notAPill, "is not a value of the Pill enum") -} - -// Marshal/unmarshal to/from json strings, either directly or automatically when -// the enum is a field of a struct -pillJSON := Aspirin.MarshalJSON() -// Now pillJSON == `"Aspirin"` -``` - -The generated code is exactly the same as the Stringer tool plus the mentioned additions, so you can use -**Enumer** where you are already using **Stringer** without any code change. - -## Transforming the string representation of the enum value - -By default, Enumer uses the same name of the enum value for generating the string representation (usually CamelCase in Go). - -```go -type MyType int - - ... - -name := MyTypeValue.String() // name => "MyTypeValue" -``` - -Sometimes you need to use some other string representation format than CamelCase (i.e. in JSON). - -To transform it from CamelCase to snake_case or kebab-case, you can use the `transform` flag. - -For example, the command `enumer -type=MyType -json -transform=snake` would generate the following string representation: - -```go -name := MyTypeValue.String() // name => "my_type_value" -``` -**Note**: The transformation only works form CamelCase to snake_case or kebab-case, not the other way around. - -## How to use -The usage of Enumer is the same as Stringer, so you can refer to the [Stringer docs](https://godoc.org/golang.org/x/tools/cmd/stringer) -for more information. - -There are four boolean flags: `json`, `text`, `yaml` and `sql`. You can use any combination of them (i.e. `enumer -type=Pill -json -text`), - - -For enum string representation transformation the `transform` and `trimprefix` flags -were added (i.e. `enumer -type=MyType -json -transform=snake`). -Possible transform values are `snake` and `kebab` for transformation to snake_case and kebab-case accordingly. -The default value for `transform` flag is `noop` which means no transformation will be performed. - -If a prefix is provided via the `trimprefix` flag, it will be trimmed from the start of each name (before -it is transformed). If a name doesn't have the prefix it will be passed unchanged. - -## Inspiring projects -* [Stringer](https://godoc.org/golang.org/x/tools/cmd/stringer) -* [jsonenums](https://github.com/campoy/jsonenums) diff --git a/vendor/github.com/alvaroloes/enumer/enumer.go b/vendor/github.com/alvaroloes/enumer/enumer.go deleted file mode 100644 index 6c3d6fdfd19..00000000000 --- a/vendor/github.com/alvaroloes/enumer/enumer.go +++ /dev/null @@ -1,157 +0,0 @@ -package main - -import "fmt" - -// Arguments to format are: -// [1]: type name -const stringNameToValueMethod = `// %[1]sString retrieves an enum value from the enum constants string name. -// Throws an error if the param is not part of the enum. -func %[1]sString(s string) (%[1]s, error) { - if val, ok := _%[1]sNameToValueMap[s]; ok { - return val, nil - } - return 0, fmt.Errorf("%%s does not belong to %[1]s values", s) -} -` - -// Arguments to format are: -// [1]: type name -const stringValuesMethod = `// %[1]sValues returns all values of the enum -func %[1]sValues() []%[1]s { - return _%[1]sValues -} -` - -// Arguments to format are: -// [1]: type name -const stringBelongsMethodLoop = `// IsA%[1]s returns "true" if the value is listed in the enum definition. "false" otherwise -func (i %[1]s) IsA%[1]s() bool { - for _, v := range _%[1]sValues { - if i == v { - return true - } - } - return false -} -` - -// Arguments to format are: -// [1]: type name -const stringBelongsMethodSet = `// IsA%[1]s returns "true" if the value is listed in the enum definition. "false" otherwise -func (i %[1]s) IsA%[1]s() bool { - _, ok := _%[1]sMap[i] - return ok -} -` - -func (g *Generator) buildBasicExtras(runs [][]Value, typeName string, runsThreshold int) { - // At this moment, either "g.declareIndexAndNameVars()" or "g.declareNameVars()" has been called - - // Print the slice of values - g.Printf("\nvar _%sValues = []%s{", typeName, typeName) - for _, values := range runs { - for _, value := range values { - g.Printf("\t%s, ", value.str) - } - } - g.Printf("}\n\n") - - // Print the map between name and value - g.Printf("\nvar _%sNameToValueMap = map[string]%s{\n", typeName, typeName) - thereAreRuns := len(runs) > 1 && len(runs) <= runsThreshold - var n int - var runID string - for i, values := range runs { - if thereAreRuns { - runID = "_" + fmt.Sprintf("%d", i) - n = 0 - } else { - runID = "" - } - - for _, value := range values { - g.Printf("\t_%sName%s[%d:%d]: %s,\n", typeName, runID, n, n+len(value.name), &value) - n += len(value.name) - } - } - g.Printf("}\n\n") - - // Print the basic extra methods - g.Printf(stringNameToValueMethod, typeName) - g.Printf(stringValuesMethod, typeName) - if len(runs) < runsThreshold { - g.Printf(stringBelongsMethodLoop, typeName) - } else { // There is a map of values, the code is simpler then - g.Printf(stringBelongsMethodSet, typeName) - } -} - -// Arguments to format are: -// [1]: type name -const jsonMethods = ` -// MarshalJSON implements the json.Marshaler interface for %[1]s -func (i %[1]s) MarshalJSON() ([]byte, error) { - return json.Marshal(i.String()) -} - -// UnmarshalJSON implements the json.Unmarshaler interface for %[1]s -func (i *%[1]s) UnmarshalJSON(data []byte) error { - var s string - if err := json.Unmarshal(data, &s); err != nil { - return fmt.Errorf("%[1]s should be a string, got %%s", data) - } - - var err error - *i, err = %[1]sString(s) - return err -} -` - -func (g *Generator) buildJSONMethods(runs [][]Value, typeName string, runsThreshold int) { - g.Printf(jsonMethods, typeName) -} - -// Arguments to format are: -// [1]: type name -const textMethods = ` -// MarshalText implements the encoding.TextMarshaler interface for %[1]s -func (i %[1]s) MarshalText() ([]byte, error) { - return []byte(i.String()), nil -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface for %[1]s -func (i *%[1]s) UnmarshalText(text []byte) error { - var err error - *i, err = %[1]sString(string(text)) - return err -} -` - -func (g *Generator) buildTextMethods(runs [][]Value, typeName string, runsThreshold int) { - g.Printf(textMethods, typeName) -} - -// Arguments to format are: -// [1]: type name -const yamlMethods = ` -// MarshalYAML implements a YAML Marshaler for %[1]s -func (i %[1]s) MarshalYAML() (interface{}, error) { - return i.String(), nil -} - -// UnmarshalYAML implements a YAML Unmarshaler for %[1]s -func (i *%[1]s) UnmarshalYAML(unmarshal func(interface{}) error) error { - var s string - if err := unmarshal(&s); err != nil { - return err - } - - var err error - *i, err = %[1]sString(s) - return err -} -` - -func (g *Generator) buildYAMLMethods(runs [][]Value, typeName string, runsThreshold int) { - g.Printf(yamlMethods, typeName) -} diff --git a/vendor/github.com/alvaroloes/enumer/sql.go b/vendor/github.com/alvaroloes/enumer/sql.go deleted file mode 100644 index 67d5354eb94..00000000000 --- a/vendor/github.com/alvaroloes/enumer/sql.go +++ /dev/null @@ -1,40 +0,0 @@ -package main - -// Arguments to format are: -// [1]: type name -const valueMethod = `func (i %[1]s) Value() (driver.Value, error) { - return i.String(), nil -} -` - -const scanMethod = `func (i *%[1]s) Scan(value interface{}) error { - if value == nil { - return nil - } - - str, ok := value.(string) - if !ok { - bytes, ok := value.([]byte) - if !ok { - return fmt.Errorf("value is not a byte slice") - } - - str = string(bytes[:]) - } - - val, err := %[1]sString(str) - if err != nil { - return err - } - - *i = val - return nil -} -` - -func (g *Generator) addValueAndScanMethod(typeName string) { - g.Printf("\n") - g.Printf(valueMethod, typeName) - g.Printf("\n\n") - g.Printf(scanMethod, typeName) -} diff --git a/vendor/github.com/alvaroloes/enumer/stringer.go b/vendor/github.com/alvaroloes/enumer/stringer.go deleted file mode 100644 index 26ff247d52a..00000000000 --- a/vendor/github.com/alvaroloes/enumer/stringer.go +++ /dev/null @@ -1,738 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.5 - -//Enumer is a tool to generate Go code that adds useful methods to Go enums (constants with a specific type). -//It started as a fork of Rob Pike’s Stringer tool -// -//Please visit http://github.com/alvaroloes/enumer for a comprehensive documentation -package main - -import ( - "bytes" - "flag" - "fmt" - "go/ast" - exact "go/constant" - "go/format" - "go/importer" - "go/token" - "go/types" - "golang.org/x/tools/go/packages" - "io/ioutil" - "log" - "os" - "path/filepath" - "sort" - "strings" - - "github.com/pascaldekloe/name" -) - -type arrayFlags []string - -func (af arrayFlags) String() string { - return strings.Join(af, "") -} - -func (af *arrayFlags) Set(value string) error { - *af = append(*af, value) - return nil -} - -var ( - typeNames = flag.String("type", "", "comma-separated list of type names; must be set") - sql = flag.Bool("sql", false, "if true, the Scanner and Valuer interface will be implemented.") - json = flag.Bool("json", false, "if true, json marshaling methods will be generated. Default: false") - yaml = flag.Bool("yaml", false, "if true, yaml marshaling methods will be generated. Default: false") - text = flag.Bool("text", false, "if true, text marshaling methods will be generated. Default: false") - output = flag.String("output", "", "output file name; default srcdir/_string.go") - transformMethod = flag.String("transform", "noop", "enum item name transformation method. Default: noop") - trimPrefix = flag.String("trimprefix", "", "transform each item name by removing a prefix. Default: \"\"") - lineComment = flag.Bool("linecomment", false, "use line comment text as printed text when present") -) - -var comments arrayFlags - -func init() { - flag.Var(&comments, "comment", "comments to include in generated code, can repeat. Default: \"\"") -} - -// Usage is a replacement usage function for the flags package. -func Usage() { - fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0]) - fmt.Fprintf(os.Stderr, "\tenumer [flags] -type T [directory]\n") - fmt.Fprintf(os.Stderr, "\tenumer [flags] -type T files... # Must be a single package\n") - fmt.Fprintf(os.Stderr, "For more information, see:\n") - fmt.Fprintf(os.Stderr, "\thttps://github.com/alvaroloes/enumer\n") - fmt.Fprintf(os.Stderr, "Flags:\n") - flag.PrintDefaults() -} - -func main() { - log.SetFlags(0) - log.SetPrefix("enumer: ") - flag.Usage = Usage - flag.Parse() - if len(*typeNames) == 0 { - flag.Usage() - os.Exit(2) - } - types := strings.Split(*typeNames, ",") - - // We accept either one directory or a list of files. Which do we have? - args := flag.Args() - if len(args) == 0 { - // Default: process whole package in current directory. - args = []string{"."} - } - - // Parse the package once. - var ( - dir string - g Generator - ) - - if len(args) == 1 && isDirectory(args[0]) { - dir = args[0] - } else { - dir = filepath.Dir(args[0]) - } - - g.parsePackage(args) - - // Print the header and package clause. - g.Printf("// Code generated by \"enumer %s\"; DO NOT EDIT.\n", strings.Join(os.Args[1:], " ")) - g.Printf("\n") - g.Printf("// %s\n", comments.String()) - g.Printf("package %s", g.pkg.name) - g.Printf("\n") - g.Printf("import (\n") - g.Printf("\t\"fmt\"\n") - if *sql { - g.Printf("\t\"database/sql/driver\"\n") - } - if *json { - g.Printf("\t\"encoding/json\"\n") - } - g.Printf(")\n") - - // Run generate for each type. - for _, typeName := range types { - g.generate(typeName, *json, *yaml, *sql, *text, *transformMethod, *trimPrefix, *lineComment) - } - - // Format the output. - src := g.format() - - // Figure out filename to write to - outputName := *output - if outputName == "" { - baseName := fmt.Sprintf("%s_enumer.go", types[0]) - outputName = filepath.Join(dir, strings.ToLower(baseName)) - } - - // Write to tmpfile first - tmpName := fmt.Sprintf("%s_enumer_", filepath.Base(types[0])) - tmpFile, err := ioutil.TempFile(filepath.Dir(types[0]), tmpName) - if err != nil { - log.Fatalf("creating temporary file for output: %s", err) - } - _, err = tmpFile.Write(src) - if err != nil { - tmpFile.Close() - os.Remove(tmpFile.Name()) - log.Fatalf("writing output: %s", err) - } - tmpFile.Close() - - // Rename tmpfile to output file - err = os.Rename(tmpFile.Name(), outputName) - if err != nil { - log.Fatalf("moving tempfile to output file: %s", err) - } -} - -// isDirectory reports whether the named file is a directory. -func isDirectory(name string) bool { - info, err := os.Stat(name) - if err != nil { - log.Fatal(err) - } - return info.IsDir() -} - -// Generator holds the state of the analysis. Primarily used to buffer -// the output for format.Source. -type Generator struct { - buf bytes.Buffer // Accumulated output. - pkg *Package // Package we are scanning. -} - -// Printf prints the string to the output -func (g *Generator) Printf(format string, args ...interface{}) { - fmt.Fprintf(&g.buf, format, args...) -} - -// File holds a single parsed file and associated data. -type File struct { - pkg *Package // Package to which this file belongs. - file *ast.File // Parsed AST. - // These fields are reset for each type being generated. - typeName string // Name of the constant type. - values []Value // Accumulator for constant values of that type. -} - -// Package holds information about a Go package -type Package struct { - dir string - name string - defs map[*ast.Ident]types.Object - files []*File - typesPkg *types.Package -} - -//// parsePackageDir parses the package residing in the directory. -//func (g *Generator) parsePackageDir(directory string) { -// pkg, err := build.Default.ImportDir(directory, 0) -// if err != nil { -// log.Fatalf("cannot process directory %s: %s", directory, err) -// } -// var names []string -// names = append(names, pkg.GoFiles...) -// names = append(names, pkg.CgoFiles...) -// // TODO: Need to think about constants in test files. Maybe write type_string_test.go -// // in a separate pass? For later. -// // names = append(names, pkg.TestGoFiles...) // These are also in the "foo" package. -// names = append(names, pkg.SFiles...) -// names = prefixDirectory(directory, names) -// g.parsePackage(directory, names, nil) -//} -// -//// parsePackageFiles parses the package occupying the named files. -//func (g *Generator) parsePackageFiles(names []string) { -// g.parsePackage(".", names, nil) -//} -// -//// prefixDirectory places the directory name on the beginning of each name in the list. -//func prefixDirectory(directory string, names []string) []string { -// if directory == "." { -// return names -// } -// ret := make([]string, len(names)) -// for i, name := range names { -// ret[i] = filepath.Join(directory, name) -// } -// return ret -//} - -//// parsePackage analyzes the single package constructed from the named files. -//// If text is non-nil, it is a string to be used instead of the content of the file, -//// to be used for testing. parsePackage exits if there is an error. -//func (g *Generator) parsePackage(directory string, names []string, text interface{}) { -// var files []*File -// var astFiles []*ast.File -// g.pkg = new(Package) -// fs := token.NewFileSet() -// for _, name := range names { -// if !strings.HasSuffix(name, ".go") { -// continue -// } -// parsedFile, err := parser.ParseFile(fs, name, text, 0) -// if err != nil { -// log.Fatalf("parsing package: %s: %s", name, err) -// } -// astFiles = append(astFiles, parsedFile) -// files = append(files, &File{ -// file: parsedFile, -// pkg: g.pkg, -// }) -// } -// if len(astFiles) == 0 { -// log.Fatalf("%s: no buildable Go files", directory) -// } -// g.pkg.name = astFiles[0].Name.Name -// g.pkg.files = files -// g.pkg.dir = directory -// // Type check the package. -// g.pkg.check(fs, astFiles) -//} - -// parsePackage analyzes the single package constructed from the patterns and tags. -// parsePackage exits if there is an error. -func (g *Generator) parsePackage(patterns []string) { - cfg := &packages.Config{ - Mode: packages.LoadSyntax, - // TODO: Need to think about constants in test files. Maybe write type_string_test.go - // in a separate pass? For later. - Tests: false, - } - pkgs, err := packages.Load(cfg, patterns...) - if err != nil { - log.Fatal(err) - } - if len(pkgs) != 1 { - log.Fatalf("error: %d packages found", len(pkgs)) - } - g.addPackage(pkgs[0]) -} - -// addPackage adds a type checked Package and its syntax files to the generator. -func (g *Generator) addPackage(pkg *packages.Package) { - g.pkg = &Package{ - name: pkg.Name, - defs: pkg.TypesInfo.Defs, - files: make([]*File, len(pkg.Syntax)), - } - - for i, file := range pkg.Syntax { - g.pkg.files[i] = &File{ - file: file, - pkg: g.pkg, - } - } -} - -// check type-checks the package. The package must be OK to proceed. -func (pkg *Package) check(fs *token.FileSet, astFiles []*ast.File) { - pkg.defs = make(map[*ast.Ident]types.Object) - config := types.Config{Importer: importer.Default(), FakeImportC: true} - info := &types.Info{ - Defs: pkg.defs, - } - typesPkg, err := config.Check(pkg.dir, fs, astFiles, info) - if err != nil { - log.Fatalf("checking package: %s", err) - } - pkg.typesPkg = typesPkg -} - -func (g *Generator) transformValueNames(values []Value, transformMethod string) { - var sep rune - switch transformMethod { - case "snake": - sep = '_' - case "kebab": - sep = '-' - default: - return - } - - for i := range values { - values[i].name = strings.ToLower(name.Delimit(values[i].name, sep)) - } -} - -// trimValueNames removes a prefix from each name -func (g *Generator) trimValueNames(values []Value, prefix string) { - for i := range values { - values[i].name = strings.TrimPrefix(values[i].name, prefix) - } -} - -func (g *Generator) replaceValuesWithLineComment(values []Value) { - for i, val := range values { - if val.comment != "" { - values[i].name = val.comment - } - } -} - -// generate produces the String method for the named type. -func (g *Generator) generate(typeName string, includeJSON, includeYAML, includeSQL, includeText bool, transformMethod string, trimPrefix string, lineComment bool) { - values := make([]Value, 0, 100) - for _, file := range g.pkg.files { - // Set the state for this run of the walker. - file.typeName = typeName - file.values = nil - if file.file != nil { - ast.Inspect(file.file, file.genDecl) - values = append(values, file.values...) - } - } - - if len(values) == 0 { - log.Fatalf("no values defined for type %s", typeName) - } - - g.trimValueNames(values, trimPrefix) - - g.transformValueNames(values, transformMethod) - - if lineComment { - g.replaceValuesWithLineComment(values) - } - - runs := splitIntoRuns(values) - // The decision of which pattern to use depends on the number of - // runs in the numbers. If there's only one, it's easy. For more than - // one, there's a tradeoff between complexity and size of the data - // and code vs. the simplicity of a map. A map takes more space, - // but so does the code. The decision here (crossover at 10) is - // arbitrary, but considers that for large numbers of runs the cost - // of the linear scan in the switch might become important, and - // rather than use yet another algorithm such as binary search, - // we punt and use a map. In any case, the likelihood of a map - // being necessary for any realistic example other than bitmasks - // is very low. And bitmasks probably deserve their own analysis, - // to be done some other day. - const runsThreshold = 10 - switch { - case len(runs) == 1: - g.buildOneRun(runs, typeName) - case len(runs) <= runsThreshold: - g.buildMultipleRuns(runs, typeName) - default: - g.buildMap(runs, typeName) - } - - g.buildBasicExtras(runs, typeName, runsThreshold) - if includeJSON { - g.buildJSONMethods(runs, typeName, runsThreshold) - } - if includeText { - g.buildTextMethods(runs, typeName, runsThreshold) - } - if includeYAML { - g.buildYAMLMethods(runs, typeName, runsThreshold) - } - if includeSQL { - g.addValueAndScanMethod(typeName) - } -} - -// splitIntoRuns breaks the values into runs of contiguous sequences. -// For example, given 1,2,3,5,6,7 it returns {1,2,3},{5,6,7}. -// The input slice is known to be non-empty. -func splitIntoRuns(values []Value) [][]Value { - // We use stable sort so the lexically first name is chosen for equal elements. - sort.Stable(byValue(values)) - // Remove duplicates. Stable sort has put the one we want to print first, - // so use that one. The String method won't care about which named constant - // was the argument, so the first name for the given value is the only one to keep. - // We need to do this because identical values would cause the switch or map - // to fail to compile. - j := 1 - for i := 1; i < len(values); i++ { - if values[i].value != values[i-1].value { - values[j] = values[i] - j++ - } - } - values = values[:j] - runs := make([][]Value, 0, 10) - for len(values) > 0 { - // One contiguous sequence per outer loop. - i := 1 - for i < len(values) && values[i].value == values[i-1].value+1 { - i++ - } - runs = append(runs, values[:i]) - values = values[i:] - } - return runs -} - -// format returns the gofmt-ed contents of the Generator's buffer. -func (g *Generator) format() []byte { - src, err := format.Source(g.buf.Bytes()) - if err != nil { - // Should never happen, but can arise when developing this code. - // The user can compile the output to see the error. - log.Printf("warning: internal error: invalid Go generated: %s", err) - log.Printf("warning: compile the package to analyze the error") - return g.buf.Bytes() - } - return src -} - -// Value represents a declared constant. -type Value struct { - name string // The name of the constant after transformation (i.e. camel case => snake case) - // The value is stored as a bit pattern alone. The boolean tells us - // whether to interpret it as an int64 or a uint64; the only place - // this matters is when sorting. - // Much of the time the str field is all we need; it is printed - // by Value.String. - value uint64 // Will be converted to int64 when needed. - signed bool // Whether the constant is a signed type. - str string // The string representation given by the "go/exact" package. - comment string // The comment on the right of the constant -} - -func (v *Value) String() string { - return v.str -} - -// byValue lets us sort the constants into increasing order. -// We take care in the Less method to sort in signed or unsigned order, -// as appropriate. -type byValue []Value - -func (b byValue) Len() int { return len(b) } -func (b byValue) Swap(i, j int) { b[i], b[j] = b[j], b[i] } -func (b byValue) Less(i, j int) bool { - if b[i].signed { - return int64(b[i].value) < int64(b[j].value) - } - return b[i].value < b[j].value -} - -// genDecl processes one declaration clause. -func (f *File) genDecl(node ast.Node) bool { - decl, ok := node.(*ast.GenDecl) - if !ok || decl.Tok != token.CONST { - // We only care about const declarations. - return true - } - // The name of the type of the constants we are declaring. - // Can change if this is a multi-element declaration. - typ := "" - // Loop over the elements of the declaration. Each element is a ValueSpec: - // a list of names possibly followed by a type, possibly followed by values. - // If the type and value are both missing, we carry down the type (and value, - // but the "go/types" package takes care of that). - for _, spec := range decl.Specs { - vspec := spec.(*ast.ValueSpec) // Guaranteed to succeed as this is CONST. - if vspec.Type == nil && len(vspec.Values) > 0 { - // "X = 1". With no type but a value, the constant is untyped. - // Skip this vspec and reset the remembered type. - typ = "" - continue - } - if vspec.Type != nil { - // "X T". We have a type. Remember it. - ident, ok := vspec.Type.(*ast.Ident) - if !ok { - continue - } - typ = ident.Name - } - if typ != f.typeName { - // This is not the type we're looking for. - continue - } - // We now have a list of names (from one line of source code) all being - // declared with the desired type. - // Grab their names and actual values and store them in f.values. - for _, name := range vspec.Names { - if name.Name == "_" { - continue - } - // This dance lets the type checker find the values for us. It's a - // bit tricky: look up the object declared by the name, find its - // types.Const, and extract its value. - obj, ok := f.pkg.defs[name] - if !ok { - log.Fatalf("no value for constant %s", name) - } - info := obj.Type().Underlying().(*types.Basic).Info() - if info&types.IsInteger == 0 { - log.Fatalf("can't handle non-integer constant type %s", typ) - } - value := obj.(*types.Const).Val() // Guaranteed to succeed as this is CONST. - if value.Kind() != exact.Int { - log.Fatalf("can't happen: constant is not an integer %s", name) - } - i64, isInt := exact.Int64Val(value) - u64, isUint := exact.Uint64Val(value) - if !isInt && !isUint { - log.Fatalf("internal error: value of %s is not an integer: %s", name, value.String()) - } - if !isInt { - u64 = uint64(i64) - } - comment := "" - if c := vspec.Comment; c != nil && len(c.List) == 1 { - comment = strings.TrimSpace(c.Text()) - } - - v := Value{ - name: name.Name, - value: u64, - signed: info&types.IsUnsigned == 0, - str: value.String(), - comment: comment, - } - f.values = append(f.values, v) - } - } - return false -} - -// Helpers - -// usize returns the number of bits of the smallest unsigned integer -// type that will hold n. Used to create the smallest possible slice of -// integers to use as indexes into the concatenated strings. -func usize(n int) int { - switch { - case n < 1<<8: - return 8 - case n < 1<<16: - return 16 - default: - // 2^32 is enough constants for anyone. - return 32 - } -} - -// declareIndexAndNameVars declares the index slices and concatenated names -// strings representing the runs of values. -func (g *Generator) declareIndexAndNameVars(runs [][]Value, typeName string) { - var indexes, names []string - for i, run := range runs { - index, name := g.createIndexAndNameDecl(run, typeName, fmt.Sprintf("_%d", i)) - indexes = append(indexes, index) - names = append(names, name) - } - g.Printf("const (\n") - for _, name := range names { - g.Printf("\t%s\n", name) - } - g.Printf(")\n\n") - g.Printf("var (") - for _, index := range indexes { - g.Printf("\t%s\n", index) - } - g.Printf(")\n\n") -} - -// declareIndexAndNameVar is the single-run version of declareIndexAndNameVars -func (g *Generator) declareIndexAndNameVar(run []Value, typeName string) { - index, name := g.createIndexAndNameDecl(run, typeName, "") - g.Printf("const %s\n", name) - g.Printf("var %s\n", index) -} - -// createIndexAndNameDecl returns the pair of declarations for the run. The caller will add "const" and "var". -func (g *Generator) createIndexAndNameDecl(run []Value, typeName string, suffix string) (string, string) { - b := new(bytes.Buffer) - indexes := make([]int, len(run)) - for i := range run { - b.WriteString(run[i].name) - indexes[i] = b.Len() - } - nameConst := fmt.Sprintf("_%sName%s = %q", typeName, suffix, b.String()) - nameLen := b.Len() - b.Reset() - fmt.Fprintf(b, "_%sIndex%s = [...]uint%d{0, ", typeName, suffix, usize(nameLen)) - for i, v := range indexes { - if i > 0 { - fmt.Fprintf(b, ", ") - } - fmt.Fprintf(b, "%d", v) - } - fmt.Fprintf(b, "}") - return b.String(), nameConst -} - -// declareNameVars declares the concatenated names string representing all the values in the runs. -func (g *Generator) declareNameVars(runs [][]Value, typeName string, suffix string) { - g.Printf("const _%sName%s = \"", typeName, suffix) - for _, run := range runs { - for i := range run { - g.Printf("%s", run[i].name) - } - } - g.Printf("\"\n") -} - -// buildOneRun generates the variables and String method for a single run of contiguous values. -func (g *Generator) buildOneRun(runs [][]Value, typeName string) { - values := runs[0] - g.Printf("\n") - g.declareIndexAndNameVar(values, typeName) - // The generated code is simple enough to write as a Printf format. - lessThanZero := "" - if values[0].signed { - lessThanZero = "i < 0 || " - } - if values[0].value == 0 { // Signed or unsigned, 0 is still 0. - g.Printf(stringOneRun, typeName, usize(len(values)), lessThanZero) - } else { - g.Printf(stringOneRunWithOffset, typeName, values[0].String(), usize(len(values)), lessThanZero) - } -} - -// Arguments to format are: -// [1]: type name -// [2]: size of index element (8 for uint8 etc.) -// [3]: less than zero check (for signed types) -const stringOneRun = `func (i %[1]s) String() string { - if %[3]si >= %[1]s(len(_%[1]sIndex)-1) { - return fmt.Sprintf("%[1]s(%%d)", i) - } - return _%[1]sName[_%[1]sIndex[i]:_%[1]sIndex[i+1]] -} -` - -// Arguments to format are: -// [1]: type name -// [2]: lowest defined value for type, as a string -// [3]: size of index element (8 for uint8 etc.) -// [4]: less than zero check (for signed types) -/* - */ -const stringOneRunWithOffset = `func (i %[1]s) String() string { - i -= %[2]s - if %[4]si >= %[1]s(len(_%[1]sIndex)-1) { - return fmt.Sprintf("%[1]s(%%d)", i + %[2]s) - } - return _%[1]sName[_%[1]sIndex[i] : _%[1]sIndex[i+1]] -} -` - -// buildMultipleRuns generates the variables and String method for multiple runs of contiguous values. -// For this pattern, a single Printf format won't do. -func (g *Generator) buildMultipleRuns(runs [][]Value, typeName string) { - g.Printf("\n") - g.declareIndexAndNameVars(runs, typeName) - g.Printf("func (i %s) String() string {\n", typeName) - g.Printf("\tswitch {\n") - for i, values := range runs { - if len(values) == 1 { - g.Printf("\tcase i == %s:\n", &values[0]) - g.Printf("\t\treturn _%sName_%d\n", typeName, i) - continue - } - g.Printf("\tcase %s <= i && i <= %s:\n", &values[0], &values[len(values)-1]) - if values[0].value != 0 { - g.Printf("\t\ti -= %s\n", &values[0]) - } - g.Printf("\t\treturn _%sName_%d[_%sIndex_%d[i]:_%sIndex_%d[i+1]]\n", - typeName, i, typeName, i, typeName, i) - } - g.Printf("\tdefault:\n") - g.Printf("\t\treturn fmt.Sprintf(\"%s(%%d)\", i)\n", typeName) - g.Printf("\t}\n") - g.Printf("}\n") -} - -// buildMap handles the case where the space is so sparse a map is a reasonable fallback. -// It's a rare situation but has simple code. -func (g *Generator) buildMap(runs [][]Value, typeName string) { - g.Printf("\n") - g.declareNameVars(runs, typeName, "") - g.Printf("\nvar _%sMap = map[%s]string{\n", typeName, typeName) - n := 0 - for _, values := range runs { - for _, value := range values { - g.Printf("\t%s: _%sName[%d:%d],\n", &value, typeName, n, n+len(value.name)) - n += len(value.name) - } - } - g.Printf("}\n\n") - g.Printf(stringMap, typeName) -} - -// Argument to format is the type name. -const stringMap = `func (i %[1]s) String() string { - if str, ok := _%[1]sMap[i]; ok { - return str - } - return fmt.Sprintf("%[1]s(%%d)", i) -} -` diff --git a/vendor/github.com/fatih/color/LICENSE.md b/vendor/github.com/fatih/color/LICENSE.md deleted file mode 100644 index 25fdaf639df..00000000000 --- a/vendor/github.com/fatih/color/LICENSE.md +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Fatih Arslan - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/fatih/color/README.md b/vendor/github.com/fatih/color/README.md deleted file mode 100644 index be82827cacd..00000000000 --- a/vendor/github.com/fatih/color/README.md +++ /dev/null @@ -1,176 +0,0 @@ -# color [![](https://github.com/fatih/color/workflows/build/badge.svg)](https://github.com/fatih/color/actions) [![PkgGoDev](https://pkg.go.dev/badge/github.com/fatih/color)](https://pkg.go.dev/github.com/fatih/color) - -Color lets you use colorized outputs in terms of [ANSI Escape -Codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors) in Go (Golang). It -has support for Windows too! The API can be used in several ways, pick one that -suits you. - -![Color](https://user-images.githubusercontent.com/438920/96832689-03b3e000-13f4-11eb-9803-46f4c4de3406.jpg) - -## Install - -```bash -go get github.com/fatih/color -``` - -## Examples - -### Standard colors - -```go -// Print with default helper functions -color.Cyan("Prints text in cyan.") - -// A newline will be appended automatically -color.Blue("Prints %s in blue.", "text") - -// These are using the default foreground colors -color.Red("We have red") -color.Magenta("And many others ..") - -``` - -### Mix and reuse colors - -```go -// Create a new color object -c := color.New(color.FgCyan).Add(color.Underline) -c.Println("Prints cyan text with an underline.") - -// Or just add them to New() -d := color.New(color.FgCyan, color.Bold) -d.Printf("This prints bold cyan %s\n", "too!.") - -// Mix up foreground and background colors, create new mixes! -red := color.New(color.FgRed) - -boldRed := red.Add(color.Bold) -boldRed.Println("This will print text in bold red.") - -whiteBackground := red.Add(color.BgWhite) -whiteBackground.Println("Red text with white background.") -``` - -### Use your own output (io.Writer) - -```go -// Use your own io.Writer output -color.New(color.FgBlue).Fprintln(myWriter, "blue color!") - -blue := color.New(color.FgBlue) -blue.Fprint(writer, "This will print text in blue.") -``` - -### Custom print functions (PrintFunc) - -```go -// Create a custom print function for convenience -red := color.New(color.FgRed).PrintfFunc() -red("Warning") -red("Error: %s", err) - -// Mix up multiple attributes -notice := color.New(color.Bold, color.FgGreen).PrintlnFunc() -notice("Don't forget this...") -``` - -### Custom fprint functions (FprintFunc) - -```go -blue := color.New(color.FgBlue).FprintfFunc() -blue(myWriter, "important notice: %s", stars) - -// Mix up with multiple attributes -success := color.New(color.Bold, color.FgGreen).FprintlnFunc() -success(myWriter, "Don't forget this...") -``` - -### Insert into noncolor strings (SprintFunc) - -```go -// Create SprintXxx functions to mix strings with other non-colorized strings: -yellow := color.New(color.FgYellow).SprintFunc() -red := color.New(color.FgRed).SprintFunc() -fmt.Printf("This is a %s and this is %s.\n", yellow("warning"), red("error")) - -info := color.New(color.FgWhite, color.BgGreen).SprintFunc() -fmt.Printf("This %s rocks!\n", info("package")) - -// Use helper functions -fmt.Println("This", color.RedString("warning"), "should be not neglected.") -fmt.Printf("%v %v\n", color.GreenString("Info:"), "an important message.") - -// Windows supported too! Just don't forget to change the output to color.Output -fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS")) -``` - -### Plug into existing code - -```go -// Use handy standard colors -color.Set(color.FgYellow) - -fmt.Println("Existing text will now be in yellow") -fmt.Printf("This one %s\n", "too") - -color.Unset() // Don't forget to unset - -// You can mix up parameters -color.Set(color.FgMagenta, color.Bold) -defer color.Unset() // Use it in your function - -fmt.Println("All text will now be bold magenta.") -``` - -### Disable/Enable color - -There might be a case where you want to explicitly disable/enable color output. the -`go-isatty` package will automatically disable color output for non-tty output streams -(for example if the output were piped directly to `less`). - -The `color` package also disables color output if the [`NO_COLOR`](https://no-color.org) environment -variable is set to a non-empty string. - -`Color` has support to disable/enable colors programmatically both globally and -for single color definitions. For example suppose you have a CLI app and a -`-no-color` bool flag. You can easily disable the color output with: - -```go -var flagNoColor = flag.Bool("no-color", false, "Disable color output") - -if *flagNoColor { - color.NoColor = true // disables colorized output -} -``` - -It also has support for single color definitions (local). You can -disable/enable color output on the fly: - -```go -c := color.New(color.FgCyan) -c.Println("Prints cyan text") - -c.DisableColor() -c.Println("This is printed without any color") - -c.EnableColor() -c.Println("This prints again cyan...") -``` - -## GitHub Actions - -To output color in GitHub Actions (or other CI systems that support ANSI colors), make sure to set `color.NoColor = false` so that it bypasses the check for non-tty output streams. - -## Todo - -* Save/Return previous values -* Evaluate fmt.Formatter interface - -## Credits - -* [Fatih Arslan](https://github.com/fatih) -* Windows support via @mattn: [colorable](https://github.com/mattn/go-colorable) - -## License - -The MIT License (MIT) - see [`LICENSE.md`](https://github.com/fatih/color/blob/master/LICENSE.md) for more details diff --git a/vendor/github.com/fatih/color/color.go b/vendor/github.com/fatih/color/color.go deleted file mode 100644 index 889f9e77bdc..00000000000 --- a/vendor/github.com/fatih/color/color.go +++ /dev/null @@ -1,616 +0,0 @@ -package color - -import ( - "fmt" - "io" - "os" - "strconv" - "strings" - "sync" - - "github.com/mattn/go-colorable" - "github.com/mattn/go-isatty" -) - -var ( - // NoColor defines if the output is colorized or not. It's dynamically set to - // false or true based on the stdout's file descriptor referring to a terminal - // or not. It's also set to true if the NO_COLOR environment variable is - // set (regardless of its value). This is a global option and affects all - // colors. For more control over each color block use the methods - // DisableColor() individually. - NoColor = noColorIsSet() || os.Getenv("TERM") == "dumb" || - (!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd())) - - // Output defines the standard output of the print functions. By default, - // os.Stdout is used. - Output = colorable.NewColorableStdout() - - // Error defines a color supporting writer for os.Stderr. - Error = colorable.NewColorableStderr() - - // colorsCache is used to reduce the count of created Color objects and - // allows to reuse already created objects with required Attribute. - colorsCache = make(map[Attribute]*Color) - colorsCacheMu sync.Mutex // protects colorsCache -) - -// noColorIsSet returns true if the environment variable NO_COLOR is set to a non-empty string. -func noColorIsSet() bool { - return os.Getenv("NO_COLOR") != "" -} - -// Color defines a custom color object which is defined by SGR parameters. -type Color struct { - params []Attribute - noColor *bool -} - -// Attribute defines a single SGR Code -type Attribute int - -const escape = "\x1b" - -// Base attributes -const ( - Reset Attribute = iota - Bold - Faint - Italic - Underline - BlinkSlow - BlinkRapid - ReverseVideo - Concealed - CrossedOut -) - -// Foreground text colors -const ( - FgBlack Attribute = iota + 30 - FgRed - FgGreen - FgYellow - FgBlue - FgMagenta - FgCyan - FgWhite -) - -// Foreground Hi-Intensity text colors -const ( - FgHiBlack Attribute = iota + 90 - FgHiRed - FgHiGreen - FgHiYellow - FgHiBlue - FgHiMagenta - FgHiCyan - FgHiWhite -) - -// Background text colors -const ( - BgBlack Attribute = iota + 40 - BgRed - BgGreen - BgYellow - BgBlue - BgMagenta - BgCyan - BgWhite -) - -// Background Hi-Intensity text colors -const ( - BgHiBlack Attribute = iota + 100 - BgHiRed - BgHiGreen - BgHiYellow - BgHiBlue - BgHiMagenta - BgHiCyan - BgHiWhite -) - -// New returns a newly created color object. -func New(value ...Attribute) *Color { - c := &Color{ - params: make([]Attribute, 0), - } - - if noColorIsSet() { - c.noColor = boolPtr(true) - } - - c.Add(value...) - return c -} - -// Set sets the given parameters immediately. It will change the color of -// output with the given SGR parameters until color.Unset() is called. -func Set(p ...Attribute) *Color { - c := New(p...) - c.Set() - return c -} - -// Unset resets all escape attributes and clears the output. Usually should -// be called after Set(). -func Unset() { - if NoColor { - return - } - - fmt.Fprintf(Output, "%s[%dm", escape, Reset) -} - -// Set sets the SGR sequence. -func (c *Color) Set() *Color { - if c.isNoColorSet() { - return c - } - - fmt.Fprint(Output, c.format()) - return c -} - -func (c *Color) unset() { - if c.isNoColorSet() { - return - } - - Unset() -} - -// SetWriter is used to set the SGR sequence with the given io.Writer. This is -// a low-level function, and users should use the higher-level functions, such -// as color.Fprint, color.Print, etc. -func (c *Color) SetWriter(w io.Writer) *Color { - if c.isNoColorSet() { - return c - } - - fmt.Fprint(w, c.format()) - return c -} - -// UnsetWriter resets all escape attributes and clears the output with the give -// io.Writer. Usually should be called after SetWriter(). -func (c *Color) UnsetWriter(w io.Writer) { - if c.isNoColorSet() { - return - } - - if NoColor { - return - } - - fmt.Fprintf(w, "%s[%dm", escape, Reset) -} - -// Add is used to chain SGR parameters. Use as many as parameters to combine -// and create custom color objects. Example: Add(color.FgRed, color.Underline). -func (c *Color) Add(value ...Attribute) *Color { - c.params = append(c.params, value...) - return c -} - -// Fprint formats using the default formats for its operands and writes to w. -// Spaces are added between operands when neither is a string. -// It returns the number of bytes written and any write error encountered. -// On Windows, users should wrap w with colorable.NewColorable() if w is of -// type *os.File. -func (c *Color) Fprint(w io.Writer, a ...interface{}) (n int, err error) { - c.SetWriter(w) - defer c.UnsetWriter(w) - - return fmt.Fprint(w, a...) -} - -// Print formats using the default formats for its operands and writes to -// standard output. Spaces are added between operands when neither is a -// string. It returns the number of bytes written and any write error -// encountered. This is the standard fmt.Print() method wrapped with the given -// color. -func (c *Color) Print(a ...interface{}) (n int, err error) { - c.Set() - defer c.unset() - - return fmt.Fprint(Output, a...) -} - -// Fprintf formats according to a format specifier and writes to w. -// It returns the number of bytes written and any write error encountered. -// On Windows, users should wrap w with colorable.NewColorable() if w is of -// type *os.File. -func (c *Color) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { - c.SetWriter(w) - defer c.UnsetWriter(w) - - return fmt.Fprintf(w, format, a...) -} - -// Printf formats according to a format specifier and writes to standard output. -// It returns the number of bytes written and any write error encountered. -// This is the standard fmt.Printf() method wrapped with the given color. -func (c *Color) Printf(format string, a ...interface{}) (n int, err error) { - c.Set() - defer c.unset() - - return fmt.Fprintf(Output, format, a...) -} - -// Fprintln formats using the default formats for its operands and writes to w. -// Spaces are always added between operands and a newline is appended. -// On Windows, users should wrap w with colorable.NewColorable() if w is of -// type *os.File. -func (c *Color) Fprintln(w io.Writer, a ...interface{}) (n int, err error) { - c.SetWriter(w) - defer c.UnsetWriter(w) - - return fmt.Fprintln(w, a...) -} - -// Println formats using the default formats for its operands and writes to -// standard output. Spaces are always added between operands and a newline is -// appended. It returns the number of bytes written and any write error -// encountered. This is the standard fmt.Print() method wrapped with the given -// color. -func (c *Color) Println(a ...interface{}) (n int, err error) { - c.Set() - defer c.unset() - - return fmt.Fprintln(Output, a...) -} - -// Sprint is just like Print, but returns a string instead of printing it. -func (c *Color) Sprint(a ...interface{}) string { - return c.wrap(fmt.Sprint(a...)) -} - -// Sprintln is just like Println, but returns a string instead of printing it. -func (c *Color) Sprintln(a ...interface{}) string { - return c.wrap(fmt.Sprintln(a...)) -} - -// Sprintf is just like Printf, but returns a string instead of printing it. -func (c *Color) Sprintf(format string, a ...interface{}) string { - return c.wrap(fmt.Sprintf(format, a...)) -} - -// FprintFunc returns a new function that prints the passed arguments as -// colorized with color.Fprint(). -func (c *Color) FprintFunc() func(w io.Writer, a ...interface{}) { - return func(w io.Writer, a ...interface{}) { - c.Fprint(w, a...) - } -} - -// PrintFunc returns a new function that prints the passed arguments as -// colorized with color.Print(). -func (c *Color) PrintFunc() func(a ...interface{}) { - return func(a ...interface{}) { - c.Print(a...) - } -} - -// FprintfFunc returns a new function that prints the passed arguments as -// colorized with color.Fprintf(). -func (c *Color) FprintfFunc() func(w io.Writer, format string, a ...interface{}) { - return func(w io.Writer, format string, a ...interface{}) { - c.Fprintf(w, format, a...) - } -} - -// PrintfFunc returns a new function that prints the passed arguments as -// colorized with color.Printf(). -func (c *Color) PrintfFunc() func(format string, a ...interface{}) { - return func(format string, a ...interface{}) { - c.Printf(format, a...) - } -} - -// FprintlnFunc returns a new function that prints the passed arguments as -// colorized with color.Fprintln(). -func (c *Color) FprintlnFunc() func(w io.Writer, a ...interface{}) { - return func(w io.Writer, a ...interface{}) { - c.Fprintln(w, a...) - } -} - -// PrintlnFunc returns a new function that prints the passed arguments as -// colorized with color.Println(). -func (c *Color) PrintlnFunc() func(a ...interface{}) { - return func(a ...interface{}) { - c.Println(a...) - } -} - -// SprintFunc returns a new function that returns colorized strings for the -// given arguments with fmt.Sprint(). Useful to put into or mix into other -// string. Windows users should use this in conjunction with color.Output, example: -// -// put := New(FgYellow).SprintFunc() -// fmt.Fprintf(color.Output, "This is a %s", put("warning")) -func (c *Color) SprintFunc() func(a ...interface{}) string { - return func(a ...interface{}) string { - return c.wrap(fmt.Sprint(a...)) - } -} - -// SprintfFunc returns a new function that returns colorized strings for the -// given arguments with fmt.Sprintf(). Useful to put into or mix into other -// string. Windows users should use this in conjunction with color.Output. -func (c *Color) SprintfFunc() func(format string, a ...interface{}) string { - return func(format string, a ...interface{}) string { - return c.wrap(fmt.Sprintf(format, a...)) - } -} - -// SprintlnFunc returns a new function that returns colorized strings for the -// given arguments with fmt.Sprintln(). Useful to put into or mix into other -// string. Windows users should use this in conjunction with color.Output. -func (c *Color) SprintlnFunc() func(a ...interface{}) string { - return func(a ...interface{}) string { - return c.wrap(fmt.Sprintln(a...)) - } -} - -// sequence returns a formatted SGR sequence to be plugged into a "\x1b[...m" -// an example output might be: "1;36" -> bold cyan -func (c *Color) sequence() string { - format := make([]string, len(c.params)) - for i, v := range c.params { - format[i] = strconv.Itoa(int(v)) - } - - return strings.Join(format, ";") -} - -// wrap wraps the s string with the colors attributes. The string is ready to -// be printed. -func (c *Color) wrap(s string) string { - if c.isNoColorSet() { - return s - } - - return c.format() + s + c.unformat() -} - -func (c *Color) format() string { - return fmt.Sprintf("%s[%sm", escape, c.sequence()) -} - -func (c *Color) unformat() string { - return fmt.Sprintf("%s[%dm", escape, Reset) -} - -// DisableColor disables the color output. Useful to not change any existing -// code and still being able to output. Can be used for flags like -// "--no-color". To enable back use EnableColor() method. -func (c *Color) DisableColor() { - c.noColor = boolPtr(true) -} - -// EnableColor enables the color output. Use it in conjunction with -// DisableColor(). Otherwise, this method has no side effects. -func (c *Color) EnableColor() { - c.noColor = boolPtr(false) -} - -func (c *Color) isNoColorSet() bool { - // check first if we have user set action - if c.noColor != nil { - return *c.noColor - } - - // if not return the global option, which is disabled by default - return NoColor -} - -// Equals returns a boolean value indicating whether two colors are equal. -func (c *Color) Equals(c2 *Color) bool { - if len(c.params) != len(c2.params) { - return false - } - - for _, attr := range c.params { - if !c2.attrExists(attr) { - return false - } - } - - return true -} - -func (c *Color) attrExists(a Attribute) bool { - for _, attr := range c.params { - if attr == a { - return true - } - } - - return false -} - -func boolPtr(v bool) *bool { - return &v -} - -func getCachedColor(p Attribute) *Color { - colorsCacheMu.Lock() - defer colorsCacheMu.Unlock() - - c, ok := colorsCache[p] - if !ok { - c = New(p) - colorsCache[p] = c - } - - return c -} - -func colorPrint(format string, p Attribute, a ...interface{}) { - c := getCachedColor(p) - - if !strings.HasSuffix(format, "\n") { - format += "\n" - } - - if len(a) == 0 { - c.Print(format) - } else { - c.Printf(format, a...) - } -} - -func colorString(format string, p Attribute, a ...interface{}) string { - c := getCachedColor(p) - - if len(a) == 0 { - return c.SprintFunc()(format) - } - - return c.SprintfFunc()(format, a...) -} - -// Black is a convenient helper function to print with black foreground. A -// newline is appended to format by default. -func Black(format string, a ...interface{}) { colorPrint(format, FgBlack, a...) } - -// Red is a convenient helper function to print with red foreground. A -// newline is appended to format by default. -func Red(format string, a ...interface{}) { colorPrint(format, FgRed, a...) } - -// Green is a convenient helper function to print with green foreground. A -// newline is appended to format by default. -func Green(format string, a ...interface{}) { colorPrint(format, FgGreen, a...) } - -// Yellow is a convenient helper function to print with yellow foreground. -// A newline is appended to format by default. -func Yellow(format string, a ...interface{}) { colorPrint(format, FgYellow, a...) } - -// Blue is a convenient helper function to print with blue foreground. A -// newline is appended to format by default. -func Blue(format string, a ...interface{}) { colorPrint(format, FgBlue, a...) } - -// Magenta is a convenient helper function to print with magenta foreground. -// A newline is appended to format by default. -func Magenta(format string, a ...interface{}) { colorPrint(format, FgMagenta, a...) } - -// Cyan is a convenient helper function to print with cyan foreground. A -// newline is appended to format by default. -func Cyan(format string, a ...interface{}) { colorPrint(format, FgCyan, a...) } - -// White is a convenient helper function to print with white foreground. A -// newline is appended to format by default. -func White(format string, a ...interface{}) { colorPrint(format, FgWhite, a...) } - -// BlackString is a convenient helper function to return a string with black -// foreground. -func BlackString(format string, a ...interface{}) string { return colorString(format, FgBlack, a...) } - -// RedString is a convenient helper function to return a string with red -// foreground. -func RedString(format string, a ...interface{}) string { return colorString(format, FgRed, a...) } - -// GreenString is a convenient helper function to return a string with green -// foreground. -func GreenString(format string, a ...interface{}) string { return colorString(format, FgGreen, a...) } - -// YellowString is a convenient helper function to return a string with yellow -// foreground. -func YellowString(format string, a ...interface{}) string { return colorString(format, FgYellow, a...) } - -// BlueString is a convenient helper function to return a string with blue -// foreground. -func BlueString(format string, a ...interface{}) string { return colorString(format, FgBlue, a...) } - -// MagentaString is a convenient helper function to return a string with magenta -// foreground. -func MagentaString(format string, a ...interface{}) string { - return colorString(format, FgMagenta, a...) -} - -// CyanString is a convenient helper function to return a string with cyan -// foreground. -func CyanString(format string, a ...interface{}) string { return colorString(format, FgCyan, a...) } - -// WhiteString is a convenient helper function to return a string with white -// foreground. -func WhiteString(format string, a ...interface{}) string { return colorString(format, FgWhite, a...) } - -// HiBlack is a convenient helper function to print with hi-intensity black foreground. A -// newline is appended to format by default. -func HiBlack(format string, a ...interface{}) { colorPrint(format, FgHiBlack, a...) } - -// HiRed is a convenient helper function to print with hi-intensity red foreground. A -// newline is appended to format by default. -func HiRed(format string, a ...interface{}) { colorPrint(format, FgHiRed, a...) } - -// HiGreen is a convenient helper function to print with hi-intensity green foreground. A -// newline is appended to format by default. -func HiGreen(format string, a ...interface{}) { colorPrint(format, FgHiGreen, a...) } - -// HiYellow is a convenient helper function to print with hi-intensity yellow foreground. -// A newline is appended to format by default. -func HiYellow(format string, a ...interface{}) { colorPrint(format, FgHiYellow, a...) } - -// HiBlue is a convenient helper function to print with hi-intensity blue foreground. A -// newline is appended to format by default. -func HiBlue(format string, a ...interface{}) { colorPrint(format, FgHiBlue, a...) } - -// HiMagenta is a convenient helper function to print with hi-intensity magenta foreground. -// A newline is appended to format by default. -func HiMagenta(format string, a ...interface{}) { colorPrint(format, FgHiMagenta, a...) } - -// HiCyan is a convenient helper function to print with hi-intensity cyan foreground. A -// newline is appended to format by default. -func HiCyan(format string, a ...interface{}) { colorPrint(format, FgHiCyan, a...) } - -// HiWhite is a convenient helper function to print with hi-intensity white foreground. A -// newline is appended to format by default. -func HiWhite(format string, a ...interface{}) { colorPrint(format, FgHiWhite, a...) } - -// HiBlackString is a convenient helper function to return a string with hi-intensity black -// foreground. -func HiBlackString(format string, a ...interface{}) string { - return colorString(format, FgHiBlack, a...) -} - -// HiRedString is a convenient helper function to return a string with hi-intensity red -// foreground. -func HiRedString(format string, a ...interface{}) string { return colorString(format, FgHiRed, a...) } - -// HiGreenString is a convenient helper function to return a string with hi-intensity green -// foreground. -func HiGreenString(format string, a ...interface{}) string { - return colorString(format, FgHiGreen, a...) -} - -// HiYellowString is a convenient helper function to return a string with hi-intensity yellow -// foreground. -func HiYellowString(format string, a ...interface{}) string { - return colorString(format, FgHiYellow, a...) -} - -// HiBlueString is a convenient helper function to return a string with hi-intensity blue -// foreground. -func HiBlueString(format string, a ...interface{}) string { return colorString(format, FgHiBlue, a...) } - -// HiMagentaString is a convenient helper function to return a string with hi-intensity magenta -// foreground. -func HiMagentaString(format string, a ...interface{}) string { - return colorString(format, FgHiMagenta, a...) -} - -// HiCyanString is a convenient helper function to return a string with hi-intensity cyan -// foreground. -func HiCyanString(format string, a ...interface{}) string { return colorString(format, FgHiCyan, a...) } - -// HiWhiteString is a convenient helper function to return a string with hi-intensity white -// foreground. -func HiWhiteString(format string, a ...interface{}) string { - return colorString(format, FgHiWhite, a...) -} diff --git a/vendor/github.com/fatih/color/color_windows.go b/vendor/github.com/fatih/color/color_windows.go deleted file mode 100644 index be01c558e50..00000000000 --- a/vendor/github.com/fatih/color/color_windows.go +++ /dev/null @@ -1,19 +0,0 @@ -package color - -import ( - "os" - - "golang.org/x/sys/windows" -) - -func init() { - // Opt-in for ansi color support for current process. - // https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#output-sequences - var outMode uint32 - out := windows.Handle(os.Stdout.Fd()) - if err := windows.GetConsoleMode(out, &outMode); err != nil { - return - } - outMode |= windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING - _ = windows.SetConsoleMode(out, outMode) -} diff --git a/vendor/github.com/fatih/color/doc.go b/vendor/github.com/fatih/color/doc.go deleted file mode 100644 index 9491ad5413c..00000000000 --- a/vendor/github.com/fatih/color/doc.go +++ /dev/null @@ -1,134 +0,0 @@ -/* -Package color is an ANSI color package to output colorized or SGR defined -output to the standard output. The API can be used in several way, pick one -that suits you. - -Use simple and default helper functions with predefined foreground colors: - - color.Cyan("Prints text in cyan.") - - // a newline will be appended automatically - color.Blue("Prints %s in blue.", "text") - - // More default foreground colors.. - color.Red("We have red") - color.Yellow("Yellow color too!") - color.Magenta("And many others ..") - - // Hi-intensity colors - color.HiGreen("Bright green color.") - color.HiBlack("Bright black means gray..") - color.HiWhite("Shiny white color!") - -However, there are times when custom color mixes are required. Below are some -examples to create custom color objects and use the print functions of each -separate color object. - - // Create a new color object - c := color.New(color.FgCyan).Add(color.Underline) - c.Println("Prints cyan text with an underline.") - - // Or just add them to New() - d := color.New(color.FgCyan, color.Bold) - d.Printf("This prints bold cyan %s\n", "too!.") - - - // Mix up foreground and background colors, create new mixes! - red := color.New(color.FgRed) - - boldRed := red.Add(color.Bold) - boldRed.Println("This will print text in bold red.") - - whiteBackground := red.Add(color.BgWhite) - whiteBackground.Println("Red text with White background.") - - // Use your own io.Writer output - color.New(color.FgBlue).Fprintln(myWriter, "blue color!") - - blue := color.New(color.FgBlue) - blue.Fprint(myWriter, "This will print text in blue.") - -You can create PrintXxx functions to simplify even more: - - // Create a custom print function for convenient - red := color.New(color.FgRed).PrintfFunc() - red("warning") - red("error: %s", err) - - // Mix up multiple attributes - notice := color.New(color.Bold, color.FgGreen).PrintlnFunc() - notice("don't forget this...") - -You can also FprintXxx functions to pass your own io.Writer: - - blue := color.New(FgBlue).FprintfFunc() - blue(myWriter, "important notice: %s", stars) - - // Mix up with multiple attributes - success := color.New(color.Bold, color.FgGreen).FprintlnFunc() - success(myWriter, don't forget this...") - -Or create SprintXxx functions to mix strings with other non-colorized strings: - - yellow := New(FgYellow).SprintFunc() - red := New(FgRed).SprintFunc() - - fmt.Printf("this is a %s and this is %s.\n", yellow("warning"), red("error")) - - info := New(FgWhite, BgGreen).SprintFunc() - fmt.Printf("this %s rocks!\n", info("package")) - -Windows support is enabled by default. All Print functions work as intended. -However, only for color.SprintXXX functions, user should use fmt.FprintXXX and -set the output to color.Output: - - fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS")) - - info := New(FgWhite, BgGreen).SprintFunc() - fmt.Fprintf(color.Output, "this %s rocks!\n", info("package")) - -Using with existing code is possible. Just use the Set() method to set the -standard output to the given parameters. That way a rewrite of an existing -code is not required. - - // Use handy standard colors. - color.Set(color.FgYellow) - - fmt.Println("Existing text will be now in Yellow") - fmt.Printf("This one %s\n", "too") - - color.Unset() // don't forget to unset - - // You can mix up parameters - color.Set(color.FgMagenta, color.Bold) - defer color.Unset() // use it in your function - - fmt.Println("All text will be now bold magenta.") - -There might be a case where you want to disable color output (for example to -pipe the standard output of your app to somewhere else). `Color` has support to -disable colors both globally and for single color definition. For example -suppose you have a CLI app and a `--no-color` bool flag. You can easily disable -the color output with: - - var flagNoColor = flag.Bool("no-color", false, "Disable color output") - - if *flagNoColor { - color.NoColor = true // disables colorized output - } - -You can also disable the color by setting the NO_COLOR environment variable to any value. - -It also has support for single color definitions (local). You can -disable/enable color output on the fly: - - c := color.New(color.FgCyan) - c.Println("Prints cyan text") - - c.DisableColor() - c.Println("This is printed without any color") - - c.EnableColor() - c.Println("This prints again cyan...") -*/ -package color diff --git a/vendor/github.com/go-bindata/go-bindata/.gitignore b/vendor/github.com/go-bindata/go-bindata/.gitignore deleted file mode 100644 index b9abe353d25..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Goland project files -.idea/ -*.iml diff --git a/vendor/github.com/go-bindata/go-bindata/CONTRIBUTING.md b/vendor/github.com/go-bindata/go-bindata/CONTRIBUTING.md deleted file mode 100644 index e0732f54ebd..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/CONTRIBUTING.md +++ /dev/null @@ -1,79 +0,0 @@ -## Contribution guidelines. - -So you wish to contribute to this project? Fantastic! -Here are a few guidelines to help you do this in a -streamlined fashion. - - -## Bug reports - -When supplying a bug report, please consider the following guidelines. -These serve to make it easier for us to address the issue and find a solution. -Most of these are pretty self-evident, but sometimes it is still necessary -to reiterate them. - -* Be clear in the way you express the problem. Use simple language and - just enough of it to clearly define the issue. Not everyone is a native - English speaker. And while most can handle themselves pretty well, - it helps to stay away from more esoteric vocabulary. - - Be patient with non-native English speakers. If their bug reports - or comments are hard to understand, just ask for clarification. - Do not start guessing at their meaning, as this may just lead to - more confusion and misunderstandings. -* Clearly define any information which is relevant to the problem. - This includes library versions, operating system and any other - external dependencies which may be needed. -* Where applicable, provide a step-by-step listing of the way to - reproduce the problem. Make sure this is the simplest possible - way to do so. Omit any and all unneccesary steps, because they may - just complicate our understanding of the real problem. - If need be, create a whole new code project on your local machine, - which specifically tries to create the problem you are running into; - nothing more, nothing less. - - Include this program in the bug report. It often suffices to paste - the code in a [Gist](https://gist.github.com) or on the - [Go playground](http://play.golang.org). -* If possible, provide us with a listing of the steps you have already - undertaken to solve the problem. This can save us a great deal of - wasted time, trying out solutions you have already covered. - - -## Pull requests - -Bug reports are great. Supplying fixes to bugs is even better. -When submitting a pull request, the following guidelines are -good to keep in mind: - -* `go fmt`: **Always** run your code through `go fmt`, before - committing it. Code has to be readable by many different - people. And the only way this will be as painless as possible, - is if we all stick to the same code style. - - Some of our projects may have automated build-servers hooked up - to commit hooks. These will vet any submitted code and determine - if it meets a set of properties. One of which is code formatting. - These servers will outright deny a submission which has not been - run through `go fmt`, even if the code itself is correct. - - We try to maintain a zero-tolerance policy on this matter, - because consistently formatted code makes life a great deal - easier for everyone involved. -* Commit log messages: When committing changes, do so often and - clearly -- Even if you have changed only 1 character in a code - comment. This means that commit log messages should clearly state - exactly what the change does and why. If it fixes a known issue, - then mention the issue number in the commit log. E.g.: - - > Fixes return value for `foo/boo.Baz()` to be consistent with - > the rest of the API. This addresses issue #32 - - Do not pile a lot of unrelated changes into a single commit. - Pick and choose only those changes for a single commit, which are - directly related. We would much rather see a hundred commits - saying nothing but `"Runs go fmt"` in between any real fixes - than have these style changes embedded in those real fixes. - It creates a lot of noise when trying to review code. - - diff --git a/vendor/github.com/go-bindata/go-bindata/LICENSE b/vendor/github.com/go-bindata/go-bindata/LICENSE deleted file mode 100644 index c07a9311f17..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/LICENSE +++ /dev/null @@ -1,3 +0,0 @@ -This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -license. Its contents can be found at: -http://creativecommons.org/publicdomain/zero/1.0 diff --git a/vendor/github.com/go-bindata/go-bindata/Makefile b/vendor/github.com/go-bindata/go-bindata/Makefile deleted file mode 100644 index 84b661cb23c..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - make -C testdata diff --git a/vendor/github.com/go-bindata/go-bindata/README.md b/vendor/github.com/go-bindata/go-bindata/README.md deleted file mode 100644 index 155350532e1..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/README.md +++ /dev/null @@ -1,199 +0,0 @@ -## bindata - -[![Go Report Card](https://goreportcard.com/badge/github.com/go-bindata/bindata)](https://goreportcard.com/report/github.com/go-bindata/bindata) - -This package converts any file into managable Go source code. Useful for -embedding binary data into a go program. The file data is optionally gzip -compressed before being converted to a raw byte slice. - -It comes with a command line tool in the `go-bindata` sub directory. -This tool offers a set of command line options, used to customize the -output being generated. - - -### Installation - -To install the library and command line program, use the following: - - go get -u github.com/go-bindata/go-bindata/... - - -### Usage - -Conversion is done on one or more sets of files. They are all embedded in a new -Go source file, along with a table of contents and an `Asset` function, -which allows quick access to the asset, based on its name. - -The simplest invocation generates a `bindata.go` file in the current -working directory. It includes all assets from the `data` directory. - - $ go-bindata data/ - -To include all input sub-directories recursively, use the elipsis postfix -as defined for Go import paths. Otherwise it will only consider assets in the -input directory itself. - - $ go-bindata data/... - -To specify the name of the output file being generated, we use the following: - - $ go-bindata -o myfile.go data/ - -Multiple input directories can be specified if necessary. - - $ go-bindata dir1/... /path/to/dir2/... dir3 - - -The following paragraphs detail some of the command line options which can be -supplied to `go-bindata`. Refer to the `testdata/out` directory for various -output examples from the assets in `testdata/in`. Each example uses different -command line options. - -To ignore files, pass in regexes using -ignore, for example: - - $ go-bindata -ignore=\\.gitignore data/... - -### Accessing an asset - -To access asset data, we use the `Asset(string) ([]byte, error)` function which -is included in the generated output. - - data, err := Asset("pub/style/foo.css") - if err != nil { - // Asset was not found. - } - - // use asset data - - -### Debug vs Release builds - -When invoking the program with the `-debug` flag, the generated code does -not actually include the asset data. Instead, it generates function stubs -which load the data from the original file on disk. The asset API remains -identical between debug and release builds, so your code will not have to -change. - -This is useful during development when you expect the assets to change often. -The host application using these assets uses the same API in both cases and -will not have to care where the actual data comes from. - -An example is a Go webserver with some embedded, static web content like -HTML, JS and CSS files. While developing it, you do not want to rebuild the -whole server and restart it every time you make a change to a bit of -javascript. You just want to build and launch the server once. Then just press -refresh in the browser to see those changes. Embedding the assets with the -`debug` flag allows you to do just that. When you are finished developing and -ready for deployment, just re-invoke `go-bindata` without the `-debug` flag. -It will now embed the latest version of the assets. - - -### Lower memory footprint - -Using the `-nomemcopy` flag, will alter the way the output file is generated. -It will employ a hack that allows us to read the file data directly from -the compiled program's `.rodata` section. This ensures that when we call -call our generated function, we omit unnecessary memcopies. - -The downside of this, is that it requires dependencies on the `reflect` and -`unsafe` packages. These may be restricted on platforms like AppEngine and -thus prevent you from using this mode. - -Another disadvantage is that the byte slice we create, is strictly read-only. -For most use-cases this is not a problem, but if you ever try to alter the -returned byte slice, a runtime panic is thrown. Use this mode only on target -platforms where memory constraints are an issue. - -The default behaviour is to use the old code generation method. This -prevents the two previously mentioned issues, but will employ at least one -extra memcopy and thus increase memory requirements. - -For instance, consider the following two examples: - -This would be the default mode, using an extra memcopy but gives a safe -implementation without dependencies on `reflect` and `unsafe`: - -```go -func myfile() []byte { - return []byte{0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a} -} -``` - -Here is the same functionality, but uses the `.rodata` hack. -The byte slice returned from this example can not be written to without -generating a runtime error. - -```go -var _myfile = "\x89\x50\x4e\x47\x0d\x0a\x1a" - -func myfile() []byte { - var empty [0]byte - sx := (*reflect.StringHeader)(unsafe.Pointer(&_myfile)) - b := empty[:] - bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bx.Data = sx.Data - bx.Len = len(_myfile) - bx.Cap = bx.Len - return b -} -``` - - -### Optional compression - -When the `-nocompress` flag is given, the supplied resource is *not* GZIP -compressed before being turned into Go code. The data should still be accessed -through a function call, so nothing changes in the usage of the generated file. - -This feature is useful if you do not care for compression, or the supplied -resource is already compressed. Doing it again would not add any value and may -even increase the size of the data. - -The default behaviour of the program is to use compression. - - -### Path prefix stripping - -The keys used in the `_bindata` map, are the same as the input file name -passed to `go-bindata`. This includes the path. In most cases, this is not -desireable, as it puts potentially sensitive information in your code base. -For this purpose, the tool supplies another command line flag `-prefix`. -This accepts a portion of a path name, which should be stripped off from -the map keys and function names. - -For example, running without the `-prefix` flag, we get: - - $ go-bindata /path/to/templates/ - - _bindata["/path/to/templates/foo.html"] = path_to_templates_foo_html - -Running with the `-prefix` flag, we get: - - $ go-bindata -prefix "/path/to/" /path/to/templates/ - - _bindata["templates/foo.html"] = templates_foo_html - - -### Build tags - -With the optional `-tags` flag, you can specify any go build tags that -must be fulfilled for the output file to be included in a build. This -is useful when including binary data in multiple formats, where the desired -format is specified at build time with the appropriate tags. - -The tags are appended to a `// +build` line in the beginning of the output file -and must follow the build tags syntax specified by the go tool. - -### Serve assets with `net/http` - -With the `-fs` flag, `go-bindata` will add an `AssetFile()` method returning an `http.FileSystem` interface: - - $ go-bindata -fs -prefix "static/" static/ - -Use `-prefix` flag to strip first level dir, then in your `net/http` router, you can use `AssetFile()` with `http.FileServer()` like: - -```go -mux := http.NewServeMux() -mux.Handle("/static", http.FileServer(AssetFile())) -http.ListenAndServe(":8080", mux) -``` diff --git a/vendor/github.com/go-bindata/go-bindata/_config.yml b/vendor/github.com/go-bindata/go-bindata/_config.yml deleted file mode 100644 index c4192631f25..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-cayman \ No newline at end of file diff --git a/vendor/github.com/go-bindata/go-bindata/asset.go b/vendor/github.com/go-bindata/go-bindata/asset.go deleted file mode 100644 index 95b6b94f3c3..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/asset.go +++ /dev/null @@ -1,12 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -// Asset holds information about a single asset to be processed. -type Asset struct { - Path string // Full file path. - Name string // Key used in TOC -- name by which asset is referenced. - Func string // Function name for the procedure returning the asset contents. -} diff --git a/vendor/github.com/go-bindata/go-bindata/bytewriter.go b/vendor/github.com/go-bindata/go-bindata/bytewriter.go deleted file mode 100644 index 05d6d678092..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/bytewriter.go +++ /dev/null @@ -1,44 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "io" -) - -var ( - newline = []byte{'\n'} - dataindent = []byte{'\t', '\t'} - space = []byte{' '} -) - -type ByteWriter struct { - io.Writer - c int -} - -func (w *ByteWriter) Write(p []byte) (n int, err error) { - if len(p) == 0 { - return - } - - for n = range p { - if w.c%12 == 0 { - w.Writer.Write(newline) - w.Writer.Write(dataindent) - w.c = 0 - } else { - w.Writer.Write(space) - } - - fmt.Fprintf(w.Writer, "0x%02x,", p[n]) - w.c++ - } - - n++ - - return -} diff --git a/vendor/github.com/go-bindata/go-bindata/config.go b/vendor/github.com/go-bindata/go-bindata/config.go deleted file mode 100644 index 471c32f1b24..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/config.go +++ /dev/null @@ -1,208 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "os" - "path/filepath" - "regexp" -) - -// InputConfig defines options on a asset directory to be convert. -type InputConfig struct { - // Path defines a directory containing asset files to be included - // in the generated output. - Path string - - // Recusive defines whether subdirectories of Path - // should be recursively included in the conversion. - Recursive bool -} - -// Config defines a set of options for the asset conversion. -type Config struct { - // Name of the package to use. Defaults to 'main'. - Package string - - // Tags specify a set of optional build tags, which should be - // included in the generated output. The tags are appended to a - // `// +build` line in the beginning of the output file - // and must follow the build tags syntax specified by the go tool. - Tags string - - // Input defines the directory path, containing all asset files as - // well as whether to recursively process assets in any sub directories. - Input []InputConfig - - // Output defines the output file for the generated code. - // If left empty, this defaults to 'bindata.go' in the current - // working directory. - Output string - - // Prefix defines a path prefix which should be stripped from all - // file names when generating the keys in the table of contents. - // For example, running without the `-prefix` flag, we get: - // - // $ go-bindata /path/to/templates - // go_bindata["/path/to/templates/foo.html"] = _path_to_templates_foo_html - // - // Running with the `-prefix` flag, we get: - // - // $ go-bindata -prefix "/path/to/" /path/to/templates/foo.html - // go_bindata["templates/foo.html"] = templates_foo_html - Prefix string - - // NoMemCopy will alter the way the output file is generated. - // - // It will employ a hack that allows us to read the file data directly from - // the compiled program's `.rodata` section. This ensures that when we call - // call our generated function, we omit unnecessary mem copies. - // - // The downside of this, is that it requires dependencies on the `reflect` and - // `unsafe` packages. These may be restricted on platforms like AppEngine and - // thus prevent you from using this mode. - // - // Another disadvantage is that the byte slice we create, is strictly read-only. - // For most use-cases this is not a problem, but if you ever try to alter the - // returned byte slice, a runtime panic is thrown. Use this mode only on target - // platforms where memory constraints are an issue. - // - // The default behaviour is to use the old code generation method. This - // prevents the two previously mentioned issues, but will employ at least one - // extra memcopy and thus increase memory requirements. - // - // For instance, consider the following two examples: - // - // This would be the default mode, using an extra memcopy but gives a safe - // implementation without dependencies on `reflect` and `unsafe`: - // - // func myfile() []byte { - // return []byte{0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a} - // } - // - // Here is the same functionality, but uses the `.rodata` hack. - // The byte slice returned from this example can not be written to without - // generating a runtime error. - // - // var _myfile = "\x89\x50\x4e\x47\x0d\x0a\x1a" - // - // func myfile() []byte { - // var empty [0]byte - // sx := (*reflect.StringHeader)(unsafe.Pointer(&_myfile)) - // b := empty[:] - // bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - // bx.Data = sx.Data - // bx.Len = len(_myfile) - // bx.Cap = bx.Len - // return b - // } - NoMemCopy bool - - // NoCompress means the assets are /not/ GZIP compressed before being turned - // into Go code. The generated function will automatically unzip - // the file data when called. Defaults to false. - NoCompress bool - - // HttpFileSystem means whether generate return http.FileSystem interface - // instance's function.When true,will generate relate code. - HttpFileSystem bool - - // Perform a debug build. This generates an asset file, which - // loads the asset contents directly from disk at their original - // location, instead of embedding the contents in the code. - // - // This is mostly useful if you anticipate that the assets are - // going to change during your development cycle. You will always - // want your code to access the latest version of the asset. - // Only in release mode, will the assets actually be embedded - // in the code. The default behaviour is Release mode. - Debug bool - - // Perform a dev build, which is nearly identical to the debug option. The - // only difference is that instead of absolute file paths in generated code, - // it expects a variable, `rootDir`, to be set in the generated code's - // package (the author needs to do this manually), which it then prepends to - // an asset's name to construct the file path on disk. - // - // This is mainly so you can push the generated code file to a shared - // repository. - Dev bool - - // When true, size, mode and modtime are not preserved from files - NoMetadata bool - // When nonzero, use this as mode for all files. - Mode uint - // When nonzero, use this as unix timestamp for all files. - ModTime int64 - - // Ignores any filenames matching the regex pattern specified, e.g. - // path/to/file.ext will ignore only that file, or \\.gitignore - // will match any .gitignore file. - // - // This parameter can be provided multiple times. - Ignore []*regexp.Regexp -} - -// NewConfig returns a default configuration struct. -func NewConfig() *Config { - c := new(Config) - c.Package = "main" - c.NoMemCopy = false - c.NoCompress = false - c.HttpFileSystem = false - c.Debug = false - c.Output = "./bindata.go" - c.Ignore = make([]*regexp.Regexp, 0) - return c -} - -// validate ensures the config has sane values. -// Part of which means checking if certain file/directory paths exist. -func (c *Config) validate() error { - if len(c.Package) == 0 { - return fmt.Errorf("Missing package name") - } - - for _, input := range c.Input { - _, err := os.Lstat(input.Path) - if err != nil { - return fmt.Errorf("Failed to stat input path '%s': %v", input.Path, err) - } - } - - if len(c.Output) == 0 { - cwd, err := os.Getwd() - if err != nil { - return fmt.Errorf("Unable to determine current working directory.") - } - - c.Output = filepath.Join(cwd, "bindata.go") - } - - stat, err := os.Lstat(c.Output) - if err != nil { - if !os.IsNotExist(err) { - return fmt.Errorf("Output path: %v", err) - } - - // File does not exist. This is fine, just make - // sure the directory it is to be in exists. - dir, _ := filepath.Split(c.Output) - if dir != "" { - err = os.MkdirAll(dir, 0744) - - if err != nil { - return fmt.Errorf("Create output directory: %v", err) - } - } - } - - if stat != nil && stat.IsDir() { - return fmt.Errorf("Output path is a directory.") - } - - return nil -} diff --git a/vendor/github.com/go-bindata/go-bindata/convert.go b/vendor/github.com/go-bindata/go-bindata/convert.go deleted file mode 100644 index 8660ee9f4a9..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/convert.go +++ /dev/null @@ -1,261 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "bufio" - "fmt" - "os" - "path/filepath" - "regexp" - "sort" - "strings" - "unicode" -) - -// Translate reads assets from an input directory, converts them -// to Go code and writes new files to the output specified -// in the given configuration. -func Translate(c *Config) error { - var toc []Asset - - // Ensure our configuration has sane values. - err := c.validate() - if err != nil { - return err - } - - var knownFuncs = make(map[string]int) - var visitedPaths = make(map[string]bool) - // Locate all the assets. - for _, input := range c.Input { - err = findFiles(input.Path, c.Prefix, input.Recursive, &toc, c.Ignore, knownFuncs, visitedPaths) - if err != nil { - return err - } - } - - // Create output file. - fd, err := os.Create(c.Output) - if err != nil { - return err - } - - defer fd.Close() - - // Create a buffered writer for better performance. - bfd := bufio.NewWriter(fd) - defer bfd.Flush() - - // Write the header. This makes e.g. Github ignore diffs in generated files. - if _, err = fmt.Fprintf(bfd, "// Code generated for package %s by go-bindata DO NOT EDIT. (@generated)\n", c.Package); err != nil { - return err - } - if _, err = fmt.Fprint(bfd, "// sources:\n"); err != nil { - return err - } - - wd, err := os.Getwd() - if err != nil { - return err - } - - for _, asset := range toc { - relative, _ := filepath.Rel(wd, asset.Path) - if _, err = fmt.Fprintf(bfd, "// %s\n", filepath.ToSlash(relative)); err != nil { - return err - } - } - //if _, err = fmt.Fprint(bfd, "// DO NOT EDIT!\n\n"); err != nil { - // return err - //} - - // Write build tags, if applicable. - if len(c.Tags) > 0 { - if _, err = fmt.Fprintf(bfd, "// +build %s\n\n", c.Tags); err != nil { - return err - } - } - - // Write package declaration. - _, err = fmt.Fprintf(bfd, "package %s\n\n", c.Package) - if err != nil { - return err - } - - // Write assets. - if c.Debug || c.Dev { - err = writeDebug(bfd, c, toc) - } else { - err = writeRelease(bfd, c, toc) - } - - if err != nil { - return err - } - - // Write table of contents - if err := writeTOC(bfd, toc); err != nil { - return err - } - // Write hierarchical tree of assets - if err := writeTOCTree(bfd, toc); err != nil { - return err - } - - // Write restore procedure - return writeRestore(bfd) -} - -// ByName implements sort.Interface for []os.FileInfo based on Name() -type ByName []os.FileInfo - -func (v ByName) Len() int { return len(v) } -func (v ByName) Swap(i, j int) { v[i], v[j] = v[j], v[i] } -func (v ByName) Less(i, j int) bool { return v[i].Name() < v[j].Name() } - -// findFiles recursively finds all the file paths in the given directory tree. -// They are added to the given map as keys. Values will be safe function names -// for each file, which will be used when generating the output code. -func findFiles(dir, prefix string, recursive bool, toc *[]Asset, ignore []*regexp.Regexp, knownFuncs map[string]int, visitedPaths map[string]bool) error { - dirpath := dir - if len(prefix) > 0 { - dirpath, _ = filepath.Abs(dirpath) - prefix, _ = filepath.Abs(prefix) - prefix = filepath.ToSlash(prefix) - } - - fi, err := os.Stat(dirpath) - if err != nil { - return err - } - - var list []os.FileInfo - - if !fi.IsDir() { - dirpath = filepath.Dir(dirpath) - list = []os.FileInfo{fi} - } else { - visitedPaths[dirpath] = true - fd, err := os.Open(dirpath) - if err != nil { - return err - } - - defer fd.Close() - - list, err = fd.Readdir(0) - if err != nil { - return err - } - - // Sort to make output stable between invocations - sort.Sort(ByName(list)) - } - - for _, file := range list { - var asset Asset - asset.Path = filepath.Join(dirpath, file.Name()) - asset.Name = filepath.ToSlash(asset.Path) - - ignoring := false - for _, re := range ignore { - if re.MatchString(asset.Path) { - ignoring = true - break - } - } - if ignoring { - continue - } - - if file.IsDir() { - if recursive { - recursivePath := filepath.Join(dir, file.Name()) - visitedPaths[asset.Path] = true - findFiles(recursivePath, prefix, recursive, toc, ignore, knownFuncs, visitedPaths) - } - continue - } else if file.Mode()&os.ModeSymlink == os.ModeSymlink { - var linkPath string - if linkPath, err = os.Readlink(asset.Path); err != nil { - return err - } - if !filepath.IsAbs(linkPath) { - if linkPath, err = filepath.Abs(dirpath + "/" + linkPath); err != nil { - return err - } - } - if _, ok := visitedPaths[linkPath]; !ok { - visitedPaths[linkPath] = true - findFiles(asset.Path, prefix, recursive, toc, ignore, knownFuncs, visitedPaths) - } - continue - } - - if strings.HasPrefix(asset.Name, prefix) { - asset.Name = asset.Name[len(prefix):] - } else { - asset.Name = filepath.Join(dir, file.Name()) - } - - // If we have a leading slash, get rid of it. - if len(asset.Name) > 0 && asset.Name[0] == '/' { - asset.Name = asset.Name[1:] - } - - // This shouldn't happen. - if len(asset.Name) == 0 { - return fmt.Errorf("Invalid file: %v", asset.Path) - } - - asset.Func = safeFunctionName(asset.Name, knownFuncs) - asset.Path, _ = filepath.Abs(asset.Path) - *toc = append(*toc, asset) - } - - return nil -} - -var regFuncName = regexp.MustCompile(`[^a-zA-Z0-9_]`) - -// safeFunctionName converts the given name into a name -// which qualifies as a valid function identifier. It -// also compares against a known list of functions to -// prevent conflict based on name translation. -func safeFunctionName(name string, knownFuncs map[string]int) string { - var inBytes, outBytes []byte - var toUpper bool - - name = strings.ToLower(name) - inBytes = []byte(name) - - for i := 0; i < len(inBytes); i++ { - if regFuncName.Match([]byte{inBytes[i]}) { - toUpper = true - } else if toUpper { - outBytes = append(outBytes, []byte(strings.ToUpper(string(inBytes[i])))...) - toUpper = false - } else { - outBytes = append(outBytes, inBytes[i]) - } - } - - name = string(outBytes) - - // Identifier can't start with a digit. - if unicode.IsDigit(rune(name[0])) { - name = "_" + name - } - - if num, ok := knownFuncs[name]; ok { - knownFuncs[name] = num + 1 - name = fmt.Sprintf("%s%d", name, num) - } else { - knownFuncs[name] = 2 - } - - return name -} diff --git a/vendor/github.com/go-bindata/go-bindata/debug.go b/vendor/github.com/go-bindata/go-bindata/debug.go deleted file mode 100644 index edb3270d6da..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/debug.go +++ /dev/null @@ -1,108 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "io" -) - -// writeDebug writes the debug code file. -func writeDebug(w io.Writer, c *Config, toc []Asset) error { - err := writeDebugHeader(w, c) - if err != nil { - return err - } - - err = writeAssetFS(w, c) - if err != nil { - return err - } - - for i := range toc { - err = writeDebugAsset(w, c, &toc[i]) - if err != nil { - return err - } - } - - return nil -} - -// writeDebugHeader writes output file headers. -// This targets debug builds. -func writeDebugHeader(w io.Writer, c *Config) error { - var header string - - if c.HttpFileSystem { - header = `import ( - "bytes" - "net/http" - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } else { - header = `import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings"` - } - - _, err := fmt.Fprintf(w, `%s -) - -// bindataRead reads the given file from disk. It returns an error on failure. -func bindataRead(path, name string) ([]byte, error) { - buf, err := ioutil.ReadFile(path) - if err != nil { - err = fmt.Errorf("Error reading asset %%s at %%s: %%v", name, path, err) - } - return buf, err -} - -type asset struct { - bytes []byte - info os.FileInfo -} - -`, header) - return err -} - -// writeDebugAsset write a debug entry for the given asset. -// A debug entry is simply a function which reads the asset from -// the original file (e.g.: from disk). -func writeDebugAsset(w io.Writer, c *Config, asset *Asset) error { - pathExpr := fmt.Sprintf("%q", asset.Path) - if c.Dev { - pathExpr = fmt.Sprintf("filepath.Join(rootDir, %q)", asset.Name) - } - - _, err := fmt.Fprintf(w, `// %s reads file data from disk. It returns an error on failure. -func %s() (*asset, error) { - path := %s - name := %q - bytes, err := bindataRead(path, name) - if err != nil { - return nil, err - } - - fi, err := os.Stat(path) - if err != nil { - err = fmt.Errorf("Error reading asset info %%s at %%s: %%v", name, path, err) - } - - a := &asset{bytes: bytes, info: fi} - return a, err -} - -`, asset.Func, asset.Func, pathExpr, asset.Name) - return err -} diff --git a/vendor/github.com/go-bindata/go-bindata/doc.go b/vendor/github.com/go-bindata/go-bindata/doc.go deleted file mode 100644 index 09ead1e3bac..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/doc.go +++ /dev/null @@ -1,129 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -/* -bindata converts any file into managable Go source code. Useful for -embedding binary data into a go program. The file data is optionally gzip -compressed before being converted to a raw byte slice. - -The following paragraphs cover some of the customization options -which can be specified in the Config struct, which must be passed into -the Translate() call. - - -Debug vs Release builds - -When used with the `Debug` option, the generated code does not actually include -the asset data. Instead, it generates function stubs which load the data from -the original file on disk. The asset API remains identical between debug and -release builds, so your code will not have to change. - -This is useful during development when you expect the assets to change often. -The host application using these assets uses the same API in both cases and -will not have to care where the actual data comes from. - -An example is a Go webserver with some embedded, static web content like -HTML, JS and CSS files. While developing it, you do not want to rebuild the -whole server and restart it every time you make a change to a bit of -javascript. You just want to build and launch the server once. Then just press -refresh in the browser to see those changes. Embedding the assets with the -`debug` flag allows you to do just that. When you are finished developing and -ready for deployment, just re-invoke `go-bindata` without the `-debug` flag. -It will now embed the latest version of the assets. - - -Lower memory footprint - -The `NoMemCopy` option will alter the way the output file is generated. -It will employ a hack that allows us to read the file data directly from -the compiled program's `.rodata` section. This ensures that when we call -call our generated function, we omit unnecessary memcopies. - -The downside of this, is that it requires dependencies on the `reflect` and -`unsafe` packages. These may be restricted on platforms like AppEngine and -thus prevent you from using this mode. - -Another disadvantage is that the byte slice we create, is strictly read-only. -For most use-cases this is not a problem, but if you ever try to alter the -returned byte slice, a runtime panic is thrown. Use this mode only on target -platforms where memory constraints are an issue. - -The default behaviour is to use the old code generation method. This -prevents the two previously mentioned issues, but will employ at least one -extra memcopy and thus increase memory requirements. - -For instance, consider the following two examples: - -This would be the default mode, using an extra memcopy but gives a safe -implementation without dependencies on `reflect` and `unsafe`: - - func myfile() []byte { - return []byte{0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a} - } - -Here is the same functionality, but uses the `.rodata` hack. -The byte slice returned from this example can not be written to without -generating a runtime error. - - var _myfile = "\x89\x50\x4e\x47\x0d\x0a\x1a" - - func myfile() []byte { - var empty [0]byte - sx := (*reflect.StringHeader)(unsafe.Pointer(&_myfile)) - b := empty[:] - bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bx.Data = sx.Data - bx.Len = len(_myfile) - bx.Cap = bx.Len - return b - } - - -Optional compression - -The NoCompress option indicates that the supplied assets are *not* GZIP -compressed before being turned into Go code. The data should still be accessed -through a function call, so nothing changes in the API. - -This feature is useful if you do not care for compression, or the supplied -resource is already compressed. Doing it again would not add any value and may -even increase the size of the data. - -The default behaviour of the program is to use compression. - - -Path prefix stripping - -The keys used in the `_bindata` map are the same as the input file name -passed to `go-bindata`. This includes the path. In most cases, this is not -desireable, as it puts potentially sensitive information in your code base. -For this purpose, the tool supplies another command line flag `-prefix`. -This accepts a portion of a path name, which should be stripped off from -the map keys and function names. - -For example, running without the `-prefix` flag, we get: - - $ go-bindata /path/to/templates/ - - _bindata["/path/to/templates/foo.html"] = path_to_templates_foo_html - -Running with the `-prefix` flag, we get: - - $ go-bindata -prefix "/path/to/" /path/to/templates/ - - _bindata["templates/foo.html"] = templates_foo_html - - -Build tags - -With the optional Tags field, you can specify any go build tags that -must be fulfilled for the output file to be included in a build. This -is useful when including binary data in multiple formats, where the desired -format is specified at build time with the appropriate tags. - -The tags are appended to a `// +build` line in the beginning of the output file -and must follow the build tags syntax specified by the go tool. - -*/ -package bindata diff --git a/vendor/github.com/go-bindata/go-bindata/file.go b/vendor/github.com/go-bindata/go-bindata/file.go deleted file mode 100644 index 8c83926c8ab..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/file.go +++ /dev/null @@ -1,102 +0,0 @@ -package bindata - -import ( - "fmt" - "io" -) - -func writeAssetFS(w io.Writer, c *Config) error { - if !c.HttpFileSystem { - return nil - } - - _, err := fmt.Fprintf(w, ` -type assetFile struct { - *bytes.Reader - name string - childInfos []os.FileInfo - childInfoOffset int -} - -type assetOperator struct{} - -// Open implement http.FileSystem interface -func (f *assetOperator) Open(name string) (http.File, error) { - var err error - if len(name) > 0 && name[0] == '/' { - name = name[1:] - } - content, err := Asset(name) - if err == nil { - return &assetFile{name: name, Reader: bytes.NewReader(content)}, nil - } - children, err := AssetDir(name) - if err == nil { - childInfos := make([]os.FileInfo, 0, len(children)) - for _, child := range children { - childPath := filepath.Join(name, child) - info, errInfo := AssetInfo(filepath.Join(name, child)) - if errInfo == nil { - childInfos = append(childInfos, info) - } else { - childInfos = append(childInfos, newDirFileInfo(childPath)) - } - } - return &assetFile{name: name, childInfos: childInfos}, nil - } else { - // If the error is not found, return an error that will - // result in a 404 error. Otherwise the server returns - // a 500 error for files not found. - if strings.Contains(err.Error(), "not found") { - return nil, os.ErrNotExist - } - return nil, err - } -} - -// Close no need do anything -func (f *assetFile) Close() error { - return nil -} - -// Readdir read dir's children file info -func (f *assetFile) Readdir(count int) ([]os.FileInfo, error) { - if len(f.childInfos) == 0 { - return nil, os.ErrNotExist - } - if count <= 0 { - return f.childInfos, nil - } - if f.childInfoOffset+count > len(f.childInfos) { - count = len(f.childInfos) - f.childInfoOffset - } - offset := f.childInfoOffset - f.childInfoOffset += count - return f.childInfos[offset : offset+count], nil -} - -// Stat read file info from asset item -func (f *assetFile) Stat() (os.FileInfo, error) { - if len(f.childInfos) != 0 { - return newDirFileInfo(f.name), nil - } - return AssetInfo(f.name) -} - -// newDirFileInfo return default dir file info -func newDirFileInfo(name string) os.FileInfo { - return &bindataFileInfo{ - name: name, - size: 0, - mode: os.FileMode(2147484068), // equal os.FileMode(0644)|os.ModeDir - modTime: time.Time{}} -} - -// AssetFile return a http.FileSystem instance that data backend by asset -func AssetFile() http.FileSystem { - return &assetOperator{} -} - -`) - return err -} diff --git a/vendor/github.com/go-bindata/go-bindata/go-bindata/.gitignore b/vendor/github.com/go-bindata/go-bindata/go-bindata/.gitignore deleted file mode 100644 index 099edf6f9f0..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/go-bindata/.gitignore +++ /dev/null @@ -1 +0,0 @@ -go-bindata diff --git a/vendor/github.com/go-bindata/go-bindata/go-bindata/AppendSliceValue.go b/vendor/github.com/go-bindata/go-bindata/go-bindata/AppendSliceValue.go deleted file mode 100644 index f5da495961b..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/go-bindata/AppendSliceValue.go +++ /dev/null @@ -1,22 +0,0 @@ -package main - -import "strings" - -// borrowed from https://github.com/hashicorp/serf/blob/master/command/agent/flag_slice_value.go - -// AppendSliceValue implements the flag.Value interface and allows multiple -// calls to the same variable to append a list. -type AppendSliceValue []string - -func (s *AppendSliceValue) String() string { - return strings.Join(*s, ",") -} - -func (s *AppendSliceValue) Set(value string) error { - if *s == nil { - *s = make([]string, 0, 1) - } - - *s = append(*s, value) - return nil -} diff --git a/vendor/github.com/go-bindata/go-bindata/go-bindata/main.go b/vendor/github.com/go-bindata/go-bindata/go-bindata/main.go deleted file mode 100644 index f0155a5d035..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/go-bindata/main.go +++ /dev/null @@ -1,108 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package main - -import ( - "flag" - "fmt" - "os" - "path/filepath" - "regexp" - "strings" - - "github.com/go-bindata/go-bindata" -) - -func main() { - cfg := parseArgs() - err := bindata.Translate(cfg) - - if err != nil { - fmt.Fprintf(os.Stderr, "bindata: %v\n", err) - os.Exit(1) - } -} - -// parseArgs create s a new, filled configuration instance -// by reading and parsing command line options. -// -// This function exits the program with an error, if -// any of the command line options are incorrect. -func parseArgs() *bindata.Config { - var version bool - - c := bindata.NewConfig() - - flag.Usage = func() { - fmt.Printf("Usage: %s [options] \n\n", os.Args[0]) - flag.PrintDefaults() - } - - flag.BoolVar(&c.Debug, "debug", c.Debug, "Do not embed the assets, but provide the embedding API. Contents will still be loaded from disk.") - flag.BoolVar(&c.Dev, "dev", c.Dev, "Similar to debug, but does not emit absolute paths. Expects a rootDir variable to already exist in the generated code's package.") - flag.StringVar(&c.Tags, "tags", c.Tags, "Optional set of build tags to include.") - flag.StringVar(&c.Prefix, "prefix", c.Prefix, "Optional path prefix to strip off asset names.") - flag.StringVar(&c.Package, "pkg", c.Package, "Package name to use in the generated code.") - flag.BoolVar(&c.NoMemCopy, "nomemcopy", c.NoMemCopy, "Use a .rodata hack to get rid of unnecessary memcopies. Refer to the documentation to see what implications this carries.") - flag.BoolVar(&c.NoCompress, "nocompress", c.NoCompress, "Assets will *not* be GZIP compressed when this flag is specified.") - flag.BoolVar(&c.NoMetadata, "nometadata", c.NoMetadata, "Assets will not preserve size, mode, and modtime info.") - flag.BoolVar(&c.HttpFileSystem, "fs", c.HttpFileSystem, "Whether generate instance http.FileSystem interface code.") - flag.UintVar(&c.Mode, "mode", c.Mode, "Optional file mode override for all files.") - flag.Int64Var(&c.ModTime, "modtime", c.ModTime, "Optional modification unix timestamp override for all files.") - flag.StringVar(&c.Output, "o", c.Output, "Optional name of the output file to be generated.") - flag.BoolVar(&version, "version", false, "Displays version information.") - - ignore := make([]string, 0) - flag.Var((*AppendSliceValue)(&ignore), "ignore", "Regex pattern to ignore") - - flag.Parse() - - patterns := make([]*regexp.Regexp, 0) - for _, pattern := range ignore { - patterns = append(patterns, regexp.MustCompile(pattern)) - } - c.Ignore = patterns - - if version { - fmt.Printf("%s\n", Version()) - os.Exit(0) - } - - // Make sure we have input paths. - if flag.NArg() == 0 { - fmt.Fprintf(os.Stderr, "Missing \n\n") - flag.Usage() - os.Exit(1) - } - - // Create input configurations. - c.Input = make([]bindata.InputConfig, flag.NArg()) - for i := range c.Input { - c.Input[i] = parseInput(flag.Arg(i)) - } - - return c -} - -// parseRecursive determines whether the given path has a recrusive indicator and -// returns a new path with the recursive indicator chopped off if it does. -// -// ex: -// /path/to/foo/... -> (/path/to/foo, true) -// /path/to/bar -> (/path/to/bar, false) -func parseInput(path string) bindata.InputConfig { - if strings.HasSuffix(path, "/...") { - return bindata.InputConfig{ - Path: filepath.Clean(path[:len(path)-4]), - Recursive: true, - } - } else { - return bindata.InputConfig{ - Path: filepath.Clean(path), - Recursive: false, - } - } - -} diff --git a/vendor/github.com/go-bindata/go-bindata/go-bindata/version.go b/vendor/github.com/go-bindata/go-bindata/go-bindata/version.go deleted file mode 100644 index 5a4cfb7943a..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/go-bindata/version.go +++ /dev/null @@ -1,31 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package main - -import ( - "fmt" - "runtime" -) - -const ( - AppName = "go-bindata" - AppVersionMajor = 3 - AppVersionMinor = 1 -) - -// revision part of the program version. -// This will be set automatically at build time like so: -// -// go build -ldflags "-X main.AppVersionRev `date -u +%s`" -var AppVersionRev string - -func Version() string { - if len(AppVersionRev) == 0 { - AppVersionRev = "2" - } - - return fmt.Sprintf("%s %d.%d.%s (Go runtime %s).\nCopyright (c) 2010-2013, Jim Teeuwen.", - AppName, AppVersionMajor, AppVersionMinor, AppVersionRev, runtime.Version()) -} diff --git a/vendor/github.com/go-bindata/go-bindata/release.go b/vendor/github.com/go-bindata/go-bindata/release.go deleted file mode 100644 index d1bef160f4a..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/release.go +++ /dev/null @@ -1,473 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "os" - "unicode/utf8" -) - -// writeRelease writes the release code file. -func writeRelease(w io.Writer, c *Config, toc []Asset) error { - err := writeReleaseHeader(w, c) - if err != nil { - return err - } - - err = writeAssetFS(w, c) - if err != nil { - return err - } - - for i := range toc { - err = writeReleaseAsset(w, c, &toc[i]) - if err != nil { - return err - } - } - - return nil -} - -// writeReleaseHeader writes output file headers. -// This targets release builds. -func writeReleaseHeader(w io.Writer, c *Config) error { - var err error - if c.NoCompress { - if c.NoMemCopy { - err = header_uncompressed_nomemcopy(w, c) - } else { - err = header_uncompressed_memcopy(w, c) - } - } else { - if c.NoMemCopy { - err = header_compressed_nomemcopy(w, c) - } else { - err = header_compressed_memcopy(w, c) - } - } - if err != nil { - return err - } - return header_release_common(w) -} - -// writeReleaseAsset write a release entry for the given asset. -// A release entry is a function which embeds and returns -// the file's byte content. -func writeReleaseAsset(w io.Writer, c *Config, asset *Asset) error { - fd, err := os.Open(asset.Path) - if err != nil { - return err - } - - defer fd.Close() - - if c.NoCompress { - if c.NoMemCopy { - err = uncompressed_nomemcopy(w, asset, fd) - } else { - err = uncompressed_memcopy(w, asset, fd) - } - } else { - if c.NoMemCopy { - err = compressed_nomemcopy(w, asset, fd) - } else { - err = compressed_memcopy(w, asset, fd) - } - } - if err != nil { - return err - } - return asset_release_common(w, c, asset) -} - -// sanitize prepares a valid UTF-8 string as a raw string constant. -// Based on https://code.google.com/p/go/source/browse/godoc/static/makestatic.go?repo=tools -func sanitize(b []byte) []byte { - // Replace ` with `+"`"+` - b = bytes.Replace(b, []byte("`"), []byte("`+\"`\"+`"), -1) - - // Replace BOM with `+"\xEF\xBB\xBF"+` - // (A BOM is valid UTF-8 but not permitted in Go source files. - // I wouldn't bother handling this, but for some insane reason - // jquery.js has a BOM somewhere in the middle.) - return bytes.Replace(b, []byte("\xEF\xBB\xBF"), []byte("`+\"\\xEF\\xBB\\xBF\"+`"), -1) -} - -func header_compressed_nomemcopy(w io.Writer, c *Config) error { - var header string - - if c.HttpFileSystem { - header = `import ( - "bytes" - "compress/gzip" - "fmt" - "net/http" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } else { - header = `import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } - - _, err := fmt.Fprintf(w, `%s -) - -func bindataRead(data, name string) ([]byte, error) { - gz, err := gzip.NewReader(strings.NewReader(data)) - if err != nil { - return nil, fmt.Errorf("Read %%q: %%v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - clErr := gz.Close() - - if err != nil { - return nil, fmt.Errorf("Read %%q: %%v", name, err) - } - if clErr != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -`, header) - return err -} - -func header_compressed_memcopy(w io.Writer, c *Config) error { - var header string - - if c.HttpFileSystem { - header = `import ( - "bytes" - "compress/gzip" - "fmt" - "net/http" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } else { - header = `import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } - - _, err := fmt.Fprintf(w, `%s -) - -func bindataRead(data []byte, name string) ([]byte, error) { - gz, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - return nil, fmt.Errorf("Read %%q: %%v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - clErr := gz.Close() - - if err != nil { - return nil, fmt.Errorf("Read %%q: %%v", name, err) - } - if clErr != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -`, header) - return err -} - -func header_uncompressed_nomemcopy(w io.Writer, c *Config) error { - var header string - - if c.HttpFileSystem { - header = `import ( - "bytes" - "fmt" - "net/http" - "io/ioutil" - "os" - "path/filepath" - "reflect" - "strings" - "time" - "unsafe"` - } else { - header = `import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "reflect" - "strings" - "time" - "unsafe"` - } - - _, err := fmt.Fprintf(w, `%s -) - -func bindataRead(data, name string) ([]byte, error) { - var empty [0]byte - sx := (*reflect.StringHeader)(unsafe.Pointer(&data)) - b := empty[:] - bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bx.Data = sx.Data - bx.Len = len(data) - bx.Cap = bx.Len - return b, nil -} - -`, header) - return err -} - -func header_uncompressed_memcopy(w io.Writer, c *Config) error { - var header string - - if c.HttpFileSystem { - header = `import ( - "bytes" - "fmt" - "net/http" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } else { - header = `import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } - - _, err := fmt.Fprintf(w, `%s -) -`, header) - return err -} - -func header_release_common(w io.Writer) error { - _, err := fmt.Fprintf(w, `type asset struct { - bytes []byte - info os.FileInfo -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -// Name return file name -func (fi bindataFileInfo) Name() string { - return fi.name -} - -// Size return file size -func (fi bindataFileInfo) Size() int64 { - return fi.size -} - -// Mode return file mode -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} - -// Mode return file modify time -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} - -// IsDir return file whether a directory -func (fi bindataFileInfo) IsDir() bool { - return fi.mode&os.ModeDir != 0 -} - -// Sys return file is sys mode -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -`) - return err -} - -func compressed_nomemcopy(w io.Writer, asset *Asset, r io.Reader) error { - _, err := fmt.Fprintf(w, `var _%s = "`, asset.Func) - if err != nil { - return err - } - - gz := gzip.NewWriter(&StringWriter{Writer: w}) - _, err = io.Copy(gz, r) - gz.Close() - - if err != nil { - return err - } - - _, err = fmt.Fprintf(w, `" - -func %sBytes() ([]byte, error) { - return bindataRead( - _%s, - %q, - ) -} - -`, asset.Func, asset.Func, asset.Name) - return err -} - -func compressed_memcopy(w io.Writer, asset *Asset, r io.Reader) error { - _, err := fmt.Fprintf(w, `var _%s = []byte("`, asset.Func) - if err != nil { - return err - } - - gz := gzip.NewWriter(&StringWriter{Writer: w}) - _, err = io.Copy(gz, r) - gz.Close() - - if err != nil { - return err - } - - _, err = fmt.Fprintf(w, `") - -func %sBytes() ([]byte, error) { - return bindataRead( - _%s, - %q, - ) -} - -`, asset.Func, asset.Func, asset.Name) - return err -} - -func uncompressed_nomemcopy(w io.Writer, asset *Asset, r io.Reader) error { - _, err := fmt.Fprintf(w, `var _%s = "`, asset.Func) - if err != nil { - return err - } - - _, err = io.Copy(&StringWriter{Writer: w}, r) - if err != nil { - return err - } - - _, err = fmt.Fprintf(w, `" - -func %sBytes() ([]byte, error) { - return bindataRead( - _%s, - %q, - ) -} - -`, asset.Func, asset.Func, asset.Name) - return err -} - -func uncompressed_memcopy(w io.Writer, asset *Asset, r io.Reader) error { - _, err := fmt.Fprintf(w, `var _%s = []byte(`, asset.Func) - if err != nil { - return err - } - - b, err := ioutil.ReadAll(r) - if err != nil { - return err - } - if utf8.Valid(b) && !bytes.Contains(b, []byte{0}) { - fmt.Fprintf(w, "`%s`", sanitize(b)) - } else { - fmt.Fprintf(w, "%+q", b) - } - - _, err = fmt.Fprintf(w, `) - -func %sBytes() ([]byte, error) { - return _%s, nil -} - -`, asset.Func, asset.Func) - return err -} - -func asset_release_common(w io.Writer, c *Config, asset *Asset) error { - fi, err := os.Stat(asset.Path) - if err != nil { - return err - } - - mode := uint(fi.Mode()) - modTime := fi.ModTime().Unix() - size := fi.Size() - if c.NoMetadata { - mode = 0 - modTime = 0 - size = 0 - } - if c.Mode > 0 { - mode = uint(os.ModePerm) & c.Mode - } - if c.ModTime > 0 { - modTime = c.ModTime - } - _, err = fmt.Fprintf(w, `func %s() (*asset, error) { - bytes, err := %sBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: %q, size: %d, mode: os.FileMode(%d), modTime: time.Unix(%d, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -`, asset.Func, asset.Func, asset.Name, size, mode, modTime) - return err -} diff --git a/vendor/github.com/go-bindata/go-bindata/restore.go b/vendor/github.com/go-bindata/go-bindata/restore.go deleted file mode 100644 index 268ec7464e2..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/restore.go +++ /dev/null @@ -1,62 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "io" -) - -func writeRestore(w io.Writer) error { - _, err := fmt.Fprintf(w, ` -// RestoreAsset restores an asset under the given directory -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil -} - -// RestoreAssets restores an asset under the given directory recursively -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) -} -`) - return err -} diff --git a/vendor/github.com/go-bindata/go-bindata/stringwriter.go b/vendor/github.com/go-bindata/go-bindata/stringwriter.go deleted file mode 100644 index 77daa04cb54..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/stringwriter.go +++ /dev/null @@ -1,36 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "io" -) - -const lowerHex = "0123456789abcdef" - -type StringWriter struct { - io.Writer - c int -} - -func (w *StringWriter) Write(p []byte) (n int, err error) { - if len(p) == 0 { - return - } - - buf := []byte(`\x00`) - var b byte - - for n, b = range p { - buf[2] = lowerHex[b/16] - buf[3] = lowerHex[b%16] - w.Writer.Write(buf) - w.c++ - } - - n++ - - return -} diff --git a/vendor/github.com/go-bindata/go-bindata/toc.go b/vendor/github.com/go-bindata/go-bindata/toc.go deleted file mode 100644 index be4a01654b5..00000000000 --- a/vendor/github.com/go-bindata/go-bindata/toc.go +++ /dev/null @@ -1,288 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "io" - "sort" - "strings" -) - -type assetTree struct { - Asset Asset - Children map[string]*assetTree -} - -func newAssetTree() *assetTree { - tree := &assetTree{} - tree.Children = make(map[string]*assetTree) - return tree -} - -func (node *assetTree) child(name string) *assetTree { - rv, ok := node.Children[name] - if !ok { - rv = newAssetTree() - node.Children[name] = rv - } - return rv -} - -func (root *assetTree) Add(route []string, asset Asset) { - for _, name := range route { - root = root.child(name) - } - root.Asset = asset -} - -func ident(w io.Writer, n int) { - for i := 0; i < n; i++ { - w.Write([]byte{'\t'}) - } -} - -func (root *assetTree) funcOrNil() string { - if root.Asset.Func == "" { - return "nil" - } else { - return root.Asset.Func - } -} - -func getFillerSize(tokenIndex int, lengths []int, nident int) int { - var ( - curlen int = lengths[tokenIndex] - maxlen int = 0 - substart int = 0 - subend int = 0 - spacediff int = 0 - ) - - if curlen > 0 { - substart = tokenIndex - for (substart-1) >= 0 && lengths[substart-1] > 0 { - substart -= 1 - } - - subend = tokenIndex - for (subend+1) < len(lengths) && lengths[subend+1] > 0 { - subend += 1 - } - - var candidate int - for j := substart; j <= subend; j += 1 { - candidate = lengths[j] - if candidate > maxlen { - maxlen = candidate - } - } - - spacediff = maxlen - curlen - } - - return spacediff -} - -func (root *assetTree) writeGoMap(w io.Writer, nident int) { - fmt.Fprintf(w, "&bintree{%s, map[string]*bintree{", root.funcOrNil()) - - if len(root.Children) > 0 { - io.WriteString(w, "\n") - - // Sort to make output stable between invocations - filenames := make([]string, len(root.Children)) - hasChildren := make(map[string]bool) - i := 0 - for filename, node := range root.Children { - filenames[i] = filename - hasChildren[filename] = len(node.Children) > 0 - i++ - } - sort.Strings(filenames) - - lengths := make([]int, len(root.Children)) - for i, filename := range filenames { - if hasChildren[filename] { - lengths[i] = 0 - } else { - lengths[i] = len(filename) - } - } - - for i, p := range filenames { - ident(w, nident+1) - filler := strings.Repeat(" ", getFillerSize(i, lengths, nident)) - fmt.Fprintf(w, `"%s": %s`, p, filler) - root.Children[p].writeGoMap(w, nident+1) - } - ident(w, nident) - } - - io.WriteString(w, "}}") - if nident > 0 { - io.WriteString(w, ",") - } - io.WriteString(w, "\n") -} - -func (root *assetTree) WriteAsGoMap(w io.Writer) error { - _, err := fmt.Fprint(w, `type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} - -var _bintree = `) - root.writeGoMap(w, 0) - return err -} - -func writeTOCTree(w io.Writer, toc []Asset) error { - _, err := fmt.Fprintf(w, `// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %%s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %%s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -`) - if err != nil { - return err - } - tree := newAssetTree() - for i := range toc { - pathList := strings.Split(toc[i].Name, "/") - tree.Add(pathList, toc[i]) - } - return tree.WriteAsGoMap(w) -} - -// writeTOC writes the table of contents file. -func writeTOC(w io.Writer, toc []Asset) error { - err := writeTOCHeader(w) - if err != nil { - return err - } - - var maxlen = 0 - for i := range toc { - l := len(toc[i].Name) - if l > maxlen { - maxlen = l - } - } - - for i := range toc { - err = writeTOCAsset(w, &toc[i], maxlen) - if err != nil { - return err - } - } - - return writeTOCFooter(w) -} - -// writeTOCHeader writes the table of contents file header. -func writeTOCHeader(w io.Writer) error { - _, err := fmt.Fprintf(w, `// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %%s can't read by error: %%v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %%s not found", name) -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %%s can't read by error: %%v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %%s not found", name) -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ -`) - return err -} - -// writeTOCAsset write a TOC entry for the given asset. -func writeTOCAsset(w io.Writer, asset *Asset, maxlen int) error { - spacediff := maxlen - len(asset.Name) - filler := strings.Repeat(" ", spacediff) - - _, err := fmt.Fprintf(w, "\t%q: %s%s,\n", asset.Name, filler, asset.Func) - return err -} - -// writeTOCFooter writes the table of contents file footer. -func writeTOCFooter(w io.Writer) error { - _, err := fmt.Fprintf(w, `} - -`) - return err -} diff --git a/vendor/github.com/gobuffalo/flect/.gitignore b/vendor/github.com/gobuffalo/flect/.gitignore deleted file mode 100644 index 3689718594c..00000000000 --- a/vendor/github.com/gobuffalo/flect/.gitignore +++ /dev/null @@ -1,29 +0,0 @@ -*.log -.DS_Store -doc -tmp -pkg -*.gem -*.pid -coverage -coverage.data -build/* -*.pbxuser -*.mode1v3 -.svn -profile -.console_history -.sass-cache/* -.rake_tasks~ -*.log.lck -solr/ -.jhw-cache/ -jhw.* -*.sublime* -node_modules/ -dist/ -generated/ -.vendor/ -bin/* -gin-bin -.idea/ diff --git a/vendor/github.com/gobuffalo/flect/.gometalinter.json b/vendor/github.com/gobuffalo/flect/.gometalinter.json deleted file mode 100644 index e4f65a36e82..00000000000 --- a/vendor/github.com/gobuffalo/flect/.gometalinter.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"] -} diff --git a/vendor/github.com/gobuffalo/flect/LICENSE b/vendor/github.com/gobuffalo/flect/LICENSE deleted file mode 100644 index 649efd43722..00000000000 --- a/vendor/github.com/gobuffalo/flect/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 Mark Bates - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/gobuffalo/flect/Makefile b/vendor/github.com/gobuffalo/flect/Makefile deleted file mode 100644 index 0ac539f1c2e..00000000000 --- a/vendor/github.com/gobuffalo/flect/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -TAGS ?= "" -GO_BIN ?= "go" - -install: - $(GO_BIN) install -tags ${TAGS} -v . - make tidy - -tidy: -ifeq ($(GO111MODULE),on) - $(GO_BIN) mod tidy -else - echo skipping go mod tidy -endif - -deps: - $(GO_BIN) get -tags ${TAGS} -t ./... - make tidy - -build: - $(GO_BIN) build -v . - make tidy - -test: - $(GO_BIN) test -cover -tags ${TAGS} ./... - make tidy - -ci-deps: - $(GO_BIN) get -tags ${TAGS} -t ./... - -ci-test: - $(GO_BIN) test -tags ${TAGS} -race ./... - -lint: - go get github.com/golangci/golangci-lint/cmd/golangci-lint - golangci-lint run --enable-all - make tidy - -update: -ifeq ($(GO111MODULE),on) - rm go.* - $(GO_BIN) mod init - $(GO_BIN) mod tidy -else - $(GO_BIN) get -u -tags ${TAGS} -endif - make test - make install - make tidy - -release-test: - $(GO_BIN) test -tags ${TAGS} -race ./... - make tidy - -release: - $(GO_BIN) get github.com/gobuffalo/release - make tidy - release -y -f version.go --skip-packr - make tidy - - - diff --git a/vendor/github.com/gobuffalo/flect/README.md b/vendor/github.com/gobuffalo/flect/README.md deleted file mode 100644 index 2d9a1bd3b6a..00000000000 --- a/vendor/github.com/gobuffalo/flect/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# Flect - -

-GoDoc -CI -Go Report Card -

- -This is a new inflection engine to replace [https://github.com/markbates/inflect](https://github.com/markbates/inflect) designed to be more modular, more readable, and easier to fix issues on than the original. - -## Installation - -```bash -$ go get -u -v github.com/gobuffalo/flect -``` - -## `github.com/gobuffalo/flect` -GoDoc - -The `github.com/gobuffalo/flect` package contains "basic" inflection tools, like pluralization, singularization, etc... - -### The `Ident` Type - -In addition to helpful methods that take in a `string` and return a `string`, there is an `Ident` type that can be used to create new, custom, inflection rules. - -The `Ident` type contains two fields. - -* `Original` - This is the original `string` that was used to create the `Ident` -* `Parts` - This is a `[]string` that represents all of the "parts" of the string, that have been split apart, making the segments easier to work with - -Examples of creating new inflection rules using `Ident` can be found in the `github.com/gobuffalo/flect/name` package. - -## `github.com/gobuffalo/flect/name` -GoDoc - -The `github.com/gobuffalo/flect/name` package contains more "business" inflection rules like creating proper names, table names, etc... diff --git a/vendor/github.com/gobuffalo/flect/SHOULDERS.md b/vendor/github.com/gobuffalo/flect/SHOULDERS.md deleted file mode 100644 index 8c359f157e6..00000000000 --- a/vendor/github.com/gobuffalo/flect/SHOULDERS.md +++ /dev/null @@ -1,10 +0,0 @@ -# github.com/gobuffalo/flect Stands on the Shoulders of Giants - -github.com/gobuffalo/flect does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants, this project would not be possible. Please make sure to check them out and thank them for all of their hard work. - -Thank you to the following **GIANTS**: - - -* [github.com/davecgh/go-spew](https://godoc.org/github.com/davecgh/go-spew) - -* [github.com/stretchr/testify](https://godoc.org/github.com/stretchr/testify) diff --git a/vendor/github.com/gobuffalo/flect/acronyms.go b/vendor/github.com/gobuffalo/flect/acronyms.go deleted file mode 100644 index b169724a4ca..00000000000 --- a/vendor/github.com/gobuffalo/flect/acronyms.go +++ /dev/null @@ -1,152 +0,0 @@ -package flect - -import "sync" - -var acronymsMoot = &sync.RWMutex{} - -var baseAcronyms = map[string]bool{ - "OK": true, - "UTF8": true, - "HTML": true, - "JSON": true, - "JWT": true, - "ID": true, - "UUID": true, - "SQL": true, - "ACK": true, - "ACL": true, - "ADSL": true, - "AES": true, - "ANSI": true, - "API": true, - "ARP": true, - "ATM": true, - "BGP": true, - "BSS": true, - "CCITT": true, - "CHAP": true, - "CIDR": true, - "CIR": true, - "CLI": true, - "CPE": true, - "CPU": true, - "CRC": true, - "CRT": true, - "CSMA": true, - "CMOS": true, - "DCE": true, - "DEC": true, - "DES": true, - "DHCP": true, - "DNS": true, - "DRAM": true, - "DSL": true, - "DSLAM": true, - "DTE": true, - "DMI": true, - "EHA": true, - "EIA": true, - "EIGRP": true, - "EOF": true, - "ESS": true, - "FCC": true, - "FCS": true, - "FDDI": true, - "FTP": true, - "GBIC": true, - "gbps": true, - "GEPOF": true, - "HDLC": true, - "HTTP": true, - "HTTPS": true, - "IANA": true, - "ICMP": true, - "IDF": true, - "IDS": true, - "IEEE": true, - "IETF": true, - "IMAP": true, - "IP": true, - "IPS": true, - "ISDN": true, - "ISP": true, - "kbps": true, - "LACP": true, - "LAN": true, - "LAPB": true, - "LAPF": true, - "LLC": true, - "MAC": true, - "Mbps": true, - "MC": true, - "MDF": true, - "MIB": true, - "MoCA": true, - "MPLS": true, - "MTU": true, - "NAC": true, - "NAT": true, - "NBMA": true, - "NIC": true, - "NRZ": true, - "NRZI": true, - "NVRAM": true, - "OSI": true, - "OSPF": true, - "OUI": true, - "PAP": true, - "PAT": true, - "PC": true, - "PIM": true, - "PCM": true, - "PDU": true, - "POP3": true, - "POTS": true, - "PPP": true, - "PPTP": true, - "PTT": true, - "PVST": true, - "RAM": true, - "RARP": true, - "RFC": true, - "RIP": true, - "RLL": true, - "ROM": true, - "RSTP": true, - "RTP": true, - "RCP": true, - "SDLC": true, - "SFD": true, - "SFP": true, - "SLARP": true, - "SLIP": true, - "SMTP": true, - "SNA": true, - "SNAP": true, - "SNMP": true, - "SOF": true, - "SRAM": true, - "SSH": true, - "SSID": true, - "STP": true, - "SYN": true, - "TDM": true, - "TFTP": true, - "TIA": true, - "TOFU": true, - "UDP": true, - "URL": true, - "URI": true, - "USB": true, - "UTP": true, - "VC": true, - "VLAN": true, - "VLSM": true, - "VPN": true, - "W3C": true, - "WAN": true, - "WEP": true, - "WiFi": true, - "WPA": true, - "WWW": true, -} diff --git a/vendor/github.com/gobuffalo/flect/camelize.go b/vendor/github.com/gobuffalo/flect/camelize.go deleted file mode 100644 index d8851c8f5e9..00000000000 --- a/vendor/github.com/gobuffalo/flect/camelize.go +++ /dev/null @@ -1,44 +0,0 @@ -package flect - -import ( - "strings" - "unicode" -) - -// Camelize returns a camelize version of a string -// bob dylan = bobDylan -// widget_id = widgetID -// WidgetID = widgetID -func Camelize(s string) string { - return New(s).Camelize().String() -} - -// Camelize returns a camelize version of a string -// bob dylan = bobDylan -// widget_id = widgetID -// WidgetID = widgetID -func (i Ident) Camelize() Ident { - var out []string - for i, part := range i.Parts { - var x string - var capped bool - for _, c := range part { - if unicode.IsLetter(c) || unicode.IsDigit(c) { - if i == 0 { - x += string(unicode.ToLower(c)) - continue - } - if !capped { - capped = true - x += string(unicode.ToUpper(c)) - continue - } - x += string(c) - } - } - if x != "" { - out = append(out, x) - } - } - return New(strings.Join(out, "")) -} diff --git a/vendor/github.com/gobuffalo/flect/capitalize.go b/vendor/github.com/gobuffalo/flect/capitalize.go deleted file mode 100644 index 78334fc0f91..00000000000 --- a/vendor/github.com/gobuffalo/flect/capitalize.go +++ /dev/null @@ -1,24 +0,0 @@ -package flect - -import "unicode" - -// Capitalize will cap the first letter of string -// user = User -// bob dylan = Bob dylan -// widget_id = Widget_id -func Capitalize(s string) string { - return New(s).Capitalize().String() -} - -// Capitalize will cap the first letter of string -// user = User -// bob dylan = Bob dylan -// widget_id = Widget_id -func (i Ident) Capitalize() Ident { - if len(i.Parts) == 0 { - return New("") - } - runes := []rune(i.Original) - runes[0] = unicode.ToTitle(runes[0]) - return New(string(runes)) -} diff --git a/vendor/github.com/gobuffalo/flect/custom_data.go b/vendor/github.com/gobuffalo/flect/custom_data.go deleted file mode 100644 index 9a2dfc74ad8..00000000000 --- a/vendor/github.com/gobuffalo/flect/custom_data.go +++ /dev/null @@ -1,83 +0,0 @@ -package flect - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" -) - -func init() { - loadCustomData("inflections.json", "INFLECT_PATH", "could not read inflection file", LoadInflections) - loadCustomData("acronyms.json", "ACRONYMS_PATH", "could not read acronyms file", LoadAcronyms) -} - -//CustomDataParser are functions that parse data like acronyms or -//plurals in the shape of a io.Reader it receives. -type CustomDataParser func(io.Reader) error - -func loadCustomData(defaultFile, env, readErrorMessage string, parser CustomDataParser) { - pwd, _ := os.Getwd() - path, found := os.LookupEnv(env) - if !found { - path = filepath.Join(pwd, defaultFile) - } - - if _, err := os.Stat(path); err != nil { - return - } - - b, err := ioutil.ReadFile(path) - if err != nil { - fmt.Printf("%s %s (%s)\n", readErrorMessage, path, err) - return - } - - if err = parser(bytes.NewReader(b)); err != nil { - fmt.Println(err) - } -} - -//LoadAcronyms loads rules from io.Reader param -func LoadAcronyms(r io.Reader) error { - m := []string{} - err := json.NewDecoder(r).Decode(&m) - - if err != nil { - return fmt.Errorf("could not decode acronyms JSON from reader: %s", err) - } - - acronymsMoot.Lock() - defer acronymsMoot.Unlock() - - for _, acronym := range m { - baseAcronyms[acronym] = true - } - - return nil -} - -//LoadInflections loads rules from io.Reader param -func LoadInflections(r io.Reader) error { - m := map[string]string{} - - err := json.NewDecoder(r).Decode(&m) - if err != nil { - return fmt.Errorf("could not decode inflection JSON from reader: %s", err) - } - - pluralMoot.Lock() - defer pluralMoot.Unlock() - singularMoot.Lock() - defer singularMoot.Unlock() - - for s, p := range m { - singleToPlural[s] = p - pluralToSingle[p] = s - } - - return nil -} diff --git a/vendor/github.com/gobuffalo/flect/dasherize.go b/vendor/github.com/gobuffalo/flect/dasherize.go deleted file mode 100644 index c7a8a33e366..00000000000 --- a/vendor/github.com/gobuffalo/flect/dasherize.go +++ /dev/null @@ -1,34 +0,0 @@ -package flect - -import ( - "strings" - "unicode" -) - -// Dasherize returns an alphanumeric, lowercased, dashed string -// Donald E. Knuth = donald-e-knuth -// Test with + sign = test-with-sign -// admin/WidgetID = admin-widget-id -func Dasherize(s string) string { - return New(s).Dasherize().String() -} - -// Dasherize returns an alphanumeric, lowercased, dashed string -// Donald E. Knuth = donald-e-knuth -// Test with + sign = test-with-sign -// admin/WidgetID = admin-widget-id -func (i Ident) Dasherize() Ident { - var parts []string - - for _, part := range i.Parts { - var x string - for _, c := range part { - if unicode.IsLetter(c) || unicode.IsDigit(c) { - x += string(c) - } - } - parts = xappend(parts, x) - } - - return New(strings.ToLower(strings.Join(parts, "-"))) -} diff --git a/vendor/github.com/gobuffalo/flect/flect.go b/vendor/github.com/gobuffalo/flect/flect.go deleted file mode 100644 index ee81b6f2bcd..00000000000 --- a/vendor/github.com/gobuffalo/flect/flect.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -Package flect is a new inflection engine to replace [https://github.com/markbates/inflect](https://github.com/markbates/inflect) designed to be more modular, more readable, and easier to fix issues on than the original. -*/ -package flect - -import ( - "strings" - "unicode" -) - -var spaces = []rune{'_', ' ', ':', '-', '/'} - -func isSpace(c rune) bool { - for _, r := range spaces { - if r == c { - return true - } - } - return unicode.IsSpace(c) -} - -func xappend(a []string, ss ...string) []string { - for _, s := range ss { - s = strings.TrimSpace(s) - for _, x := range spaces { - s = strings.Trim(s, string(x)) - } - if _, ok := baseAcronyms[strings.ToUpper(s)]; ok { - s = strings.ToUpper(s) - } - if s != "" { - a = append(a, s) - } - } - return a -} - -func abs(x int) int { - if x < 0 { - return -x - } - return x -} diff --git a/vendor/github.com/gobuffalo/flect/humanize.go b/vendor/github.com/gobuffalo/flect/humanize.go deleted file mode 100644 index 6a0b75af7bf..00000000000 --- a/vendor/github.com/gobuffalo/flect/humanize.go +++ /dev/null @@ -1,35 +0,0 @@ -package flect - -import ( - "strings" -) - -// Humanize returns first letter of sentence capitalized. -// Common acronyms are capitalized as well. -// Other capital letters in string are left as provided. -// employee_salary = Employee salary -// employee_id = employee ID -// employee_mobile_number = Employee mobile number -// first_Name = First Name -// firstName = First Name -func Humanize(s string) string { - return New(s).Humanize().String() -} - -// Humanize First letter of sentence capitalized -func (i Ident) Humanize() Ident { - if len(i.Original) == 0 { - return New("") - } - - var parts []string - for index, part := range i.Parts { - if index == 0 { - part = strings.Title(i.Parts[0]) - } - - parts = xappend(parts, part) - } - - return New(strings.Join(parts, " ")) -} diff --git a/vendor/github.com/gobuffalo/flect/ident.go b/vendor/github.com/gobuffalo/flect/ident.go deleted file mode 100644 index 9189e9a39b6..00000000000 --- a/vendor/github.com/gobuffalo/flect/ident.go +++ /dev/null @@ -1,122 +0,0 @@ -package flect - -import ( - "encoding" - "strings" - "unicode" - "unicode/utf8" -) - -// Ident represents the string and it's parts -type Ident struct { - Original string - Parts []string -} - -// String implements fmt.Stringer and returns the original string -func (i Ident) String() string { - return i.Original -} - -// New creates a new Ident from the string -func New(s string) Ident { - i := Ident{ - Original: s, - Parts: toParts(s), - } - - return i -} - -func toParts(s string) []string { - parts := []string{} - s = strings.TrimSpace(s) - if len(s) == 0 { - return parts - } - if _, ok := baseAcronyms[strings.ToUpper(s)]; ok { - return []string{strings.ToUpper(s)} - } - var prev rune - var x strings.Builder - x.Grow(len(s)) - for _, c := range s { - // fmt.Println("### cs ->", cs) - // fmt.Println("### unicode.IsControl(c) ->", unicode.IsControl(c)) - // fmt.Println("### unicode.IsDigit(c) ->", unicode.IsDigit(c)) - // fmt.Println("### unicode.IsGraphic(c) ->", unicode.IsGraphic(c)) - // fmt.Println("### unicode.IsLetter(c) ->", unicode.IsLetter(c)) - // fmt.Println("### unicode.IsLower(c) ->", unicode.IsLower(c)) - // fmt.Println("### unicode.IsMark(c) ->", unicode.IsMark(c)) - // fmt.Println("### unicode.IsPrint(c) ->", unicode.IsPrint(c)) - // fmt.Println("### unicode.IsPunct(c) ->", unicode.IsPunct(c)) - // fmt.Println("### unicode.IsSpace(c) ->", unicode.IsSpace(c)) - // fmt.Println("### unicode.IsTitle(c) ->", unicode.IsTitle(c)) - // fmt.Println("### unicode.IsUpper(c) ->", unicode.IsUpper(c)) - if !utf8.ValidRune(c) { - continue - } - - if isSpace(c) { - parts = xappend(parts, x.String()) - x.Reset() - x.WriteRune(c) - prev = c - continue - } - - if unicode.IsUpper(c) && !unicode.IsUpper(prev) { - parts = xappend(parts, x.String()) - x.Reset() - x.WriteRune(c) - prev = c - continue - } - if unicode.IsUpper(c) && baseAcronyms[strings.ToUpper(x.String())] { - parts = xappend(parts, x.String()) - x.Reset() - x.WriteRune(c) - prev = c - continue - } - if unicode.IsLetter(c) || unicode.IsDigit(c) || unicode.IsPunct(c) || c == '`' { - prev = c - x.WriteRune(c) - continue - } - - parts = xappend(parts, x.String()) - x.Reset() - prev = c - } - parts = xappend(parts, x.String()) - - return parts -} - -var _ encoding.TextUnmarshaler = &Ident{} -var _ encoding.TextMarshaler = &Ident{} - -// LastPart returns the last part/word of the original string -func (i *Ident) LastPart() string { - if len(i.Parts) == 0 { - return "" - } - return i.Parts[len(i.Parts)-1] -} - -// ReplaceSuffix creates a new Ident with the original suffix replaced by new -func (i Ident) ReplaceSuffix(orig, new string) Ident { - return New(strings.TrimSuffix(i.Original, orig) + new) -} - -//UnmarshalText unmarshalls byte array into the Ident -func (i *Ident) UnmarshalText(data []byte) error { - (*i) = New(string(data)) - return nil -} - -//MarshalText marshals Ident into byte array -func (i Ident) MarshalText() ([]byte, error) { - return []byte(i.Original), nil -} diff --git a/vendor/github.com/gobuffalo/flect/lower_upper.go b/vendor/github.com/gobuffalo/flect/lower_upper.go deleted file mode 100644 index 930da58d8c7..00000000000 --- a/vendor/github.com/gobuffalo/flect/lower_upper.go +++ /dev/null @@ -1,13 +0,0 @@ -package flect - -import "strings" - -// ToUpper is a convience wrapper for strings.ToUpper -func (i Ident) ToUpper() Ident { - return New(strings.ToUpper(i.Original)) -} - -// ToLower is a convience wrapper for strings.ToLower -func (i Ident) ToLower() Ident { - return New(strings.ToLower(i.Original)) -} diff --git a/vendor/github.com/gobuffalo/flect/ordinalize.go b/vendor/github.com/gobuffalo/flect/ordinalize.go deleted file mode 100644 index 1ce27b3a0d4..00000000000 --- a/vendor/github.com/gobuffalo/flect/ordinalize.go +++ /dev/null @@ -1,43 +0,0 @@ -package flect - -import ( - "fmt" - "strconv" -) - -// Ordinalize converts a number to an ordinal version -// 42 = 42nd -// 45 = 45th -// 1 = 1st -func Ordinalize(s string) string { - return New(s).Ordinalize().String() -} - -// Ordinalize converts a number to an ordinal version -// 42 = 42nd -// 45 = 45th -// 1 = 1st -func (i Ident) Ordinalize() Ident { - number, err := strconv.Atoi(i.Original) - if err != nil { - return i - } - var s string - switch abs(number) % 100 { - case 11, 12, 13: - s = fmt.Sprintf("%dth", number) - default: - switch abs(number) % 10 { - case 1: - s = fmt.Sprintf("%dst", number) - case 2: - s = fmt.Sprintf("%dnd", number) - case 3: - s = fmt.Sprintf("%drd", number) - } - } - if s != "" { - return New(s) - } - return New(fmt.Sprintf("%dth", number)) -} diff --git a/vendor/github.com/gobuffalo/flect/pascalize.go b/vendor/github.com/gobuffalo/flect/pascalize.go deleted file mode 100644 index 6396d0d4e79..00000000000 --- a/vendor/github.com/gobuffalo/flect/pascalize.go +++ /dev/null @@ -1,32 +0,0 @@ -package flect - -import ( - "strings" -) - -// Pascalize returns a string with each segment capitalized -// user = User -// bob dylan = BobDylan -// widget_id = WidgetID -func Pascalize(s string) string { - return New(s).Pascalize().String() -} - -// Pascalize returns a string with each segment capitalized -// user = User -// bob dylan = BobDylan -// widget_id = WidgetID -func (i Ident) Pascalize() Ident { - c := i.Camelize() - if len(c.String()) == 0 { - return c - } - if len(i.Parts) == 0 { - return i - } - capLen := 1 - if _, ok := baseAcronyms[strings.ToUpper(i.Parts[0])]; ok { - capLen = len(i.Parts[0]) - } - return New(string(strings.ToUpper(c.Original[0:capLen])) + c.Original[capLen:]) -} diff --git a/vendor/github.com/gobuffalo/flect/plural_rules.go b/vendor/github.com/gobuffalo/flect/plural_rules.go deleted file mode 100644 index 61d34d393b6..00000000000 --- a/vendor/github.com/gobuffalo/flect/plural_rules.go +++ /dev/null @@ -1,287 +0,0 @@ -package flect - -var pluralRules = []rule{} - -// AddPlural adds a rule that will replace the given suffix with the replacement suffix. -func AddPlural(suffix string, repl string) { - pluralMoot.Lock() - defer pluralMoot.Unlock() - pluralRules = append([]rule{{ - suffix: suffix, - fn: func(s string) string { - s = s[:len(s)-len(suffix)] - return s + repl - }, - }}, pluralRules...) - - pluralRules = append([]rule{{ - suffix: repl, - fn: noop, - }}, pluralRules...) -} - -var singleToPlural = map[string]string{ - "aircraft": "aircraft", - "alias": "aliases", - "alumna": "alumnae", - "alumnus": "alumni", - "analysis": "analyses", - "antenna": "antennas", - "antithesis": "antitheses", - "apex": "apexes", - "appendix": "appendices", - "axis": "axes", - "bacillus": "bacilli", - "bacterium": "bacteria", - "basis": "bases", - "beau": "beaus", - "bison": "bison", - "bureau": "bureaus", - "bus": "buses", - "campus": "campuses", - "caucus": "caucuses", - "child": "children", - "château": "châteaux", - "circus": "circuses", - "codex": "codices", - "concerto": "concertos", - "corpus": "corpora", - "crisis": "crises", - "curriculum": "curriculums", - "datum": "data", - "deer": "deer", - "diagnosis": "diagnoses", - "die": "dice", - "dwarf": "dwarves", - "ellipsis": "ellipses", - "equipment": "equipment", - "erratum": "errata", - "faux pas": "faux pas", - "fez": "fezzes", - "fish": "fish", - "focus": "foci", - "foo": "foos", - "foot": "feet", - "formula": "formulas", - "fungus": "fungi", - "genus": "genera", - "goose": "geese", - "graffito": "graffiti", - "grouse": "grouse", - "half": "halves", - "halo": "halos", - "hoof": "hooves", - "human": "humans", - "hypothesis": "hypotheses", - "index": "indices", - "information": "information", - "jeans": "jeans", - "larva": "larvae", - "libretto": "librettos", - "loaf": "loaves", - "locus": "loci", - "louse": "lice", - "matrix": "matrices", - "minutia": "minutiae", - "money": "money", - "moose": "moose", - "mouse": "mice", - "nebula": "nebulae", - "news": "news", - "nucleus": "nuclei", - "oasis": "oases", - "octopus": "octopi", - "offspring": "offspring", - "opus": "opera", - "ovum": "ova", - "ox": "oxen", - "parenthesis": "parentheses", - "phenomenon": "phenomena", - "photo": "photos", - "phylum": "phyla", - "piano": "pianos", - "plus": "pluses", - "police": "police", - "prognosis": "prognoses", - "prometheus": "prometheuses", - "quiz": "quizzes", - "quota": "quotas", - "radius": "radiuses", - "referendum": "referendums", - "ress": "resses", - "rice": "rice", - "salmon": "salmon", - "sex": "sexes", - "series": "series", - "sheep": "sheep", - "shoe": "shoes", - "shrimp": "shrimp", - "species": "species", - "stimulus": "stimuli", - "stratum": "strata", - "swine": "swine", - "syllabus": "syllabi", - "symposium": "symposiums", - "synapse": "synapses", - "synopsis": "synopses", - "tableau": "tableaus", - "testis": "testes", - "thesis": "theses", - "thief": "thieves", - "tooth": "teeth", - "trout": "trout", - "tuna": "tuna", - "vedalia": "vedalias", - "vertebra": "vertebrae", - "vertix": "vertices", - "vita": "vitae", - "vortex": "vortices", - "wharf": "wharves", - "wife": "wives", - "woman": "women", - "wolf": "wolves", - "you": "you", -} - -var pluralToSingle = map[string]string{} - -func init() { - for k, v := range singleToPlural { - pluralToSingle[v] = k - } -} - -type singularToPluralSuffix struct { - singular string - plural string -} - -var singularToPluralSuffixList = []singularToPluralSuffix{ - {"iterion", "iteria"}, - {"campus", "campuses"}, - {"genera", "genus"}, - {"person", "people"}, - {"phylum", "phyla"}, - {"randum", "randa"}, - {"actus", "acti"}, - {"adium", "adia"}, - {"basis", "basis"}, - {"child", "children"}, - {"chive", "chives"}, - {"focus", "foci"}, - {"hello", "hellos"}, - {"jeans", "jeans"}, - {"louse", "lice"}, - {"media", "media"}, - {"mouse", "mice"}, - {"movie", "movies"}, - {"oasis", "oasis"}, - {"atum", "ata"}, - {"atus", "atuses"}, - {"base", "bases"}, - {"cess", "cesses"}, - {"dium", "diums"}, - {"eses", "esis"}, - {"half", "halves"}, - {"hive", "hives"}, - {"iano", "ianos"}, - {"irus", "iri"}, - {"isis", "ises"}, - {"leus", "li"}, - {"mnus", "mni"}, - {"move", "moves"}, - {"news", "news"}, - {"odex", "odice"}, - {"oose", "eese"}, - {"ouse", "ouses"}, - {"ovum", "ova"}, - {"rion", "ria"}, - {"shoe", "shoes"}, - {"stis", "stes"}, - {"tive", "tives"}, - {"vice", "vices"}, - {"wife", "wives"}, - {"afe", "aves"}, - {"bfe", "bves"}, - {"box", "boxes"}, - {"cfe", "cves"}, - {"dfe", "dves"}, - {"dge", "dges"}, - {"efe", "eves"}, - {"gfe", "gves"}, - {"hfe", "hves"}, - {"ife", "ives"}, - {"itz", "itzes"}, - {"ium", "ia"}, - {"ize", "izes"}, - {"jfe", "jves"}, - {"kfe", "kves"}, - {"man", "men"}, - {"mfe", "mves"}, - {"nfe", "nves"}, - {"nna", "nnas"}, - {"oaf", "oaves"}, - {"oci", "ocus"}, - {"ode", "odes"}, - {"ofe", "oves"}, - {"pfe", "pves"}, - {"pse", "psis"}, - {"qfe", "qves"}, - {"quy", "quies"}, - {"rfe", "rves"}, - {"sfe", "sves"}, - {"tfe", "tves"}, - {"tum", "ta"}, - {"tus", "tuses"}, - {"ufe", "uves"}, - {"ula", "ulae"}, - {"ula", "ulas"}, - {"uli", "ulus"}, - {"use", "uses"}, - {"uss", "usses"}, - {"vfe", "vves"}, - {"wfe", "wves"}, - {"xfe", "xves"}, - {"yfe", "yves"}, - {"you", "you"}, - {"zfe", "zves"}, - {"by", "bies"}, - {"ch", "ches"}, - {"cy", "cies"}, - {"dy", "dies"}, - {"ex", "ices"}, - {"fy", "fies"}, - {"gy", "gies"}, - {"hy", "hies"}, - {"io", "ios"}, - {"jy", "jies"}, - {"ky", "kies"}, - {"lf", "lves"}, - {"ly", "lies"}, - {"my", "mies"}, - {"ny", "nies"}, - {"py", "pies"}, - {"qy", "qies"}, - {"rf", "rves"}, - {"ry", "ries"}, - {"sh", "shes"}, - {"ss", "sses"}, - {"sy", "sies"}, - {"ty", "ties"}, - {"tz", "tzes"}, - {"va", "vae"}, - {"vy", "vies"}, - {"wy", "wies"}, - {"xy", "xies"}, - {"zy", "zies"}, - {"zz", "zzes"}, - {"o", "oes"}, - {"x", "xes"}, -} - -func init() { - for i := len(singularToPluralSuffixList) - 1; i >= 0; i-- { - AddPlural(singularToPluralSuffixList[i].singular, singularToPluralSuffixList[i].plural) - AddSingular(singularToPluralSuffixList[i].plural, singularToPluralSuffixList[i].singular) - } -} diff --git a/vendor/github.com/gobuffalo/flect/pluralize.go b/vendor/github.com/gobuffalo/flect/pluralize.go deleted file mode 100644 index e265f84e91d..00000000000 --- a/vendor/github.com/gobuffalo/flect/pluralize.go +++ /dev/null @@ -1,59 +0,0 @@ -package flect - -import ( - "strings" - "sync" -) - -var pluralMoot = &sync.RWMutex{} - -// Pluralize returns a plural version of the string -// user = users -// person = people -// datum = data -func Pluralize(s string) string { - return New(s).Pluralize().String() -} - -// PluralizeWithSize will pluralize a string taking a number number into account. -// PluralizeWithSize("user", 1) = user -// PluralizeWithSize("user", 2) = users -func PluralizeWithSize(s string, i int) string { - if i == 1 || i == -1 { - return New(s).Singularize().String() - } - return New(s).Pluralize().String() -} - -// Pluralize returns a plural version of the string -// user = users -// person = people -// datum = data -func (i Ident) Pluralize() Ident { - s := i.LastPart() - if len(s) == 0 { - return New("") - } - - pluralMoot.RLock() - defer pluralMoot.RUnlock() - - ls := strings.ToLower(s) - if _, ok := pluralToSingle[ls]; ok { - return i - } - if p, ok := singleToPlural[ls]; ok { - return i.ReplaceSuffix(s, p) - } - for _, r := range pluralRules { - if strings.HasSuffix(ls, r.suffix) { - return i.ReplaceSuffix(s, r.fn(s)) - } - } - - if strings.HasSuffix(ls, "s") { - return i - } - - return New(i.String() + "s") -} diff --git a/vendor/github.com/gobuffalo/flect/rule.go b/vendor/github.com/gobuffalo/flect/rule.go deleted file mode 100644 index dc616b337dd..00000000000 --- a/vendor/github.com/gobuffalo/flect/rule.go +++ /dev/null @@ -1,10 +0,0 @@ -package flect - -type ruleFn func(string) string - -type rule struct { - suffix string - fn ruleFn -} - -func noop(s string) string { return s } diff --git a/vendor/github.com/gobuffalo/flect/singular_rules.go b/vendor/github.com/gobuffalo/flect/singular_rules.go deleted file mode 100644 index 9b85a873b98..00000000000 --- a/vendor/github.com/gobuffalo/flect/singular_rules.go +++ /dev/null @@ -1,23 +0,0 @@ -package flect - -var singularRules = []rule{} - -// AddSingular adds a rule that will replace the given suffix with the replacement suffix. -func AddSingular(ext string, repl string) { - singularMoot.Lock() - defer singularMoot.Unlock() - singularRules = append([]rule{{ - suffix: ext, - fn: func(s string) string { - s = s[:len(s)-len(ext)] - return s + repl - }, - }}, singularRules...) - - singularRules = append([]rule{{ - suffix: repl, - fn: func(s string) string { - return s - }, - }}, singularRules...) -} diff --git a/vendor/github.com/gobuffalo/flect/singularize.go b/vendor/github.com/gobuffalo/flect/singularize.go deleted file mode 100644 index 1ed4995053e..00000000000 --- a/vendor/github.com/gobuffalo/flect/singularize.go +++ /dev/null @@ -1,57 +0,0 @@ -package flect - -import ( - "strings" - "sync" -) - -var singularMoot = &sync.RWMutex{} - -// Singularize returns a singular version of the string -// users = user -// data = datum -// people = person -func Singularize(s string) string { - return New(s).Singularize().String() -} - -// SingularizeWithSize will singular a string taking a number number into account. -// SingularizeWithSize("user", 1) = user -// SingularizeWithSize("user", 2) = users -func SingularizeWithSize(s string, i int) string { - if i == 1 || i == -1 { - return New(s).Singularize().String() - } - return New(s).Pluralize().String() -} - -// Singularize returns a singular version of the string -// users = user -// data = datum -// people = person -func (i Ident) Singularize() Ident { - s := i.Original - if len(s) == 0 { - return i - } - - singularMoot.RLock() - defer singularMoot.RUnlock() - ls := strings.ToLower(s) - if p, ok := pluralToSingle[ls]; ok { - return New(p) - } - if _, ok := singleToPlural[ls]; ok { - return i - } - for _, r := range singularRules { - if strings.HasSuffix(ls, r.suffix) { - return New(r.fn(s)) - } - } - - if strings.HasSuffix(s, "s") { - return New(s[:len(s)-1]) - } - return i -} diff --git a/vendor/github.com/gobuffalo/flect/titleize.go b/vendor/github.com/gobuffalo/flect/titleize.go deleted file mode 100644 index cbbf08a5aa2..00000000000 --- a/vendor/github.com/gobuffalo/flect/titleize.go +++ /dev/null @@ -1,30 +0,0 @@ -package flect - -import ( - "strings" - "unicode" -) - -// Titleize will capitalize the start of each part -// "Nice to see you!" = "Nice To See You!" -// "i've read a book! have you?" = "I've Read A Book! Have You?" -// "This is `code` ok" = "This Is `code` OK" -func Titleize(s string) string { - return New(s).Titleize().String() -} - -// Titleize will capitalize the start of each part -// "Nice to see you!" = "Nice To See You!" -// "i've read a book! have you?" = "I've Read A Book! Have You?" -// "This is `code` ok" = "This Is `code` OK" -func (i Ident) Titleize() Ident { - var parts []string - for _, part := range i.Parts { - x := string(unicode.ToTitle(rune(part[0]))) - if len(part) > 1 { - x += part[1:] - } - parts = append(parts, x) - } - return New(strings.Join(parts, " ")) -} diff --git a/vendor/github.com/gobuffalo/flect/underscore.go b/vendor/github.com/gobuffalo/flect/underscore.go deleted file mode 100644 index e1466d99b9f..00000000000 --- a/vendor/github.com/gobuffalo/flect/underscore.go +++ /dev/null @@ -1,35 +0,0 @@ -package flect - -import ( - "strings" - "unicode" -) - -// Underscore a string -// bob dylan = bob_dylan -// Nice to see you! = nice_to_see_you -// widgetID = widget_id -func Underscore(s string) string { - return New(s).Underscore().String() -} - -// Underscore a string -// bob dylan = bob_dylan -// Nice to see you! = nice_to_see_you -// widgetID = widget_id -func (i Ident) Underscore() Ident { - out := make([]string, 0, len(i.Parts)) - for _, part := range i.Parts { - var x strings.Builder - x.Grow(len(part)) - for _, c := range part { - if unicode.IsLetter(c) || unicode.IsDigit(c) { - x.WriteRune(c) - } - } - if x.Len() > 0 { - out = append(out, x.String()) - } - } - return New(strings.ToLower(strings.Join(out, "_"))) -} diff --git a/vendor/github.com/gobuffalo/flect/version.go b/vendor/github.com/gobuffalo/flect/version.go deleted file mode 100644 index 9624d5df2d0..00000000000 --- a/vendor/github.com/gobuffalo/flect/version.go +++ /dev/null @@ -1,4 +0,0 @@ -package flect - -//Version holds Flect version number -const Version = "v0.1.6" diff --git a/vendor/github.com/golang/mock/mockgen/mockgen.go b/vendor/github.com/golang/mock/mockgen/mockgen.go deleted file mode 100644 index 50487070e3e..00000000000 --- a/vendor/github.com/golang/mock/mockgen/mockgen.go +++ /dev/null @@ -1,701 +0,0 @@ -// Copyright 2010 Google Inc. -// -// 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. - -// MockGen generates mock implementations of Go interfaces. -package main - -// TODO: This does not support recursive embedded interfaces. -// TODO: This does not support embedding package-local interfaces in a separate file. - -import ( - "bytes" - "encoding/json" - "flag" - "fmt" - "go/token" - "io" - "io/ioutil" - "log" - "os" - "os/exec" - "path" - "path/filepath" - "sort" - "strconv" - "strings" - "unicode" - - "github.com/golang/mock/mockgen/model" - - "golang.org/x/mod/modfile" - toolsimports "golang.org/x/tools/imports" -) - -const ( - gomockImportPath = "github.com/golang/mock/gomock" -) - -var ( - version = "" - commit = "none" - date = "unknown" -) - -var ( - source = flag.String("source", "", "(source mode) Input Go source file; enables source mode.") - destination = flag.String("destination", "", "Output file; defaults to stdout.") - mockNames = flag.String("mock_names", "", "Comma-separated interfaceName=mockName pairs of explicit mock names to use. Mock names default to 'Mock'+ interfaceName suffix.") - packageOut = flag.String("package", "", "Package of the generated code; defaults to the package of the input with a 'mock_' prefix.") - selfPackage = flag.String("self_package", "", "The full package import path for the generated code. The purpose of this flag is to prevent import cycles in the generated code by trying to include its own package. This can happen if the mock's package is set to one of its inputs (usually the main one) and the output is stdio so mockgen cannot detect the final output package. Setting this flag will then tell mockgen which import to exclude.") - writePkgComment = flag.Bool("write_package_comment", true, "Writes package documentation comment (godoc) if true.") - copyrightFile = flag.String("copyright_file", "", "Copyright file used to add copyright header") - - debugParser = flag.Bool("debug_parser", false, "Print out parser results only.") - showVersion = flag.Bool("version", false, "Print version.") -) - -func main() { - flag.Usage = usage - flag.Parse() - - if *showVersion { - printVersion() - return - } - - var pkg *model.Package - var err error - var packageName string - if *source != "" { - pkg, err = sourceMode(*source) - } else { - if flag.NArg() != 2 { - usage() - log.Fatal("Expected exactly two arguments") - } - packageName = flag.Arg(0) - interfaces := strings.Split(flag.Arg(1), ",") - if packageName == "." { - dir, err := os.Getwd() - if err != nil { - log.Fatalf("Get current directory failed: %v", err) - } - packageName, err = packageNameOfDir(dir) - if err != nil { - log.Fatalf("Parse package name failed: %v", err) - } - } - pkg, err = reflectMode(packageName, interfaces) - } - if err != nil { - log.Fatalf("Loading input failed: %v", err) - } - - if *debugParser { - pkg.Print(os.Stdout) - return - } - - dst := os.Stdout - if len(*destination) > 0 { - if err := os.MkdirAll(filepath.Dir(*destination), os.ModePerm); err != nil { - log.Fatalf("Unable to create directory: %v", err) - } - f, err := os.Create(*destination) - if err != nil { - log.Fatalf("Failed opening destination file: %v", err) - } - defer f.Close() - dst = f - } - - outputPackageName := *packageOut - if outputPackageName == "" { - // pkg.Name in reflect mode is the base name of the import path, - // which might have characters that are illegal to have in package names. - outputPackageName = "mock_" + sanitize(pkg.Name) - } - - // outputPackagePath represents the fully qualified name of the package of - // the generated code. Its purposes are to prevent the module from importing - // itself and to prevent qualifying type names that come from its own - // package (i.e. if there is a type called X then we want to print "X" not - // "package.X" since "package" is this package). This can happen if the mock - // is output into an already existing package. - outputPackagePath := *selfPackage - if outputPackagePath == "" && *destination != "" { - dstPath, err := filepath.Abs(filepath.Dir(*destination)) - if err == nil { - pkgPath, err := parsePackageImport(dstPath) - if err == nil { - outputPackagePath = pkgPath - } else { - log.Println("Unable to infer -self_package from destination file path:", err) - } - } else { - log.Println("Unable to determine destination file path:", err) - } - } - - g := new(generator) - if *source != "" { - g.filename = *source - } else { - g.srcPackage = packageName - g.srcInterfaces = flag.Arg(1) - } - g.destination = *destination - - if *mockNames != "" { - g.mockNames = parseMockNames(*mockNames) - } - if *copyrightFile != "" { - header, err := ioutil.ReadFile(*copyrightFile) - if err != nil { - log.Fatalf("Failed reading copyright file: %v", err) - } - - g.copyrightHeader = string(header) - } - if err := g.Generate(pkg, outputPackageName, outputPackagePath); err != nil { - log.Fatalf("Failed generating mock: %v", err) - } - if _, err := dst.Write(g.Output()); err != nil { - log.Fatalf("Failed writing to destination: %v", err) - } -} - -func parseMockNames(names string) map[string]string { - mocksMap := make(map[string]string) - for _, kv := range strings.Split(names, ",") { - parts := strings.SplitN(kv, "=", 2) - if len(parts) != 2 || parts[1] == "" { - log.Fatalf("bad mock names spec: %v", kv) - } - mocksMap[parts[0]] = parts[1] - } - return mocksMap -} - -func usage() { - _, _ = io.WriteString(os.Stderr, usageText) - flag.PrintDefaults() -} - -const usageText = `mockgen has two modes of operation: source and reflect. - -Source mode generates mock interfaces from a source file. -It is enabled by using the -source flag. Other flags that -may be useful in this mode are -imports and -aux_files. -Example: - mockgen -source=foo.go [other options] - -Reflect mode generates mock interfaces by building a program -that uses reflection to understand interfaces. It is enabled -by passing two non-flag arguments: an import path, and a -comma-separated list of symbols. -Example: - mockgen database/sql/driver Conn,Driver - -` - -type generator struct { - buf bytes.Buffer - indent string - mockNames map[string]string // may be empty - filename string // may be empty - destination string // may be empty - srcPackage, srcInterfaces string // may be empty - copyrightHeader string - - packageMap map[string]string // map from import path to package name -} - -func (g *generator) p(format string, args ...interface{}) { - fmt.Fprintf(&g.buf, g.indent+format+"\n", args...) -} - -func (g *generator) in() { - g.indent += "\t" -} - -func (g *generator) out() { - if len(g.indent) > 0 { - g.indent = g.indent[0 : len(g.indent)-1] - } -} - -// sanitize cleans up a string to make a suitable package name. -func sanitize(s string) string { - t := "" - for _, r := range s { - if t == "" { - if unicode.IsLetter(r) || r == '_' { - t += string(r) - continue - } - } else { - if unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' { - t += string(r) - continue - } - } - t += "_" - } - if t == "_" { - t = "x" - } - return t -} - -func (g *generator) Generate(pkg *model.Package, outputPkgName string, outputPackagePath string) error { - if outputPkgName != pkg.Name && *selfPackage == "" { - // reset outputPackagePath if it's not passed in through -self_package - outputPackagePath = "" - } - - if g.copyrightHeader != "" { - lines := strings.Split(g.copyrightHeader, "\n") - for _, line := range lines { - g.p("// %s", line) - } - g.p("") - } - - g.p("// Code generated by MockGen. DO NOT EDIT.") - if g.filename != "" { - g.p("// Source: %v", g.filename) - } else { - g.p("// Source: %v (interfaces: %v)", g.srcPackage, g.srcInterfaces) - } - g.p("") - - // Get all required imports, and generate unique names for them all. - im := pkg.Imports() - im[gomockImportPath] = true - - // Only import reflect if it's used. We only use reflect in mocked methods - // so only import if any of the mocked interfaces have methods. - for _, intf := range pkg.Interfaces { - if len(intf.Methods) > 0 { - im["reflect"] = true - break - } - } - - // Sort keys to make import alias generation predictable - sortedPaths := make([]string, len(im)) - x := 0 - for pth := range im { - sortedPaths[x] = pth - x++ - } - sort.Strings(sortedPaths) - - packagesName := createPackageMap(sortedPaths) - - g.packageMap = make(map[string]string, len(im)) - localNames := make(map[string]bool, len(im)) - for _, pth := range sortedPaths { - base, ok := packagesName[pth] - if !ok { - base = sanitize(path.Base(pth)) - } - - // Local names for an imported package can usually be the basename of the import path. - // A couple of situations don't permit that, such as duplicate local names - // (e.g. importing "html/template" and "text/template"), or where the basename is - // a keyword (e.g. "foo/case"). - // try base0, base1, ... - pkgName := base - i := 0 - for localNames[pkgName] || token.Lookup(pkgName).IsKeyword() { - pkgName = base + strconv.Itoa(i) - i++ - } - - // Avoid importing package if source pkg == output pkg - if pth == pkg.PkgPath && outputPackagePath == pkg.PkgPath { - continue - } - - g.packageMap[pth] = pkgName - localNames[pkgName] = true - } - - if *writePkgComment { - g.p("// Package %v is a generated GoMock package.", outputPkgName) - } - g.p("package %v", outputPkgName) - g.p("") - g.p("import (") - g.in() - for pkgPath, pkgName := range g.packageMap { - if pkgPath == outputPackagePath { - continue - } - g.p("%v %q", pkgName, pkgPath) - } - for _, pkgPath := range pkg.DotImports { - g.p(". %q", pkgPath) - } - g.out() - g.p(")") - - for _, intf := range pkg.Interfaces { - if err := g.GenerateMockInterface(intf, outputPackagePath); err != nil { - return err - } - } - - return nil -} - -// The name of the mock type to use for the given interface identifier. -func (g *generator) mockName(typeName string) string { - if mockName, ok := g.mockNames[typeName]; ok { - return mockName - } - - return "Mock" + typeName -} - -func (g *generator) GenerateMockInterface(intf *model.Interface, outputPackagePath string) error { - mockType := g.mockName(intf.Name) - - g.p("") - g.p("// %v is a mock of %v interface.", mockType, intf.Name) - g.p("type %v struct {", mockType) - g.in() - g.p("ctrl *gomock.Controller") - g.p("recorder *%vMockRecorder", mockType) - g.out() - g.p("}") - g.p("") - - g.p("// %vMockRecorder is the mock recorder for %v.", mockType, mockType) - g.p("type %vMockRecorder struct {", mockType) - g.in() - g.p("mock *%v", mockType) - g.out() - g.p("}") - g.p("") - - g.p("// New%v creates a new mock instance.", mockType) - g.p("func New%v(ctrl *gomock.Controller) *%v {", mockType, mockType) - g.in() - g.p("mock := &%v{ctrl: ctrl}", mockType) - g.p("mock.recorder = &%vMockRecorder{mock}", mockType) - g.p("return mock") - g.out() - g.p("}") - g.p("") - - // XXX: possible name collision here if someone has EXPECT in their interface. - g.p("// EXPECT returns an object that allows the caller to indicate expected use.") - g.p("func (m *%v) EXPECT() *%vMockRecorder {", mockType, mockType) - g.in() - g.p("return m.recorder") - g.out() - g.p("}") - - g.GenerateMockMethods(mockType, intf, outputPackagePath) - - return nil -} - -type byMethodName []*model.Method - -func (b byMethodName) Len() int { return len(b) } -func (b byMethodName) Swap(i, j int) { b[i], b[j] = b[j], b[i] } -func (b byMethodName) Less(i, j int) bool { return b[i].Name < b[j].Name } - -func (g *generator) GenerateMockMethods(mockType string, intf *model.Interface, pkgOverride string) { - sort.Sort(byMethodName(intf.Methods)) - for _, m := range intf.Methods { - g.p("") - _ = g.GenerateMockMethod(mockType, m, pkgOverride) - g.p("") - _ = g.GenerateMockRecorderMethod(mockType, m) - } -} - -func makeArgString(argNames, argTypes []string) string { - args := make([]string, len(argNames)) - for i, name := range argNames { - // specify the type only once for consecutive args of the same type - if i+1 < len(argTypes) && argTypes[i] == argTypes[i+1] { - args[i] = name - } else { - args[i] = name + " " + argTypes[i] - } - } - return strings.Join(args, ", ") -} - -// GenerateMockMethod generates a mock method implementation. -// If non-empty, pkgOverride is the package in which unqualified types reside. -func (g *generator) GenerateMockMethod(mockType string, m *model.Method, pkgOverride string) error { - argNames := g.getArgNames(m) - argTypes := g.getArgTypes(m, pkgOverride) - argString := makeArgString(argNames, argTypes) - - rets := make([]string, len(m.Out)) - for i, p := range m.Out { - rets[i] = p.Type.String(g.packageMap, pkgOverride) - } - retString := strings.Join(rets, ", ") - if len(rets) > 1 { - retString = "(" + retString + ")" - } - if retString != "" { - retString = " " + retString - } - - ia := newIdentifierAllocator(argNames) - idRecv := ia.allocateIdentifier("m") - - g.p("// %v mocks base method.", m.Name) - g.p("func (%v *%v) %v(%v)%v {", idRecv, mockType, m.Name, argString, retString) - g.in() - g.p("%s.ctrl.T.Helper()", idRecv) - - var callArgs string - if m.Variadic == nil { - if len(argNames) > 0 { - callArgs = ", " + strings.Join(argNames, ", ") - } - } else { - // Non-trivial. The generated code must build a []interface{}, - // but the variadic argument may be any type. - idVarArgs := ia.allocateIdentifier("varargs") - idVArg := ia.allocateIdentifier("a") - g.p("%s := []interface{}{%s}", idVarArgs, strings.Join(argNames[:len(argNames)-1], ", ")) - g.p("for _, %s := range %s {", idVArg, argNames[len(argNames)-1]) - g.in() - g.p("%s = append(%s, %s)", idVarArgs, idVarArgs, idVArg) - g.out() - g.p("}") - callArgs = ", " + idVarArgs + "..." - } - if len(m.Out) == 0 { - g.p(`%v.ctrl.Call(%v, %q%v)`, idRecv, idRecv, m.Name, callArgs) - } else { - idRet := ia.allocateIdentifier("ret") - g.p(`%v := %v.ctrl.Call(%v, %q%v)`, idRet, idRecv, idRecv, m.Name, callArgs) - - // Go does not allow "naked" type assertions on nil values, so we use the two-value form here. - // The value of that is either (x.(T), true) or (Z, false), where Z is the zero value for T. - // Happily, this coincides with the semantics we want here. - retNames := make([]string, len(rets)) - for i, t := range rets { - retNames[i] = ia.allocateIdentifier(fmt.Sprintf("ret%d", i)) - g.p("%s, _ := %s[%d].(%s)", retNames[i], idRet, i, t) - } - g.p("return " + strings.Join(retNames, ", ")) - } - - g.out() - g.p("}") - return nil -} - -func (g *generator) GenerateMockRecorderMethod(mockType string, m *model.Method) error { - argNames := g.getArgNames(m) - - var argString string - if m.Variadic == nil { - argString = strings.Join(argNames, ", ") - } else { - argString = strings.Join(argNames[:len(argNames)-1], ", ") - } - if argString != "" { - argString += " interface{}" - } - - if m.Variadic != nil { - if argString != "" { - argString += ", " - } - argString += fmt.Sprintf("%s ...interface{}", argNames[len(argNames)-1]) - } - - ia := newIdentifierAllocator(argNames) - idRecv := ia.allocateIdentifier("mr") - - g.p("// %v indicates an expected call of %v.", m.Name, m.Name) - g.p("func (%s *%vMockRecorder) %v(%v) *gomock.Call {", idRecv, mockType, m.Name, argString) - g.in() - g.p("%s.mock.ctrl.T.Helper()", idRecv) - - var callArgs string - if m.Variadic == nil { - if len(argNames) > 0 { - callArgs = ", " + strings.Join(argNames, ", ") - } - } else { - if len(argNames) == 1 { - // Easy: just use ... to push the arguments through. - callArgs = ", " + argNames[0] + "..." - } else { - // Hard: create a temporary slice. - idVarArgs := ia.allocateIdentifier("varargs") - g.p("%s := append([]interface{}{%s}, %s...)", - idVarArgs, - strings.Join(argNames[:len(argNames)-1], ", "), - argNames[len(argNames)-1]) - callArgs = ", " + idVarArgs + "..." - } - } - g.p(`return %s.mock.ctrl.RecordCallWithMethodType(%s.mock, "%s", reflect.TypeOf((*%s)(nil).%s)%s)`, idRecv, idRecv, m.Name, mockType, m.Name, callArgs) - - g.out() - g.p("}") - return nil -} - -func (g *generator) getArgNames(m *model.Method) []string { - argNames := make([]string, len(m.In)) - for i, p := range m.In { - name := p.Name - if name == "" || name == "_" { - name = fmt.Sprintf("arg%d", i) - } - argNames[i] = name - } - if m.Variadic != nil { - name := m.Variadic.Name - if name == "" { - name = fmt.Sprintf("arg%d", len(m.In)) - } - argNames = append(argNames, name) - } - return argNames -} - -func (g *generator) getArgTypes(m *model.Method, pkgOverride string) []string { - argTypes := make([]string, len(m.In)) - for i, p := range m.In { - argTypes[i] = p.Type.String(g.packageMap, pkgOverride) - } - if m.Variadic != nil { - argTypes = append(argTypes, "..."+m.Variadic.Type.String(g.packageMap, pkgOverride)) - } - return argTypes -} - -type identifierAllocator map[string]struct{} - -func newIdentifierAllocator(taken []string) identifierAllocator { - a := make(identifierAllocator, len(taken)) - for _, s := range taken { - a[s] = struct{}{} - } - return a -} - -func (o identifierAllocator) allocateIdentifier(want string) string { - id := want - for i := 2; ; i++ { - if _, ok := o[id]; !ok { - o[id] = struct{}{} - return id - } - id = want + "_" + strconv.Itoa(i) - } -} - -// Output returns the generator's output, formatted in the standard Go style. -func (g *generator) Output() []byte { - src, err := toolsimports.Process(g.destination, g.buf.Bytes(), nil) - if err != nil { - log.Fatalf("Failed to format generated source code: %s\n%s", err, g.buf.String()) - } - return src -} - -// createPackageMap returns a map of import path to package name -// for specified importPaths. -func createPackageMap(importPaths []string) map[string]string { - var pkg struct { - Name string - ImportPath string - } - pkgMap := make(map[string]string) - b := bytes.NewBuffer(nil) - args := []string{"list", "-json"} - args = append(args, importPaths...) - cmd := exec.Command("go", args...) - cmd.Stdout = b - cmd.Run() - dec := json.NewDecoder(b) - for dec.More() { - err := dec.Decode(&pkg) - if err != nil { - log.Printf("failed to decode 'go list' output: %v", err) - continue - } - pkgMap[pkg.ImportPath] = pkg.Name - } - return pkgMap -} - -func printVersion() { - if version != "" { - fmt.Printf("v%s\nCommit: %s\nDate: %s\n", version, commit, date) - } else { - printModuleVersion() - } -} - -// parseImportPackage get package import path via source file -// an alternative implementation is to use: -// cfg := &packages.Config{Mode: packages.NeedName, Tests: true, Dir: srcDir} -// pkgs, err := packages.Load(cfg, "file="+source) -// However, it will call "go list" and slow down the performance -func parsePackageImport(srcDir string) (string, error) { - moduleMode := os.Getenv("GO111MODULE") - // trying to find the module - if moduleMode != "off" { - currentDir := srcDir - for { - dat, err := ioutil.ReadFile(filepath.Join(currentDir, "go.mod")) - if os.IsNotExist(err) { - if currentDir == filepath.Dir(currentDir) { - // at the root - break - } - currentDir = filepath.Dir(currentDir) - continue - } else if err != nil { - return "", err - } - modulePath := modfile.ModulePath(dat) - return filepath.ToSlash(filepath.Join(modulePath, strings.TrimPrefix(srcDir, currentDir))), nil - } - } - // fall back to GOPATH mode - goPaths := os.Getenv("GOPATH") - if goPaths == "" { - return "", fmt.Errorf("GOPATH is not set") - } - goPathList := strings.Split(goPaths, string(os.PathListSeparator)) - for _, goPath := range goPathList { - sourceRoot := filepath.Join(goPath, "src") + string(os.PathSeparator) - if strings.HasPrefix(srcDir, sourceRoot) { - return filepath.ToSlash(strings.TrimPrefix(srcDir, sourceRoot)), nil - } - } - return "", errOutsideGoPath -} diff --git a/vendor/github.com/golang/mock/mockgen/parse.go b/vendor/github.com/golang/mock/mockgen/parse.go deleted file mode 100644 index bf6902cd5b3..00000000000 --- a/vendor/github.com/golang/mock/mockgen/parse.go +++ /dev/null @@ -1,644 +0,0 @@ -// Copyright 2012 Google Inc. -// -// 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 main - -// This file contains the model construction by parsing source files. - -import ( - "errors" - "flag" - "fmt" - "go/ast" - "go/build" - "go/importer" - "go/parser" - "go/token" - "go/types" - "io/ioutil" - "log" - "path" - "path/filepath" - "strconv" - "strings" - - "github.com/golang/mock/mockgen/model" -) - -var ( - imports = flag.String("imports", "", "(source mode) Comma-separated name=path pairs of explicit imports to use.") - auxFiles = flag.String("aux_files", "", "(source mode) Comma-separated pkg=path pairs of auxiliary Go source files.") -) - -// sourceMode generates mocks via source file. -func sourceMode(source string) (*model.Package, error) { - srcDir, err := filepath.Abs(filepath.Dir(source)) - if err != nil { - return nil, fmt.Errorf("failed getting source directory: %v", err) - } - - packageImport, err := parsePackageImport(srcDir) - if err != nil { - return nil, err - } - - fs := token.NewFileSet() - file, err := parser.ParseFile(fs, source, nil, 0) - if err != nil { - return nil, fmt.Errorf("failed parsing source file %v: %v", source, err) - } - - p := &fileParser{ - fileSet: fs, - imports: make(map[string]importedPackage), - importedInterfaces: make(map[string]map[string]*ast.InterfaceType), - auxInterfaces: make(map[string]map[string]*ast.InterfaceType), - srcDir: srcDir, - } - - // Handle -imports. - dotImports := make(map[string]bool) - if *imports != "" { - for _, kv := range strings.Split(*imports, ",") { - eq := strings.Index(kv, "=") - k, v := kv[:eq], kv[eq+1:] - if k == "." { - dotImports[v] = true - } else { - p.imports[k] = importedPkg{path: v} - } - } - } - - // Handle -aux_files. - if err := p.parseAuxFiles(*auxFiles); err != nil { - return nil, err - } - p.addAuxInterfacesFromFile(packageImport, file) // this file - - pkg, err := p.parseFile(packageImport, file) - if err != nil { - return nil, err - } - for pkgPath := range dotImports { - pkg.DotImports = append(pkg.DotImports, pkgPath) - } - return pkg, nil -} - -type importedPackage interface { - Path() string - Parser() *fileParser -} - -type importedPkg struct { - path string - parser *fileParser -} - -func (i importedPkg) Path() string { return i.path } -func (i importedPkg) Parser() *fileParser { return i.parser } - -// duplicateImport is a bit of a misnomer. Currently the parser can't -// handle cases of multi-file packages importing different packages -// under the same name. Often these imports would not be problematic, -// so this type lets us defer raising an error unless the package name -// is actually used. -type duplicateImport struct { - name string - duplicates []string -} - -func (d duplicateImport) Error() string { - return fmt.Sprintf("%q is ambiguous because of duplicate imports: %v", d.name, d.duplicates) -} - -func (d duplicateImport) Path() string { log.Fatal(d.Error()); return "" } -func (d duplicateImport) Parser() *fileParser { log.Fatal(d.Error()); return nil } - -type fileParser struct { - fileSet *token.FileSet - imports map[string]importedPackage // package name => imported package - importedInterfaces map[string]map[string]*ast.InterfaceType // package (or "") => name => interface - - auxFiles []*ast.File - auxInterfaces map[string]map[string]*ast.InterfaceType // package (or "") => name => interface - - srcDir string -} - -func (p *fileParser) errorf(pos token.Pos, format string, args ...interface{}) error { - ps := p.fileSet.Position(pos) - format = "%s:%d:%d: " + format - args = append([]interface{}{ps.Filename, ps.Line, ps.Column}, args...) - return fmt.Errorf(format, args...) -} - -func (p *fileParser) parseAuxFiles(auxFiles string) error { - auxFiles = strings.TrimSpace(auxFiles) - if auxFiles == "" { - return nil - } - for _, kv := range strings.Split(auxFiles, ",") { - parts := strings.SplitN(kv, "=", 2) - if len(parts) != 2 { - return fmt.Errorf("bad aux file spec: %v", kv) - } - pkg, fpath := parts[0], parts[1] - - file, err := parser.ParseFile(p.fileSet, fpath, nil, 0) - if err != nil { - return err - } - p.auxFiles = append(p.auxFiles, file) - p.addAuxInterfacesFromFile(pkg, file) - } - return nil -} - -func (p *fileParser) addAuxInterfacesFromFile(pkg string, file *ast.File) { - if _, ok := p.auxInterfaces[pkg]; !ok { - p.auxInterfaces[pkg] = make(map[string]*ast.InterfaceType) - } - for ni := range iterInterfaces(file) { - p.auxInterfaces[pkg][ni.name.Name] = ni.it - } -} - -// parseFile loads all file imports and auxiliary files import into the -// fileParser, parses all file interfaces and returns package model. -func (p *fileParser) parseFile(importPath string, file *ast.File) (*model.Package, error) { - allImports, dotImports := importsOfFile(file) - // Don't stomp imports provided by -imports. Those should take precedence. - for pkg, pkgI := range allImports { - if _, ok := p.imports[pkg]; !ok { - p.imports[pkg] = pkgI - } - } - // Add imports from auxiliary files, which might be needed for embedded interfaces. - // Don't stomp any other imports. - for _, f := range p.auxFiles { - auxImports, _ := importsOfFile(f) - for pkg, pkgI := range auxImports { - if _, ok := p.imports[pkg]; !ok { - p.imports[pkg] = pkgI - } - } - } - - var is []*model.Interface - for ni := range iterInterfaces(file) { - i, err := p.parseInterface(ni.name.String(), importPath, ni.it) - if err != nil { - return nil, err - } - is = append(is, i) - } - return &model.Package{ - Name: file.Name.String(), - PkgPath: importPath, - Interfaces: is, - DotImports: dotImports, - }, nil -} - -// parsePackage loads package specified by path, parses it and returns -// a new fileParser with the parsed imports and interfaces. -func (p *fileParser) parsePackage(path string) (*fileParser, error) { - newP := &fileParser{ - fileSet: token.NewFileSet(), - imports: make(map[string]importedPackage), - importedInterfaces: make(map[string]map[string]*ast.InterfaceType), - auxInterfaces: make(map[string]map[string]*ast.InterfaceType), - srcDir: p.srcDir, - } - - var pkgs map[string]*ast.Package - if imp, err := build.Import(path, newP.srcDir, build.FindOnly); err != nil { - return nil, err - } else if pkgs, err = parser.ParseDir(newP.fileSet, imp.Dir, nil, 0); err != nil { - return nil, err - } - - for _, pkg := range pkgs { - file := ast.MergePackageFiles(pkg, ast.FilterFuncDuplicates|ast.FilterUnassociatedComments|ast.FilterImportDuplicates) - if _, ok := newP.importedInterfaces[path]; !ok { - newP.importedInterfaces[path] = make(map[string]*ast.InterfaceType) - } - for ni := range iterInterfaces(file) { - newP.importedInterfaces[path][ni.name.Name] = ni.it - } - imports, _ := importsOfFile(file) - for pkgName, pkgI := range imports { - newP.imports[pkgName] = pkgI - } - } - return newP, nil -} - -func (p *fileParser) parseInterface(name, pkg string, it *ast.InterfaceType) (*model.Interface, error) { - iface := &model.Interface{Name: name} - for _, field := range it.Methods.List { - switch v := field.Type.(type) { - case *ast.FuncType: - if nn := len(field.Names); nn != 1 { - return nil, fmt.Errorf("expected one name for interface %v, got %d", iface.Name, nn) - } - m := &model.Method{ - Name: field.Names[0].String(), - } - var err error - m.In, m.Variadic, m.Out, err = p.parseFunc(pkg, v) - if err != nil { - return nil, err - } - iface.AddMethod(m) - case *ast.Ident: - // Embedded interface in this package. - embeddedIfaceType := p.auxInterfaces[pkg][v.String()] - if embeddedIfaceType == nil { - embeddedIfaceType = p.importedInterfaces[pkg][v.String()] - } - - var embeddedIface *model.Interface - if embeddedIfaceType != nil { - var err error - embeddedIface, err = p.parseInterface(v.String(), pkg, embeddedIfaceType) - if err != nil { - return nil, err - } - } else { - // This is built-in error interface. - if v.String() == model.ErrorInterface.Name { - embeddedIface = &model.ErrorInterface - } else { - return nil, p.errorf(v.Pos(), "unknown embedded interface %s", v.String()) - } - } - // Copy the methods. - for _, m := range embeddedIface.Methods { - iface.AddMethod(m) - } - case *ast.SelectorExpr: - // Embedded interface in another package. - filePkg, sel := v.X.(*ast.Ident).String(), v.Sel.String() - embeddedPkg, ok := p.imports[filePkg] - if !ok { - return nil, p.errorf(v.X.Pos(), "unknown package %s", filePkg) - } - - var embeddedIface *model.Interface - var err error - embeddedIfaceType := p.auxInterfaces[filePkg][sel] - if embeddedIfaceType != nil { - embeddedIface, err = p.parseInterface(sel, filePkg, embeddedIfaceType) - if err != nil { - return nil, err - } - } else { - path := embeddedPkg.Path() - parser := embeddedPkg.Parser() - if parser == nil { - ip, err := p.parsePackage(path) - if err != nil { - return nil, p.errorf(v.Pos(), "could not parse package %s: %v", path, err) - } - parser = ip - p.imports[filePkg] = importedPkg{ - path: embeddedPkg.Path(), - parser: parser, - } - } - if embeddedIfaceType = parser.importedInterfaces[path][sel]; embeddedIfaceType == nil { - return nil, p.errorf(v.Pos(), "unknown embedded interface %s.%s", path, sel) - } - embeddedIface, err = parser.parseInterface(sel, path, embeddedIfaceType) - if err != nil { - return nil, err - } - } - // Copy the methods. - // TODO: apply shadowing rules. - for _, m := range embeddedIface.Methods { - iface.AddMethod(m) - } - default: - return nil, fmt.Errorf("don't know how to mock method of type %T", field.Type) - } - } - return iface, nil -} - -func (p *fileParser) parseFunc(pkg string, f *ast.FuncType) (inParam []*model.Parameter, variadic *model.Parameter, outParam []*model.Parameter, err error) { - if f.Params != nil { - regParams := f.Params.List - if isVariadic(f) { - n := len(regParams) - varParams := regParams[n-1:] - regParams = regParams[:n-1] - vp, err := p.parseFieldList(pkg, varParams) - if err != nil { - return nil, nil, nil, p.errorf(varParams[0].Pos(), "failed parsing variadic argument: %v", err) - } - variadic = vp[0] - } - inParam, err = p.parseFieldList(pkg, regParams) - if err != nil { - return nil, nil, nil, p.errorf(f.Pos(), "failed parsing arguments: %v", err) - } - } - if f.Results != nil { - outParam, err = p.parseFieldList(pkg, f.Results.List) - if err != nil { - return nil, nil, nil, p.errorf(f.Pos(), "failed parsing returns: %v", err) - } - } - return -} - -func (p *fileParser) parseFieldList(pkg string, fields []*ast.Field) ([]*model.Parameter, error) { - nf := 0 - for _, f := range fields { - nn := len(f.Names) - if nn == 0 { - nn = 1 // anonymous parameter - } - nf += nn - } - if nf == 0 { - return nil, nil - } - ps := make([]*model.Parameter, nf) - i := 0 // destination index - for _, f := range fields { - t, err := p.parseType(pkg, f.Type) - if err != nil { - return nil, err - } - - if len(f.Names) == 0 { - // anonymous arg - ps[i] = &model.Parameter{Type: t} - i++ - continue - } - for _, name := range f.Names { - ps[i] = &model.Parameter{Name: name.Name, Type: t} - i++ - } - } - return ps, nil -} - -func (p *fileParser) parseType(pkg string, typ ast.Expr) (model.Type, error) { - switch v := typ.(type) { - case *ast.ArrayType: - ln := -1 - if v.Len != nil { - var value string - switch val := v.Len.(type) { - case (*ast.BasicLit): - value = val.Value - case (*ast.Ident): - // when the length is a const defined locally - value = val.Obj.Decl.(*ast.ValueSpec).Values[0].(*ast.BasicLit).Value - case (*ast.SelectorExpr): - // when the length is a const defined in an external package - usedPkg, err := importer.Default().Import(fmt.Sprintf("%s", val.X)) - if err != nil { - return nil, p.errorf(v.Len.Pos(), "unknown package in array length: %v", err) - } - ev, err := types.Eval(token.NewFileSet(), usedPkg, token.NoPos, val.Sel.Name) - if err != nil { - return nil, p.errorf(v.Len.Pos(), "unknown constant in array length: %v", err) - } - value = ev.Value.String() - } - - x, err := strconv.Atoi(value) - if err != nil { - return nil, p.errorf(v.Len.Pos(), "bad array size: %v", err) - } - ln = x - } - t, err := p.parseType(pkg, v.Elt) - if err != nil { - return nil, err - } - return &model.ArrayType{Len: ln, Type: t}, nil - case *ast.ChanType: - t, err := p.parseType(pkg, v.Value) - if err != nil { - return nil, err - } - var dir model.ChanDir - if v.Dir == ast.SEND { - dir = model.SendDir - } - if v.Dir == ast.RECV { - dir = model.RecvDir - } - return &model.ChanType{Dir: dir, Type: t}, nil - case *ast.Ellipsis: - // assume we're parsing a variadic argument - return p.parseType(pkg, v.Elt) - case *ast.FuncType: - in, variadic, out, err := p.parseFunc(pkg, v) - if err != nil { - return nil, err - } - return &model.FuncType{In: in, Out: out, Variadic: variadic}, nil - case *ast.Ident: - if v.IsExported() { - // `pkg` may be an aliased imported pkg - // if so, patch the import w/ the fully qualified import - maybeImportedPkg, ok := p.imports[pkg] - if ok { - pkg = maybeImportedPkg.Path() - } - // assume type in this package - return &model.NamedType{Package: pkg, Type: v.Name}, nil - } - - // assume predeclared type - return model.PredeclaredType(v.Name), nil - case *ast.InterfaceType: - if v.Methods != nil && len(v.Methods.List) > 0 { - return nil, p.errorf(v.Pos(), "can't handle non-empty unnamed interface types") - } - return model.PredeclaredType("interface{}"), nil - case *ast.MapType: - key, err := p.parseType(pkg, v.Key) - if err != nil { - return nil, err - } - value, err := p.parseType(pkg, v.Value) - if err != nil { - return nil, err - } - return &model.MapType{Key: key, Value: value}, nil - case *ast.SelectorExpr: - pkgName := v.X.(*ast.Ident).String() - pkg, ok := p.imports[pkgName] - if !ok { - return nil, p.errorf(v.Pos(), "unknown package %q", pkgName) - } - return &model.NamedType{Package: pkg.Path(), Type: v.Sel.String()}, nil - case *ast.StarExpr: - t, err := p.parseType(pkg, v.X) - if err != nil { - return nil, err - } - return &model.PointerType{Type: t}, nil - case *ast.StructType: - if v.Fields != nil && len(v.Fields.List) > 0 { - return nil, p.errorf(v.Pos(), "can't handle non-empty unnamed struct types") - } - return model.PredeclaredType("struct{}"), nil - case *ast.ParenExpr: - return p.parseType(pkg, v.X) - } - - return nil, fmt.Errorf("don't know how to parse type %T", typ) -} - -// importsOfFile returns a map of package name to import path -// of the imports in file. -func importsOfFile(file *ast.File) (normalImports map[string]importedPackage, dotImports []string) { - var importPaths []string - for _, is := range file.Imports { - if is.Name != nil { - continue - } - importPath := is.Path.Value[1 : len(is.Path.Value)-1] // remove quotes - importPaths = append(importPaths, importPath) - } - packagesName := createPackageMap(importPaths) - normalImports = make(map[string]importedPackage) - dotImports = make([]string, 0) - for _, is := range file.Imports { - var pkgName string - importPath := is.Path.Value[1 : len(is.Path.Value)-1] // remove quotes - - if is.Name != nil { - // Named imports are always certain. - if is.Name.Name == "_" { - continue - } - pkgName = is.Name.Name - } else { - pkg, ok := packagesName[importPath] - if !ok { - // Fallback to import path suffix. Note that this is uncertain. - _, last := path.Split(importPath) - // If the last path component has dots, the first dot-delimited - // field is used as the name. - pkgName = strings.SplitN(last, ".", 2)[0] - } else { - pkgName = pkg - } - } - - if pkgName == "." { - dotImports = append(dotImports, importPath) - } else { - if pkg, ok := normalImports[pkgName]; ok { - switch p := pkg.(type) { - case duplicateImport: - normalImports[pkgName] = duplicateImport{ - name: p.name, - duplicates: append([]string{importPath}, p.duplicates...), - } - case importedPkg: - normalImports[pkgName] = duplicateImport{ - name: pkgName, - duplicates: []string{p.path, importPath}, - } - } - } else { - normalImports[pkgName] = importedPkg{path: importPath} - } - } - } - return -} - -type namedInterface struct { - name *ast.Ident - it *ast.InterfaceType -} - -// Create an iterator over all interfaces in file. -func iterInterfaces(file *ast.File) <-chan namedInterface { - ch := make(chan namedInterface) - go func() { - for _, decl := range file.Decls { - gd, ok := decl.(*ast.GenDecl) - if !ok || gd.Tok != token.TYPE { - continue - } - for _, spec := range gd.Specs { - ts, ok := spec.(*ast.TypeSpec) - if !ok { - continue - } - it, ok := ts.Type.(*ast.InterfaceType) - if !ok { - continue - } - - ch <- namedInterface{ts.Name, it} - } - } - close(ch) - }() - return ch -} - -// isVariadic returns whether the function is variadic. -func isVariadic(f *ast.FuncType) bool { - nargs := len(f.Params.List) - if nargs == 0 { - return false - } - _, ok := f.Params.List[nargs-1].Type.(*ast.Ellipsis) - return ok -} - -// packageNameOfDir get package import path via dir -func packageNameOfDir(srcDir string) (string, error) { - files, err := ioutil.ReadDir(srcDir) - if err != nil { - log.Fatal(err) - } - - var goFilePath string - for _, file := range files { - if !file.IsDir() && strings.HasSuffix(file.Name(), ".go") { - goFilePath = file.Name() - break - } - } - if goFilePath == "" { - return "", fmt.Errorf("go source file not found %s", srcDir) - } - - packageImport, err := parsePackageImport(srcDir) - if err != nil { - return "", err - } - return packageImport, nil -} - -var errOutsideGoPath = errors.New("source directory is outside GOPATH") diff --git a/vendor/github.com/golang/mock/mockgen/reflect.go b/vendor/github.com/golang/mock/mockgen/reflect.go deleted file mode 100644 index e24efce0ba6..00000000000 --- a/vendor/github.com/golang/mock/mockgen/reflect.go +++ /dev/null @@ -1,256 +0,0 @@ -// Copyright 2012 Google Inc. -// -// 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 main - -// This file contains the model construction by reflection. - -import ( - "bytes" - "encoding/gob" - "flag" - "fmt" - "go/build" - "io" - "io/ioutil" - "log" - "os" - "os/exec" - "path/filepath" - "runtime" - "strings" - "text/template" - - "github.com/golang/mock/mockgen/model" -) - -var ( - progOnly = flag.Bool("prog_only", false, "(reflect mode) Only generate the reflection program; write it to stdout and exit.") - execOnly = flag.String("exec_only", "", "(reflect mode) If set, execute this reflection program.") - buildFlags = flag.String("build_flags", "", "(reflect mode) Additional flags for go build.") -) - -// reflectMode generates mocks via reflection on an interface. -func reflectMode(importPath string, symbols []string) (*model.Package, error) { - if *execOnly != "" { - return run(*execOnly) - } - - program, err := writeProgram(importPath, symbols) - if err != nil { - return nil, err - } - - if *progOnly { - if _, err := os.Stdout.Write(program); err != nil { - return nil, err - } - os.Exit(0) - } - - wd, _ := os.Getwd() - - // Try to run the reflection program in the current working directory. - if p, err := runInDir(program, wd); err == nil { - return p, nil - } - - // Try to run the program in the same directory as the input package. - if p, err := build.Import(importPath, wd, build.FindOnly); err == nil { - dir := p.Dir - if p, err := runInDir(program, dir); err == nil { - return p, nil - } - } - - // Try to run it in a standard temp directory. - return runInDir(program, "") -} - -func writeProgram(importPath string, symbols []string) ([]byte, error) { - var program bytes.Buffer - data := reflectData{ - ImportPath: importPath, - Symbols: symbols, - } - if err := reflectProgram.Execute(&program, &data); err != nil { - return nil, err - } - return program.Bytes(), nil -} - -// run the given program and parse the output as a model.Package. -func run(program string) (*model.Package, error) { - f, err := ioutil.TempFile("", "") - if err != nil { - return nil, err - } - - filename := f.Name() - defer os.Remove(filename) - if err := f.Close(); err != nil { - return nil, err - } - - // Run the program. - cmd := exec.Command(program, "-output", filename) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - return nil, err - } - - f, err = os.Open(filename) - if err != nil { - return nil, err - } - - // Process output. - var pkg model.Package - if err := gob.NewDecoder(f).Decode(&pkg); err != nil { - return nil, err - } - - if err := f.Close(); err != nil { - return nil, err - } - - return &pkg, nil -} - -// runInDir writes the given program into the given dir, runs it there, and -// parses the output as a model.Package. -func runInDir(program []byte, dir string) (*model.Package, error) { - // We use TempDir instead of TempFile so we can control the filename. - tmpDir, err := ioutil.TempDir(dir, "gomock_reflect_") - if err != nil { - return nil, err - } - defer func() { - if err := os.RemoveAll(tmpDir); err != nil { - log.Printf("failed to remove temp directory: %s", err) - } - }() - const progSource = "prog.go" - var progBinary = "prog.bin" - if runtime.GOOS == "windows" { - // Windows won't execute a program unless it has a ".exe" suffix. - progBinary += ".exe" - } - - if err := ioutil.WriteFile(filepath.Join(tmpDir, progSource), program, 0600); err != nil { - return nil, err - } - - cmdArgs := []string{} - cmdArgs = append(cmdArgs, "build") - if *buildFlags != "" { - cmdArgs = append(cmdArgs, strings.Split(*buildFlags, " ")...) - } - cmdArgs = append(cmdArgs, "-o", progBinary, progSource) - - // Build the program. - buf := bytes.NewBuffer(nil) - cmd := exec.Command("go", cmdArgs...) - cmd.Dir = tmpDir - cmd.Stdout = os.Stdout - cmd.Stderr = io.MultiWriter(os.Stderr, buf) - if err := cmd.Run(); err != nil { - sErr := buf.String() - if strings.Contains(sErr, `cannot find package "."`) && - strings.Contains(sErr, "github.com/golang/mock/mockgen/model") { - fmt.Fprint(os.Stderr, "Please reference the steps in the README to fix this error:\n\thttps://github.com/golang/mock#reflect-vendoring-error.") - return nil, err - } - return nil, err - } - - return run(filepath.Join(tmpDir, progBinary)) -} - -type reflectData struct { - ImportPath string - Symbols []string -} - -// This program reflects on an interface value, and prints the -// gob encoding of a model.Package to standard output. -// JSON doesn't work because of the model.Type interface. -var reflectProgram = template.Must(template.New("program").Parse(` -package main - -import ( - "encoding/gob" - "flag" - "fmt" - "os" - "path" - "reflect" - - "github.com/golang/mock/mockgen/model" - - pkg_ {{printf "%q" .ImportPath}} -) - -var output = flag.String("output", "", "The output file name, or empty to use stdout.") - -func main() { - flag.Parse() - - its := []struct{ - sym string - typ reflect.Type - }{ - {{range .Symbols}} - { {{printf "%q" .}}, reflect.TypeOf((*pkg_.{{.}})(nil)).Elem()}, - {{end}} - } - pkg := &model.Package{ - // NOTE: This behaves contrary to documented behaviour if the - // package name is not the final component of the import path. - // The reflect package doesn't expose the package name, though. - Name: path.Base({{printf "%q" .ImportPath}}), - } - - for _, it := range its { - intf, err := model.InterfaceFromInterfaceType(it.typ) - if err != nil { - fmt.Fprintf(os.Stderr, "Reflection: %v\n", err) - os.Exit(1) - } - intf.Name = it.sym - pkg.Interfaces = append(pkg.Interfaces, intf) - } - - outfile := os.Stdout - if len(*output) != 0 { - var err error - outfile, err = os.Create(*output) - if err != nil { - fmt.Fprintf(os.Stderr, "failed to open output file %q", *output) - } - defer func() { - if err := outfile.Close(); err != nil { - fmt.Fprintf(os.Stderr, "failed to close output file %q", *output) - os.Exit(1) - } - }() - } - - if err := gob.NewEncoder(outfile).Encode(pkg); err != nil { - fmt.Fprintf(os.Stderr, "gob encode: %v\n", err) - os.Exit(1) - } -} -`)) diff --git a/vendor/github.com/golang/mock/mockgen/version.1.11.go b/vendor/github.com/golang/mock/mockgen/version.1.11.go deleted file mode 100644 index e6b25db2384..00000000000 --- a/vendor/github.com/golang/mock/mockgen/version.1.11.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2019 Google LLC -// -// 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.12 - -package main - -import ( - "log" -) - -func printModuleVersion() { - log.Printf("No version information is available for Mockgen compiled with " + - "version 1.11") -} diff --git a/vendor/github.com/golang/mock/mockgen/version.1.12.go b/vendor/github.com/golang/mock/mockgen/version.1.12.go deleted file mode 100644 index ad121ae63c5..00000000000 --- a/vendor/github.com/golang/mock/mockgen/version.1.12.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2019 Google LLC -// -// 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.12 - -package main - -import ( - "fmt" - "log" - "runtime/debug" -) - -func printModuleVersion() { - if bi, exists := debug.ReadBuildInfo(); exists { - fmt.Println(bi.Main.Version) - } else { - log.Printf("No version information found. Make sure to use " + - "GO111MODULE=on when running 'go get' in order to use specific " + - "version of the binary.") - } - -} diff --git a/vendor/github.com/jewzaam/go-cosmosdb/LICENSE b/vendor/github.com/jewzaam/go-cosmosdb/LICENSE deleted file mode 100644 index d6456956733..00000000000 --- a/vendor/github.com/jewzaam/go-cosmosdb/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/jewzaam/go-cosmosdb/cmd/gencosmosdb/gencosmosdb.go b/vendor/github.com/jewzaam/go-cosmosdb/cmd/gencosmosdb/gencosmosdb.go deleted file mode 100644 index ae04c7364dc..00000000000 --- a/vendor/github.com/jewzaam/go-cosmosdb/cmd/gencosmosdb/gencosmosdb.go +++ /dev/null @@ -1,96 +0,0 @@ -package main - -import ( - "flag" - "log" - "os" - "regexp" - "strings" - "unicode" - - "github.com/jewzaam/go-cosmosdb/pkg/gencosmosdb" -) - -var ( - pkg = flag.String("package", "cosmosdb", "package") - - packageRegexp = regexp.MustCompile(`^package .*`) - importRegexp = regexp.MustCompile(`(?m)^\tpkg "[^"]+"$`) - pluralRegexp = regexp.MustCompile(`templates`) - pluralExportedRegexp = regexp.MustCompile(`Templates`) - singularRegexp = regexp.MustCompile(`template`) - singularExportedRegexp = regexp.MustCompile(`Template`) -) - -func writeFile(filename string, data []byte) error { - f, err := os.Create(filename) - if err != nil { - return err - } - defer f.Close() - - data = packageRegexp.ReplaceAll(data, []byte("// Code generated by github.com/jewzaam/go-cosmosdb, DO NOT EDIT.\n\npackage "+*pkg)) - - _, err = f.Write(data) - return err -} - -func unexport(s string) string { - rs := []rune(s) - rs[0] = unicode.ToLower(rs[0]) - return string(rs) -} - -func run() error { - for _, name := range gencosmosdb.AssetNames() { - if name == "template.go" || name == "template_fake.go" { - continue - } - - err := writeFile("zz_generated_"+name, gencosmosdb.MustAsset(name)) - if err != nil { - return err - } - } - - for _, arg := range flag.Args() { - filesToGenerate := []string{"template.go", "template_fake.go"} - args := strings.Split(arg, ",") - - importpkg := args[0] - singularExported := args[1] - pluralExported := singularExported + "s" - if len(args) == 3 { - pluralExported = args[2] - } - singular := unexport(singularExported) - plural := unexport(pluralExported) - - for _, filename := range filesToGenerate { - data := gencosmosdb.MustAsset(filename) - data = importRegexp.ReplaceAll(data, []byte("\tpkg \""+importpkg+"\"")) - - // plural must be done before singular ("template" is a sub-string of "templates") - data = pluralRegexp.ReplaceAll(data, []byte(plural)) - data = pluralExportedRegexp.ReplaceAll(data, []byte(pluralExported)) - data = singularRegexp.ReplaceAll(data, []byte(singular)) - data = singularExportedRegexp.ReplaceAll(data, []byte(singularExported)) - - generatedFilename := strings.Replace(filename, "template", strings.ToLower(singularExported), 1) - err := writeFile("zz_generated_"+generatedFilename, data) - if err != nil { - return err - } - } - } - - return nil -} - -func main() { - flag.Parse() - - if err := run(); err != nil { - log.Fatal(err) - } -} diff --git a/vendor/github.com/jewzaam/go-cosmosdb/pkg/gencosmosdb/bindata.go b/vendor/github.com/jewzaam/go-cosmosdb/pkg/gencosmosdb/bindata.go deleted file mode 100644 index c2ad9297bac..00000000000 --- a/vendor/github.com/jewzaam/go-cosmosdb/pkg/gencosmosdb/bindata.go +++ /dev/null @@ -1,451 +0,0 @@ -// Code generated for package gencosmosdb by go-bindata DO NOT EDIT. (@generated) -// sources: -// cosmosdb/authorizer.go -// cosmosdb/collection.go -// cosmosdb/cosmosdb.go -// cosmosdb/database.go -// cosmosdb/document.go -// cosmosdb/permission.go -// cosmosdb/template.go -// cosmosdb/template_fake.go -// cosmosdb/trigger.go -// cosmosdb/user.go -package gencosmosdb - -import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time" -) - -func bindataRead(data []byte, name string) ([]byte, error) { - gz, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - clErr := gz.Close() - - if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) - } - if clErr != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -type asset struct { - bytes []byte - info os.FileInfo -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -// Name return file name -func (fi bindataFileInfo) Name() string { - return fi.name -} - -// Size return file size -func (fi bindataFileInfo) Size() int64 { - return fi.size -} - -// Mode return file mode -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} - -// Mode return file modify time -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} - -// IsDir return file whether a directory -func (fi bindataFileInfo) IsDir() bool { - return fi.mode&os.ModeDir != 0 -} - -// Sys return file is sys mode -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -var _authorizerGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x56\xdf\x8f\xdb\xb8\x11\x7e\x16\xff\x8a\x89\x81\x73\xa5\x40\x96\xf7\xd2\xdb\x3c\x18\xf0\x43\xee\x2e\x97\x5e\x9b\x0d\xd0\x5b\xa7\x05\xda\xeb\x03\x2d\x8d\x56\x84\x25\xd2\x4b\x52\xab\x75\xf7\xfc\xbf\x17\x43\x8a\x92\xfc\xa3\xc9\xc3\xb5\x0b\x24\xa6\xf8\x63\xe6\x9b\x99\xef\x1b\x72\xcf\xf3\x1d\x7f\x40\xc8\x95\x69\x94\x29\xb6\x8c\x89\x66\xaf\xb4\x85\x98\x45\xb3\x5c\x49\x8b\xcf\x76\x46\x43\x7d\xd8\x5b\xb5\xac\x1a\x9e\x4f\x3e\x4d\xc5\xdf\xdc\xbe\xa5\x09\x94\xb9\x2a\x84\x7c\x58\x6e\xb9\xc1\xb7\xdf\xd1\x54\xd9\xb8\x93\x12\xed\xb2\xb2\x76\x1f\xc6\xad\xae\x69\x68\xac\x16\xf2\xc1\xb8\xe1\x41\x3a\xa3\x56\x34\x38\x63\x09\x63\xf6\xb0\x47\x78\xd7\xda\x4a\x69\xf1\x6f\xd4\x20\xa4\x45\x5d\xf2\x1c\xe1\x85\x45\xc3\x7c\xdc\xc3\xcb\x7e\xf0\xbf\x29\xbc\x26\x3f\xd9\x2f\xf8\xd8\xa2\xb1\x29\x78\x17\xe1\x37\x01\xd4\x5a\x69\x76\xec\xed\x37\xdc\x58\xd4\x7f\xc1\xc3\xc4\x91\xb1\xba\xcd\x2d\x79\x19\x56\xe1\x9f\xff\xda\x1e\x2c\xd2\xb1\xb2\x95\x39\xc4\x1c\x5e\x5f\x39\x9a\xc0\x04\x97\x7d\x86\x0b\x6c\x1a\x1f\xcf\xf1\x69\x34\xaa\xd5\x39\x6e\x0e\x7b\x1c\xbf\x3e\x0a\xb9\x3b\x85\x4c\x78\x0a\x6e\x11\x56\x6b\xa0\x1c\x65\x9f\x54\x17\x27\xd9\xe7\xcd\x0f\x71\x92\xfd\xa4\x74\xc3\x6d\x3c\xbb\x53\x32\x85\x9b\x37\xf0\x67\x2e\xe1\xcd\xcd\xcd\x5b\xf8\xf6\x76\x75\xf3\xdd\xea\xe6\x16\x3e\xdc\x6d\x66\x09\x63\x51\x45\xe7\xa9\x80\xd9\x27\xec\x62\x5f\x3a\x1a\xa6\xc0\xb3\x21\xa2\x84\x45\x65\x63\xb3\x9f\xf6\x5a\x48\x5b\xc6\x55\x0a\xb3\x6f\xcc\xaf\x72\xfa\xef\x57\x39\x0b\x39\x35\xd9\x46\x7d\x54\x1d\xea\x58\xe3\x63\x76\x87\xb6\x52\x45\xf2\xa5\xc0\x2e\x0f\x52\x60\x09\xc1\x23\x0b\x7f\x42\x5e\xa0\xce\xee\xd1\xc6\xb3\x90\x4f\x6e\x85\x22\x8f\xad\xae\xb3\xbf\xb6\xa8\x0f\xef\x4d\xce\xf7\x18\x13\xcc\xfb\x1e\xe6\x8c\x2a\xba\xf6\x41\xcc\x9f\x50\xaf\xbf\xcd\x6e\xe6\x46\x3c\xac\xbf\x31\xb3\x14\x3c\x25\xb3\x7b\x5b\xbc\xef\x59\x9a\xb9\x01\x6e\xd4\xbd\x43\x13\x57\xd9\x7d\xdb\xc4\x52\xd4\x09\xfd\x5d\x62\x79\x5e\x34\x66\x41\x48\x67\x29\x38\xc0\x0e\xaf\x6d\xb5\x04\x29\xea\x81\x1b\x9f\xb0\xbb\xbb\xa4\x46\x3c\x72\x29\x94\x35\x1e\x57\x53\x5f\xe3\x84\x8a\xbc\x75\x1f\x54\xa6\x2b\x90\x7f\x44\x82\xdc\x03\x9e\xd6\x4b\x94\xee\xd4\xab\x35\x61\x21\x33\x13\x68\xce\x20\x8b\x8e\x23\xde\xf9\x15\xf2\xbe\x0c\x73\x2b\xd8\x1e\xd3\x10\x93\x93\x89\x55\x3b\x94\x57\x25\xe2\x56\xc0\xff\xf9\xc0\x58\x84\xcf\x7b\xa1\x5d\xc5\xc0\x53\x75\x23\x1a\x64\x51\xae\x64\xd1\xef\x84\xd7\x24\x77\xd2\x45\xc1\x22\x9e\x3f\xb6\x82\x4e\x02\xc0\x56\xa9\x9a\x45\x35\x37\xf6\x9d\xb5\xd8\xec\xed\xd4\xc0\x03\xda\x4d\x70\x47\xa9\x3e\xd7\x7e\x02\xb1\x87\x13\x34\x2f\xb1\x7b\x3f\x62\x19\x2c\xf9\x04\xfb\x8c\x9f\x48\xfa\x2c\xcc\xff\xb7\x9c\x9d\xbb\xa1\xda\x3c\xf3\x89\x40\x17\x23\x39\xfc\x52\x59\xfb\x8a\x46\x7c\x2a\x10\xcf\x56\x32\x76\xa9\x0b\xce\x8b\x4b\x51\x38\x04\x09\x8b\xf2\x56\x6b\x94\x96\x92\xf3\xbb\xfa\xcb\x57\xf5\x7b\x05\xee\x57\x94\x36\x81\xf6\xdf\x05\xb7\x39\x2d\xdc\x19\x0d\xf0\x2a\x07\x06\x36\xfd\xaf\xa8\x94\x4c\x6f\xab\x97\x51\x6b\x67\xac\x7a\x71\xdf\x2b\x08\xd5\x1f\xac\xae\x26\xe3\x11\xde\x6a\x18\xa5\x44\xc0\x62\x05\x4e\x3a\x9f\xb0\x23\xf5\xc4\x73\xf7\x75\xd7\x5a\x7c\x7e\x39\x26\x47\x4a\xca\x72\x09\x1f\xd0\x82\x77\x6f\xc0\x56\x08\xad\x2c\x50\xd7\x07\xd2\x58\xa0\x64\x46\xfb\x7e\x2e\xdd\x72\x98\x03\x61\xa0\xd4\x68\xaa\x14\xa4\x02\x8d\x6e\x4c\x93\x7b\xd4\xa5\xd2\x0d\x16\xd9\x17\xc4\x72\x4e\xdf\x73\xbd\x24\x10\x0f\x15\x19\xba\xdd\x75\x10\x2e\x11\x84\xb6\x13\xb6\x12\x12\x6c\x25\x8c\x4b\x3a\x74\x42\x16\xaa\x4b\xa1\xdd\xbb\xcb\x50\x58\x40\xfe\x40\xb1\x65\xce\xd6\x86\x36\xf2\xba\x56\x9d\x01\x65\x2b\xd4\xf0\xa0\xb4\x6a\xad\x90\x68\xc0\x2a\xd8\x21\xee\x41\xb7\x52\x92\xf1\xed\x01\x5a\x43\x03\x72\x2f\x95\x5d\x1c\xd0\x2e\x9c\x6b\x2c\x9c\xb5\x01\xd2\x13\xaf\x5b\x84\xae\x12\x35\x82\x92\x38\x1a\xed\x71\x98\x93\x08\x32\xd7\xeb\x8c\xed\xc1\xc2\x1a\x6e\xe1\xb5\xe7\xcc\x9d\x90\xad\x45\x00\x20\xac\x2a\x44\x41\x87\x3d\xdd\x44\x09\xb7\xd0\x08\x69\xa0\xc6\xd2\x12\x62\x8f\x27\x58\xdc\xf2\x7c\xa7\xca\x12\xd6\xf0\xc7\x9b\x60\xf3\x1e\x5d\x67\x5d\x2e\xe1\x4e\x48\xd1\xb4\x0d\x74\x5c\xf8\xc6\x09\x5b\xb4\x1d\xa2\x04\xee\xbb\xa9\x61\x91\xa4\xec\xf5\xa5\xea\xd9\x87\xc5\xa9\xe8\x53\x28\x79\x6d\xb0\xff\x61\x2e\x15\xfd\x09\xc0\xe7\xbc\x6e\x8d\x78\x42\xa8\x55\xbe\x63\x11\xcf\xc8\x79\xf6\x31\xfb\xa8\xf2\x5d\x9c\x84\x0b\xc1\xf5\x33\x37\x64\x2c\x2a\x7d\xbb\x8b\x82\x33\x5a\x1b\xa9\x9e\xfd\x6c\xfe\x81\x5a\xc5\x09\xfc\xf6\xdb\xe9\xc2\xf7\x58\x2a\x8d\xb1\x54\x5d\xc2\x22\xd7\x0a\x7b\x03\x64\x8c\xbe\x5f\x85\x9e\x49\x45\x74\x93\x03\x07\xc6\x0a\x75\xa2\xae\x07\xf8\x43\xa6\x33\xb7\x7b\x72\x7e\x48\x0a\xac\xc1\xea\x16\x53\xf7\xbf\xdb\xb5\xd5\xc8\x77\x34\x3a\x32\xef\xe1\x03\x5a\x4b\x2e\x2b\xd4\x08\x0d\x72\xa7\x32\x6e\x3d\x4d\xcf\x3c\xbb\x5a\x50\x06\x9c\x0e\x5d\xbd\x0b\x0f\x81\x45\xd1\x11\xb0\x36\x48\x55\x3f\x09\xfc\x5d\x51\xc4\x0b\x4f\x9e\x64\x9a\x05\x1f\xa3\x0b\x71\x20\x8c\x21\x72\x8a\x02\xb6\xad\xbd\xae\x1c\x9c\x0a\x27\xf6\xec\x4a\xae\x25\x70\x3e\x07\x9e\x4d\xae\x5e\x07\xa3\x27\xdc\x15\x18\xbd\x74\xb9\x3c\xd3\x19\xa1\x90\xca\xc2\x60\x78\xa9\x51\x62\x17\x74\xd6\xb7\x3d\x2e\x0b\x90\x24\xa5\x8a\x9b\xc0\x4e\x52\x9d\xb7\x6b\x15\x14\x0a\x8c\x9a\x46\x41\xc8\x88\xf5\xc6\xd1\xdd\xa4\x57\xb3\x5d\x28\x10\xf6\xf7\x94\xf6\x1a\x79\x5a\xe3\x89\x83\xcf\xc2\xb8\xba\xfb\xd4\x4f\x9b\x42\xc8\x42\x68\x07\x1e\x84\xdf\x37\x4a\x61\xe2\xb0\xaf\xfc\xd5\x82\x52\xf6\xf2\x5a\x91\x57\x35\x14\xb4\x8f\xd7\xa8\xbe\x67\x09\x6b\xc2\xdd\xe8\x91\x7c\xcd\x21\x0b\x15\xeb\x90\xae\x14\x47\xde\xf4\x94\x9e\x12\xbb\x93\xd8\xac\x82\x2d\x86\xe4\x15\xcb\x9e\xbd\x2c\x0a\xaa\xff\x3b\x17\x96\x34\x7f\x9c\xf4\x81\xcf\xb2\x76\x9d\x80\xfa\xd1\x2f\x58\x23\xef\x93\x47\xb3\x84\x5e\xaa\x69\x4b\xe6\x1a\x61\x4b\x4b\x58\x30\x16\x3d\x71\x3d\xde\xa7\xee\xf1\x13\x0a\xf7\xc2\xae\x55\x87\xb8\xb3\xa5\xf6\x66\xb0\xc6\xdc\x0b\x2b\x1c\x59\x9e\xf7\x56\x16\x79\xfb\x57\x6e\xf1\x7e\x49\x62\xf7\x37\x17\x77\x78\xc8\x46\x27\x7a\x80\x35\x48\xd5\xb1\x28\x0a\xfb\xd2\x93\x0b\x9b\x80\x53\xe6\xc3\x75\xed\x5f\x70\x1e\xf7\x3b\xab\x1a\x91\xf3\xba\x3e\xa4\xd3\x9e\x6f\x2a\xae\x43\x37\xf8\x83\x71\xe9\xf7\x89\x9f\x4f\x2c\x67\x63\xbe\xc7\x2e\x1b\x1e\x86\xeb\xf1\x61\x48\x7e\x3e\xf7\xb6\x5d\x0d\xe7\x27\xf0\xfa\xd7\x48\x28\xf3\x05\x65\x42\x50\xcc\x69\x27\xa8\x74\xd2\x95\x48\x3c\xe7\x4f\x96\x93\x16\xf6\xea\xa4\x3d\x53\xd4\xd2\x5f\xce\x21\xe4\x92\x8b\x1a\x8b\x0c\x7e\x14\x26\xe7\xba\xf0\x9a\x72\x8f\x61\xea\x06\x13\x80\x3d\xaf\x17\x0b\x63\x49\x7f\xae\xc1\x2d\x16\x13\x66\x92\x03\x9f\x6f\x7a\x08\x7a\x72\x4f\x5b\xd9\xba\xbf\xba\xa2\x4b\x5e\x8e\x73\xdf\x6b\xc5\x8b\x9c\x9b\x40\xe1\x00\x60\x78\x95\xb3\x23\xfb\x4f\x00\x00\x00\xff\xff\xd2\x89\xf7\x59\x1a\x11\x00\x00") - -func authorizerGoBytes() ([]byte, error) { - return bindataRead( - _authorizerGo, - "authorizer.go", - ) -} - -func authorizerGo() (*asset, error) { - bytes, err := authorizerGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "authorizer.go", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _collectionGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x59\x4f\x6f\xdb\x38\x16\x3f\x5b\x9f\x82\xa3\x43\x61\x27\xae\x7d\x59\xec\xa1\x80\x0f\x45\x32\xed\x74\xdb\xa4\x41\xd3\x9d\x59\x20\x08\x3a\x8c\xf4\x6c\x73\x22\x91\x1a\x92\x6a\x92\x09\xf2\xdd\x17\x24\x45\x89\xa4\xc8\xc8\xe9\x2c\xb0\x3d\xa4\x21\xdf\x7b\x3f\xbe\xff\x7c\x62\x1a\x5c\xdc\xe2\x1d\xa0\x82\x89\x9a\x89\xf2\x26\xcb\x48\xdd\x30\x2e\xd1\x3c\x9b\xe5\x05\xa3\x12\xee\x65\x9e\xcd\x72\x0a\x72\xbd\x97\xb2\xc9\xb3\x45\x96\xad\xd7\xe8\x84\x55\x15\x14\x92\x30\x8a\x38\x34\x1c\x04\x50\x29\x10\x46\x45\xbf\x9f\xc9\x87\x06\x5c\x3e\x21\x79\x5b\x48\xf4\x98\xcd\x3e\x9c\xa2\xf8\x3f\x21\x39\xa1\xbb\x18\xe5\xf7\x3f\x04\xa3\x6f\x72\x52\x2e\x59\x4d\x24\xd4\x8d\x7c\xc8\x7f\xcf\x66\x5f\x40\xb0\x96\x17\x30\x42\x9c\x44\xfa\xc6\x43\xac\xaf\xa4\x06\x21\x71\xdd\x84\x12\x84\xca\x84\xbe\x16\x4b\x0a\x1f\xea\x12\xaa\xed\x8f\x19\xf8\x4d\x40\xb5\xf5\xc1\x7e\xfe\x8a\xa3\x12\x07\x80\x81\xc4\x3b\x1f\xec\x94\x15\x6d\xad\x63\xf5\x62\xb0\x92\x15\xa1\x99\x92\x71\x28\x2f\x38\x2b\xa0\x6c\x39\x88\x97\x98\xd9\xf0\x11\xdc\x57\x4e\x76\x3b\xe0\x23\xd5\x0e\x80\x93\x9d\xa8\x0f\xf8\x6f\x01\xfc\x14\xb6\x84\x42\xf9\xae\xa5\x3a\x0b\xc5\x81\x80\x6d\xb9\x0d\xc0\x4e\x18\xdd\x56\xa4\xf8\x11\xcf\x15\x56\xd4\x47\xfc\x40\x4b\xb8\x27\x74\x77\xc1\x2a\x52\x3c\x38\x72\x47\x49\x8a\x2d\x03\x8f\xee\xa3\x5e\x60\x2e\x89\x32\xf5\x23\x3c\x78\xda\x1c\x25\x29\x1d\x6a\xe3\xd0\x03\x47\x52\xf2\x67\x0b\x1f\xe1\x21\x54\xe8\x28\x49\xe9\x30\x5b\x9f\x1e\x77\xa9\xaa\xe2\xaa\x55\x27\x77\x28\x47\x49\x4a\x07\x5b\x24\xe8\x3e\xfe\xdb\xaa\x62\x77\x67\x58\x02\x27\xb8\x22\x7f\x41\xf9\x2b\x81\x3b\x15\xbf\x1b\xc6\xaa\x58\xc0\x7a\xb5\x71\x54\xd2\x47\x7f\x0f\x4c\x34\x58\x12\x5c\x29\x6d\xc9\x90\x01\x47\x49\x4a\x87\xbe\x0b\xe8\x1e\xee\x93\xee\xaf\x41\x06\xb8\x3d\x96\x22\x1b\x7e\xd4\x68\xaa\xe9\xb4\x81\xc4\xd0\x6d\xdf\xb6\x92\xd5\x58\x92\xc2\x6a\x11\xb1\xde\x9a\x6d\x59\xe3\x89\x7a\xc6\x4a\xd0\xec\xfe\x59\x7a\x3b\xc8\x4c\xb5\x17\x82\x14\x55\x5b\x42\x79\x81\xe5\x5e\xd7\xd0\xd5\xb5\xbb\xe5\xa7\xb7\xc3\x1a\x34\xc3\xfb\x83\x51\xe0\x3e\x89\x72\xc2\xea\x86\x09\x22\x41\x1b\x02\x02\x5d\x5d\xfb\x5b\x03\x4a\x11\xb0\x4e\xc6\x4a\x7b\xe3\xd9\x78\xa1\x9a\x95\x10\x0b\x9a\x16\x35\xed\x24\x05\x5c\x30\x2a\x24\xa6\x52\x64\xfa\x37\x75\x4d\x8f\xb9\x4e\x18\x15\x44\x48\xa0\x32\x06\xb1\x41\xf9\xc0\x90\xc7\xe4\x3f\xe1\xbf\x6c\x25\xc7\xe5\x15\x83\x9d\x04\x3c\xf7\x87\x76\x1b\x12\x6a\xb0\xdc\x5b\x83\x1d\xee\x21\x47\x6d\xec\x6c\x2f\xed\x3b\x92\xdc\x47\x52\x51\x07\xcc\xc4\xc9\x4d\xbb\x74\x70\x62\xf1\x70\x02\xe0\x28\x72\x8a\x25\xfe\xaa\x08\x86\xd2\x2f\xbb\x73\xca\x6e\xed\x2b\xf5\x91\xd0\xd2\x71\x57\xbf\xec\x84\x6e\x09\x0d\x46\x8d\x0b\x0e\x05\x11\x6a\x28\xf2\x67\x0b\x6b\xb6\x25\xa7\xec\xe9\xd5\x8a\xd8\x85\x94\x8e\x48\x19\xe7\x58\xd8\x0b\x84\xd9\xd5\x13\x52\x89\x65\x19\x2e\x87\x5b\xce\x17\xdc\xa0\xdc\xd0\xf2\x40\xe2\xbc\xad\x6f\x80\xc7\x25\x0c\x2d\x94\xb8\x60\xbd\x3b\x46\x12\x9a\x36\x16\xa8\x1e\x76\x8c\x26\x04\x34\x2d\x14\xf9\x44\xa8\xb5\x65\x24\x32\xd0\x86\xe4\xb6\xf1\x8c\x79\x5a\x05\xd6\x71\xb2\xe6\x0b\x1d\xac\x37\x53\xce\x55\xc4\x5f\xb0\xd8\xfb\xa9\xb3\x41\xb9\xda\xcc\x1d\xa6\x2f\x98\xee\x20\x64\xd2\x9b\x2e\xd7\xa5\xb9\x54\x7c\xae\x6e\xd3\x5a\xe4\x36\xd0\xc0\x28\xdb\x30\x9d\x72\xf5\xb8\x83\x72\xed\x6a\x35\x55\xaa\x4f\xdd\x77\x82\xd7\x56\x83\x6f\x85\x8e\xe6\x16\x64\x20\x70\x75\x1d\x36\x89\x89\x63\x67\x9f\x79\x09\x1c\x99\x9f\x96\x8b\xa9\x55\x44\x3b\xc3\xe5\x7b\x41\xf3\x1a\x5d\x0c\xd9\x89\xa8\xd9\x88\x44\x53\x13\xde\x8a\x02\x68\xa9\xab\xc4\x30\x6e\x50\x8e\xed\x5e\xde\x31\x9d\x42\xcf\xd5\x33\x95\x30\x70\x99\x28\x79\xa3\x9a\xe7\xb4\x7e\x48\x43\xb7\xd0\xdd\xfc\x1e\xb3\xef\x2e\xa1\x6f\xc8\x60\x42\x75\x5c\x27\xe2\x8d\xcc\x45\xd4\x7b\xc9\x4e\xf6\x2b\xf0\x48\x1f\x1b\x0e\xf9\x6e\xe8\x11\xdf\x8f\xce\x48\x9b\xe9\x14\xda\x48\xca\x89\xce\x88\x16\x09\x54\xc8\xa3\xab\x6f\x24\xd8\x57\xa0\x89\x46\x38\xe4\x7a\x9a\x9a\x09\x57\xab\xe9\x8e\x63\xa1\xcc\x10\x97\x9e\xa2\x6e\xb1\x7e\x31\x1a\x98\x63\x97\xd9\xc0\x9d\x50\x21\x38\x7b\x94\x0d\x7d\x2e\x24\x73\xc0\x96\x6d\x62\xfe\x0e\x0a\xd8\x70\x21\xde\xb3\x79\x3e\x48\xa2\x0c\x6a\xf5\x23\x65\xe4\x5f\x4a\xdc\x9d\x37\xeb\xd1\x9c\x19\x91\xb2\x83\xe1\x33\x9f\x6a\xee\xc0\x17\x93\x9f\x3c\xc3\x7e\x04\xff\xe8\x19\x56\xfe\x05\xc1\x18\x4d\x9a\xcf\x04\xc4\x99\x39\x9f\x85\x73\xca\xe9\x59\xbe\x48\x69\x3d\xc7\xff\x09\x0b\xf9\x1b\x27\x12\xf8\x6f\x84\x8a\xe7\xa1\xf5\x7c\xe9\xb2\xe7\xcf\x63\x9f\xb4\x42\xb2\xfa\xb0\xac\x51\xb3\xaf\x66\xb7\xa5\x3d\xfa\x54\xf3\xfc\x39\x7c\xa8\x69\xd7\x92\x9d\xf1\xe0\x48\x68\xc8\xe7\xaf\x31\xba\x3b\x41\xca\x70\x7a\x7c\x8a\xea\x11\x4e\x77\x23\x4d\xf4\x84\x27\xe2\xfa\x84\x93\x5e\x94\x1e\x89\x60\x8c\xef\x3d\xb0\x1d\xc7\xcd\xfe\x21\x8e\xb2\x41\x79\xcf\x31\x7e\x1b\x14\xae\x09\xc3\xd3\xa0\x08\xdf\x06\x85\xe3\xc1\x13\xd6\xf6\x77\x49\x74\x3a\xfe\x56\x28\x8e\xf4\x3b\xa0\x5f\x80\xc9\xe7\x3e\xf7\xf4\xab\xeb\x23\xe7\xa1\xb2\x13\xb1\x4f\x65\x0e\xe3\xc4\x35\xa6\x07\x32\xcf\x66\xff\x1a\xe3\x9a\x3e\xbe\xc8\x3a\xb9\xb8\x0f\xa2\xae\x78\x91\x43\x50\xba\xf9\x25\xbd\x13\x51\xef\xea\x7a\xb4\x69\xe5\xc7\xdc\x87\x78\xea\xb9\x1b\x5f\xbb\x2a\xe1\x29\xf7\xfa\x20\x42\x10\xba\x7b\x47\xa0\x2a\x45\x16\x7d\x59\x4e\xf5\xe3\xc3\x5f\x94\x27\x10\x0e\x7a\x49\x4e\xbd\x21\xbf\xe0\x05\x79\x4a\x8d\x83\x5e\x8e\xa7\x40\xc6\x2f\xc6\x67\xf8\x5e\x7f\x05\x08\xf2\x1d\x0e\x03\xa9\x1d\x89\x00\x8b\x50\xfd\x00\xf0\x02\x2c\x47\x22\x15\xa8\x0b\x0e\x5b\x72\x3f\xed\x64\x4e\x4a\xc3\x1a\x44\x6b\xcf\x59\xbb\xdb\x37\xad\x7c\xc7\xb1\xe9\x00\xdb\x8a\x61\xf9\xcf\x7f\xa4\x80\xe4\x48\x22\x7c\x17\xc7\xb2\xf5\xdf\x89\x47\x49\xdc\xf1\x74\x88\x42\xaf\x46\x25\x18\x3e\xd4\x8f\x46\x79\x5f\xaf\xc6\x48\xf8\x30\x9f\x2e\xcf\x43\xf6\x09\x3f\x55\x62\x6a\x5e\x77\x2d\x98\x2a\x62\x64\x6c\x4b\xd4\x72\x07\x92\x98\xe2\x5d\x96\x89\x61\xde\x61\xfd\x4c\x2b\x42\xd3\x67\x6d\x50\xce\x34\x87\xbd\xaf\xbc\x26\x82\x38\x48\xac\x66\x94\xef\xb8\x6a\x41\x20\xb9\xc7\x12\x95\x0c\x51\x26\x51\x8d\x1b\x24\x99\x6d\x3f\x5b\xc3\x5f\xb6\x3a\x22\xff\xba\xfc\x7c\xae\xc0\x6a\xcc\xc5\x1e\x57\x15\xa1\xbb\x75\x4b\x9d\xd5\x0a\x05\x07\x91\xba\xa9\x40\xff\x2d\x46\xc9\xed\x88\xdc\xb7\x37\xab\x82\xd5\xeb\x76\xc7\xf8\x1f\x64\xbd\x63\xeb\x82\x95\x50\xac\x5c\x31\xe0\x2b\xe3\x49\x1f\x6b\xe8\x88\xb5\xd2\xf2\xca\xf8\xf3\x9a\x50\x09\x7c\x8b\x0b\x78\x7c\xea\x67\xc9\x12\x0a\x57\x16\x11\x81\x0a\x5c\x55\x50\x6a\xd3\x40\x22\x8c\x6a\x43\x37\x16\x22\x4c\x4b\xe3\x0c\xd4\x60\xc2\xb3\x6d\x4b\x0b\x34\xaf\xb7\xe8\xc8\x53\x61\x31\x86\x9e\x1b\xf9\xab\xeb\x9b\x07\x09\xcb\x0e\xc3\x51\x69\x61\x5e\xa2\x1f\xb3\x19\xd9\xa2\x7a\xbb\xaa\xd1\x66\x83\x28\xd1\x3b\x33\xb3\x4e\x18\xf3\xf8\x94\xcd\x9e\xb2\xd9\x5c\x31\x2d\x3a\xba\x39\x6d\x71\x8d\x36\xe6\xa4\x6c\xc6\x41\xb6\x9c\x22\xc9\x5b\x48\x59\xaf\xc3\xdd\x72\xaa\xe2\x0c\xda\x7a\xb6\xb5\x81\xbd\xdb\x93\x62\x8f\x30\x07\x1d\x7b\x2f\xe8\x2f\x70\x82\x98\x2f\x12\x46\x28\x33\x3b\x15\x95\x1d\x4a\x45\x69\x06\x33\x3b\x6f\x9c\x54\x04\xa8\x74\x82\x7b\x54\x62\x89\x6f\xb0\x00\x43\xc9\x66\xcd\xf0\x10\xd3\x9b\x18\x48\x13\xff\xcf\xb2\xa8\x30\xa2\xc1\x04\x66\x99\xad\x7a\x7a\x0a\xe1\x80\x25\xcc\xbb\xbf\x02\xaf\x4e\xcc\xff\x4b\xe4\xcc\x4a\x0b\x34\x77\x56\x4b\x04\x9c\x33\xbe\xc8\x66\x9f\x88\x90\xf3\x85\x83\xff\x41\x02\xc7\x92\x71\x43\x7a\x5b\x55\x21\xac\x8f\x24\x06\xa8\xf7\x20\xc7\x2a\x18\x93\x53\xa7\x9f\x42\x05\x93\x8a\x6b\x66\x75\x8d\x34\x15\x2e\x7e\xcc\xca\xf1\xd8\xf3\x9c\xa6\x91\x21\xc9\x22\x8d\x43\xaf\xbc\x64\x7d\xe6\x26\x40\x98\x1c\xd9\x4c\x9d\x48\x68\x8b\xed\xdf\xd8\x55\x2a\xcc\x4a\x46\x87\xcf\x6a\x55\x65\xa3\xec\xe8\xc1\xc3\xfc\x20\x36\x52\x41\x86\x0c\x02\x6e\x8e\x9c\xc3\xfd\x28\x3c\xa9\x50\x1a\x15\xce\xe1\x6e\x94\x76\xb6\x08\x31\xa2\x70\x17\x49\x56\x5d\x6e\x11\xc1\x79\x81\x4e\xbd\x8a\x58\xa2\xf2\x86\x94\xbd\xd3\x47\x07\x0d\x25\xf7\x2a\xf4\xa4\x6a\x3a\x7e\x79\xbd\x41\xc5\x6a\x1e\x94\xdc\x62\x99\xcd\x74\xd5\xbd\x71\xee\xcd\xbc\xbc\x11\xeb\x1c\x1d\xeb\xc3\x97\xaa\x35\x3d\x65\x5d\x8b\x28\xd0\x28\x64\x0b\x84\x55\xfa\xcb\x7b\x34\x4a\x16\x12\xf1\x77\xc2\x9b\xca\x14\x5c\x55\x0a\x5c\xa0\x37\x1b\xf4\xca\xe1\x79\x7c\xca\xb2\xd9\x96\x71\xdd\x48\x35\x87\x96\x52\x6c\x64\x65\x22\x26\xef\x17\xd9\x4c\xf5\x5d\xb5\xff\xd3\xd0\x76\xad\x7b\x28\xa9\xb4\x4c\x36\x53\x8d\x56\x31\x9a\x93\x9c\x0e\x3d\xbb\xe1\x80\x6f\x35\x43\x36\xeb\x75\x59\x99\x6f\x97\xe3\x0d\x72\x96\x2e\xdd\x19\xb0\x2d\xcf\xb0\xe5\x03\x0d\x1f\x68\x1b\x84\x9b\x06\x68\x39\x8f\x51\x97\x68\xb4\xb5\x5a\xad\x16\x99\x56\xac\xb3\xc7\xca\x2d\x95\xfa\x13\xe1\xb1\x7d\x2f\x16\x21\x0a\x77\x4a\x20\xe8\x0e\xe1\x96\x71\xf7\x10\x28\xb5\xda\xa0\x62\x55\x32\x85\xba\x44\x7b\x29\x9b\xd5\x19\xc8\x3d\x2b\x2f\x98\x90\x4b\x54\xac\x54\x4e\x1d\xe7\x6b\xad\x64\xbe\x44\xb9\xfd\xc5\x50\x3a\x11\x33\xc1\x18\xfd\xca\x25\x7a\xd5\x69\xb3\x34\xd9\xac\x6d\x5b\x58\x93\x27\x8c\x4c\x76\xe8\x78\x8d\xb8\xfd\xe8\x31\x44\x7b\x83\x8a\xa9\x94\xef\xbb\xfe\xd8\xa9\xcf\x24\x78\xa7\x47\xb1\xea\x2a\x46\xb9\xc3\x28\xbe\x98\x38\x4f\xdf\x1a\xb1\x00\x2a\x56\xa7\x43\xfc\x9d\xd0\xbd\x87\x51\xe4\xd6\xf9\xb1\x39\x60\x14\xc1\x08\x87\x13\xd2\xcf\x1f\x97\xa6\xe4\x5e\x1e\x48\x7b\xd9\xa5\x8c\x8d\xdc\x7a\xdd\xc8\xa5\xa8\x2b\xfd\x8d\xb8\xd9\xa0\x3c\xd7\x45\xdd\x79\xfc\x67\xce\x15\xe1\x0b\xfc\xd9\x12\x0e\xa5\x9e\xb6\xf6\x80\x4b\xe0\xba\xd9\x68\xcd\x7f\xd1\xeb\xc7\x81\xb2\xba\x04\x39\xcf\x3f\x6c\x5f\x9f\x61\x59\xec\xf3\xe5\x70\xc0\xc2\x09\x65\xc4\x91\xc6\x84\x84\xa7\x56\x1f\x4e\xa7\x9c\xa9\x59\x1c\x6f\x9e\x33\xed\x01\x75\x1d\x68\xa7\xea\x1f\x9d\x92\x53\x89\xd3\xcf\x03\xff\xb7\xea\x5f\xe7\xc7\xdd\x39\x13\xa6\xbb\x5c\xff\xeb\xf6\x10\x1b\x6d\x0e\x29\xa7\xe6\x96\x0b\x94\x1a\x75\xfe\x7e\x59\x1d\xe7\xeb\xe6\xd6\x3c\xa3\xa9\x26\xe9\xfc\xfe\xb2\x2a\x53\x6a\xa6\xfc\x41\x5c\x7f\xb8\x7d\x6f\x81\xec\xdd\x19\x69\x61\xe6\x7a\x1c\x35\x32\xc7\x64\xb2\x45\x64\xa5\x07\xb3\xa1\xd0\xcc\x1d\x95\xae\x2c\x2d\xe3\x4d\x78\x3f\xf5\xa5\xea\x55\xdd\x7f\x5e\x9f\x89\xd7\x27\x0e\x63\xbe\x0c\x24\xbb\xfb\xd0\x38\x9e\x24\x1d\x4f\x92\x37\x11\x19\xdf\x44\x7e\xdb\x12\x4e\x91\x45\x46\x0b\xd7\xe2\xc0\xa8\x8d\x15\x5c\xbd\x8f\x1b\xa3\x00\x8d\xef\x36\xa1\x43\x74\xef\xca\x9c\x30\xfe\x37\x00\x00\xff\xff\xf9\x76\x8d\x64\xd3\x2a\x00\x00") - -func collectionGoBytes() ([]byte, error) { - return bindataRead( - _collectionGo, - "collection.go", - ) -} - -func collectionGo() (*asset, error) { - bytes, err := collectionGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "collection.go", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _cosmosdbGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x56\x5f\x4f\xdc\x38\x10\x7f\x4e\x3e\xc5\x34\x12\x28\x81\x90\x85\x9e\x4e\x3a\xd1\xee\x43\x0b\xdc\x15\xb5\x50\x04\x9c\xfa\x50\x55\xad\x37\x99\xec\xba\x9b\xd8\xc1\x76\x38\xf6\x10\xdf\xfd\x34\xb6\xf3\x67\x59\xa8\x7a\xf7\x74\x3c\xb0\x8e\xc7\x33\xf3\x9b\x99\xdf\x8c\xdd\xb0\x7c\xc9\xe6\x08\xb9\xd4\xb5\xd4\xc5\x2c\x0c\x79\xdd\x48\x65\x20\x0e\x83\x68\xb6\x32\xa8\xa3\x30\x88\x72\x29\x0c\xde\x19\x5a\x96\xb5\xfd\xe1\x92\xfe\x0b\x34\x93\x85\x31\x4d\xb7\xa6\x43\x8d\x92\xc6\x0a\xb5\x51\xb9\x14\xb7\xb4\x34\xbc\xc6\x28\x0c\x83\x68\xce\xcd\xa2\x9d\x65\xb9\xac\x27\xed\x5c\xaa\xef\x7c\x32\x97\x93\x5c\x16\x98\x47\x61\x12\x86\x93\x09\x7c\x6c\x0c\x97\x42\x83\xc2\x46\xa1\x46\x61\x34\xbc\xb9\x38\x05\xe9\xb6\x43\xb3\x6a\xb0\x3f\xa3\x8d\x6a\x73\x03\xf7\x61\x70\x2e\x4f\xae\xd9\x1c\xd6\xfe\x66\x52\x56\x61\x70\xa1\xf0\x5a\xf1\xf9\x1c\x95\xee\x25\x9f\xbf\x68\xa3\xb8\x98\x87\xc1\x85\xd4\xe6\xb1\x78\x24\x65\xca\x70\x72\xf5\x1e\x57\x97\x4c\xcc\xf1\xf4\x18\x3a\xd9\x91\x14\x86\x8b\x96\x91\xb8\xd3\xf4\xb2\x07\x1b\xc8\x89\x52\x52\x8d\xc3\x60\x02\x90\xf6\x5c\x0c\x4e\x3c\x44\x70\x65\x98\x69\xf5\x91\x2c\x10\xb8\x30\x64\xbf\xc0\x35\xb3\xf0\xed\xbb\x96\xe2\x30\xa2\x6c\x45\xdf\xc2\xe0\x0c\xb5\xa6\xca\x6d\x1c\xa8\x9d\x20\xfa\x46\x40\xca\x56\xe4\x10\x23\xec\x58\x7f\x89\x73\x1b\x27\x9d\xca\x7d\x18\x28\x34\xad\x12\x50\xd6\x26\xbb\x6a\x14\x17\xa6\x8c\xa3\xad\x02\xb6\xf4\x21\x6c\xe9\x28\x05\xcc\x06\x68\xf4\xd5\xfd\x7a\xff\x89\x0f\xf7\x54\x5b\xd3\xa3\x30\x9c\x61\x0d\x46\xb5\x08\xbc\xa4\xe0\x81\x6b\x90\x25\x8c\x12\xc0\x44\x01\xdc\x68\x18\xf4\xc8\x58\xcd\x4c\xbe\x40\x2a\x70\xbf\x6b\x03\xd9\x70\x12\x93\x51\x9b\xd5\x74\x74\x98\x32\x98\xd8\xfa\x53\x80\xce\x75\x0a\x72\x09\x87\x53\x5a\x66\xb1\xcf\xc6\x2b\xda\xbb\x0f\x83\x2e\x07\x24\x1b\x05\x30\x9d\x8e\x01\x04\x0f\x43\xae\x58\xa5\x71\x28\x33\x51\xef\x12\x6f\x5a\xae\xb0\xa0\x08\xcd\x02\x1d\x26\x9f\x02\xda\x2d\xed\xae\x25\x69\xc9\xb1\xb2\xe7\x84\x34\xd0\xc8\xa6\xad\x98\x41\x90\x02\x18\xd9\xbb\xf8\xf3\x1a\xa4\x82\xe3\x93\x0f\x27\xd7\x27\x20\x1b\x54\x96\x62\xe1\x2d\x53\x1b\xbe\xa6\xb6\x6a\x36\x96\x32\x8e\xac\x71\x4e\x9d\xe3\xc4\x51\xd2\x01\x3c\x97\xe6\xb4\x6e\x2a\xac\x51\x98\x1f\x41\x64\x50\xb2\x25\x02\xa5\xda\xd2\xda\x63\xe4\x83\x6e\x07\xe3\x91\xc5\x75\x20\x8f\x74\x3c\x8e\x4b\x34\x6a\xf5\x51\x5c\x28\xcc\xa5\x28\x6c\x5b\xfd\xce\x78\x85\x05\x41\x50\x1c\x35\xb9\xef\x3d\x97\xc0\x0d\x94\x8c\x57\x1a\x8a\x16\xc1\x48\x9b\x9b\x0d\x5d\x47\x8b\x67\x4d\xc7\xa5\x35\x19\x27\x2e\xd8\x04\x06\xbe\x24\x54\xf8\x52\x2a\xe0\xc4\x8a\xfd\x57\xc0\xe1\x35\xfc\xfa\x0a\xf8\xee\xae\xa5\x04\x1d\x9c\x42\x19\x27\x61\x40\x0c\x7a\xf1\x24\xf5\x52\xa0\xe9\xe7\x39\xb3\xe9\xde\xfa\xe8\xd8\x15\x06\xc4\xa0\x80\x46\x61\x76\x55\x21\x36\xb1\x5d\x1e\xb7\xae\xc0\xf1\xc1\xfe\xfe\x0e\x4f\x60\x07\xec\xf6\x19\xaf\x2a\xae\xad\xc1\x64\x44\xbd\xa1\xa5\x73\xd8\x29\x98\x61\x33\xa6\xf1\xa8\xe2\x48\x84\x2f\x64\x9c\x9b\x3b\xf0\xc3\x3a\x3b\x72\xbf\x29\xd4\x68\x16\xb2\x48\xa1\x61\x66\x91\x82\x42\x2d\x5b\x95\xe3\xf5\xaa\xc1\xe1\xeb\x03\x17\x4b\x3f\x14\x52\xc0\xbb\x06\x73\x83\xc5\xfa\x4c\x4a\x81\x8b\x14\x64\x6b\xe8\x03\x55\xc9\x72\xbc\x7f\x48\x61\x81\xac\xa0\xe9\x69\x33\xf1\xce\x7e\xf8\x74\x53\xf4\xc4\x17\x85\xba\x81\x1d\x2b\xbf\x44\xdd\x48\xa1\xd1\x09\xfa\x62\x84\xae\x14\x44\x84\x95\x2f\x87\x5b\xbf\x86\x3c\xab\xd9\xdd\xa5\x63\x88\xdf\xf5\x15\x22\xb3\x29\xb8\x3a\xe5\xd9\x57\x17\xfd\xcf\x47\xfb\x54\x98\x7d\x88\x7d\x58\x3f\x5f\xfe\x6b\x29\xcf\x98\x58\x51\x73\xa2\x36\xda\xd7\x7e\xa6\x90\x2d\x6d\xe9\xc3\x20\xc8\xb3\x4a\xce\xb3\x4f\x4c\x09\x9a\xb1\xda\xce\x58\x66\x0c\xd6\x8d\x81\xad\xc2\xcf\xdb\xc7\xf8\x8d\x5a\xd9\x28\x13\xb2\x50\x6b\xbb\x7e\x49\x49\xf2\xf7\x6b\x76\xc1\x94\xc6\x53\x61\x62\x4a\x88\xaf\x40\xf6\x07\x9a\x38\xba\xdb\xab\xf5\x9e\xb5\xb0\xc7\x4a\x83\x6a\xaf\xd6\x51\x92\xc2\xc1\x7e\x0a\xfb\x3e\x30\x6b\xec\xc5\x14\x04\xaf\xc6\x64\xb5\xfb\x1d\xec\x67\x29\x5b\xeb\x67\xf9\x6a\xc7\xae\x2d\xbc\x37\xbe\xbd\xdd\x33\x65\xe4\x8e\xaa\x6e\xc7\xb2\xa2\xeb\xb5\x3f\x61\x91\x14\x58\xa1\xc1\xd8\xef\xa5\xb0\x4c\x7c\x0b\x59\xa5\x14\x6e\x07\xbd\x51\xe4\x4e\xd7\x2b\x7d\x5e\x7e\x81\x29\xdc\x3a\x3d\x02\x35\x44\xf7\xc3\x4e\xfa\xfa\x3f\x6a\xa5\x78\xbd\x73\xd2\xd1\xf8\x52\x78\xe3\x1a\xe0\x70\xea\x74\xce\xf1\x2f\xcf\xbf\x4f\xdc\x2c\x3c\xea\xf5\xb6\x88\xe8\xa0\x3e\x9c\x4c\xa2\xdd\x3c\xeb\xe2\x7e\x27\xb5\x11\xac\xc6\xdd\x68\x12\xed\xba\xd8\x04\xaf\x92\xee\xee\x1c\x57\xcc\x67\x50\xf0\xca\xba\xee\x6b\xcd\xc5\xf8\xd4\xac\x2d\x09\xd4\xb6\x7d\x41\x66\x6f\xdb\xb2\x44\x75\xff\xe0\xc7\xea\xe1\x14\xec\x93\x8f\xe0\x9e\x08\x5a\xaa\x78\xd6\x96\x29\xe4\x19\xbd\x60\xde\x31\x51\x54\x98\x64\x4e\x14\x73\x31\x50\xf5\x29\xa6\x0e\x48\x2c\x39\x14\xde\x64\x6f\x65\xb1\x82\x29\x70\x99\x9d\xcb\xe6\xa8\x92\xda\x39\x48\xbc\xd8\xb7\xc8\x15\xb5\x88\xcd\x91\x30\x7b\x54\xc2\x28\x85\x88\x35\x4d\xc5\x73\x4b\xef\x09\x81\x89\x3c\x9b\x37\x39\x37\xe6\xea\x60\xf5\x73\xff\x04\xce\x8e\x98\x90\x82\xe7\xac\x3a\x3b\x3d\x3b\x71\xd2\xf7\xb8\x8a\x97\x89\xe7\xa4\xe3\xe3\x3a\x1c\xdb\xb1\xb7\xa8\x34\x97\x82\xe0\xbc\xdc\x3f\xf8\x6d\xef\xe0\xe5\xde\x2f\x07\x74\x8b\x52\x16\xf2\x8c\xb5\x66\x21\x15\xff\x1b\xd7\xd2\xd1\x25\x76\x24\xce\xde\x74\x4b\x47\x01\x4b\x97\xe7\x39\xfb\x6f\xd2\x6c\x2f\xa4\x6e\xfc\x5a\xb7\x8b\x3c\x3b\x96\xb1\xc2\x9b\x9f\x65\x4d\x50\x60\x89\xaa\xbb\x9f\xbb\x81\x6e\x6b\x97\x5d\x22\x2b\x62\xc7\xc0\xd1\xae\xad\x24\x5d\xc8\x0f\x31\x25\xa3\x58\x23\xd2\x31\x3a\x22\xf5\xc7\x1f\xd1\x69\x98\x48\xe3\x27\xde\x8b\xe9\x53\x1d\x3a\xca\xe7\xb6\x1d\xfb\x96\xba\x9d\xfa\x78\xc2\xae\xd1\x27\xa1\x17\xe3\x26\x83\xfc\x34\xcb\x1c\xc2\x78\xdb\xce\x72\x47\xd6\xc7\x0f\xce\xc7\xf8\x86\xcc\xf5\xd9\xee\x1b\x8e\xa6\xc7\x30\x5b\xff\x3b\xb2\x35\x07\x03\x4a\xd9\x9a\x64\x6d\x66\xba\x03\x82\x57\xe1\x43\xf8\x4f\x00\x00\x00\xff\xff\x33\x6d\x19\x41\x36\x0e\x00\x00") - -func cosmosdbGoBytes() ([]byte, error) { - return bindataRead( - _cosmosdbGo, - "cosmosdb.go", - ) -} - -func cosmosdbGo() (*asset, error) { - bytes, err := cosmosdbGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "cosmosdb.go", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _databaseGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x56\x5d\x6f\xdb\x36\x14\x7d\x26\x7f\x05\xab\x87\xc0\x4a\x55\x79\x7b\x35\xa0\x87\xc2\x09\x92\x6c\x4d\x36\x24\x2d\x36\x60\x18\x5a\x9a\xba\xb6\xd9\xc8\xa4\x47\x52\x88\x33\x23\xff\x7d\x20\xa9\x0f\x52\x92\x3d\x6c\x7e\xb0\x2d\xde\xcb\xcb\xc3\x73\xce\x25\xb5\xa7\xec\x99\x6e\x80\x30\xa9\x77\x52\x97\x2b\x8c\xf9\x6e\x2f\x95\x21\x33\x8c\x12\x26\x85\x81\x83\x49\x30\x4a\x04\x98\xf9\xd6\x98\xbd\xfd\xaf\x5f\x05\x4b\x30\x46\xc9\x86\x9b\x6d\xbd\xca\x99\xdc\xcd\x35\x57\xf5\x5e\x83\x98\x57\x72\xa3\x6a\x9d\xc4\xd1\x7a\x23\xd5\x77\x3e\xdf\xc8\x39\x93\x25\xb0\x04\xa7\x18\xcf\xe7\xe4\x8a\x1a\xba\xa2\x1a\x88\x82\xbd\x02\x0d\xc2\x68\x42\x49\xd9\x8c\x62\xf3\xba\x87\x3e\x47\x1b\x55\x33\x43\x8e\x18\xdd\x5d\x91\xee\xa3\x8d\xe2\x62\x43\xbe\x7d\xd7\x52\x2c\x12\x5e\x66\x72\xc7\x0d\xec\xf6\xe6\x35\xf9\x86\xd1\x23\x68\x59\x2b\x06\x76\x46\x9c\xf9\x55\x0d\x73\x3f\xf3\x1d\x68\x43\x77\x7b\x42\x08\x17\xc6\x16\x6f\x73\x8d\x8e\x53\x9f\xa0\x5a\x4f\x03\xf8\xaa\xa1\x5a\xc7\xc9\xd7\x9f\xe9\xe6\x44\x32\x18\xba\x89\x93\x97\xb2\xaa\x80\x19\x2e\x85\x1e\x26\x33\x59\x55\x03\x1c\x5f\x34\x28\x3d\x5d\xba\xb6\xa1\x28\xfb\x2d\xa2\x5c\x87\x9c\xb7\x8c\xeb\x98\x72\x1d\x70\xbe\x94\xb5\xe7\xa4\x23\x87\x84\x0c\x31\x1b\x3e\xc9\x7d\x83\x2d\x9a\x31\xe2\xbf\x5f\x95\xfc\xf1\xe7\x65\x27\x7b\x93\xdf\x45\x87\x7b\x72\x88\xdb\x0d\x2c\x2b\x0e\xc2\x04\xb0\x77\x35\x89\x3f\xd6\xbb\xf9\xe3\x6f\xf7\xb5\x81\x03\x46\x95\xdc\xc4\xe1\x4b\x6f\xdf\xfc\x5a\x18\xf5\x8a\xd1\x96\x0d\xa6\x5f\xda\x1e\xc8\xfd\x32\x18\x59\x68\xb7\x54\x94\x15\xb4\x61\x67\xef\xfc\xa7\x6e\x1c\xa3\x16\xda\xad\xd4\x46\xd0\x1d\x34\x64\x60\x44\x6b\xb3\x95\x8a\xff\x0d\xaa\x99\xfc\xb1\x1b\xc0\x68\x47\x0f\x8f\x60\x14\x87\x56\x5e\x2e\xcc\x40\xc1\x66\xaf\x3c\x6c\x19\xc2\x3c\xb2\x48\xc6\x36\x51\x18\x50\x6b\xca\xc0\xf2\xf2\x04\xa6\x5f\x6e\xd6\xff\x4d\x31\x5a\x2a\xa0\x06\x66\x4d\xef\xe7\x4b\xff\x9b\x91\x4e\x92\x94\xcc\xba\xff\x19\x01\xa5\xa4\x9d\xf6\x89\x6b\x33\x4b\xbb\x45\xef\x0c\x28\x6a\xa4\xf2\x81\x8f\x55\x35\x2c\x18\x56\xd1\x7d\x99\x1b\x30\xe3\xa5\x3d\x65\xd3\xeb\x5e\x41\x05\xff\x02\xd7\xa5\x8e\xbc\x62\x71\xb5\x28\x03\xc7\x5c\xc6\x5e\xc2\xc8\x56\xe6\xa2\xa6\xb6\x29\x3b\xf1\x4a\x29\xa0\x33\xc5\x4a\xca\x6a\x20\x4e\x57\x38\x96\x87\xb7\xac\x44\x02\xf5\xc9\xa1\x44\x0f\x70\x18\x51\x31\x4d\x9a\x5f\xfa\x01\x5e\x06\x8a\x2b\x30\xb5\x12\x16\x80\x80\x97\x91\x47\xd6\xb5\x60\xe3\x49\x33\xdb\x12\x51\x17\x64\x64\xcb\x22\xdf\x67\x24\xf0\xfd\xc8\xf1\x19\x39\xe1\xf8\x8c\x04\x8e\x0f\x1c\x37\xf4\xe9\x11\x23\x0f\x9c\x5c\xc4\x52\x1c\x31\xb2\x0d\xbb\x88\x3b\xb2\x92\x9b\x0c\x23\xb4\x65\x83\x71\xb2\x65\x76\xbc\x87\xda\xc6\xfb\x11\x1b\x1f\x82\x5d\x8c\xe0\xdb\xac\x1e\x79\x5b\xa5\x1f\xb1\xf1\xbe\x5d\xdb\xf8\x8f\x3f\x64\x18\xbd\x59\x69\x1c\xcf\x33\x46\x06\xc6\x4a\x09\xb5\x4d\x61\x0e\x64\x64\x5d\x3e\x72\xc6\xa4\xee\x96\x29\x5a\x55\xe5\x4a\x93\x45\x41\x2e\xba\xf8\xf1\x0d\x63\xb4\x96\xca\xc6\x51\xb9\xf2\xf9\x36\x85\xe7\xde\x53\xe6\x90\x62\x84\xf8\xda\x8d\xbf\x2b\x88\xe0\x95\xcb\x6d\x79\x17\xbc\x72\x73\x30\x42\x6f\x3e\xd1\xae\x51\x04\x89\x2b\x05\xf4\xd9\x85\x2d\x39\x0e\x43\xee\x6f\x88\xf7\x05\xe9\x1e\xfa\x58\x70\x17\xf8\x78\x3f\xd0\x27\xf5\x17\x40\x41\xe8\x7e\x0f\xa2\x9c\x0d\x23\x19\x89\x1e\xf3\x3c\x4f\xb1\x03\xd1\x20\xf7\xf9\x99\x05\x7a\x96\xfa\xf8\xf8\x3b\xe1\xcb\x23\x46\x2c\xdf\xd5\xf9\x27\xc9\x9e\x67\x29\x46\x25\xac\x41\x11\x37\xf4\x45\x54\x7e\xd0\xa6\x04\xd3\x8b\xc0\x17\x67\x01\xb4\x87\xec\x94\xfc\x02\x5e\xca\x55\x74\xdc\x86\x8f\x5e\xcd\xde\x01\xf6\xa9\x20\x2c\x2f\xa5\xad\x96\x11\xd7\xa8\xf7\x60\xb6\xb2\xfc\x55\x6a\x93\x91\xa4\x5c\xe9\xa4\xff\x49\x9a\x94\x27\x43\x4d\xad\x3d\x8e\x32\x23\x17\x6e\xd5\x8c\x5c\xd8\x2f\xc1\xab\xb4\xe5\xf4\xec\x36\x4e\x1c\xfa\x53\x3d\x1c\x1e\xb7\xc7\xb8\xce\x82\xb0\xf3\x9d\xd2\x5d\x21\x63\xba\x4e\x76\x46\xb3\x3e\xcb\x9b\x36\xcb\x08\xcb\x3d\xdc\xf4\xec\x5a\xee\x02\x9a\x92\xa5\x5c\xf1\xb2\xbf\x89\xfe\xa7\x24\x37\xd0\x28\x32\x4f\xde\xdb\x82\x91\x3c\xdd\x58\x20\xd0\x2f\x3f\x67\xbe\x1f\xff\x9b\x30\xed\xad\x38\xbd\x91\xd1\xe5\x68\x51\xbb\x36\xcf\xdd\xdb\x6a\x51\x90\x24\x71\x9d\xde\xb0\x78\xad\x94\x0d\x3c\xc2\x5f\x35\x57\x50\xda\x9e\x43\x5b\xa0\xa5\x7d\xfd\x5c\x14\x1e\xef\xad\x7b\x3e\xf6\x91\xfc\x09\xcc\x2c\xb9\x5b\x7f\xb8\xa7\x86\x6d\x93\xac\x2d\x9f\x06\xe2\x4c\x50\xe4\xa1\x07\x8c\xe4\x77\x57\x63\x9a\xdc\x60\xc0\xd3\x83\x74\xfb\xb3\xb7\x93\xa3\xcb\x7d\x35\x40\x02\xc1\x79\x4f\x55\x68\xc8\x94\xb4\x27\xe3\x84\xbf\xec\xe1\x37\xf0\x58\x20\x36\x5f\x13\x9e\xbb\xd7\x81\x9e\x2f\x7f\x26\x9d\x26\xc8\xcd\x89\xde\x2b\xde\x75\x8c\x47\xe4\xfd\xfe\xe1\x5e\x7f\x58\x06\x89\x49\x36\x98\xd9\x9c\x7f\xde\x72\xfc\xac\xe5\x4e\x1e\x02\xa1\xc7\x74\xc0\xda\xc4\x15\x11\xee\x6f\xb0\x85\xa2\x9d\x98\xdf\x4c\x43\xb7\x05\x3d\x53\xc5\x70\xfb\xce\x70\x38\x70\xf6\x3f\x01\x00\x00\xff\xff\x6f\xda\x85\x37\x97\x0e\x00\x00") - -func databaseGoBytes() ([]byte, error) { - return bindataRead( - _databaseGo, - "database.go", - ) -} - -func databaseGo() (*asset, error) { - bytes, err := databaseGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "database.go", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _documentGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x8e\xcd\xaa\xc2\x40\x0c\x85\xd7\x9d\xa7\x08\x5d\x5f\xe8\xfe\x3e\x84\xe8\xc6\x8d\x08\x8d\x35\x94\xaa\x99\x19\x93\x54\x28\xe2\xbb\x4b\x7f\x9c\x32\x9d\xd5\x24\xe7\x7c\xe4\x8b\xd8\xdc\xb1\x25\x68\x82\x72\xd0\xeb\xc5\xb9\xaa\x82\x43\x4f\x32\x80\x50\x14\x52\xf2\xa6\x80\xf0\x1c\x57\xce\x86\x48\x4b\xaa\x26\x7d\x63\xf0\x76\xc5\x3c\x4f\x4f\x4d\x3a\xdf\xce\xff\xfa\xa6\xc1\xff\x97\x13\xf8\x17\xb8\x33\xe2\x68\x43\x59\xbb\x62\x8f\x82\x4c\x46\xa2\x70\x3a\xa7\xe1\x07\xc4\x94\x66\xd4\x67\x32\x5b\xdb\x99\x5d\x62\x66\xc3\xb5\xb5\x5a\xee\x90\x29\x09\x2e\xa7\x3c\x32\xe5\x6a\x47\x7c\xf4\xb4\x69\xbd\xc6\xdd\xc6\xe5\x1b\x00\x00\xff\xff\xa1\x09\x70\x18\x37\x01\x00\x00") - -func documentGoBytes() ([]byte, error) { - return bindataRead( - _documentGo, - "document.go", - ) -} - -func documentGo() (*asset, error) { - bytes, err := documentGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "document.go", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _permissionGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x56\x51\x4f\xe4\x36\x10\x7e\xb6\x7f\x85\xcf\x0f\xa7\x0d\x1b\xb2\xef\x48\x79\x40\x70\xa2\xa8\x85\x9e\xe0\x2a\x55\xaa\xaa\x3b\x93\xcc\xb2\x2e\x59\x3b\xb5\xbd\x82\xd3\x8a\xff\x5e\xd9\x4e\x76\x6d\x27\x21\x77\xd7\x3e\x94\x07\x20\xf6\x7c\x9e\x99\xef\x9b\x19\xbb\x65\xd5\x13\x7b\x04\x52\x49\xbd\x95\xba\x7e\xc0\x98\x6f\x5b\xa9\x0c\x59\x60\x44\x2b\x29\x0c\xbc\x18\x8a\x11\x15\x60\x56\x1b\x63\x5a\x8a\x33\x8c\x57\x2b\xf2\x11\xd4\x96\x6b\xcd\xa5\x20\x0a\x5a\x05\x1a\x84\xd1\x84\x91\xf6\xb0\x8e\xcd\xd7\x16\x42\x3b\x6d\xd4\xae\x32\x64\x8f\xd1\xf5\x25\x09\x7f\xb4\x51\x5c\x3c\x1e\x3e\xbf\xfc\xa5\xa5\x38\xa3\xbc\xce\xe5\x96\x1b\xd8\xb6\xe6\x2b\xfd\x82\xd1\x1d\x68\xb9\x53\x15\x74\xe0\x71\xd0\x67\x95\xc2\x3e\xf1\x2d\x68\xc3\xb6\xad\xb7\xe3\xc2\x84\xae\x7b\x98\xd1\x31\xea\x1e\x9a\xf5\x6c\x84\x9f\x35\x34\xeb\x18\xf7\xe1\x13\x7b\x9c\xc7\x81\x61\x8f\x49\x94\xf2\x09\xc4\x2c\xce\x58\xab\x18\x78\xe4\xf7\x46\xd6\x21\xdd\xee\xb3\x03\xb6\xd1\xea\x38\xad\x6f\x7a\x56\x9d\x51\x04\x7d\x4d\x0a\xc1\x79\x9c\x28\x06\xb2\x95\x35\xa4\x15\xe1\x00\xde\xe1\xd8\x51\x95\x14\xda\x30\x61\x34\x76\xff\xd9\x8a\x8c\x2d\xce\x9b\x86\xa4\xa0\x92\xd0\xf3\xa6\xa1\xa9\xe9\x1d\xb0\x7a\xc4\xd4\x2e\x0f\x2b\x5a\x87\x59\x1c\x73\xd0\x69\xfc\x3a\x28\xe9\x0b\xb9\x3b\x54\x56\x5c\x63\xbd\x78\x95\xb5\x98\x2e\xe9\x98\xf8\xc9\x72\x0e\xbd\xff\xf1\xe7\x49\xd0\x5e\x1d\x24\x30\x48\xd5\x72\xe1\x1f\xf3\xb9\x68\x38\x08\x13\xe4\x70\x52\x33\xc3\x1e\x98\x06\xbf\x83\x51\xcb\xcc\xa6\x17\x28\x55\xbb\x43\xf3\x44\xe7\xca\x43\x13\xa6\x7a\x63\x61\x40\xad\x59\x05\x8e\x31\x05\xcc\xc0\xa2\x9b\x31\xc5\x85\xff\x9b\x93\x20\xa7\x8c\x2c\x82\xaf\x9c\x80\x52\x52\x65\x18\xfd\xc2\xb5\x59\x64\xc1\xf9\xd7\x06\x14\x33\x52\xf9\xad\xf3\xa6\x49\x8f\x8d\x4f\xd2\xc7\xa3\xae\xc0\x0c\x43\xf0\x29\x4f\x79\xbf\x84\x06\x66\x03\x77\xc6\x56\xe1\xb6\x61\xd5\x0f\x65\x39\x14\xcc\xe6\xd6\x67\x1a\xca\x96\x4a\x8a\x91\x75\xc7\xc5\x8e\x99\x6e\xee\x5a\x01\x51\x2d\x05\x1c\xaa\xf2\x41\xca\x66\xa0\xe9\xe1\xf0\x54\x55\xde\xf3\x9b\xe8\x7a\x04\x84\xca\xde\xc2\xcb\x80\xd4\x29\x01\x7c\x08\xb7\xf0\x3c\x28\x16\x05\x66\xa7\x84\x0d\x44\xc0\xf3\x48\x89\xad\x77\xa2\x1a\x03\x2e\x76\x1a\x54\x45\x7e\xd3\xa0\xfc\x42\x4e\xec\x0a\xaf\x0f\xb2\x0e\x5c\xed\x31\xf2\xde\xc8\xfb\x94\xcb\x3d\x46\x28\x6e\x8b\x33\x77\x5c\x55\x2c\x4e\x76\x07\x17\x59\x11\xdb\xe4\x18\xb9\xe6\x39\x0b\xe6\xc0\x18\xca\x35\xd8\x92\xd0\x95\x5d\xd4\x2b\x4a\x96\x5d\xac\x39\x46\xaf\x96\x1b\x97\xe4\xa2\x22\x03\x8d\x33\xc2\x6c\x95\x9b\x17\x32\x28\x2d\x3e\x22\xd0\x04\xfd\x36\x73\xd6\x34\xc1\x8c\x23\x67\x25\x79\x1f\x58\xee\x5f\x31\x46\x6b\xa9\xac\x25\x6a\x93\x13\xac\x31\x2f\xbc\xdc\xe6\x25\xc3\x08\xf1\xb5\x5b\x7f\x57\x12\xc1\x1b\x87\xe9\x99\x15\xbc\x71\x18\x8c\xd0\xab\x37\x0c\xbd\x96\x01\xe0\x41\x01\x7b\x72\x66\x18\x25\xd1\x15\x7e\xcc\x2e\x4b\x32\x58\x1c\xda\x06\xd3\x35\xb6\x3f\x6e\x0c\x41\xe1\x7c\x2d\x09\x6b\x5b\x10\xf5\x62\xda\x26\x27\x13\x1b\x45\x51\x64\xd8\xa5\xd0\xe5\x1f\x9f\x91\xdb\x74\x67\x04\xee\x07\xe4\x98\xc6\x02\x9e\x83\x8e\x88\x87\xc9\xf8\x86\x17\xec\x28\xbb\xfd\x2a\x49\x55\xd4\xd2\x7a\xc8\x89\x7d\xdc\x15\x37\x60\x36\xb2\xfe\x28\xb5\xc9\x49\xe5\xaa\x73\x49\x57\x41\xd8\x34\x27\x34\xfe\xf4\x56\x1d\xfc\xde\x30\xb3\xd3\x3e\xee\x3a\x27\xef\xa3\x28\xf3\xb0\xb9\x5c\xfe\x59\x4f\xce\x0c\x11\x93\xe3\x7e\xbc\x71\xc3\x31\xb9\x4f\x4f\x3b\x23\xd5\x5c\x63\x1d\xae\x90\x21\xf1\x6f\xb4\x51\x17\x47\x55\x74\x7d\x69\xa9\xf1\x81\x67\x33\xfe\xdc\x15\x34\x26\xf2\xd1\x34\x18\x5e\xff\x5e\xde\x2b\x98\x50\x77\x45\x97\xa1\xcb\x09\xad\x67\x30\x41\x21\xfc\xfa\x73\xee\xdb\xfe\x47\x85\xef\x6f\xda\xb7\xc9\x19\xb9\x78\x2d\x03\xd1\x84\x29\xdc\xc3\xbc\x2c\x09\xa5\x6e\xc8\x74\x6a\x7d\x50\xca\x6e\xdc\xc1\xdf\x3b\xae\xa0\xb6\x0d\x8b\x36\xc0\x6a\x50\x6e\x10\xba\x5c\x7e\x72\xdf\xfb\xe3\x4e\x71\x0f\x66\x41\xaf\xd7\xa7\x37\xcc\x54\x1b\x9a\xa7\x6e\xb2\xa0\x18\x46\xe8\xf7\x49\x7d\x03\x9b\xc5\xf5\xe5\xf7\x4b\xe0\x40\x81\x06\xb7\xd2\x31\x66\x6f\x41\x27\x85\xfb\xd5\x25\x32\x57\x98\x87\xc7\xcb\xff\x68\x02\xad\xe8\x32\xf2\xfc\x1d\x24\x0d\x71\xff\xd1\xd0\xe2\x21\x79\xe1\xf4\xc9\x48\x7f\x37\x8e\x0c\x92\xf0\xfa\x1b\x0c\x95\x80\x26\xbe\x26\xbc\x70\x6f\xb7\x63\xe1\xfa\x9b\x65\xba\x52\x1d\x26\x7a\x04\xbe\x3b\x94\x7e\x54\xc5\xbf\x9f\xde\xe8\xd3\x8b\xc0\x90\xe6\x09\xb2\xbb\xc5\xbc\x58\x7c\x72\x9e\xf0\x6f\xba\x2d\xf8\xf0\xb6\x18\x1b\x12\x3a\x28\xd1\x91\x27\x45\xc8\x41\x92\x66\xd9\x03\x8b\xab\xf1\xf4\xec\x81\x9e\xcd\x32\xa5\xc8\x4d\x07\x1c\xc8\xfb\x4f\x00\x00\x00\xff\xff\xe9\x75\x66\x68\x1c\x11\x00\x00") - -func permissionGoBytes() ([]byte, error) { - return bindataRead( - _permissionGo, - "permission.go", - ) -} - -func permissionGo() (*asset, error) { - bytes, err := permissionGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "permission.go", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _templateGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xdc\x59\x5b\x6f\xdb\x38\x16\x7e\x16\x7f\x05\xab\x07\xc3\x8a\x65\x79\xf7\xd5\x80\x17\x28\x92\x6c\xd7\xdb\x4d\xda\x4d\xf3\x30\xc0\x60\x80\x30\xd2\xb1\xc3\x46\x16\x55\x8a\x6a\x92\x31\xfc\xdf\x07\x24\x75\x21\x29\xc9\x4e\x32\x49\x27\xd3\xbc\xc4\x96\xce\xe5\xe3\xb9\x1f\x3a\x27\xf1\x2d\x59\x03\x8e\x59\xb1\x61\x45\x72\x8d\x10\xdd\xe4\x8c\x0b\x3c\x46\x9e\x1f\xb3\x4c\xc0\xbd\xf0\x91\xe7\x67\x20\x66\x37\x42\xe4\xf2\x73\x21\x78\xcc\xb2\xef\xd5\x47\x9a\xad\x0b\x1f\x21\x2f\xbf\x5d\x63\x7f\x4d\xc5\x4d\x79\x1d\xc5\x6c\x33\xfb\x0a\x77\xbf\x13\xb2\x99\xad\xd9\xb4\x16\x3e\xcb\x6f\xd7\xb3\x35\x64\xcd\xf7\xe6\x43\x52\x6e\x36\x0f\x3e\x0a\x10\x12\x0f\x39\x60\x01\x9b\x3c\x25\x02\x8e\x53\x0a\x99\xc0\x85\xe0\x65\x2c\xf0\x16\x79\x47\x09\x11\xe4\x9a\x14\xd5\x1b\xe4\xe5\x44\xdc\x60\x8d\x02\xed\x10\x9a\xcd\xf0\xa5\xcd\x4b\x0b\x4c\x1a\x79\x38\xd6\x6c\x4a\x89\x4b\x98\x09\xe0\x2b\x12\x83\xd4\x73\xcc\x81\x08\x18\x57\x06\x88\x8e\xf5\xff\xb0\xd2\x14\xe2\xa3\xfc\x76\x1d\xd5\x02\x42\x7c\xf4\x29\x17\x94\x65\x45\x80\xc7\xce\x1b\xe0\x9c\xf1\x00\x79\xff\xa3\x85\x18\xb7\x64\x35\xc1\x52\x00\x27\x82\x71\x4d\xf0\x3e\x4d\xbb\x2a\x87\x64\x17\xad\xf0\x0f\x20\x86\xa1\x36\x90\x0f\x62\xbc\x80\x3c\x25\xf1\x4b\x9e\xfa\x04\x52\x78\x96\x19\x95\x00\xe4\xfd\xbf\x04\xfe\x30\x6e\xa8\xd5\x57\x93\xac\x66\xbd\x20\x77\xad\x25\x15\x55\xaf\x29\x87\x05\x0d\x9a\xf6\xf8\x86\x64\x6b\xf8\x37\x40\xb2\xcf\x7b\x3b\x37\x6e\x1b\xae\x9a\xc4\x8c\x61\x3b\xba\x91\x27\x71\xd2\xac\x24\x52\x7a\x1d\xcb\x1e\xd3\xca\xb0\xfa\xab\x55\x77\x14\xc9\xa8\x79\xb6\x8a\x84\x65\x80\xeb\xbf\x6b\xc6\xd2\xc7\x6a\x55\xe6\x7b\x8c\xda\x9c\x70\x41\xa5\x8c\x5b\x78\x68\xd4\x7e\x93\xdc\xb5\x5a\xed\x8a\x17\x00\x68\x64\x7e\x83\xcc\xce\x7d\x5a\x7b\xcb\xca\xfe\x96\xd8\xcc\xff\x73\xb8\xef\x49\x29\x9a\x89\x7d\xa1\x62\x1c\x61\x1c\xf4\x17\x25\x23\x50\x1d\x74\x9c\xdc\x0d\x20\xb4\x78\x4c\x90\xdd\x22\x22\x61\x5f\x90\xbb\x5e\xe4\x61\xcb\xbc\xdd\xd5\x19\xa6\xd1\x9d\xc3\x9d\x53\x0c\x39\x88\x92\x67\x12\x60\x06\x77\x9d\xf2\xb9\x2a\xb3\xb8\xcb\x34\x8e\x59\x9a\xc6\xf8\x98\xa5\x29\xc4\xd2\x08\xfa\x71\x88\xe5\x73\x9a\x54\x06\x09\xdc\xba\xbb\x45\x9e\xd6\x86\x47\x76\xf8\x6c\x91\xe7\xd9\xe5\x7e\xae\x44\xc5\xd1\xf8\x28\x76\x94\x04\x91\x4d\x19\x22\x4f\xb5\x86\x39\x6e\xff\x86\x79\x55\x13\x99\x60\x7f\x26\x5f\x15\x33\x1f\x4f\x2a\xcc\x21\xf2\x76\xd2\x46\xea\xc0\xe3\x18\x3b\x01\x1e\x60\x22\xcb\x8c\xb8\xc7\x5d\x83\x77\x02\x6c\x30\x72\xa4\x05\x48\x9a\xd6\xa2\x0b\x3c\x5f\xe0\x91\x45\xb9\xdd\x21\xe4\xad\x18\x97\x94\x9e\xb0\xf8\x25\x31\x8d\x74\xb8\x8a\xfb\x10\x4f\xff\x19\x20\xcf\xa3\x2b\xf5\xee\xdd\x02\x67\x34\x55\x5c\xb5\x8d\x33\x9a\x2a\x3e\xe4\x79\x3b\x4d\xd8\xea\x5d\x18\xe4\xd7\x1c\xc8\xad\x22\x42\x9e\x85\x2e\x3a\x66\x65\x26\xf0\x64\x81\x9d\x47\x2e\xdd\x05\x14\xac\xe4\x31\x2c\x4f\xb0\x49\xdb\x3e\x76\x19\x2e\x5b\x20\x98\xe4\x39\x64\xc9\xb8\xff\x7d\x88\x7b\x1e\x46\x51\x14\x20\x05\xb7\x3a\xa9\xc9\x1b\xca\x83\xed\x75\x64\xdd\xf0\xfb\x7c\xd9\x53\xc5\x42\x99\x17\x4d\x5a\x38\x6d\xac\xae\x51\x46\x7b\x19\x22\x95\x5e\x6a\xa3\xe0\x06\x48\x02\x5c\x05\x80\x9c\xb5\xa2\xff\xa8\xef\xdb\x5d\xf3\x26\xfa\x02\x62\xec\xff\x32\x3d\x2b\xa6\x27\x2c\x2e\x37\x90\x89\xe4\x7a\xfa\xd9\xc0\xe7\x87\xf8\xea\x57\xff\x6a\x62\x62\x9e\x5c\xf9\xbf\x5d\x05\x08\x49\x6f\xd7\xd8\x0c\x5f\x37\x8f\xf0\xa8\x02\x2c\x35\xee\x9a\x5a\x1b\x9d\xb3\xd3\x4b\xb2\x96\x5e\xe4\x25\x20\xe4\x49\xd0\x0b\x1c\x47\x05\x88\x8a\x61\x5c\x91\x5a\x66\x09\x71\x85\x3a\x40\x3d\x01\xa9\xbd\xa4\x3d\x56\x0b\x4c\x98\x0e\x62\x75\xf8\x33\x10\x37\x2c\xf9\xcc\x0a\x59\x41\x54\x8a\x4e\xfc\x59\xc2\xe2\xc2\x0f\xb1\x5f\xfd\xd7\xcf\x2b\x86\x2f\x82\x88\xb2\xd0\x8e\x4c\x42\x3c\xb2\xa0\x8c\xfa\x50\x55\x18\xf6\xc5\x85\x9a\xdb\xba\x0e\xed\x74\x8f\xad\xd3\xc2\xe6\x0b\xec\xfb\x96\xc5\x8d\xb3\x5b\x94\x8b\x9a\x22\x32\x1b\x88\x15\xca\xa3\xbe\x76\xbf\xb5\xa1\xce\x71\xdc\x44\xde\x1c\x37\xfe\x30\x55\xcd\xad\x6f\xfb\x0b\x5b\x33\x8e\xf6\x25\x44\x4f\x80\x0f\x97\xb6\xea\x0c\x71\x54\xd5\x4a\xe9\x35\xd3\xaa\x41\xb0\x17\x88\x9a\x6d\x0f\x65\x65\x5b\x11\x9a\x3e\xf3\x86\xd3\x70\x6f\xfe\xc8\xfa\xfc\x02\x79\xf3\x01\xdc\xb4\x99\xf9\x93\xd6\x48\x6e\x0a\xf5\xd3\x18\x69\xf5\xe9\x63\x85\xed\xb9\x89\xd4\x2c\x17\x3f\x75\x85\xfd\xa1\xa5\xb1\xec\x71\xb1\xa1\x24\x5a\x9e\x0c\xbb\xd9\xa5\x73\x5c\xfd\x32\xc5\xb3\x5e\xff\x1e\xed\xf2\x27\xf8\xfb\xed\xf8\xf5\x45\x9d\xaa\x4d\x36\x9c\x96\x7b\x9d\x3a\xe4\xd1\x73\xa6\xcc\x2e\x67\x71\x95\xc3\x4e\x91\x79\x84\x27\xf5\x22\xde\xeb\x33\xbd\xce\xd5\x2b\xf5\x70\xab\x34\xd7\x98\x1f\xd3\x2d\xad\x35\xb5\xaf\x5d\x9a\xe7\x99\x3b\x0d\x45\x1d\x6b\xae\xff\xbd\x64\x63\x6d\x6f\x27\x1e\x9d\x15\x87\x2c\xfc\xc4\xe6\xdb\xf5\x65\xe8\x1c\xf3\x40\x4b\x36\xee\x44\xde\xcc\x64\xd4\xbd\x71\x79\xdd\xf9\xa8\x5b\x08\x1a\x1b\x0c\x97\xb1\xba\x4a\x19\x25\xaa\x5a\xc4\xe5\xe1\xfb\xa7\xf3\x76\x6f\xd3\x07\x37\x36\xb6\xda\x70\xa3\x11\x7e\xe7\xcc\xea\x5b\x7b\xb7\x8b\xf4\x00\x2f\x2d\x6f\x6d\x83\xa7\x9c\xcb\x37\x17\xf0\xad\xa4\x1c\x92\x6a\x29\xb4\x4a\xe6\x72\x35\x3d\x23\x22\xbe\xf1\x43\x5b\x9a\x5a\xb6\xa4\x8e\x14\xb2\xda\x04\xd1\x67\x0e\x97\x9c\xae\xd7\xb2\xae\xe0\x7f\xe1\x7f\x28\x65\xfb\x2b\x30\x87\x69\xc5\x32\x5d\x66\x71\x5a\x26\xe0\xd7\x17\x75\x45\xf4\x5f\x46\x7b\x85\x87\xd8\x0f\xfd\xa0\x1f\x02\x2b\xc4\x53\x31\xb0\x42\x3c\x1a\x84\x21\x7e\x1f\x8a\x3a\xbb\x3e\xc2\xc3\x85\x8c\xcc\xe5\xc9\x63\xc1\x74\x39\xfd\x26\x70\x7b\xe5\x5a\x09\x61\xed\xb9\xd4\x88\xdb\x4e\x7e\x04\xb8\xbe\x35\xe8\x96\xa1\x0d\xb9\x5f\x0a\xd8\xe8\x55\x5f\xdf\x7a\xb5\xd7\x04\x3d\xd5\xe6\xe9\x9d\xf8\xfd\x74\x79\x26\x17\xb9\x65\x16\x73\x90\x47\x27\x29\x5e\x01\x24\xbe\xec\xb6\x5d\x03\x9d\x91\xfb\xa9\x44\x34\x55\x90\xb4\x73\x62\x96\x7d\x8f\x96\x82\x91\xb1\x09\x37\xd0\xdd\x97\x46\x56\x29\x79\xd7\x84\xbe\x1b\xdc\xe7\x2c\x83\x26\xc2\x6d\xae\xc0\xec\xd6\xd4\xec\xfd\x34\xfa\x33\x03\x3b\x1d\x1c\xd8\xe9\xc0\x9e\x4b\xbb\x7b\x6e\x77\x20\x2f\x1c\x1c\xcb\xe2\x54\x7a\xa5\x5a\x8b\x59\x02\x72\x66\x72\xe6\x02\x71\xc6\x12\xba\xa2\x90\x28\xdf\x55\xf8\xaa\x5a\x73\xe0\x2c\x8e\x85\x17\xb5\xf2\x48\x6e\x6c\xfe\xa9\x20\x6b\xe5\x4b\x77\xb8\x38\x10\x93\xbd\x97\xa8\x46\x27\xb3\xb5\xf6\x8a\x35\x97\xe4\x57\x0a\x72\x15\x60\xea\x76\xda\xb5\xca\x53\x06\xd1\x57\x0a\x6a\x25\xdb\xb4\xe3\xcf\x16\xd8\xcf\x0e\xca\xae\x65\xa4\x40\xed\xc8\x85\x6b\x5d\xd5\x2d\xf7\x07\xb0\x1d\x69\x2f\x10\xba\xd6\xc4\xfa\x4a\xb1\x5b\xbb\xaa\xf9\xad\x40\xfa\xcb\x94\x67\x5a\xbe\x67\x3b\xd8\x0f\xb7\x92\x78\x18\x71\xa8\x7f\xf1\x30\x7f\x92\x18\xff\xf5\x49\xb6\xb7\x35\x2f\x0b\x35\x26\xcb\xf0\xbd\xe4\x25\xf8\x2e\x7d\xb5\x64\x4d\x2f\x1f\x72\x39\x3f\xf8\x24\xcf\x53\x1a\x2b\x6f\xcf\x14\xe7\xe4\x6b\x51\xc5\xdc\x4a\x45\xbe\x31\xeb\xef\xcb\xe5\x03\x0b\xab\x2d\xa9\x5a\x59\xbd\x1d\x86\xb4\x80\xc3\x12\x95\x0f\xa7\xa7\x19\xb9\x4e\x21\xe6\xac\x28\x1a\x61\xe6\x39\x77\x7f\xdf\xfa\xa3\x6f\x90\x9f\x58\x80\x46\x34\xaa\x56\xa2\x11\x27\x77\x6f\xb5\xfe\x38\xf9\xf7\xe4\x02\xf4\x47\x00\x00\x00\xff\xff\xe2\x7c\xa2\x5a\xfd\x21\x00\x00") - -func templateGoBytes() ([]byte, error) { - return bindataRead( - _templateGo, - "template.go", - ) -} - -func templateGo() (*asset, error) { - bytes, err := templateGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "template.go", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _template_fakeGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd4\x5a\xdd\x73\xdc\xb6\x11\x7f\x26\xff\x8a\xf5\xcd\x54\x43\xda\x67\x5e\xf2\xaa\xcc\x65\x26\x95\xed\xd4\xad\xa3\xa6\xb2\x3b\x7d\xd0\x68\x3c\x10\xb9\xc7\x83\x8f\x04\x18\x00\xd4\xe9\xaa\xd1\xff\xde\x01\x40\x82\xe0\xc7\x7d\x39\xce\xb4\xf5\x43\x8e\x22\xb1\xdf\xbb\xbf\x5d\x00\xa9\x48\xba\x21\x39\x42\xca\x65\xc9\x65\x76\x1f\x86\xb4\xac\xb8\x50\x10\x85\xc1\x2c\xe5\x4c\xe1\xa3\x9a\x85\xc1\x6c\x55\x9a\x1f\x86\x6a\xb1\x56\xaa\xd2\xcf\x72\xc7\xd2\x59\x18\x06\xb3\x9c\xaa\x75\x7d\x9f\xa4\xbc\x5c\xd4\x39\x17\x5f\xe8\x22\xe7\x8b\x94\x67\x68\x3e\x57\x9b\x1c\xfc\x25\x5f\x70\xfb\x6f\x42\xca\x45\xce\x5f\xb7\x42\x17\xd5\x26\x5f\xe4\xc8\xdc\xdf\xee\x21\xab\xcb\x72\x37\x0b\xe3\x30\x54\xbb\x0a\x61\x45\x36\xf8\x09\xcb\xaa\x20\x0a\x3f\x09\x9a\xe7\x28\xfe\x42\x58\x56\xa0\x80\x55\xcd\xd2\xa8\x51\x38\xb9\xb2\xbf\x73\x78\x59\x6d\xf2\xa4\xa5\x88\x01\x85\xe0\x62\xcc\xea\x1f\x35\x8a\x5d\x8f\x51\xfb\xe5\xaa\xa0\xc8\x34\x1f\xb3\x64\x0e\x2f\xff\x5e\x29\xca\x99\x8c\xa1\x5d\x71\x43\xb6\xef\x15\x0a\xa2\xb8\x08\xc3\x07\x22\xe0\x33\xf4\x89\x61\x09\x17\xef\x3c\x61\xf6\xed\xd3\x73\x18\x2e\x16\x70\x8d\xdb\xf1\x37\x10\xa8\x6a\xc1\x24\x10\x18\x7f\x0c\xb5\x7e\xd3\x74\xd1\x1a\x5e\x1a\xb7\x27\x7f\x95\x9c\x59\x7b\x62\x78\x39\x21\xe0\x29\x0c\xac\x8c\x49\xd5\xc2\x20\xf8\xe2\x18\x5c\x82\xf9\xb7\x9e\x87\x41\xa0\x9a\x75\xb2\x79\x09\x25\xd9\x60\x54\x92\xea\x56\x2a\x41\x59\x7e\xd7\x77\xb7\x21\xe9\x45\x49\x5e\x8e\x48\xf6\x87\xd4\xd0\xff\xe6\x85\xc6\x88\x3d\x44\xef\xc7\x51\x53\x3f\x87\xd6\xcb\x13\x1e\xa0\x7b\xbc\x6b\x72\x63\x62\xbd\x54\xa2\x4e\x8d\xe3\x0a\x9e\x6e\xc0\xfb\xa7\xcb\x20\xb9\xf9\xd7\x2f\xb5\xc2\xc7\xd0\x73\x9c\xfd\x3a\x0a\x48\xd8\x79\xd1\x39\x71\xda\x7f\xe1\xd0\x79\x70\x92\xdb\xc2\xbe\xcf\xfa\x02\xf6\x79\x2b\x0c\x24\x17\x0a\x45\x67\x96\x29\x83\xdb\x41\x44\xc3\x00\x15\xc9\x7d\xeb\x29\x53\x61\x18\x2c\x16\x2e\x67\x95\xa8\x11\xe8\x0a\x32\x9e\xd6\x25\x32\x25\x21\xe5\x6c\x55\xd0\x54\x85\x41\xfb\x74\xb5\xc6\x74\xd3\x96\x5a\x4f\xc2\xa8\x62\xef\x39\x2f\xac\x00\x14\x62\xae\x19\x33\xae\x80\xd1\x62\x6e\x42\xc8\x6c\x49\x83\xe2\x8d\x02\xb0\x5d\x23\x03\xa2\xb4\x93\x15\x65\xb9\xfe\x92\xf2\xb2\xac\x19\x4d\x8d\x4f\x17\x0b\xd8\x52\xb5\x06\xb5\xa6\x12\x9a\xa0\x07\x28\x44\x83\x0d\x36\x61\x3e\xa2\x7a\x6b\xf8\x4a\x54\x12\xb8\x80\x9a\x99\xa7\x4e\xde\x9a\x28\xd8\xd2\xa2\x80\x7b\x6c\x24\x63\x06\x9c\x01\x61\xbb\x3d\x19\x57\xa2\x5a\xf3\x0c\x28\x7b\xe0\x29\xd1\x20\x62\x2b\x39\x4a\xa7\x2a\x34\x76\x2a\x44\x4e\xb7\x58\x67\x5f\x9a\xe8\xfc\x4b\x3e\xf0\x74\x13\xc5\x61\x90\xe1\x0a\x05\x34\x2f\xff\xc9\x0a\xfb\x5a\x2f\xd3\x64\x4b\x4d\xd8\x99\xf4\xd1\x86\x78\x68\x13\x34\xa1\xd7\xea\x68\xbd\x60\xbb\xa6\xe9\xda\x59\x57\x4b\xcc\xb4\x17\xf5\x2a\x78\x20\x45\x8d\x32\x74\xf1\xc6\x0c\xee\x77\xf0\x81\x4a\x15\xc5\xb0\xd2\x8e\x41\xa9\x8b\x85\xdc\xd3\x82\xaa\xdd\x51\x13\xad\x4a\x91\xa7\xc1\x28\xe7\xce\x33\xbb\xe1\xb4\x6c\x8c\xea\x8c\xbf\x1a\xe4\xde\xc8\x0b\x03\xf3\x53\xc2\x7c\xeb\x1f\x48\x41\x33\x9d\x40\x8b\x05\x90\x2c\xa3\x7a\x25\x29\xa0\x66\xf4\xb7\x1a\x61\x83\x3b\x09\x94\x01\x71\xd8\x7f\xd4\xf2\x81\x3e\xd1\x57\xd6\xc6\x79\xde\x19\x0a\x59\xc2\xe0\x4d\xe7\xaf\x41\x7b\x1d\xb9\xab\xc1\x26\x58\x37\x00\x72\xcc\xde\x3e\xbf\xa8\x21\xbf\x26\x25\x82\xc5\xa6\xb9\x63\x79\xa0\x25\x9c\x65\xed\x00\x3e\x6f\x3d\x99\x77\xb0\x6c\xc5\x75\x26\xf7\xc6\x80\x91\xc1\x06\x55\x4f\x36\xd7\xe7\x15\x19\xd2\x9e\xa9\x96\xd9\xde\xde\x75\x96\x99\x3d\xb8\xbf\x75\xb2\xb4\x89\xe6\x0f\x6d\xe0\x41\x75\x33\xc4\xea\x8a\x57\xbb\xa8\xed\x4c\xc3\x44\x1b\xe6\x61\x07\x47\x7a\xe0\xb9\x87\xdb\xbb\xfb\x9d\xc6\x56\x8d\x39\x97\x3a\xa7\x74\xcb\xbb\xc6\xed\x5b\xa6\x1f\xc5\x9f\x77\x0a\x65\x74\x71\x3f\x87\x34\xe9\xfa\x63\x9c\xd8\xcf\x4e\x6a\x1c\x06\x74\xa5\x79\xc3\x8b\xa5\x46\x78\xcd\xbf\x1d\x53\x0c\xe0\x6b\x30\x0b\x9e\xc3\xae\x83\x82\x59\x67\xe5\x7a\x62\xdf\xa0\x27\x76\x24\xd5\x7e\x8d\x2e\xce\x17\xdb\xbc\x54\xce\x0f\x5a\xf8\x31\xe7\x92\xaa\x2a\x76\x51\xaa\x1e\x61\x34\x9c\x56\x44\x28\x03\x24\x1b\xdc\x75\x45\x30\x19\x83\x39\x70\x3b\x78\xba\x09\x54\xf7\xbf\x2b\x81\x7a\xa5\xc5\x81\xfd\x41\x3a\x31\x93\xe8\x0a\x6c\xdb\xd8\xe3\x07\xf3\xb1\x1f\x00\x23\xc5\x84\x3c\x19\x25\x51\x0c\x8b\x05\xa4\xbc\xda\x01\xe3\x5b\xb8\xc7\x94\xd4\x12\xa1\x12\xd8\xd4\x9d\x34\x10\x5b\xd6\x4a\x9b\xa0\xdc\xcc\x73\x62\x2c\xe8\xca\x79\xc4\x5b\xea\xb4\xa9\x04\x4f\x51\xca\x5f\x45\x0b\x20\x52\x87\x60\xee\xc5\xae\xa1\x8e\xc3\x60\x42\xe4\x58\x66\xf0\x6c\xe5\xe2\x23\x95\x7a\xae\xf0\xfc\xac\xdf\x48\x2b\xd6\x8d\x76\xb7\xed\x53\xf2\xfe\xcd\x9d\xd1\xd6\x45\xeb\xe2\xa2\x25\x19\x1a\x77\x61\x1a\xbe\x91\xff\x51\x11\x55\xcb\x2b\x9e\xe1\x25\xe8\xfd\x56\xd2\xbe\xb0\x68\xad\x27\xe3\xe0\x17\x94\x92\xe4\x76\x40\x9f\xbd\x65\x8a\xaa\x5d\x3b\xda\x20\xc8\x0a\x53\xba\xa2\x98\x01\xcd\x80\x14\x02\x49\xb6\x6b\xe5\x52\x66\x97\xec\xa4\xc2\x72\x36\x6f\x8d\xd3\x5a\xbe\x70\x6a\x3e\x59\xc7\xbc\xf0\x74\x9d\x52\x76\x8f\xa2\xd7\x5c\xbd\xe3\x35\xcb\x9e\x0d\x73\xcb\xca\xb9\xe4\xed\x27\x92\x6b\x6f\x0f\x7d\x69\x3f\x9c\x29\xe9\x57\x81\x29\x67\xb6\x21\xbf\x23\xb4\xc0\x46\x66\x9b\x25\xe3\xa6\xe7\xc5\x59\x4f\x2c\x9f\xbb\xac\xf8\xc4\xcd\x1a\x1d\x4b\x41\x98\xde\x15\x77\x11\xb5\x7a\x4d\x31\x8c\x06\xe4\x1d\xbf\xd8\x12\xed\x0b\xf2\x69\x61\xfe\xa6\x81\x36\x9e\xb1\xff\x79\xee\x97\xb2\x75\xfe\x12\x56\xa5\x4a\x3e\x56\x82\x32\x15\xa5\x89\x9e\xf6\x63\x33\x4d\x2a\x92\xbf\x7a\x65\xbb\xea\x64\x8e\xeb\x7e\xda\xd6\xb0\x43\xca\x29\x54\x68\xda\x6d\x93\x65\xa9\xf9\x91\xde\xe0\xd4\x2a\x9d\x11\x45\xee\x89\x3c\x32\x48\x59\x36\x7f\x00\xbc\x1e\xc2\x53\x67\x9d\xc3\xf6\xbe\xb0\x09\x98\x99\x9b\x7d\x51\x6b\xfc\x0d\x56\x05\x49\xf5\xc6\xc1\xfc\x7e\xbd\xf9\x0d\xa3\xff\x07\xfb\x57\xa4\x90\xce\x01\x7a\xc3\xe0\x9d\x72\xb4\x42\xda\x83\x14\x3d\x70\x17\x7a\x09\x29\x0a\xf7\x51\x9e\xe7\x1a\xb3\x27\x19\x1f\xd7\x38\x11\x5d\x5f\xbc\x99\x6c\x8c\x37\xa7\x75\xc6\xc1\x41\x8c\x29\x6e\xca\x72\xef\x54\x28\x32\xa4\x71\xbf\xda\x4c\xbf\x30\x47\x19\x83\xed\xce\x1c\xbe\x9b\x43\x81\x2c\xf2\x0a\x2d\x8e\xc3\x21\x52\xed\x87\xa8\x93\x5a\xf3\xc1\xa6\x77\x82\x49\xd6\x20\x03\x23\x9d\xf4\xa5\x9e\x75\x90\x65\x4e\x8c\xf4\x90\xd0\xc3\xe3\x66\x8b\xe6\x49\x6e\xdf\x75\x94\x71\x6f\xe2\x1a\x68\xe4\xd4\xf0\x04\x7d\xe7\xa7\xd6\x4f\x45\x61\xf2\x47\xfe\xde\x04\xfa\xa9\x28\xa6\x6b\xeb\x58\xb9\x48\xbf\x5e\xa8\x36\xd7\x44\xc2\x24\x65\x37\x79\x34\xe6\xe9\xef\xc9\x35\x3e\x2a\x5b\x4a\xaf\xbf\x6f\x6d\xf9\x19\x15\xe4\x76\xf7\xe1\xf0\x61\x25\x78\x79\x86\x15\x3f\xa3\x3a\x03\x1d\x68\xe6\x1e\xcf\x01\x84\x6f\x51\x48\x07\x46\xcc\xc9\x01\x8b\x66\x76\xae\x7a\x71\x78\x98\x3a\x3e\x9f\x3c\x9f\xd4\xaf\xde\x60\x81\x0a\x21\x33\x3f\xbf\x27\x20\x96\xd1\x91\x98\xfc\xed\xab\x10\xdb\x1e\x4d\x7d\x93\x81\xdf\x0b\xc4\xe7\x93\x47\xdc\x89\x50\x9c\x15\x85\xac\x71\x4d\x32\x01\x20\xc9\xfb\x37\x5d\xc1\x34\xfb\x2e\x3d\x46\xac\x35\x08\xbe\x43\x3d\xfe\x48\xa8\x19\x2d\xab\x02\x4b\x64\x0a\xb3\x23\x83\x83\x23\xfc\xdf\x6b\x12\xa7\x53\xbd\x15\xe2\x9a\xab\xf7\x9d\xd1\xf1\xd1\xfd\xe8\xf4\xce\x68\x9c\x8b\x5f\x91\x76\x6d\x8f\xf2\x8e\x76\x5c\x9b\x6a\xc8\x12\x4f\x6e\xbb\xc5\xe8\x1f\xd3\x34\x59\x76\xe0\xe8\xe6\x87\x21\x85\xdf\xc3\x86\x59\x1e\xb8\x4d\x61\x9f\xa8\xbf\x1d\x8c\x3d\xd2\x0f\x8e\x70\xa2\x45\xb6\xb1\xb1\x7b\x42\x3b\x47\x03\x16\x12\x7b\x1d\x74\x14\x96\x6e\xdc\x1e\x65\xb0\x39\xf7\x81\x94\x14\xc5\xe8\x90\x49\x8f\x41\x2e\xa1\x1d\xbc\xd8\x35\x94\xe5\x87\xe3\x6c\xf8\x46\x6c\x7c\xe8\xd4\x5e\x65\x8d\x03\x39\x71\xa5\xf5\x5f\xaa\x00\xba\x02\xff\x54\xcb\xe6\xc4\xc4\x39\x57\x62\x6c\xb9\xfb\xa1\xbf\xba\x37\x59\x0c\xb4\x0c\x02\xaa\xb9\xf9\xeb\xa3\xb4\x71\x4d\xef\x50\x60\x68\xb5\x6b\xd6\xdf\xa6\x46\xdb\xc8\xeb\x51\xe5\x0f\x0a\xfe\xde\xe1\x65\xb2\xf5\x1f\x4b\x8e\x93\xe6\x1b\x9b\x74\xb3\xd9\x84\x43\x0f\xce\x3a\x53\x77\x9a\xe3\x29\x0f\x46\xb3\xb2\x36\x8d\xb2\xda\x5c\xa7\x00\xd5\x96\xef\xc9\xe1\xb6\x1d\xad\x26\x04\x3c\x79\xd7\x9a\x5e\xe7\xf1\x79\x5f\xf6\xfe\x32\xd7\x8a\xa3\x4b\x64\x27\xae\xbb\x2a\xec\xdd\xf4\xdd\x0e\x6f\xf7\x86\xca\x87\x41\xc6\x19\xba\x9b\x35\x73\xf3\xe5\xd0\x9c\xc2\xcb\x29\x61\x31\x68\x5f\xde\x90\xed\x74\xa4\x4b\xf2\xf8\x5e\x61\x79\xc5\x6b\xa6\xb4\x88\x39\xf0\xda\x3c\xa0\x58\x91\x14\x9f\x9e\x3d\xf4\xde\x8b\x5d\xa7\xe9\x70\x9a\x02\x87\xf3\x68\x05\x34\x31\x3e\x18\x0e\x73\xe6\x94\x57\x97\xdd\x03\x11\xb0\x37\x1f\x0c\x87\x9e\xc4\xe5\x12\x5e\x7f\xdf\xdb\x16\xe9\x6d\x0a\xf5\xc7\xc8\xa4\x17\xe7\x3b\x0d\x10\xbd\x57\xb0\x34\xdb\x31\x8f\xc6\x80\x88\xd5\x73\x69\xb6\xf5\xa1\xdf\x03\x4a\xf2\xa8\x6b\x61\xc0\xe4\x55\x4f\x2f\xdb\xf7\xf4\xca\x1f\x47\xcc\x6d\x23\xd1\xdf\x26\x05\x0f\xb7\x5c\x07\x6c\x29\xc9\xe3\x84\x39\xaf\xf4\xbe\xf3\xd1\x37\x81\x9a\x70\xb5\x0b\xa2\x58\x7b\x6d\x36\xeb\xc1\xdc\x45\x2f\x66\x5a\xc3\x4f\x53\x35\x13\x06\x81\xb1\xcf\xfe\xef\x01\x5a\xfb\x4e\xf7\x79\x18\x3c\x0f\x4e\xcc\xf7\xe6\xd3\x40\x1f\x0b\x51\x2e\x43\x7a\xe6\xfc\x38\xf6\x92\x9f\x3d\xd6\x8e\xf6\xaf\xee\x6c\x6b\x15\xcd\xfe\x94\xcd\xe6\x03\x6e\x2d\x32\x1f\x47\xf5\x89\xc3\x0b\xff\xab\xb9\x42\xd4\x9c\xb6\x6b\x2e\xb1\xb9\xfa\x95\xed\x15\xb5\xde\x2c\xe4\xf4\x01\x9b\xcb\xe4\x49\xf4\xdb\xb3\xeb\x6e\xab\xe5\x0c\x98\x9b\xe0\xf4\x84\x42\x5c\x6a\x56\xd3\x48\x36\x65\x6f\x07\x6a\xbd\xbb\xf2\xc9\x40\x4e\xd0\x7f\x33\x8c\xf0\x51\x81\x26\xcd\xf5\xf6\x79\x5a\x18\xb4\x1c\x2a\x61\xc0\xf1\x20\x30\x7e\x85\xb4\xbd\x79\xdc\x65\xe7\x73\xf8\x9f\x00\x00\x00\xff\xff\xad\xf4\xe6\x85\x82\x25\x00\x00") - -func template_fakeGoBytes() ([]byte, error) { - return bindataRead( - _template_fakeGo, - "template_fake.go", - ) -} - -func template_fakeGo() (*asset, error) { - bytes, err := template_fakeGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "template_fake.go", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _triggerGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x57\x4f\x6f\xdb\x36\x14\x3f\x8b\x9f\x82\xe5\xa1\xb0\x6a\x55\xbe\x07\xd0\x21\x73\x8a\x2c\xd8\x92\x16\x49\x0e\x03\x86\xa1\x65\xa8\x67\x87\xab\x2c\x6a\x24\x8d\x24\x30\xf2\xdd\x07\x92\xa2\x44\x4a\xb4\x97\xa2\x87\xf9\x90\xc8\x8f\xef\xef\xef\xf7\xde\xa3\xdc\x51\xf6\x9d\x6e\x01\x33\xa1\x76\x42\xd5\x0f\x08\xf1\x5d\x27\xa4\xc6\x0b\x94\x11\x26\x5a\x0d\xcf\x9a\xa0\x8c\xb4\xa0\x57\x8f\x5a\x77\x04\xe5\x08\xad\x56\xf8\x5e\xf2\xed\x16\x24\x96\xd0\x49\x50\xd0\x6a\x85\x29\xd6\x4e\x88\xf4\x4b\x07\x83\x86\xd2\x72\xcf\x34\x3e\xa0\xec\xea\x02\xc7\x1f\xa5\x25\x6f\xb7\x81\xe0\xdb\xdf\x4a\xb4\x67\x84\xd7\x85\xd8\x71\x0d\xbb\x4e\xbf\x90\x6f\x28\xbb\x05\x25\xf6\x92\xc1\xe0\xe0\x98\xe1\x57\x39\x35\xbd\xe7\x3b\x50\x9a\xee\x3a\xaf\xc9\x5b\x1d\x27\xe1\x4d\xb5\x8a\x2d\xef\xa0\xd9\xbc\x29\xdb\xaf\x0a\x9a\x4d\x6c\xfb\xe9\x9e\x6e\xdf\x66\x0b\x9a\x6e\x63\xdb\x5f\x44\xfd\xf2\x26\xdb\x07\x51\xbf\x4c\x8a\x75\x90\x7f\xee\x40\x52\xcd\x45\x8b\x67\x82\xde\x54\x4f\xe4\x49\x37\xf7\x86\x45\xfb\x99\x09\x62\x37\x46\x1e\x79\x78\x0d\x5b\x64\x0c\x9e\xea\x15\x2c\xfc\x71\xd4\x35\xa3\x91\xab\x3e\xed\x90\x89\x56\x69\xda\x6a\x85\xec\x93\xe9\xd9\xa9\xce\x79\xd3\x84\x25\x8c\xb6\x15\x26\xe7\x4d\x43\xe6\x16\x6b\x09\x54\x43\xda\xc2\x9d\x25\x8c\x6e\xa1\x6b\x28\x4b\xa4\x5f\x61\xd2\x9f\x25\xac\x2e\xa0\x81\x63\xa1\xdc\xd9\x64\xdc\x2c\x03\x49\x18\x0d\x78\x11\x82\x56\x75\x0e\x9e\x15\x1f\xc7\xcd\x1c\x7f\x91\x10\x53\x5e\x61\xf2\x45\x06\xf9\x5b\x25\xa1\xf4\x4c\x49\x28\x3d\x49\x58\x85\xd9\xf6\xb9\xaa\x28\x4f\x15\x2c\x88\xb5\xd8\xfb\xe9\x0c\xc6\xd4\x8f\x0a\x33\xa7\x47\x17\x43\x30\x25\xc7\x97\x81\x0f\x89\xf1\x9f\x7f\x7d\xf0\x0b\xaa\x57\xf7\x87\xd3\x4e\xb6\xc9\xf6\xa9\xaf\x1b\x0e\xad\x0e\x32\xfe\x50\x53\x4d\x1f\xa8\x02\x77\x82\xb2\x8e\xea\x47\x0f\x7b\x34\x06\xbd\x29\x0f\x49\x63\xce\x28\x84\xc3\xab\xb5\x1a\xe4\xc6\x74\x94\x81\xc5\x76\xdd\xa2\xdf\xc6\xe5\xda\xfd\x2f\xb0\xaf\x20\xc7\x0b\xff\x58\x60\x90\x52\xc8\x1c\x65\xbf\x73\xa5\x17\xb9\x77\x7b\xa5\x4d\x6b\x09\xe9\xe4\xe7\x4d\x33\xf5\x16\xf8\x50\xa3\x93\x4b\xd0\xf3\xb0\xae\xba\x64\x50\xd7\xb4\xa7\x32\xb5\x9a\x86\x38\x3b\x13\x3f\x56\xd3\x84\x0c\x53\x89\xaf\x2b\xa4\x24\xe2\x0a\x65\x26\x04\x6f\xf7\xd1\x36\xc9\x6a\xd1\xc2\xb0\x4f\x1f\x84\x68\x62\xb2\x06\xb7\x11\x5d\xdc\x83\x18\x12\x36\xaa\x86\x94\xdd\xc0\xf3\x0c\xb9\x24\xc4\x2e\xec\x0d\x3c\xc5\xfc\x4b\xd0\x7b\xd9\x9a\xe0\x2d\x3c\x4d\xfb\x65\xb3\x6f\xd9\xcc\x64\xc1\x44\xd3\x30\xbc\x16\x4d\x03\xcc\xee\x31\x2b\x2e\xb0\x91\xf3\x7a\x60\x2d\x8e\x73\x40\x99\x0b\x85\xdf\x47\xb0\x1d\x50\x96\xc5\xad\x7d\x66\x1d\xb1\x72\xf1\x81\x4d\x42\xe4\x65\xac\x59\xa0\xcc\x8e\xc1\x59\x70\x65\x1d\xb7\xb5\x03\xb3\xc4\x64\x65\x8e\xd4\x8a\xe0\x65\x9f\x71\x81\xb2\x57\x03\x8f\xad\x76\xc1\x70\xcc\x6b\x8e\xa9\x69\x62\xfd\x8c\x67\x2d\xc4\xa7\xd4\xa4\x80\x37\x95\xd3\xa6\xf1\x2b\x09\x9f\x55\xf8\xbd\xd7\x39\xbc\x22\x94\x6d\x84\x34\x3a\x99\x0e\x0d\x8d\x1a\x2f\x1d\xb9\xfa\x39\x47\x59\xc6\x37\x56\xfe\xae\xc2\x2d\x6f\xac\x81\x07\xb4\xe5\x8d\xb5\x41\x59\xf6\xea\x14\x87\x60\x55\xa0\xfd\x20\x81\x7e\xb7\x3a\x28\x0b\x33\x2a\xdd\x32\x5c\x56\x38\x96\x4c\xb4\x82\x0d\x18\x68\x8e\xd2\x89\xfa\xb0\x01\x2b\x4c\xbb\x0e\xda\x7a\x91\x3a\x2d\xf0\x4c\x54\x96\x65\x8e\x6c\x92\x7d\x79\x81\x5d\x61\xaa\x39\x45\x95\x5f\x60\x29\xb6\x5a\x78\xf2\xed\x1d\xcc\xfe\x54\xe4\xd0\x1f\xa9\x33\xdf\x2a\xcc\xca\x5a\x18\xaf\x05\x36\xaf\xa6\xe5\x35\xe8\x47\x51\x9b\x5b\xa8\xc0\xcc\x36\xd6\x92\xac\x7c\x92\xa4\xc0\x24\x78\x76\xe7\xbd\xe1\x9d\xa6\x7a\xaf\x5c\x96\x75\x81\xdf\x8f\x39\x15\xc3\x5c\xd8\x22\x73\x5f\xfe\xa9\x6a\xd3\x9b\x37\x31\x6a\xe1\x02\x3b\x44\x4e\xce\x30\x3b\xd9\xfb\xc3\x12\x9f\x23\x7a\xac\xd9\xfb\xd8\xac\xec\xe7\xc6\x40\xe0\x32\xcd\x4f\x45\xb2\x37\x40\x8a\xb7\x5e\x2f\xd8\x2c\x3f\x43\xda\x25\xa4\x38\x5b\x91\xe5\x10\x26\x45\xdf\x51\xd5\x80\xd5\xcf\xbf\x15\x6e\x14\x7f\x9c\x48\x7f\x9b\x9d\x28\x7f\x7a\xb3\x99\x32\xc7\x49\x2f\xed\xef\x80\xaa\xc2\x84\xd8\x61\xef\x39\xf8\x24\xa5\x39\xb8\x85\x7f\xf6\x5c\x42\x6d\xc6\x2a\x7b\x04\x5a\xf7\x7b\xc8\x26\xff\xab\xfd\x7e\x18\x4f\xca\x3b\xd0\x0b\x72\xb5\xf9\x78\x4d\x35\x7b\x24\x45\x14\x23\x0f\xf8\x4d\xa0\xeb\x0a\x39\x89\x5a\x79\x75\xf1\x66\x84\xad\x6e\x00\xf1\x8d\xb0\xb0\x98\xcb\xc6\x22\x6d\xff\xf4\x69\x9f\x6c\xae\xe1\x2d\xe0\xff\x5c\x0c\x2b\xb2\x1c\x43\xbd\x09\x86\x89\xfa\x4f\xaf\x10\x3e\x00\x13\x6e\x84\x1c\xfb\x7b\x26\x31\xe2\xc3\x55\x12\xcf\x7a\x00\x04\xdf\x60\x5e\xda\xd7\x9c\xb1\xf3\xdc\x02\x3f\xde\x6a\xd6\x26\x7a\x5f\x7a\x37\xf4\x6e\xd4\x86\x7f\x7c\xbc\x56\x1f\xd7\x81\x22\x29\x26\x96\xfd\x65\xe1\xe8\xe0\x47\x47\x9e\xff\xc7\x9a\xe6\xf3\x35\x3d\x1b\x68\x15\x34\x5b\xe2\x3e\x0e\x4b\x9f\x54\x57\x79\xc3\xf2\x32\x5d\x95\x71\xe8\x40\xac\xa6\xc8\xd8\xa9\x46\x01\x99\xff\x06\x00\x00\xff\xff\xd4\x0c\x52\x6d\x4a\x11\x00\x00") - -func triggerGoBytes() ([]byte, error) { - return bindataRead( - _triggerGo, - "trigger.go", - ) -} - -func triggerGo() (*asset, error) { - bytes, err := triggerGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "trigger.go", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _userGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x56\x5b\x6f\xdb\x36\x14\x7e\x26\x7f\xc5\xa9\x1e\x02\xab\x51\xe4\x77\x03\x7a\x18\x92\x22\x0b\xb6\x64\x45\xd3\x01\x03\x86\xa1\xa5\xa9\xe3\x98\xab\x4c\x6a\x24\x85\xa4\x30\xf2\xdf\x07\x92\xba\x50\xb7\x75\x17\x60\x7e\x88\x43\xf1\x23\xcf\xf7\x7d\xe7\x22\xd7\x8c\x7f\x61\x4f\x08\x5c\x99\x93\x32\xe5\x9e\x52\x71\xaa\x95\xb6\xb0\xa1\x24\xe1\x4a\x5a\x7c\xb1\x09\x25\x89\x44\xbb\x3d\x5a\x5b\x27\x34\xa5\x74\xbb\x85\x9f\x0d\x6a\xd0\x58\x6b\x34\x28\xad\x01\x06\x8d\x41\x4d\xed\xd7\x1a\xc3\x9e\xb1\xba\xe1\x16\xce\x94\xdc\xdd\x40\xff\x31\x56\x0b\xf9\x04\x9f\x7f\x37\x4a\xee\x12\x51\x66\xea\x24\x2c\x9e\x6a\xfb\x35\xf9\x4c\xc9\x07\x34\xaa\xd1\x1c\xdd\x89\x31\xf2\x93\x9e\x62\x3f\x8a\x13\x1a\xcb\x4e\x35\x00\x08\x69\xdd\xe5\x1d\xd6\x9a\x31\xf4\x11\xab\xc3\x32\x81\x4f\x06\xab\xc3\x18\xfc\xee\x23\x7b\x5a\x01\xa3\x65\x4f\x63\xf0\x7b\xd4\x27\x61\x8c\x50\xd2\x4c\xc1\xf5\xb0\x35\x3a\xf3\xda\xdb\x67\x62\xff\x9c\x7b\x66\xb0\xcf\x44\xfe\x5d\xab\x26\xe8\xeb\x85\xf6\x41\xb8\xdb\x5a\xf5\xb0\x65\xb4\xee\x61\x88\xe4\x3f\xbf\xfe\xf6\xd6\xa7\xad\xc5\xfa\x9d\x29\x6f\xcf\xce\x11\xbd\xae\x04\x4a\x1b\x51\x7c\x5b\x32\xcb\xf6\xcc\x60\xd8\xa1\xa4\x66\xf6\xd8\xc6\x8f\x14\xb7\xe7\x44\x57\x2e\xc0\x03\xbc\x97\xdd\x01\xa4\x45\x7d\x60\x1c\xbd\x7c\x8d\xcc\xe2\xa6\xad\xc5\xfc\x3a\x7c\x67\xe0\xf9\xa6\xb0\xf1\xdf\x19\xa0\xd6\x4a\xa7\x94\xfc\x28\x8c\xdd\xa4\xfe\xb6\x3b\x8b\x9a\x59\xa5\xc3\xc3\xef\xaa\x6a\x7a\x49\x77\xda\x0c\xc7\x6f\xd1\xce\x43\x05\x21\xf3\x58\x37\x58\xe1\x5f\x50\xf3\x30\x97\x91\xba\x62\xfc\x6f\x2b\x88\x8d\x76\xbc\x3b\x15\xb1\xdd\x43\x12\x28\x71\xd7\x0a\xd9\x30\x2b\x94\xec\x2c\x27\xa5\x92\xd8\x37\xdd\x5e\xa9\x2a\xca\x42\x7f\xe1\x90\x07\xd1\x39\xd5\x67\x62\x00\xc5\xb9\x78\xc0\x97\x99\x3d\x73\x13\x43\xa8\x07\x7c\x8e\x52\xaa\xd1\x36\x5a\xba\x80\x12\x9f\x47\xc9\x3f\x34\x92\x8f\xc1\x1b\x0e\x37\xa3\x7a\xca\xa0\xdc\x8b\xb2\x4f\x43\x74\xed\x99\x92\x70\x33\x5c\x0c\x9e\x9c\x29\x21\xe3\x82\xdc\x01\xcf\x37\x93\x22\x4d\x33\x4a\x7c\x9d\xee\x86\xf1\x04\x49\xb9\x37\xdb\x04\x2e\x7d\xc0\x8c\x92\x57\x27\xc6\x33\xdc\x70\x88\x6c\x4f\x81\xb9\x72\xb2\x2f\x30\xcb\xaa\x18\xf9\x37\x73\xc7\x51\x66\x55\xe5\xfb\x1d\x76\x05\x5c\xf8\xdd\xf3\x2b\xa5\xe4\xa0\xb4\xdb\x25\x4d\x8f\x77\x00\x91\x07\xd7\xed\x4b\x4a\x09\x11\x07\xff\xfc\x4d\x01\x52\x54\x1e\xdd\x19\x20\x45\xe5\xcf\x50\x42\x5e\x03\x30\xc4\x28\x22\xe8\x5e\x23\xfb\xe2\x01\x94\xf4\x2c\xf2\x30\x60\x2e\x0b\x88\x96\xf1\x7e\x34\x52\x3a\xcc\xf0\x28\x06\x86\x79\x52\x00\xab\x6b\x94\xe5\x66\xfc\x3c\x83\x68\x91\xe7\x79\x4a\x3d\x8d\x96\x7d\x87\xcd\x1c\xd9\x55\xd3\xbb\x59\xb0\xe4\xbb\xc4\x67\x5f\x56\x5d\x57\x0d\x8b\x60\xe5\x60\xbf\x5b\x15\xc0\xf3\x52\xb9\x9b\x32\x70\xef\xb5\xfc\x1e\xed\x51\x95\xef\x95\xb1\x19\xf0\xdc\xd5\xc5\x65\xb2\xf5\x94\x92\x0c\x92\xee\x9f\xb0\xd3\x1e\x79\xb4\xcc\x36\x26\x70\x2a\x33\xb8\x68\x19\x64\xa1\x16\xbd\x92\xb4\x13\xb8\x2a\x69\x61\x5e\x4d\xab\x3a\x9e\x02\xe7\xe1\xec\x0e\xf8\x7a\x79\xf6\x13\x6f\x6e\xd5\x62\x49\xb6\xf1\x78\xde\xd6\xb5\x93\x1a\xa8\xa5\xab\x31\xfc\xac\x5c\x4a\x85\x03\x45\xfd\xfa\xef\x52\x71\x8b\xb3\x4c\x6c\x93\xcb\x70\xf5\x2c\x23\x0b\x88\x28\x45\x3f\xfd\x90\x85\xf6\xf8\x27\x89\xe9\x86\xfb\x9a\xc0\xd1\x94\x77\x5a\xda\x8e\xcb\xfd\x2f\x88\xa2\x80\x24\xf1\x4d\xd7\x3a\xfb\x4e\x6b\xb7\xf1\x01\xff\x68\x84\xc6\xd2\x15\x3f\x39\x22\x2b\xdb\x31\xe0\xd9\x7e\xef\xd7\xe7\x61\x27\x7f\x44\xbb\x49\xee\x0e\x57\xf7\xcc\xf2\x63\x92\x0d\x01\xd2\x28\x65\x0b\xe6\x05\xf2\x2b\xee\xe4\x77\x37\xdf\x32\xd0\x43\x22\x07\x1f\x94\xd7\xee\x46\xb1\x37\xd2\xff\x69\x49\xae\x17\x48\xff\xe6\xfb\x5f\xfb\x75\x9b\x5c\xb6\x77\x7f\x43\x68\x8c\xfa\x0f\x0d\x2d\x82\xe8\xb8\x4b\x53\xe8\x66\xf6\x42\xf3\x85\xb1\x1c\xb5\x60\x24\x55\x1c\x40\xe4\xfe\xe5\x3d\x94\x4e\x98\x93\xeb\xb5\xe2\xcf\x8c\x7e\x05\xbc\xe9\x8b\x6f\x54\x47\xbf\x5c\xdd\x9b\xab\xeb\x08\x98\x64\x93\x93\xed\x4c\x0e\x86\x8b\xd5\xae\x14\xab\xf3\x51\xcc\xe7\xe3\xb8\xf9\x4c\x54\x36\x0b\x2f\xb3\x58\xf1\x44\x54\xd1\x1d\xcc\x6f\x97\xc5\xb8\x0b\x83\x77\xc5\xd4\x10\xdf\x8d\x34\x4a\xdd\x9f\x01\x00\x00\xff\xff\x9d\x3e\x6d\x2e\xf7\x0c\x00\x00") - -func userGoBytes() ([]byte, error) { - return bindataRead( - _userGo, - "user.go", - ) -} - -func userGo() (*asset, error) { - bytes, err := userGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "user.go", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ - "authorizer.go": authorizerGo, - "collection.go": collectionGo, - "cosmosdb.go": cosmosdbGo, - "database.go": databaseGo, - "document.go": documentGo, - "permission.go": permissionGo, - "template.go": templateGo, - "template_fake.go": template_fakeGo, - "trigger.go": triggerGo, - "user.go": userGo, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} - -var _bintree = &bintree{nil, map[string]*bintree{ - "authorizer.go": &bintree{authorizerGo, map[string]*bintree{}}, - "collection.go": &bintree{collectionGo, map[string]*bintree{}}, - "cosmosdb.go": &bintree{cosmosdbGo, map[string]*bintree{}}, - "database.go": &bintree{databaseGo, map[string]*bintree{}}, - "document.go": &bintree{documentGo, map[string]*bintree{}}, - "permission.go": &bintree{permissionGo, map[string]*bintree{}}, - "template.go": &bintree{templateGo, map[string]*bintree{}}, - "template_fake.go": &bintree{template_fakeGo, map[string]*bintree{}}, - "trigger.go": &bintree{triggerGo, map[string]*bintree{}}, - "user.go": &bintree{userGo, map[string]*bintree{}}, -}} - -// RestoreAsset restores an asset under the given directory -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil -} - -// RestoreAssets restores an asset under the given directory recursively -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) -} diff --git a/vendor/github.com/jewzaam/go-cosmosdb/pkg/gencosmosdb/generate.go b/vendor/github.com/jewzaam/go-cosmosdb/pkg/gencosmosdb/generate.go deleted file mode 100644 index 309f689a710..00000000000 --- a/vendor/github.com/jewzaam/go-cosmosdb/pkg/gencosmosdb/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -package gencosmosdb - -//go:generate go run ../../vendor/github.com/go-bindata/go-bindata/go-bindata -pkg gencosmosdb -prefix cosmosdb -nometadata cosmosdb diff --git a/vendor/github.com/mattn/go-colorable/LICENSE b/vendor/github.com/mattn/go-colorable/LICENSE deleted file mode 100644 index 91b5cef30eb..00000000000 --- a/vendor/github.com/mattn/go-colorable/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Yasuhiro Matsumoto - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/mattn/go-colorable/README.md b/vendor/github.com/mattn/go-colorable/README.md deleted file mode 100644 index ca0483711c9..00000000000 --- a/vendor/github.com/mattn/go-colorable/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# go-colorable - -[![Build Status](https://github.com/mattn/go-colorable/workflows/test/badge.svg)](https://github.com/mattn/go-colorable/actions?query=workflow%3Atest) -[![Codecov](https://codecov.io/gh/mattn/go-colorable/branch/master/graph/badge.svg)](https://codecov.io/gh/mattn/go-colorable) -[![GoDoc](https://godoc.org/github.com/mattn/go-colorable?status.svg)](http://godoc.org/github.com/mattn/go-colorable) -[![Go Report Card](https://goreportcard.com/badge/mattn/go-colorable)](https://goreportcard.com/report/mattn/go-colorable) - -Colorable writer for windows. - -For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.) -This package is possible to handle escape sequence for ansi color on windows. - -## Too Bad! - -![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png) - - -## So Good! - -![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png) - -## Usage - -```go -logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true}) -logrus.SetOutput(colorable.NewColorableStdout()) - -logrus.Info("succeeded") -logrus.Warn("not correct") -logrus.Error("something error") -logrus.Fatal("panic") -``` - -You can compile above code on non-windows OSs. - -## Installation - -``` -$ go get github.com/mattn/go-colorable -``` - -# License - -MIT - -# Author - -Yasuhiro Matsumoto (a.k.a mattn) diff --git a/vendor/github.com/mattn/go-colorable/colorable_appengine.go b/vendor/github.com/mattn/go-colorable/colorable_appengine.go deleted file mode 100644 index 416d1bbbf83..00000000000 --- a/vendor/github.com/mattn/go-colorable/colorable_appengine.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build appengine -// +build appengine - -package colorable - -import ( - "io" - "os" - - _ "github.com/mattn/go-isatty" -) - -// NewColorable returns new instance of Writer which handles escape sequence. -func NewColorable(file *os.File) io.Writer { - if file == nil { - panic("nil passed instead of *os.File to NewColorable()") - } - - return file -} - -// NewColorableStdout returns new instance of Writer which handles escape sequence for stdout. -func NewColorableStdout() io.Writer { - return os.Stdout -} - -// NewColorableStderr returns new instance of Writer which handles escape sequence for stderr. -func NewColorableStderr() io.Writer { - return os.Stderr -} - -// EnableColorsStdout enable colors if possible. -func EnableColorsStdout(enabled *bool) func() { - if enabled != nil { - *enabled = true - } - return func() {} -} diff --git a/vendor/github.com/mattn/go-colorable/colorable_others.go b/vendor/github.com/mattn/go-colorable/colorable_others.go deleted file mode 100644 index 766d94603ac..00000000000 --- a/vendor/github.com/mattn/go-colorable/colorable_others.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build !windows && !appengine -// +build !windows,!appengine - -package colorable - -import ( - "io" - "os" - - _ "github.com/mattn/go-isatty" -) - -// NewColorable returns new instance of Writer which handles escape sequence. -func NewColorable(file *os.File) io.Writer { - if file == nil { - panic("nil passed instead of *os.File to NewColorable()") - } - - return file -} - -// NewColorableStdout returns new instance of Writer which handles escape sequence for stdout. -func NewColorableStdout() io.Writer { - return os.Stdout -} - -// NewColorableStderr returns new instance of Writer which handles escape sequence for stderr. -func NewColorableStderr() io.Writer { - return os.Stderr -} - -// EnableColorsStdout enable colors if possible. -func EnableColorsStdout(enabled *bool) func() { - if enabled != nil { - *enabled = true - } - return func() {} -} diff --git a/vendor/github.com/mattn/go-colorable/colorable_windows.go b/vendor/github.com/mattn/go-colorable/colorable_windows.go deleted file mode 100644 index 1846ad5ab41..00000000000 --- a/vendor/github.com/mattn/go-colorable/colorable_windows.go +++ /dev/null @@ -1,1047 +0,0 @@ -//go:build windows && !appengine -// +build windows,!appengine - -package colorable - -import ( - "bytes" - "io" - "math" - "os" - "strconv" - "strings" - "sync" - "syscall" - "unsafe" - - "github.com/mattn/go-isatty" -) - -const ( - foregroundBlue = 0x1 - foregroundGreen = 0x2 - foregroundRed = 0x4 - foregroundIntensity = 0x8 - foregroundMask = (foregroundRed | foregroundBlue | foregroundGreen | foregroundIntensity) - backgroundBlue = 0x10 - backgroundGreen = 0x20 - backgroundRed = 0x40 - backgroundIntensity = 0x80 - backgroundMask = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity) - commonLvbUnderscore = 0x8000 - - cENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4 -) - -const ( - genericRead = 0x80000000 - genericWrite = 0x40000000 -) - -const ( - consoleTextmodeBuffer = 0x1 -) - -type wchar uint16 -type short int16 -type dword uint32 -type word uint16 - -type coord struct { - x short - y short -} - -type smallRect struct { - left short - top short - right short - bottom short -} - -type consoleScreenBufferInfo struct { - size coord - cursorPosition coord - attributes word - window smallRect - maximumWindowSize coord -} - -type consoleCursorInfo struct { - size dword - visible int32 -} - -var ( - kernel32 = syscall.NewLazyDLL("kernel32.dll") - procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo") - procSetConsoleTextAttribute = kernel32.NewProc("SetConsoleTextAttribute") - procSetConsoleCursorPosition = kernel32.NewProc("SetConsoleCursorPosition") - procFillConsoleOutputCharacter = kernel32.NewProc("FillConsoleOutputCharacterW") - procFillConsoleOutputAttribute = kernel32.NewProc("FillConsoleOutputAttribute") - procGetConsoleCursorInfo = kernel32.NewProc("GetConsoleCursorInfo") - procSetConsoleCursorInfo = kernel32.NewProc("SetConsoleCursorInfo") - procSetConsoleTitle = kernel32.NewProc("SetConsoleTitleW") - procGetConsoleMode = kernel32.NewProc("GetConsoleMode") - procSetConsoleMode = kernel32.NewProc("SetConsoleMode") - procCreateConsoleScreenBuffer = kernel32.NewProc("CreateConsoleScreenBuffer") -) - -// Writer provides colorable Writer to the console -type Writer struct { - out io.Writer - handle syscall.Handle - althandle syscall.Handle - oldattr word - oldpos coord - rest bytes.Buffer - mutex sync.Mutex -} - -// NewColorable returns new instance of Writer which handles escape sequence from File. -func NewColorable(file *os.File) io.Writer { - if file == nil { - panic("nil passed instead of *os.File to NewColorable()") - } - - if isatty.IsTerminal(file.Fd()) { - var mode uint32 - if r, _, _ := procGetConsoleMode.Call(file.Fd(), uintptr(unsafe.Pointer(&mode))); r != 0 && mode&cENABLE_VIRTUAL_TERMINAL_PROCESSING != 0 { - return file - } - var csbi consoleScreenBufferInfo - handle := syscall.Handle(file.Fd()) - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - return &Writer{out: file, handle: handle, oldattr: csbi.attributes, oldpos: coord{0, 0}} - } - return file -} - -// NewColorableStdout returns new instance of Writer which handles escape sequence for stdout. -func NewColorableStdout() io.Writer { - return NewColorable(os.Stdout) -} - -// NewColorableStderr returns new instance of Writer which handles escape sequence for stderr. -func NewColorableStderr() io.Writer { - return NewColorable(os.Stderr) -} - -var color256 = map[int]int{ - 0: 0x000000, - 1: 0x800000, - 2: 0x008000, - 3: 0x808000, - 4: 0x000080, - 5: 0x800080, - 6: 0x008080, - 7: 0xc0c0c0, - 8: 0x808080, - 9: 0xff0000, - 10: 0x00ff00, - 11: 0xffff00, - 12: 0x0000ff, - 13: 0xff00ff, - 14: 0x00ffff, - 15: 0xffffff, - 16: 0x000000, - 17: 0x00005f, - 18: 0x000087, - 19: 0x0000af, - 20: 0x0000d7, - 21: 0x0000ff, - 22: 0x005f00, - 23: 0x005f5f, - 24: 0x005f87, - 25: 0x005faf, - 26: 0x005fd7, - 27: 0x005fff, - 28: 0x008700, - 29: 0x00875f, - 30: 0x008787, - 31: 0x0087af, - 32: 0x0087d7, - 33: 0x0087ff, - 34: 0x00af00, - 35: 0x00af5f, - 36: 0x00af87, - 37: 0x00afaf, - 38: 0x00afd7, - 39: 0x00afff, - 40: 0x00d700, - 41: 0x00d75f, - 42: 0x00d787, - 43: 0x00d7af, - 44: 0x00d7d7, - 45: 0x00d7ff, - 46: 0x00ff00, - 47: 0x00ff5f, - 48: 0x00ff87, - 49: 0x00ffaf, - 50: 0x00ffd7, - 51: 0x00ffff, - 52: 0x5f0000, - 53: 0x5f005f, - 54: 0x5f0087, - 55: 0x5f00af, - 56: 0x5f00d7, - 57: 0x5f00ff, - 58: 0x5f5f00, - 59: 0x5f5f5f, - 60: 0x5f5f87, - 61: 0x5f5faf, - 62: 0x5f5fd7, - 63: 0x5f5fff, - 64: 0x5f8700, - 65: 0x5f875f, - 66: 0x5f8787, - 67: 0x5f87af, - 68: 0x5f87d7, - 69: 0x5f87ff, - 70: 0x5faf00, - 71: 0x5faf5f, - 72: 0x5faf87, - 73: 0x5fafaf, - 74: 0x5fafd7, - 75: 0x5fafff, - 76: 0x5fd700, - 77: 0x5fd75f, - 78: 0x5fd787, - 79: 0x5fd7af, - 80: 0x5fd7d7, - 81: 0x5fd7ff, - 82: 0x5fff00, - 83: 0x5fff5f, - 84: 0x5fff87, - 85: 0x5fffaf, - 86: 0x5fffd7, - 87: 0x5fffff, - 88: 0x870000, - 89: 0x87005f, - 90: 0x870087, - 91: 0x8700af, - 92: 0x8700d7, - 93: 0x8700ff, - 94: 0x875f00, - 95: 0x875f5f, - 96: 0x875f87, - 97: 0x875faf, - 98: 0x875fd7, - 99: 0x875fff, - 100: 0x878700, - 101: 0x87875f, - 102: 0x878787, - 103: 0x8787af, - 104: 0x8787d7, - 105: 0x8787ff, - 106: 0x87af00, - 107: 0x87af5f, - 108: 0x87af87, - 109: 0x87afaf, - 110: 0x87afd7, - 111: 0x87afff, - 112: 0x87d700, - 113: 0x87d75f, - 114: 0x87d787, - 115: 0x87d7af, - 116: 0x87d7d7, - 117: 0x87d7ff, - 118: 0x87ff00, - 119: 0x87ff5f, - 120: 0x87ff87, - 121: 0x87ffaf, - 122: 0x87ffd7, - 123: 0x87ffff, - 124: 0xaf0000, - 125: 0xaf005f, - 126: 0xaf0087, - 127: 0xaf00af, - 128: 0xaf00d7, - 129: 0xaf00ff, - 130: 0xaf5f00, - 131: 0xaf5f5f, - 132: 0xaf5f87, - 133: 0xaf5faf, - 134: 0xaf5fd7, - 135: 0xaf5fff, - 136: 0xaf8700, - 137: 0xaf875f, - 138: 0xaf8787, - 139: 0xaf87af, - 140: 0xaf87d7, - 141: 0xaf87ff, - 142: 0xafaf00, - 143: 0xafaf5f, - 144: 0xafaf87, - 145: 0xafafaf, - 146: 0xafafd7, - 147: 0xafafff, - 148: 0xafd700, - 149: 0xafd75f, - 150: 0xafd787, - 151: 0xafd7af, - 152: 0xafd7d7, - 153: 0xafd7ff, - 154: 0xafff00, - 155: 0xafff5f, - 156: 0xafff87, - 157: 0xafffaf, - 158: 0xafffd7, - 159: 0xafffff, - 160: 0xd70000, - 161: 0xd7005f, - 162: 0xd70087, - 163: 0xd700af, - 164: 0xd700d7, - 165: 0xd700ff, - 166: 0xd75f00, - 167: 0xd75f5f, - 168: 0xd75f87, - 169: 0xd75faf, - 170: 0xd75fd7, - 171: 0xd75fff, - 172: 0xd78700, - 173: 0xd7875f, - 174: 0xd78787, - 175: 0xd787af, - 176: 0xd787d7, - 177: 0xd787ff, - 178: 0xd7af00, - 179: 0xd7af5f, - 180: 0xd7af87, - 181: 0xd7afaf, - 182: 0xd7afd7, - 183: 0xd7afff, - 184: 0xd7d700, - 185: 0xd7d75f, - 186: 0xd7d787, - 187: 0xd7d7af, - 188: 0xd7d7d7, - 189: 0xd7d7ff, - 190: 0xd7ff00, - 191: 0xd7ff5f, - 192: 0xd7ff87, - 193: 0xd7ffaf, - 194: 0xd7ffd7, - 195: 0xd7ffff, - 196: 0xff0000, - 197: 0xff005f, - 198: 0xff0087, - 199: 0xff00af, - 200: 0xff00d7, - 201: 0xff00ff, - 202: 0xff5f00, - 203: 0xff5f5f, - 204: 0xff5f87, - 205: 0xff5faf, - 206: 0xff5fd7, - 207: 0xff5fff, - 208: 0xff8700, - 209: 0xff875f, - 210: 0xff8787, - 211: 0xff87af, - 212: 0xff87d7, - 213: 0xff87ff, - 214: 0xffaf00, - 215: 0xffaf5f, - 216: 0xffaf87, - 217: 0xffafaf, - 218: 0xffafd7, - 219: 0xffafff, - 220: 0xffd700, - 221: 0xffd75f, - 222: 0xffd787, - 223: 0xffd7af, - 224: 0xffd7d7, - 225: 0xffd7ff, - 226: 0xffff00, - 227: 0xffff5f, - 228: 0xffff87, - 229: 0xffffaf, - 230: 0xffffd7, - 231: 0xffffff, - 232: 0x080808, - 233: 0x121212, - 234: 0x1c1c1c, - 235: 0x262626, - 236: 0x303030, - 237: 0x3a3a3a, - 238: 0x444444, - 239: 0x4e4e4e, - 240: 0x585858, - 241: 0x626262, - 242: 0x6c6c6c, - 243: 0x767676, - 244: 0x808080, - 245: 0x8a8a8a, - 246: 0x949494, - 247: 0x9e9e9e, - 248: 0xa8a8a8, - 249: 0xb2b2b2, - 250: 0xbcbcbc, - 251: 0xc6c6c6, - 252: 0xd0d0d0, - 253: 0xdadada, - 254: 0xe4e4e4, - 255: 0xeeeeee, -} - -// `\033]0;TITLESTR\007` -func doTitleSequence(er *bytes.Reader) error { - var c byte - var err error - - c, err = er.ReadByte() - if err != nil { - return err - } - if c != '0' && c != '2' { - return nil - } - c, err = er.ReadByte() - if err != nil { - return err - } - if c != ';' { - return nil - } - title := make([]byte, 0, 80) - for { - c, err = er.ReadByte() - if err != nil { - return err - } - if c == 0x07 || c == '\n' { - break - } - title = append(title, c) - } - if len(title) > 0 { - title8, err := syscall.UTF16PtrFromString(string(title)) - if err == nil { - procSetConsoleTitle.Call(uintptr(unsafe.Pointer(title8))) - } - } - return nil -} - -// returns Atoi(s) unless s == "" in which case it returns def -func atoiWithDefault(s string, def int) (int, error) { - if s == "" { - return def, nil - } - return strconv.Atoi(s) -} - -// Write writes data on console -func (w *Writer) Write(data []byte) (n int, err error) { - w.mutex.Lock() - defer w.mutex.Unlock() - var csbi consoleScreenBufferInfo - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) - - handle := w.handle - - var er *bytes.Reader - if w.rest.Len() > 0 { - var rest bytes.Buffer - w.rest.WriteTo(&rest) - w.rest.Reset() - rest.Write(data) - er = bytes.NewReader(rest.Bytes()) - } else { - er = bytes.NewReader(data) - } - var plaintext bytes.Buffer -loop: - for { - c1, err := er.ReadByte() - if err != nil { - plaintext.WriteTo(w.out) - break loop - } - if c1 != 0x1b { - plaintext.WriteByte(c1) - continue - } - _, err = plaintext.WriteTo(w.out) - if err != nil { - break loop - } - c2, err := er.ReadByte() - if err != nil { - break loop - } - - switch c2 { - case '>': - continue - case ']': - w.rest.WriteByte(c1) - w.rest.WriteByte(c2) - er.WriteTo(&w.rest) - if bytes.IndexByte(w.rest.Bytes(), 0x07) == -1 { - break loop - } - er = bytes.NewReader(w.rest.Bytes()[2:]) - err := doTitleSequence(er) - if err != nil { - break loop - } - w.rest.Reset() - continue - // https://github.com/mattn/go-colorable/issues/27 - case '7': - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - w.oldpos = csbi.cursorPosition - continue - case '8': - procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&w.oldpos))) - continue - case 0x5b: - // execute part after switch - default: - continue - } - - w.rest.WriteByte(c1) - w.rest.WriteByte(c2) - er.WriteTo(&w.rest) - - var buf bytes.Buffer - var m byte - for i, c := range w.rest.Bytes()[2:] { - if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { - m = c - er = bytes.NewReader(w.rest.Bytes()[2+i+1:]) - w.rest.Reset() - break - } - buf.Write([]byte(string(c))) - } - if m == 0 { - break loop - } - - switch m { - case 'A': - n, err = atoiWithDefault(buf.String(), 1) - if err != nil { - continue - } - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - csbi.cursorPosition.y -= short(n) - procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) - case 'B': - n, err = atoiWithDefault(buf.String(), 1) - if err != nil { - continue - } - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - csbi.cursorPosition.y += short(n) - procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) - case 'C': - n, err = atoiWithDefault(buf.String(), 1) - if err != nil { - continue - } - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - csbi.cursorPosition.x += short(n) - procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) - case 'D': - n, err = atoiWithDefault(buf.String(), 1) - if err != nil { - continue - } - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - csbi.cursorPosition.x -= short(n) - if csbi.cursorPosition.x < 0 { - csbi.cursorPosition.x = 0 - } - procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) - case 'E': - n, err = strconv.Atoi(buf.String()) - if err != nil { - continue - } - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - csbi.cursorPosition.x = 0 - csbi.cursorPosition.y += short(n) - procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) - case 'F': - n, err = strconv.Atoi(buf.String()) - if err != nil { - continue - } - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - csbi.cursorPosition.x = 0 - csbi.cursorPosition.y -= short(n) - procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) - case 'G': - n, err = strconv.Atoi(buf.String()) - if err != nil { - continue - } - if n < 1 { - n = 1 - } - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - csbi.cursorPosition.x = short(n - 1) - procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) - case 'H', 'f': - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - if buf.Len() > 0 { - token := strings.Split(buf.String(), ";") - switch len(token) { - case 1: - n1, err := strconv.Atoi(token[0]) - if err != nil { - continue - } - csbi.cursorPosition.y = short(n1 - 1) - case 2: - n1, err := strconv.Atoi(token[0]) - if err != nil { - continue - } - n2, err := strconv.Atoi(token[1]) - if err != nil { - continue - } - csbi.cursorPosition.x = short(n2 - 1) - csbi.cursorPosition.y = short(n1 - 1) - } - } else { - csbi.cursorPosition.y = 0 - } - procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) - case 'J': - n := 0 - if buf.Len() > 0 { - n, err = strconv.Atoi(buf.String()) - if err != nil { - continue - } - } - var count, written dword - var cursor coord - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - switch n { - case 0: - cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y} - count = dword(csbi.size.x) - dword(csbi.cursorPosition.x) + dword(csbi.size.y-csbi.cursorPosition.y)*dword(csbi.size.x) - case 1: - cursor = coord{x: csbi.window.left, y: csbi.window.top} - count = dword(csbi.size.x) - dword(csbi.cursorPosition.x) + dword(csbi.window.top-csbi.cursorPosition.y)*dword(csbi.size.x) - case 2: - cursor = coord{x: csbi.window.left, y: csbi.window.top} - count = dword(csbi.size.x) - dword(csbi.cursorPosition.x) + dword(csbi.size.y-csbi.cursorPosition.y)*dword(csbi.size.x) - } - procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) - procFillConsoleOutputAttribute.Call(uintptr(handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) - case 'K': - n := 0 - if buf.Len() > 0 { - n, err = strconv.Atoi(buf.String()) - if err != nil { - continue - } - } - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - var cursor coord - var count, written dword - switch n { - case 0: - cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y} - count = dword(csbi.size.x - csbi.cursorPosition.x) - case 1: - cursor = coord{x: csbi.window.left, y: csbi.cursorPosition.y} - count = dword(csbi.size.x - csbi.cursorPosition.x) - case 2: - cursor = coord{x: csbi.window.left, y: csbi.cursorPosition.y} - count = dword(csbi.size.x) - } - procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) - procFillConsoleOutputAttribute.Call(uintptr(handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) - case 'X': - n := 0 - if buf.Len() > 0 { - n, err = strconv.Atoi(buf.String()) - if err != nil { - continue - } - } - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - var cursor coord - var written dword - cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y} - procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(n), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) - procFillConsoleOutputAttribute.Call(uintptr(handle), uintptr(csbi.attributes), uintptr(n), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) - case 'm': - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - attr := csbi.attributes - cs := buf.String() - if cs == "" { - procSetConsoleTextAttribute.Call(uintptr(handle), uintptr(w.oldattr)) - continue - } - token := strings.Split(cs, ";") - for i := 0; i < len(token); i++ { - ns := token[i] - if n, err = strconv.Atoi(ns); err == nil { - switch { - case n == 0 || n == 100: - attr = w.oldattr - case n == 4: - attr |= commonLvbUnderscore - case (1 <= n && n <= 3) || n == 5: - attr |= foregroundIntensity - case n == 7 || n == 27: - attr = - (attr &^ (foregroundMask | backgroundMask)) | - ((attr & foregroundMask) << 4) | - ((attr & backgroundMask) >> 4) - case n == 22: - attr &^= foregroundIntensity - case n == 24: - attr &^= commonLvbUnderscore - case 30 <= n && n <= 37: - attr &= backgroundMask - if (n-30)&1 != 0 { - attr |= foregroundRed - } - if (n-30)&2 != 0 { - attr |= foregroundGreen - } - if (n-30)&4 != 0 { - attr |= foregroundBlue - } - case n == 38: // set foreground color. - if i < len(token)-2 && (token[i+1] == "5" || token[i+1] == "05") { - if n256, err := strconv.Atoi(token[i+2]); err == nil { - if n256foreAttr == nil { - n256setup() - } - attr &= backgroundMask - attr |= n256foreAttr[n256%len(n256foreAttr)] - i += 2 - } - } else if len(token) == 5 && token[i+1] == "2" { - var r, g, b int - r, _ = strconv.Atoi(token[i+2]) - g, _ = strconv.Atoi(token[i+3]) - b, _ = strconv.Atoi(token[i+4]) - i += 4 - if r > 127 { - attr |= foregroundRed - } - if g > 127 { - attr |= foregroundGreen - } - if b > 127 { - attr |= foregroundBlue - } - } else { - attr = attr & (w.oldattr & backgroundMask) - } - case n == 39: // reset foreground color. - attr &= backgroundMask - attr |= w.oldattr & foregroundMask - case 40 <= n && n <= 47: - attr &= foregroundMask - if (n-40)&1 != 0 { - attr |= backgroundRed - } - if (n-40)&2 != 0 { - attr |= backgroundGreen - } - if (n-40)&4 != 0 { - attr |= backgroundBlue - } - case n == 48: // set background color. - if i < len(token)-2 && token[i+1] == "5" { - if n256, err := strconv.Atoi(token[i+2]); err == nil { - if n256backAttr == nil { - n256setup() - } - attr &= foregroundMask - attr |= n256backAttr[n256%len(n256backAttr)] - i += 2 - } - } else if len(token) == 5 && token[i+1] == "2" { - var r, g, b int - r, _ = strconv.Atoi(token[i+2]) - g, _ = strconv.Atoi(token[i+3]) - b, _ = strconv.Atoi(token[i+4]) - i += 4 - if r > 127 { - attr |= backgroundRed - } - if g > 127 { - attr |= backgroundGreen - } - if b > 127 { - attr |= backgroundBlue - } - } else { - attr = attr & (w.oldattr & foregroundMask) - } - case n == 49: // reset foreground color. - attr &= foregroundMask - attr |= w.oldattr & backgroundMask - case 90 <= n && n <= 97: - attr = (attr & backgroundMask) - attr |= foregroundIntensity - if (n-90)&1 != 0 { - attr |= foregroundRed - } - if (n-90)&2 != 0 { - attr |= foregroundGreen - } - if (n-90)&4 != 0 { - attr |= foregroundBlue - } - case 100 <= n && n <= 107: - attr = (attr & foregroundMask) - attr |= backgroundIntensity - if (n-100)&1 != 0 { - attr |= backgroundRed - } - if (n-100)&2 != 0 { - attr |= backgroundGreen - } - if (n-100)&4 != 0 { - attr |= backgroundBlue - } - } - procSetConsoleTextAttribute.Call(uintptr(handle), uintptr(attr)) - } - } - case 'h': - var ci consoleCursorInfo - cs := buf.String() - if cs == "5>" { - procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) - ci.visible = 0 - procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) - } else if cs == "?25" { - procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) - ci.visible = 1 - procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) - } else if cs == "?1049" { - if w.althandle == 0 { - h, _, _ := procCreateConsoleScreenBuffer.Call(uintptr(genericRead|genericWrite), 0, 0, uintptr(consoleTextmodeBuffer), 0, 0) - w.althandle = syscall.Handle(h) - if w.althandle != 0 { - handle = w.althandle - } - } - } - case 'l': - var ci consoleCursorInfo - cs := buf.String() - if cs == "5>" { - procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) - ci.visible = 1 - procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) - } else if cs == "?25" { - procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) - ci.visible = 0 - procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) - } else if cs == "?1049" { - if w.althandle != 0 { - syscall.CloseHandle(w.althandle) - w.althandle = 0 - handle = w.handle - } - } - case 's': - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - w.oldpos = csbi.cursorPosition - case 'u': - procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&w.oldpos))) - } - } - - return len(data), nil -} - -type consoleColor struct { - rgb int - red bool - green bool - blue bool - intensity bool -} - -func (c consoleColor) foregroundAttr() (attr word) { - if c.red { - attr |= foregroundRed - } - if c.green { - attr |= foregroundGreen - } - if c.blue { - attr |= foregroundBlue - } - if c.intensity { - attr |= foregroundIntensity - } - return -} - -func (c consoleColor) backgroundAttr() (attr word) { - if c.red { - attr |= backgroundRed - } - if c.green { - attr |= backgroundGreen - } - if c.blue { - attr |= backgroundBlue - } - if c.intensity { - attr |= backgroundIntensity - } - return -} - -var color16 = []consoleColor{ - {0x000000, false, false, false, false}, - {0x000080, false, false, true, false}, - {0x008000, false, true, false, false}, - {0x008080, false, true, true, false}, - {0x800000, true, false, false, false}, - {0x800080, true, false, true, false}, - {0x808000, true, true, false, false}, - {0xc0c0c0, true, true, true, false}, - {0x808080, false, false, false, true}, - {0x0000ff, false, false, true, true}, - {0x00ff00, false, true, false, true}, - {0x00ffff, false, true, true, true}, - {0xff0000, true, false, false, true}, - {0xff00ff, true, false, true, true}, - {0xffff00, true, true, false, true}, - {0xffffff, true, true, true, true}, -} - -type hsv struct { - h, s, v float32 -} - -func (a hsv) dist(b hsv) float32 { - dh := a.h - b.h - switch { - case dh > 0.5: - dh = 1 - dh - case dh < -0.5: - dh = -1 - dh - } - ds := a.s - b.s - dv := a.v - b.v - return float32(math.Sqrt(float64(dh*dh + ds*ds + dv*dv))) -} - -func toHSV(rgb int) hsv { - r, g, b := float32((rgb&0xFF0000)>>16)/256.0, - float32((rgb&0x00FF00)>>8)/256.0, - float32(rgb&0x0000FF)/256.0 - min, max := minmax3f(r, g, b) - h := max - min - if h > 0 { - if max == r { - h = (g - b) / h - if h < 0 { - h += 6 - } - } else if max == g { - h = 2 + (b-r)/h - } else { - h = 4 + (r-g)/h - } - } - h /= 6.0 - s := max - min - if max != 0 { - s /= max - } - v := max - return hsv{h: h, s: s, v: v} -} - -type hsvTable []hsv - -func toHSVTable(rgbTable []consoleColor) hsvTable { - t := make(hsvTable, len(rgbTable)) - for i, c := range rgbTable { - t[i] = toHSV(c.rgb) - } - return t -} - -func (t hsvTable) find(rgb int) consoleColor { - hsv := toHSV(rgb) - n := 7 - l := float32(5.0) - for i, p := range t { - d := hsv.dist(p) - if d < l { - l, n = d, i - } - } - return color16[n] -} - -func minmax3f(a, b, c float32) (min, max float32) { - if a < b { - if b < c { - return a, c - } else if a < c { - return a, b - } else { - return c, b - } - } else { - if a < c { - return b, c - } else if b < c { - return b, a - } else { - return c, a - } - } -} - -var n256foreAttr []word -var n256backAttr []word - -func n256setup() { - n256foreAttr = make([]word, 256) - n256backAttr = make([]word, 256) - t := toHSVTable(color16) - for i, rgb := range color256 { - c := t.find(rgb) - n256foreAttr[i] = c.foregroundAttr() - n256backAttr[i] = c.backgroundAttr() - } -} - -// EnableColorsStdout enable colors if possible. -func EnableColorsStdout(enabled *bool) func() { - var mode uint32 - h := os.Stdout.Fd() - if r, _, _ := procGetConsoleMode.Call(h, uintptr(unsafe.Pointer(&mode))); r != 0 { - if r, _, _ = procSetConsoleMode.Call(h, uintptr(mode|cENABLE_VIRTUAL_TERMINAL_PROCESSING)); r != 0 { - if enabled != nil { - *enabled = true - } - return func() { - procSetConsoleMode.Call(h, uintptr(mode)) - } - } - } - if enabled != nil { - *enabled = true - } - return func() {} -} diff --git a/vendor/github.com/mattn/go-colorable/go.test.sh b/vendor/github.com/mattn/go-colorable/go.test.sh deleted file mode 100644 index 012162b077c..00000000000 --- a/vendor/github.com/mattn/go-colorable/go.test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -e -echo "" > coverage.txt - -for d in $(go list ./... | grep -v vendor); do - go test -race -coverprofile=profile.out -covermode=atomic "$d" - if [ -f profile.out ]; then - cat profile.out >> coverage.txt - rm profile.out - fi -done diff --git a/vendor/github.com/mattn/go-colorable/noncolorable.go b/vendor/github.com/mattn/go-colorable/noncolorable.go deleted file mode 100644 index 05d6f74bf6b..00000000000 --- a/vendor/github.com/mattn/go-colorable/noncolorable.go +++ /dev/null @@ -1,57 +0,0 @@ -package colorable - -import ( - "bytes" - "io" -) - -// NonColorable holds writer but removes escape sequence. -type NonColorable struct { - out io.Writer -} - -// NewNonColorable returns new instance of Writer which removes escape sequence from Writer. -func NewNonColorable(w io.Writer) io.Writer { - return &NonColorable{out: w} -} - -// Write writes data on console -func (w *NonColorable) Write(data []byte) (n int, err error) { - er := bytes.NewReader(data) - var plaintext bytes.Buffer -loop: - for { - c1, err := er.ReadByte() - if err != nil { - plaintext.WriteTo(w.out) - break loop - } - if c1 != 0x1b { - plaintext.WriteByte(c1) - continue - } - _, err = plaintext.WriteTo(w.out) - if err != nil { - break loop - } - c2, err := er.ReadByte() - if err != nil { - break loop - } - if c2 != 0x5b { - continue - } - - for { - c, err := er.ReadByte() - if err != nil { - break loop - } - if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { - break - } - } - } - - return len(data), nil -} diff --git a/vendor/github.com/pascaldekloe/name/.travis.yml b/vendor/github.com/pascaldekloe/name/.travis.yml deleted file mode 100644 index 4f2ee4d9733..00000000000 --- a/vendor/github.com/pascaldekloe/name/.travis.yml +++ /dev/null @@ -1 +0,0 @@ -language: go diff --git a/vendor/github.com/pascaldekloe/name/LICENSE b/vendor/github.com/pascaldekloe/name/LICENSE deleted file mode 100644 index 88188f77aa0..00000000000 --- a/vendor/github.com/pascaldekloe/name/LICENSE +++ /dev/null @@ -1,5 +0,0 @@ -To the extent possible under law, Pascal S. de Kloe has waived all -copyright and related or neighboring rights to name. This work is -published from The Netherlands. - -https://creativecommons.org/publicdomain/zero/1.0/legalcode diff --git a/vendor/github.com/pascaldekloe/name/README.md b/vendor/github.com/pascaldekloe/name/README.md deleted file mode 100644 index a065b9b6137..00000000000 --- a/vendor/github.com/pascaldekloe/name/README.md +++ /dev/null @@ -1,18 +0,0 @@ -[![API Documentation](https://godoc.org/github.com/pascaldekloe/name?status.svg)](https://godoc.org/github.com/pascaldekloe/name) -[![Build Status](https://travis-ci.org/pascaldekloe/name.svg?branch=master)](https://travis-ci.org/pascaldekloe/name) - -Naming convention library for the Go programming language. -The functions offer flexible parsing and strict formatting for label -techniques such as snake_case, Lisp-case, CamelCase and (Java) property keys. - - -This is free and unencumbered software released into the -[public domain](http://creativecommons.org/publicdomain/zero/1.0). - - -### Inspiration - -* `name.CamelCase("pascal case", true)` returns *PascalCase* -* `name.CamelCase("snake_to_camel AND CamelToCamel?", false)` returns *snakeToCamelANDCamelToCamel* -* `name.Delimit("* All Hype is aGoodThing (TM)", '-')` returns *all-hype-is-a-good-thing-TM* -* `name.DotSeparated("WebCrawler#socketTimeout")` returns *web.crawler.socket.timeout* diff --git a/vendor/github.com/pascaldekloe/name/case.go b/vendor/github.com/pascaldekloe/name/case.go deleted file mode 100644 index 7b2e8520983..00000000000 --- a/vendor/github.com/pascaldekloe/name/case.go +++ /dev/null @@ -1,115 +0,0 @@ -// Package name implements naming conventions. -// The functions offer flexible parsing and strict formatting for label -// techniques such as snake_case, Lisp-case, CamelCase and (Java) property keys. -package name - -import "unicode" - -// CamelCase returns the medial capitals form of word sequence s. -// The input can be any case or even just a bunch of words. -// Upper case sequences (abbreviations) are preserved. -// Argument upper sets the letter case for the first rune. Use true for -// UpperCamelCase and false for lowerCamelCase. -func CamelCase(s string, upper bool) string { - if s == "" { - return "" - } - - out := make([]rune, 1, len(s)+5) - for i, r := range s { - if i == 0 { - if upper { - r = unicode.ToUpper(r) - } - out[0] = r - continue - } - - if i == 1 { - if !upper && unicode.Is(unicode.Lower, r) { - out[0] = unicode.ToLower(out[0]) - } - - upper = false - } - - switch { - case unicode.IsLetter(r): - if upper { - r = unicode.ToUpper(r) - } - - fallthrough - case unicode.IsNumber(r): - upper = false - out = append(out, r) - - default: - upper = true - - } - } - - return string(out) -} - -// SnakeCase is an alias for Delimit(s, '_'). -func SnakeCase(s string) string { - return Delimit(s, '_') -} - -// DotSeparated is an alias for Delimit(s, '.'). -func DotSeparated(s string) string { - return Delimit(s, '.') -} - -// Delimit returns word sequence s delimited with separator sep. -// The input can be any case or even just a bunch of words. -// Upper case sequences (abbreviations) are preserved. Use -// strings.ToLower and strings.ToUpper to enforce a letter case. -func Delimit(s string, sep rune) string { - out := make([]rune, 0, len(s)+5) - - for _, r := range s { - switch { - case unicode.IsUpper(r): - if last := len(out) - 1; last >= 0 && unicode.IsLower(out[last]) { - out = append(out, sep) - } - - case unicode.IsLetter(r): - if i := len(out) - 1; i >= 0 { - if last := out[i]; unicode.IsUpper(last) { - out = out[:i] - if i > 0 && out[i-1] != sep { - out = append(out, sep) - } - out = append(out, unicode.ToLower(last)) - } - } - - case !unicode.IsNumber(r): - if i := len(out); i != 0 && out[i-1] != sep { - out = append(out, sep) - } - continue - - } - out = append(out, r) - } - - if len(out) == 0 { - return "" - } - - // trim tailing separator - if i := len(out) - 1; out[i] == sep { - out = out[:i] - } - - if len(out) == 1 { - out[0] = unicode.ToLower(out[0]) - } - - return string(out) -} diff --git a/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go b/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go deleted file mode 100644 index 150f887e7a4..00000000000 --- a/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package lazyregexp is a thin wrapper over regexp, allowing the use of global -// regexp variables without forcing them to be compiled at init. -package lazyregexp - -import ( - "os" - "regexp" - "strings" - "sync" -) - -// Regexp is a wrapper around [regexp.Regexp], where the underlying regexp will be -// compiled the first time it is needed. -type Regexp struct { - str string - once sync.Once - rx *regexp.Regexp -} - -func (r *Regexp) re() *regexp.Regexp { - r.once.Do(r.build) - return r.rx -} - -func (r *Regexp) build() { - r.rx = regexp.MustCompile(r.str) - r.str = "" -} - -func (r *Regexp) FindSubmatch(s []byte) [][]byte { - return r.re().FindSubmatch(s) -} - -func (r *Regexp) FindStringSubmatch(s string) []string { - return r.re().FindStringSubmatch(s) -} - -func (r *Regexp) FindStringSubmatchIndex(s string) []int { - return r.re().FindStringSubmatchIndex(s) -} - -func (r *Regexp) ReplaceAllString(src, repl string) string { - return r.re().ReplaceAllString(src, repl) -} - -func (r *Regexp) FindString(s string) string { - return r.re().FindString(s) -} - -func (r *Regexp) FindAllString(s string, n int) []string { - return r.re().FindAllString(s, n) -} - -func (r *Regexp) MatchString(s string) bool { - return r.re().MatchString(s) -} - -func (r *Regexp) SubexpNames() []string { - return r.re().SubexpNames() -} - -var inTest = len(os.Args) > 0 && strings.HasSuffix(strings.TrimSuffix(os.Args[0], ".exe"), ".test") - -// New creates a new lazy regexp, delaying the compiling work until it is first -// needed. If the code is being run as part of tests, the regexp compiling will -// happen immediately. -func New(str string) *Regexp { - lr := &Regexp{str: str} - if inTest { - // In tests, always compile the regexps early. - lr.re() - } - return lr -} diff --git a/vendor/golang.org/x/mod/modfile/print.go b/vendor/golang.org/x/mod/modfile/print.go deleted file mode 100644 index 2a0123d4b91..00000000000 --- a/vendor/golang.org/x/mod/modfile/print.go +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Module file printer. - -package modfile - -import ( - "bytes" - "fmt" - "strings" -) - -// Format returns a go.mod file as a byte slice, formatted in standard style. -func Format(f *FileSyntax) []byte { - pr := &printer{} - pr.file(f) - - // remove trailing blank lines - b := pr.Bytes() - for len(b) > 0 && b[len(b)-1] == '\n' && (len(b) == 1 || b[len(b)-2] == '\n') { - b = b[:len(b)-1] - } - return b -} - -// A printer collects the state during printing of a file or expression. -type printer struct { - bytes.Buffer // output buffer - comment []Comment // pending end-of-line comments - margin int // left margin (indent), a number of tabs -} - -// printf prints to the buffer. -func (p *printer) printf(format string, args ...interface{}) { - fmt.Fprintf(p, format, args...) -} - -// indent returns the position on the current line, in bytes, 0-indexed. -func (p *printer) indent() int { - b := p.Bytes() - n := 0 - for n < len(b) && b[len(b)-1-n] != '\n' { - n++ - } - return n -} - -// newline ends the current line, flushing end-of-line comments. -func (p *printer) newline() { - if len(p.comment) > 0 { - p.printf(" ") - for i, com := range p.comment { - if i > 0 { - p.trim() - p.printf("\n") - for i := 0; i < p.margin; i++ { - p.printf("\t") - } - } - p.printf("%s", strings.TrimSpace(com.Token)) - } - p.comment = p.comment[:0] - } - - p.trim() - if b := p.Bytes(); len(b) == 0 || (len(b) >= 2 && b[len(b)-1] == '\n' && b[len(b)-2] == '\n') { - // skip the blank line at top of file or after a blank line - } else { - p.printf("\n") - } - for i := 0; i < p.margin; i++ { - p.printf("\t") - } -} - -// trim removes trailing spaces and tabs from the current line. -func (p *printer) trim() { - // Remove trailing spaces and tabs from line we're about to end. - b := p.Bytes() - n := len(b) - for n > 0 && (b[n-1] == '\t' || b[n-1] == ' ') { - n-- - } - p.Truncate(n) -} - -// file formats the given file into the print buffer. -func (p *printer) file(f *FileSyntax) { - for _, com := range f.Before { - p.printf("%s", strings.TrimSpace(com.Token)) - p.newline() - } - - for i, stmt := range f.Stmt { - switch x := stmt.(type) { - case *CommentBlock: - // comments already handled - p.expr(x) - - default: - p.expr(x) - p.newline() - } - - for _, com := range stmt.Comment().After { - p.printf("%s", strings.TrimSpace(com.Token)) - p.newline() - } - - if i+1 < len(f.Stmt) { - p.newline() - } - } -} - -func (p *printer) expr(x Expr) { - // Emit line-comments preceding this expression. - if before := x.Comment().Before; len(before) > 0 { - // Want to print a line comment. - // Line comments must be at the current margin. - p.trim() - if p.indent() > 0 { - // There's other text on the line. Start a new line. - p.printf("\n") - } - // Re-indent to margin. - for i := 0; i < p.margin; i++ { - p.printf("\t") - } - for _, com := range before { - p.printf("%s", strings.TrimSpace(com.Token)) - p.newline() - } - } - - switch x := x.(type) { - default: - panic(fmt.Errorf("printer: unexpected type %T", x)) - - case *CommentBlock: - // done - - case *LParen: - p.printf("(") - case *RParen: - p.printf(")") - - case *Line: - p.tokens(x.Token) - - case *LineBlock: - p.tokens(x.Token) - p.printf(" ") - p.expr(&x.LParen) - p.margin++ - for _, l := range x.Line { - p.newline() - p.expr(l) - } - p.margin-- - p.newline() - p.expr(&x.RParen) - } - - // Queue end-of-line comments for printing when we - // reach the end of the line. - p.comment = append(p.comment, x.Comment().Suffix...) -} - -func (p *printer) tokens(tokens []string) { - sep := "" - for _, t := range tokens { - if t == "," || t == ")" || t == "]" || t == "}" { - sep = "" - } - p.printf("%s%s", sep, t) - sep = " " - if t == "(" || t == "[" || t == "{" { - sep = "" - } - } -} diff --git a/vendor/golang.org/x/mod/modfile/read.go b/vendor/golang.org/x/mod/modfile/read.go deleted file mode 100644 index 22056825915..00000000000 --- a/vendor/golang.org/x/mod/modfile/read.go +++ /dev/null @@ -1,958 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package modfile - -import ( - "bytes" - "errors" - "fmt" - "os" - "strconv" - "strings" - "unicode" - "unicode/utf8" -) - -// A Position describes an arbitrary source position in a file, including the -// file, line, column, and byte offset. -type Position struct { - Line int // line in input (starting at 1) - LineRune int // rune in line (starting at 1) - Byte int // byte in input (starting at 0) -} - -// add returns the position at the end of s, assuming it starts at p. -func (p Position) add(s string) Position { - p.Byte += len(s) - if n := strings.Count(s, "\n"); n > 0 { - p.Line += n - s = s[strings.LastIndex(s, "\n")+1:] - p.LineRune = 1 - } - p.LineRune += utf8.RuneCountInString(s) - return p -} - -// An Expr represents an input element. -type Expr interface { - // Span returns the start and end position of the expression, - // excluding leading or trailing comments. - Span() (start, end Position) - - // Comment returns the comments attached to the expression. - // This method would normally be named 'Comments' but that - // would interfere with embedding a type of the same name. - Comment() *Comments -} - -// A Comment represents a single // comment. -type Comment struct { - Start Position - Token string // without trailing newline - Suffix bool // an end of line (not whole line) comment -} - -// Comments collects the comments associated with an expression. -type Comments struct { - Before []Comment // whole-line comments before this expression - Suffix []Comment // end-of-line comments after this expression - - // For top-level expressions only, After lists whole-line - // comments following the expression. - After []Comment -} - -// Comment returns the receiver. This isn't useful by itself, but -// a [Comments] struct is embedded into all the expression -// implementation types, and this gives each of those a Comment -// method to satisfy the Expr interface. -func (c *Comments) Comment() *Comments { - return c -} - -// A FileSyntax represents an entire go.mod file. -type FileSyntax struct { - Name string // file path - Comments - Stmt []Expr -} - -func (x *FileSyntax) Span() (start, end Position) { - if len(x.Stmt) == 0 { - return - } - start, _ = x.Stmt[0].Span() - _, end = x.Stmt[len(x.Stmt)-1].Span() - return start, end -} - -// addLine adds a line containing the given tokens to the file. -// -// If the first token of the hint matches the first token of the -// line, the new line is added at the end of the block containing hint, -// extracting hint into a new block if it is not yet in one. -// -// If the hint is non-nil buts its first token does not match, -// the new line is added after the block containing hint -// (or hint itself, if not in a block). -// -// If no hint is provided, addLine appends the line to the end of -// the last block with a matching first token, -// or to the end of the file if no such block exists. -func (x *FileSyntax) addLine(hint Expr, tokens ...string) *Line { - if hint == nil { - // If no hint given, add to the last statement of the given type. - Loop: - for i := len(x.Stmt) - 1; i >= 0; i-- { - stmt := x.Stmt[i] - switch stmt := stmt.(type) { - case *Line: - if stmt.Token != nil && stmt.Token[0] == tokens[0] { - hint = stmt - break Loop - } - case *LineBlock: - if stmt.Token[0] == tokens[0] { - hint = stmt - break Loop - } - } - } - } - - newLineAfter := func(i int) *Line { - new := &Line{Token: tokens} - if i == len(x.Stmt) { - x.Stmt = append(x.Stmt, new) - } else { - x.Stmt = append(x.Stmt, nil) - copy(x.Stmt[i+2:], x.Stmt[i+1:]) - x.Stmt[i+1] = new - } - return new - } - - if hint != nil { - for i, stmt := range x.Stmt { - switch stmt := stmt.(type) { - case *Line: - if stmt == hint { - if stmt.Token == nil || stmt.Token[0] != tokens[0] { - return newLineAfter(i) - } - - // Convert line to line block. - stmt.InBlock = true - block := &LineBlock{Token: stmt.Token[:1], Line: []*Line{stmt}} - stmt.Token = stmt.Token[1:] - x.Stmt[i] = block - new := &Line{Token: tokens[1:], InBlock: true} - block.Line = append(block.Line, new) - return new - } - - case *LineBlock: - if stmt == hint { - if stmt.Token[0] != tokens[0] { - return newLineAfter(i) - } - - new := &Line{Token: tokens[1:], InBlock: true} - stmt.Line = append(stmt.Line, new) - return new - } - - for j, line := range stmt.Line { - if line == hint { - if stmt.Token[0] != tokens[0] { - return newLineAfter(i) - } - - // Add new line after hint within the block. - stmt.Line = append(stmt.Line, nil) - copy(stmt.Line[j+2:], stmt.Line[j+1:]) - new := &Line{Token: tokens[1:], InBlock: true} - stmt.Line[j+1] = new - return new - } - } - } - } - } - - new := &Line{Token: tokens} - x.Stmt = append(x.Stmt, new) - return new -} - -func (x *FileSyntax) updateLine(line *Line, tokens ...string) { - if line.InBlock { - tokens = tokens[1:] - } - line.Token = tokens -} - -// markRemoved modifies line so that it (and its end-of-line comment, if any) -// will be dropped by (*FileSyntax).Cleanup. -func (line *Line) markRemoved() { - line.Token = nil - line.Comments.Suffix = nil -} - -// Cleanup cleans up the file syntax x after any edit operations. -// To avoid quadratic behavior, (*Line).markRemoved marks the line as dead -// by setting line.Token = nil but does not remove it from the slice -// in which it appears. After edits have all been indicated, -// calling Cleanup cleans out the dead lines. -func (x *FileSyntax) Cleanup() { - w := 0 - for _, stmt := range x.Stmt { - switch stmt := stmt.(type) { - case *Line: - if stmt.Token == nil { - continue - } - case *LineBlock: - ww := 0 - for _, line := range stmt.Line { - if line.Token != nil { - stmt.Line[ww] = line - ww++ - } - } - if ww == 0 { - continue - } - if ww == 1 && len(stmt.RParen.Comments.Before) == 0 { - // Collapse block into single line. - line := &Line{ - Comments: Comments{ - Before: commentsAdd(stmt.Before, stmt.Line[0].Before), - Suffix: commentsAdd(stmt.Line[0].Suffix, stmt.Suffix), - After: commentsAdd(stmt.Line[0].After, stmt.After), - }, - Token: stringsAdd(stmt.Token, stmt.Line[0].Token), - } - x.Stmt[w] = line - w++ - continue - } - stmt.Line = stmt.Line[:ww] - } - x.Stmt[w] = stmt - w++ - } - x.Stmt = x.Stmt[:w] -} - -func commentsAdd(x, y []Comment) []Comment { - return append(x[:len(x):len(x)], y...) -} - -func stringsAdd(x, y []string) []string { - return append(x[:len(x):len(x)], y...) -} - -// A CommentBlock represents a top-level block of comments separate -// from any rule. -type CommentBlock struct { - Comments - Start Position -} - -func (x *CommentBlock) Span() (start, end Position) { - return x.Start, x.Start -} - -// A Line is a single line of tokens. -type Line struct { - Comments - Start Position - Token []string - InBlock bool - End Position -} - -func (x *Line) Span() (start, end Position) { - return x.Start, x.End -} - -// A LineBlock is a factored block of lines, like -// -// require ( -// "x" -// "y" -// ) -type LineBlock struct { - Comments - Start Position - LParen LParen - Token []string - Line []*Line - RParen RParen -} - -func (x *LineBlock) Span() (start, end Position) { - return x.Start, x.RParen.Pos.add(")") -} - -// An LParen represents the beginning of a parenthesized line block. -// It is a place to store suffix comments. -type LParen struct { - Comments - Pos Position -} - -func (x *LParen) Span() (start, end Position) { - return x.Pos, x.Pos.add(")") -} - -// An RParen represents the end of a parenthesized line block. -// It is a place to store whole-line (before) comments. -type RParen struct { - Comments - Pos Position -} - -func (x *RParen) Span() (start, end Position) { - return x.Pos, x.Pos.add(")") -} - -// An input represents a single input file being parsed. -type input struct { - // Lexing state. - filename string // name of input file, for errors - complete []byte // entire input - remaining []byte // remaining input - tokenStart []byte // token being scanned to end of input - token token // next token to be returned by lex, peek - pos Position // current input position - comments []Comment // accumulated comments - - // Parser state. - file *FileSyntax // returned top-level syntax tree - parseErrors ErrorList // errors encountered during parsing - - // Comment assignment state. - pre []Expr // all expressions, in preorder traversal - post []Expr // all expressions, in postorder traversal -} - -func newInput(filename string, data []byte) *input { - return &input{ - filename: filename, - complete: data, - remaining: data, - pos: Position{Line: 1, LineRune: 1, Byte: 0}, - } -} - -// parse parses the input file. -func parse(file string, data []byte) (f *FileSyntax, err error) { - // The parser panics for both routine errors like syntax errors - // and for programmer bugs like array index errors. - // Turn both into error returns. Catching bug panics is - // especially important when processing many files. - in := newInput(file, data) - defer func() { - if e := recover(); e != nil && e != &in.parseErrors { - in.parseErrors = append(in.parseErrors, Error{ - Filename: in.filename, - Pos: in.pos, - Err: fmt.Errorf("internal error: %v", e), - }) - } - if err == nil && len(in.parseErrors) > 0 { - err = in.parseErrors - } - }() - - // Prime the lexer by reading in the first token. It will be available - // in the next peek() or lex() call. - in.readToken() - - // Invoke the parser. - in.parseFile() - if len(in.parseErrors) > 0 { - return nil, in.parseErrors - } - in.file.Name = in.filename - - // Assign comments to nearby syntax. - in.assignComments() - - return in.file, nil -} - -// Error is called to report an error. -// Error does not return: it panics. -func (in *input) Error(s string) { - in.parseErrors = append(in.parseErrors, Error{ - Filename: in.filename, - Pos: in.pos, - Err: errors.New(s), - }) - panic(&in.parseErrors) -} - -// eof reports whether the input has reached end of file. -func (in *input) eof() bool { - return len(in.remaining) == 0 -} - -// peekRune returns the next rune in the input without consuming it. -func (in *input) peekRune() int { - if len(in.remaining) == 0 { - return 0 - } - r, _ := utf8.DecodeRune(in.remaining) - return int(r) -} - -// peekPrefix reports whether the remaining input begins with the given prefix. -func (in *input) peekPrefix(prefix string) bool { - // This is like bytes.HasPrefix(in.remaining, []byte(prefix)) - // but without the allocation of the []byte copy of prefix. - for i := 0; i < len(prefix); i++ { - if i >= len(in.remaining) || in.remaining[i] != prefix[i] { - return false - } - } - return true -} - -// readRune consumes and returns the next rune in the input. -func (in *input) readRune() int { - if len(in.remaining) == 0 { - in.Error("internal lexer error: readRune at EOF") - } - r, size := utf8.DecodeRune(in.remaining) - in.remaining = in.remaining[size:] - if r == '\n' { - in.pos.Line++ - in.pos.LineRune = 1 - } else { - in.pos.LineRune++ - } - in.pos.Byte += size - return int(r) -} - -type token struct { - kind tokenKind - pos Position - endPos Position - text string -} - -type tokenKind int - -const ( - _EOF tokenKind = -(iota + 1) - _EOLCOMMENT - _IDENT - _STRING - _COMMENT - - // newlines and punctuation tokens are allowed as ASCII codes. -) - -func (k tokenKind) isComment() bool { - return k == _COMMENT || k == _EOLCOMMENT -} - -// isEOL returns whether a token terminates a line. -func (k tokenKind) isEOL() bool { - return k == _EOF || k == _EOLCOMMENT || k == '\n' -} - -// startToken marks the beginning of the next input token. -// It must be followed by a call to endToken, once the token's text has -// been consumed using readRune. -func (in *input) startToken() { - in.tokenStart = in.remaining - in.token.text = "" - in.token.pos = in.pos -} - -// endToken marks the end of an input token. -// It records the actual token string in tok.text. -// A single trailing newline (LF or CRLF) will be removed from comment tokens. -func (in *input) endToken(kind tokenKind) { - in.token.kind = kind - text := string(in.tokenStart[:len(in.tokenStart)-len(in.remaining)]) - if kind.isComment() { - if strings.HasSuffix(text, "\r\n") { - text = text[:len(text)-2] - } else { - text = strings.TrimSuffix(text, "\n") - } - } - in.token.text = text - in.token.endPos = in.pos -} - -// peek returns the kind of the next token returned by lex. -func (in *input) peek() tokenKind { - return in.token.kind -} - -// lex is called from the parser to obtain the next input token. -func (in *input) lex() token { - tok := in.token - in.readToken() - return tok -} - -// readToken lexes the next token from the text and stores it in in.token. -func (in *input) readToken() { - // Skip past spaces, stopping at non-space or EOF. - for !in.eof() { - c := in.peekRune() - if c == ' ' || c == '\t' || c == '\r' { - in.readRune() - continue - } - - // Comment runs to end of line. - if in.peekPrefix("//") { - in.startToken() - - // Is this comment the only thing on its line? - // Find the last \n before this // and see if it's all - // spaces from there to here. - i := bytes.LastIndex(in.complete[:in.pos.Byte], []byte("\n")) - suffix := len(bytes.TrimSpace(in.complete[i+1:in.pos.Byte])) > 0 - in.readRune() - in.readRune() - - // Consume comment. - for len(in.remaining) > 0 && in.readRune() != '\n' { - } - - // If we are at top level (not in a statement), hand the comment to - // the parser as a _COMMENT token. The grammar is written - // to handle top-level comments itself. - if !suffix { - in.endToken(_COMMENT) - return - } - - // Otherwise, save comment for later attachment to syntax tree. - in.endToken(_EOLCOMMENT) - in.comments = append(in.comments, Comment{in.token.pos, in.token.text, suffix}) - return - } - - if in.peekPrefix("/*") { - in.Error("mod files must use // comments (not /* */ comments)") - } - - // Found non-space non-comment. - break - } - - // Found the beginning of the next token. - in.startToken() - - // End of file. - if in.eof() { - in.endToken(_EOF) - return - } - - // Punctuation tokens. - switch c := in.peekRune(); c { - case '\n', '(', ')', '[', ']', '{', '}', ',': - in.readRune() - in.endToken(tokenKind(c)) - return - - case '"', '`': // quoted string - quote := c - in.readRune() - for { - if in.eof() { - in.pos = in.token.pos - in.Error("unexpected EOF in string") - } - if in.peekRune() == '\n' { - in.Error("unexpected newline in string") - } - c := in.readRune() - if c == quote { - break - } - if c == '\\' && quote != '`' { - if in.eof() { - in.pos = in.token.pos - in.Error("unexpected EOF in string") - } - in.readRune() - } - } - in.endToken(_STRING) - return - } - - // Checked all punctuation. Must be identifier token. - if c := in.peekRune(); !isIdent(c) { - in.Error(fmt.Sprintf("unexpected input character %#q", c)) - } - - // Scan over identifier. - for isIdent(in.peekRune()) { - if in.peekPrefix("//") { - break - } - if in.peekPrefix("/*") { - in.Error("mod files must use // comments (not /* */ comments)") - } - in.readRune() - } - in.endToken(_IDENT) -} - -// isIdent reports whether c is an identifier rune. -// We treat most printable runes as identifier runes, except for a handful of -// ASCII punctuation characters. -func isIdent(c int) bool { - switch r := rune(c); r { - case ' ', '(', ')', '[', ']', '{', '}', ',': - return false - default: - return !unicode.IsSpace(r) && unicode.IsPrint(r) - } -} - -// Comment assignment. -// We build two lists of all subexpressions, preorder and postorder. -// The preorder list is ordered by start location, with outer expressions first. -// The postorder list is ordered by end location, with outer expressions last. -// We use the preorder list to assign each whole-line comment to the syntax -// immediately following it, and we use the postorder list to assign each -// end-of-line comment to the syntax immediately preceding it. - -// order walks the expression adding it and its subexpressions to the -// preorder and postorder lists. -func (in *input) order(x Expr) { - if x != nil { - in.pre = append(in.pre, x) - } - switch x := x.(type) { - default: - panic(fmt.Errorf("order: unexpected type %T", x)) - case nil: - // nothing - case *LParen, *RParen: - // nothing - case *CommentBlock: - // nothing - case *Line: - // nothing - case *FileSyntax: - for _, stmt := range x.Stmt { - in.order(stmt) - } - case *LineBlock: - in.order(&x.LParen) - for _, l := range x.Line { - in.order(l) - } - in.order(&x.RParen) - } - if x != nil { - in.post = append(in.post, x) - } -} - -// assignComments attaches comments to nearby syntax. -func (in *input) assignComments() { - const debug = false - - // Generate preorder and postorder lists. - in.order(in.file) - - // Split into whole-line comments and suffix comments. - var line, suffix []Comment - for _, com := range in.comments { - if com.Suffix { - suffix = append(suffix, com) - } else { - line = append(line, com) - } - } - - if debug { - for _, c := range line { - fmt.Fprintf(os.Stderr, "LINE %q :%d:%d #%d\n", c.Token, c.Start.Line, c.Start.LineRune, c.Start.Byte) - } - } - - // Assign line comments to syntax immediately following. - for _, x := range in.pre { - start, _ := x.Span() - if debug { - fmt.Fprintf(os.Stderr, "pre %T :%d:%d #%d\n", x, start.Line, start.LineRune, start.Byte) - } - xcom := x.Comment() - for len(line) > 0 && start.Byte >= line[0].Start.Byte { - if debug { - fmt.Fprintf(os.Stderr, "ASSIGN LINE %q #%d\n", line[0].Token, line[0].Start.Byte) - } - xcom.Before = append(xcom.Before, line[0]) - line = line[1:] - } - } - - // Remaining line comments go at end of file. - in.file.After = append(in.file.After, line...) - - if debug { - for _, c := range suffix { - fmt.Fprintf(os.Stderr, "SUFFIX %q :%d:%d #%d\n", c.Token, c.Start.Line, c.Start.LineRune, c.Start.Byte) - } - } - - // Assign suffix comments to syntax immediately before. - for i := len(in.post) - 1; i >= 0; i-- { - x := in.post[i] - - start, end := x.Span() - if debug { - fmt.Fprintf(os.Stderr, "post %T :%d:%d #%d :%d:%d #%d\n", x, start.Line, start.LineRune, start.Byte, end.Line, end.LineRune, end.Byte) - } - - // Do not assign suffix comments to end of line block or whole file. - // Instead assign them to the last element inside. - switch x.(type) { - case *FileSyntax: - continue - } - - // Do not assign suffix comments to something that starts - // on an earlier line, so that in - // - // x ( y - // z ) // comment - // - // we assign the comment to z and not to x ( ... ). - if start.Line != end.Line { - continue - } - xcom := x.Comment() - for len(suffix) > 0 && end.Byte <= suffix[len(suffix)-1].Start.Byte { - if debug { - fmt.Fprintf(os.Stderr, "ASSIGN SUFFIX %q #%d\n", suffix[len(suffix)-1].Token, suffix[len(suffix)-1].Start.Byte) - } - xcom.Suffix = append(xcom.Suffix, suffix[len(suffix)-1]) - suffix = suffix[:len(suffix)-1] - } - } - - // We assigned suffix comments in reverse. - // If multiple suffix comments were appended to the same - // expression node, they are now in reverse. Fix that. - for _, x := range in.post { - reverseComments(x.Comment().Suffix) - } - - // Remaining suffix comments go at beginning of file. - in.file.Before = append(in.file.Before, suffix...) -} - -// reverseComments reverses the []Comment list. -func reverseComments(list []Comment) { - for i, j := 0, len(list)-1; i < j; i, j = i+1, j-1 { - list[i], list[j] = list[j], list[i] - } -} - -func (in *input) parseFile() { - in.file = new(FileSyntax) - var cb *CommentBlock - for { - switch in.peek() { - case '\n': - in.lex() - if cb != nil { - in.file.Stmt = append(in.file.Stmt, cb) - cb = nil - } - case _COMMENT: - tok := in.lex() - if cb == nil { - cb = &CommentBlock{Start: tok.pos} - } - com := cb.Comment() - com.Before = append(com.Before, Comment{Start: tok.pos, Token: tok.text}) - case _EOF: - if cb != nil { - in.file.Stmt = append(in.file.Stmt, cb) - } - return - default: - in.parseStmt() - if cb != nil { - in.file.Stmt[len(in.file.Stmt)-1].Comment().Before = cb.Before - cb = nil - } - } - } -} - -func (in *input) parseStmt() { - tok := in.lex() - start := tok.pos - end := tok.endPos - tokens := []string{tok.text} - for { - tok := in.lex() - switch { - case tok.kind.isEOL(): - in.file.Stmt = append(in.file.Stmt, &Line{ - Start: start, - Token: tokens, - End: end, - }) - return - - case tok.kind == '(': - if next := in.peek(); next.isEOL() { - // Start of block: no more tokens on this line. - in.file.Stmt = append(in.file.Stmt, in.parseLineBlock(start, tokens, tok)) - return - } else if next == ')' { - rparen := in.lex() - if in.peek().isEOL() { - // Empty block. - in.lex() - in.file.Stmt = append(in.file.Stmt, &LineBlock{ - Start: start, - Token: tokens, - LParen: LParen{Pos: tok.pos}, - RParen: RParen{Pos: rparen.pos}, - }) - return - } - // '( )' in the middle of the line, not a block. - tokens = append(tokens, tok.text, rparen.text) - } else { - // '(' in the middle of the line, not a block. - tokens = append(tokens, tok.text) - } - - default: - tokens = append(tokens, tok.text) - end = tok.endPos - } - } -} - -func (in *input) parseLineBlock(start Position, token []string, lparen token) *LineBlock { - x := &LineBlock{ - Start: start, - Token: token, - LParen: LParen{Pos: lparen.pos}, - } - var comments []Comment - for { - switch in.peek() { - case _EOLCOMMENT: - // Suffix comment, will be attached later by assignComments. - in.lex() - case '\n': - // Blank line. Add an empty comment to preserve it. - in.lex() - if len(comments) == 0 && len(x.Line) > 0 || len(comments) > 0 && comments[len(comments)-1].Token != "" { - comments = append(comments, Comment{}) - } - case _COMMENT: - tok := in.lex() - comments = append(comments, Comment{Start: tok.pos, Token: tok.text}) - case _EOF: - in.Error(fmt.Sprintf("syntax error (unterminated block started at %s:%d:%d)", in.filename, x.Start.Line, x.Start.LineRune)) - case ')': - rparen := in.lex() - x.RParen.Before = comments - x.RParen.Pos = rparen.pos - if !in.peek().isEOL() { - in.Error("syntax error (expected newline after closing paren)") - } - in.lex() - return x - default: - l := in.parseLine() - x.Line = append(x.Line, l) - l.Comment().Before = comments - comments = nil - } - } -} - -func (in *input) parseLine() *Line { - tok := in.lex() - if tok.kind.isEOL() { - in.Error("internal parse error: parseLine at end of line") - } - start := tok.pos - end := tok.endPos - tokens := []string{tok.text} - for { - tok := in.lex() - if tok.kind.isEOL() { - return &Line{ - Start: start, - Token: tokens, - End: end, - InBlock: true, - } - } - tokens = append(tokens, tok.text) - end = tok.endPos - } -} - -var ( - slashSlash = []byte("//") - moduleStr = []byte("module") -) - -// ModulePath returns the module path from the gomod file text. -// If it cannot find a module path, it returns an empty string. -// It is tolerant of unrelated problems in the go.mod file. -func ModulePath(mod []byte) string { - for len(mod) > 0 { - line := mod - mod = nil - if i := bytes.IndexByte(line, '\n'); i >= 0 { - line, mod = line[:i], line[i+1:] - } - if i := bytes.Index(line, slashSlash); i >= 0 { - line = line[:i] - } - line = bytes.TrimSpace(line) - if !bytes.HasPrefix(line, moduleStr) { - continue - } - line = line[len(moduleStr):] - n := len(line) - line = bytes.TrimSpace(line) - if len(line) == n || len(line) == 0 { - continue - } - - if line[0] == '"' || line[0] == '`' { - p, err := strconv.Unquote(string(line)) - if err != nil { - return "" // malformed quoted string or multiline module path - } - return p - } - - return string(line) - } - return "" // missing module path -} diff --git a/vendor/golang.org/x/mod/modfile/rule.go b/vendor/golang.org/x/mod/modfile/rule.go deleted file mode 100644 index 0e7b7e26792..00000000000 --- a/vendor/golang.org/x/mod/modfile/rule.go +++ /dev/null @@ -1,1666 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package modfile implements a parser and formatter for go.mod files. -// -// The go.mod syntax is described in -// https://pkg.go.dev/cmd/go/#hdr-The_go_mod_file. -// -// The [Parse] and [ParseLax] functions both parse a go.mod file and return an -// abstract syntax tree. ParseLax ignores unknown statements and may be used to -// parse go.mod files that may have been developed with newer versions of Go. -// -// The [File] struct returned by Parse and ParseLax represent an abstract -// go.mod file. File has several methods like [File.AddNewRequire] and -// [File.DropReplace] that can be used to programmatically edit a file. -// -// The [Format] function formats a File back to a byte slice which can be -// written to a file. -package modfile - -import ( - "errors" - "fmt" - "path/filepath" - "sort" - "strconv" - "strings" - "unicode" - - "golang.org/x/mod/internal/lazyregexp" - "golang.org/x/mod/module" - "golang.org/x/mod/semver" -) - -// A File is the parsed, interpreted form of a go.mod file. -type File struct { - Module *Module - Go *Go - Toolchain *Toolchain - Require []*Require - Exclude []*Exclude - Replace []*Replace - Retract []*Retract - - Syntax *FileSyntax -} - -// A Module is the module statement. -type Module struct { - Mod module.Version - Deprecated string - Syntax *Line -} - -// A Go is the go statement. -type Go struct { - Version string // "1.23" - Syntax *Line -} - -// A Toolchain is the toolchain statement. -type Toolchain struct { - Name string // "go1.21rc1" - Syntax *Line -} - -// An Exclude is a single exclude statement. -type Exclude struct { - Mod module.Version - Syntax *Line -} - -// A Replace is a single replace statement. -type Replace struct { - Old module.Version - New module.Version - Syntax *Line -} - -// A Retract is a single retract statement. -type Retract struct { - VersionInterval - Rationale string - Syntax *Line -} - -// A VersionInterval represents a range of versions with upper and lower bounds. -// Intervals are closed: both bounds are included. When Low is equal to High, -// the interval may refer to a single version ('v1.2.3') or an interval -// ('[v1.2.3, v1.2.3]'); both have the same representation. -type VersionInterval struct { - Low, High string -} - -// A Require is a single require statement. -type Require struct { - Mod module.Version - Indirect bool // has "// indirect" comment - Syntax *Line -} - -func (r *Require) markRemoved() { - r.Syntax.markRemoved() - *r = Require{} -} - -func (r *Require) setVersion(v string) { - r.Mod.Version = v - - if line := r.Syntax; len(line.Token) > 0 { - if line.InBlock { - // If the line is preceded by an empty line, remove it; see - // https://golang.org/issue/33779. - if len(line.Comments.Before) == 1 && len(line.Comments.Before[0].Token) == 0 { - line.Comments.Before = line.Comments.Before[:0] - } - if len(line.Token) >= 2 { // example.com v1.2.3 - line.Token[1] = v - } - } else { - if len(line.Token) >= 3 { // require example.com v1.2.3 - line.Token[2] = v - } - } - } -} - -// setIndirect sets line to have (or not have) a "// indirect" comment. -func (r *Require) setIndirect(indirect bool) { - r.Indirect = indirect - line := r.Syntax - if isIndirect(line) == indirect { - return - } - if indirect { - // Adding comment. - if len(line.Suffix) == 0 { - // New comment. - line.Suffix = []Comment{{Token: "// indirect", Suffix: true}} - return - } - - com := &line.Suffix[0] - text := strings.TrimSpace(strings.TrimPrefix(com.Token, string(slashSlash))) - if text == "" { - // Empty comment. - com.Token = "// indirect" - return - } - - // Insert at beginning of existing comment. - com.Token = "// indirect; " + text - return - } - - // Removing comment. - f := strings.TrimSpace(strings.TrimPrefix(line.Suffix[0].Token, string(slashSlash))) - if f == "indirect" { - // Remove whole comment. - line.Suffix = nil - return - } - - // Remove comment prefix. - com := &line.Suffix[0] - i := strings.Index(com.Token, "indirect;") - com.Token = "//" + com.Token[i+len("indirect;"):] -} - -// isIndirect reports whether line has a "// indirect" comment, -// meaning it is in go.mod only for its effect on indirect dependencies, -// so that it can be dropped entirely once the effective version of the -// indirect dependency reaches the given minimum version. -func isIndirect(line *Line) bool { - if len(line.Suffix) == 0 { - return false - } - f := strings.Fields(strings.TrimPrefix(line.Suffix[0].Token, string(slashSlash))) - return (len(f) == 1 && f[0] == "indirect" || len(f) > 1 && f[0] == "indirect;") -} - -func (f *File) AddModuleStmt(path string) error { - if f.Syntax == nil { - f.Syntax = new(FileSyntax) - } - if f.Module == nil { - f.Module = &Module{ - Mod: module.Version{Path: path}, - Syntax: f.Syntax.addLine(nil, "module", AutoQuote(path)), - } - } else { - f.Module.Mod.Path = path - f.Syntax.updateLine(f.Module.Syntax, "module", AutoQuote(path)) - } - return nil -} - -func (f *File) AddComment(text string) { - if f.Syntax == nil { - f.Syntax = new(FileSyntax) - } - f.Syntax.Stmt = append(f.Syntax.Stmt, &CommentBlock{ - Comments: Comments{ - Before: []Comment{ - { - Token: text, - }, - }, - }, - }) -} - -type VersionFixer func(path, version string) (string, error) - -// errDontFix is returned by a VersionFixer to indicate the version should be -// left alone, even if it's not canonical. -var dontFixRetract VersionFixer = func(_, vers string) (string, error) { - return vers, nil -} - -// Parse parses and returns a go.mod file. -// -// file is the name of the file, used in positions and errors. -// -// data is the content of the file. -// -// fix is an optional function that canonicalizes module versions. -// If fix is nil, all module versions must be canonical ([module.CanonicalVersion] -// must return the same string). -func Parse(file string, data []byte, fix VersionFixer) (*File, error) { - return parseToFile(file, data, fix, true) -} - -// ParseLax is like Parse but ignores unknown statements. -// It is used when parsing go.mod files other than the main module, -// under the theory that most statement types we add in the future will -// only apply in the main module, like exclude and replace, -// and so we get better gradual deployments if old go commands -// simply ignore those statements when found in go.mod files -// in dependencies. -func ParseLax(file string, data []byte, fix VersionFixer) (*File, error) { - return parseToFile(file, data, fix, false) -} - -func parseToFile(file string, data []byte, fix VersionFixer, strict bool) (parsed *File, err error) { - fs, err := parse(file, data) - if err != nil { - return nil, err - } - f := &File{ - Syntax: fs, - } - var errs ErrorList - - // fix versions in retract directives after the file is parsed. - // We need the module path to fix versions, and it might be at the end. - defer func() { - oldLen := len(errs) - f.fixRetract(fix, &errs) - if len(errs) > oldLen { - parsed, err = nil, errs - } - }() - - for _, x := range fs.Stmt { - switch x := x.(type) { - case *Line: - f.add(&errs, nil, x, x.Token[0], x.Token[1:], fix, strict) - - case *LineBlock: - if len(x.Token) > 1 { - if strict { - errs = append(errs, Error{ - Filename: file, - Pos: x.Start, - Err: fmt.Errorf("unknown block type: %s", strings.Join(x.Token, " ")), - }) - } - continue - } - switch x.Token[0] { - default: - if strict { - errs = append(errs, Error{ - Filename: file, - Pos: x.Start, - Err: fmt.Errorf("unknown block type: %s", strings.Join(x.Token, " ")), - }) - } - continue - case "module", "require", "exclude", "replace", "retract": - for _, l := range x.Line { - f.add(&errs, x, l, x.Token[0], l.Token, fix, strict) - } - } - } - } - - if len(errs) > 0 { - return nil, errs - } - return f, nil -} - -var GoVersionRE = lazyregexp.New(`^([1-9][0-9]*)\.(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))?([a-z]+[0-9]+)?$`) -var laxGoVersionRE = lazyregexp.New(`^v?(([1-9][0-9]*)\.(0|[1-9][0-9]*))([^0-9].*)$`) - -// Toolchains must be named beginning with `go1`, -// like "go1.20.3" or "go1.20.3-gccgo". As a special case, "default" is also permitted. -// TODO(samthanawalla): Replace regex with https://pkg.go.dev/go/version#IsValid in 1.23+ -var ToolchainRE = lazyregexp.New(`^default$|^go1($|\.)`) - -func (f *File) add(errs *ErrorList, block *LineBlock, line *Line, verb string, args []string, fix VersionFixer, strict bool) { - // If strict is false, this module is a dependency. - // We ignore all unknown directives as well as main-module-only - // directives like replace and exclude. It will work better for - // forward compatibility if we can depend on modules that have unknown - // statements (presumed relevant only when acting as the main module) - // and simply ignore those statements. - if !strict { - switch verb { - case "go", "module", "retract", "require": - // want these even for dependency go.mods - default: - return - } - } - - wrapModPathError := func(modPath string, err error) { - *errs = append(*errs, Error{ - Filename: f.Syntax.Name, - Pos: line.Start, - ModPath: modPath, - Verb: verb, - Err: err, - }) - } - wrapError := func(err error) { - *errs = append(*errs, Error{ - Filename: f.Syntax.Name, - Pos: line.Start, - Err: err, - }) - } - errorf := func(format string, args ...interface{}) { - wrapError(fmt.Errorf(format, args...)) - } - - switch verb { - default: - errorf("unknown directive: %s", verb) - - case "go": - if f.Go != nil { - errorf("repeated go statement") - return - } - if len(args) != 1 { - errorf("go directive expects exactly one argument") - return - } else if !GoVersionRE.MatchString(args[0]) { - fixed := false - if !strict { - if m := laxGoVersionRE.FindStringSubmatch(args[0]); m != nil { - args[0] = m[1] - fixed = true - } - } - if !fixed { - errorf("invalid go version '%s': must match format 1.23.0", args[0]) - return - } - } - - f.Go = &Go{Syntax: line} - f.Go.Version = args[0] - - case "toolchain": - if f.Toolchain != nil { - errorf("repeated toolchain statement") - return - } - if len(args) != 1 { - errorf("toolchain directive expects exactly one argument") - return - } else if strict && !ToolchainRE.MatchString(args[0]) { - errorf("invalid toolchain version '%s': must match format go1.23.0 or default", args[0]) - return - } - f.Toolchain = &Toolchain{Syntax: line} - f.Toolchain.Name = args[0] - - case "module": - if f.Module != nil { - errorf("repeated module statement") - return - } - deprecated := parseDeprecation(block, line) - f.Module = &Module{ - Syntax: line, - Deprecated: deprecated, - } - if len(args) != 1 { - errorf("usage: module module/path") - return - } - s, err := parseString(&args[0]) - if err != nil { - errorf("invalid quoted string: %v", err) - return - } - f.Module.Mod = module.Version{Path: s} - - case "require", "exclude": - if len(args) != 2 { - errorf("usage: %s module/path v1.2.3", verb) - return - } - s, err := parseString(&args[0]) - if err != nil { - errorf("invalid quoted string: %v", err) - return - } - v, err := parseVersion(verb, s, &args[1], fix) - if err != nil { - wrapError(err) - return - } - pathMajor, err := modulePathMajor(s) - if err != nil { - wrapError(err) - return - } - if err := module.CheckPathMajor(v, pathMajor); err != nil { - wrapModPathError(s, err) - return - } - if verb == "require" { - f.Require = append(f.Require, &Require{ - Mod: module.Version{Path: s, Version: v}, - Syntax: line, - Indirect: isIndirect(line), - }) - } else { - f.Exclude = append(f.Exclude, &Exclude{ - Mod: module.Version{Path: s, Version: v}, - Syntax: line, - }) - } - - case "replace": - replace, wrappederr := parseReplace(f.Syntax.Name, line, verb, args, fix) - if wrappederr != nil { - *errs = append(*errs, *wrappederr) - return - } - f.Replace = append(f.Replace, replace) - - case "retract": - rationale := parseDirectiveComment(block, line) - vi, err := parseVersionInterval(verb, "", &args, dontFixRetract) - if err != nil { - if strict { - wrapError(err) - return - } else { - // Only report errors parsing intervals in the main module. We may - // support additional syntax in the future, such as open and half-open - // intervals. Those can't be supported now, because they break the - // go.mod parser, even in lax mode. - return - } - } - if len(args) > 0 && strict { - // In the future, there may be additional information after the version. - errorf("unexpected token after version: %q", args[0]) - return - } - retract := &Retract{ - VersionInterval: vi, - Rationale: rationale, - Syntax: line, - } - f.Retract = append(f.Retract, retract) - } -} - -func parseReplace(filename string, line *Line, verb string, args []string, fix VersionFixer) (*Replace, *Error) { - wrapModPathError := func(modPath string, err error) *Error { - return &Error{ - Filename: filename, - Pos: line.Start, - ModPath: modPath, - Verb: verb, - Err: err, - } - } - wrapError := func(err error) *Error { - return &Error{ - Filename: filename, - Pos: line.Start, - Err: err, - } - } - errorf := func(format string, args ...interface{}) *Error { - return wrapError(fmt.Errorf(format, args...)) - } - - arrow := 2 - if len(args) >= 2 && args[1] == "=>" { - arrow = 1 - } - if len(args) < arrow+2 || len(args) > arrow+3 || args[arrow] != "=>" { - return nil, errorf("usage: %s module/path [v1.2.3] => other/module v1.4\n\t or %s module/path [v1.2.3] => ../local/directory", verb, verb) - } - s, err := parseString(&args[0]) - if err != nil { - return nil, errorf("invalid quoted string: %v", err) - } - pathMajor, err := modulePathMajor(s) - if err != nil { - return nil, wrapModPathError(s, err) - - } - var v string - if arrow == 2 { - v, err = parseVersion(verb, s, &args[1], fix) - if err != nil { - return nil, wrapError(err) - } - if err := module.CheckPathMajor(v, pathMajor); err != nil { - return nil, wrapModPathError(s, err) - } - } - ns, err := parseString(&args[arrow+1]) - if err != nil { - return nil, errorf("invalid quoted string: %v", err) - } - nv := "" - if len(args) == arrow+2 { - if !IsDirectoryPath(ns) { - if strings.Contains(ns, "@") { - return nil, errorf("replacement module must match format 'path version', not 'path@version'") - } - return nil, errorf("replacement module without version must be directory path (rooted or starting with . or ..)") - } - if filepath.Separator == '/' && strings.Contains(ns, `\`) { - return nil, errorf("replacement directory appears to be Windows path (on a non-windows system)") - } - } - if len(args) == arrow+3 { - nv, err = parseVersion(verb, ns, &args[arrow+2], fix) - if err != nil { - return nil, wrapError(err) - } - if IsDirectoryPath(ns) { - return nil, errorf("replacement module directory path %q cannot have version", ns) - } - } - return &Replace{ - Old: module.Version{Path: s, Version: v}, - New: module.Version{Path: ns, Version: nv}, - Syntax: line, - }, nil -} - -// fixRetract applies fix to each retract directive in f, appending any errors -// to errs. -// -// Most versions are fixed as we parse the file, but for retract directives, -// the relevant module path is the one specified with the module directive, -// and that might appear at the end of the file (or not at all). -func (f *File) fixRetract(fix VersionFixer, errs *ErrorList) { - if fix == nil { - return - } - path := "" - if f.Module != nil { - path = f.Module.Mod.Path - } - var r *Retract - wrapError := func(err error) { - *errs = append(*errs, Error{ - Filename: f.Syntax.Name, - Pos: r.Syntax.Start, - Err: err, - }) - } - - for _, r = range f.Retract { - if path == "" { - wrapError(errors.New("no module directive found, so retract cannot be used")) - return // only print the first one of these - } - - args := r.Syntax.Token - if args[0] == "retract" { - args = args[1:] - } - vi, err := parseVersionInterval("retract", path, &args, fix) - if err != nil { - wrapError(err) - } - r.VersionInterval = vi - } -} - -func (f *WorkFile) add(errs *ErrorList, line *Line, verb string, args []string, fix VersionFixer) { - wrapError := func(err error) { - *errs = append(*errs, Error{ - Filename: f.Syntax.Name, - Pos: line.Start, - Err: err, - }) - } - errorf := func(format string, args ...interface{}) { - wrapError(fmt.Errorf(format, args...)) - } - - switch verb { - default: - errorf("unknown directive: %s", verb) - - case "go": - if f.Go != nil { - errorf("repeated go statement") - return - } - if len(args) != 1 { - errorf("go directive expects exactly one argument") - return - } else if !GoVersionRE.MatchString(args[0]) { - errorf("invalid go version '%s': must match format 1.23.0", args[0]) - return - } - - f.Go = &Go{Syntax: line} - f.Go.Version = args[0] - - case "toolchain": - if f.Toolchain != nil { - errorf("repeated toolchain statement") - return - } - if len(args) != 1 { - errorf("toolchain directive expects exactly one argument") - return - } else if !ToolchainRE.MatchString(args[0]) { - errorf("invalid toolchain version '%s': must match format go1.23.0 or default", args[0]) - return - } - - f.Toolchain = &Toolchain{Syntax: line} - f.Toolchain.Name = args[0] - - case "use": - if len(args) != 1 { - errorf("usage: %s local/dir", verb) - return - } - s, err := parseString(&args[0]) - if err != nil { - errorf("invalid quoted string: %v", err) - return - } - f.Use = append(f.Use, &Use{ - Path: s, - Syntax: line, - }) - - case "replace": - replace, wrappederr := parseReplace(f.Syntax.Name, line, verb, args, fix) - if wrappederr != nil { - *errs = append(*errs, *wrappederr) - return - } - f.Replace = append(f.Replace, replace) - } -} - -// IsDirectoryPath reports whether the given path should be interpreted as a directory path. -// Just like on the go command line, relative paths starting with a '.' or '..' path component -// and rooted paths are directory paths; the rest are module paths. -func IsDirectoryPath(ns string) bool { - // Because go.mod files can move from one system to another, - // we check all known path syntaxes, both Unix and Windows. - return ns == "." || strings.HasPrefix(ns, "./") || strings.HasPrefix(ns, `.\`) || - ns == ".." || strings.HasPrefix(ns, "../") || strings.HasPrefix(ns, `..\`) || - strings.HasPrefix(ns, "/") || strings.HasPrefix(ns, `\`) || - len(ns) >= 2 && ('A' <= ns[0] && ns[0] <= 'Z' || 'a' <= ns[0] && ns[0] <= 'z') && ns[1] == ':' -} - -// MustQuote reports whether s must be quoted in order to appear as -// a single token in a go.mod line. -func MustQuote(s string) bool { - for _, r := range s { - switch r { - case ' ', '"', '\'', '`': - return true - - case '(', ')', '[', ']', '{', '}', ',': - if len(s) > 1 { - return true - } - - default: - if !unicode.IsPrint(r) { - return true - } - } - } - return s == "" || strings.Contains(s, "//") || strings.Contains(s, "/*") -} - -// AutoQuote returns s or, if quoting is required for s to appear in a go.mod, -// the quotation of s. -func AutoQuote(s string) string { - if MustQuote(s) { - return strconv.Quote(s) - } - return s -} - -func parseVersionInterval(verb string, path string, args *[]string, fix VersionFixer) (VersionInterval, error) { - toks := *args - if len(toks) == 0 || toks[0] == "(" { - return VersionInterval{}, fmt.Errorf("expected '[' or version") - } - if toks[0] != "[" { - v, err := parseVersion(verb, path, &toks[0], fix) - if err != nil { - return VersionInterval{}, err - } - *args = toks[1:] - return VersionInterval{Low: v, High: v}, nil - } - toks = toks[1:] - - if len(toks) == 0 { - return VersionInterval{}, fmt.Errorf("expected version after '['") - } - low, err := parseVersion(verb, path, &toks[0], fix) - if err != nil { - return VersionInterval{}, err - } - toks = toks[1:] - - if len(toks) == 0 || toks[0] != "," { - return VersionInterval{}, fmt.Errorf("expected ',' after version") - } - toks = toks[1:] - - if len(toks) == 0 { - return VersionInterval{}, fmt.Errorf("expected version after ','") - } - high, err := parseVersion(verb, path, &toks[0], fix) - if err != nil { - return VersionInterval{}, err - } - toks = toks[1:] - - if len(toks) == 0 || toks[0] != "]" { - return VersionInterval{}, fmt.Errorf("expected ']' after version") - } - toks = toks[1:] - - *args = toks - return VersionInterval{Low: low, High: high}, nil -} - -func parseString(s *string) (string, error) { - t := *s - if strings.HasPrefix(t, `"`) { - var err error - if t, err = strconv.Unquote(t); err != nil { - return "", err - } - } else if strings.ContainsAny(t, "\"'`") { - // Other quotes are reserved both for possible future expansion - // and to avoid confusion. For example if someone types 'x' - // we want that to be a syntax error and not a literal x in literal quotation marks. - return "", fmt.Errorf("unquoted string cannot contain quote") - } - *s = AutoQuote(t) - return t, nil -} - -var deprecatedRE = lazyregexp.New(`(?s)(?:^|\n\n)Deprecated: *(.*?)(?:$|\n\n)`) - -// parseDeprecation extracts the text of comments on a "module" directive and -// extracts a deprecation message from that. -// -// A deprecation message is contained in a paragraph within a block of comments -// that starts with "Deprecated:" (case sensitive). The message runs until the -// end of the paragraph and does not include the "Deprecated:" prefix. If the -// comment block has multiple paragraphs that start with "Deprecated:", -// parseDeprecation returns the message from the first. -func parseDeprecation(block *LineBlock, line *Line) string { - text := parseDirectiveComment(block, line) - m := deprecatedRE.FindStringSubmatch(text) - if m == nil { - return "" - } - return m[1] -} - -// parseDirectiveComment extracts the text of comments on a directive. -// If the directive's line does not have comments and is part of a block that -// does have comments, the block's comments are used. -func parseDirectiveComment(block *LineBlock, line *Line) string { - comments := line.Comment() - if block != nil && len(comments.Before) == 0 && len(comments.Suffix) == 0 { - comments = block.Comment() - } - groups := [][]Comment{comments.Before, comments.Suffix} - var lines []string - for _, g := range groups { - for _, c := range g { - if !strings.HasPrefix(c.Token, "//") { - continue // blank line - } - lines = append(lines, strings.TrimSpace(strings.TrimPrefix(c.Token, "//"))) - } - } - return strings.Join(lines, "\n") -} - -type ErrorList []Error - -func (e ErrorList) Error() string { - errStrs := make([]string, len(e)) - for i, err := range e { - errStrs[i] = err.Error() - } - return strings.Join(errStrs, "\n") -} - -type Error struct { - Filename string - Pos Position - Verb string - ModPath string - Err error -} - -func (e *Error) Error() string { - var pos string - if e.Pos.LineRune > 1 { - // Don't print LineRune if it's 1 (beginning of line). - // It's always 1 except in scanner errors, which are rare. - pos = fmt.Sprintf("%s:%d:%d: ", e.Filename, e.Pos.Line, e.Pos.LineRune) - } else if e.Pos.Line > 0 { - pos = fmt.Sprintf("%s:%d: ", e.Filename, e.Pos.Line) - } else if e.Filename != "" { - pos = fmt.Sprintf("%s: ", e.Filename) - } - - var directive string - if e.ModPath != "" { - directive = fmt.Sprintf("%s %s: ", e.Verb, e.ModPath) - } else if e.Verb != "" { - directive = fmt.Sprintf("%s: ", e.Verb) - } - - return pos + directive + e.Err.Error() -} - -func (e *Error) Unwrap() error { return e.Err } - -func parseVersion(verb string, path string, s *string, fix VersionFixer) (string, error) { - t, err := parseString(s) - if err != nil { - return "", &Error{ - Verb: verb, - ModPath: path, - Err: &module.InvalidVersionError{ - Version: *s, - Err: err, - }, - } - } - if fix != nil { - fixed, err := fix(path, t) - if err != nil { - if err, ok := err.(*module.ModuleError); ok { - return "", &Error{ - Verb: verb, - ModPath: path, - Err: err.Err, - } - } - return "", err - } - t = fixed - } else { - cv := module.CanonicalVersion(t) - if cv == "" { - return "", &Error{ - Verb: verb, - ModPath: path, - Err: &module.InvalidVersionError{ - Version: t, - Err: errors.New("must be of the form v1.2.3"), - }, - } - } - t = cv - } - *s = t - return *s, nil -} - -func modulePathMajor(path string) (string, error) { - _, major, ok := module.SplitPathVersion(path) - if !ok { - return "", fmt.Errorf("invalid module path") - } - return major, nil -} - -func (f *File) Format() ([]byte, error) { - return Format(f.Syntax), nil -} - -// Cleanup cleans up the file f after any edit operations. -// To avoid quadratic behavior, modifications like [File.DropRequire] -// clear the entry but do not remove it from the slice. -// Cleanup cleans out all the cleared entries. -func (f *File) Cleanup() { - w := 0 - for _, r := range f.Require { - if r.Mod.Path != "" { - f.Require[w] = r - w++ - } - } - f.Require = f.Require[:w] - - w = 0 - for _, x := range f.Exclude { - if x.Mod.Path != "" { - f.Exclude[w] = x - w++ - } - } - f.Exclude = f.Exclude[:w] - - w = 0 - for _, r := range f.Replace { - if r.Old.Path != "" { - f.Replace[w] = r - w++ - } - } - f.Replace = f.Replace[:w] - - w = 0 - for _, r := range f.Retract { - if r.Low != "" || r.High != "" { - f.Retract[w] = r - w++ - } - } - f.Retract = f.Retract[:w] - - f.Syntax.Cleanup() -} - -func (f *File) AddGoStmt(version string) error { - if !GoVersionRE.MatchString(version) { - return fmt.Errorf("invalid language version %q", version) - } - if f.Go == nil { - var hint Expr - if f.Module != nil && f.Module.Syntax != nil { - hint = f.Module.Syntax - } else if f.Syntax == nil { - f.Syntax = new(FileSyntax) - } - f.Go = &Go{ - Version: version, - Syntax: f.Syntax.addLine(hint, "go", version), - } - } else { - f.Go.Version = version - f.Syntax.updateLine(f.Go.Syntax, "go", version) - } - return nil -} - -// DropGoStmt deletes the go statement from the file. -func (f *File) DropGoStmt() { - if f.Go != nil { - f.Go.Syntax.markRemoved() - f.Go = nil - } -} - -// DropToolchainStmt deletes the toolchain statement from the file. -func (f *File) DropToolchainStmt() { - if f.Toolchain != nil { - f.Toolchain.Syntax.markRemoved() - f.Toolchain = nil - } -} - -func (f *File) AddToolchainStmt(name string) error { - if !ToolchainRE.MatchString(name) { - return fmt.Errorf("invalid toolchain name %q", name) - } - if f.Toolchain == nil { - var hint Expr - if f.Go != nil && f.Go.Syntax != nil { - hint = f.Go.Syntax - } else if f.Module != nil && f.Module.Syntax != nil { - hint = f.Module.Syntax - } - f.Toolchain = &Toolchain{ - Name: name, - Syntax: f.Syntax.addLine(hint, "toolchain", name), - } - } else { - f.Toolchain.Name = name - f.Syntax.updateLine(f.Toolchain.Syntax, "toolchain", name) - } - return nil -} - -// AddRequire sets the first require line for path to version vers, -// preserving any existing comments for that line and removing all -// other lines for path. -// -// If no line currently exists for path, AddRequire adds a new line -// at the end of the last require block. -func (f *File) AddRequire(path, vers string) error { - need := true - for _, r := range f.Require { - if r.Mod.Path == path { - if need { - r.Mod.Version = vers - f.Syntax.updateLine(r.Syntax, "require", AutoQuote(path), vers) - need = false - } else { - r.Syntax.markRemoved() - *r = Require{} - } - } - } - - if need { - f.AddNewRequire(path, vers, false) - } - return nil -} - -// AddNewRequire adds a new require line for path at version vers at the end of -// the last require block, regardless of any existing require lines for path. -func (f *File) AddNewRequire(path, vers string, indirect bool) { - line := f.Syntax.addLine(nil, "require", AutoQuote(path), vers) - r := &Require{ - Mod: module.Version{Path: path, Version: vers}, - Syntax: line, - } - r.setIndirect(indirect) - f.Require = append(f.Require, r) -} - -// SetRequire updates the requirements of f to contain exactly req, preserving -// the existing block structure and line comment contents (except for 'indirect' -// markings) for the first requirement on each named module path. -// -// The Syntax field is ignored for the requirements in req. -// -// Any requirements not already present in the file are added to the block -// containing the last require line. -// -// The requirements in req must specify at most one distinct version for each -// module path. -// -// If any existing requirements may be removed, the caller should call -// [File.Cleanup] after all edits are complete. -func (f *File) SetRequire(req []*Require) { - type elem struct { - version string - indirect bool - } - need := make(map[string]elem) - for _, r := range req { - if prev, dup := need[r.Mod.Path]; dup && prev.version != r.Mod.Version { - panic(fmt.Errorf("SetRequire called with conflicting versions for path %s (%s and %s)", r.Mod.Path, prev.version, r.Mod.Version)) - } - need[r.Mod.Path] = elem{r.Mod.Version, r.Indirect} - } - - // Update or delete the existing Require entries to preserve - // only the first for each module path in req. - for _, r := range f.Require { - e, ok := need[r.Mod.Path] - if ok { - r.setVersion(e.version) - r.setIndirect(e.indirect) - } else { - r.markRemoved() - } - delete(need, r.Mod.Path) - } - - // Add new entries in the last block of the file for any paths that weren't - // already present. - // - // This step is nondeterministic, but the final result will be deterministic - // because we will sort the block. - for path, e := range need { - f.AddNewRequire(path, e.version, e.indirect) - } - - f.SortBlocks() -} - -// SetRequireSeparateIndirect updates the requirements of f to contain the given -// requirements. Comment contents (except for 'indirect' markings) are retained -// from the first existing requirement for each module path. Like SetRequire, -// SetRequireSeparateIndirect adds requirements for new paths in req, -// updates the version and "// indirect" comment on existing requirements, -// and deletes requirements on paths not in req. Existing duplicate requirements -// are deleted. -// -// As its name suggests, SetRequireSeparateIndirect puts direct and indirect -// requirements into two separate blocks, one containing only direct -// requirements, and the other containing only indirect requirements. -// SetRequireSeparateIndirect may move requirements between these two blocks -// when their indirect markings change. However, SetRequireSeparateIndirect -// won't move requirements from other blocks, especially blocks with comments. -// -// If the file initially has one uncommented block of requirements, -// SetRequireSeparateIndirect will split it into a direct-only and indirect-only -// block. This aids in the transition to separate blocks. -func (f *File) SetRequireSeparateIndirect(req []*Require) { - // hasComments returns whether a line or block has comments - // other than "indirect". - hasComments := func(c Comments) bool { - return len(c.Before) > 0 || len(c.After) > 0 || len(c.Suffix) > 1 || - (len(c.Suffix) == 1 && - strings.TrimSpace(strings.TrimPrefix(c.Suffix[0].Token, string(slashSlash))) != "indirect") - } - - // moveReq adds r to block. If r was in another block, moveReq deletes - // it from that block and transfers its comments. - moveReq := func(r *Require, block *LineBlock) { - var line *Line - if r.Syntax == nil { - line = &Line{Token: []string{AutoQuote(r.Mod.Path), r.Mod.Version}} - r.Syntax = line - if r.Indirect { - r.setIndirect(true) - } - } else { - line = new(Line) - *line = *r.Syntax - if !line.InBlock && len(line.Token) > 0 && line.Token[0] == "require" { - line.Token = line.Token[1:] - } - r.Syntax.Token = nil // Cleanup will delete the old line. - r.Syntax = line - } - line.InBlock = true - block.Line = append(block.Line, line) - } - - // Examine existing require lines and blocks. - var ( - // We may insert new requirements into the last uncommented - // direct-only and indirect-only blocks. We may also move requirements - // to the opposite block if their indirect markings change. - lastDirectIndex = -1 - lastIndirectIndex = -1 - - // If there are no direct-only or indirect-only blocks, a new block may - // be inserted after the last require line or block. - lastRequireIndex = -1 - - // If there's only one require line or block, and it's uncommented, - // we'll move its requirements to the direct-only or indirect-only blocks. - requireLineOrBlockCount = 0 - - // Track the block each requirement belongs to (if any) so we can - // move them later. - lineToBlock = make(map[*Line]*LineBlock) - ) - for i, stmt := range f.Syntax.Stmt { - switch stmt := stmt.(type) { - case *Line: - if len(stmt.Token) == 0 || stmt.Token[0] != "require" { - continue - } - lastRequireIndex = i - requireLineOrBlockCount++ - if !hasComments(stmt.Comments) { - if isIndirect(stmt) { - lastIndirectIndex = i - } else { - lastDirectIndex = i - } - } - - case *LineBlock: - if len(stmt.Token) == 0 || stmt.Token[0] != "require" { - continue - } - lastRequireIndex = i - requireLineOrBlockCount++ - allDirect := len(stmt.Line) > 0 && !hasComments(stmt.Comments) - allIndirect := len(stmt.Line) > 0 && !hasComments(stmt.Comments) - for _, line := range stmt.Line { - lineToBlock[line] = stmt - if hasComments(line.Comments) { - allDirect = false - allIndirect = false - } else if isIndirect(line) { - allDirect = false - } else { - allIndirect = false - } - } - if allDirect { - lastDirectIndex = i - } - if allIndirect { - lastIndirectIndex = i - } - } - } - - oneFlatUncommentedBlock := requireLineOrBlockCount == 1 && - !hasComments(*f.Syntax.Stmt[lastRequireIndex].Comment()) - - // Create direct and indirect blocks if needed. Convert lines into blocks - // if needed. If we end up with an empty block or a one-line block, - // Cleanup will delete it or convert it to a line later. - insertBlock := func(i int) *LineBlock { - block := &LineBlock{Token: []string{"require"}} - f.Syntax.Stmt = append(f.Syntax.Stmt, nil) - copy(f.Syntax.Stmt[i+1:], f.Syntax.Stmt[i:]) - f.Syntax.Stmt[i] = block - return block - } - - ensureBlock := func(i int) *LineBlock { - switch stmt := f.Syntax.Stmt[i].(type) { - case *LineBlock: - return stmt - case *Line: - block := &LineBlock{ - Token: []string{"require"}, - Line: []*Line{stmt}, - } - stmt.Token = stmt.Token[1:] // remove "require" - stmt.InBlock = true - f.Syntax.Stmt[i] = block - return block - default: - panic(fmt.Sprintf("unexpected statement: %v", stmt)) - } - } - - var lastDirectBlock *LineBlock - if lastDirectIndex < 0 { - if lastIndirectIndex >= 0 { - lastDirectIndex = lastIndirectIndex - lastIndirectIndex++ - } else if lastRequireIndex >= 0 { - lastDirectIndex = lastRequireIndex + 1 - } else { - lastDirectIndex = len(f.Syntax.Stmt) - } - lastDirectBlock = insertBlock(lastDirectIndex) - } else { - lastDirectBlock = ensureBlock(lastDirectIndex) - } - - var lastIndirectBlock *LineBlock - if lastIndirectIndex < 0 { - lastIndirectIndex = lastDirectIndex + 1 - lastIndirectBlock = insertBlock(lastIndirectIndex) - } else { - lastIndirectBlock = ensureBlock(lastIndirectIndex) - } - - // Delete requirements we don't want anymore. - // Update versions and indirect comments on requirements we want to keep. - // If a requirement is in last{Direct,Indirect}Block with the wrong - // indirect marking after this, or if the requirement is in an single - // uncommented mixed block (oneFlatUncommentedBlock), move it to the - // correct block. - // - // Some blocks may be empty after this. Cleanup will remove them. - need := make(map[string]*Require) - for _, r := range req { - need[r.Mod.Path] = r - } - have := make(map[string]*Require) - for _, r := range f.Require { - path := r.Mod.Path - if need[path] == nil || have[path] != nil { - // Requirement not needed, or duplicate requirement. Delete. - r.markRemoved() - continue - } - have[r.Mod.Path] = r - r.setVersion(need[path].Mod.Version) - r.setIndirect(need[path].Indirect) - if need[path].Indirect && - (oneFlatUncommentedBlock || lineToBlock[r.Syntax] == lastDirectBlock) { - moveReq(r, lastIndirectBlock) - } else if !need[path].Indirect && - (oneFlatUncommentedBlock || lineToBlock[r.Syntax] == lastIndirectBlock) { - moveReq(r, lastDirectBlock) - } - } - - // Add new requirements. - for path, r := range need { - if have[path] == nil { - if r.Indirect { - moveReq(r, lastIndirectBlock) - } else { - moveReq(r, lastDirectBlock) - } - f.Require = append(f.Require, r) - } - } - - f.SortBlocks() -} - -func (f *File) DropRequire(path string) error { - for _, r := range f.Require { - if r.Mod.Path == path { - r.Syntax.markRemoved() - *r = Require{} - } - } - return nil -} - -// AddExclude adds a exclude statement to the mod file. Errors if the provided -// version is not a canonical version string -func (f *File) AddExclude(path, vers string) error { - if err := checkCanonicalVersion(path, vers); err != nil { - return err - } - - var hint *Line - for _, x := range f.Exclude { - if x.Mod.Path == path && x.Mod.Version == vers { - return nil - } - if x.Mod.Path == path { - hint = x.Syntax - } - } - - f.Exclude = append(f.Exclude, &Exclude{Mod: module.Version{Path: path, Version: vers}, Syntax: f.Syntax.addLine(hint, "exclude", AutoQuote(path), vers)}) - return nil -} - -func (f *File) DropExclude(path, vers string) error { - for _, x := range f.Exclude { - if x.Mod.Path == path && x.Mod.Version == vers { - x.Syntax.markRemoved() - *x = Exclude{} - } - } - return nil -} - -func (f *File) AddReplace(oldPath, oldVers, newPath, newVers string) error { - return addReplace(f.Syntax, &f.Replace, oldPath, oldVers, newPath, newVers) -} - -func addReplace(syntax *FileSyntax, replace *[]*Replace, oldPath, oldVers, newPath, newVers string) error { - need := true - old := module.Version{Path: oldPath, Version: oldVers} - new := module.Version{Path: newPath, Version: newVers} - tokens := []string{"replace", AutoQuote(oldPath)} - if oldVers != "" { - tokens = append(tokens, oldVers) - } - tokens = append(tokens, "=>", AutoQuote(newPath)) - if newVers != "" { - tokens = append(tokens, newVers) - } - - var hint *Line - for _, r := range *replace { - if r.Old.Path == oldPath && (oldVers == "" || r.Old.Version == oldVers) { - if need { - // Found replacement for old; update to use new. - r.New = new - syntax.updateLine(r.Syntax, tokens...) - need = false - continue - } - // Already added; delete other replacements for same. - r.Syntax.markRemoved() - *r = Replace{} - } - if r.Old.Path == oldPath { - hint = r.Syntax - } - } - if need { - *replace = append(*replace, &Replace{Old: old, New: new, Syntax: syntax.addLine(hint, tokens...)}) - } - return nil -} - -func (f *File) DropReplace(oldPath, oldVers string) error { - for _, r := range f.Replace { - if r.Old.Path == oldPath && r.Old.Version == oldVers { - r.Syntax.markRemoved() - *r = Replace{} - } - } - return nil -} - -// AddRetract adds a retract statement to the mod file. Errors if the provided -// version interval does not consist of canonical version strings -func (f *File) AddRetract(vi VersionInterval, rationale string) error { - var path string - if f.Module != nil { - path = f.Module.Mod.Path - } - if err := checkCanonicalVersion(path, vi.High); err != nil { - return err - } - if err := checkCanonicalVersion(path, vi.Low); err != nil { - return err - } - - r := &Retract{ - VersionInterval: vi, - } - if vi.Low == vi.High { - r.Syntax = f.Syntax.addLine(nil, "retract", AutoQuote(vi.Low)) - } else { - r.Syntax = f.Syntax.addLine(nil, "retract", "[", AutoQuote(vi.Low), ",", AutoQuote(vi.High), "]") - } - if rationale != "" { - for _, line := range strings.Split(rationale, "\n") { - com := Comment{Token: "// " + line} - r.Syntax.Comment().Before = append(r.Syntax.Comment().Before, com) - } - } - return nil -} - -func (f *File) DropRetract(vi VersionInterval) error { - for _, r := range f.Retract { - if r.VersionInterval == vi { - r.Syntax.markRemoved() - *r = Retract{} - } - } - return nil -} - -func (f *File) SortBlocks() { - f.removeDups() // otherwise sorting is unsafe - - // semanticSortForExcludeVersionV is the Go version (plus leading "v") at which - // lines in exclude blocks start to use semantic sort instead of lexicographic sort. - // See go.dev/issue/60028. - const semanticSortForExcludeVersionV = "v1.21" - useSemanticSortForExclude := f.Go != nil && semver.Compare("v"+f.Go.Version, semanticSortForExcludeVersionV) >= 0 - - for _, stmt := range f.Syntax.Stmt { - block, ok := stmt.(*LineBlock) - if !ok { - continue - } - less := lineLess - if block.Token[0] == "exclude" && useSemanticSortForExclude { - less = lineExcludeLess - } else if block.Token[0] == "retract" { - less = lineRetractLess - } - sort.SliceStable(block.Line, func(i, j int) bool { - return less(block.Line[i], block.Line[j]) - }) - } -} - -// removeDups removes duplicate exclude and replace directives. -// -// Earlier exclude directives take priority. -// -// Later replace directives take priority. -// -// require directives are not de-duplicated. That's left up to higher-level -// logic (MVS). -// -// retract directives are not de-duplicated since comments are -// meaningful, and versions may be retracted multiple times. -func (f *File) removeDups() { - removeDups(f.Syntax, &f.Exclude, &f.Replace) -} - -func removeDups(syntax *FileSyntax, exclude *[]*Exclude, replace *[]*Replace) { - kill := make(map[*Line]bool) - - // Remove duplicate excludes. - if exclude != nil { - haveExclude := make(map[module.Version]bool) - for _, x := range *exclude { - if haveExclude[x.Mod] { - kill[x.Syntax] = true - continue - } - haveExclude[x.Mod] = true - } - var excl []*Exclude - for _, x := range *exclude { - if !kill[x.Syntax] { - excl = append(excl, x) - } - } - *exclude = excl - } - - // Remove duplicate replacements. - // Later replacements take priority over earlier ones. - haveReplace := make(map[module.Version]bool) - for i := len(*replace) - 1; i >= 0; i-- { - x := (*replace)[i] - if haveReplace[x.Old] { - kill[x.Syntax] = true - continue - } - haveReplace[x.Old] = true - } - var repl []*Replace - for _, x := range *replace { - if !kill[x.Syntax] { - repl = append(repl, x) - } - } - *replace = repl - - // Duplicate require and retract directives are not removed. - - // Drop killed statements from the syntax tree. - var stmts []Expr - for _, stmt := range syntax.Stmt { - switch stmt := stmt.(type) { - case *Line: - if kill[stmt] { - continue - } - case *LineBlock: - var lines []*Line - for _, line := range stmt.Line { - if !kill[line] { - lines = append(lines, line) - } - } - stmt.Line = lines - if len(lines) == 0 { - continue - } - } - stmts = append(stmts, stmt) - } - syntax.Stmt = stmts -} - -// lineLess returns whether li should be sorted before lj. It sorts -// lexicographically without assigning any special meaning to tokens. -func lineLess(li, lj *Line) bool { - for k := 0; k < len(li.Token) && k < len(lj.Token); k++ { - if li.Token[k] != lj.Token[k] { - return li.Token[k] < lj.Token[k] - } - } - return len(li.Token) < len(lj.Token) -} - -// lineExcludeLess reports whether li should be sorted before lj for lines in -// an "exclude" block. -func lineExcludeLess(li, lj *Line) bool { - if len(li.Token) != 2 || len(lj.Token) != 2 { - // Not a known exclude specification. - // Fall back to sorting lexicographically. - return lineLess(li, lj) - } - // An exclude specification has two tokens: ModulePath and Version. - // Compare module path by string order and version by semver rules. - if pi, pj := li.Token[0], lj.Token[0]; pi != pj { - return pi < pj - } - return semver.Compare(li.Token[1], lj.Token[1]) < 0 -} - -// lineRetractLess returns whether li should be sorted before lj for lines in -// a "retract" block. It treats each line as a version interval. Single versions -// are compared as if they were intervals with the same low and high version. -// Intervals are sorted in descending order, first by low version, then by -// high version, using semver.Compare. -func lineRetractLess(li, lj *Line) bool { - interval := func(l *Line) VersionInterval { - if len(l.Token) == 1 { - return VersionInterval{Low: l.Token[0], High: l.Token[0]} - } else if len(l.Token) == 5 && l.Token[0] == "[" && l.Token[2] == "," && l.Token[4] == "]" { - return VersionInterval{Low: l.Token[1], High: l.Token[3]} - } else { - // Line in unknown format. Treat as an invalid version. - return VersionInterval{} - } - } - vii := interval(li) - vij := interval(lj) - if cmp := semver.Compare(vii.Low, vij.Low); cmp != 0 { - return cmp > 0 - } - return semver.Compare(vii.High, vij.High) > 0 -} - -// checkCanonicalVersion returns a non-nil error if vers is not a canonical -// version string or does not match the major version of path. -// -// If path is non-empty, the error text suggests a format with a major version -// corresponding to the path. -func checkCanonicalVersion(path, vers string) error { - _, pathMajor, pathMajorOk := module.SplitPathVersion(path) - - if vers == "" || vers != module.CanonicalVersion(vers) { - if pathMajor == "" { - return &module.InvalidVersionError{ - Version: vers, - Err: fmt.Errorf("must be of the form v1.2.3"), - } - } - return &module.InvalidVersionError{ - Version: vers, - Err: fmt.Errorf("must be of the form %s.2.3", module.PathMajorPrefix(pathMajor)), - } - } - - if pathMajorOk { - if err := module.CheckPathMajor(vers, pathMajor); err != nil { - if pathMajor == "" { - // In this context, the user probably wrote "v2.3.4" when they meant - // "v2.3.4+incompatible". Suggest that instead of "v0 or v1". - return &module.InvalidVersionError{ - Version: vers, - Err: fmt.Errorf("should be %s+incompatible (or module %s/%v)", vers, path, semver.Major(vers)), - } - } - return err - } - } - - return nil -} diff --git a/vendor/golang.org/x/mod/modfile/work.go b/vendor/golang.org/x/mod/modfile/work.go deleted file mode 100644 index d7b99376ebe..00000000000 --- a/vendor/golang.org/x/mod/modfile/work.go +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package modfile - -import ( - "fmt" - "sort" - "strings" -) - -// A WorkFile is the parsed, interpreted form of a go.work file. -type WorkFile struct { - Go *Go - Toolchain *Toolchain - Use []*Use - Replace []*Replace - - Syntax *FileSyntax -} - -// A Use is a single directory statement. -type Use struct { - Path string // Use path of module. - ModulePath string // Module path in the comment. - Syntax *Line -} - -// ParseWork parses and returns a go.work file. -// -// file is the name of the file, used in positions and errors. -// -// data is the content of the file. -// -// fix is an optional function that canonicalizes module versions. -// If fix is nil, all module versions must be canonical ([module.CanonicalVersion] -// must return the same string). -func ParseWork(file string, data []byte, fix VersionFixer) (*WorkFile, error) { - fs, err := parse(file, data) - if err != nil { - return nil, err - } - f := &WorkFile{ - Syntax: fs, - } - var errs ErrorList - - for _, x := range fs.Stmt { - switch x := x.(type) { - case *Line: - f.add(&errs, x, x.Token[0], x.Token[1:], fix) - - case *LineBlock: - if len(x.Token) > 1 { - errs = append(errs, Error{ - Filename: file, - Pos: x.Start, - Err: fmt.Errorf("unknown block type: %s", strings.Join(x.Token, " ")), - }) - continue - } - switch x.Token[0] { - default: - errs = append(errs, Error{ - Filename: file, - Pos: x.Start, - Err: fmt.Errorf("unknown block type: %s", strings.Join(x.Token, " ")), - }) - continue - case "use", "replace": - for _, l := range x.Line { - f.add(&errs, l, x.Token[0], l.Token, fix) - } - } - } - } - - if len(errs) > 0 { - return nil, errs - } - return f, nil -} - -// Cleanup cleans up the file f after any edit operations. -// To avoid quadratic behavior, modifications like [WorkFile.DropRequire] -// clear the entry but do not remove it from the slice. -// Cleanup cleans out all the cleared entries. -func (f *WorkFile) Cleanup() { - w := 0 - for _, r := range f.Use { - if r.Path != "" { - f.Use[w] = r - w++ - } - } - f.Use = f.Use[:w] - - w = 0 - for _, r := range f.Replace { - if r.Old.Path != "" { - f.Replace[w] = r - w++ - } - } - f.Replace = f.Replace[:w] - - f.Syntax.Cleanup() -} - -func (f *WorkFile) AddGoStmt(version string) error { - if !GoVersionRE.MatchString(version) { - return fmt.Errorf("invalid language version %q", version) - } - if f.Go == nil { - stmt := &Line{Token: []string{"go", version}} - f.Go = &Go{ - Version: version, - Syntax: stmt, - } - // Find the first non-comment-only block and add - // the go statement before it. That will keep file comments at the top. - i := 0 - for i = 0; i < len(f.Syntax.Stmt); i++ { - if _, ok := f.Syntax.Stmt[i].(*CommentBlock); !ok { - break - } - } - f.Syntax.Stmt = append(append(f.Syntax.Stmt[:i:i], stmt), f.Syntax.Stmt[i:]...) - } else { - f.Go.Version = version - f.Syntax.updateLine(f.Go.Syntax, "go", version) - } - return nil -} - -func (f *WorkFile) AddToolchainStmt(name string) error { - if !ToolchainRE.MatchString(name) { - return fmt.Errorf("invalid toolchain name %q", name) - } - if f.Toolchain == nil { - stmt := &Line{Token: []string{"toolchain", name}} - f.Toolchain = &Toolchain{ - Name: name, - Syntax: stmt, - } - // Find the go line and add the toolchain line after it. - // Or else find the first non-comment-only block and add - // the toolchain line before it. That will keep file comments at the top. - i := 0 - for i = 0; i < len(f.Syntax.Stmt); i++ { - if line, ok := f.Syntax.Stmt[i].(*Line); ok && len(line.Token) > 0 && line.Token[0] == "go" { - i++ - goto Found - } - } - for i = 0; i < len(f.Syntax.Stmt); i++ { - if _, ok := f.Syntax.Stmt[i].(*CommentBlock); !ok { - break - } - } - Found: - f.Syntax.Stmt = append(append(f.Syntax.Stmt[:i:i], stmt), f.Syntax.Stmt[i:]...) - } else { - f.Toolchain.Name = name - f.Syntax.updateLine(f.Toolchain.Syntax, "toolchain", name) - } - return nil -} - -// DropGoStmt deletes the go statement from the file. -func (f *WorkFile) DropGoStmt() { - if f.Go != nil { - f.Go.Syntax.markRemoved() - f.Go = nil - } -} - -// DropToolchainStmt deletes the toolchain statement from the file. -func (f *WorkFile) DropToolchainStmt() { - if f.Toolchain != nil { - f.Toolchain.Syntax.markRemoved() - f.Toolchain = nil - } -} - -func (f *WorkFile) AddUse(diskPath, modulePath string) error { - need := true - for _, d := range f.Use { - if d.Path == diskPath { - if need { - d.ModulePath = modulePath - f.Syntax.updateLine(d.Syntax, "use", AutoQuote(diskPath)) - need = false - } else { - d.Syntax.markRemoved() - *d = Use{} - } - } - } - - if need { - f.AddNewUse(diskPath, modulePath) - } - return nil -} - -func (f *WorkFile) AddNewUse(diskPath, modulePath string) { - line := f.Syntax.addLine(nil, "use", AutoQuote(diskPath)) - f.Use = append(f.Use, &Use{Path: diskPath, ModulePath: modulePath, Syntax: line}) -} - -func (f *WorkFile) SetUse(dirs []*Use) { - need := make(map[string]string) - for _, d := range dirs { - need[d.Path] = d.ModulePath - } - - for _, d := range f.Use { - if modulePath, ok := need[d.Path]; ok { - d.ModulePath = modulePath - } else { - d.Syntax.markRemoved() - *d = Use{} - } - } - - // TODO(#45713): Add module path to comment. - - for diskPath, modulePath := range need { - f.AddNewUse(diskPath, modulePath) - } - f.SortBlocks() -} - -func (f *WorkFile) DropUse(path string) error { - for _, d := range f.Use { - if d.Path == path { - d.Syntax.markRemoved() - *d = Use{} - } - } - return nil -} - -func (f *WorkFile) AddReplace(oldPath, oldVers, newPath, newVers string) error { - return addReplace(f.Syntax, &f.Replace, oldPath, oldVers, newPath, newVers) -} - -func (f *WorkFile) DropReplace(oldPath, oldVers string) error { - for _, r := range f.Replace { - if r.Old.Path == oldPath && r.Old.Version == oldVers { - r.Syntax.markRemoved() - *r = Replace{} - } - } - return nil -} - -func (f *WorkFile) SortBlocks() { - f.removeDups() // otherwise sorting is unsafe - - for _, stmt := range f.Syntax.Stmt { - block, ok := stmt.(*LineBlock) - if !ok { - continue - } - sort.SliceStable(block.Line, func(i, j int) bool { - return lineLess(block.Line[i], block.Line[j]) - }) - } -} - -// removeDups removes duplicate replace directives. -// -// Later replace directives take priority. -// -// require directives are not de-duplicated. That's left up to higher-level -// logic (MVS). -// -// retract directives are not de-duplicated since comments are -// meaningful, and versions may be retracted multiple times. -func (f *WorkFile) removeDups() { - removeDups(f.Syntax, nil, &f.Replace) -} diff --git a/vendor/golang.org/x/mod/module/module.go b/vendor/golang.org/x/mod/module/module.go deleted file mode 100644 index 2a364b229b9..00000000000 --- a/vendor/golang.org/x/mod/module/module.go +++ /dev/null @@ -1,841 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package module defines the module.Version type along with support code. -// -// The [module.Version] type is a simple Path, Version pair: -// -// type Version struct { -// Path string -// Version string -// } -// -// There are no restrictions imposed directly by use of this structure, -// but additional checking functions, most notably [Check], verify that -// a particular path, version pair is valid. -// -// # Escaped Paths -// -// Module paths appear as substrings of file system paths -// (in the download cache) and of web server URLs in the proxy protocol. -// In general we cannot rely on file systems to be case-sensitive, -// nor can we rely on web servers, since they read from file systems. -// That is, we cannot rely on the file system to keep rsc.io/QUOTE -// and rsc.io/quote separate. Windows and macOS don't. -// Instead, we must never require two different casings of a file path. -// Because we want the download cache to match the proxy protocol, -// and because we want the proxy protocol to be possible to serve -// from a tree of static files (which might be stored on a case-insensitive -// file system), the proxy protocol must never require two different casings -// of a URL path either. -// -// One possibility would be to make the escaped form be the lowercase -// hexadecimal encoding of the actual path bytes. This would avoid ever -// needing different casings of a file path, but it would be fairly illegible -// to most programmers when those paths appeared in the file system -// (including in file paths in compiler errors and stack traces) -// in web server logs, and so on. Instead, we want a safe escaped form that -// leaves most paths unaltered. -// -// The safe escaped form is to replace every uppercase letter -// with an exclamation mark followed by the letter's lowercase equivalent. -// -// For example, -// -// github.com/Azure/azure-sdk-for-go -> github.com/!azure/azure-sdk-for-go. -// github.com/GoogleCloudPlatform/cloudsql-proxy -> github.com/!google!cloud!platform/cloudsql-proxy -// github.com/Sirupsen/logrus -> github.com/!sirupsen/logrus. -// -// Import paths that avoid upper-case letters are left unchanged. -// Note that because import paths are ASCII-only and avoid various -// problematic punctuation (like : < and >), the escaped form is also ASCII-only -// and avoids the same problematic punctuation. -// -// Import paths have never allowed exclamation marks, so there is no -// need to define how to escape a literal !. -// -// # Unicode Restrictions -// -// Today, paths are disallowed from using Unicode. -// -// Although paths are currently disallowed from using Unicode, -// we would like at some point to allow Unicode letters as well, to assume that -// file systems and URLs are Unicode-safe (storing UTF-8), and apply -// the !-for-uppercase convention for escaping them in the file system. -// But there are at least two subtle considerations. -// -// First, note that not all case-fold equivalent distinct runes -// form an upper/lower pair. -// For example, U+004B ('K'), U+006B ('k'), and U+212A ('K' for Kelvin) -// are three distinct runes that case-fold to each other. -// When we do add Unicode letters, we must not assume that upper/lower -// are the only case-equivalent pairs. -// Perhaps the Kelvin symbol would be disallowed entirely, for example. -// Or perhaps it would escape as "!!k", or perhaps as "(212A)". -// -// Second, it would be nice to allow Unicode marks as well as letters, -// but marks include combining marks, and then we must deal not -// only with case folding but also normalization: both U+00E9 ('é') -// and U+0065 U+0301 ('e' followed by combining acute accent) -// look the same on the page and are treated by some file systems -// as the same path. If we do allow Unicode marks in paths, there -// must be some kind of normalization to allow only one canonical -// encoding of any character used in an import path. -package module - -// IMPORTANT NOTE -// -// This file essentially defines the set of valid import paths for the go command. -// There are many subtle considerations, including Unicode ambiguity, -// security, network, and file system representations. -// -// This file also defines the set of valid module path and version combinations, -// another topic with many subtle considerations. -// -// Changes to the semantics in this file require approval from rsc. - -import ( - "errors" - "fmt" - "path" - "sort" - "strings" - "unicode" - "unicode/utf8" - - "golang.org/x/mod/semver" -) - -// A Version (for clients, a module.Version) is defined by a module path and version pair. -// These are stored in their plain (unescaped) form. -type Version struct { - // Path is a module path, like "golang.org/x/text" or "rsc.io/quote/v2". - Path string - - // Version is usually a semantic version in canonical form. - // There are three exceptions to this general rule. - // First, the top-level target of a build has no specific version - // and uses Version = "". - // Second, during MVS calculations the version "none" is used - // to represent the decision to take no version of a given module. - // Third, filesystem paths found in "replace" directives are - // represented by a path with an empty version. - Version string `json:",omitempty"` -} - -// String returns a representation of the Version suitable for logging -// (Path@Version, or just Path if Version is empty). -func (m Version) String() string { - if m.Version == "" { - return m.Path - } - return m.Path + "@" + m.Version -} - -// A ModuleError indicates an error specific to a module. -type ModuleError struct { - Path string - Version string - Err error -} - -// VersionError returns a [ModuleError] derived from a [Version] and error, -// or err itself if it is already such an error. -func VersionError(v Version, err error) error { - var mErr *ModuleError - if errors.As(err, &mErr) && mErr.Path == v.Path && mErr.Version == v.Version { - return err - } - return &ModuleError{ - Path: v.Path, - Version: v.Version, - Err: err, - } -} - -func (e *ModuleError) Error() string { - if v, ok := e.Err.(*InvalidVersionError); ok { - return fmt.Sprintf("%s@%s: invalid %s: %v", e.Path, v.Version, v.noun(), v.Err) - } - if e.Version != "" { - return fmt.Sprintf("%s@%s: %v", e.Path, e.Version, e.Err) - } - return fmt.Sprintf("module %s: %v", e.Path, e.Err) -} - -func (e *ModuleError) Unwrap() error { return e.Err } - -// An InvalidVersionError indicates an error specific to a version, with the -// module path unknown or specified externally. -// -// A [ModuleError] may wrap an InvalidVersionError, but an InvalidVersionError -// must not wrap a ModuleError. -type InvalidVersionError struct { - Version string - Pseudo bool - Err error -} - -// noun returns either "version" or "pseudo-version", depending on whether -// e.Version is a pseudo-version. -func (e *InvalidVersionError) noun() string { - if e.Pseudo { - return "pseudo-version" - } - return "version" -} - -func (e *InvalidVersionError) Error() string { - return fmt.Sprintf("%s %q invalid: %s", e.noun(), e.Version, e.Err) -} - -func (e *InvalidVersionError) Unwrap() error { return e.Err } - -// An InvalidPathError indicates a module, import, or file path doesn't -// satisfy all naming constraints. See [CheckPath], [CheckImportPath], -// and [CheckFilePath] for specific restrictions. -type InvalidPathError struct { - Kind string // "module", "import", or "file" - Path string - Err error -} - -func (e *InvalidPathError) Error() string { - return fmt.Sprintf("malformed %s path %q: %v", e.Kind, e.Path, e.Err) -} - -func (e *InvalidPathError) Unwrap() error { return e.Err } - -// Check checks that a given module path, version pair is valid. -// In addition to the path being a valid module path -// and the version being a valid semantic version, -// the two must correspond. -// For example, the path "yaml/v2" only corresponds to -// semantic versions beginning with "v2.". -func Check(path, version string) error { - if err := CheckPath(path); err != nil { - return err - } - if !semver.IsValid(version) { - return &ModuleError{ - Path: path, - Err: &InvalidVersionError{Version: version, Err: errors.New("not a semantic version")}, - } - } - _, pathMajor, _ := SplitPathVersion(path) - if err := CheckPathMajor(version, pathMajor); err != nil { - return &ModuleError{Path: path, Err: err} - } - return nil -} - -// firstPathOK reports whether r can appear in the first element of a module path. -// The first element of the path must be an LDH domain name, at least for now. -// To avoid case ambiguity, the domain name must be entirely lower case. -func firstPathOK(r rune) bool { - return r == '-' || r == '.' || - '0' <= r && r <= '9' || - 'a' <= r && r <= 'z' -} - -// modPathOK reports whether r can appear in a module path element. -// Paths can be ASCII letters, ASCII digits, and limited ASCII punctuation: - . _ and ~. -// -// This matches what "go get" has historically recognized in import paths, -// and avoids confusing sequences like '%20' or '+' that would change meaning -// if used in a URL. -// -// TODO(rsc): We would like to allow Unicode letters, but that requires additional -// care in the safe encoding (see "escaped paths" above). -func modPathOK(r rune) bool { - if r < utf8.RuneSelf { - return r == '-' || r == '.' || r == '_' || r == '~' || - '0' <= r && r <= '9' || - 'A' <= r && r <= 'Z' || - 'a' <= r && r <= 'z' - } - return false -} - -// importPathOK reports whether r can appear in a package import path element. -// -// Import paths are intermediate between module paths and file paths: we allow -// disallow characters that would be confusing or ambiguous as arguments to -// 'go get' (such as '@' and ' ' ), but allow certain characters that are -// otherwise-unambiguous on the command line and historically used for some -// binary names (such as '++' as a suffix for compiler binaries and wrappers). -func importPathOK(r rune) bool { - return modPathOK(r) || r == '+' -} - -// fileNameOK reports whether r can appear in a file name. -// For now we allow all Unicode letters but otherwise limit to pathOK plus a few more punctuation characters. -// If we expand the set of allowed characters here, we have to -// work harder at detecting potential case-folding and normalization collisions. -// See note about "escaped paths" above. -func fileNameOK(r rune) bool { - if r < utf8.RuneSelf { - // Entire set of ASCII punctuation, from which we remove characters: - // ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ - // We disallow some shell special characters: " ' * < > ? ` | - // (Note that some of those are disallowed by the Windows file system as well.) - // We also disallow path separators / : and \ (fileNameOK is only called on path element characters). - // We allow spaces (U+0020) in file names. - const allowed = "!#$%&()+,-.=@[]^_{}~ " - if '0' <= r && r <= '9' || 'A' <= r && r <= 'Z' || 'a' <= r && r <= 'z' { - return true - } - return strings.ContainsRune(allowed, r) - } - // It may be OK to add more ASCII punctuation here, but only carefully. - // For example Windows disallows < > \, and macOS disallows :, so we must not allow those. - return unicode.IsLetter(r) -} - -// CheckPath checks that a module path is valid. -// A valid module path is a valid import path, as checked by [CheckImportPath], -// with three additional constraints. -// First, the leading path element (up to the first slash, if any), -// by convention a domain name, must contain only lower-case ASCII letters, -// ASCII digits, dots (U+002E), and dashes (U+002D); -// it must contain at least one dot and cannot start with a dash. -// Second, for a final path element of the form /vN, where N looks numeric -// (ASCII digits and dots) must not begin with a leading zero, must not be /v1, -// and must not contain any dots. For paths beginning with "gopkg.in/", -// this second requirement is replaced by a requirement that the path -// follow the gopkg.in server's conventions. -// Third, no path element may begin with a dot. -func CheckPath(path string) (err error) { - defer func() { - if err != nil { - err = &InvalidPathError{Kind: "module", Path: path, Err: err} - } - }() - - if err := checkPath(path, modulePath); err != nil { - return err - } - i := strings.Index(path, "/") - if i < 0 { - i = len(path) - } - if i == 0 { - return fmt.Errorf("leading slash") - } - if !strings.Contains(path[:i], ".") { - return fmt.Errorf("missing dot in first path element") - } - if path[0] == '-' { - return fmt.Errorf("leading dash in first path element") - } - for _, r := range path[:i] { - if !firstPathOK(r) { - return fmt.Errorf("invalid char %q in first path element", r) - } - } - if _, _, ok := SplitPathVersion(path); !ok { - return fmt.Errorf("invalid version") - } - return nil -} - -// CheckImportPath checks that an import path is valid. -// -// A valid import path consists of one or more valid path elements -// separated by slashes (U+002F). (It must not begin with nor end in a slash.) -// -// A valid path element is a non-empty string made up of -// ASCII letters, ASCII digits, and limited ASCII punctuation: - . _ and ~. -// It must not end with a dot (U+002E), nor contain two dots in a row. -// -// The element prefix up to the first dot must not be a reserved file name -// on Windows, regardless of case (CON, com1, NuL, and so on). The element -// must not have a suffix of a tilde followed by one or more ASCII digits -// (to exclude paths elements that look like Windows short-names). -// -// CheckImportPath may be less restrictive in the future, but see the -// top-level package documentation for additional information about -// subtleties of Unicode. -func CheckImportPath(path string) error { - if err := checkPath(path, importPath); err != nil { - return &InvalidPathError{Kind: "import", Path: path, Err: err} - } - return nil -} - -// pathKind indicates what kind of path we're checking. Module paths, -// import paths, and file paths have different restrictions. -type pathKind int - -const ( - modulePath pathKind = iota - importPath - filePath -) - -// checkPath checks that a general path is valid. kind indicates what -// specific constraints should be applied. -// -// checkPath returns an error describing why the path is not valid. -// Because these checks apply to module, import, and file paths, -// and because other checks may be applied, the caller is expected to wrap -// this error with [InvalidPathError]. -func checkPath(path string, kind pathKind) error { - if !utf8.ValidString(path) { - return fmt.Errorf("invalid UTF-8") - } - if path == "" { - return fmt.Errorf("empty string") - } - if path[0] == '-' && kind != filePath { - return fmt.Errorf("leading dash") - } - if strings.Contains(path, "//") { - return fmt.Errorf("double slash") - } - if path[len(path)-1] == '/' { - return fmt.Errorf("trailing slash") - } - elemStart := 0 - for i, r := range path { - if r == '/' { - if err := checkElem(path[elemStart:i], kind); err != nil { - return err - } - elemStart = i + 1 - } - } - if err := checkElem(path[elemStart:], kind); err != nil { - return err - } - return nil -} - -// checkElem checks whether an individual path element is valid. -func checkElem(elem string, kind pathKind) error { - if elem == "" { - return fmt.Errorf("empty path element") - } - if strings.Count(elem, ".") == len(elem) { - return fmt.Errorf("invalid path element %q", elem) - } - if elem[0] == '.' && kind == modulePath { - return fmt.Errorf("leading dot in path element") - } - if elem[len(elem)-1] == '.' { - return fmt.Errorf("trailing dot in path element") - } - for _, r := range elem { - ok := false - switch kind { - case modulePath: - ok = modPathOK(r) - case importPath: - ok = importPathOK(r) - case filePath: - ok = fileNameOK(r) - default: - panic(fmt.Sprintf("internal error: invalid kind %v", kind)) - } - if !ok { - return fmt.Errorf("invalid char %q", r) - } - } - - // Windows disallows a bunch of path elements, sadly. - // See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file - short := elem - if i := strings.Index(short, "."); i >= 0 { - short = short[:i] - } - for _, bad := range badWindowsNames { - if strings.EqualFold(bad, short) { - return fmt.Errorf("%q disallowed as path element component on Windows", short) - } - } - - if kind == filePath { - // don't check for Windows short-names in file names. They're - // only an issue for import paths. - return nil - } - - // Reject path components that look like Windows short-names. - // Those usually end in a tilde followed by one or more ASCII digits. - if tilde := strings.LastIndexByte(short, '~'); tilde >= 0 && tilde < len(short)-1 { - suffix := short[tilde+1:] - suffixIsDigits := true - for _, r := range suffix { - if r < '0' || r > '9' { - suffixIsDigits = false - break - } - } - if suffixIsDigits { - return fmt.Errorf("trailing tilde and digits in path element") - } - } - - return nil -} - -// CheckFilePath checks that a slash-separated file path is valid. -// The definition of a valid file path is the same as the definition -// of a valid import path except that the set of allowed characters is larger: -// all Unicode letters, ASCII digits, the ASCII space character (U+0020), -// and the ASCII punctuation characters -// “!#$%&()+,-.=@[]^_{}~”. -// (The excluded punctuation characters, " * < > ? ` ' | / \ and :, -// have special meanings in certain shells or operating systems.) -// -// CheckFilePath may be less restrictive in the future, but see the -// top-level package documentation for additional information about -// subtleties of Unicode. -func CheckFilePath(path string) error { - if err := checkPath(path, filePath); err != nil { - return &InvalidPathError{Kind: "file", Path: path, Err: err} - } - return nil -} - -// badWindowsNames are the reserved file path elements on Windows. -// See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file -var badWindowsNames = []string{ - "CON", - "PRN", - "AUX", - "NUL", - "COM1", - "COM2", - "COM3", - "COM4", - "COM5", - "COM6", - "COM7", - "COM8", - "COM9", - "LPT1", - "LPT2", - "LPT3", - "LPT4", - "LPT5", - "LPT6", - "LPT7", - "LPT8", - "LPT9", -} - -// SplitPathVersion returns prefix and major version such that prefix+pathMajor == path -// and version is either empty or "/vN" for N >= 2. -// As a special case, gopkg.in paths are recognized directly; -// they require ".vN" instead of "/vN", and for all N, not just N >= 2. -// SplitPathVersion returns with ok = false when presented with -// a path whose last path element does not satisfy the constraints -// applied by [CheckPath], such as "example.com/pkg/v1" or "example.com/pkg/v1.2". -func SplitPathVersion(path string) (prefix, pathMajor string, ok bool) { - if strings.HasPrefix(path, "gopkg.in/") { - return splitGopkgIn(path) - } - - i := len(path) - dot := false - for i > 0 && ('0' <= path[i-1] && path[i-1] <= '9' || path[i-1] == '.') { - if path[i-1] == '.' { - dot = true - } - i-- - } - if i <= 1 || i == len(path) || path[i-1] != 'v' || path[i-2] != '/' { - return path, "", true - } - prefix, pathMajor = path[:i-2], path[i-2:] - if dot || len(pathMajor) <= 2 || pathMajor[2] == '0' || pathMajor == "/v1" { - return path, "", false - } - return prefix, pathMajor, true -} - -// splitGopkgIn is like SplitPathVersion but only for gopkg.in paths. -func splitGopkgIn(path string) (prefix, pathMajor string, ok bool) { - if !strings.HasPrefix(path, "gopkg.in/") { - return path, "", false - } - i := len(path) - if strings.HasSuffix(path, "-unstable") { - i -= len("-unstable") - } - for i > 0 && ('0' <= path[i-1] && path[i-1] <= '9') { - i-- - } - if i <= 1 || path[i-1] != 'v' || path[i-2] != '.' { - // All gopkg.in paths must end in vN for some N. - return path, "", false - } - prefix, pathMajor = path[:i-2], path[i-2:] - if len(pathMajor) <= 2 || pathMajor[2] == '0' && pathMajor != ".v0" { - return path, "", false - } - return prefix, pathMajor, true -} - -// MatchPathMajor reports whether the semantic version v -// matches the path major version pathMajor. -// -// MatchPathMajor returns true if and only if [CheckPathMajor] returns nil. -func MatchPathMajor(v, pathMajor string) bool { - return CheckPathMajor(v, pathMajor) == nil -} - -// CheckPathMajor returns a non-nil error if the semantic version v -// does not match the path major version pathMajor. -func CheckPathMajor(v, pathMajor string) error { - // TODO(jayconrod): return errors or panic for invalid inputs. This function - // (and others) was covered by integration tests for cmd/go, and surrounding - // code protected against invalid inputs like non-canonical versions. - if strings.HasPrefix(pathMajor, ".v") && strings.HasSuffix(pathMajor, "-unstable") { - pathMajor = strings.TrimSuffix(pathMajor, "-unstable") - } - if strings.HasPrefix(v, "v0.0.0-") && pathMajor == ".v1" { - // Allow old bug in pseudo-versions that generated v0.0.0- pseudoversion for gopkg .v1. - // For example, gopkg.in/yaml.v2@v2.2.1's go.mod requires gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405. - return nil - } - m := semver.Major(v) - if pathMajor == "" { - if m == "v0" || m == "v1" || semver.Build(v) == "+incompatible" { - return nil - } - pathMajor = "v0 or v1" - } else if pathMajor[0] == '/' || pathMajor[0] == '.' { - if m == pathMajor[1:] { - return nil - } - pathMajor = pathMajor[1:] - } - return &InvalidVersionError{ - Version: v, - Err: fmt.Errorf("should be %s, not %s", pathMajor, semver.Major(v)), - } -} - -// PathMajorPrefix returns the major-version tag prefix implied by pathMajor. -// An empty PathMajorPrefix allows either v0 or v1. -// -// Note that [MatchPathMajor] may accept some versions that do not actually begin -// with this prefix: namely, it accepts a 'v0.0.0-' prefix for a '.v1' -// pathMajor, even though that pathMajor implies 'v1' tagging. -func PathMajorPrefix(pathMajor string) string { - if pathMajor == "" { - return "" - } - if pathMajor[0] != '/' && pathMajor[0] != '.' { - panic("pathMajor suffix " + pathMajor + " passed to PathMajorPrefix lacks separator") - } - if strings.HasPrefix(pathMajor, ".v") && strings.HasSuffix(pathMajor, "-unstable") { - pathMajor = strings.TrimSuffix(pathMajor, "-unstable") - } - m := pathMajor[1:] - if m != semver.Major(m) { - panic("pathMajor suffix " + pathMajor + "passed to PathMajorPrefix is not a valid major version") - } - return m -} - -// CanonicalVersion returns the canonical form of the version string v. -// It is the same as [semver.Canonical] except that it preserves the special build suffix "+incompatible". -func CanonicalVersion(v string) string { - cv := semver.Canonical(v) - if semver.Build(v) == "+incompatible" { - cv += "+incompatible" - } - return cv -} - -// Sort sorts the list by Path, breaking ties by comparing [Version] fields. -// The Version fields are interpreted as semantic versions (using [semver.Compare]) -// optionally followed by a tie-breaking suffix introduced by a slash character, -// like in "v0.0.1/go.mod". -func Sort(list []Version) { - sort.Slice(list, func(i, j int) bool { - mi := list[i] - mj := list[j] - if mi.Path != mj.Path { - return mi.Path < mj.Path - } - // To help go.sum formatting, allow version/file. - // Compare semver prefix by semver rules, - // file by string order. - vi := mi.Version - vj := mj.Version - var fi, fj string - if k := strings.Index(vi, "/"); k >= 0 { - vi, fi = vi[:k], vi[k:] - } - if k := strings.Index(vj, "/"); k >= 0 { - vj, fj = vj[:k], vj[k:] - } - if vi != vj { - return semver.Compare(vi, vj) < 0 - } - return fi < fj - }) -} - -// EscapePath returns the escaped form of the given module path. -// It fails if the module path is invalid. -func EscapePath(path string) (escaped string, err error) { - if err := CheckPath(path); err != nil { - return "", err - } - - return escapeString(path) -} - -// EscapeVersion returns the escaped form of the given module version. -// Versions are allowed to be in non-semver form but must be valid file names -// and not contain exclamation marks. -func EscapeVersion(v string) (escaped string, err error) { - if err := checkElem(v, filePath); err != nil || strings.Contains(v, "!") { - return "", &InvalidVersionError{ - Version: v, - Err: fmt.Errorf("disallowed version string"), - } - } - return escapeString(v) -} - -func escapeString(s string) (escaped string, err error) { - haveUpper := false - for _, r := range s { - if r == '!' || r >= utf8.RuneSelf { - // This should be disallowed by CheckPath, but diagnose anyway. - // The correctness of the escaping loop below depends on it. - return "", fmt.Errorf("internal error: inconsistency in EscapePath") - } - if 'A' <= r && r <= 'Z' { - haveUpper = true - } - } - - if !haveUpper { - return s, nil - } - - var buf []byte - for _, r := range s { - if 'A' <= r && r <= 'Z' { - buf = append(buf, '!', byte(r+'a'-'A')) - } else { - buf = append(buf, byte(r)) - } - } - return string(buf), nil -} - -// UnescapePath returns the module path for the given escaped path. -// It fails if the escaped path is invalid or describes an invalid path. -func UnescapePath(escaped string) (path string, err error) { - path, ok := unescapeString(escaped) - if !ok { - return "", fmt.Errorf("invalid escaped module path %q", escaped) - } - if err := CheckPath(path); err != nil { - return "", fmt.Errorf("invalid escaped module path %q: %v", escaped, err) - } - return path, nil -} - -// UnescapeVersion returns the version string for the given escaped version. -// It fails if the escaped form is invalid or describes an invalid version. -// Versions are allowed to be in non-semver form but must be valid file names -// and not contain exclamation marks. -func UnescapeVersion(escaped string) (v string, err error) { - v, ok := unescapeString(escaped) - if !ok { - return "", fmt.Errorf("invalid escaped version %q", escaped) - } - if err := checkElem(v, filePath); err != nil { - return "", fmt.Errorf("invalid escaped version %q: %v", v, err) - } - return v, nil -} - -func unescapeString(escaped string) (string, bool) { - var buf []byte - - bang := false - for _, r := range escaped { - if r >= utf8.RuneSelf { - return "", false - } - if bang { - bang = false - if r < 'a' || 'z' < r { - return "", false - } - buf = append(buf, byte(r+'A'-'a')) - continue - } - if r == '!' { - bang = true - continue - } - if 'A' <= r && r <= 'Z' { - return "", false - } - buf = append(buf, byte(r)) - } - if bang { - return "", false - } - return string(buf), true -} - -// MatchPrefixPatterns reports whether any path prefix of target matches one of -// the glob patterns (as defined by [path.Match]) in the comma-separated globs -// list. This implements the algorithm used when matching a module path to the -// GOPRIVATE environment variable, as described by 'go help module-private'. -// -// It ignores any empty or malformed patterns in the list. -// Trailing slashes on patterns are ignored. -func MatchPrefixPatterns(globs, target string) bool { - for globs != "" { - // Extract next non-empty glob in comma-separated list. - var glob string - if i := strings.Index(globs, ","); i >= 0 { - glob, globs = globs[:i], globs[i+1:] - } else { - glob, globs = globs, "" - } - glob = strings.TrimSuffix(glob, "/") - if glob == "" { - continue - } - - // A glob with N+1 path elements (N slashes) needs to be matched - // against the first N+1 path elements of target, - // which end just before the N+1'th slash. - n := strings.Count(glob, "/") - prefix := target - // Walk target, counting slashes, truncating at the N+1'th slash. - for i := 0; i < len(target); i++ { - if target[i] == '/' { - if n == 0 { - prefix = target[:i] - break - } - n-- - } - } - if n > 0 { - // Not enough prefix elements. - continue - } - matched, _ := path.Match(glob, prefix) - if matched { - return true - } - } - return false -} diff --git a/vendor/golang.org/x/mod/module/pseudo.go b/vendor/golang.org/x/mod/module/pseudo.go deleted file mode 100644 index 9cf19d3254e..00000000000 --- a/vendor/golang.org/x/mod/module/pseudo.go +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Pseudo-versions -// -// Code authors are expected to tag the revisions they want users to use, -// including prereleases. However, not all authors tag versions at all, -// and not all commits a user might want to try will have tags. -// A pseudo-version is a version with a special form that allows us to -// address an untagged commit and order that version with respect to -// other versions we might encounter. -// -// A pseudo-version takes one of the general forms: -// -// (1) vX.0.0-yyyymmddhhmmss-abcdef123456 -// (2) vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456 -// (3) vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456+incompatible -// (4) vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456 -// (5) vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456+incompatible -// -// If there is no recently tagged version with the right major version vX, -// then form (1) is used, creating a space of pseudo-versions at the bottom -// of the vX version range, less than any tagged version, including the unlikely v0.0.0. -// -// If the most recent tagged version before the target commit is vX.Y.Z or vX.Y.Z+incompatible, -// then the pseudo-version uses form (2) or (3), making it a prerelease for the next -// possible semantic version after vX.Y.Z. The leading 0 segment in the prerelease string -// ensures that the pseudo-version compares less than possible future explicit prereleases -// like vX.Y.(Z+1)-rc1 or vX.Y.(Z+1)-1. -// -// If the most recent tagged version before the target commit is vX.Y.Z-pre or vX.Y.Z-pre+incompatible, -// then the pseudo-version uses form (4) or (5), making it a slightly later prerelease. - -package module - -import ( - "errors" - "fmt" - "strings" - "time" - - "golang.org/x/mod/internal/lazyregexp" - "golang.org/x/mod/semver" -) - -var pseudoVersionRE = lazyregexp.New(`^v[0-9]+\.(0\.0-|\d+\.\d+-([^+]*\.)?0\.)\d{14}-[A-Za-z0-9]+(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$`) - -const PseudoVersionTimestampFormat = "20060102150405" - -// PseudoVersion returns a pseudo-version for the given major version ("v1") -// preexisting older tagged version ("" or "v1.2.3" or "v1.2.3-pre"), revision time, -// and revision identifier (usually a 12-byte commit hash prefix). -func PseudoVersion(major, older string, t time.Time, rev string) string { - if major == "" { - major = "v0" - } - segment := fmt.Sprintf("%s-%s", t.UTC().Format(PseudoVersionTimestampFormat), rev) - build := semver.Build(older) - older = semver.Canonical(older) - if older == "" { - return major + ".0.0-" + segment // form (1) - } - if semver.Prerelease(older) != "" { - return older + ".0." + segment + build // form (4), (5) - } - - // Form (2), (3). - // Extract patch from vMAJOR.MINOR.PATCH - i := strings.LastIndex(older, ".") + 1 - v, patch := older[:i], older[i:] - - // Reassemble. - return v + incDecimal(patch) + "-0." + segment + build -} - -// ZeroPseudoVersion returns a pseudo-version with a zero timestamp and -// revision, which may be used as a placeholder. -func ZeroPseudoVersion(major string) string { - return PseudoVersion(major, "", time.Time{}, "000000000000") -} - -// incDecimal returns the decimal string incremented by 1. -func incDecimal(decimal string) string { - // Scan right to left turning 9s to 0s until you find a digit to increment. - digits := []byte(decimal) - i := len(digits) - 1 - for ; i >= 0 && digits[i] == '9'; i-- { - digits[i] = '0' - } - if i >= 0 { - digits[i]++ - } else { - // digits is all zeros - digits[0] = '1' - digits = append(digits, '0') - } - return string(digits) -} - -// decDecimal returns the decimal string decremented by 1, or the empty string -// if the decimal is all zeroes. -func decDecimal(decimal string) string { - // Scan right to left turning 0s to 9s until you find a digit to decrement. - digits := []byte(decimal) - i := len(digits) - 1 - for ; i >= 0 && digits[i] == '0'; i-- { - digits[i] = '9' - } - if i < 0 { - // decimal is all zeros - return "" - } - if i == 0 && digits[i] == '1' && len(digits) > 1 { - digits = digits[1:] - } else { - digits[i]-- - } - return string(digits) -} - -// IsPseudoVersion reports whether v is a pseudo-version. -func IsPseudoVersion(v string) bool { - return strings.Count(v, "-") >= 2 && semver.IsValid(v) && pseudoVersionRE.MatchString(v) -} - -// IsZeroPseudoVersion returns whether v is a pseudo-version with a zero base, -// timestamp, and revision, as returned by [ZeroPseudoVersion]. -func IsZeroPseudoVersion(v string) bool { - return v == ZeroPseudoVersion(semver.Major(v)) -} - -// PseudoVersionTime returns the time stamp of the pseudo-version v. -// It returns an error if v is not a pseudo-version or if the time stamp -// embedded in the pseudo-version is not a valid time. -func PseudoVersionTime(v string) (time.Time, error) { - _, timestamp, _, _, err := parsePseudoVersion(v) - if err != nil { - return time.Time{}, err - } - t, err := time.Parse("20060102150405", timestamp) - if err != nil { - return time.Time{}, &InvalidVersionError{ - Version: v, - Pseudo: true, - Err: fmt.Errorf("malformed time %q", timestamp), - } - } - return t, nil -} - -// PseudoVersionRev returns the revision identifier of the pseudo-version v. -// It returns an error if v is not a pseudo-version. -func PseudoVersionRev(v string) (rev string, err error) { - _, _, rev, _, err = parsePseudoVersion(v) - return -} - -// PseudoVersionBase returns the canonical parent version, if any, upon which -// the pseudo-version v is based. -// -// If v has no parent version (that is, if it is "vX.0.0-[…]"), -// PseudoVersionBase returns the empty string and a nil error. -func PseudoVersionBase(v string) (string, error) { - base, _, _, build, err := parsePseudoVersion(v) - if err != nil { - return "", err - } - - switch pre := semver.Prerelease(base); pre { - case "": - // vX.0.0-yyyymmddhhmmss-abcdef123456 → "" - if build != "" { - // Pseudo-versions of the form vX.0.0-yyyymmddhhmmss-abcdef123456+incompatible - // are nonsensical: the "vX.0.0-" prefix implies that there is no parent tag, - // but the "+incompatible" suffix implies that the major version of - // the parent tag is not compatible with the module's import path. - // - // There are a few such entries in the index generated by proxy.golang.org, - // but we believe those entries were generated by the proxy itself. - return "", &InvalidVersionError{ - Version: v, - Pseudo: true, - Err: fmt.Errorf("lacks base version, but has build metadata %q", build), - } - } - return "", nil - - case "-0": - // vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456 → vX.Y.Z - // vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456+incompatible → vX.Y.Z+incompatible - base = strings.TrimSuffix(base, pre) - i := strings.LastIndexByte(base, '.') - if i < 0 { - panic("base from parsePseudoVersion missing patch number: " + base) - } - patch := decDecimal(base[i+1:]) - if patch == "" { - // vX.0.0-0 is invalid, but has been observed in the wild in the index - // generated by requests to proxy.golang.org. - // - // NOTE(bcmills): I cannot find a historical bug that accounts for - // pseudo-versions of this form, nor have I seen such versions in any - // actual go.mod files. If we find actual examples of this form and a - // reasonable theory of how they came into existence, it seems fine to - // treat them as equivalent to vX.0.0 (especially since the invalid - // pseudo-versions have lower precedence than the real ones). For now, we - // reject them. - return "", &InvalidVersionError{ - Version: v, - Pseudo: true, - Err: fmt.Errorf("version before %s would have negative patch number", base), - } - } - return base[:i+1] + patch + build, nil - - default: - // vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456 → vX.Y.Z-pre - // vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456+incompatible → vX.Y.Z-pre+incompatible - if !strings.HasSuffix(base, ".0") { - panic(`base from parsePseudoVersion missing ".0" before date: ` + base) - } - return strings.TrimSuffix(base, ".0") + build, nil - } -} - -var errPseudoSyntax = errors.New("syntax error") - -func parsePseudoVersion(v string) (base, timestamp, rev, build string, err error) { - if !IsPseudoVersion(v) { - return "", "", "", "", &InvalidVersionError{ - Version: v, - Pseudo: true, - Err: errPseudoSyntax, - } - } - build = semver.Build(v) - v = strings.TrimSuffix(v, build) - j := strings.LastIndex(v, "-") - v, rev = v[:j], v[j+1:] - i := strings.LastIndex(v, "-") - if j := strings.LastIndex(v, "."); j > i { - base = v[:j] // "vX.Y.Z-pre.0" or "vX.Y.(Z+1)-0" - timestamp = v[j+1:] - } else { - base = v[:i] // "vX.0.0" - timestamp = v[i+1:] - } - return base, timestamp, rev, build, nil -} diff --git a/vendor/golang.org/x/tools/cmd/goimports/doc.go b/vendor/golang.org/x/tools/cmd/goimports/doc.go deleted file mode 100644 index 18a3ad448ea..00000000000 --- a/vendor/golang.org/x/tools/cmd/goimports/doc.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -Command goimports updates your Go import lines, -adding missing ones and removing unreferenced ones. - - $ go install golang.org/x/tools/cmd/goimports@latest - -In addition to fixing imports, goimports also formats -your code in the same style as gofmt so it can be used -as a replacement for your editor's gofmt-on-save hook. - -For emacs, make sure you have the latest go-mode.el: - - https://github.com/dominikh/go-mode.el - -Then in your .emacs file: - - (setq gofmt-command "goimports") - (add-hook 'before-save-hook 'gofmt-before-save) - -For vim, set "gofmt_command" to "goimports": - - https://golang.org/change/39c724dd7f252 - https://golang.org/wiki/IDEsAndTextEditorPlugins - etc - -For GoSublime, follow the steps described here: - - http://michaelwhatcott.com/gosublime-goimports/ - -For other editors, you probably know what to do. - -To exclude directories in your $GOPATH from being scanned for Go -files, goimports respects a configuration file at -$GOPATH/src/.goimportsignore which may contain blank lines, comment -lines (beginning with '#'), or lines naming a directory relative to -the configuration file to ignore when scanning. No globbing or regex -patterns are allowed. Use the "-v" verbose flag to verify it's -working and see what goimports is doing. - -File bugs or feature requests at: - - https://golang.org/issues/new?title=x/tools/cmd/goimports:+ - -Happy hacking! -*/ -package main // import "golang.org/x/tools/cmd/goimports" diff --git a/vendor/golang.org/x/tools/cmd/goimports/goimports.go b/vendor/golang.org/x/tools/cmd/goimports/goimports.go deleted file mode 100644 index dcb5023a2e7..00000000000 --- a/vendor/golang.org/x/tools/cmd/goimports/goimports.go +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bufio" - "bytes" - "errors" - "flag" - "fmt" - "go/scanner" - "io" - "log" - "os" - "os/exec" - "path/filepath" - "runtime" - "runtime/pprof" - "strings" - - "golang.org/x/tools/internal/gocommand" - "golang.org/x/tools/internal/imports" -) - -var ( - // main operation modes - list = flag.Bool("l", false, "list files whose formatting differs from goimport's") - write = flag.Bool("w", false, "write result to (source) file instead of stdout") - doDiff = flag.Bool("d", false, "display diffs instead of rewriting files") - srcdir = flag.String("srcdir", "", "choose imports as if source code is from `dir`. When operating on a single file, dir may instead be the complete file name.") - - verbose bool // verbose logging - - cpuProfile = flag.String("cpuprofile", "", "CPU profile output") - memProfile = flag.String("memprofile", "", "memory profile output") - memProfileRate = flag.Int("memrate", 0, "if > 0, sets runtime.MemProfileRate") - - options = &imports.Options{ - TabWidth: 8, - TabIndent: true, - Comments: true, - Fragment: true, - Env: &imports.ProcessEnv{ - GocmdRunner: &gocommand.Runner{}, - }, - } - exitCode = 0 -) - -func init() { - flag.BoolVar(&options.AllErrors, "e", false, "report all errors (not just the first 10 on different lines)") - flag.StringVar(&options.LocalPrefix, "local", "", "put imports beginning with this string after 3rd-party packages; comma-separated list") - flag.BoolVar(&options.FormatOnly, "format-only", false, "if true, don't fix imports and only format. In this mode, goimports is effectively gofmt, with the addition that imports are grouped into sections.") -} - -func report(err error) { - scanner.PrintError(os.Stderr, err) - exitCode = 2 -} - -func usage() { - fmt.Fprintf(os.Stderr, "usage: goimports [flags] [path ...]\n") - flag.PrintDefaults() - os.Exit(2) -} - -func isGoFile(f os.FileInfo) bool { - // ignore non-Go files - name := f.Name() - return !f.IsDir() && !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".go") -} - -// argumentType is which mode goimports was invoked as. -type argumentType int - -const ( - // fromStdin means the user is piping their source into goimports. - fromStdin argumentType = iota - - // singleArg is the common case from editors, when goimports is run on - // a single file. - singleArg - - // multipleArg is when the user ran "goimports file1.go file2.go" - // or ran goimports on a directory tree. - multipleArg -) - -func processFile(filename string, in io.Reader, out io.Writer, argType argumentType) error { - opt := options - if argType == fromStdin { - nopt := *options - nopt.Fragment = true - opt = &nopt - } - - if in == nil { - f, err := os.Open(filename) - if err != nil { - return err - } - defer f.Close() - in = f - } - - src, err := io.ReadAll(in) - if err != nil { - return err - } - - target := filename - if *srcdir != "" { - // Determine whether the provided -srcdirc is a directory or file - // and then use it to override the target. - // - // See https://github.com/dominikh/go-mode.el/issues/146 - if isFile(*srcdir) { - if argType == multipleArg { - return errors.New("-srcdir value can't be a file when passing multiple arguments or when walking directories") - } - target = *srcdir - } else if argType == singleArg && strings.HasSuffix(*srcdir, ".go") && !isDir(*srcdir) { - // For a file which doesn't exist on disk yet, but might shortly. - // e.g. user in editor opens $DIR/newfile.go and newfile.go doesn't yet exist on disk. - // The goimports on-save hook writes the buffer to a temp file - // first and runs goimports before the actual save to newfile.go. - // The editor's buffer is named "newfile.go" so that is passed to goimports as: - // goimports -srcdir=/gopath/src/pkg/newfile.go /tmp/gofmtXXXXXXXX.go - // and then the editor reloads the result from the tmp file and writes - // it to newfile.go. - target = *srcdir - } else { - // Pretend that file is from *srcdir in order to decide - // visible imports correctly. - target = filepath.Join(*srcdir, filepath.Base(filename)) - } - } - - res, err := imports.Process(target, src, opt) - if err != nil { - return err - } - - if !bytes.Equal(src, res) { - // formatting has changed - if *list { - fmt.Fprintln(out, filename) - } - if *write { - if argType == fromStdin { - // filename is "" - return errors.New("can't use -w on stdin") - } - // On Windows, we need to re-set the permissions from the file. See golang/go#38225. - var perms os.FileMode - if fi, err := os.Stat(filename); err == nil { - perms = fi.Mode() & os.ModePerm - } - err = os.WriteFile(filename, res, perms) - if err != nil { - return err - } - } - if *doDiff { - if argType == fromStdin { - filename = "stdin.go" // because .orig looks silly - } - data, err := diff(src, res, filename) - if err != nil { - return fmt.Errorf("computing diff: %s", err) - } - fmt.Printf("diff -u %s %s\n", filepath.ToSlash(filename+".orig"), filepath.ToSlash(filename)) - out.Write(data) - } - } - - if !*list && !*write && !*doDiff { - _, err = out.Write(res) - } - - return err -} - -func visitFile(path string, f os.FileInfo, err error) error { - if err == nil && isGoFile(f) { - err = processFile(path, nil, os.Stdout, multipleArg) - } - if err != nil { - report(err) - } - return nil -} - -func walkDir(path string) { - filepath.Walk(path, visitFile) -} - -func main() { - runtime.GOMAXPROCS(runtime.NumCPU()) - - // call gofmtMain in a separate function - // so that it can use defer and have them - // run before the exit. - gofmtMain() - os.Exit(exitCode) -} - -// parseFlags parses command line flags and returns the paths to process. -// It's a var so that custom implementations can replace it in other files. -var parseFlags = func() []string { - flag.BoolVar(&verbose, "v", false, "verbose logging") - - flag.Parse() - return flag.Args() -} - -func bufferedFileWriter(dest string) (w io.Writer, close func()) { - f, err := os.Create(dest) - if err != nil { - log.Fatal(err) - } - bw := bufio.NewWriter(f) - return bw, func() { - if err := bw.Flush(); err != nil { - log.Fatalf("error flushing %v: %v", dest, err) - } - if err := f.Close(); err != nil { - log.Fatal(err) - } - } -} - -func gofmtMain() { - flag.Usage = usage - paths := parseFlags() - - if *cpuProfile != "" { - bw, flush := bufferedFileWriter(*cpuProfile) - pprof.StartCPUProfile(bw) - defer flush() - defer pprof.StopCPUProfile() - } - // doTrace is a conditionally compiled wrapper around runtime/trace. It is - // used to allow goimports to compile under gccgo, which does not support - // runtime/trace. See https://golang.org/issue/15544. - defer doTrace()() - if *memProfileRate > 0 { - runtime.MemProfileRate = *memProfileRate - bw, flush := bufferedFileWriter(*memProfile) - defer func() { - runtime.GC() // materialize all statistics - if err := pprof.WriteHeapProfile(bw); err != nil { - log.Fatal(err) - } - flush() - }() - } - - if verbose { - log.SetFlags(log.LstdFlags | log.Lmicroseconds) - options.Env.Logf = log.Printf - } - if options.TabWidth < 0 { - fmt.Fprintf(os.Stderr, "negative tabwidth %d\n", options.TabWidth) - exitCode = 2 - return - } - - if len(paths) == 0 { - if err := processFile("", os.Stdin, os.Stdout, fromStdin); err != nil { - report(err) - } - return - } - - argType := singleArg - if len(paths) > 1 { - argType = multipleArg - } - - for _, path := range paths { - switch dir, err := os.Stat(path); { - case err != nil: - report(err) - case dir.IsDir(): - walkDir(path) - default: - if err := processFile(path, nil, os.Stdout, argType); err != nil { - report(err) - } - } - } -} - -func writeTempFile(dir, prefix string, data []byte) (string, error) { - file, err := os.CreateTemp(dir, prefix) - if err != nil { - return "", err - } - _, err = file.Write(data) - if err1 := file.Close(); err == nil { - err = err1 - } - if err != nil { - os.Remove(file.Name()) - return "", err - } - return file.Name(), nil -} - -func diff(b1, b2 []byte, filename string) (data []byte, err error) { - f1, err := writeTempFile("", "gofmt", b1) - if err != nil { - return - } - defer os.Remove(f1) - - f2, err := writeTempFile("", "gofmt", b2) - if err != nil { - return - } - defer os.Remove(f2) - - cmd := "diff" - if runtime.GOOS == "plan9" { - cmd = "/bin/ape/diff" - } - - data, err = exec.Command(cmd, "-u", f1, f2).CombinedOutput() - if len(data) > 0 { - // diff exits with a non-zero status when the files don't match. - // Ignore that failure as long as we get output. - return replaceTempFilename(data, filename) - } - return -} - -// replaceTempFilename replaces temporary filenames in diff with actual one. -// -// --- /tmp/gofmt316145376 2017-02-03 19:13:00.280468375 -0500 -// +++ /tmp/gofmt617882815 2017-02-03 19:13:00.280468375 -0500 -// ... -// -> -// --- path/to/file.go.orig 2017-02-03 19:13:00.280468375 -0500 -// +++ path/to/file.go 2017-02-03 19:13:00.280468375 -0500 -// ... -func replaceTempFilename(diff []byte, filename string) ([]byte, error) { - bs := bytes.SplitN(diff, []byte{'\n'}, 3) - if len(bs) < 3 { - return nil, fmt.Errorf("got unexpected diff for %s", filename) - } - // Preserve timestamps. - var t0, t1 []byte - if i := bytes.LastIndexByte(bs[0], '\t'); i != -1 { - t0 = bs[0][i:] - } - if i := bytes.LastIndexByte(bs[1], '\t'); i != -1 { - t1 = bs[1][i:] - } - // Always print filepath with slash separator. - f := filepath.ToSlash(filename) - bs[0] = []byte(fmt.Sprintf("--- %s%s", f+".orig", t0)) - bs[1] = []byte(fmt.Sprintf("+++ %s%s", f, t1)) - return bytes.Join(bs, []byte{'\n'}), nil -} - -// isFile reports whether name is a file. -func isFile(name string) bool { - fi, err := os.Stat(name) - return err == nil && fi.Mode().IsRegular() -} - -// isDir reports whether name is a directory. -func isDir(name string) bool { - fi, err := os.Stat(name) - return err == nil && fi.IsDir() -} diff --git a/vendor/golang.org/x/tools/cmd/goimports/goimports_gc.go b/vendor/golang.org/x/tools/cmd/goimports/goimports_gc.go deleted file mode 100644 index 3326646d035..00000000000 --- a/vendor/golang.org/x/tools/cmd/goimports/goimports_gc.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build gc -// +build gc - -package main - -import ( - "flag" - "runtime/trace" -) - -var traceProfile = flag.String("trace", "", "trace profile output") - -func doTrace() func() { - if *traceProfile != "" { - bw, flush := bufferedFileWriter(*traceProfile) - trace.Start(bw) - return func() { - trace.Stop() - flush() - } - } - return func() {} -} diff --git a/vendor/golang.org/x/tools/cmd/goimports/goimports_not_gc.go b/vendor/golang.org/x/tools/cmd/goimports/goimports_not_gc.go deleted file mode 100644 index 344fe7576b0..00000000000 --- a/vendor/golang.org/x/tools/cmd/goimports/goimports_not_gc.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !gc -// +build !gc - -package main - -func doTrace() func() { - return func() {} -} diff --git a/vendor/golang.org/x/tools/imports/forward.go b/vendor/golang.org/x/tools/imports/forward.go deleted file mode 100644 index cb6db8893f9..00000000000 --- a/vendor/golang.org/x/tools/imports/forward.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package imports implements a Go pretty-printer (like package "go/format") -// that also adds or removes import statements as necessary. -package imports // import "golang.org/x/tools/imports" - -import ( - "log" - "os" - - "golang.org/x/tools/internal/gocommand" - intimp "golang.org/x/tools/internal/imports" -) - -// Options specifies options for processing files. -type Options struct { - Fragment bool // Accept fragment of a source file (no package statement) - AllErrors bool // Report all errors (not just the first 10 on different lines) - - Comments bool // Print comments (true if nil *Options provided) - TabIndent bool // Use tabs for indent (true if nil *Options provided) - TabWidth int // Tab width (8 if nil *Options provided) - - FormatOnly bool // Disable the insertion and deletion of imports -} - -// Debug controls verbose logging. -var Debug = false - -// LocalPrefix is a comma-separated string of import path prefixes, which, if -// set, instructs Process to sort the import paths with the given prefixes -// into another group after 3rd-party packages. -var LocalPrefix string - -// Process formats and adjusts imports for the provided file. -// If opt is nil the defaults are used, and if src is nil the source -// is read from the filesystem. -// -// Note that filename's directory influences which imports can be chosen, -// so it is important that filename be accurate. -// To process data “as if” it were in filename, pass the data as a non-nil src. -func Process(filename string, src []byte, opt *Options) ([]byte, error) { - var err error - if src == nil { - src, err = os.ReadFile(filename) - if err != nil { - return nil, err - } - } - if opt == nil { - opt = &Options{Comments: true, TabIndent: true, TabWidth: 8} - } - intopt := &intimp.Options{ - Env: &intimp.ProcessEnv{ - GocmdRunner: &gocommand.Runner{}, - }, - LocalPrefix: LocalPrefix, - AllErrors: opt.AllErrors, - Comments: opt.Comments, - FormatOnly: opt.FormatOnly, - Fragment: opt.Fragment, - TabIndent: opt.TabIndent, - TabWidth: opt.TabWidth, - } - if Debug { - intopt.Env.Logf = log.Printf - } - return intimp.Process(filename, src, intopt) -} - -// VendorlessPath returns the devendorized version of the import path ipath. -// For example, VendorlessPath("foo/bar/vendor/a/b") returns "a/b". -func VendorlessPath(ipath string) string { - return intimp.VendorlessPath(ipath) -} diff --git a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go deleted file mode 100644 index 8361515519f..00000000000 --- a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go +++ /dev/null @@ -1,337 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package gopathwalk is like filepath.Walk but specialized for finding Go -// packages, particularly in $GOPATH and $GOROOT. -package gopathwalk - -import ( - "bufio" - "bytes" - "io" - "io/fs" - "os" - "path/filepath" - "runtime" - "strings" - "sync" - "time" -) - -// Options controls the behavior of a Walk call. -type Options struct { - // If Logf is non-nil, debug logging is enabled through this function. - Logf func(format string, args ...interface{}) - - // Search module caches. Also disables legacy goimports ignore rules. - ModulesEnabled bool - - // Maximum number of concurrent calls to user-provided callbacks, - // or 0 for GOMAXPROCS. - Concurrency int -} - -// RootType indicates the type of a Root. -type RootType int - -const ( - RootUnknown RootType = iota - RootGOROOT - RootGOPATH - RootCurrentModule - RootModuleCache - RootOther -) - -// A Root is a starting point for a Walk. -type Root struct { - Path string - Type RootType -} - -// Walk concurrently walks Go source directories ($GOROOT, $GOPATH, etc) to find packages. -// -// For each package found, add will be called with the absolute -// paths of the containing source directory and the package directory. -// -// Unlike filepath.WalkDir, Walk follows symbolic links -// (while guarding against cycles). -func Walk(roots []Root, add func(root Root, dir string), opts Options) { - WalkSkip(roots, add, func(Root, string) bool { return false }, opts) -} - -// WalkSkip concurrently walks Go source directories ($GOROOT, $GOPATH, etc) to -// find packages. -// -// For each package found, add will be called with the absolute -// paths of the containing source directory and the package directory. -// For each directory that will be scanned, skip will be called -// with the absolute paths of the containing source directory and the directory. -// If skip returns false on a directory it will be processed. -// -// Unlike filepath.WalkDir, WalkSkip follows symbolic links -// (while guarding against cycles). -func WalkSkip(roots []Root, add func(root Root, dir string), skip func(root Root, dir string) bool, opts Options) { - for _, root := range roots { - walkDir(root, add, skip, opts) - } -} - -// walkDir creates a walker and starts fastwalk with this walker. -func walkDir(root Root, add func(Root, string), skip func(root Root, dir string) bool, opts Options) { - if opts.Logf == nil { - opts.Logf = func(format string, args ...interface{}) {} - } - if _, err := os.Stat(root.Path); os.IsNotExist(err) { - opts.Logf("skipping nonexistent directory: %v", root.Path) - return - } - start := time.Now() - opts.Logf("scanning %s", root.Path) - - concurrency := opts.Concurrency - if concurrency == 0 { - // The walk be either CPU-bound or I/O-bound, depending on what the - // caller-supplied add function does and the details of the user's platform - // and machine. Rather than trying to fine-tune the concurrency level for a - // specific environment, we default to GOMAXPROCS: it is likely to be a good - // choice for a CPU-bound add function, and if it is instead I/O-bound, then - // dealing with I/O saturation is arguably the job of the kernel and/or - // runtime. (Oversaturating I/O seems unlikely to harm performance as badly - // as failing to saturate would.) - concurrency = runtime.GOMAXPROCS(0) - } - w := &walker{ - root: root, - add: add, - skip: skip, - opts: opts, - sem: make(chan struct{}, concurrency), - } - w.init() - - w.sem <- struct{}{} - path := root.Path - if path == "" { - path = "." - } - if fi, err := os.Lstat(path); err == nil { - w.walk(path, nil, fs.FileInfoToDirEntry(fi)) - } else { - w.opts.Logf("scanning directory %v: %v", root.Path, err) - } - <-w.sem - w.walking.Wait() - - opts.Logf("scanned %s in %v", root.Path, time.Since(start)) -} - -// walker is the callback for fastwalk.Walk. -type walker struct { - root Root // The source directory to scan. - add func(Root, string) // The callback that will be invoked for every possible Go package dir. - skip func(Root, string) bool // The callback that will be invoked for every dir. dir is skipped if it returns true. - opts Options // Options passed to Walk by the user. - - walking sync.WaitGroup - sem chan struct{} // Channel of semaphore tokens; send to acquire, receive to release. - ignoredDirs []string - - added sync.Map // map[string]bool -} - -// A symlinkList is a linked list of os.FileInfos for parent directories -// reached via symlinks. -type symlinkList struct { - info os.FileInfo - prev *symlinkList -} - -// init initializes the walker based on its Options -func (w *walker) init() { - var ignoredPaths []string - if w.root.Type == RootModuleCache { - ignoredPaths = []string{"cache"} - } - if !w.opts.ModulesEnabled && w.root.Type == RootGOPATH { - ignoredPaths = w.getIgnoredDirs(w.root.Path) - ignoredPaths = append(ignoredPaths, "v", "mod") - } - - for _, p := range ignoredPaths { - full := filepath.Join(w.root.Path, p) - w.ignoredDirs = append(w.ignoredDirs, full) - w.opts.Logf("Directory added to ignore list: %s", full) - } -} - -// getIgnoredDirs reads an optional config file at /.goimportsignore -// of relative directories to ignore when scanning for go files. -// The provided path is one of the $GOPATH entries with "src" appended. -func (w *walker) getIgnoredDirs(path string) []string { - file := filepath.Join(path, ".goimportsignore") - slurp, err := os.ReadFile(file) - if err != nil { - w.opts.Logf("%v", err) - } else { - w.opts.Logf("Read %s", file) - } - if err != nil { - return nil - } - - var ignoredDirs []string - bs := bufio.NewScanner(bytes.NewReader(slurp)) - for bs.Scan() { - line := strings.TrimSpace(bs.Text()) - if line == "" || strings.HasPrefix(line, "#") { - continue - } - ignoredDirs = append(ignoredDirs, line) - } - return ignoredDirs -} - -// shouldSkipDir reports whether the file should be skipped or not. -func (w *walker) shouldSkipDir(dir string) bool { - for _, ignoredDir := range w.ignoredDirs { - if dir == ignoredDir { - return true - } - } - if w.skip != nil { - // Check with the user specified callback. - return w.skip(w.root, dir) - } - return false -} - -// walk walks through the given path. -// -// Errors are logged if w.opts.Logf is non-nil, but otherwise ignored. -func (w *walker) walk(path string, pathSymlinks *symlinkList, d fs.DirEntry) { - if d.Type()&os.ModeSymlink != 0 { - // Walk the symlink's target rather than the symlink itself. - // - // (Note that os.Stat, unlike the lower-lever os.Readlink, - // follows arbitrarily many layers of symlinks, so it will eventually - // reach either a non-symlink or a nonexistent target.) - // - // TODO(bcmills): 'go list all' itself ignores symlinks within GOROOT/src - // and GOPATH/src. Do we really need to traverse them here? If so, why? - - fi, err := os.Stat(path) - if err != nil { - w.opts.Logf("%v", err) - return - } - - // Avoid walking symlink cycles: if we have already followed a symlink to - // this directory as a parent of itself, don't follow it again. - // - // This doesn't catch the first time through a cycle, but it also minimizes - // the number of extra stat calls we make if we *don't* encounter a cycle. - // Since we don't actually expect to encounter symlink cycles in practice, - // this seems like the right tradeoff. - for parent := pathSymlinks; parent != nil; parent = parent.prev { - if os.SameFile(fi, parent.info) { - return - } - } - - pathSymlinks = &symlinkList{ - info: fi, - prev: pathSymlinks, - } - d = fs.FileInfoToDirEntry(fi) - } - - if d.Type().IsRegular() { - if !strings.HasSuffix(path, ".go") { - return - } - - dir := filepath.Dir(path) - if dir == w.root.Path && (w.root.Type == RootGOROOT || w.root.Type == RootGOPATH) { - // Doesn't make sense to have regular files - // directly in your $GOPATH/src or $GOROOT/src. - // - // TODO(bcmills): there are many levels of directory within - // RootModuleCache where this also wouldn't make sense, - // Can we generalize this to any directory without a corresponding - // import path? - return - } - - if _, dup := w.added.LoadOrStore(dir, true); !dup { - w.add(w.root, dir) - } - } - - if !d.IsDir() { - return - } - - base := filepath.Base(path) - if base == "" || base[0] == '.' || base[0] == '_' || - base == "testdata" || - (w.root.Type == RootGOROOT && w.opts.ModulesEnabled && base == "vendor") || - (!w.opts.ModulesEnabled && base == "node_modules") || - w.shouldSkipDir(path) { - return - } - - // Read the directory and walk its entries. - - f, err := os.Open(path) - if err != nil { - w.opts.Logf("%v", err) - return - } - defer f.Close() - - for { - // We impose an arbitrary limit on the number of ReadDir results per - // directory to limit the amount of memory consumed for stale or upcoming - // directory entries. The limit trades off CPU (number of syscalls to read - // the whole directory) against RAM (reachable directory entries other than - // the one currently being processed). - // - // Since we process the directories recursively, we will end up maintaining - // a slice of entries for each level of the directory tree. - // (Compare https://go.dev/issue/36197.) - ents, err := f.ReadDir(1024) - if err != nil { - if err != io.EOF { - w.opts.Logf("%v", err) - } - break - } - - for _, d := range ents { - nextPath := filepath.Join(path, d.Name()) - if d.IsDir() { - select { - case w.sem <- struct{}{}: - // Got a new semaphore token, so we can traverse the directory concurrently. - d := d - w.walking.Add(1) - go func() { - defer func() { - <-w.sem - w.walking.Done() - }() - w.walk(nextPath, pathSymlinks, d) - }() - continue - - default: - // No tokens available, so traverse serially. - } - } - - w.walk(nextPath, pathSymlinks, d) - } - } -} diff --git a/vendor/golang.org/x/tools/internal/imports/fix.go b/vendor/golang.org/x/tools/internal/imports/fix.go deleted file mode 100644 index 93d49a6efd0..00000000000 --- a/vendor/golang.org/x/tools/internal/imports/fix.go +++ /dev/null @@ -1,1892 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package imports - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "go/ast" - "go/build" - "go/parser" - "go/token" - "go/types" - "io/fs" - "io/ioutil" - "os" - "path" - "path/filepath" - "reflect" - "sort" - "strconv" - "strings" - "sync" - "unicode" - "unicode/utf8" - - "golang.org/x/tools/go/ast/astutil" - "golang.org/x/tools/internal/event" - "golang.org/x/tools/internal/gocommand" - "golang.org/x/tools/internal/gopathwalk" - "golang.org/x/tools/internal/stdlib" -) - -// importToGroup is a list of functions which map from an import path to -// a group number. -var importToGroup = []func(localPrefix, importPath string) (num int, ok bool){ - func(localPrefix, importPath string) (num int, ok bool) { - if localPrefix == "" { - return - } - for _, p := range strings.Split(localPrefix, ",") { - if strings.HasPrefix(importPath, p) || strings.TrimSuffix(p, "/") == importPath { - return 3, true - } - } - return - }, - func(_, importPath string) (num int, ok bool) { - if strings.HasPrefix(importPath, "appengine") { - return 2, true - } - return - }, - func(_, importPath string) (num int, ok bool) { - firstComponent := strings.Split(importPath, "/")[0] - if strings.Contains(firstComponent, ".") { - return 1, true - } - return - }, -} - -func importGroup(localPrefix, importPath string) int { - for _, fn := range importToGroup { - if n, ok := fn(localPrefix, importPath); ok { - return n - } - } - return 0 -} - -type ImportFixType int - -const ( - AddImport ImportFixType = iota - DeleteImport - SetImportName -) - -type ImportFix struct { - // StmtInfo represents the import statement this fix will add, remove, or change. - StmtInfo ImportInfo - // IdentName is the identifier that this fix will add or remove. - IdentName string - // FixType is the type of fix this is (AddImport, DeleteImport, SetImportName). - FixType ImportFixType - Relevance float64 // see pkg -} - -// An ImportInfo represents a single import statement. -type ImportInfo struct { - ImportPath string // import path, e.g. "crypto/rand". - Name string // import name, e.g. "crand", or "" if none. -} - -// A packageInfo represents what's known about a package. -type packageInfo struct { - name string // real package name, if known. - exports map[string]bool // known exports. -} - -// parseOtherFiles parses all the Go files in srcDir except filename, including -// test files if filename looks like a test. -func parseOtherFiles(fset *token.FileSet, srcDir, filename string) []*ast.File { - // This could use go/packages but it doesn't buy much, and it fails - // with https://golang.org/issue/26296 in LoadFiles mode in some cases. - considerTests := strings.HasSuffix(filename, "_test.go") - - fileBase := filepath.Base(filename) - packageFileInfos, err := os.ReadDir(srcDir) - if err != nil { - return nil - } - - var files []*ast.File - for _, fi := range packageFileInfos { - if fi.Name() == fileBase || !strings.HasSuffix(fi.Name(), ".go") { - continue - } - if !considerTests && strings.HasSuffix(fi.Name(), "_test.go") { - continue - } - - f, err := parser.ParseFile(fset, filepath.Join(srcDir, fi.Name()), nil, 0) - if err != nil { - continue - } - - files = append(files, f) - } - - return files -} - -// addGlobals puts the names of package vars into the provided map. -func addGlobals(f *ast.File, globals map[string]bool) { - for _, decl := range f.Decls { - genDecl, ok := decl.(*ast.GenDecl) - if !ok { - continue - } - - for _, spec := range genDecl.Specs { - valueSpec, ok := spec.(*ast.ValueSpec) - if !ok { - continue - } - globals[valueSpec.Names[0].Name] = true - } - } -} - -// collectReferences builds a map of selector expressions, from -// left hand side (X) to a set of right hand sides (Sel). -func collectReferences(f *ast.File) references { - refs := references{} - - var visitor visitFn - visitor = func(node ast.Node) ast.Visitor { - if node == nil { - return visitor - } - switch v := node.(type) { - case *ast.SelectorExpr: - xident, ok := v.X.(*ast.Ident) - if !ok { - break - } - if xident.Obj != nil { - // If the parser can resolve it, it's not a package ref. - break - } - if !ast.IsExported(v.Sel.Name) { - // Whatever this is, it's not exported from a package. - break - } - pkgName := xident.Name - r := refs[pkgName] - if r == nil { - r = make(map[string]bool) - refs[pkgName] = r - } - r[v.Sel.Name] = true - } - return visitor - } - ast.Walk(visitor, f) - return refs -} - -// collectImports returns all the imports in f. -// Unnamed imports (., _) and "C" are ignored. -func collectImports(f *ast.File) []*ImportInfo { - var imports []*ImportInfo - for _, imp := range f.Imports { - var name string - if imp.Name != nil { - name = imp.Name.Name - } - if imp.Path.Value == `"C"` || name == "_" || name == "." { - continue - } - path := strings.Trim(imp.Path.Value, `"`) - imports = append(imports, &ImportInfo{ - Name: name, - ImportPath: path, - }) - } - return imports -} - -// findMissingImport searches pass's candidates for an import that provides -// pkg, containing all of syms. -func (p *pass) findMissingImport(pkg string, syms map[string]bool) *ImportInfo { - for _, candidate := range p.candidates { - pkgInfo, ok := p.knownPackages[candidate.ImportPath] - if !ok { - continue - } - if p.importIdentifier(candidate) != pkg { - continue - } - - allFound := true - for right := range syms { - if !pkgInfo.exports[right] { - allFound = false - break - } - } - - if allFound { - return candidate - } - } - return nil -} - -// references is set of references found in a Go file. The first map key is the -// left hand side of a selector expression, the second key is the right hand -// side, and the value should always be true. -type references map[string]map[string]bool - -// A pass contains all the inputs and state necessary to fix a file's imports. -// It can be modified in some ways during use; see comments below. -type pass struct { - // Inputs. These must be set before a call to load, and not modified after. - fset *token.FileSet // fset used to parse f and its siblings. - f *ast.File // the file being fixed. - srcDir string // the directory containing f. - env *ProcessEnv // the environment to use for go commands, etc. - loadRealPackageNames bool // if true, load package names from disk rather than guessing them. - otherFiles []*ast.File // sibling files. - - // Intermediate state, generated by load. - existingImports map[string][]*ImportInfo - allRefs references - missingRefs references - - // Inputs to fix. These can be augmented between successive fix calls. - lastTry bool // indicates that this is the last call and fix should clean up as best it can. - candidates []*ImportInfo // candidate imports in priority order. - knownPackages map[string]*packageInfo // information about all known packages. -} - -// loadPackageNames saves the package names for everything referenced by imports. -func (p *pass) loadPackageNames(imports []*ImportInfo) error { - if p.env.Logf != nil { - p.env.Logf("loading package names for %v packages", len(imports)) - defer func() { - p.env.Logf("done loading package names for %v packages", len(imports)) - }() - } - var unknown []string - for _, imp := range imports { - if _, ok := p.knownPackages[imp.ImportPath]; ok { - continue - } - unknown = append(unknown, imp.ImportPath) - } - - resolver, err := p.env.GetResolver() - if err != nil { - return err - } - - names, err := resolver.loadPackageNames(unknown, p.srcDir) - if err != nil { - return err - } - - for path, name := range names { - p.knownPackages[path] = &packageInfo{ - name: name, - exports: map[string]bool{}, - } - } - return nil -} - -// if there is a trailing major version, remove it -func withoutVersion(nm string) string { - if v := path.Base(nm); len(v) > 0 && v[0] == 'v' { - if _, err := strconv.Atoi(v[1:]); err == nil { - // this is, for instance, called with rand/v2 and returns rand - if len(v) < len(nm) { - xnm := nm[:len(nm)-len(v)-1] - return path.Base(xnm) - } - } - } - return nm -} - -// importIdentifier returns the identifier that imp will introduce. It will -// guess if the package name has not been loaded, e.g. because the source -// is not available. -func (p *pass) importIdentifier(imp *ImportInfo) string { - if imp.Name != "" { - return imp.Name - } - known := p.knownPackages[imp.ImportPath] - if known != nil && known.name != "" { - return withoutVersion(known.name) - } - return ImportPathToAssumedName(imp.ImportPath) -} - -// load reads in everything necessary to run a pass, and reports whether the -// file already has all the imports it needs. It fills in p.missingRefs with the -// file's missing symbols, if any, or removes unused imports if not. -func (p *pass) load() ([]*ImportFix, bool) { - p.knownPackages = map[string]*packageInfo{} - p.missingRefs = references{} - p.existingImports = map[string][]*ImportInfo{} - - // Load basic information about the file in question. - p.allRefs = collectReferences(p.f) - - // Load stuff from other files in the same package: - // global variables so we know they don't need resolving, and imports - // that we might want to mimic. - globals := map[string]bool{} - for _, otherFile := range p.otherFiles { - // Don't load globals from files that are in the same directory - // but a different package. Using them to suggest imports is OK. - if p.f.Name.Name == otherFile.Name.Name { - addGlobals(otherFile, globals) - } - p.candidates = append(p.candidates, collectImports(otherFile)...) - } - - // Resolve all the import paths we've seen to package names, and store - // f's imports by the identifier they introduce. - imports := collectImports(p.f) - if p.loadRealPackageNames { - err := p.loadPackageNames(append(imports, p.candidates...)) - if err != nil { - if p.env.Logf != nil { - p.env.Logf("loading package names: %v", err) - } - return nil, false - } - } - for _, imp := range imports { - p.existingImports[p.importIdentifier(imp)] = append(p.existingImports[p.importIdentifier(imp)], imp) - } - - // Find missing references. - for left, rights := range p.allRefs { - if globals[left] { - continue - } - _, ok := p.existingImports[left] - if !ok { - p.missingRefs[left] = rights - continue - } - } - if len(p.missingRefs) != 0 { - return nil, false - } - - return p.fix() -} - -// fix attempts to satisfy missing imports using p.candidates. If it finds -// everything, or if p.lastTry is true, it updates fixes to add the imports it found, -// delete anything unused, and update import names, and returns true. -func (p *pass) fix() ([]*ImportFix, bool) { - // Find missing imports. - var selected []*ImportInfo - for left, rights := range p.missingRefs { - if imp := p.findMissingImport(left, rights); imp != nil { - selected = append(selected, imp) - } - } - - if !p.lastTry && len(selected) != len(p.missingRefs) { - return nil, false - } - - // Found everything, or giving up. Add the new imports and remove any unused. - var fixes []*ImportFix - for _, identifierImports := range p.existingImports { - for _, imp := range identifierImports { - // We deliberately ignore globals here, because we can't be sure - // they're in the same package. People do things like put multiple - // main packages in the same directory, and we don't want to - // remove imports if they happen to have the same name as a var in - // a different package. - if _, ok := p.allRefs[p.importIdentifier(imp)]; !ok { - fixes = append(fixes, &ImportFix{ - StmtInfo: *imp, - IdentName: p.importIdentifier(imp), - FixType: DeleteImport, - }) - continue - } - - // An existing import may need to update its import name to be correct. - if name := p.importSpecName(imp); name != imp.Name { - fixes = append(fixes, &ImportFix{ - StmtInfo: ImportInfo{ - Name: name, - ImportPath: imp.ImportPath, - }, - IdentName: p.importIdentifier(imp), - FixType: SetImportName, - }) - } - } - } - // Collecting fixes involved map iteration, so sort for stability. See - // golang/go#59976. - sortFixes(fixes) - - // collect selected fixes in a separate slice, so that it can be sorted - // separately. Note that these fixes must occur after fixes to existing - // imports. TODO(rfindley): figure out why. - var selectedFixes []*ImportFix - for _, imp := range selected { - selectedFixes = append(selectedFixes, &ImportFix{ - StmtInfo: ImportInfo{ - Name: p.importSpecName(imp), - ImportPath: imp.ImportPath, - }, - IdentName: p.importIdentifier(imp), - FixType: AddImport, - }) - } - sortFixes(selectedFixes) - - return append(fixes, selectedFixes...), true -} - -func sortFixes(fixes []*ImportFix) { - sort.Slice(fixes, func(i, j int) bool { - fi, fj := fixes[i], fixes[j] - if fi.StmtInfo.ImportPath != fj.StmtInfo.ImportPath { - return fi.StmtInfo.ImportPath < fj.StmtInfo.ImportPath - } - if fi.StmtInfo.Name != fj.StmtInfo.Name { - return fi.StmtInfo.Name < fj.StmtInfo.Name - } - if fi.IdentName != fj.IdentName { - return fi.IdentName < fj.IdentName - } - return fi.FixType < fj.FixType - }) -} - -// importSpecName gets the import name of imp in the import spec. -// -// When the import identifier matches the assumed import name, the import name does -// not appear in the import spec. -func (p *pass) importSpecName(imp *ImportInfo) string { - // If we did not load the real package names, or the name is already set, - // we just return the existing name. - if !p.loadRealPackageNames || imp.Name != "" { - return imp.Name - } - - ident := p.importIdentifier(imp) - if ident == ImportPathToAssumedName(imp.ImportPath) { - return "" // ident not needed since the assumed and real names are the same. - } - return ident -} - -// apply will perform the fixes on f in order. -func apply(fset *token.FileSet, f *ast.File, fixes []*ImportFix) { - for _, fix := range fixes { - switch fix.FixType { - case DeleteImport: - astutil.DeleteNamedImport(fset, f, fix.StmtInfo.Name, fix.StmtInfo.ImportPath) - case AddImport: - astutil.AddNamedImport(fset, f, fix.StmtInfo.Name, fix.StmtInfo.ImportPath) - case SetImportName: - // Find the matching import path and change the name. - for _, spec := range f.Imports { - path := strings.Trim(spec.Path.Value, `"`) - if path == fix.StmtInfo.ImportPath { - spec.Name = &ast.Ident{ - Name: fix.StmtInfo.Name, - NamePos: spec.Pos(), - } - } - } - } - } -} - -// assumeSiblingImportsValid assumes that siblings' use of packages is valid, -// adding the exports they use. -func (p *pass) assumeSiblingImportsValid() { - for _, f := range p.otherFiles { - refs := collectReferences(f) - imports := collectImports(f) - importsByName := map[string]*ImportInfo{} - for _, imp := range imports { - importsByName[p.importIdentifier(imp)] = imp - } - for left, rights := range refs { - if imp, ok := importsByName[left]; ok { - if m, ok := stdlib.PackageSymbols[imp.ImportPath]; ok { - // We have the stdlib in memory; no need to guess. - rights = symbolNameSet(m) - } - p.addCandidate(imp, &packageInfo{ - // no name; we already know it. - exports: rights, - }) - } - } - } -} - -// addCandidate adds a candidate import to p, and merges in the information -// in pkg. -func (p *pass) addCandidate(imp *ImportInfo, pkg *packageInfo) { - p.candidates = append(p.candidates, imp) - if existing, ok := p.knownPackages[imp.ImportPath]; ok { - if existing.name == "" { - existing.name = pkg.name - } - for export := range pkg.exports { - existing.exports[export] = true - } - } else { - p.knownPackages[imp.ImportPath] = pkg - } -} - -// fixImports adds and removes imports from f so that all its references are -// satisfied and there are no unused imports. -// -// This is declared as a variable rather than a function so goimports can -// easily be extended by adding a file with an init function. -var fixImports = fixImportsDefault - -func fixImportsDefault(fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) error { - fixes, err := getFixes(context.Background(), fset, f, filename, env) - if err != nil { - return err - } - apply(fset, f, fixes) - return err -} - -// getFixes gets the import fixes that need to be made to f in order to fix the imports. -// It does not modify the ast. -func getFixes(ctx context.Context, fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) ([]*ImportFix, error) { - abs, err := filepath.Abs(filename) - if err != nil { - return nil, err - } - srcDir := filepath.Dir(abs) - if env.Logf != nil { - env.Logf("fixImports(filename=%q), abs=%q, srcDir=%q ...", filename, abs, srcDir) - } - - // First pass: looking only at f, and using the naive algorithm to - // derive package names from import paths, see if the file is already - // complete. We can't add any imports yet, because we don't know - // if missing references are actually package vars. - p := &pass{fset: fset, f: f, srcDir: srcDir, env: env} - if fixes, done := p.load(); done { - return fixes, nil - } - - otherFiles := parseOtherFiles(fset, srcDir, filename) - - // Second pass: add information from other files in the same package, - // like their package vars and imports. - p.otherFiles = otherFiles - if fixes, done := p.load(); done { - return fixes, nil - } - - // Now we can try adding imports from the stdlib. - p.assumeSiblingImportsValid() - addStdlibCandidates(p, p.missingRefs) - if fixes, done := p.fix(); done { - return fixes, nil - } - - // Third pass: get real package names where we had previously used - // the naive algorithm. - p = &pass{fset: fset, f: f, srcDir: srcDir, env: env} - p.loadRealPackageNames = true - p.otherFiles = otherFiles - if fixes, done := p.load(); done { - return fixes, nil - } - - if err := addStdlibCandidates(p, p.missingRefs); err != nil { - return nil, err - } - p.assumeSiblingImportsValid() - if fixes, done := p.fix(); done { - return fixes, nil - } - - // Go look for candidates in $GOPATH, etc. We don't necessarily load - // the real exports of sibling imports, so keep assuming their contents. - if err := addExternalCandidates(ctx, p, p.missingRefs, filename); err != nil { - return nil, err - } - - p.lastTry = true - fixes, _ := p.fix() - return fixes, nil -} - -// MaxRelevance is the highest relevance, used for the standard library. -// Chosen arbitrarily to match pre-existing gopls code. -const MaxRelevance = 7.0 - -// getCandidatePkgs works with the passed callback to find all acceptable packages. -// It deduplicates by import path, and uses a cached stdlib rather than reading -// from disk. -func getCandidatePkgs(ctx context.Context, wrappedCallback *scanCallback, filename, filePkg string, env *ProcessEnv) error { - notSelf := func(p *pkg) bool { - return p.packageName != filePkg || p.dir != filepath.Dir(filename) - } - goenv, err := env.goEnv() - if err != nil { - return err - } - - var mu sync.Mutex // to guard asynchronous access to dupCheck - dupCheck := map[string]struct{}{} - - // Start off with the standard library. - for importPath, symbols := range stdlib.PackageSymbols { - p := &pkg{ - dir: filepath.Join(goenv["GOROOT"], "src", importPath), - importPathShort: importPath, - packageName: path.Base(importPath), - relevance: MaxRelevance, - } - dupCheck[importPath] = struct{}{} - if notSelf(p) && wrappedCallback.dirFound(p) && wrappedCallback.packageNameLoaded(p) { - var exports []stdlib.Symbol - for _, sym := range symbols { - switch sym.Kind { - case stdlib.Func, stdlib.Type, stdlib.Var, stdlib.Const: - exports = append(exports, sym) - } - } - wrappedCallback.exportsLoaded(p, exports) - } - } - - scanFilter := &scanCallback{ - rootFound: func(root gopathwalk.Root) bool { - // Exclude goroot results -- getting them is relatively expensive, not cached, - // and generally redundant with the in-memory version. - return root.Type != gopathwalk.RootGOROOT && wrappedCallback.rootFound(root) - }, - dirFound: wrappedCallback.dirFound, - packageNameLoaded: func(pkg *pkg) bool { - mu.Lock() - defer mu.Unlock() - if _, ok := dupCheck[pkg.importPathShort]; ok { - return false - } - dupCheck[pkg.importPathShort] = struct{}{} - return notSelf(pkg) && wrappedCallback.packageNameLoaded(pkg) - }, - exportsLoaded: func(pkg *pkg, exports []stdlib.Symbol) { - // If we're an x_test, load the package under test's test variant. - if strings.HasSuffix(filePkg, "_test") && pkg.dir == filepath.Dir(filename) { - var err error - _, exports, err = loadExportsFromFiles(ctx, env, pkg.dir, true) - if err != nil { - return - } - } - wrappedCallback.exportsLoaded(pkg, exports) - }, - } - resolver, err := env.GetResolver() - if err != nil { - return err - } - return resolver.scan(ctx, scanFilter) -} - -func ScoreImportPaths(ctx context.Context, env *ProcessEnv, paths []string) (map[string]float64, error) { - result := make(map[string]float64) - resolver, err := env.GetResolver() - if err != nil { - return nil, err - } - for _, path := range paths { - result[path] = resolver.scoreImportPath(ctx, path) - } - return result, nil -} - -func PrimeCache(ctx context.Context, resolver Resolver) error { - // Fully scan the disk for directories, but don't actually read any Go files. - callback := &scanCallback{ - rootFound: func(root gopathwalk.Root) bool { - // See getCandidatePkgs: walking GOROOT is apparently expensive and - // unnecessary. - return root.Type != gopathwalk.RootGOROOT - }, - dirFound: func(pkg *pkg) bool { - return false - }, - // packageNameLoaded and exportsLoaded must never be called. - } - - return resolver.scan(ctx, callback) -} - -func candidateImportName(pkg *pkg) string { - if ImportPathToAssumedName(pkg.importPathShort) != pkg.packageName { - return pkg.packageName - } - return "" -} - -// GetAllCandidates calls wrapped for each package whose name starts with -// searchPrefix, and can be imported from filename with the package name filePkg. -// -// Beware that the wrapped function may be called multiple times concurrently. -// TODO(adonovan): encapsulate the concurrency. -func GetAllCandidates(ctx context.Context, wrapped func(ImportFix), searchPrefix, filename, filePkg string, env *ProcessEnv) error { - callback := &scanCallback{ - rootFound: func(gopathwalk.Root) bool { - return true - }, - dirFound: func(pkg *pkg) bool { - if !canUse(filename, pkg.dir) { - return false - } - // Try the assumed package name first, then a simpler path match - // in case of packages named vN, which are not uncommon. - return strings.HasPrefix(ImportPathToAssumedName(pkg.importPathShort), searchPrefix) || - strings.HasPrefix(path.Base(pkg.importPathShort), searchPrefix) - }, - packageNameLoaded: func(pkg *pkg) bool { - if !strings.HasPrefix(pkg.packageName, searchPrefix) { - return false - } - wrapped(ImportFix{ - StmtInfo: ImportInfo{ - ImportPath: pkg.importPathShort, - Name: candidateImportName(pkg), - }, - IdentName: pkg.packageName, - FixType: AddImport, - Relevance: pkg.relevance, - }) - return false - }, - } - return getCandidatePkgs(ctx, callback, filename, filePkg, env) -} - -// GetImportPaths calls wrapped for each package whose import path starts with -// searchPrefix, and can be imported from filename with the package name filePkg. -func GetImportPaths(ctx context.Context, wrapped func(ImportFix), searchPrefix, filename, filePkg string, env *ProcessEnv) error { - callback := &scanCallback{ - rootFound: func(gopathwalk.Root) bool { - return true - }, - dirFound: func(pkg *pkg) bool { - if !canUse(filename, pkg.dir) { - return false - } - return strings.HasPrefix(pkg.importPathShort, searchPrefix) - }, - packageNameLoaded: func(pkg *pkg) bool { - wrapped(ImportFix{ - StmtInfo: ImportInfo{ - ImportPath: pkg.importPathShort, - Name: candidateImportName(pkg), - }, - IdentName: pkg.packageName, - FixType: AddImport, - Relevance: pkg.relevance, - }) - return false - }, - } - return getCandidatePkgs(ctx, callback, filename, filePkg, env) -} - -// A PackageExport is a package and its exports. -type PackageExport struct { - Fix *ImportFix - Exports []stdlib.Symbol -} - -// GetPackageExports returns all known packages with name pkg and their exports. -func GetPackageExports(ctx context.Context, wrapped func(PackageExport), searchPkg, filename, filePkg string, env *ProcessEnv) error { - callback := &scanCallback{ - rootFound: func(gopathwalk.Root) bool { - return true - }, - dirFound: func(pkg *pkg) bool { - return pkgIsCandidate(filename, references{searchPkg: nil}, pkg) - }, - packageNameLoaded: func(pkg *pkg) bool { - return pkg.packageName == searchPkg - }, - exportsLoaded: func(pkg *pkg, exports []stdlib.Symbol) { - sortSymbols(exports) - wrapped(PackageExport{ - Fix: &ImportFix{ - StmtInfo: ImportInfo{ - ImportPath: pkg.importPathShort, - Name: candidateImportName(pkg), - }, - IdentName: pkg.packageName, - FixType: AddImport, - Relevance: pkg.relevance, - }, - Exports: exports, - }) - }, - } - return getCandidatePkgs(ctx, callback, filename, filePkg, env) -} - -// TODO(rfindley): we should depend on GOOS and GOARCH, to provide accurate -// imports when doing cross-platform development. -var requiredGoEnvVars = []string{ - "GO111MODULE", - "GOFLAGS", - "GOINSECURE", - "GOMOD", - "GOMODCACHE", - "GONOPROXY", - "GONOSUMDB", - "GOPATH", - "GOPROXY", - "GOROOT", - "GOSUMDB", - "GOWORK", -} - -// ProcessEnv contains environment variables and settings that affect the use of -// the go command, the go/build package, etc. -// -// ...a ProcessEnv *also* overwrites its Env along with derived state in the -// form of the resolver. And because it is lazily initialized, an env may just -// be broken and unusable, but there is no way for the caller to detect that: -// all queries will just fail. -// -// TODO(rfindley): refactor this package so that this type (perhaps renamed to -// just Env or Config) is an immutable configuration struct, to be exchanged -// for an initialized object via a constructor that returns an error. Perhaps -// the signature should be `func NewResolver(*Env) (*Resolver, error)`, where -// resolver is a concrete type used for resolving imports. Via this -// refactoring, we can avoid the need to call ProcessEnv.init and -// ProcessEnv.GoEnv everywhere, and implicitly fix all the places where this -// these are misused. Also, we'd delegate the caller the decision of how to -// handle a broken environment. -type ProcessEnv struct { - GocmdRunner *gocommand.Runner - - BuildFlags []string - ModFlag string - - // SkipPathInScan returns true if the path should be skipped from scans of - // the RootCurrentModule root type. The function argument is a clean, - // absolute path. - SkipPathInScan func(string) bool - - // Env overrides the OS environment, and can be used to specify - // GOPROXY, GO111MODULE, etc. PATH cannot be set here, because - // exec.Command will not honor it. - // Specifying all of requiredGoEnvVars avoids a call to `go env`. - Env map[string]string - - WorkingDir string - - // If Logf is non-nil, debug logging is enabled through this function. - Logf func(format string, args ...interface{}) - - // If set, ModCache holds a shared cache of directory info to use across - // multiple ProcessEnvs. - ModCache *DirInfoCache - - initialized bool // see TODO above - - // resolver and resolverErr are lazily evaluated (see GetResolver). - // This is unclean, but see the big TODO in the docstring for ProcessEnv - // above: for now, we can't be sure that the ProcessEnv is fully initialized. - resolver Resolver - resolverErr error -} - -func (e *ProcessEnv) goEnv() (map[string]string, error) { - if err := e.init(); err != nil { - return nil, err - } - return e.Env, nil -} - -func (e *ProcessEnv) matchFile(dir, name string) (bool, error) { - bctx, err := e.buildContext() - if err != nil { - return false, err - } - return bctx.MatchFile(dir, name) -} - -// CopyConfig copies the env's configuration into a new env. -func (e *ProcessEnv) CopyConfig() *ProcessEnv { - copy := &ProcessEnv{ - GocmdRunner: e.GocmdRunner, - initialized: e.initialized, - BuildFlags: e.BuildFlags, - Logf: e.Logf, - WorkingDir: e.WorkingDir, - resolver: nil, - Env: map[string]string{}, - } - for k, v := range e.Env { - copy.Env[k] = v - } - return copy -} - -func (e *ProcessEnv) init() error { - if e.initialized { - return nil - } - - foundAllRequired := true - for _, k := range requiredGoEnvVars { - if _, ok := e.Env[k]; !ok { - foundAllRequired = false - break - } - } - if foundAllRequired { - e.initialized = true - return nil - } - - if e.Env == nil { - e.Env = map[string]string{} - } - - goEnv := map[string]string{} - stdout, err := e.invokeGo(context.TODO(), "env", append([]string{"-json"}, requiredGoEnvVars...)...) - if err != nil { - return err - } - if err := json.Unmarshal(stdout.Bytes(), &goEnv); err != nil { - return err - } - for k, v := range goEnv { - e.Env[k] = v - } - e.initialized = true - return nil -} - -func (e *ProcessEnv) env() []string { - var env []string // the gocommand package will prepend os.Environ. - for k, v := range e.Env { - env = append(env, k+"="+v) - } - return env -} - -func (e *ProcessEnv) GetResolver() (Resolver, error) { - if err := e.init(); err != nil { - return nil, err - } - - if e.resolver == nil && e.resolverErr == nil { - // TODO(rfindley): we should only use a gopathResolver here if the working - // directory is actually *in* GOPATH. (I seem to recall an open gopls issue - // for this behavior, but I can't find it). - // - // For gopls, we can optionally explicitly choose a resolver type, since we - // already know the view type. - if len(e.Env["GOMOD"]) == 0 && len(e.Env["GOWORK"]) == 0 { - e.resolver = newGopathResolver(e) - } else if r, err := newModuleResolver(e, e.ModCache); err != nil { - e.resolverErr = err - } else { - e.resolver = Resolver(r) - } - } - - return e.resolver, e.resolverErr -} - -// buildContext returns the build.Context to use for matching files. -// -// TODO(rfindley): support dynamic GOOS, GOARCH here, when doing cross-platform -// development. -func (e *ProcessEnv) buildContext() (*build.Context, error) { - ctx := build.Default - goenv, err := e.goEnv() - if err != nil { - return nil, err - } - ctx.GOROOT = goenv["GOROOT"] - ctx.GOPATH = goenv["GOPATH"] - - // As of Go 1.14, build.Context has a Dir field - // (see golang.org/issue/34860). - // Populate it only if present. - rc := reflect.ValueOf(&ctx).Elem() - dir := rc.FieldByName("Dir") - if dir.IsValid() && dir.Kind() == reflect.String { - dir.SetString(e.WorkingDir) - } - - // Since Go 1.11, go/build.Context.Import may invoke 'go list' depending on - // the value in GO111MODULE in the process's environment. We always want to - // run in GOPATH mode when calling Import, so we need to prevent this from - // happening. In Go 1.16, GO111MODULE defaults to "on", so this problem comes - // up more frequently. - // - // HACK: setting any of the Context I/O hooks prevents Import from invoking - // 'go list', regardless of GO111MODULE. This is undocumented, but it's - // unlikely to change before GOPATH support is removed. - ctx.ReadDir = ioutil.ReadDir - - return &ctx, nil -} - -func (e *ProcessEnv) invokeGo(ctx context.Context, verb string, args ...string) (*bytes.Buffer, error) { - inv := gocommand.Invocation{ - Verb: verb, - Args: args, - BuildFlags: e.BuildFlags, - Env: e.env(), - Logf: e.Logf, - WorkingDir: e.WorkingDir, - } - return e.GocmdRunner.Run(ctx, inv) -} - -func addStdlibCandidates(pass *pass, refs references) error { - goenv, err := pass.env.goEnv() - if err != nil { - return err - } - localbase := func(nm string) string { - ans := path.Base(nm) - if ans[0] == 'v' { - // this is called, for instance, with math/rand/v2 and returns rand/v2 - if _, err := strconv.Atoi(ans[1:]); err == nil { - ix := strings.LastIndex(nm, ans) - more := path.Base(nm[:ix]) - ans = path.Join(more, ans) - } - } - return ans - } - add := func(pkg string) { - // Prevent self-imports. - if path.Base(pkg) == pass.f.Name.Name && filepath.Join(goenv["GOROOT"], "src", pkg) == pass.srcDir { - return - } - exports := symbolNameSet(stdlib.PackageSymbols[pkg]) - pass.addCandidate( - &ImportInfo{ImportPath: pkg}, - &packageInfo{name: localbase(pkg), exports: exports}) - } - for left := range refs { - if left == "rand" { - // Make sure we try crypto/rand before any version of math/rand as both have Int() - // and our policy is to recommend crypto - add("crypto/rand") - // if the user's no later than go1.21, this should be "math/rand" - // but we have no way of figuring out what the user is using - // TODO: investigate using the toolchain version to disambiguate in the stdlib - add("math/rand/v2") - continue - } - for importPath := range stdlib.PackageSymbols { - if path.Base(importPath) == left { - add(importPath) - } - } - } - return nil -} - -// A Resolver does the build-system-specific parts of goimports. -type Resolver interface { - // loadPackageNames loads the package names in importPaths. - loadPackageNames(importPaths []string, srcDir string) (map[string]string, error) - - // scan works with callback to search for packages. See scanCallback for details. - scan(ctx context.Context, callback *scanCallback) error - - // loadExports returns the set of exported symbols in the package at dir. - // loadExports may be called concurrently. - loadExports(ctx context.Context, pkg *pkg, includeTest bool) (string, []stdlib.Symbol, error) - - // scoreImportPath returns the relevance for an import path. - scoreImportPath(ctx context.Context, path string) float64 - - // ClearForNewScan returns a new Resolver based on the receiver that has - // cleared its internal caches of directory contents. - // - // The new resolver should be primed and then set via - // [ProcessEnv.UpdateResolver]. - ClearForNewScan() Resolver -} - -// A scanCallback controls a call to scan and receives its results. -// In general, minor errors will be silently discarded; a user should not -// expect to receive a full series of calls for everything. -type scanCallback struct { - // rootFound is called before scanning a new root dir. If it returns true, - // the root will be scanned. Returning false will not necessarily prevent - // directories from that root making it to dirFound. - rootFound func(gopathwalk.Root) bool - // dirFound is called when a directory is found that is possibly a Go package. - // pkg will be populated with everything except packageName. - // If it returns true, the package's name will be loaded. - dirFound func(pkg *pkg) bool - // packageNameLoaded is called when a package is found and its name is loaded. - // If it returns true, the package's exports will be loaded. - packageNameLoaded func(pkg *pkg) bool - // exportsLoaded is called when a package's exports have been loaded. - exportsLoaded func(pkg *pkg, exports []stdlib.Symbol) -} - -func addExternalCandidates(ctx context.Context, pass *pass, refs references, filename string) error { - ctx, done := event.Start(ctx, "imports.addExternalCandidates") - defer done() - - var mu sync.Mutex - found := make(map[string][]pkgDistance) - callback := &scanCallback{ - rootFound: func(gopathwalk.Root) bool { - return true // We want everything. - }, - dirFound: func(pkg *pkg) bool { - return pkgIsCandidate(filename, refs, pkg) - }, - packageNameLoaded: func(pkg *pkg) bool { - if _, want := refs[pkg.packageName]; !want { - return false - } - if pkg.dir == pass.srcDir && pass.f.Name.Name == pkg.packageName { - // The candidate is in the same directory and has the - // same package name. Don't try to import ourselves. - return false - } - if !canUse(filename, pkg.dir) { - return false - } - mu.Lock() - defer mu.Unlock() - found[pkg.packageName] = append(found[pkg.packageName], pkgDistance{pkg, distance(pass.srcDir, pkg.dir)}) - return false // We'll do our own loading after we sort. - }, - } - resolver, err := pass.env.GetResolver() - if err != nil { - return err - } - if err = resolver.scan(context.Background(), callback); err != nil { - return err - } - - // Search for imports matching potential package references. - type result struct { - imp *ImportInfo - pkg *packageInfo - } - results := make(chan result, len(refs)) - - ctx, cancel := context.WithCancel(context.TODO()) - var wg sync.WaitGroup - defer func() { - cancel() - wg.Wait() - }() - var ( - firstErr error - firstErrOnce sync.Once - ) - for pkgName, symbols := range refs { - wg.Add(1) - go func(pkgName string, symbols map[string]bool) { - defer wg.Done() - - found, err := findImport(ctx, pass, found[pkgName], pkgName, symbols) - - if err != nil { - firstErrOnce.Do(func() { - firstErr = err - cancel() - }) - return - } - - if found == nil { - return // No matching package. - } - - imp := &ImportInfo{ - ImportPath: found.importPathShort, - } - - pkg := &packageInfo{ - name: pkgName, - exports: symbols, - } - results <- result{imp, pkg} - }(pkgName, symbols) - } - go func() { - wg.Wait() - close(results) - }() - - for result := range results { - // Don't offer completions that would shadow predeclared - // names, such as github.com/coreos/etcd/error. - if types.Universe.Lookup(result.pkg.name) != nil { // predeclared - // Ideally we would skip this candidate only - // if the predeclared name is actually - // referenced by the file, but that's a lot - // trickier to compute and would still create - // an import that is likely to surprise the - // user before long. - continue - } - pass.addCandidate(result.imp, result.pkg) - } - return firstErr -} - -// notIdentifier reports whether ch is an invalid identifier character. -func notIdentifier(ch rune) bool { - return !('a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || - '0' <= ch && ch <= '9' || - ch == '_' || - ch >= utf8.RuneSelf && (unicode.IsLetter(ch) || unicode.IsDigit(ch))) -} - -// ImportPathToAssumedName returns the assumed package name of an import path. -// It does this using only string parsing of the import path. -// It picks the last element of the path that does not look like a major -// version, and then picks the valid identifier off the start of that element. -// It is used to determine if a local rename should be added to an import for -// clarity. -// This function could be moved to a standard package and exported if we want -// for use in other tools. -func ImportPathToAssumedName(importPath string) string { - base := path.Base(importPath) - if strings.HasPrefix(base, "v") { - if _, err := strconv.Atoi(base[1:]); err == nil { - dir := path.Dir(importPath) - if dir != "." { - base = path.Base(dir) - } - } - } - base = strings.TrimPrefix(base, "go-") - if i := strings.IndexFunc(base, notIdentifier); i >= 0 { - base = base[:i] - } - return base -} - -// gopathResolver implements resolver for GOPATH workspaces. -type gopathResolver struct { - env *ProcessEnv - walked bool - cache *DirInfoCache - scanSema chan struct{} // scanSema prevents concurrent scans. -} - -func newGopathResolver(env *ProcessEnv) *gopathResolver { - r := &gopathResolver{ - env: env, - cache: NewDirInfoCache(), - scanSema: make(chan struct{}, 1), - } - r.scanSema <- struct{}{} - return r -} - -func (r *gopathResolver) ClearForNewScan() Resolver { - return newGopathResolver(r.env) -} - -func (r *gopathResolver) loadPackageNames(importPaths []string, srcDir string) (map[string]string, error) { - names := map[string]string{} - bctx, err := r.env.buildContext() - if err != nil { - return nil, err - } - for _, path := range importPaths { - names[path] = importPathToName(bctx, path, srcDir) - } - return names, nil -} - -// importPathToName finds out the actual package name, as declared in its .go files. -func importPathToName(bctx *build.Context, importPath, srcDir string) string { - // Fast path for standard library without going to disk. - if stdlib.HasPackage(importPath) { - return path.Base(importPath) // stdlib packages always match their paths. - } - - buildPkg, err := bctx.Import(importPath, srcDir, build.FindOnly) - if err != nil { - return "" - } - pkgName, err := packageDirToName(buildPkg.Dir) - if err != nil { - return "" - } - return pkgName -} - -// packageDirToName is a faster version of build.Import if -// the only thing desired is the package name. Given a directory, -// packageDirToName then only parses one file in the package, -// trusting that the files in the directory are consistent. -func packageDirToName(dir string) (packageName string, err error) { - d, err := os.Open(dir) - if err != nil { - return "", err - } - names, err := d.Readdirnames(-1) - d.Close() - if err != nil { - return "", err - } - sort.Strings(names) // to have predictable behavior - var lastErr error - var nfile int - for _, name := range names { - if !strings.HasSuffix(name, ".go") { - continue - } - if strings.HasSuffix(name, "_test.go") { - continue - } - nfile++ - fullFile := filepath.Join(dir, name) - - fset := token.NewFileSet() - f, err := parser.ParseFile(fset, fullFile, nil, parser.PackageClauseOnly) - if err != nil { - lastErr = err - continue - } - pkgName := f.Name.Name - if pkgName == "documentation" { - // Special case from go/build.ImportDir, not - // handled by ctx.MatchFile. - continue - } - if pkgName == "main" { - // Also skip package main, assuming it's a +build ignore generator or example. - // Since you can't import a package main anyway, there's no harm here. - continue - } - return pkgName, nil - } - if lastErr != nil { - return "", lastErr - } - return "", fmt.Errorf("no importable package found in %d Go files", nfile) -} - -type pkg struct { - dir string // absolute file path to pkg directory ("/usr/lib/go/src/net/http") - importPathShort string // vendorless import path ("net/http", "a/b") - packageName string // package name loaded from source if requested - relevance float64 // a weakly-defined score of how relevant a package is. 0 is most relevant. -} - -type pkgDistance struct { - pkg *pkg - distance int // relative distance to target -} - -// byDistanceOrImportPathShortLength sorts by relative distance breaking ties -// on the short import path length and then the import string itself. -type byDistanceOrImportPathShortLength []pkgDistance - -func (s byDistanceOrImportPathShortLength) Len() int { return len(s) } -func (s byDistanceOrImportPathShortLength) Less(i, j int) bool { - di, dj := s[i].distance, s[j].distance - if di == -1 { - return false - } - if dj == -1 { - return true - } - if di != dj { - return di < dj - } - - vi, vj := s[i].pkg.importPathShort, s[j].pkg.importPathShort - if len(vi) != len(vj) { - return len(vi) < len(vj) - } - return vi < vj -} -func (s byDistanceOrImportPathShortLength) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -func distance(basepath, targetpath string) int { - p, err := filepath.Rel(basepath, targetpath) - if err != nil { - return -1 - } - if p == "." { - return 0 - } - return strings.Count(p, string(filepath.Separator)) + 1 -} - -func (r *gopathResolver) scan(ctx context.Context, callback *scanCallback) error { - add := func(root gopathwalk.Root, dir string) { - // We assume cached directories have not changed. We can skip them and their - // children. - if _, ok := r.cache.Load(dir); ok { - return - } - - importpath := filepath.ToSlash(dir[len(root.Path)+len("/"):]) - info := directoryPackageInfo{ - status: directoryScanned, - dir: dir, - rootType: root.Type, - nonCanonicalImportPath: VendorlessPath(importpath), - } - r.cache.Store(dir, info) - } - processDir := func(info directoryPackageInfo) { - // Skip this directory if we were not able to get the package information successfully. - if scanned, err := info.reachedStatus(directoryScanned); !scanned || err != nil { - return - } - - p := &pkg{ - importPathShort: info.nonCanonicalImportPath, - dir: info.dir, - relevance: MaxRelevance - 1, - } - if info.rootType == gopathwalk.RootGOROOT { - p.relevance = MaxRelevance - } - - if !callback.dirFound(p) { - return - } - var err error - p.packageName, err = r.cache.CachePackageName(info) - if err != nil { - return - } - - if !callback.packageNameLoaded(p) { - return - } - if _, exports, err := r.loadExports(ctx, p, false); err == nil { - callback.exportsLoaded(p, exports) - } - } - stop := r.cache.ScanAndListen(ctx, processDir) - defer stop() - - goenv, err := r.env.goEnv() - if err != nil { - return err - } - var roots []gopathwalk.Root - roots = append(roots, gopathwalk.Root{Path: filepath.Join(goenv["GOROOT"], "src"), Type: gopathwalk.RootGOROOT}) - for _, p := range filepath.SplitList(goenv["GOPATH"]) { - roots = append(roots, gopathwalk.Root{Path: filepath.Join(p, "src"), Type: gopathwalk.RootGOPATH}) - } - // The callback is not necessarily safe to use in the goroutine below. Process roots eagerly. - roots = filterRoots(roots, callback.rootFound) - // We can't cancel walks, because we need them to finish to have a usable - // cache. Instead, run them in a separate goroutine and detach. - scanDone := make(chan struct{}) - go func() { - select { - case <-ctx.Done(): - return - case <-r.scanSema: - } - defer func() { r.scanSema <- struct{}{} }() - gopathwalk.Walk(roots, add, gopathwalk.Options{Logf: r.env.Logf, ModulesEnabled: false}) - close(scanDone) - }() - select { - case <-ctx.Done(): - case <-scanDone: - } - return nil -} - -func (r *gopathResolver) scoreImportPath(ctx context.Context, path string) float64 { - if stdlib.HasPackage(path) { - return MaxRelevance - } - return MaxRelevance - 1 -} - -func filterRoots(roots []gopathwalk.Root, include func(gopathwalk.Root) bool) []gopathwalk.Root { - var result []gopathwalk.Root - for _, root := range roots { - if !include(root) { - continue - } - result = append(result, root) - } - return result -} - -func (r *gopathResolver) loadExports(ctx context.Context, pkg *pkg, includeTest bool) (string, []stdlib.Symbol, error) { - if info, ok := r.cache.Load(pkg.dir); ok && !includeTest { - return r.cache.CacheExports(ctx, r.env, info) - } - return loadExportsFromFiles(ctx, r.env, pkg.dir, includeTest) -} - -// VendorlessPath returns the devendorized version of the import path ipath. -// For example, VendorlessPath("foo/bar/vendor/a/b") returns "a/b". -func VendorlessPath(ipath string) string { - // Devendorize for use in import statement. - if i := strings.LastIndex(ipath, "/vendor/"); i >= 0 { - return ipath[i+len("/vendor/"):] - } - if strings.HasPrefix(ipath, "vendor/") { - return ipath[len("vendor/"):] - } - return ipath -} - -func loadExportsFromFiles(ctx context.Context, env *ProcessEnv, dir string, includeTest bool) (string, []stdlib.Symbol, error) { - // Look for non-test, buildable .go files which could provide exports. - all, err := os.ReadDir(dir) - if err != nil { - return "", nil, err - } - var files []fs.DirEntry - for _, fi := range all { - name := fi.Name() - if !strings.HasSuffix(name, ".go") || (!includeTest && strings.HasSuffix(name, "_test.go")) { - continue - } - match, err := env.matchFile(dir, fi.Name()) - if err != nil || !match { - continue - } - files = append(files, fi) - } - - if len(files) == 0 { - return "", nil, fmt.Errorf("dir %v contains no buildable, non-test .go files", dir) - } - - var pkgName string - var exports []stdlib.Symbol - fset := token.NewFileSet() - for _, fi := range files { - select { - case <-ctx.Done(): - return "", nil, ctx.Err() - default: - } - - fullFile := filepath.Join(dir, fi.Name()) - f, err := parser.ParseFile(fset, fullFile, nil, 0) - if err != nil { - if env.Logf != nil { - env.Logf("error parsing %v: %v", fullFile, err) - } - continue - } - if f.Name.Name == "documentation" { - // Special case from go/build.ImportDir, not - // handled by MatchFile above. - continue - } - if includeTest && strings.HasSuffix(f.Name.Name, "_test") { - // x_test package. We want internal test files only. - continue - } - pkgName = f.Name.Name - for name, obj := range f.Scope.Objects { - if ast.IsExported(name) { - var kind stdlib.Kind - switch obj.Kind { - case ast.Con: - kind = stdlib.Const - case ast.Typ: - kind = stdlib.Type - case ast.Var: - kind = stdlib.Var - case ast.Fun: - kind = stdlib.Func - } - exports = append(exports, stdlib.Symbol{ - Name: name, - Kind: kind, - Version: 0, // unknown; be permissive - }) - } - } - } - sortSymbols(exports) - - if env.Logf != nil { - env.Logf("loaded exports in dir %v (package %v): %v", dir, pkgName, exports) - } - return pkgName, exports, nil -} - -func sortSymbols(syms []stdlib.Symbol) { - sort.Slice(syms, func(i, j int) bool { - return syms[i].Name < syms[j].Name - }) -} - -// findImport searches for a package with the given symbols. -// If no package is found, findImport returns ("", false, nil) -func findImport(ctx context.Context, pass *pass, candidates []pkgDistance, pkgName string, symbols map[string]bool) (*pkg, error) { - // Sort the candidates by their import package length, - // assuming that shorter package names are better than long - // ones. Note that this sorts by the de-vendored name, so - // there's no "penalty" for vendoring. - sort.Sort(byDistanceOrImportPathShortLength(candidates)) - if pass.env.Logf != nil { - for i, c := range candidates { - pass.env.Logf("%s candidate %d/%d: %v in %v", pkgName, i+1, len(candidates), c.pkg.importPathShort, c.pkg.dir) - } - } - resolver, err := pass.env.GetResolver() - if err != nil { - return nil, err - } - - // Collect exports for packages with matching names. - rescv := make([]chan *pkg, len(candidates)) - for i := range candidates { - rescv[i] = make(chan *pkg, 1) - } - const maxConcurrentPackageImport = 4 - loadExportsSem := make(chan struct{}, maxConcurrentPackageImport) - - ctx, cancel := context.WithCancel(ctx) - var wg sync.WaitGroup - defer func() { - cancel() - wg.Wait() - }() - - wg.Add(1) - go func() { - defer wg.Done() - for i, c := range candidates { - select { - case loadExportsSem <- struct{}{}: - case <-ctx.Done(): - return - } - - wg.Add(1) - go func(c pkgDistance, resc chan<- *pkg) { - defer func() { - <-loadExportsSem - wg.Done() - }() - - if pass.env.Logf != nil { - pass.env.Logf("loading exports in dir %s (seeking package %s)", c.pkg.dir, pkgName) - } - // If we're an x_test, load the package under test's test variant. - includeTest := strings.HasSuffix(pass.f.Name.Name, "_test") && c.pkg.dir == pass.srcDir - _, exports, err := resolver.loadExports(ctx, c.pkg, includeTest) - if err != nil { - if pass.env.Logf != nil { - pass.env.Logf("loading exports in dir %s (seeking package %s): %v", c.pkg.dir, pkgName, err) - } - resc <- nil - return - } - - exportsMap := make(map[string]bool, len(exports)) - for _, sym := range exports { - exportsMap[sym.Name] = true - } - - // If it doesn't have the right - // symbols, send nil to mean no match. - for symbol := range symbols { - if !exportsMap[symbol] { - resc <- nil - return - } - } - resc <- c.pkg - }(c, rescv[i]) - } - }() - - for _, resc := range rescv { - pkg := <-resc - if pkg == nil { - continue - } - return pkg, nil - } - return nil, nil -} - -// pkgIsCandidate reports whether pkg is a candidate for satisfying the -// finding which package pkgIdent in the file named by filename is trying -// to refer to. -// -// This check is purely lexical and is meant to be as fast as possible -// because it's run over all $GOPATH directories to filter out poor -// candidates in order to limit the CPU and I/O later parsing the -// exports in candidate packages. -// -// filename is the file being formatted. -// pkgIdent is the package being searched for, like "client" (if -// searching for "client.New") -func pkgIsCandidate(filename string, refs references, pkg *pkg) bool { - // Check "internal" and "vendor" visibility: - if !canUse(filename, pkg.dir) { - return false - } - - // Speed optimization to minimize disk I/O: - // the last two components on disk must contain the - // package name somewhere. - // - // This permits mismatch naming like directory - // "go-foo" being package "foo", or "pkg.v3" being "pkg", - // or directory "google.golang.org/api/cloudbilling/v1" - // being package "cloudbilling", but doesn't - // permit a directory "foo" to be package - // "bar", which is strongly discouraged - // anyway. There's no reason goimports needs - // to be slow just to accommodate that. - for pkgIdent := range refs { - lastTwo := lastTwoComponents(pkg.importPathShort) - if strings.Contains(lastTwo, pkgIdent) { - return true - } - if hasHyphenOrUpperASCII(lastTwo) && !hasHyphenOrUpperASCII(pkgIdent) { - lastTwo = lowerASCIIAndRemoveHyphen(lastTwo) - if strings.Contains(lastTwo, pkgIdent) { - return true - } - } - } - return false -} - -func hasHyphenOrUpperASCII(s string) bool { - for i := 0; i < len(s); i++ { - b := s[i] - if b == '-' || ('A' <= b && b <= 'Z') { - return true - } - } - return false -} - -func lowerASCIIAndRemoveHyphen(s string) (ret string) { - buf := make([]byte, 0, len(s)) - for i := 0; i < len(s); i++ { - b := s[i] - switch { - case b == '-': - continue - case 'A' <= b && b <= 'Z': - buf = append(buf, b+('a'-'A')) - default: - buf = append(buf, b) - } - } - return string(buf) -} - -// canUse reports whether the package in dir is usable from filename, -// respecting the Go "internal" and "vendor" visibility rules. -func canUse(filename, dir string) bool { - // Fast path check, before any allocations. If it doesn't contain vendor - // or internal, it's not tricky: - // Note that this can false-negative on directories like "notinternal", - // but we check it correctly below. This is just a fast path. - if !strings.Contains(dir, "vendor") && !strings.Contains(dir, "internal") { - return true - } - - dirSlash := filepath.ToSlash(dir) - if !strings.Contains(dirSlash, "/vendor/") && !strings.Contains(dirSlash, "/internal/") && !strings.HasSuffix(dirSlash, "/internal") { - return true - } - // Vendor or internal directory only visible from children of parent. - // That means the path from the current directory to the target directory - // can contain ../vendor or ../internal but not ../foo/vendor or ../foo/internal - // or bar/vendor or bar/internal. - // After stripping all the leading ../, the only okay place to see vendor or internal - // is at the very beginning of the path. - absfile, err := filepath.Abs(filename) - if err != nil { - return false - } - absdir, err := filepath.Abs(dir) - if err != nil { - return false - } - rel, err := filepath.Rel(absfile, absdir) - if err != nil { - return false - } - relSlash := filepath.ToSlash(rel) - if i := strings.LastIndex(relSlash, "../"); i >= 0 { - relSlash = relSlash[i+len("../"):] - } - return !strings.Contains(relSlash, "/vendor/") && !strings.Contains(relSlash, "/internal/") && !strings.HasSuffix(relSlash, "/internal") -} - -// lastTwoComponents returns at most the last two path components -// of v, using either / or \ as the path separator. -func lastTwoComponents(v string) string { - nslash := 0 - for i := len(v) - 1; i >= 0; i-- { - if v[i] == '/' || v[i] == '\\' { - nslash++ - if nslash == 2 { - return v[i:] - } - } - } - return v -} - -type visitFn func(node ast.Node) ast.Visitor - -func (fn visitFn) Visit(node ast.Node) ast.Visitor { - return fn(node) -} - -func symbolNameSet(symbols []stdlib.Symbol) map[string]bool { - names := make(map[string]bool) - for _, sym := range symbols { - switch sym.Kind { - case stdlib.Const, stdlib.Var, stdlib.Type, stdlib.Func: - names[sym.Name] = true - } - } - return names -} diff --git a/vendor/golang.org/x/tools/internal/imports/imports.go b/vendor/golang.org/x/tools/internal/imports/imports.go deleted file mode 100644 index f83465520a4..00000000000 --- a/vendor/golang.org/x/tools/internal/imports/imports.go +++ /dev/null @@ -1,354 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package imports implements a Go pretty-printer (like package "go/format") -// that also adds or removes import statements as necessary. -package imports - -import ( - "bufio" - "bytes" - "context" - "fmt" - "go/ast" - "go/format" - "go/parser" - "go/printer" - "go/token" - "io" - "regexp" - "strconv" - "strings" - - "golang.org/x/tools/go/ast/astutil" - "golang.org/x/tools/internal/event" -) - -// Options is golang.org/x/tools/imports.Options with extra internal-only options. -type Options struct { - Env *ProcessEnv // The environment to use. Note: this contains the cached module and filesystem state. - - // LocalPrefix is a comma-separated string of import path prefixes, which, if - // set, instructs Process to sort the import paths with the given prefixes - // into another group after 3rd-party packages. - LocalPrefix string - - Fragment bool // Accept fragment of a source file (no package statement) - AllErrors bool // Report all errors (not just the first 10 on different lines) - - Comments bool // Print comments (true if nil *Options provided) - TabIndent bool // Use tabs for indent (true if nil *Options provided) - TabWidth int // Tab width (8 if nil *Options provided) - - FormatOnly bool // Disable the insertion and deletion of imports -} - -// Process implements golang.org/x/tools/imports.Process with explicit context in opt.Env. -func Process(filename string, src []byte, opt *Options) (formatted []byte, err error) { - fileSet := token.NewFileSet() - file, adjust, err := parse(fileSet, filename, src, opt) - if err != nil { - return nil, err - } - - if !opt.FormatOnly { - if err := fixImports(fileSet, file, filename, opt.Env); err != nil { - return nil, err - } - } - return formatFile(fileSet, file, src, adjust, opt) -} - -// FixImports returns a list of fixes to the imports that, when applied, -// will leave the imports in the same state as Process. src and opt must -// be specified. -// -// Note that filename's directory influences which imports can be chosen, -// so it is important that filename be accurate. -func FixImports(ctx context.Context, filename string, src []byte, opt *Options) (fixes []*ImportFix, err error) { - ctx, done := event.Start(ctx, "imports.FixImports") - defer done() - - fileSet := token.NewFileSet() - file, _, err := parse(fileSet, filename, src, opt) - if err != nil { - return nil, err - } - - return getFixes(ctx, fileSet, file, filename, opt.Env) -} - -// ApplyFixes applies all of the fixes to the file and formats it. extraMode -// is added in when parsing the file. src and opts must be specified, but no -// env is needed. -func ApplyFixes(fixes []*ImportFix, filename string, src []byte, opt *Options, extraMode parser.Mode) (formatted []byte, err error) { - // Don't use parse() -- we don't care about fragments or statement lists - // here, and we need to work with unparseable files. - fileSet := token.NewFileSet() - parserMode := parser.Mode(0) - if opt.Comments { - parserMode |= parser.ParseComments - } - if opt.AllErrors { - parserMode |= parser.AllErrors - } - parserMode |= extraMode - - file, err := parser.ParseFile(fileSet, filename, src, parserMode) - if file == nil { - return nil, err - } - - // Apply the fixes to the file. - apply(fileSet, file, fixes) - - return formatFile(fileSet, file, src, nil, opt) -} - -// formatFile formats the file syntax tree. -// It may mutate the token.FileSet and the ast.File. -// -// If an adjust function is provided, it is called after formatting -// with the original source (formatFile's src parameter) and the -// formatted file, and returns the postpocessed result. -func formatFile(fset *token.FileSet, file *ast.File, src []byte, adjust func(orig []byte, src []byte) []byte, opt *Options) ([]byte, error) { - mergeImports(file) - sortImports(opt.LocalPrefix, fset.File(file.Pos()), file) - var spacesBefore []string // import paths we need spaces before - for _, impSection := range astutil.Imports(fset, file) { - // Within each block of contiguous imports, see if any - // import lines are in different group numbers. If so, - // we'll need to put a space between them so it's - // compatible with gofmt. - lastGroup := -1 - for _, importSpec := range impSection { - importPath, _ := strconv.Unquote(importSpec.Path.Value) - groupNum := importGroup(opt.LocalPrefix, importPath) - if groupNum != lastGroup && lastGroup != -1 { - spacesBefore = append(spacesBefore, importPath) - } - lastGroup = groupNum - } - - } - - printerMode := printer.UseSpaces - if opt.TabIndent { - printerMode |= printer.TabIndent - } - printConfig := &printer.Config{Mode: printerMode, Tabwidth: opt.TabWidth} - - var buf bytes.Buffer - err := printConfig.Fprint(&buf, fset, file) - if err != nil { - return nil, err - } - out := buf.Bytes() - if adjust != nil { - out = adjust(src, out) - } - if len(spacesBefore) > 0 { - out, err = addImportSpaces(bytes.NewReader(out), spacesBefore) - if err != nil { - return nil, err - } - } - - out, err = format.Source(out) - if err != nil { - return nil, err - } - return out, nil -} - -// parse parses src, which was read from filename, -// as a Go source file or statement list. -func parse(fset *token.FileSet, filename string, src []byte, opt *Options) (*ast.File, func(orig, src []byte) []byte, error) { - parserMode := parser.Mode(0) - if opt.Comments { - parserMode |= parser.ParseComments - } - if opt.AllErrors { - parserMode |= parser.AllErrors - } - - // Try as whole source file. - file, err := parser.ParseFile(fset, filename, src, parserMode) - if err == nil { - return file, nil, nil - } - // If the error is that the source file didn't begin with a - // package line and we accept fragmented input, fall through to - // try as a source fragment. Stop and return on any other error. - if !opt.Fragment || !strings.Contains(err.Error(), "expected 'package'") { - return nil, nil, err - } - - // If this is a declaration list, make it a source file - // by inserting a package clause. - // Insert using a ;, not a newline, so that parse errors are on - // the correct line. - const prefix = "package main;" - psrc := append([]byte(prefix), src...) - file, err = parser.ParseFile(fset, filename, psrc, parserMode) - if err == nil { - // Gofmt will turn the ; into a \n. - // Do that ourselves now and update the file contents, - // so that positions and line numbers are correct going forward. - psrc[len(prefix)-1] = '\n' - fset.File(file.Package).SetLinesForContent(psrc) - - // If a main function exists, we will assume this is a main - // package and leave the file. - if containsMainFunc(file) { - return file, nil, nil - } - - adjust := func(orig, src []byte) []byte { - // Remove the package clause. - src = src[len(prefix):] - return matchSpace(orig, src) - } - return file, adjust, nil - } - // If the error is that the source file didn't begin with a - // declaration, fall through to try as a statement list. - // Stop and return on any other error. - if !strings.Contains(err.Error(), "expected declaration") { - return nil, nil, err - } - - // If this is a statement list, make it a source file - // by inserting a package clause and turning the list - // into a function body. This handles expressions too. - // Insert using a ;, not a newline, so that the line numbers - // in fsrc match the ones in src. - fsrc := append(append([]byte("package p; func _() {"), src...), '}') - file, err = parser.ParseFile(fset, filename, fsrc, parserMode) - if err == nil { - adjust := func(orig, src []byte) []byte { - // Remove the wrapping. - // Gofmt has turned the ; into a \n\n. - src = src[len("package p\n\nfunc _() {"):] - src = src[:len(src)-len("}\n")] - // Gofmt has also indented the function body one level. - // Remove that indent. - src = bytes.ReplaceAll(src, []byte("\n\t"), []byte("\n")) - return matchSpace(orig, src) - } - return file, adjust, nil - } - - // Failed, and out of options. - return nil, nil, err -} - -// containsMainFunc checks if a file contains a function declaration with the -// function signature 'func main()' -func containsMainFunc(file *ast.File) bool { - for _, decl := range file.Decls { - if f, ok := decl.(*ast.FuncDecl); ok { - if f.Name.Name != "main" { - continue - } - - if len(f.Type.Params.List) != 0 { - continue - } - - if f.Type.Results != nil && len(f.Type.Results.List) != 0 { - continue - } - - return true - } - } - - return false -} - -func cutSpace(b []byte) (before, middle, after []byte) { - i := 0 - for i < len(b) && (b[i] == ' ' || b[i] == '\t' || b[i] == '\n') { - i++ - } - j := len(b) - for j > 0 && (b[j-1] == ' ' || b[j-1] == '\t' || b[j-1] == '\n') { - j-- - } - if i <= j { - return b[:i], b[i:j], b[j:] - } - return nil, nil, b[j:] -} - -// matchSpace reformats src to use the same space context as orig. -// 1. If orig begins with blank lines, matchSpace inserts them at the beginning of src. -// 2. matchSpace copies the indentation of the first non-blank line in orig -// to every non-blank line in src. -// 3. matchSpace copies the trailing space from orig and uses it in place -// of src's trailing space. -func matchSpace(orig []byte, src []byte) []byte { - before, _, after := cutSpace(orig) - i := bytes.LastIndex(before, []byte{'\n'}) - before, indent := before[:i+1], before[i+1:] - - _, src, _ = cutSpace(src) - - var b bytes.Buffer - b.Write(before) - for len(src) > 0 { - line := src - if i := bytes.IndexByte(line, '\n'); i >= 0 { - line, src = line[:i+1], line[i+1:] - } else { - src = nil - } - if len(line) > 0 && line[0] != '\n' { // not blank - b.Write(indent) - } - b.Write(line) - } - b.Write(after) - return b.Bytes() -} - -var impLine = regexp.MustCompile(`^\s+(?:[\w\.]+\s+)?"(.+?)"`) - -func addImportSpaces(r io.Reader, breaks []string) ([]byte, error) { - var out bytes.Buffer - in := bufio.NewReader(r) - inImports := false - done := false - for { - s, err := in.ReadString('\n') - if err == io.EOF { - break - } else if err != nil { - return nil, err - } - - if !inImports && !done && strings.HasPrefix(s, "import") { - inImports = true - } - if inImports && (strings.HasPrefix(s, "var") || - strings.HasPrefix(s, "func") || - strings.HasPrefix(s, "const") || - strings.HasPrefix(s, "type")) { - done = true - inImports = false - } - if inImports && len(breaks) > 0 { - if m := impLine.FindStringSubmatch(s); m != nil { - if m[1] == breaks[0] { - out.WriteByte('\n') - breaks = breaks[1:] - } - } - } - - fmt.Fprint(&out, s) - } - return out.Bytes(), nil -} diff --git a/vendor/golang.org/x/tools/internal/imports/mod.go b/vendor/golang.org/x/tools/internal/imports/mod.go deleted file mode 100644 index 82fe644a189..00000000000 --- a/vendor/golang.org/x/tools/internal/imports/mod.go +++ /dev/null @@ -1,841 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package imports - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "os" - "path" - "path/filepath" - "regexp" - "sort" - "strconv" - "strings" - - "golang.org/x/mod/module" - "golang.org/x/tools/internal/event" - "golang.org/x/tools/internal/gocommand" - "golang.org/x/tools/internal/gopathwalk" - "golang.org/x/tools/internal/stdlib" -) - -// Notes(rfindley): ModuleResolver appears to be heavily optimized for scanning -// as fast as possible, which is desirable for a call to goimports from the -// command line, but it doesn't work as well for gopls, where it suffers from -// slow startup (golang/go#44863) and intermittent hanging (golang/go#59216), -// both caused by populating the cache, albeit in slightly different ways. -// -// A high level list of TODOs: -// - Optimize the scan itself, as there is some redundancy statting and -// reading go.mod files. -// - Invert the relationship between ProcessEnv and Resolver (see the -// docstring of ProcessEnv). -// - Make it easier to use an external resolver implementation. -// -// Smaller TODOs are annotated in the code below. - -// ModuleResolver implements the Resolver interface for a workspace using -// modules. -// -// A goal of the ModuleResolver is to invoke the Go command as little as -// possible. To this end, it runs the Go command only for listing module -// information (i.e. `go list -m -e -json ...`). Package scanning, the process -// of loading package information for the modules, is implemented internally -// via the scan method. -// -// It has two types of state: the state derived from the go command, which -// is populated by init, and the state derived from scans, which is populated -// via scan. A root is considered scanned if it has been walked to discover -// directories. However, if the scan did not require additional information -// from the directory (such as package name or exports), the directory -// information itself may be partially populated. It will be lazily filled in -// as needed by scans, using the scanCallback. -type ModuleResolver struct { - env *ProcessEnv - - // Module state, populated during construction - dummyVendorMod *gocommand.ModuleJSON // if vendoring is enabled, a pseudo-module to represent the /vendor directory - moduleCacheDir string // GOMODCACHE, inferred from GOPATH if unset - roots []gopathwalk.Root // roots to scan, in approximate order of importance - mains []*gocommand.ModuleJSON // main modules - mainByDir map[string]*gocommand.ModuleJSON // module information by dir, to join with roots - modsByModPath []*gocommand.ModuleJSON // all modules, ordered by # of path components in their module path - modsByDir []*gocommand.ModuleJSON // ...or by the number of path components in their Dir. - - // Scanning state, populated by scan - - // scanSema prevents concurrent scans, and guards scannedRoots and the cache - // fields below (though the caches themselves are concurrency safe). - // Receive to acquire, send to release. - scanSema chan struct{} - scannedRoots map[gopathwalk.Root]bool // if true, root has been walked - - // Caches of directory info, populated by scans and scan callbacks - // - // moduleCacheCache stores cached information about roots in the module - // cache, which are immutable and therefore do not need to be invalidated. - // - // otherCache stores information about all other roots (even GOROOT), which - // may change. - moduleCacheCache *DirInfoCache - otherCache *DirInfoCache -} - -// newModuleResolver returns a new module-aware goimports resolver. -// -// Note: use caution when modifying this constructor: changes must also be -// reflected in ModuleResolver.ClearForNewScan. -func newModuleResolver(e *ProcessEnv, moduleCacheCache *DirInfoCache) (*ModuleResolver, error) { - r := &ModuleResolver{ - env: e, - scanSema: make(chan struct{}, 1), - } - r.scanSema <- struct{}{} // release - - goenv, err := r.env.goEnv() - if err != nil { - return nil, err - } - - // TODO(rfindley): can we refactor to share logic with r.env.invokeGo? - inv := gocommand.Invocation{ - BuildFlags: r.env.BuildFlags, - ModFlag: r.env.ModFlag, - Env: r.env.env(), - Logf: r.env.Logf, - WorkingDir: r.env.WorkingDir, - } - - vendorEnabled := false - var mainModVendor *gocommand.ModuleJSON // for module vendoring - var mainModsVendor []*gocommand.ModuleJSON // for workspace vendoring - - goWork := r.env.Env["GOWORK"] - if len(goWork) == 0 { - // TODO(rfindley): VendorEnabled runs the go command to get GOFLAGS, but - // they should be available from the ProcessEnv. Can we avoid the redundant - // invocation? - vendorEnabled, mainModVendor, err = gocommand.VendorEnabled(context.TODO(), inv, r.env.GocmdRunner) - if err != nil { - return nil, err - } - } else { - vendorEnabled, mainModsVendor, err = gocommand.WorkspaceVendorEnabled(context.Background(), inv, r.env.GocmdRunner) - if err != nil { - return nil, err - } - } - - if vendorEnabled { - if mainModVendor != nil { - // Module vendor mode is on, so all the non-Main modules are irrelevant, - // and we need to search /vendor for everything. - r.mains = []*gocommand.ModuleJSON{mainModVendor} - r.dummyVendorMod = &gocommand.ModuleJSON{ - Path: "", - Dir: filepath.Join(mainModVendor.Dir, "vendor"), - } - r.modsByModPath = []*gocommand.ModuleJSON{mainModVendor, r.dummyVendorMod} - r.modsByDir = []*gocommand.ModuleJSON{mainModVendor, r.dummyVendorMod} - } else { - // Workspace vendor mode is on, so all the non-Main modules are irrelevant, - // and we need to search /vendor for everything. - r.mains = mainModsVendor - r.dummyVendorMod = &gocommand.ModuleJSON{ - Path: "", - Dir: filepath.Join(filepath.Dir(goWork), "vendor"), - } - r.modsByModPath = append(append([]*gocommand.ModuleJSON{}, mainModsVendor...), r.dummyVendorMod) - r.modsByDir = append(append([]*gocommand.ModuleJSON{}, mainModsVendor...), r.dummyVendorMod) - } - } else { - // Vendor mode is off, so run go list -m ... to find everything. - err := r.initAllMods() - // We expect an error when running outside of a module with - // GO111MODULE=on. Other errors are fatal. - if err != nil { - if errMsg := err.Error(); !strings.Contains(errMsg, "working directory is not part of a module") && !strings.Contains(errMsg, "go.mod file not found") { - return nil, err - } - } - } - - r.moduleCacheDir = gomodcacheForEnv(goenv) - if r.moduleCacheDir == "" { - return nil, fmt.Errorf("cannot resolve GOMODCACHE") - } - - sort.Slice(r.modsByModPath, func(i, j int) bool { - count := func(x int) int { - return strings.Count(r.modsByModPath[x].Path, "/") - } - return count(j) < count(i) // descending order - }) - sort.Slice(r.modsByDir, func(i, j int) bool { - count := func(x int) int { - return strings.Count(r.modsByDir[x].Dir, string(filepath.Separator)) - } - return count(j) < count(i) // descending order - }) - - r.roots = []gopathwalk.Root{} - if goenv["GOROOT"] != "" { // "" happens in tests - r.roots = append(r.roots, gopathwalk.Root{Path: filepath.Join(goenv["GOROOT"], "/src"), Type: gopathwalk.RootGOROOT}) - } - r.mainByDir = make(map[string]*gocommand.ModuleJSON) - for _, main := range r.mains { - r.roots = append(r.roots, gopathwalk.Root{Path: main.Dir, Type: gopathwalk.RootCurrentModule}) - r.mainByDir[main.Dir] = main - } - if vendorEnabled { - r.roots = append(r.roots, gopathwalk.Root{Path: r.dummyVendorMod.Dir, Type: gopathwalk.RootOther}) - } else { - addDep := func(mod *gocommand.ModuleJSON) { - if mod.Replace == nil { - // This is redundant with the cache, but we'll skip it cheaply enough - // when we encounter it in the module cache scan. - // - // Including it at a lower index in r.roots than the module cache dir - // helps prioritize matches from within existing dependencies. - r.roots = append(r.roots, gopathwalk.Root{Path: mod.Dir, Type: gopathwalk.RootModuleCache}) - } else { - r.roots = append(r.roots, gopathwalk.Root{Path: mod.Dir, Type: gopathwalk.RootOther}) - } - } - // Walk dependent modules before scanning the full mod cache, direct deps first. - for _, mod := range r.modsByModPath { - if !mod.Indirect && !mod.Main { - addDep(mod) - } - } - for _, mod := range r.modsByModPath { - if mod.Indirect && !mod.Main { - addDep(mod) - } - } - // If provided, share the moduleCacheCache. - // - // TODO(rfindley): The module cache is immutable. However, the loaded - // exports do depend on GOOS and GOARCH. Fortunately, the - // ProcessEnv.buildContext does not adjust these from build.DefaultContext - // (even though it should). So for now, this is OK to share, but we need to - // add logic for handling GOOS/GOARCH. - r.moduleCacheCache = moduleCacheCache - r.roots = append(r.roots, gopathwalk.Root{Path: r.moduleCacheDir, Type: gopathwalk.RootModuleCache}) - } - - r.scannedRoots = map[gopathwalk.Root]bool{} - if r.moduleCacheCache == nil { - r.moduleCacheCache = NewDirInfoCache() - } - r.otherCache = NewDirInfoCache() - return r, nil -} - -// gomodcacheForEnv returns the GOMODCACHE value to use based on the given env -// map, which must have GOMODCACHE and GOPATH populated. -// -// TODO(rfindley): this is defensive refactoring. -// 1. Is this even relevant anymore? Can't we just read GOMODCACHE. -// 2. Use this to separate module cache scanning from other scanning. -func gomodcacheForEnv(goenv map[string]string) string { - if gmc := goenv["GOMODCACHE"]; gmc != "" { - return gmc - } - gopaths := filepath.SplitList(goenv["GOPATH"]) - if len(gopaths) == 0 { - return "" - } - return filepath.Join(gopaths[0], "/pkg/mod") -} - -func (r *ModuleResolver) initAllMods() error { - stdout, err := r.env.invokeGo(context.TODO(), "list", "-m", "-e", "-json", "...") - if err != nil { - return err - } - for dec := json.NewDecoder(stdout); dec.More(); { - mod := &gocommand.ModuleJSON{} - if err := dec.Decode(mod); err != nil { - return err - } - if mod.Dir == "" { - if r.env.Logf != nil { - r.env.Logf("module %v has not been downloaded and will be ignored", mod.Path) - } - // Can't do anything with a module that's not downloaded. - continue - } - // golang/go#36193: the go command doesn't always clean paths. - mod.Dir = filepath.Clean(mod.Dir) - r.modsByModPath = append(r.modsByModPath, mod) - r.modsByDir = append(r.modsByDir, mod) - if mod.Main { - r.mains = append(r.mains, mod) - } - } - return nil -} - -// ClearForNewScan invalidates the last scan. -// -// It preserves the set of roots, but forgets about the set of directories. -// Though it forgets the set of module cache directories, it remembers their -// contents, since they are assumed to be immutable. -func (r *ModuleResolver) ClearForNewScan() Resolver { - <-r.scanSema // acquire r, to guard scannedRoots - r2 := &ModuleResolver{ - env: r.env, - dummyVendorMod: r.dummyVendorMod, - moduleCacheDir: r.moduleCacheDir, - roots: r.roots, - mains: r.mains, - mainByDir: r.mainByDir, - modsByModPath: r.modsByModPath, - - scanSema: make(chan struct{}, 1), - scannedRoots: make(map[gopathwalk.Root]bool), - otherCache: NewDirInfoCache(), - moduleCacheCache: r.moduleCacheCache, - } - r2.scanSema <- struct{}{} // r2 must start released - // Invalidate root scans. We don't need to invalidate module cache roots, - // because they are immutable. - // (We don't support a use case where GOMODCACHE is cleaned in the middle of - // e.g. a gopls session: the user must restart gopls to get accurate - // imports.) - // - // Scanning for new directories in GOMODCACHE should be handled elsewhere, - // via a call to ScanModuleCache. - for _, root := range r.roots { - if root.Type == gopathwalk.RootModuleCache && r.scannedRoots[root] { - r2.scannedRoots[root] = true - } - } - r.scanSema <- struct{}{} // release r - return r2 -} - -// ClearModuleInfo invalidates resolver state that depends on go.mod file -// contents (essentially, the output of go list -m -json ...). -// -// Notably, it does not forget directory contents, which are reset -// asynchronously via ClearForNewScan. -// -// If the ProcessEnv is a GOPATH environment, ClearModuleInfo is a no op. -// -// TODO(rfindley): move this to a new env.go, consolidating ProcessEnv methods. -func (e *ProcessEnv) ClearModuleInfo() { - if r, ok := e.resolver.(*ModuleResolver); ok { - resolver, err := newModuleResolver(e, e.ModCache) - if err != nil { - e.resolver = nil - e.resolverErr = err - return - } - - <-r.scanSema // acquire (guards caches) - resolver.moduleCacheCache = r.moduleCacheCache - resolver.otherCache = r.otherCache - r.scanSema <- struct{}{} // release - - e.UpdateResolver(resolver) - } -} - -// UpdateResolver sets the resolver for the ProcessEnv to use in imports -// operations. Only for use with the result of [Resolver.ClearForNewScan]. -// -// TODO(rfindley): this awkward API is a result of the (arguably) inverted -// relationship between configuration and state described in the doc comment -// for [ProcessEnv]. -func (e *ProcessEnv) UpdateResolver(r Resolver) { - e.resolver = r - e.resolverErr = nil -} - -// findPackage returns the module and directory from within the main modules -// and their dependencies that contains the package at the given import path, -// or returns nil, "" if no module is in scope. -func (r *ModuleResolver) findPackage(importPath string) (*gocommand.ModuleJSON, string) { - // This can't find packages in the stdlib, but that's harmless for all - // the existing code paths. - for _, m := range r.modsByModPath { - if !strings.HasPrefix(importPath, m.Path) { - continue - } - pathInModule := importPath[len(m.Path):] - pkgDir := filepath.Join(m.Dir, pathInModule) - if r.dirIsNestedModule(pkgDir, m) { - continue - } - - if info, ok := r.cacheLoad(pkgDir); ok { - if loaded, err := info.reachedStatus(nameLoaded); loaded { - if err != nil { - continue // No package in this dir. - } - return m, pkgDir - } - if scanned, err := info.reachedStatus(directoryScanned); scanned && err != nil { - continue // Dir is unreadable, etc. - } - // This is slightly wrong: a directory doesn't have to have an - // importable package to count as a package for package-to-module - // resolution. package main or _test files should count but - // don't. - // TODO(heschi): fix this. - if _, err := r.cachePackageName(info); err == nil { - return m, pkgDir - } - } - - // Not cached. Read the filesystem. - pkgFiles, err := os.ReadDir(pkgDir) - if err != nil { - continue - } - // A module only contains a package if it has buildable go - // files in that directory. If not, it could be provided by an - // outer module. See #29736. - for _, fi := range pkgFiles { - if ok, _ := r.env.matchFile(pkgDir, fi.Name()); ok { - return m, pkgDir - } - } - } - return nil, "" -} - -func (r *ModuleResolver) cacheLoad(dir string) (directoryPackageInfo, bool) { - if info, ok := r.moduleCacheCache.Load(dir); ok { - return info, ok - } - return r.otherCache.Load(dir) -} - -func (r *ModuleResolver) cacheStore(info directoryPackageInfo) { - if info.rootType == gopathwalk.RootModuleCache { - r.moduleCacheCache.Store(info.dir, info) - } else { - r.otherCache.Store(info.dir, info) - } -} - -// cachePackageName caches the package name for a dir already in the cache. -func (r *ModuleResolver) cachePackageName(info directoryPackageInfo) (string, error) { - if info.rootType == gopathwalk.RootModuleCache { - return r.moduleCacheCache.CachePackageName(info) - } - return r.otherCache.CachePackageName(info) -} - -func (r *ModuleResolver) cacheExports(ctx context.Context, env *ProcessEnv, info directoryPackageInfo) (string, []stdlib.Symbol, error) { - if info.rootType == gopathwalk.RootModuleCache { - return r.moduleCacheCache.CacheExports(ctx, env, info) - } - return r.otherCache.CacheExports(ctx, env, info) -} - -// findModuleByDir returns the module that contains dir, or nil if no such -// module is in scope. -func (r *ModuleResolver) findModuleByDir(dir string) *gocommand.ModuleJSON { - // This is quite tricky and may not be correct. dir could be: - // - a package in the main module. - // - a replace target underneath the main module's directory. - // - a nested module in the above. - // - a replace target somewhere totally random. - // - a nested module in the above. - // - in the mod cache. - // - in /vendor/ in -mod=vendor mode. - // - nested module? Dunno. - // Rumor has it that replace targets cannot contain other replace targets. - // - // Note that it is critical here that modsByDir is sorted to have deeper dirs - // first. This ensures that findModuleByDir finds the innermost module. - // See also golang/go#56291. - for _, m := range r.modsByDir { - if !strings.HasPrefix(dir, m.Dir) { - continue - } - - if r.dirIsNestedModule(dir, m) { - continue - } - - return m - } - return nil -} - -// dirIsNestedModule reports if dir is contained in a nested module underneath -// mod, not actually in mod. -func (r *ModuleResolver) dirIsNestedModule(dir string, mod *gocommand.ModuleJSON) bool { - if !strings.HasPrefix(dir, mod.Dir) { - return false - } - if r.dirInModuleCache(dir) { - // Nested modules in the module cache are pruned, - // so it cannot be a nested module. - return false - } - if mod != nil && mod == r.dummyVendorMod { - // The /vendor pseudomodule is flattened and doesn't actually count. - return false - } - modDir, _ := r.modInfo(dir) - if modDir == "" { - return false - } - return modDir != mod.Dir -} - -func readModName(modFile string) string { - modBytes, err := os.ReadFile(modFile) - if err != nil { - return "" - } - return modulePath(modBytes) -} - -func (r *ModuleResolver) modInfo(dir string) (modDir, modName string) { - if r.dirInModuleCache(dir) { - if matches := modCacheRegexp.FindStringSubmatch(dir); len(matches) == 3 { - index := strings.Index(dir, matches[1]+"@"+matches[2]) - modDir := filepath.Join(dir[:index], matches[1]+"@"+matches[2]) - return modDir, readModName(filepath.Join(modDir, "go.mod")) - } - } - for { - if info, ok := r.cacheLoad(dir); ok { - return info.moduleDir, info.moduleName - } - f := filepath.Join(dir, "go.mod") - info, err := os.Stat(f) - if err == nil && !info.IsDir() { - return dir, readModName(f) - } - - d := filepath.Dir(dir) - if len(d) >= len(dir) { - return "", "" // reached top of file system, no go.mod - } - dir = d - } -} - -func (r *ModuleResolver) dirInModuleCache(dir string) bool { - if r.moduleCacheDir == "" { - return false - } - return strings.HasPrefix(dir, r.moduleCacheDir) -} - -func (r *ModuleResolver) loadPackageNames(importPaths []string, srcDir string) (map[string]string, error) { - names := map[string]string{} - for _, path := range importPaths { - // TODO(rfindley): shouldn't this use the dirInfoCache? - _, packageDir := r.findPackage(path) - if packageDir == "" { - continue - } - name, err := packageDirToName(packageDir) - if err != nil { - continue - } - names[path] = name - } - return names, nil -} - -func (r *ModuleResolver) scan(ctx context.Context, callback *scanCallback) error { - ctx, done := event.Start(ctx, "imports.ModuleResolver.scan") - defer done() - - processDir := func(info directoryPackageInfo) { - // Skip this directory if we were not able to get the package information successfully. - if scanned, err := info.reachedStatus(directoryScanned); !scanned || err != nil { - return - } - pkg, err := r.canonicalize(info) - if err != nil { - return - } - if !callback.dirFound(pkg) { - return - } - - pkg.packageName, err = r.cachePackageName(info) - if err != nil { - return - } - if !callback.packageNameLoaded(pkg) { - return - } - - _, exports, err := r.loadExports(ctx, pkg, false) - if err != nil { - return - } - callback.exportsLoaded(pkg, exports) - } - - // Start processing everything in the cache, and listen for the new stuff - // we discover in the walk below. - stop1 := r.moduleCacheCache.ScanAndListen(ctx, processDir) - defer stop1() - stop2 := r.otherCache.ScanAndListen(ctx, processDir) - defer stop2() - - // We assume cached directories are fully cached, including all their - // children, and have not changed. We can skip them. - skip := func(root gopathwalk.Root, dir string) bool { - if r.env.SkipPathInScan != nil && root.Type == gopathwalk.RootCurrentModule { - if root.Path == dir { - return false - } - - if r.env.SkipPathInScan(filepath.Clean(dir)) { - return true - } - } - - info, ok := r.cacheLoad(dir) - if !ok { - return false - } - // This directory can be skipped as long as we have already scanned it. - // Packages with errors will continue to have errors, so there is no need - // to rescan them. - packageScanned, _ := info.reachedStatus(directoryScanned) - return packageScanned - } - - add := func(root gopathwalk.Root, dir string) { - r.cacheStore(r.scanDirForPackage(root, dir)) - } - - // r.roots and the callback are not necessarily safe to use in the - // goroutine below. Process them eagerly. - roots := filterRoots(r.roots, callback.rootFound) - // We can't cancel walks, because we need them to finish to have a usable - // cache. Instead, run them in a separate goroutine and detach. - scanDone := make(chan struct{}) - go func() { - select { - case <-ctx.Done(): - return - case <-r.scanSema: // acquire - } - defer func() { r.scanSema <- struct{}{} }() // release - // We have the lock on r.scannedRoots, and no other scans can run. - for _, root := range roots { - if ctx.Err() != nil { - return - } - - if r.scannedRoots[root] { - continue - } - gopathwalk.WalkSkip([]gopathwalk.Root{root}, add, skip, gopathwalk.Options{Logf: r.env.Logf, ModulesEnabled: true}) - r.scannedRoots[root] = true - } - close(scanDone) - }() - select { - case <-ctx.Done(): - case <-scanDone: - } - return nil -} - -func (r *ModuleResolver) scoreImportPath(ctx context.Context, path string) float64 { - if stdlib.HasPackage(path) { - return MaxRelevance - } - mod, _ := r.findPackage(path) - return modRelevance(mod) -} - -func modRelevance(mod *gocommand.ModuleJSON) float64 { - var relevance float64 - switch { - case mod == nil: // out of scope - return MaxRelevance - 4 - case mod.Indirect: - relevance = MaxRelevance - 3 - case !mod.Main: - relevance = MaxRelevance - 2 - default: - relevance = MaxRelevance - 1 // main module ties with stdlib - } - - _, versionString, ok := module.SplitPathVersion(mod.Path) - if ok { - index := strings.Index(versionString, "v") - if index == -1 { - return relevance - } - if versionNumber, err := strconv.ParseFloat(versionString[index+1:], 64); err == nil { - relevance += versionNumber / 1000 - } - } - - return relevance -} - -// canonicalize gets the result of canonicalizing the packages using the results -// of initializing the resolver from 'go list -m'. -func (r *ModuleResolver) canonicalize(info directoryPackageInfo) (*pkg, error) { - // Packages in GOROOT are already canonical, regardless of the std/cmd modules. - if info.rootType == gopathwalk.RootGOROOT { - return &pkg{ - importPathShort: info.nonCanonicalImportPath, - dir: info.dir, - packageName: path.Base(info.nonCanonicalImportPath), - relevance: MaxRelevance, - }, nil - } - - importPath := info.nonCanonicalImportPath - mod := r.findModuleByDir(info.dir) - // Check if the directory is underneath a module that's in scope. - if mod != nil { - // It is. If dir is the target of a replace directive, - // our guessed import path is wrong. Use the real one. - if mod.Dir == info.dir { - importPath = mod.Path - } else { - dirInMod := info.dir[len(mod.Dir)+len("/"):] - importPath = path.Join(mod.Path, filepath.ToSlash(dirInMod)) - } - } else if !strings.HasPrefix(importPath, info.moduleName) { - // The module's name doesn't match the package's import path. It - // probably needs a replace directive we don't have. - return nil, fmt.Errorf("package in %q is not valid without a replace statement", info.dir) - } - - res := &pkg{ - importPathShort: importPath, - dir: info.dir, - relevance: modRelevance(mod), - } - // We may have discovered a package that has a different version - // in scope already. Canonicalize to that one if possible. - if _, canonicalDir := r.findPackage(importPath); canonicalDir != "" { - res.dir = canonicalDir - } - return res, nil -} - -func (r *ModuleResolver) loadExports(ctx context.Context, pkg *pkg, includeTest bool) (string, []stdlib.Symbol, error) { - if info, ok := r.cacheLoad(pkg.dir); ok && !includeTest { - return r.cacheExports(ctx, r.env, info) - } - return loadExportsFromFiles(ctx, r.env, pkg.dir, includeTest) -} - -func (r *ModuleResolver) scanDirForPackage(root gopathwalk.Root, dir string) directoryPackageInfo { - subdir := "" - if dir != root.Path { - subdir = dir[len(root.Path)+len("/"):] - } - importPath := filepath.ToSlash(subdir) - if strings.HasPrefix(importPath, "vendor/") { - // Only enter vendor directories if they're explicitly requested as a root. - return directoryPackageInfo{ - status: directoryScanned, - err: fmt.Errorf("unwanted vendor directory"), - } - } - switch root.Type { - case gopathwalk.RootCurrentModule: - importPath = path.Join(r.mainByDir[root.Path].Path, filepath.ToSlash(subdir)) - case gopathwalk.RootModuleCache: - matches := modCacheRegexp.FindStringSubmatch(subdir) - if len(matches) == 0 { - return directoryPackageInfo{ - status: directoryScanned, - err: fmt.Errorf("invalid module cache path: %v", subdir), - } - } - modPath, err := module.UnescapePath(filepath.ToSlash(matches[1])) - if err != nil { - if r.env.Logf != nil { - r.env.Logf("decoding module cache path %q: %v", subdir, err) - } - return directoryPackageInfo{ - status: directoryScanned, - err: fmt.Errorf("decoding module cache path %q: %v", subdir, err), - } - } - importPath = path.Join(modPath, filepath.ToSlash(matches[3])) - } - - modDir, modName := r.modInfo(dir) - result := directoryPackageInfo{ - status: directoryScanned, - dir: dir, - rootType: root.Type, - nonCanonicalImportPath: importPath, - moduleDir: modDir, - moduleName: modName, - } - if root.Type == gopathwalk.RootGOROOT { - // stdlib packages are always in scope, despite the confusing go.mod - return result - } - return result -} - -// modCacheRegexp splits a path in a module cache into module, module version, and package. -var modCacheRegexp = regexp.MustCompile(`(.*)@([^/\\]*)(.*)`) - -var ( - slashSlash = []byte("//") - moduleStr = []byte("module") -) - -// modulePath returns the module path from the gomod file text. -// If it cannot find a module path, it returns an empty string. -// It is tolerant of unrelated problems in the go.mod file. -// -// Copied from cmd/go/internal/modfile. -func modulePath(mod []byte) string { - for len(mod) > 0 { - line := mod - mod = nil - if i := bytes.IndexByte(line, '\n'); i >= 0 { - line, mod = line[:i], line[i+1:] - } - if i := bytes.Index(line, slashSlash); i >= 0 { - line = line[:i] - } - line = bytes.TrimSpace(line) - if !bytes.HasPrefix(line, moduleStr) { - continue - } - line = line[len(moduleStr):] - n := len(line) - line = bytes.TrimSpace(line) - if len(line) == n || len(line) == 0 { - continue - } - - if line[0] == '"' || line[0] == '`' { - p, err := strconv.Unquote(string(line)) - if err != nil { - return "" // malformed quoted string or multiline module path - } - return p - } - - return string(line) - } - return "" // missing module path -} diff --git a/vendor/golang.org/x/tools/internal/imports/mod_cache.go b/vendor/golang.org/x/tools/internal/imports/mod_cache.go deleted file mode 100644 index b1192696b28..00000000000 --- a/vendor/golang.org/x/tools/internal/imports/mod_cache.go +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package imports - -import ( - "context" - "fmt" - "path" - "path/filepath" - "strings" - "sync" - - "golang.org/x/mod/module" - "golang.org/x/tools/internal/gopathwalk" - "golang.org/x/tools/internal/stdlib" -) - -// To find packages to import, the resolver needs to know about all of -// the packages that could be imported. This includes packages that are -// already in modules that are in (1) the current module, (2) replace targets, -// and (3) packages in the module cache. Packages in (1) and (2) may change over -// time, as the client may edit the current module and locally replaced modules. -// The module cache (which includes all of the packages in (3)) can only -// ever be added to. -// -// The resolver can thus save state about packages in the module cache -// and guarantee that this will not change over time. To obtain information -// about new modules added to the module cache, the module cache should be -// rescanned. -// -// It is OK to serve information about modules that have been deleted, -// as they do still exist. -// TODO(suzmue): can we share information with the caller about -// what module needs to be downloaded to import this package? - -type directoryPackageStatus int - -const ( - _ directoryPackageStatus = iota - directoryScanned - nameLoaded - exportsLoaded -) - -// directoryPackageInfo holds (possibly incomplete) information about packages -// contained in a given directory. -type directoryPackageInfo struct { - // status indicates the extent to which this struct has been filled in. - status directoryPackageStatus - // err is non-nil when there was an error trying to reach status. - err error - - // Set when status >= directoryScanned. - - // dir is the absolute directory of this package. - dir string - rootType gopathwalk.RootType - // nonCanonicalImportPath is the package's expected import path. It may - // not actually be importable at that path. - nonCanonicalImportPath string - - // Module-related information. - moduleDir string // The directory that is the module root of this dir. - moduleName string // The module name that contains this dir. - - // Set when status >= nameLoaded. - - packageName string // the package name, as declared in the source. - - // Set when status >= exportsLoaded. - // TODO(rfindley): it's hard to see this, but exports depend implicitly on - // the default build context GOOS and GOARCH. - // - // We can make this explicit, and key exports by GOOS, GOARCH. - exports []stdlib.Symbol -} - -// reachedStatus returns true when info has a status at least target and any error associated with -// an attempt to reach target. -func (info *directoryPackageInfo) reachedStatus(target directoryPackageStatus) (bool, error) { - if info.err == nil { - return info.status >= target, nil - } - if info.status == target { - return true, info.err - } - return true, nil -} - -// DirInfoCache is a concurrency-safe map for storing information about -// directories that may contain packages. -// -// The information in this cache is built incrementally. Entries are initialized in scan. -// No new keys should be added in any other functions, as all directories containing -// packages are identified in scan. -// -// Other functions, including loadExports and findPackage, may update entries in this cache -// as they discover new things about the directory. -// -// The information in the cache is not expected to change for the cache's -// lifetime, so there is no protection against competing writes. Users should -// take care not to hold the cache across changes to the underlying files. -type DirInfoCache struct { - mu sync.Mutex - // dirs stores information about packages in directories, keyed by absolute path. - dirs map[string]*directoryPackageInfo - listeners map[*int]cacheListener -} - -func NewDirInfoCache() *DirInfoCache { - return &DirInfoCache{ - dirs: make(map[string]*directoryPackageInfo), - listeners: make(map[*int]cacheListener), - } -} - -type cacheListener func(directoryPackageInfo) - -// ScanAndListen calls listener on all the items in the cache, and on anything -// newly added. The returned stop function waits for all in-flight callbacks to -// finish and blocks new ones. -func (d *DirInfoCache) ScanAndListen(ctx context.Context, listener cacheListener) func() { - ctx, cancel := context.WithCancel(ctx) - - // Flushing out all the callbacks is tricky without knowing how many there - // are going to be. Setting an arbitrary limit makes it much easier. - const maxInFlight = 10 - sema := make(chan struct{}, maxInFlight) - for i := 0; i < maxInFlight; i++ { - sema <- struct{}{} - } - - cookie := new(int) // A unique ID we can use for the listener. - - // We can't hold mu while calling the listener. - d.mu.Lock() - var keys []string - for key := range d.dirs { - keys = append(keys, key) - } - d.listeners[cookie] = func(info directoryPackageInfo) { - select { - case <-ctx.Done(): - return - case <-sema: - } - listener(info) - sema <- struct{}{} - } - d.mu.Unlock() - - stop := func() { - cancel() - d.mu.Lock() - delete(d.listeners, cookie) - d.mu.Unlock() - for i := 0; i < maxInFlight; i++ { - <-sema - } - } - - // Process the pre-existing keys. - for _, k := range keys { - select { - case <-ctx.Done(): - return stop - default: - } - if v, ok := d.Load(k); ok { - listener(v) - } - } - - return stop -} - -// Store stores the package info for dir. -func (d *DirInfoCache) Store(dir string, info directoryPackageInfo) { - d.mu.Lock() - // TODO(rfindley, golang/go#59216): should we overwrite an existing entry? - // That seems incorrect as the cache should be idempotent. - _, old := d.dirs[dir] - d.dirs[dir] = &info - var listeners []cacheListener - for _, l := range d.listeners { - listeners = append(listeners, l) - } - d.mu.Unlock() - - if !old { - for _, l := range listeners { - l(info) - } - } -} - -// Load returns a copy of the directoryPackageInfo for absolute directory dir. -func (d *DirInfoCache) Load(dir string) (directoryPackageInfo, bool) { - d.mu.Lock() - defer d.mu.Unlock() - info, ok := d.dirs[dir] - if !ok { - return directoryPackageInfo{}, false - } - return *info, true -} - -// Keys returns the keys currently present in d. -func (d *DirInfoCache) Keys() (keys []string) { - d.mu.Lock() - defer d.mu.Unlock() - for key := range d.dirs { - keys = append(keys, key) - } - return keys -} - -func (d *DirInfoCache) CachePackageName(info directoryPackageInfo) (string, error) { - if loaded, err := info.reachedStatus(nameLoaded); loaded { - return info.packageName, err - } - if scanned, err := info.reachedStatus(directoryScanned); !scanned || err != nil { - return "", fmt.Errorf("cannot read package name, scan error: %v", err) - } - info.packageName, info.err = packageDirToName(info.dir) - info.status = nameLoaded - d.Store(info.dir, info) - return info.packageName, info.err -} - -func (d *DirInfoCache) CacheExports(ctx context.Context, env *ProcessEnv, info directoryPackageInfo) (string, []stdlib.Symbol, error) { - if reached, _ := info.reachedStatus(exportsLoaded); reached { - return info.packageName, info.exports, info.err - } - if reached, err := info.reachedStatus(nameLoaded); reached && err != nil { - return "", nil, err - } - info.packageName, info.exports, info.err = loadExportsFromFiles(ctx, env, info.dir, false) - if info.err == context.Canceled || info.err == context.DeadlineExceeded { - return info.packageName, info.exports, info.err - } - // The cache structure wants things to proceed linearly. We can skip a - // step here, but only if we succeed. - if info.status == nameLoaded || info.err == nil { - info.status = exportsLoaded - } else { - info.status = nameLoaded - } - d.Store(info.dir, info) - return info.packageName, info.exports, info.err -} - -// ScanModuleCache walks the given directory, which must be a GOMODCACHE value, -// for directory package information, storing the results in cache. -func ScanModuleCache(dir string, cache *DirInfoCache, logf func(string, ...any)) { - // Note(rfindley): it's hard to see, but this function attempts to implement - // just the side effects on cache of calling PrimeCache with a ProcessEnv - // that has the given dir as its GOMODCACHE. - // - // Teasing out the control flow, we see that we can avoid any handling of - // vendor/ and can infer module info entirely from the path, simplifying the - // logic here. - - root := gopathwalk.Root{ - Path: filepath.Clean(dir), - Type: gopathwalk.RootModuleCache, - } - - directoryInfo := func(root gopathwalk.Root, dir string) directoryPackageInfo { - // This is a copy of ModuleResolver.scanDirForPackage, trimmed down to - // logic that applies to a module cache directory. - - subdir := "" - if dir != root.Path { - subdir = dir[len(root.Path)+len("/"):] - } - - matches := modCacheRegexp.FindStringSubmatch(subdir) - if len(matches) == 0 { - return directoryPackageInfo{ - status: directoryScanned, - err: fmt.Errorf("invalid module cache path: %v", subdir), - } - } - modPath, err := module.UnescapePath(filepath.ToSlash(matches[1])) - if err != nil { - if logf != nil { - logf("decoding module cache path %q: %v", subdir, err) - } - return directoryPackageInfo{ - status: directoryScanned, - err: fmt.Errorf("decoding module cache path %q: %v", subdir, err), - } - } - importPath := path.Join(modPath, filepath.ToSlash(matches[3])) - index := strings.Index(dir, matches[1]+"@"+matches[2]) - modDir := filepath.Join(dir[:index], matches[1]+"@"+matches[2]) - modName := readModName(filepath.Join(modDir, "go.mod")) - return directoryPackageInfo{ - status: directoryScanned, - dir: dir, - rootType: root.Type, - nonCanonicalImportPath: importPath, - moduleDir: modDir, - moduleName: modName, - } - } - - add := func(root gopathwalk.Root, dir string) { - info := directoryInfo(root, dir) - cache.Store(info.dir, info) - } - - skip := func(_ gopathwalk.Root, dir string) bool { - // Skip directories that have already been scanned. - // - // Note that gopathwalk only adds "package" directories, which must contain - // a .go file, and all such package directories in the module cache are - // immutable. So if we can load a dir, it can be skipped. - info, ok := cache.Load(dir) - if !ok { - return false - } - packageScanned, _ := info.reachedStatus(directoryScanned) - return packageScanned - } - - gopathwalk.WalkSkip([]gopathwalk.Root{root}, add, skip, gopathwalk.Options{Logf: logf, ModulesEnabled: true}) -} diff --git a/vendor/golang.org/x/tools/internal/imports/sortimports.go b/vendor/golang.org/x/tools/internal/imports/sortimports.go deleted file mode 100644 index da8194fd965..00000000000 --- a/vendor/golang.org/x/tools/internal/imports/sortimports.go +++ /dev/null @@ -1,297 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Hacked up copy of go/ast/import.go -// Modified to use a single token.File in preference to a FileSet. - -package imports - -import ( - "go/ast" - "go/token" - "log" - "sort" - "strconv" -) - -// sortImports sorts runs of consecutive import lines in import blocks in f. -// It also removes duplicate imports when it is possible to do so without data loss. -// -// It may mutate the token.File and the ast.File. -func sortImports(localPrefix string, tokFile *token.File, f *ast.File) { - for i, d := range f.Decls { - d, ok := d.(*ast.GenDecl) - if !ok || d.Tok != token.IMPORT { - // Not an import declaration, so we're done. - // Imports are always first. - break - } - - if len(d.Specs) == 0 { - // Empty import block, remove it. - f.Decls = append(f.Decls[:i], f.Decls[i+1:]...) - } - - if !d.Lparen.IsValid() { - // Not a block: sorted by default. - continue - } - - // Identify and sort runs of specs on successive lines. - i := 0 - specs := d.Specs[:0] - for j, s := range d.Specs { - if j > i && tokFile.Line(s.Pos()) > 1+tokFile.Line(d.Specs[j-1].End()) { - // j begins a new run. End this one. - specs = append(specs, sortSpecs(localPrefix, tokFile, f, d.Specs[i:j])...) - i = j - } - } - specs = append(specs, sortSpecs(localPrefix, tokFile, f, d.Specs[i:])...) - d.Specs = specs - - // Deduping can leave a blank line before the rparen; clean that up. - // Ignore line directives. - if len(d.Specs) > 0 { - lastSpec := d.Specs[len(d.Specs)-1] - lastLine := tokFile.PositionFor(lastSpec.Pos(), false).Line - if rParenLine := tokFile.PositionFor(d.Rparen, false).Line; rParenLine > lastLine+1 { - tokFile.MergeLine(rParenLine - 1) // has side effects! - } - } - } -} - -// mergeImports merges all the import declarations into the first one. -// Taken from golang.org/x/tools/ast/astutil. -// This does not adjust line numbers properly -func mergeImports(f *ast.File) { - if len(f.Decls) <= 1 { - return - } - - // Merge all the import declarations into the first one. - var first *ast.GenDecl - for i := 0; i < len(f.Decls); i++ { - decl := f.Decls[i] - gen, ok := decl.(*ast.GenDecl) - if !ok || gen.Tok != token.IMPORT || declImports(gen, "C") { - continue - } - if first == nil { - first = gen - continue // Don't touch the first one. - } - // We now know there is more than one package in this import - // declaration. Ensure that it ends up parenthesized. - first.Lparen = first.Pos() - // Move the imports of the other import declaration to the first one. - for _, spec := range gen.Specs { - spec.(*ast.ImportSpec).Path.ValuePos = first.Pos() - first.Specs = append(first.Specs, spec) - } - f.Decls = append(f.Decls[:i], f.Decls[i+1:]...) - i-- - } -} - -// declImports reports whether gen contains an import of path. -// Taken from golang.org/x/tools/ast/astutil. -func declImports(gen *ast.GenDecl, path string) bool { - if gen.Tok != token.IMPORT { - return false - } - for _, spec := range gen.Specs { - impspec := spec.(*ast.ImportSpec) - if importPath(impspec) == path { - return true - } - } - return false -} - -func importPath(s ast.Spec) string { - t, err := strconv.Unquote(s.(*ast.ImportSpec).Path.Value) - if err == nil { - return t - } - return "" -} - -func importName(s ast.Spec) string { - n := s.(*ast.ImportSpec).Name - if n == nil { - return "" - } - return n.Name -} - -func importComment(s ast.Spec) string { - c := s.(*ast.ImportSpec).Comment - if c == nil { - return "" - } - return c.Text() -} - -// collapse indicates whether prev may be removed, leaving only next. -func collapse(prev, next ast.Spec) bool { - if importPath(next) != importPath(prev) || importName(next) != importName(prev) { - return false - } - return prev.(*ast.ImportSpec).Comment == nil -} - -type posSpan struct { - Start token.Pos - End token.Pos -} - -// sortSpecs sorts the import specs within each import decl. -// It may mutate the token.File. -func sortSpecs(localPrefix string, tokFile *token.File, f *ast.File, specs []ast.Spec) []ast.Spec { - // Can't short-circuit here even if specs are already sorted, - // since they might yet need deduplication. - // A lone import, however, may be safely ignored. - if len(specs) <= 1 { - return specs - } - - // Record positions for specs. - pos := make([]posSpan, len(specs)) - for i, s := range specs { - pos[i] = posSpan{s.Pos(), s.End()} - } - - // Identify comments in this range. - // Any comment from pos[0].Start to the final line counts. - lastLine := tokFile.Line(pos[len(pos)-1].End) - cstart := len(f.Comments) - cend := len(f.Comments) - for i, g := range f.Comments { - if g.Pos() < pos[0].Start { - continue - } - if i < cstart { - cstart = i - } - if tokFile.Line(g.End()) > lastLine { - cend = i - break - } - } - comments := f.Comments[cstart:cend] - - // Assign each comment to the import spec preceding it. - importComment := map[*ast.ImportSpec][]*ast.CommentGroup{} - specIndex := 0 - for _, g := range comments { - for specIndex+1 < len(specs) && pos[specIndex+1].Start <= g.Pos() { - specIndex++ - } - s := specs[specIndex].(*ast.ImportSpec) - importComment[s] = append(importComment[s], g) - } - - // Sort the import specs by import path. - // Remove duplicates, when possible without data loss. - // Reassign the import paths to have the same position sequence. - // Reassign each comment to abut the end of its spec. - // Sort the comments by new position. - sort.Sort(byImportSpec{localPrefix, specs}) - - // Dedup. Thanks to our sorting, we can just consider - // adjacent pairs of imports. - deduped := specs[:0] - for i, s := range specs { - if i == len(specs)-1 || !collapse(s, specs[i+1]) { - deduped = append(deduped, s) - } else { - p := s.Pos() - tokFile.MergeLine(tokFile.Line(p)) // has side effects! - } - } - specs = deduped - - // Fix up comment positions - for i, s := range specs { - s := s.(*ast.ImportSpec) - if s.Name != nil { - s.Name.NamePos = pos[i].Start - } - s.Path.ValuePos = pos[i].Start - s.EndPos = pos[i].End - nextSpecPos := pos[i].End - - for _, g := range importComment[s] { - for _, c := range g.List { - c.Slash = pos[i].End - nextSpecPos = c.End() - } - } - if i < len(specs)-1 { - pos[i+1].Start = nextSpecPos - pos[i+1].End = nextSpecPos - } - } - - sort.Sort(byCommentPos(comments)) - - // Fixup comments can insert blank lines, because import specs are on different lines. - // We remove those blank lines here by merging import spec to the first import spec line. - firstSpecLine := tokFile.Line(specs[0].Pos()) - for _, s := range specs[1:] { - p := s.Pos() - line := tokFile.Line(p) - for previousLine := line - 1; previousLine >= firstSpecLine; { - // MergeLine can panic. Avoid the panic at the cost of not removing the blank line - // golang/go#50329 - if previousLine > 0 && previousLine < tokFile.LineCount() { - tokFile.MergeLine(previousLine) // has side effects! - previousLine-- - } else { - // try to gather some data to diagnose how this could happen - req := "Please report what the imports section of your go file looked like." - log.Printf("panic avoided: first:%d line:%d previous:%d max:%d. %s", - firstSpecLine, line, previousLine, tokFile.LineCount(), req) - } - } - } - return specs -} - -type byImportSpec struct { - localPrefix string - specs []ast.Spec // slice of *ast.ImportSpec -} - -func (x byImportSpec) Len() int { return len(x.specs) } -func (x byImportSpec) Swap(i, j int) { x.specs[i], x.specs[j] = x.specs[j], x.specs[i] } -func (x byImportSpec) Less(i, j int) bool { - ipath := importPath(x.specs[i]) - jpath := importPath(x.specs[j]) - - igroup := importGroup(x.localPrefix, ipath) - jgroup := importGroup(x.localPrefix, jpath) - if igroup != jgroup { - return igroup < jgroup - } - - if ipath != jpath { - return ipath < jpath - } - iname := importName(x.specs[i]) - jname := importName(x.specs[j]) - - if iname != jname { - return iname < jname - } - return importComment(x.specs[i]) < importComment(x.specs[j]) -} - -type byCommentPos []*ast.CommentGroup - -func (x byCommentPos) Len() int { return len(x) } -func (x byCommentPos) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x byCommentPos) Less(i, j int) bool { return x[i].Pos() < x[j].Pos() } diff --git a/vendor/k8s.io/code-generator/LICENSE b/vendor/k8s.io/code-generator/LICENSE deleted file mode 100644 index d6456956733..00000000000 --- a/vendor/k8s.io/code-generator/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/OWNERS b/vendor/k8s.io/code-generator/cmd/client-gen/OWNERS deleted file mode 100644 index 0170a84e8a9..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/OWNERS +++ /dev/null @@ -1,10 +0,0 @@ -# See the OWNERS docs at https://go.k8s.io/owners - -approvers: - - lavalamp - - wojtek-t - - caesarxuchao -reviewers: - - lavalamp - - wojtek-t - - caesarxuchao diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/README.md b/vendor/k8s.io/code-generator/cmd/client-gen/README.md deleted file mode 100644 index b8206127ff5..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/README.md +++ /dev/null @@ -1,2 +0,0 @@ -See [generating-clientset.md](https://git.k8s.io/community/contributors/devel/sig-api-machinery/generating-clientset.md) - diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/args/args.go b/vendor/k8s.io/code-generator/cmd/client-gen/args/args.go deleted file mode 100644 index 4460ad26a25..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/args/args.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 args - -import ( - "fmt" - "path" - - "github.com/spf13/pflag" - "k8s.io/gengo/args" - - "k8s.io/code-generator/cmd/client-gen/types" - codegenutil "k8s.io/code-generator/pkg/util" -) - -var DefaultInputDirs = []string{} - -// CustomArgs is a wrapper for arguments to client-gen. -type CustomArgs struct { - // A sorted list of group versions to generate. For each of them the package path is found - // in GroupVersionToInputPath. - Groups []types.GroupVersions - - // Overrides for which types should be included in the client. - IncludedTypesOverrides map[types.GroupVersion][]string - - // ClientsetName is the name of the clientset to be generated. It's - // populated from command-line arguments. - ClientsetName string - // ClientsetAPIPath is the default API HTTP path for generated clients. - ClientsetAPIPath string - // ClientsetOnly determines if we should generate the clients for groups and - // types along with the clientset. It's populated from command-line - // arguments. - ClientsetOnly bool - // FakeClient determines if client-gen generates the fake clients. - FakeClient bool - // PluralExceptions specify list of exceptions used when pluralizing certain types. - // For example 'Endpoints:Endpoints', otherwise the pluralizer will generate 'Endpointes'. - PluralExceptions []string - - // ApplyConfigurationPackage is the package of apply builders generated by typebuilder-gen. - // If non-empty, Apply functions are generated for each type and reference the apply builders. - // If empty (""), Apply functions are not generated. - ApplyConfigurationPackage string -} - -func NewDefaults() (*args.GeneratorArgs, *CustomArgs) { - genericArgs := args.Default().WithoutDefaultFlagParsing() - customArgs := &CustomArgs{ - ClientsetName: "internalclientset", - ClientsetAPIPath: "/apis", - ClientsetOnly: false, - FakeClient: true, - PluralExceptions: []string{"Endpoints:Endpoints"}, - ApplyConfigurationPackage: "", - } - genericArgs.CustomArgs = customArgs - genericArgs.InputDirs = DefaultInputDirs - - if pkg := codegenutil.CurrentPackage(); len(pkg) != 0 { - genericArgs.OutputPackagePath = path.Join(pkg, "pkg/client/clientset") - } - - return genericArgs, customArgs -} - -func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet, inputBase string) { - gvsBuilder := NewGroupVersionsBuilder(&ca.Groups) - pflag.Var(NewGVPackagesValue(gvsBuilder, nil), "input", "group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format \"group1/version1,group2/version2...\".") - pflag.Var(NewGVTypesValue(&ca.IncludedTypesOverrides, []string{}), "included-types-overrides", "list of group/version/type for which client should be generated. By default, client is generated for all types which have genclient in types.go. This overrides that. For each groupVersion in this list, only the types mentioned here will be included. The default check of genclient will be used for other group versions.") - pflag.Var(NewInputBasePathValue(gvsBuilder, inputBase), "input-base", "base path to look for the api group.") - pflag.StringVarP(&ca.ClientsetName, "clientset-name", "n", ca.ClientsetName, "the name of the generated clientset package.") - pflag.StringVarP(&ca.ClientsetAPIPath, "clientset-api-path", "", ca.ClientsetAPIPath, "the value of default API HTTP path, starting with / and without trailing /.") - pflag.BoolVar(&ca.ClientsetOnly, "clientset-only", ca.ClientsetOnly, "when set, client-gen only generates the clientset shell, without generating the individual typed clients") - pflag.BoolVar(&ca.FakeClient, "fake-clientset", ca.FakeClient, "when set, client-gen will generate the fake clientset that can be used in tests") - - fs.StringSliceVar(&ca.PluralExceptions, "plural-exceptions", ca.PluralExceptions, "list of comma separated plural exception definitions in Type:PluralizedType form") - fs.StringVar(&ca.ApplyConfigurationPackage, "apply-configuration-package", ca.ApplyConfigurationPackage, "optional package of apply configurations, generated by applyconfiguration-gen, that are required to generate Apply functions for each type in the clientset. By default Apply functions are not generated.") - - // support old flags - fs.SetNormalizeFunc(mapFlagName("clientset-path", "output-package", fs.GetNormalizeFunc())) -} - -func Validate(genericArgs *args.GeneratorArgs) error { - customArgs := genericArgs.CustomArgs.(*CustomArgs) - - if len(genericArgs.OutputPackagePath) == 0 { - return fmt.Errorf("output package cannot be empty") - } - if len(customArgs.ClientsetName) == 0 { - return fmt.Errorf("clientset name cannot be empty") - } - if len(customArgs.ClientsetAPIPath) == 0 { - return fmt.Errorf("clientset API path cannot be empty") - } - - return nil -} - -// GroupVersionPackages returns a map from GroupVersion to the package with the types.go. -func (ca *CustomArgs) GroupVersionPackages() map[types.GroupVersion]string { - res := map[types.GroupVersion]string{} - for _, pkg := range ca.Groups { - for _, v := range pkg.Versions { - res[types.GroupVersion{Group: pkg.Group, Version: v.Version}] = v.Package - } - } - return res -} - -func mapFlagName(from, to string, old func(fs *pflag.FlagSet, name string) pflag.NormalizedName) func(fs *pflag.FlagSet, name string) pflag.NormalizedName { - return func(fs *pflag.FlagSet, name string) pflag.NormalizedName { - if name == from { - name = to - } - return old(fs, name) - } -} diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/args/gvpackages.go b/vendor/k8s.io/code-generator/cmd/client-gen/args/gvpackages.go deleted file mode 100644 index 50d29a95be1..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/args/gvpackages.go +++ /dev/null @@ -1,173 +0,0 @@ -/* -Copyright 2017 The Kubernetes 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 args - -import ( - "bytes" - "encoding/csv" - "flag" - "path" - "sort" - "strings" - - "k8s.io/code-generator/cmd/client-gen/generators/util" - "k8s.io/code-generator/cmd/client-gen/types" -) - -type inputBasePathValue struct { - builder *groupVersionsBuilder -} - -var _ flag.Value = &inputBasePathValue{} - -func NewInputBasePathValue(builder *groupVersionsBuilder, def string) *inputBasePathValue { - v := &inputBasePathValue{ - builder: builder, - } - v.Set(def) - return v -} - -func (s *inputBasePathValue) Set(val string) error { - s.builder.importBasePath = val - return s.builder.update() -} - -func (s *inputBasePathValue) Type() string { - return "string" -} - -func (s *inputBasePathValue) String() string { - return s.builder.importBasePath -} - -type gvPackagesValue struct { - builder *groupVersionsBuilder - groups []string - changed bool -} - -func NewGVPackagesValue(builder *groupVersionsBuilder, def []string) *gvPackagesValue { - gvp := new(gvPackagesValue) - gvp.builder = builder - if def != nil { - if err := gvp.set(def); err != nil { - panic(err) - } - } - return gvp -} - -var _ flag.Value = &gvPackagesValue{} - -func (s *gvPackagesValue) set(vs []string) error { - if s.changed { - s.groups = append(s.groups, vs...) - } else { - s.groups = append([]string(nil), vs...) - } - - s.builder.groups = s.groups - return s.builder.update() -} - -func (s *gvPackagesValue) Set(val string) error { - vs, err := readAsCSV(val) - if err != nil { - return err - } - if err := s.set(vs); err != nil { - return err - } - s.changed = true - return nil -} - -func (s *gvPackagesValue) Type() string { - return "stringSlice" -} - -func (s *gvPackagesValue) String() string { - str, _ := writeAsCSV(s.groups) - return "[" + str + "]" -} - -type groupVersionsBuilder struct { - value *[]types.GroupVersions - groups []string - importBasePath string -} - -func NewGroupVersionsBuilder(groups *[]types.GroupVersions) *groupVersionsBuilder { - return &groupVersionsBuilder{ - value: groups, - } -} - -func (p *groupVersionsBuilder) update() error { - var seenGroups = make(map[types.Group]*types.GroupVersions) - for _, v := range p.groups { - pth, gvString := util.ParsePathGroupVersion(v) - gv, err := types.ToGroupVersion(gvString) - if err != nil { - return err - } - - versionPkg := types.PackageVersion{Package: path.Join(p.importBasePath, pth, gv.Group.NonEmpty(), gv.Version.String()), Version: gv.Version} - if group, ok := seenGroups[gv.Group]; ok { - seenGroups[gv.Group].Versions = append(group.Versions, versionPkg) - } else { - seenGroups[gv.Group] = &types.GroupVersions{ - PackageName: gv.Group.NonEmpty(), - Group: gv.Group, - Versions: []types.PackageVersion{versionPkg}, - } - } - } - - var groupNames []string - for groupName := range seenGroups { - groupNames = append(groupNames, groupName.String()) - } - sort.Strings(groupNames) - *p.value = []types.GroupVersions{} - for _, groupName := range groupNames { - *p.value = append(*p.value, *seenGroups[types.Group(groupName)]) - } - - return nil -} - -func readAsCSV(val string) ([]string, error) { - if val == "" { - return []string{}, nil - } - stringReader := strings.NewReader(val) - csvReader := csv.NewReader(stringReader) - return csvReader.Read() -} - -func writeAsCSV(vals []string) (string, error) { - b := &bytes.Buffer{} - w := csv.NewWriter(b) - err := w.Write(vals) - if err != nil { - return "", err - } - w.Flush() - return strings.TrimSuffix(b.String(), "\n"), nil -} diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/args/gvtype.go b/vendor/k8s.io/code-generator/cmd/client-gen/args/gvtype.go deleted file mode 100644 index e4e3ccb5366..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/args/gvtype.go +++ /dev/null @@ -1,110 +0,0 @@ -/* -Copyright 2017 The Kubernetes 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 args - -import ( - "flag" - "fmt" - "strings" - - "k8s.io/code-generator/cmd/client-gen/types" -) - -type gvTypeValue struct { - gvToTypes *map[types.GroupVersion][]string - changed bool -} - -func NewGVTypesValue(gvToTypes *map[types.GroupVersion][]string, def []string) *gvTypeValue { - gvt := new(gvTypeValue) - gvt.gvToTypes = gvToTypes - if def != nil { - if err := gvt.set(def); err != nil { - panic(err) - } - } - return gvt -} - -var _ flag.Value = &gvTypeValue{} - -func (s *gvTypeValue) set(vs []string) error { - if !s.changed { - *s.gvToTypes = map[types.GroupVersion][]string{} - } - - for _, input := range vs { - gvString, typeStr, err := parseGroupVersionType(input) - if err != nil { - return err - } - gv, err := types.ToGroupVersion(gvString) - if err != nil { - return err - } - types, ok := (*s.gvToTypes)[gv] - if !ok { - types = []string{} - } - types = append(types, typeStr) - (*s.gvToTypes)[gv] = types - } - - return nil -} - -func (s *gvTypeValue) Set(val string) error { - vs, err := readAsCSV(val) - if err != nil { - return err - } - if err := s.set(vs); err != nil { - return err - } - s.changed = true - return nil -} - -func (s *gvTypeValue) Type() string { - return "stringSlice" -} - -func (s *gvTypeValue) String() string { - strs := make([]string, 0, len(*s.gvToTypes)) - for gv, ts := range *s.gvToTypes { - for _, t := range ts { - strs = append(strs, gv.Group.String()+"/"+gv.Version.String()+"/"+t) - } - } - str, _ := writeAsCSV(strs) - return "[" + str + "]" -} - -func parseGroupVersionType(gvtString string) (gvString string, typeStr string, err error) { - invalidFormatErr := fmt.Errorf("invalid value: %s, should be of the form group/version/type", gvtString) - subs := strings.Split(gvtString, "/") - length := len(subs) - switch length { - case 2: - // gvtString of the form group/type, e.g. api/Service,extensions/ReplicaSet - return subs[0] + "/", subs[1], nil - case 3: - return strings.Join(subs[:length-1], "/"), subs[length-1], nil - default: - return "", "", invalidFormatErr - } -} diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go deleted file mode 100644 index 6739a3fa46d..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go +++ /dev/null @@ -1,403 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 generators has the generators for the client-gen utility. -package generators - -import ( - "path/filepath" - "strings" - - clientgenargs "k8s.io/code-generator/cmd/client-gen/args" - "k8s.io/code-generator/cmd/client-gen/generators/fake" - "k8s.io/code-generator/cmd/client-gen/generators/scheme" - "k8s.io/code-generator/cmd/client-gen/generators/util" - "k8s.io/code-generator/cmd/client-gen/path" - clientgentypes "k8s.io/code-generator/cmd/client-gen/types" - codegennamer "k8s.io/code-generator/pkg/namer" - genutil "k8s.io/code-generator/pkg/util" - "k8s.io/gengo/args" - "k8s.io/gengo/generator" - "k8s.io/gengo/namer" - "k8s.io/gengo/types" - - "k8s.io/klog/v2" -) - -// NameSystems returns the name system used by the generators in this package. -func NameSystems(pluralExceptions map[string]string) namer.NameSystems { - lowercaseNamer := namer.NewAllLowercasePluralNamer(pluralExceptions) - - publicNamer := &ExceptionNamer{ - Exceptions: map[string]string{ - // these exceptions are used to deconflict the generated code - // you can put your fully qualified package like - // to generate a name that doesn't conflict with your group. - // "k8s.io/apis/events/v1beta1.Event": "EventResource" - }, - KeyFunc: func(t *types.Type) string { - return t.Name.Package + "." + t.Name.Name - }, - Delegate: namer.NewPublicNamer(0), - } - privateNamer := &ExceptionNamer{ - Exceptions: map[string]string{ - // these exceptions are used to deconflict the generated code - // you can put your fully qualified package like - // to generate a name that doesn't conflict with your group. - // "k8s.io/apis/events/v1beta1.Event": "eventResource" - }, - KeyFunc: func(t *types.Type) string { - return t.Name.Package + "." + t.Name.Name - }, - Delegate: namer.NewPrivateNamer(0), - } - publicPluralNamer := &ExceptionNamer{ - Exceptions: map[string]string{ - // these exceptions are used to deconflict the generated code - // you can put your fully qualified package like - // to generate a name that doesn't conflict with your group. - // "k8s.io/apis/events/v1beta1.Event": "EventResource" - }, - KeyFunc: func(t *types.Type) string { - return t.Name.Package + "." + t.Name.Name - }, - Delegate: namer.NewPublicPluralNamer(pluralExceptions), - } - privatePluralNamer := &ExceptionNamer{ - Exceptions: map[string]string{ - // you can put your fully qualified package like - // to generate a name that doesn't conflict with your group. - // "k8s.io/apis/events/v1beta1.Event": "eventResource" - // these exceptions are used to deconflict the generated code - "k8s.io/apis/events/v1beta1.Event": "eventResources", - "k8s.io/kubernetes/pkg/apis/events.Event": "eventResources", - }, - KeyFunc: func(t *types.Type) string { - return t.Name.Package + "." + t.Name.Name - }, - Delegate: namer.NewPrivatePluralNamer(pluralExceptions), - } - - return namer.NameSystems{ - "singularKind": namer.NewPublicNamer(0), - "public": publicNamer, - "private": privateNamer, - "raw": namer.NewRawNamer("", nil), - "publicPlural": publicPluralNamer, - "privatePlural": privatePluralNamer, - "allLowercasePlural": lowercaseNamer, - "resource": codegennamer.NewTagOverrideNamer("resourceName", lowercaseNamer), - } -} - -// ExceptionNamer allows you specify exceptional cases with exact names. This allows you to have control -// for handling various conflicts, like group and resource names for instance. -type ExceptionNamer struct { - Exceptions map[string]string - KeyFunc func(*types.Type) string - - Delegate namer.Namer -} - -// Name provides the requested name for a type. -func (n *ExceptionNamer) Name(t *types.Type) string { - key := n.KeyFunc(t) - if exception, ok := n.Exceptions[key]; ok { - return exception - } - return n.Delegate.Name(t) -} - -// DefaultNameSystem returns the default name system for ordering the types to be -// processed by the generators in this package. -func DefaultNameSystem() string { - return "public" -} - -func packageForGroup(gv clientgentypes.GroupVersion, typeList []*types.Type, clientsetPackage string, groupPackageName string, groupGoName string, apiPath string, srcTreePath string, inputPackage string, applyBuilderPackage string, boilerplate []byte) generator.Package { - groupVersionClientPackage := filepath.Join(clientsetPackage, "typed", strings.ToLower(groupPackageName), strings.ToLower(gv.Version.NonEmpty())) - return &generator.DefaultPackage{ - PackageName: strings.ToLower(gv.Version.NonEmpty()), - PackagePath: groupVersionClientPackage, - HeaderText: boilerplate, - PackageDocumentation: []byte( - `// This package has the automatically generated typed clients. -`), - // GeneratorFunc returns a list of generators. Each generator makes a - // single file. - GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) { - generators = []generator.Generator{ - // Always generate a "doc.go" file. - generator.DefaultGen{OptionalName: "doc"}, - } - // Since we want a file per type that we generate a client for, we - // have to provide a function for this. - for _, t := range typeList { - generators = append(generators, &genClientForType{ - DefaultGen: generator.DefaultGen{ - OptionalName: strings.ToLower(c.Namers["private"].Name(t)), - }, - outputPackage: groupVersionClientPackage, - inputPackage: inputPackage, - clientsetPackage: clientsetPackage, - applyConfigurationPackage: applyBuilderPackage, - group: gv.Group.NonEmpty(), - version: gv.Version.String(), - groupGoName: groupGoName, - typeToMatch: t, - imports: generator.NewImportTracker(), - }) - } - - generators = append(generators, &genGroup{ - DefaultGen: generator.DefaultGen{ - OptionalName: groupPackageName + "_client", - }, - outputPackage: groupVersionClientPackage, - inputPackage: inputPackage, - clientsetPackage: clientsetPackage, - group: gv.Group.NonEmpty(), - version: gv.Version.String(), - groupGoName: groupGoName, - apiPath: apiPath, - types: typeList, - imports: generator.NewImportTracker(), - }) - - expansionFileName := "generated_expansion" - generators = append(generators, &genExpansion{ - groupPackagePath: filepath.Join(srcTreePath, groupVersionClientPackage), - DefaultGen: generator.DefaultGen{ - OptionalName: expansionFileName, - }, - types: typeList, - }) - - return generators - }, - FilterFunc: func(c *generator.Context, t *types.Type) bool { - return util.MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)).GenerateClient - }, - } -} - -func packageForClientset(customArgs *clientgenargs.CustomArgs, clientsetPackage string, groupGoNames map[clientgentypes.GroupVersion]string, boilerplate []byte) generator.Package { - return &generator.DefaultPackage{ - PackageName: customArgs.ClientsetName, - PackagePath: clientsetPackage, - HeaderText: boilerplate, - PackageDocumentation: []byte( - `// This package has the automatically generated clientset. -`), - // GeneratorFunc returns a list of generators. Each generator generates a - // single file. - GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) { - generators = []generator.Generator{ - // Always generate a "doc.go" file. - generator.DefaultGen{OptionalName: "doc"}, - - &genClientset{ - DefaultGen: generator.DefaultGen{ - OptionalName: "clientset", - }, - groups: customArgs.Groups, - groupGoNames: groupGoNames, - clientsetPackage: clientsetPackage, - outputPackage: customArgs.ClientsetName, - imports: generator.NewImportTracker(), - }, - } - return generators - }, - } -} - -func packageForScheme(customArgs *clientgenargs.CustomArgs, clientsetPackage string, srcTreePath string, groupGoNames map[clientgentypes.GroupVersion]string, boilerplate []byte) generator.Package { - schemePackage := filepath.Join(clientsetPackage, "scheme") - - // create runtime.Registry for internal client because it has to know about group versions - internalClient := false -NextGroup: - for _, group := range customArgs.Groups { - for _, v := range group.Versions { - if v.String() == "" { - internalClient = true - break NextGroup - } - } - } - - return &generator.DefaultPackage{ - PackageName: "scheme", - PackagePath: schemePackage, - HeaderText: boilerplate, - PackageDocumentation: []byte( - `// This package contains the scheme of the automatically generated clientset. -`), - // GeneratorFunc returns a list of generators. Each generator generates a - // single file. - GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) { - generators = []generator.Generator{ - // Always generate a "doc.go" file. - generator.DefaultGen{OptionalName: "doc"}, - - &scheme.GenScheme{ - DefaultGen: generator.DefaultGen{ - OptionalName: "register", - }, - InputPackages: customArgs.GroupVersionPackages(), - OutputPackage: schemePackage, - OutputPath: filepath.Join(srcTreePath, schemePackage), - Groups: customArgs.Groups, - GroupGoNames: groupGoNames, - ImportTracker: generator.NewImportTracker(), - CreateRegistry: internalClient, - }, - } - return generators - }, - } -} - -// applyGroupOverrides applies group name overrides to each package, if applicable. If there is a -// comment of the form "// +groupName=somegroup" or "// +groupName=somegroup.foo.bar.io", use the -// first field (somegroup) as the name of the group in Go code, e.g. as the func name in a clientset. -// -// If the first field of the groupName is not unique within the clientset, use "// +groupName=unique -func applyGroupOverrides(universe types.Universe, customArgs *clientgenargs.CustomArgs) { - // Create a map from "old GV" to "new GV" so we know what changes we need to make. - changes := make(map[clientgentypes.GroupVersion]clientgentypes.GroupVersion) - for gv, inputDir := range customArgs.GroupVersionPackages() { - p := universe.Package(genutil.Vendorless(inputDir)) - if override := types.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil { - newGV := clientgentypes.GroupVersion{ - Group: clientgentypes.Group(override[0]), - Version: gv.Version, - } - changes[gv] = newGV - } - } - - // Modify customArgs.Groups based on the groupName overrides. - newGroups := make([]clientgentypes.GroupVersions, 0, len(customArgs.Groups)) - for _, gvs := range customArgs.Groups { - gv := clientgentypes.GroupVersion{ - Group: gvs.Group, - Version: gvs.Versions[0].Version, // we only need a version, and the first will do - } - if newGV, ok := changes[gv]; ok { - // There's an override, so use it. - newGVS := clientgentypes.GroupVersions{ - PackageName: gvs.PackageName, - Group: newGV.Group, - Versions: gvs.Versions, - } - newGroups = append(newGroups, newGVS) - } else { - // No override. - newGroups = append(newGroups, gvs) - } - } - customArgs.Groups = newGroups -} - -// Packages makes the client package definition. -func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages { - boilerplate, err := arguments.LoadGoBoilerplate() - if err != nil { - klog.Fatalf("Failed loading boilerplate: %v", err) - } - - customArgs, ok := arguments.CustomArgs.(*clientgenargs.CustomArgs) - if !ok { - klog.Fatalf("cannot convert arguments.CustomArgs to clientgenargs.CustomArgs") - } - includedTypesOverrides := customArgs.IncludedTypesOverrides - - applyGroupOverrides(context.Universe, customArgs) - - gvToTypes := map[clientgentypes.GroupVersion][]*types.Type{} - groupGoNames := make(map[clientgentypes.GroupVersion]string) - for gv, inputDir := range customArgs.GroupVersionPackages() { - p := context.Universe.Package(path.Vendorless(inputDir)) - - // If there's a comment of the form "// +groupGoName=SomeUniqueShortName", use that as - // the Go group identifier in CamelCase. It defaults - groupGoNames[gv] = namer.IC(strings.Split(gv.Group.NonEmpty(), ".")[0]) - if override := types.ExtractCommentTags("+", p.Comments)["groupGoName"]; override != nil { - groupGoNames[gv] = namer.IC(override[0]) - } - - // Package are indexed with the vendor prefix stripped - for n, t := range p.Types { - // filter out types which are not included in user specified overrides. - typesOverride, ok := includedTypesOverrides[gv] - if ok { - found := false - for _, typeStr := range typesOverride { - if typeStr == n { - found = true - break - } - } - if !found { - continue - } - } else { - // User has not specified any override for this group version. - // filter out types which don't have genclient. - if tags := util.MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)); !tags.GenerateClient { - continue - } - } - if _, found := gvToTypes[gv]; !found { - gvToTypes[gv] = []*types.Type{} - } - gvToTypes[gv] = append(gvToTypes[gv], t) - } - } - - var packageList []generator.Package - clientsetPackage := filepath.Join(arguments.OutputPackagePath, customArgs.ClientsetName) - - packageList = append(packageList, packageForClientset(customArgs, clientsetPackage, groupGoNames, boilerplate)) - packageList = append(packageList, packageForScheme(customArgs, clientsetPackage, arguments.OutputBase, groupGoNames, boilerplate)) - if customArgs.FakeClient { - packageList = append(packageList, fake.PackageForClientset(customArgs, clientsetPackage, groupGoNames, boilerplate)) - } - - // If --clientset-only=true, we don't regenerate the individual typed clients. - if customArgs.ClientsetOnly { - return generator.Packages(packageList) - } - - orderer := namer.Orderer{Namer: namer.NewPrivateNamer(0)} - gvPackages := customArgs.GroupVersionPackages() - for _, group := range customArgs.Groups { - for _, version := range group.Versions { - gv := clientgentypes.GroupVersion{Group: group.Group, Version: version.Version} - types := gvToTypes[gv] - inputPath := gvPackages[gv] - packageList = append(packageList, packageForGroup(gv, orderer.OrderTypes(types), clientsetPackage, group.PackageName, groupGoNames[gv], customArgs.ClientsetAPIPath, arguments.OutputBase, inputPath, customArgs.ApplyConfigurationPackage, boilerplate)) - if customArgs.FakeClient { - packageList = append(packageList, fake.PackageForGroup(gv, orderer.OrderTypes(types), clientsetPackage, group.PackageName, groupGoNames[gv], inputPath, customArgs.ApplyConfigurationPackage, boilerplate)) - } - } - } - - return generator.Packages(packageList) -} diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/fake_client_generator.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/fake_client_generator.go deleted file mode 100644 index 1794909148f..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/fake_client_generator.go +++ /dev/null @@ -1,131 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 fake - -import ( - "path/filepath" - "strings" - - "k8s.io/gengo/generator" - "k8s.io/gengo/types" - - clientgenargs "k8s.io/code-generator/cmd/client-gen/args" - scheme "k8s.io/code-generator/cmd/client-gen/generators/scheme" - "k8s.io/code-generator/cmd/client-gen/generators/util" - clientgentypes "k8s.io/code-generator/cmd/client-gen/types" -) - -func PackageForGroup(gv clientgentypes.GroupVersion, typeList []*types.Type, clientsetPackage string, groupPackageName string, groupGoName string, inputPackage string, applyBuilderPackage string, boilerplate []byte) generator.Package { - outputPackage := filepath.Join(clientsetPackage, "typed", strings.ToLower(groupPackageName), strings.ToLower(gv.Version.NonEmpty()), "fake") - // TODO: should make this a function, called by here and in client-generator.go - realClientPackage := filepath.Join(clientsetPackage, "typed", strings.ToLower(groupPackageName), strings.ToLower(gv.Version.NonEmpty())) - return &generator.DefaultPackage{ - PackageName: "fake", - PackagePath: outputPackage, - HeaderText: boilerplate, - PackageDocumentation: []byte( - `// Package fake has the automatically generated clients. -`), - // GeneratorFunc returns a list of generators. Each generator makes a - // single file. - GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) { - generators = []generator.Generator{ - // Always generate a "doc.go" file. - generator.DefaultGen{OptionalName: "doc"}, - } - // Since we want a file per type that we generate a client for, we - // have to provide a function for this. - for _, t := range typeList { - generators = append(generators, &genFakeForType{ - DefaultGen: generator.DefaultGen{ - OptionalName: "fake_" + strings.ToLower(c.Namers["private"].Name(t)), - }, - outputPackage: outputPackage, - inputPackage: inputPackage, - group: gv.Group.NonEmpty(), - version: gv.Version.String(), - groupGoName: groupGoName, - typeToMatch: t, - imports: generator.NewImportTracker(), - applyConfigurationPackage: applyBuilderPackage, - }) - } - - generators = append(generators, &genFakeForGroup{ - DefaultGen: generator.DefaultGen{ - OptionalName: "fake_" + groupPackageName + "_client", - }, - outputPackage: outputPackage, - realClientPackage: realClientPackage, - group: gv.Group.NonEmpty(), - version: gv.Version.String(), - groupGoName: groupGoName, - types: typeList, - imports: generator.NewImportTracker(), - }) - return generators - }, - FilterFunc: func(c *generator.Context, t *types.Type) bool { - return util.MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)).GenerateClient - }, - } -} - -func PackageForClientset(customArgs *clientgenargs.CustomArgs, clientsetPackage string, groupGoNames map[clientgentypes.GroupVersion]string, boilerplate []byte) generator.Package { - return &generator.DefaultPackage{ - // TODO: we'll generate fake clientset for different release in the future. - // Package name and path are hard coded for now. - PackageName: "fake", - PackagePath: filepath.Join(clientsetPackage, "fake"), - HeaderText: boilerplate, - PackageDocumentation: []byte( - `// This package has the automatically generated fake clientset. -`), - // GeneratorFunc returns a list of generators. Each generator generates a - // single file. - GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) { - generators = []generator.Generator{ - // Always generate a "doc.go" file. - generator.DefaultGen{OptionalName: "doc"}, - - &genClientset{ - DefaultGen: generator.DefaultGen{ - OptionalName: "clientset_generated", - }, - groups: customArgs.Groups, - groupGoNames: groupGoNames, - fakeClientsetPackage: clientsetPackage, - outputPackage: "fake", - imports: generator.NewImportTracker(), - realClientsetPackage: clientsetPackage, - }, - &scheme.GenScheme{ - DefaultGen: generator.DefaultGen{ - OptionalName: "register", - }, - InputPackages: customArgs.GroupVersionPackages(), - OutputPackage: clientsetPackage, - Groups: customArgs.Groups, - GroupGoNames: groupGoNames, - ImportTracker: generator.NewImportTracker(), - PrivateScheme: true, - }, - } - return generators - }, - } -} diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_clientset.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_clientset.go deleted file mode 100644 index cd731cb9d66..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_clientset.go +++ /dev/null @@ -1,170 +0,0 @@ -/* -Copyright 2016 The Kubernetes 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 fake - -import ( - "fmt" - "io" - "path/filepath" - "strings" - - clientgentypes "k8s.io/code-generator/cmd/client-gen/types" - "k8s.io/gengo/generator" - "k8s.io/gengo/namer" - "k8s.io/gengo/types" -) - -// genClientset generates a package for a clientset. -type genClientset struct { - generator.DefaultGen - groups []clientgentypes.GroupVersions - groupGoNames map[clientgentypes.GroupVersion]string - fakeClientsetPackage string - outputPackage string - imports namer.ImportTracker - clientsetGenerated bool - // the import path of the generated real clientset. - realClientsetPackage string -} - -var _ generator.Generator = &genClientset{} - -func (g *genClientset) Namers(c *generator.Context) namer.NameSystems { - return namer.NameSystems{ - "raw": namer.NewRawNamer(g.outputPackage, g.imports), - } -} - -// We only want to call GenerateType() once. -func (g *genClientset) Filter(c *generator.Context, t *types.Type) bool { - ret := !g.clientsetGenerated - g.clientsetGenerated = true - return ret -} - -func (g *genClientset) Imports(c *generator.Context) (imports []string) { - imports = append(imports, g.imports.ImportLines()...) - for _, group := range g.groups { - for _, version := range group.Versions { - groupClientPackage := filepath.Join(g.fakeClientsetPackage, "typed", strings.ToLower(group.PackageName), strings.ToLower(version.NonEmpty())) - fakeGroupClientPackage := filepath.Join(groupClientPackage, "fake") - - groupAlias := strings.ToLower(g.groupGoNames[clientgentypes.GroupVersion{Group: group.Group, Version: version.Version}]) - imports = append(imports, fmt.Sprintf("%s%s \"%s\"", groupAlias, strings.ToLower(version.NonEmpty()), groupClientPackage)) - imports = append(imports, fmt.Sprintf("fake%s%s \"%s\"", groupAlias, strings.ToLower(version.NonEmpty()), fakeGroupClientPackage)) - } - } - // the package that has the clientset Interface - imports = append(imports, fmt.Sprintf("clientset \"%s\"", g.realClientsetPackage)) - // imports for the code in commonTemplate - imports = append(imports, - "k8s.io/client-go/testing", - "k8s.io/client-go/discovery", - "fakediscovery \"k8s.io/client-go/discovery/fake\"", - "k8s.io/apimachinery/pkg/runtime", - "k8s.io/apimachinery/pkg/watch", - ) - - return -} - -func (g *genClientset) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { - // TODO: We actually don't need any type information to generate the clientset, - // perhaps we can adapt the go2ild framework to this kind of usage. - sw := generator.NewSnippetWriter(w, c, "$", "$") - - allGroups := clientgentypes.ToGroupVersionInfo(g.groups, g.groupGoNames) - - sw.Do(common, nil) - sw.Do(checkImpl, nil) - - for _, group := range allGroups { - m := map[string]interface{}{ - "group": group.Group, - "version": group.Version, - "PackageAlias": group.PackageAlias, - "GroupGoName": group.GroupGoName, - "Version": namer.IC(group.Version.String()), - } - - sw.Do(clientsetInterfaceImplTemplate, m) - } - - return sw.Error() -} - -// This part of code is version-independent, unchanging. -var common = ` -// NewSimpleClientset returns a clientset that will respond with the provided objects. -// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement -// for a real clientset and is mostly useful in simple unit tests. -func NewSimpleClientset(objects ...runtime.Object) *Clientset { - o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) - for _, obj := range objects { - if err := o.Add(obj); err != nil { - panic(err) - } - } - - cs := &Clientset{tracker: o} - cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} - cs.AddReactor("*", "*", testing.ObjectReaction(o)) - cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { - gvr := action.GetResource() - ns := action.GetNamespace() - watch, err := o.Watch(gvr, ns) - if err != nil { - return false, nil, err - } - return true, watch, nil - }) - - return cs -} - -// Clientset implements clientset.Interface. Meant to be embedded into a -// struct to get a default implementation. This makes faking out just the method -// you want to test easier. -type Clientset struct { - testing.Fake - discovery *fakediscovery.FakeDiscovery - tracker testing.ObjectTracker -} - -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - return c.discovery -} - -func (c *Clientset) Tracker() testing.ObjectTracker { - return c.tracker -} -` - -var checkImpl = ` -var ( - _ clientset.Interface = &Clientset{} - _ testing.FakeClient = &Clientset{} -) -` - -var clientsetInterfaceImplTemplate = ` -// $.GroupGoName$$.Version$ retrieves the $.GroupGoName$$.Version$Client -func (c *Clientset) $.GroupGoName$$.Version$() $.PackageAlias$.$.GroupGoName$$.Version$Interface { - return &fake$.PackageAlias$.Fake$.GroupGoName$$.Version${Fake: &c.Fake} -} -` diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_group.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_group.go deleted file mode 100644 index 8f4d5785ef9..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_group.go +++ /dev/null @@ -1,130 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 fake - -import ( - "fmt" - "io" - "path/filepath" - "strings" - - "k8s.io/gengo/generator" - "k8s.io/gengo/namer" - "k8s.io/gengo/types" - - "k8s.io/code-generator/cmd/client-gen/generators/util" -) - -// genFakeForGroup produces a file for a group client, e.g. ExtensionsClient for the extension group. -type genFakeForGroup struct { - generator.DefaultGen - outputPackage string - realClientPackage string - group string - version string - groupGoName string - // types in this group - types []*types.Type - imports namer.ImportTracker - // If the genGroup has been called. This generator should only execute once. - called bool -} - -var _ generator.Generator = &genFakeForGroup{} - -// We only want to call GenerateType() once per group. -func (g *genFakeForGroup) Filter(c *generator.Context, t *types.Type) bool { - if !g.called { - g.called = true - return true - } - return false -} - -func (g *genFakeForGroup) Namers(c *generator.Context) namer.NameSystems { - return namer.NameSystems{ - "raw": namer.NewRawNamer(g.outputPackage, g.imports), - } -} - -func (g *genFakeForGroup) Imports(c *generator.Context) (imports []string) { - imports = g.imports.ImportLines() - if len(g.types) != 0 { - imports = append(imports, fmt.Sprintf("%s \"%s\"", strings.ToLower(filepath.Base(g.realClientPackage)), g.realClientPackage)) - } - return imports -} - -func (g *genFakeForGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { - sw := generator.NewSnippetWriter(w, c, "$", "$") - - m := map[string]interface{}{ - "GroupGoName": g.groupGoName, - "Version": namer.IC(g.version), - "Fake": c.Universe.Type(types.Name{Package: "k8s.io/client-go/testing", Name: "Fake"}), - "RESTClientInterface": c.Universe.Type(types.Name{Package: "k8s.io/client-go/rest", Name: "Interface"}), - "RESTClient": c.Universe.Type(types.Name{Package: "k8s.io/client-go/rest", Name: "RESTClient"}), - } - - sw.Do(groupClientTemplate, m) - for _, t := range g.types { - tags, err := util.ParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)) - if err != nil { - return err - } - wrapper := map[string]interface{}{ - "type": t, - "GroupGoName": g.groupGoName, - "Version": namer.IC(g.version), - "realClientPackage": strings.ToLower(filepath.Base(g.realClientPackage)), - } - if tags.NonNamespaced { - sw.Do(getterImplNonNamespaced, wrapper) - continue - } - sw.Do(getterImplNamespaced, wrapper) - } - sw.Do(getRESTClient, m) - return sw.Error() -} - -var groupClientTemplate = ` -type Fake$.GroupGoName$$.Version$ struct { - *$.Fake|raw$ -} -` - -var getterImplNamespaced = ` -func (c *Fake$.GroupGoName$$.Version$) $.type|publicPlural$(namespace string) $.realClientPackage$.$.type|public$Interface { - return &Fake$.type|publicPlural${c, namespace} -} -` - -var getterImplNonNamespaced = ` -func (c *Fake$.GroupGoName$$.Version$) $.type|publicPlural$() $.realClientPackage$.$.type|public$Interface { - return &Fake$.type|publicPlural${c} -} -` - -var getRESTClient = ` -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *Fake$.GroupGoName$$.Version$) RESTClient() $.RESTClientInterface|raw$ { - var ret *$.RESTClient|raw$ - return ret -} -` diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_type.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_type.go deleted file mode 100644 index ec40fb4ed7e..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_type.go +++ /dev/null @@ -1,589 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 fake - -import ( - "io" - gopath "path" - "path/filepath" - "strings" - - "k8s.io/gengo/generator" - "k8s.io/gengo/namer" - "k8s.io/gengo/types" - - "k8s.io/code-generator/cmd/client-gen/generators/util" - "k8s.io/code-generator/cmd/client-gen/path" -) - -// genFakeForType produces a file for each top-level type. -type genFakeForType struct { - generator.DefaultGen - outputPackage string - group string - version string - groupGoName string - inputPackage string - typeToMatch *types.Type - imports namer.ImportTracker - applyConfigurationPackage string -} - -var _ generator.Generator = &genFakeForType{} - -// Filter ignores all but one type because we're making a single file per type. -func (g *genFakeForType) Filter(c *generator.Context, t *types.Type) bool { return t == g.typeToMatch } - -func (g *genFakeForType) Namers(c *generator.Context) namer.NameSystems { - return namer.NameSystems{ - "raw": namer.NewRawNamer(g.outputPackage, g.imports), - } -} - -func (g *genFakeForType) Imports(c *generator.Context) (imports []string) { - return g.imports.ImportLines() -} - -// Ideally, we'd like genStatus to return true if there is a subresource path -// registered for "status" in the API server, but we do not have that -// information, so genStatus returns true if the type has a status field. -func genStatus(t *types.Type) bool { - // Default to true if we have a Status member - hasStatus := false - for _, m := range t.Members { - if m.Name == "Status" { - hasStatus = true - break - } - } - - tags := util.MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)) - return hasStatus && !tags.NoStatus -} - -// hasObjectMeta returns true if the type has a ObjectMeta field. -func hasObjectMeta(t *types.Type) bool { - for _, m := range t.Members { - if m.Embedded == true && m.Name == "ObjectMeta" { - return true - } - } - return false -} - -// GenerateType makes the body of a file implementing the individual typed client for type t. -func (g *genFakeForType) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { - sw := generator.NewSnippetWriter(w, c, "$", "$") - pkg := filepath.Base(t.Name.Package) - tags, err := util.ParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)) - if err != nil { - return err - } - canonicalGroup := g.group - if canonicalGroup == "core" { - canonicalGroup = "" - } - - groupName := g.group - if g.group == "core" { - groupName = "" - } - - // allow user to define a group name that's different from the one parsed from the directory. - p := c.Universe.Package(path.Vendorless(g.inputPackage)) - if override := types.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil { - groupName = override[0] - } - - const pkgClientGoTesting = "k8s.io/client-go/testing" - m := map[string]interface{}{ - "type": t, - "inputType": t, - "resultType": t, - "subresourcePath": "", - "package": pkg, - "Package": namer.IC(pkg), - "namespaced": !tags.NonNamespaced, - "Group": namer.IC(g.group), - "GroupGoName": g.groupGoName, - "Version": namer.IC(g.version), - "group": canonicalGroup, - "groupName": groupName, - "version": g.version, - "CreateOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "CreateOptions"}), - "DeleteOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "DeleteOptions"}), - "GetOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "GetOptions"}), - "ListOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ListOptions"}), - "PatchOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "PatchOptions"}), - "ApplyOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ApplyOptions"}), - "UpdateOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "UpdateOptions"}), - "Everything": c.Universe.Function(types.Name{Package: "k8s.io/apimachinery/pkg/labels", Name: "Everything"}), - "GroupVersionResource": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/runtime/schema", Name: "GroupVersionResource"}), - "GroupVersionKind": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/runtime/schema", Name: "GroupVersionKind"}), - "PatchType": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/types", Name: "PatchType"}), - "ApplyPatchType": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/types", Name: "ApplyPatchType"}), - "watchInterface": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/watch", Name: "Interface"}), - "jsonMarshal": c.Universe.Type(types.Name{Package: "encoding/json", Name: "Marshal"}), - - "NewRootListAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewRootListAction"}), - "NewListAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewListAction"}), - "NewRootGetAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewRootGetAction"}), - "NewGetAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewGetAction"}), - "NewRootDeleteAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewRootDeleteAction"}), - "NewRootDeleteActionWithOptions": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewRootDeleteActionWithOptions"}), - "NewDeleteAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewDeleteAction"}), - "NewDeleteActionWithOptions": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewDeleteActionWithOptions"}), - "NewRootDeleteCollectionAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewRootDeleteCollectionAction"}), - "NewDeleteCollectionAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewDeleteCollectionAction"}), - "NewRootUpdateAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewRootUpdateAction"}), - "NewUpdateAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewUpdateAction"}), - "NewRootCreateAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewRootCreateAction"}), - "NewCreateAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewCreateAction"}), - "NewRootWatchAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewRootWatchAction"}), - "NewWatchAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewWatchAction"}), - "NewCreateSubresourceAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewCreateSubresourceAction"}), - "NewRootCreateSubresourceAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewRootCreateSubresourceAction"}), - "NewUpdateSubresourceAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewUpdateSubresourceAction"}), - "NewGetSubresourceAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewGetSubresourceAction"}), - "NewRootGetSubresourceAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewRootGetSubresourceAction"}), - "NewRootUpdateSubresourceAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewRootUpdateSubresourceAction"}), - "NewRootPatchAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewRootPatchAction"}), - "NewPatchAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewPatchAction"}), - "NewRootPatchSubresourceAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewRootPatchSubresourceAction"}), - "NewPatchSubresourceAction": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "NewPatchSubresourceAction"}), - "ExtractFromListOptions": c.Universe.Function(types.Name{Package: pkgClientGoTesting, Name: "ExtractFromListOptions"}), - } - - generateApply := len(g.applyConfigurationPackage) > 0 - if generateApply { - // Generated apply builder type references required for generated Apply function - _, gvString := util.ParsePathGroupVersion(g.inputPackage) - m["inputApplyConfig"] = types.Ref(gopath.Join(g.applyConfigurationPackage, gvString), t.Name.Name+"ApplyConfiguration") - } - - if tags.NonNamespaced { - sw.Do(structNonNamespaced, m) - } else { - sw.Do(structNamespaced, m) - } - - if tags.NoVerbs { - return sw.Error() - } - sw.Do(resource, m) - sw.Do(kind, m) - - if tags.HasVerb("get") { - sw.Do(getTemplate, m) - } - if tags.HasVerb("list") { - if hasObjectMeta(t) { - sw.Do(listUsingOptionsTemplate, m) - } else { - sw.Do(listTemplate, m) - } - } - if tags.HasVerb("watch") { - sw.Do(watchTemplate, m) - } - - if tags.HasVerb("create") { - sw.Do(createTemplate, m) - } - if tags.HasVerb("update") { - sw.Do(updateTemplate, m) - } - if tags.HasVerb("updateStatus") && genStatus(t) { - sw.Do(updateStatusTemplate, m) - } - if tags.HasVerb("delete") { - sw.Do(deleteTemplate, m) - } - if tags.HasVerb("deleteCollection") { - sw.Do(deleteCollectionTemplate, m) - } - if tags.HasVerb("patch") { - sw.Do(patchTemplate, m) - } - if tags.HasVerb("apply") && generateApply { - sw.Do(applyTemplate, m) - } - if tags.HasVerb("applyStatus") && generateApply && genStatus(t) { - sw.Do(applyStatusTemplate, m) - } - _, typeGVString := util.ParsePathGroupVersion(g.inputPackage) - - // generate extended client methods - for _, e := range tags.Extensions { - if e.HasVerb("apply") && !generateApply { - continue - } - inputType := *t - resultType := *t - inputGVString := typeGVString - if len(e.InputTypeOverride) > 0 { - if name, pkg := e.Input(); len(pkg) > 0 { - _, inputGVString = util.ParsePathGroupVersion(pkg) - newType := c.Universe.Type(types.Name{Package: pkg, Name: name}) - inputType = *newType - } else { - inputType.Name.Name = e.InputTypeOverride - } - } - if len(e.ResultTypeOverride) > 0 { - if name, pkg := e.Result(); len(pkg) > 0 { - newType := c.Universe.Type(types.Name{Package: pkg, Name: name}) - resultType = *newType - } else { - resultType.Name.Name = e.ResultTypeOverride - } - } - m["inputType"] = &inputType - m["resultType"] = &resultType - m["subresourcePath"] = e.SubResourcePath - if e.HasVerb("apply") { - m["inputApplyConfig"] = types.Ref(gopath.Join(g.applyConfigurationPackage, inputGVString), inputType.Name.Name+"ApplyConfiguration") - } - - if e.HasVerb("get") { - if e.IsSubresource() { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, getSubresourceTemplate), m) - } else { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, getTemplate), m) - } - } - - if e.HasVerb("list") { - - sw.Do(adjustTemplate(e.VerbName, e.VerbType, listTemplate), m) - } - - // TODO: Figure out schemantic for watching a sub-resource. - if e.HasVerb("watch") { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, watchTemplate), m) - } - - if e.HasVerb("create") { - if e.IsSubresource() { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, createSubresourceTemplate), m) - } else { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, createTemplate), m) - } - } - - if e.HasVerb("update") { - if e.IsSubresource() { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, updateSubresourceTemplate), m) - } else { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, updateTemplate), m) - } - } - - // TODO: Figure out schemantic for deleting a sub-resource (what arguments - // are passed, does it need two names? etc. - if e.HasVerb("delete") { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, deleteTemplate), m) - } - - if e.HasVerb("patch") { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, patchTemplate), m) - } - - if e.HasVerb("apply") && generateApply { - if e.IsSubresource() { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, applySubresourceTemplate), m) - } else { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, applyTemplate), m) - } - } - } - - return sw.Error() -} - -// adjustTemplate adjust the origin verb template using the expansion name. -// TODO: Make the verbs in templates parametrized so the strings.Replace() is -// not needed. -func adjustTemplate(name, verbType, template string) string { - return strings.Replace(template, " "+strings.Title(verbType), " "+name, -1) -} - -// template for the struct that implements the type's interface -var structNamespaced = ` -// Fake$.type|publicPlural$ implements $.type|public$Interface -type Fake$.type|publicPlural$ struct { - Fake *Fake$.GroupGoName$$.Version$ - ns string -} -` - -// template for the struct that implements the type's interface -var structNonNamespaced = ` -// Fake$.type|publicPlural$ implements $.type|public$Interface -type Fake$.type|publicPlural$ struct { - Fake *Fake$.GroupGoName$$.Version$ -} -` - -var resource = ` -var $.type|allLowercasePlural$Resource = $.GroupVersionResource|raw${Group: "$.groupName$", Version: "$.version$", Resource: "$.type|resource$"} -` - -var kind = ` -var $.type|allLowercasePlural$Kind = $.GroupVersionKind|raw${Group: "$.groupName$", Version: "$.version$", Kind: "$.type|singularKind$"} -` - -var listTemplate = ` -// List takes label and field selectors, and returns the list of $.type|publicPlural$ that match those selectors. -func (c *Fake$.type|publicPlural$) List(ctx context.Context, opts $.ListOptions|raw$) (result *$.type|raw$List, err error) { - obj, err := c.Fake. - $if .namespaced$Invokes($.NewListAction|raw$($.type|allLowercasePlural$Resource, $.type|allLowercasePlural$Kind, c.ns, opts), &$.type|raw$List{}) - $else$Invokes($.NewRootListAction|raw$($.type|allLowercasePlural$Resource, $.type|allLowercasePlural$Kind, opts), &$.type|raw$List{})$end$ - if obj == nil { - return nil, err - } - return obj.(*$.type|raw$List), err -} -` - -var listUsingOptionsTemplate = ` -// List takes label and field selectors, and returns the list of $.type|publicPlural$ that match those selectors. -func (c *Fake$.type|publicPlural$) List(ctx context.Context, opts $.ListOptions|raw$) (result *$.type|raw$List, err error) { - obj, err := c.Fake. - $if .namespaced$Invokes($.NewListAction|raw$($.type|allLowercasePlural$Resource, $.type|allLowercasePlural$Kind, c.ns, opts), &$.type|raw$List{}) - $else$Invokes($.NewRootListAction|raw$($.type|allLowercasePlural$Resource, $.type|allLowercasePlural$Kind, opts), &$.type|raw$List{})$end$ - if obj == nil { - return nil, err - } - - label, _, _ := $.ExtractFromListOptions|raw$(opts) - if label == nil { - label = $.Everything|raw$() - } - list := &$.type|raw$List{ListMeta: obj.(*$.type|raw$List).ListMeta} - for _, item := range obj.(*$.type|raw$List).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} -` - -var getTemplate = ` -// Get takes name of the $.type|private$, and returns the corresponding $.resultType|private$ object, and an error if there is any. -func (c *Fake$.type|publicPlural$) Get(ctx context.Context, name string, options $.GetOptions|raw$) (result *$.resultType|raw$, err error) { - obj, err := c.Fake. - $if .namespaced$Invokes($.NewGetAction|raw$($.type|allLowercasePlural$Resource, c.ns, name), &$.resultType|raw${}) - $else$Invokes($.NewRootGetAction|raw$($.type|allLowercasePlural$Resource, name), &$.resultType|raw${})$end$ - if obj == nil { - return nil, err - } - return obj.(*$.resultType|raw$), err -} -` - -var getSubresourceTemplate = ` -// Get takes name of the $.type|private$, and returns the corresponding $.resultType|private$ object, and an error if there is any. -func (c *Fake$.type|publicPlural$) Get(ctx context.Context, $.type|private$Name string, options $.GetOptions|raw$) (result *$.resultType|raw$, err error) { - obj, err := c.Fake. - $if .namespaced$Invokes($.NewGetSubresourceAction|raw$($.type|allLowercasePlural$Resource, c.ns, "$.subresourcePath$", $.type|private$Name), &$.resultType|raw${}) - $else$Invokes($.NewRootGetSubresourceAction|raw$($.type|allLowercasePlural$Resource, "$.subresourcePath$", $.type|private$Name), &$.resultType|raw${})$end$ - if obj == nil { - return nil, err - } - return obj.(*$.resultType|raw$), err -} -` - -var deleteTemplate = ` -// Delete takes name of the $.type|private$ and deletes it. Returns an error if one occurs. -func (c *Fake$.type|publicPlural$) Delete(ctx context.Context, name string, opts $.DeleteOptions|raw$) error { - _, err := c.Fake. - $if .namespaced$Invokes($.NewDeleteActionWithOptions|raw$($.type|allLowercasePlural$Resource, c.ns, name, opts), &$.type|raw${}) - $else$Invokes($.NewRootDeleteActionWithOptions|raw$($.type|allLowercasePlural$Resource, name, opts), &$.type|raw${})$end$ - return err -} -` - -var deleteCollectionTemplate = ` -// DeleteCollection deletes a collection of objects. -func (c *Fake$.type|publicPlural$) DeleteCollection(ctx context.Context, opts $.DeleteOptions|raw$, listOpts $.ListOptions|raw$) error { - $if .namespaced$action := $.NewDeleteCollectionAction|raw$($.type|allLowercasePlural$Resource, c.ns, listOpts) - $else$action := $.NewRootDeleteCollectionAction|raw$($.type|allLowercasePlural$Resource, listOpts) - $end$ - _, err := c.Fake.Invokes(action, &$.type|raw$List{}) - return err -} -` -var createTemplate = ` -// Create takes the representation of a $.inputType|private$ and creates it. Returns the server's representation of the $.resultType|private$, and an error, if there is any. -func (c *Fake$.type|publicPlural$) Create(ctx context.Context, $.inputType|private$ *$.inputType|raw$, opts $.CreateOptions|raw$) (result *$.resultType|raw$, err error) { - obj, err := c.Fake. - $if .namespaced$Invokes($.NewCreateAction|raw$($.inputType|allLowercasePlural$Resource, c.ns, $.inputType|private$), &$.resultType|raw${}) - $else$Invokes($.NewRootCreateAction|raw$($.inputType|allLowercasePlural$Resource, $.inputType|private$), &$.resultType|raw${})$end$ - if obj == nil { - return nil, err - } - return obj.(*$.resultType|raw$), err -} -` - -var createSubresourceTemplate = ` -// Create takes the representation of a $.inputType|private$ and creates it. Returns the server's representation of the $.resultType|private$, and an error, if there is any. -func (c *Fake$.type|publicPlural$) Create(ctx context.Context, $.type|private$Name string, $.inputType|private$ *$.inputType|raw$, opts $.CreateOptions|raw$) (result *$.resultType|raw$, err error) { - obj, err := c.Fake. - $if .namespaced$Invokes($.NewCreateSubresourceAction|raw$($.type|allLowercasePlural$Resource, $.type|private$Name, "$.subresourcePath$", c.ns, $.inputType|private$), &$.resultType|raw${}) - $else$Invokes($.NewRootCreateSubresourceAction|raw$($.type|allLowercasePlural$Resource, $.type|private$Name, "$.subresourcePath$", $.inputType|private$), &$.resultType|raw${})$end$ - if obj == nil { - return nil, err - } - return obj.(*$.resultType|raw$), err -} -` - -var updateTemplate = ` -// Update takes the representation of a $.inputType|private$ and updates it. Returns the server's representation of the $.resultType|private$, and an error, if there is any. -func (c *Fake$.type|publicPlural$) Update(ctx context.Context, $.inputType|private$ *$.inputType|raw$, opts $.UpdateOptions|raw$) (result *$.resultType|raw$, err error) { - obj, err := c.Fake. - $if .namespaced$Invokes($.NewUpdateAction|raw$($.inputType|allLowercasePlural$Resource, c.ns, $.inputType|private$), &$.resultType|raw${}) - $else$Invokes($.NewRootUpdateAction|raw$($.inputType|allLowercasePlural$Resource, $.inputType|private$), &$.resultType|raw${})$end$ - if obj == nil { - return nil, err - } - return obj.(*$.resultType|raw$), err -} -` - -var updateSubresourceTemplate = ` -// Update takes the representation of a $.inputType|private$ and updates it. Returns the server's representation of the $.resultType|private$, and an error, if there is any. -func (c *Fake$.type|publicPlural$) Update(ctx context.Context, $.type|private$Name string, $.inputType|private$ *$.inputType|raw$, opts $.UpdateOptions|raw$) (result *$.resultType|raw$, err error) { - obj, err := c.Fake. - $if .namespaced$Invokes($.NewUpdateSubresourceAction|raw$($.type|allLowercasePlural$Resource, "$.subresourcePath$", c.ns, $.inputType|private$), &$.inputType|raw${}) - $else$Invokes($.NewRootUpdateSubresourceAction|raw$($.type|allLowercasePlural$Resource, "$.subresourcePath$", $.inputType|private$), &$.resultType|raw${})$end$ - if obj == nil { - return nil, err - } - return obj.(*$.resultType|raw$), err -} -` - -var updateStatusTemplate = ` -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *Fake$.type|publicPlural$) UpdateStatus(ctx context.Context, $.type|private$ *$.type|raw$, opts $.UpdateOptions|raw$) (*$.type|raw$, error) { - obj, err := c.Fake. - $if .namespaced$Invokes($.NewUpdateSubresourceAction|raw$($.type|allLowercasePlural$Resource, "status", c.ns, $.type|private$), &$.type|raw${}) - $else$Invokes($.NewRootUpdateSubresourceAction|raw$($.type|allLowercasePlural$Resource, "status", $.type|private$), &$.type|raw${})$end$ - if obj == nil { - return nil, err - } - return obj.(*$.type|raw$), err -} -` - -var watchTemplate = ` -// Watch returns a $.watchInterface|raw$ that watches the requested $.type|privatePlural$. -func (c *Fake$.type|publicPlural$) Watch(ctx context.Context, opts $.ListOptions|raw$) ($.watchInterface|raw$, error) { - return c.Fake. - $if .namespaced$InvokesWatch($.NewWatchAction|raw$($.type|allLowercasePlural$Resource, c.ns, opts)) - $else$InvokesWatch($.NewRootWatchAction|raw$($.type|allLowercasePlural$Resource, opts))$end$ -} -` - -var patchTemplate = ` -// Patch applies the patch and returns the patched $.resultType|private$. -func (c *Fake$.type|publicPlural$) Patch(ctx context.Context, name string, pt $.PatchType|raw$, data []byte, opts $.PatchOptions|raw$, subresources ...string) (result *$.resultType|raw$, err error) { - obj, err := c.Fake. - $if .namespaced$Invokes($.NewPatchSubresourceAction|raw$($.type|allLowercasePlural$Resource, c.ns, name, pt, data, subresources... ), &$.resultType|raw${}) - $else$Invokes($.NewRootPatchSubresourceAction|raw$($.type|allLowercasePlural$Resource, name, pt, data, subresources...), &$.resultType|raw${})$end$ - if obj == nil { - return nil, err - } - return obj.(*$.resultType|raw$), err -} -` - -var applyTemplate = ` -// Apply takes the given apply declarative configuration, applies it and returns the applied $.resultType|private$. -func (c *Fake$.type|publicPlural$) Apply(ctx context.Context, $.inputType|private$ *$.inputApplyConfig|raw$, opts $.ApplyOptions|raw$) (result *$.resultType|raw$, err error) { - if $.inputType|private$ == nil { - return nil, fmt.Errorf("$.inputType|private$ provided to Apply must not be nil") - } - data, err := $.jsonMarshal|raw$($.inputType|private$) - if err != nil { - return nil, err - } - name := $.inputType|private$.Name - if name == nil { - return nil, fmt.Errorf("$.inputType|private$.Name must be provided to Apply") - } - obj, err := c.Fake. - $if .namespaced$Invokes($.NewPatchSubresourceAction|raw$($.type|allLowercasePlural$Resource, c.ns, *name, $.ApplyPatchType|raw$, data), &$.resultType|raw${}) - $else$Invokes($.NewRootPatchSubresourceAction|raw$($.type|allLowercasePlural$Resource, *name, $.ApplyPatchType|raw$, data), &$.resultType|raw${})$end$ - if obj == nil { - return nil, err - } - return obj.(*$.resultType|raw$), err -} -` - -var applyStatusTemplate = ` -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *Fake$.type|publicPlural$) ApplyStatus(ctx context.Context, $.inputType|private$ *$.inputApplyConfig|raw$, opts $.ApplyOptions|raw$) (result *$.resultType|raw$, err error) { - if $.inputType|private$ == nil { - return nil, fmt.Errorf("$.inputType|private$ provided to Apply must not be nil") - } - data, err := $.jsonMarshal|raw$($.inputType|private$) - if err != nil { - return nil, err - } - name := $.inputType|private$.Name - if name == nil { - return nil, fmt.Errorf("$.inputType|private$.Name must be provided to Apply") - } - obj, err := c.Fake. - $if .namespaced$Invokes($.NewPatchSubresourceAction|raw$($.type|allLowercasePlural$Resource, c.ns, *name, $.ApplyPatchType|raw$, data, "status"), &$.resultType|raw${}) - $else$Invokes($.NewRootPatchSubresourceAction|raw$($.type|allLowercasePlural$Resource, *name, $.ApplyPatchType|raw$, data, "status"), &$.resultType|raw${})$end$ - if obj == nil { - return nil, err - } - return obj.(*$.resultType|raw$), err -} -` - -var applySubresourceTemplate = ` -// Apply takes top resource name and the apply declarative configuration for $.subresourcePath$, -// applies it and returns the applied $.resultType|private$, and an error, if there is any. -func (c *Fake$.type|publicPlural$) Apply(ctx context.Context, $.type|private$Name string, $.inputType|private$ *$.inputApplyConfig|raw$, opts $.ApplyOptions|raw$) (result *$.resultType|raw$, err error) { - if $.inputType|private$ == nil { - return nil, fmt.Errorf("$.inputType|private$ provided to Apply must not be nil") - } - data, err := $.jsonMarshal|raw$($.inputType|private$) - if err != nil { - return nil, err - } - obj, err := c.Fake. - $if .namespaced$Invokes($.NewPatchSubresourceAction|raw$($.type|allLowercasePlural$Resource, c.ns, $.type|private$Name, $.ApplyPatchType|raw$, data, "status"), &$.resultType|raw${}) - $else$Invokes($.NewRootPatchSubresourceAction|raw$($.type|allLowercasePlural$Resource, $.type|private$Name, $.ApplyPatchType|raw$, data, "status"), &$.resultType|raw${})$end$ - if obj == nil { - return nil, err - } - return obj.(*$.resultType|raw$), err -} -` diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_clientset.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_clientset.go deleted file mode 100644 index cd7b1d0fc02..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_clientset.go +++ /dev/null @@ -1,210 +0,0 @@ -/* -Copyright 2016 The Kubernetes 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 generators - -import ( - "fmt" - "io" - "path/filepath" - "strings" - - clientgentypes "k8s.io/code-generator/cmd/client-gen/types" - "k8s.io/gengo/generator" - "k8s.io/gengo/namer" - "k8s.io/gengo/types" -) - -// genClientset generates a package for a clientset. -type genClientset struct { - generator.DefaultGen - groups []clientgentypes.GroupVersions - groupGoNames map[clientgentypes.GroupVersion]string - clientsetPackage string - outputPackage string - imports namer.ImportTracker - clientsetGenerated bool -} - -var _ generator.Generator = &genClientset{} - -func (g *genClientset) Namers(c *generator.Context) namer.NameSystems { - return namer.NameSystems{ - "raw": namer.NewRawNamer(g.outputPackage, g.imports), - } -} - -// We only want to call GenerateType() once. -func (g *genClientset) Filter(c *generator.Context, t *types.Type) bool { - ret := !g.clientsetGenerated - g.clientsetGenerated = true - return ret -} - -func (g *genClientset) Imports(c *generator.Context) (imports []string) { - imports = append(imports, g.imports.ImportLines()...) - for _, group := range g.groups { - for _, version := range group.Versions { - typedClientPath := filepath.Join(g.clientsetPackage, "typed", strings.ToLower(group.PackageName), strings.ToLower(version.NonEmpty())) - groupAlias := strings.ToLower(g.groupGoNames[clientgentypes.GroupVersion{Group: group.Group, Version: version.Version}]) - imports = append(imports, fmt.Sprintf("%s%s \"%s\"", groupAlias, strings.ToLower(version.NonEmpty()), typedClientPath)) - } - } - return -} - -func (g *genClientset) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { - // TODO: We actually don't need any type information to generate the clientset, - // perhaps we can adapt the go2ild framework to this kind of usage. - sw := generator.NewSnippetWriter(w, c, "$", "$") - - allGroups := clientgentypes.ToGroupVersionInfo(g.groups, g.groupGoNames) - m := map[string]interface{}{ - "allGroups": allGroups, - "Config": c.Universe.Type(types.Name{Package: "k8s.io/client-go/rest", Name: "Config"}), - "DefaultKubernetesUserAgent": c.Universe.Function(types.Name{Package: "k8s.io/client-go/rest", Name: "DefaultKubernetesUserAgent"}), - "RESTClientInterface": c.Universe.Type(types.Name{Package: "k8s.io/client-go/rest", Name: "Interface"}), - "RESTHTTPClientFor": c.Universe.Function(types.Name{Package: "k8s.io/client-go/rest", Name: "HTTPClientFor"}), - "DiscoveryInterface": c.Universe.Type(types.Name{Package: "k8s.io/client-go/discovery", Name: "DiscoveryInterface"}), - "DiscoveryClient": c.Universe.Type(types.Name{Package: "k8s.io/client-go/discovery", Name: "DiscoveryClient"}), - "NewDiscoveryClientForConfigAndClient": c.Universe.Function(types.Name{Package: "k8s.io/client-go/discovery", Name: "NewDiscoveryClientForConfigAndClient"}), - "NewDiscoveryClientForConfigOrDie": c.Universe.Function(types.Name{Package: "k8s.io/client-go/discovery", Name: "NewDiscoveryClientForConfigOrDie"}), - "NewDiscoveryClient": c.Universe.Function(types.Name{Package: "k8s.io/client-go/discovery", Name: "NewDiscoveryClient"}), - "flowcontrolNewTokenBucketRateLimiter": c.Universe.Function(types.Name{Package: "k8s.io/client-go/util/flowcontrol", Name: "NewTokenBucketRateLimiter"}), - } - sw.Do(clientsetInterface, m) - sw.Do(clientsetTemplate, m) - for _, g := range allGroups { - sw.Do(clientsetInterfaceImplTemplate, g) - } - sw.Do(getDiscoveryTemplate, m) - sw.Do(newClientsetForConfigTemplate, m) - sw.Do(newClientsetForConfigAndClientTemplate, m) - sw.Do(newClientsetForConfigOrDieTemplate, m) - sw.Do(newClientsetForRESTClientTemplate, m) - - return sw.Error() -} - -var clientsetInterface = ` -type Interface interface { - Discovery() $.DiscoveryInterface|raw$ - $range .allGroups$$.GroupGoName$$.Version$() $.PackageAlias$.$.GroupGoName$$.Version$Interface - $end$ -} -` - -var clientsetTemplate = ` -// Clientset contains the clients for groups. Each group has exactly one -// version included in a Clientset. -type Clientset struct { - *$.DiscoveryClient|raw$ - $range .allGroups$$.LowerCaseGroupGoName$$.Version$ *$.PackageAlias$.$.GroupGoName$$.Version$Client - $end$ -} -` - -var clientsetInterfaceImplTemplate = ` -// $.GroupGoName$$.Version$ retrieves the $.GroupGoName$$.Version$Client -func (c *Clientset) $.GroupGoName$$.Version$() $.PackageAlias$.$.GroupGoName$$.Version$Interface { - return c.$.LowerCaseGroupGoName$$.Version$ -} -` - -var getDiscoveryTemplate = ` -// Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() $.DiscoveryInterface|raw$ { - if c == nil { - return nil - } - return c.DiscoveryClient -} -` - -var newClientsetForConfigTemplate = ` -// NewForConfig creates a new Clientset for the given config. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfig will generate a rate-limiter in configShallowCopy. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *$.Config|raw$) (*Clientset, error) { - configShallowCopy := *c - - if configShallowCopy.UserAgent == "" { - configShallowCopy.UserAgent = $.DefaultKubernetesUserAgent|raw$() - } - - // share the transport between all clients - httpClient, err := $.RESTHTTPClientFor|raw$(&configShallowCopy) - if err != nil { - return nil, err - } - - return NewForConfigAndClient(&configShallowCopy, httpClient) -} -` - -var newClientsetForConfigAndClientTemplate = ` -// NewForConfigAndClient creates a new Clientset for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. -func NewForConfigAndClient(c *$.Config|raw$, httpClient *http.Client) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - if configShallowCopy.Burst <= 0 { - return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") - } - configShallowCopy.RateLimiter = $.flowcontrolNewTokenBucketRateLimiter|raw$(configShallowCopy.QPS, configShallowCopy.Burst) - } - - var cs Clientset - var err error -$range .allGroups$ cs.$.LowerCaseGroupGoName$$.Version$, err =$.PackageAlias$.NewForConfigAndClient(&configShallowCopy, httpClient) - if err!=nil { - return nil, err - } -$end$ - cs.DiscoveryClient, err = $.NewDiscoveryClientForConfigAndClient|raw$(&configShallowCopy, httpClient) - if err!=nil { - return nil, err - } - return &cs, nil -} -` - -var newClientsetForConfigOrDieTemplate = ` -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *$.Config|raw$) *Clientset { - cs, err := NewForConfig(c) - if err!=nil { - panic(err) - } - return cs -} -` - -var newClientsetForRESTClientTemplate = ` -// New creates a new Clientset for the given RESTClient. -func New(c $.RESTClientInterface|raw$) *Clientset { - var cs Clientset -$range .allGroups$ cs.$.LowerCaseGroupGoName$$.Version$ =$.PackageAlias$.New(c) -$end$ - cs.DiscoveryClient = $.NewDiscoveryClient|raw$(c) - return &cs -} -` diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_expansion.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_expansion.go deleted file mode 100644 index f47c079e02f..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_expansion.go +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright 2016 The Kubernetes 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 generators - -import ( - "io" - "os" - "path/filepath" - "strings" - - "k8s.io/gengo/generator" - "k8s.io/gengo/types" -) - -// genExpansion produces a file for a group client, e.g. ExtensionsClient for the extension group. -type genExpansion struct { - generator.DefaultGen - groupPackagePath string - // types in a group - types []*types.Type -} - -// We only want to call GenerateType() once per group. -func (g *genExpansion) Filter(c *generator.Context, t *types.Type) bool { - return len(g.types) == 0 || t == g.types[0] -} - -func (g *genExpansion) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { - sw := generator.NewSnippetWriter(w, c, "$", "$") - for _, t := range g.types { - if _, err := os.Stat(filepath.Join(g.groupPackagePath, strings.ToLower(t.Name.Name+"_expansion.go"))); os.IsNotExist(err) { - sw.Do(expansionInterfaceTemplate, t) - } - } - return sw.Error() -} - -var expansionInterfaceTemplate = ` -type $.|public$Expansion interface {} -` diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_group.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_group.go deleted file mode 100644 index 30284990037..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_group.go +++ /dev/null @@ -1,267 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 generators - -import ( - "io" - "path/filepath" - - "k8s.io/gengo/generator" - "k8s.io/gengo/namer" - "k8s.io/gengo/types" - - "k8s.io/code-generator/cmd/client-gen/generators/util" - "k8s.io/code-generator/cmd/client-gen/path" -) - -// genGroup produces a file for a group client, e.g. ExtensionsClient for the extension group. -type genGroup struct { - generator.DefaultGen - outputPackage string - group string - version string - groupGoName string - apiPath string - // types in this group - types []*types.Type - imports namer.ImportTracker - inputPackage string - clientsetPackage string - // If the genGroup has been called. This generator should only execute once. - called bool -} - -var _ generator.Generator = &genGroup{} - -// We only want to call GenerateType() once per group. -func (g *genGroup) Filter(c *generator.Context, t *types.Type) bool { - if !g.called { - g.called = true - return true - } - return false -} - -func (g *genGroup) Namers(c *generator.Context) namer.NameSystems { - return namer.NameSystems{ - "raw": namer.NewRawNamer(g.outputPackage, g.imports), - } -} - -func (g *genGroup) Imports(c *generator.Context) (imports []string) { - imports = append(imports, g.imports.ImportLines()...) - imports = append(imports, filepath.Join(g.clientsetPackage, "scheme")) - return -} - -func (g *genGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { - sw := generator.NewSnippetWriter(w, c, "$", "$") - - apiPath := func(group string) string { - if group == "core" { - return `"/api"` - } - return `"` + g.apiPath + `"` - } - - groupName := g.group - if g.group == "core" { - groupName = "" - } - // allow user to define a group name that's different from the one parsed from the directory. - p := c.Universe.Package(path.Vendorless(g.inputPackage)) - if override := types.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil { - groupName = override[0] - } - - m := map[string]interface{}{ - "group": g.group, - "version": g.version, - "groupName": groupName, - "GroupGoName": g.groupGoName, - "Version": namer.IC(g.version), - "types": g.types, - "apiPath": apiPath(g.group), - "schemaGroupVersion": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/runtime/schema", Name: "GroupVersion"}), - "runtimeAPIVersionInternal": c.Universe.Variable(types.Name{Package: "k8s.io/apimachinery/pkg/runtime", Name: "APIVersionInternal"}), - "restConfig": c.Universe.Type(types.Name{Package: "k8s.io/client-go/rest", Name: "Config"}), - "restDefaultKubernetesUserAgent": c.Universe.Function(types.Name{Package: "k8s.io/client-go/rest", Name: "DefaultKubernetesUserAgent"}), - "restRESTClientInterface": c.Universe.Type(types.Name{Package: "k8s.io/client-go/rest", Name: "Interface"}), - "RESTHTTPClientFor": c.Universe.Function(types.Name{Package: "k8s.io/client-go/rest", Name: "HTTPClientFor"}), - "restRESTClientFor": c.Universe.Function(types.Name{Package: "k8s.io/client-go/rest", Name: "RESTClientFor"}), - "restRESTClientForConfigAndClient": c.Universe.Function(types.Name{Package: "k8s.io/client-go/rest", Name: "RESTClientForConfigAndClient"}), - "SchemeGroupVersion": c.Universe.Variable(types.Name{Package: path.Vendorless(g.inputPackage), Name: "SchemeGroupVersion"}), - } - sw.Do(groupInterfaceTemplate, m) - sw.Do(groupClientTemplate, m) - for _, t := range g.types { - tags, err := util.ParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)) - if err != nil { - return err - } - wrapper := map[string]interface{}{ - "type": t, - "GroupGoName": g.groupGoName, - "Version": namer.IC(g.version), - } - if tags.NonNamespaced { - sw.Do(getterImplNonNamespaced, wrapper) - } else { - sw.Do(getterImplNamespaced, wrapper) - } - } - sw.Do(newClientForConfigTemplate, m) - sw.Do(newClientForConfigAndClientTemplate, m) - sw.Do(newClientForConfigOrDieTemplate, m) - sw.Do(newClientForRESTClientTemplate, m) - if g.version == "" { - sw.Do(setInternalVersionClientDefaultsTemplate, m) - } else { - sw.Do(setClientDefaultsTemplate, m) - } - sw.Do(getRESTClient, m) - - return sw.Error() -} - -var groupInterfaceTemplate = ` -type $.GroupGoName$$.Version$Interface interface { - RESTClient() $.restRESTClientInterface|raw$ - $range .types$ $.|publicPlural$Getter - $end$ -} -` - -var groupClientTemplate = ` -// $.GroupGoName$$.Version$Client is used to interact with features provided by the $.groupName$ group. -type $.GroupGoName$$.Version$Client struct { - restClient $.restRESTClientInterface|raw$ -} -` - -var getterImplNamespaced = ` -func (c *$.GroupGoName$$.Version$Client) $.type|publicPlural$(namespace string) $.type|public$Interface { - return new$.type|publicPlural$(c, namespace) -} -` - -var getterImplNonNamespaced = ` -func (c *$.GroupGoName$$.Version$Client) $.type|publicPlural$() $.type|public$Interface { - return new$.type|publicPlural$(c) -} -` - -var newClientForConfigTemplate = ` -// NewForConfig creates a new $.GroupGoName$$.Version$Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *$.restConfig|raw$) (*$.GroupGoName$$.Version$Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := $.RESTHTTPClientFor|raw$(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} -` - -var newClientForConfigAndClientTemplate = ` -// NewForConfigAndClient creates a new $.GroupGoName$$.Version$Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *$.restConfig|raw$, h *http.Client) (*$.GroupGoName$$.Version$Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := $.restRESTClientForConfigAndClient|raw$(&config, h) - if err != nil { - return nil, err - } - return &$.GroupGoName$$.Version$Client{client}, nil -} -` - -var newClientForConfigOrDieTemplate = ` -// NewForConfigOrDie creates a new $.GroupGoName$$.Version$Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *$.restConfig|raw$) *$.GroupGoName$$.Version$Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} -` - -var getRESTClient = ` -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *$.GroupGoName$$.Version$Client) RESTClient() $.restRESTClientInterface|raw$ { - if c == nil { - return nil - } - return c.restClient -} -` - -var newClientForRESTClientTemplate = ` -// New creates a new $.GroupGoName$$.Version$Client for the given RESTClient. -func New(c $.restRESTClientInterface|raw$) *$.GroupGoName$$.Version$Client { - return &$.GroupGoName$$.Version$Client{c} -} -` - -var setInternalVersionClientDefaultsTemplate = ` -func setConfigDefaults(config *$.restConfig|raw$) error { - config.APIPath = $.apiPath$ - if config.UserAgent == "" { - config.UserAgent = $.restDefaultKubernetesUserAgent|raw$() - } - if config.GroupVersion == nil || config.GroupVersion.Group != scheme.Scheme.PrioritizedVersionsForGroup("$.groupName$")[0].Group { - gv := scheme.Scheme.PrioritizedVersionsForGroup("$.groupName$")[0] - config.GroupVersion = &gv - } - config.NegotiatedSerializer = scheme.Codecs - - if config.QPS == 0 { - config.QPS = 5 - } - if config.Burst == 0 { - config.Burst = 10 - } - - return nil -} -` - -var setClientDefaultsTemplate = ` -func setConfigDefaults(config *$.restConfig|raw$) error { - gv := $.SchemeGroupVersion|raw$ - config.GroupVersion = &gv - config.APIPath = $.apiPath$ - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = $.restDefaultKubernetesUserAgent|raw$() - } - - return nil -} -` diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_type.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_type.go deleted file mode 100644 index fe63dd19895..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_type.go +++ /dev/null @@ -1,760 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 generators - -import ( - "io" - "path" - "path/filepath" - "strings" - - "k8s.io/gengo/generator" - "k8s.io/gengo/namer" - "k8s.io/gengo/types" - - "k8s.io/code-generator/cmd/client-gen/generators/util" -) - -// genClientForType produces a file for each top-level type. -type genClientForType struct { - generator.DefaultGen - outputPackage string - inputPackage string - clientsetPackage string - applyConfigurationPackage string - group string - version string - groupGoName string - typeToMatch *types.Type - imports namer.ImportTracker -} - -var _ generator.Generator = &genClientForType{} - -// Filter ignores all but one type because we're making a single file per type. -func (g *genClientForType) Filter(c *generator.Context, t *types.Type) bool { - return t == g.typeToMatch -} - -func (g *genClientForType) Namers(c *generator.Context) namer.NameSystems { - return namer.NameSystems{ - "raw": namer.NewRawNamer(g.outputPackage, g.imports), - } -} - -func (g *genClientForType) Imports(c *generator.Context) (imports []string) { - return g.imports.ImportLines() -} - -// Ideally, we'd like genStatus to return true if there is a subresource path -// registered for "status" in the API server, but we do not have that -// information, so genStatus returns true if the type has a status field. -func genStatus(t *types.Type) bool { - // Default to true if we have a Status member - hasStatus := false - for _, m := range t.Members { - if m.Name == "Status" { - hasStatus = true - break - } - } - return hasStatus && !util.MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)).NoStatus -} - -// GenerateType makes the body of a file implementing the individual typed client for type t. -func (g *genClientForType) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { - generateApply := len(g.applyConfigurationPackage) > 0 - defaultVerbTemplates := buildDefaultVerbTemplates(generateApply) - subresourceDefaultVerbTemplates := buildSubresourceDefaultVerbTemplates(generateApply) - sw := generator.NewSnippetWriter(w, c, "$", "$") - pkg := filepath.Base(t.Name.Package) - tags, err := util.ParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...)) - if err != nil { - return err - } - type extendedInterfaceMethod struct { - template string - args map[string]interface{} - } - _, typeGVString := util.ParsePathGroupVersion(g.inputPackage) - extendedMethods := []extendedInterfaceMethod{} - for _, e := range tags.Extensions { - if e.HasVerb("apply") && !generateApply { - continue - } - inputType := *t - resultType := *t - inputGVString := typeGVString - // TODO: Extract this to some helper method as this code is copied into - // 2 other places. - if len(e.InputTypeOverride) > 0 { - if name, pkg := e.Input(); len(pkg) > 0 { - _, inputGVString = util.ParsePathGroupVersion(pkg) - newType := c.Universe.Type(types.Name{Package: pkg, Name: name}) - inputType = *newType - } else { - inputType.Name.Name = e.InputTypeOverride - } - } - if len(e.ResultTypeOverride) > 0 { - if name, pkg := e.Result(); len(pkg) > 0 { - newType := c.Universe.Type(types.Name{Package: pkg, Name: name}) - resultType = *newType - } else { - resultType.Name.Name = e.ResultTypeOverride - } - } - var updatedVerbtemplate string - if _, exists := subresourceDefaultVerbTemplates[e.VerbType]; e.IsSubresource() && exists { - updatedVerbtemplate = e.VerbName + "(" + strings.TrimPrefix(subresourceDefaultVerbTemplates[e.VerbType], strings.Title(e.VerbType)+"(") - } else { - updatedVerbtemplate = e.VerbName + "(" + strings.TrimPrefix(defaultVerbTemplates[e.VerbType], strings.Title(e.VerbType)+"(") - } - extendedMethod := extendedInterfaceMethod{ - template: updatedVerbtemplate, - args: map[string]interface{}{ - "type": t, - "inputType": &inputType, - "resultType": &resultType, - "CreateOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "CreateOptions"}), - "GetOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "GetOptions"}), - "ListOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ListOptions"}), - "UpdateOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "UpdateOptions"}), - "ApplyOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ApplyOptions"}), - "PatchType": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/types", Name: "PatchType"}), - "jsonMarshal": c.Universe.Type(types.Name{Package: "encoding/json", Name: "Marshal"}), - }, - } - if e.HasVerb("apply") { - extendedMethod.args["inputApplyConfig"] = types.Ref(path.Join(g.applyConfigurationPackage, inputGVString), inputType.Name.Name+"ApplyConfiguration") - } - extendedMethods = append(extendedMethods, extendedMethod) - } - m := map[string]interface{}{ - "type": t, - "inputType": t, - "resultType": t, - "package": pkg, - "Package": namer.IC(pkg), - "namespaced": !tags.NonNamespaced, - "Group": namer.IC(g.group), - "subresource": false, - "subresourcePath": "", - "GroupGoName": g.groupGoName, - "Version": namer.IC(g.version), - "CreateOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "CreateOptions"}), - "DeleteOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "DeleteOptions"}), - "GetOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "GetOptions"}), - "ListOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ListOptions"}), - "PatchOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "PatchOptions"}), - "ApplyOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ApplyOptions"}), - "UpdateOptions": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "UpdateOptions"}), - "PatchType": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/types", Name: "PatchType"}), - "ApplyPatchType": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/types", Name: "ApplyPatchType"}), - "watchInterface": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/watch", Name: "Interface"}), - "RESTClientInterface": c.Universe.Type(types.Name{Package: "k8s.io/client-go/rest", Name: "Interface"}), - "schemeParameterCodec": c.Universe.Variable(types.Name{Package: filepath.Join(g.clientsetPackage, "scheme"), Name: "ParameterCodec"}), - "jsonMarshal": c.Universe.Type(types.Name{Package: "encoding/json", Name: "Marshal"}), - } - - if generateApply { - // Generated apply configuration type references required for generated Apply function - _, gvString := util.ParsePathGroupVersion(g.inputPackage) - m["inputApplyConfig"] = types.Ref(path.Join(g.applyConfigurationPackage, gvString), t.Name.Name+"ApplyConfiguration") - } - - sw.Do(getterComment, m) - if tags.NonNamespaced { - sw.Do(getterNonNamespaced, m) - } else { - sw.Do(getterNamespaced, m) - } - - sw.Do(interfaceTemplate1, m) - if !tags.NoVerbs { - if !genStatus(t) { - tags.SkipVerbs = append(tags.SkipVerbs, "updateStatus") - tags.SkipVerbs = append(tags.SkipVerbs, "applyStatus") - } - interfaceSuffix := "" - if len(extendedMethods) > 0 { - interfaceSuffix = "\n" - } - sw.Do("\n"+generateInterface(defaultVerbTemplates, tags)+interfaceSuffix, m) - // add extended verbs into interface - for _, v := range extendedMethods { - sw.Do(v.template+interfaceSuffix, v.args) - } - - } - sw.Do(interfaceTemplate4, m) - - if tags.NonNamespaced { - sw.Do(structNonNamespaced, m) - sw.Do(newStructNonNamespaced, m) - } else { - sw.Do(structNamespaced, m) - sw.Do(newStructNamespaced, m) - } - - if tags.NoVerbs { - return sw.Error() - } - - if tags.HasVerb("get") { - sw.Do(getTemplate, m) - } - if tags.HasVerb("list") { - sw.Do(listTemplate, m) - } - if tags.HasVerb("watch") { - sw.Do(watchTemplate, m) - } - - if tags.HasVerb("create") { - sw.Do(createTemplate, m) - } - if tags.HasVerb("update") { - sw.Do(updateTemplate, m) - } - if tags.HasVerb("updateStatus") { - sw.Do(updateStatusTemplate, m) - } - if tags.HasVerb("delete") { - sw.Do(deleteTemplate, m) - } - if tags.HasVerb("deleteCollection") { - sw.Do(deleteCollectionTemplate, m) - } - if tags.HasVerb("patch") { - sw.Do(patchTemplate, m) - } - if tags.HasVerb("apply") && generateApply { - sw.Do(applyTemplate, m) - } - if tags.HasVerb("applyStatus") && generateApply { - sw.Do(applyStatusTemplate, m) - } - - // generate expansion methods - for _, e := range tags.Extensions { - if e.HasVerb("apply") && !generateApply { - continue - } - inputType := *t - resultType := *t - inputGVString := typeGVString - if len(e.InputTypeOverride) > 0 { - if name, pkg := e.Input(); len(pkg) > 0 { - _, inputGVString = util.ParsePathGroupVersion(pkg) - newType := c.Universe.Type(types.Name{Package: pkg, Name: name}) - inputType = *newType - } else { - inputType.Name.Name = e.InputTypeOverride - } - } - if len(e.ResultTypeOverride) > 0 { - if name, pkg := e.Result(); len(pkg) > 0 { - newType := c.Universe.Type(types.Name{Package: pkg, Name: name}) - resultType = *newType - } else { - resultType.Name.Name = e.ResultTypeOverride - } - } - m["inputType"] = &inputType - m["resultType"] = &resultType - m["subresourcePath"] = e.SubResourcePath - if e.HasVerb("apply") { - m["inputApplyConfig"] = types.Ref(path.Join(g.applyConfigurationPackage, inputGVString), inputType.Name.Name+"ApplyConfiguration") - } - - if e.HasVerb("get") { - if e.IsSubresource() { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, getSubresourceTemplate), m) - } else { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, getTemplate), m) - } - } - - if e.HasVerb("list") { - if e.IsSubresource() { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, listSubresourceTemplate), m) - } else { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, listTemplate), m) - } - } - - // TODO: Figure out schemantic for watching a sub-resource. - if e.HasVerb("watch") { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, watchTemplate), m) - } - - if e.HasVerb("create") { - if e.IsSubresource() { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, createSubresourceTemplate), m) - } else { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, createTemplate), m) - } - } - - if e.HasVerb("update") { - if e.IsSubresource() { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, updateSubresourceTemplate), m) - } else { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, updateTemplate), m) - } - } - - // TODO: Figure out schemantic for deleting a sub-resource (what arguments - // are passed, does it need two names? etc. - if e.HasVerb("delete") { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, deleteTemplate), m) - } - - if e.HasVerb("patch") { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, patchTemplate), m) - } - - if e.HasVerb("apply") { - if e.IsSubresource() { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, applySubresourceTemplate), m) - } else { - sw.Do(adjustTemplate(e.VerbName, e.VerbType, applyTemplate), m) - } - } - } - - return sw.Error() -} - -// adjustTemplate adjust the origin verb template using the expansion name. -// TODO: Make the verbs in templates parametrized so the strings.Replace() is -// not needed. -func adjustTemplate(name, verbType, template string) string { - return strings.Replace(template, " "+strings.Title(verbType), " "+name, -1) -} - -func generateInterface(defaultVerbTemplates map[string]string, tags util.Tags) string { - // need an ordered list here to guarantee order of generated methods. - out := []string{} - for _, m := range util.SupportedVerbs { - if tags.HasVerb(m) && len(defaultVerbTemplates[m]) > 0 { - out = append(out, defaultVerbTemplates[m]) - } - } - return strings.Join(out, "\n") -} - -func buildSubresourceDefaultVerbTemplates(generateApply bool) map[string]string { - m := map[string]string{ - "create": `Create(ctx context.Context, $.type|private$Name string, $.inputType|private$ *$.inputType|raw$, opts $.CreateOptions|raw$) (*$.resultType|raw$, error)`, - "list": `List(ctx context.Context, $.type|private$Name string, opts $.ListOptions|raw$) (*$.resultType|raw$List, error)`, - "update": `Update(ctx context.Context, $.type|private$Name string, $.inputType|private$ *$.inputType|raw$, opts $.UpdateOptions|raw$) (*$.resultType|raw$, error)`, - "get": `Get(ctx context.Context, $.type|private$Name string, options $.GetOptions|raw$) (*$.resultType|raw$, error)`, - } - if generateApply { - m["apply"] = `Apply(ctx context.Context, $.type|private$Name string, $.inputType|private$ *$.inputApplyConfig|raw$, opts $.ApplyOptions|raw$) (*$.resultType|raw$, error)` - } - return m -} - -func buildDefaultVerbTemplates(generateApply bool) map[string]string { - m := map[string]string{ - "create": `Create(ctx context.Context, $.inputType|private$ *$.inputType|raw$, opts $.CreateOptions|raw$) (*$.resultType|raw$, error)`, - "update": `Update(ctx context.Context, $.inputType|private$ *$.inputType|raw$, opts $.UpdateOptions|raw$) (*$.resultType|raw$, error)`, - "updateStatus": `UpdateStatus(ctx context.Context, $.inputType|private$ *$.type|raw$, opts $.UpdateOptions|raw$) (*$.type|raw$, error)`, - "delete": `Delete(ctx context.Context, name string, opts $.DeleteOptions|raw$) error`, - "deleteCollection": `DeleteCollection(ctx context.Context, opts $.DeleteOptions|raw$, listOpts $.ListOptions|raw$) error`, - "get": `Get(ctx context.Context, name string, opts $.GetOptions|raw$) (*$.resultType|raw$, error)`, - "list": `List(ctx context.Context, opts $.ListOptions|raw$) (*$.resultType|raw$List, error)`, - "watch": `Watch(ctx context.Context, opts $.ListOptions|raw$) ($.watchInterface|raw$, error)`, - "patch": `Patch(ctx context.Context, name string, pt $.PatchType|raw$, data []byte, opts $.PatchOptions|raw$, subresources ...string) (result *$.resultType|raw$, err error)`, - } - if generateApply { - m["apply"] = `Apply(ctx context.Context, $.inputType|private$ *$.inputApplyConfig|raw$, opts $.ApplyOptions|raw$) (result *$.resultType|raw$, err error)` - m["applyStatus"] = `ApplyStatus(ctx context.Context, $.inputType|private$ *$.inputApplyConfig|raw$, opts $.ApplyOptions|raw$) (result *$.resultType|raw$, err error)` - } - return m -} - -// group client will implement this interface. -var getterComment = ` -// $.type|publicPlural$Getter has a method to return a $.type|public$Interface. -// A group's client should implement this interface.` - -var getterNamespaced = ` -type $.type|publicPlural$Getter interface { - $.type|publicPlural$(namespace string) $.type|public$Interface -} -` - -var getterNonNamespaced = ` -type $.type|publicPlural$Getter interface { - $.type|publicPlural$() $.type|public$Interface -} -` - -// this type's interface, typed client will implement this interface. -var interfaceTemplate1 = ` -// $.type|public$Interface has methods to work with $.type|public$ resources. -type $.type|public$Interface interface {` - -var interfaceTemplate4 = ` - $.type|public$Expansion -} -` - -// template for the struct that implements the type's interface -var structNamespaced = ` -// $.type|privatePlural$ implements $.type|public$Interface -type $.type|privatePlural$ struct { - client $.RESTClientInterface|raw$ - ns string -} -` - -// template for the struct that implements the type's interface -var structNonNamespaced = ` -// $.type|privatePlural$ implements $.type|public$Interface -type $.type|privatePlural$ struct { - client $.RESTClientInterface|raw$ -} -` - -var newStructNamespaced = ` -// new$.type|publicPlural$ returns a $.type|publicPlural$ -func new$.type|publicPlural$(c *$.GroupGoName$$.Version$Client, namespace string) *$.type|privatePlural$ { - return &$.type|privatePlural${ - client: c.RESTClient(), - ns: namespace, - } -} -` - -var newStructNonNamespaced = ` -// new$.type|publicPlural$ returns a $.type|publicPlural$ -func new$.type|publicPlural$(c *$.GroupGoName$$.Version$Client) *$.type|privatePlural$ { - return &$.type|privatePlural${ - client: c.RESTClient(), - } -} -` -var listTemplate = ` -// List takes label and field selectors, and returns the list of $.resultType|publicPlural$ that match those selectors. -func (c *$.type|privatePlural$) List(ctx context.Context, opts $.ListOptions|raw$) (result *$.resultType|raw$List, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil{ - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &$.resultType|raw$List{} - err = c.client.Get(). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - VersionedParams(&opts, $.schemeParameterCodec|raw$). - Timeout(timeout). - Do(ctx). - Into(result) - return -} -` - -var listSubresourceTemplate = ` -// List takes $.type|raw$ name, label and field selectors, and returns the list of $.resultType|publicPlural$ that match those selectors. -func (c *$.type|privatePlural$) List(ctx context.Context, $.type|private$Name string, opts $.ListOptions|raw$) (result *$.resultType|raw$List, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil{ - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &$.resultType|raw$List{} - err = c.client.Get(). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - Name($.type|private$Name). - SubResource("$.subresourcePath$"). - VersionedParams(&opts, $.schemeParameterCodec|raw$). - Timeout(timeout). - Do(ctx). - Into(result) - return -} -` - -var getTemplate = ` -// Get takes name of the $.type|private$, and returns the corresponding $.resultType|private$ object, and an error if there is any. -func (c *$.type|privatePlural$) Get(ctx context.Context, name string, options $.GetOptions|raw$) (result *$.resultType|raw$, err error) { - result = &$.resultType|raw${} - err = c.client.Get(). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - Name(name). - VersionedParams(&options, $.schemeParameterCodec|raw$). - Do(ctx). - Into(result) - return -} -` - -var getSubresourceTemplate = ` -// Get takes name of the $.type|private$, and returns the corresponding $.resultType|raw$ object, and an error if there is any. -func (c *$.type|privatePlural$) Get(ctx context.Context, $.type|private$Name string, options $.GetOptions|raw$) (result *$.resultType|raw$, err error) { - result = &$.resultType|raw${} - err = c.client.Get(). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - Name($.type|private$Name). - SubResource("$.subresourcePath$"). - VersionedParams(&options, $.schemeParameterCodec|raw$). - Do(ctx). - Into(result) - return -} -` - -var deleteTemplate = ` -// Delete takes name of the $.type|private$ and deletes it. Returns an error if one occurs. -func (c *$.type|privatePlural$) Delete(ctx context.Context, name string, opts $.DeleteOptions|raw$) error { - return c.client.Delete(). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} -` - -var deleteCollectionTemplate = ` -// DeleteCollection deletes a collection of objects. -func (c *$.type|privatePlural$) DeleteCollection(ctx context.Context, opts $.DeleteOptions|raw$, listOpts $.ListOptions|raw$) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil{ - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - VersionedParams(&listOpts, $.schemeParameterCodec|raw$). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} -` - -var createSubresourceTemplate = ` -// Create takes the representation of a $.inputType|private$ and creates it. Returns the server's representation of the $.resultType|private$, and an error, if there is any. -func (c *$.type|privatePlural$) Create(ctx context.Context, $.type|private$Name string, $.inputType|private$ *$.inputType|raw$, opts $.CreateOptions|raw$) (result *$.resultType|raw$, err error) { - result = &$.resultType|raw${} - err = c.client.Post(). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - Name($.type|private$Name). - SubResource("$.subresourcePath$"). - VersionedParams(&opts, $.schemeParameterCodec|raw$). - Body($.inputType|private$). - Do(ctx). - Into(result) - return -} -` - -var createTemplate = ` -// Create takes the representation of a $.inputType|private$ and creates it. Returns the server's representation of the $.resultType|private$, and an error, if there is any. -func (c *$.type|privatePlural$) Create(ctx context.Context, $.inputType|private$ *$.inputType|raw$, opts $.CreateOptions|raw$) (result *$.resultType|raw$, err error) { - result = &$.resultType|raw${} - err = c.client.Post(). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - VersionedParams(&opts, $.schemeParameterCodec|raw$). - Body($.inputType|private$). - Do(ctx). - Into(result) - return -} -` - -var updateSubresourceTemplate = ` -// Update takes the top resource name and the representation of a $.inputType|private$ and updates it. Returns the server's representation of the $.resultType|private$, and an error, if there is any. -func (c *$.type|privatePlural$) Update(ctx context.Context, $.type|private$Name string, $.inputType|private$ *$.inputType|raw$, opts $.UpdateOptions|raw$) (result *$.resultType|raw$, err error) { - result = &$.resultType|raw${} - err = c.client.Put(). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - Name($.type|private$Name). - SubResource("$.subresourcePath$"). - VersionedParams(&opts, $.schemeParameterCodec|raw$). - Body($.inputType|private$). - Do(ctx). - Into(result) - return -} -` - -var updateTemplate = ` -// Update takes the representation of a $.inputType|private$ and updates it. Returns the server's representation of the $.resultType|private$, and an error, if there is any. -func (c *$.type|privatePlural$) Update(ctx context.Context, $.inputType|private$ *$.inputType|raw$, opts $.UpdateOptions|raw$) (result *$.resultType|raw$, err error) { - result = &$.resultType|raw${} - err = c.client.Put(). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - Name($.inputType|private$.Name). - VersionedParams(&opts, $.schemeParameterCodec|raw$). - Body($.inputType|private$). - Do(ctx). - Into(result) - return -} -` - -var updateStatusTemplate = ` -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *$.type|privatePlural$) UpdateStatus(ctx context.Context, $.type|private$ *$.type|raw$, opts $.UpdateOptions|raw$) (result *$.type|raw$, err error) { - result = &$.type|raw${} - err = c.client.Put(). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - Name($.type|private$.Name). - SubResource("status"). - VersionedParams(&opts, $.schemeParameterCodec|raw$). - Body($.type|private$). - Do(ctx). - Into(result) - return -} -` - -var watchTemplate = ` -// Watch returns a $.watchInterface|raw$ that watches the requested $.type|privatePlural$. -func (c *$.type|privatePlural$) Watch(ctx context.Context, opts $.ListOptions|raw$) ($.watchInterface|raw$, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil{ - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - VersionedParams(&opts, $.schemeParameterCodec|raw$). - Timeout(timeout). - Watch(ctx) -} -` - -var patchTemplate = ` -// Patch applies the patch and returns the patched $.resultType|private$. -func (c *$.type|privatePlural$) Patch(ctx context.Context, name string, pt $.PatchType|raw$, data []byte, opts $.PatchOptions|raw$, subresources ...string) (result *$.resultType|raw$, err error) { - result = &$.resultType|raw${} - err = c.client.Patch(pt). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, $.schemeParameterCodec|raw$). - Body(data). - Do(ctx). - Into(result) - return -} -` - -var applyTemplate = ` -// Apply takes the given apply declarative configuration, applies it and returns the applied $.resultType|private$. -func (c *$.type|privatePlural$) Apply(ctx context.Context, $.inputType|private$ *$.inputApplyConfig|raw$, opts $.ApplyOptions|raw$) (result *$.resultType|raw$, err error) { - if $.inputType|private$ == nil { - return nil, fmt.Errorf("$.inputType|private$ provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := $.jsonMarshal|raw$($.inputType|private$) - if err != nil { - return nil, err - } - name := $.inputType|private$.Name - if name == nil { - return nil, fmt.Errorf("$.inputType|private$.Name must be provided to Apply") - } - result = &$.resultType|raw${} - err = c.client.Patch($.ApplyPatchType|raw$). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - Name(*name). - VersionedParams(&patchOpts, $.schemeParameterCodec|raw$). - Body(data). - Do(ctx). - Into(result) - return -} -` - -var applyStatusTemplate = ` -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *$.type|privatePlural$) ApplyStatus(ctx context.Context, $.inputType|private$ *$.inputApplyConfig|raw$, opts $.ApplyOptions|raw$) (result *$.resultType|raw$, err error) { - if $.inputType|private$ == nil { - return nil, fmt.Errorf("$.inputType|private$ provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := $.jsonMarshal|raw$($.inputType|private$) - if err != nil { - return nil, err - } - - name := $.inputType|private$.Name - if name == nil { - return nil, fmt.Errorf("$.inputType|private$.Name must be provided to Apply") - } - - result = &$.resultType|raw${} - err = c.client.Patch($.ApplyPatchType|raw$). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, $.schemeParameterCodec|raw$). - Body(data). - Do(ctx). - Into(result) - return -} -` - -var applySubresourceTemplate = ` -// Apply takes top resource name and the apply declarative configuration for $.subresourcePath$, -// applies it and returns the applied $.resultType|private$, and an error, if there is any. -func (c *$.type|privatePlural$) Apply(ctx context.Context, $.type|private$Name string, $.inputType|private$ *$.inputApplyConfig|raw$, opts $.ApplyOptions|raw$) (result *$.resultType|raw$, err error) { - if $.inputType|private$ == nil { - return nil, fmt.Errorf("$.inputType|private$ provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := $.jsonMarshal|raw$($.inputType|private$) - if err != nil { - return nil, err - } - - result = &$.resultType|raw${} - err = c.client.Patch($.ApplyPatchType|raw$). - $if .namespaced$Namespace(c.ns).$end$ - Resource("$.type|resource$"). - Name($.type|private$Name). - SubResource("$.subresourcePath$"). - VersionedParams(&patchOpts, $.schemeParameterCodec|raw$). - Body(data). - Do(ctx). - Into(result) - return -} -` diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/scheme/generator_for_scheme.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/scheme/generator_for_scheme.go deleted file mode 100644 index a87d7571eb6..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/scheme/generator_for_scheme.go +++ /dev/null @@ -1,187 +0,0 @@ -/* -Copyright 2017 The Kubernetes 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 scheme - -import ( - "fmt" - "io" - "os" - "path/filepath" - "strings" - - "k8s.io/code-generator/cmd/client-gen/path" - clientgentypes "k8s.io/code-generator/cmd/client-gen/types" - "k8s.io/gengo/generator" - "k8s.io/gengo/namer" - "k8s.io/gengo/types" -) - -// GenScheme produces a package for a clientset with the scheme, codecs and parameter codecs. -type GenScheme struct { - generator.DefaultGen - OutputPackage string - Groups []clientgentypes.GroupVersions - GroupGoNames map[clientgentypes.GroupVersion]string - InputPackages map[clientgentypes.GroupVersion]string - OutputPath string - ImportTracker namer.ImportTracker - PrivateScheme bool - CreateRegistry bool - schemeGenerated bool -} - -func (g *GenScheme) Namers(c *generator.Context) namer.NameSystems { - return namer.NameSystems{ - "raw": namer.NewRawNamer(g.OutputPackage, g.ImportTracker), - } -} - -// We only want to call GenerateType() once. -func (g *GenScheme) Filter(c *generator.Context, t *types.Type) bool { - ret := !g.schemeGenerated - g.schemeGenerated = true - return ret -} - -func (g *GenScheme) Imports(c *generator.Context) (imports []string) { - imports = append(imports, g.ImportTracker.ImportLines()...) - for _, group := range g.Groups { - for _, version := range group.Versions { - packagePath := g.InputPackages[clientgentypes.GroupVersion{Group: group.Group, Version: version.Version}] - groupAlias := strings.ToLower(g.GroupGoNames[clientgentypes.GroupVersion{Group: group.Group, Version: version.Version}]) - if g.CreateRegistry { - // import the install package for internal clientsets instead of the type package with register.go - if version.Version != "" { - packagePath = filepath.Dir(packagePath) - } - packagePath = filepath.Join(packagePath, "install") - - imports = append(imports, fmt.Sprintf("%s \"%s\"", groupAlias, path.Vendorless(packagePath))) - break - } else { - imports = append(imports, fmt.Sprintf("%s%s \"%s\"", groupAlias, strings.ToLower(version.Version.NonEmpty()), path.Vendorless(packagePath))) - } - } - } - return -} - -func (g *GenScheme) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { - sw := generator.NewSnippetWriter(w, c, "$", "$") - - allGroupVersions := clientgentypes.ToGroupVersionInfo(g.Groups, g.GroupGoNames) - allInstallGroups := clientgentypes.ToGroupInstallPackages(g.Groups, g.GroupGoNames) - - m := map[string]interface{}{ - "publicScheme": !g.PrivateScheme, - "allGroupVersions": allGroupVersions, - "allInstallGroups": allInstallGroups, - "customRegister": false, - "runtimeNewParameterCodec": c.Universe.Function(types.Name{Package: "k8s.io/apimachinery/pkg/runtime", Name: "NewParameterCodec"}), - "runtimeNewScheme": c.Universe.Function(types.Name{Package: "k8s.io/apimachinery/pkg/runtime", Name: "NewScheme"}), - "serializerNewCodecFactory": c.Universe.Function(types.Name{Package: "k8s.io/apimachinery/pkg/runtime/serializer", Name: "NewCodecFactory"}), - "runtimeScheme": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/runtime", Name: "Scheme"}), - "runtimeSchemeBuilder": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/runtime", Name: "SchemeBuilder"}), - "runtimeUtilMust": c.Universe.Function(types.Name{Package: "k8s.io/apimachinery/pkg/util/runtime", Name: "Must"}), - "schemaGroupVersion": c.Universe.Type(types.Name{Package: "k8s.io/apimachinery/pkg/runtime/schema", Name: "GroupVersion"}), - "metav1AddToGroupVersion": c.Universe.Function(types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "AddToGroupVersion"}), - } - globals := map[string]string{ - "Scheme": "Scheme", - "Codecs": "Codecs", - "ParameterCodec": "ParameterCodec", - "Registry": "Registry", - } - for k, v := range globals { - if g.PrivateScheme { - m[k] = strings.ToLower(v[0:1]) + v[1:] - } else { - m[k] = v - } - } - - sw.Do(globalsTemplate, m) - - if g.OutputPath != "" { - if _, err := os.Stat(filepath.Join(g.OutputPath, strings.ToLower("register_custom.go"))); err == nil { - m["customRegister"] = true - } - } - - if g.CreateRegistry { - sw.Do(registryRegistration, m) - } else { - sw.Do(simpleRegistration, m) - } - - return sw.Error() -} - -var globalsTemplate = ` -var $.Scheme$ = $.runtimeNewScheme|raw$() -var $.Codecs$ = $.serializerNewCodecFactory|raw$($.Scheme$) -$if .publicScheme$var $.ParameterCodec$ = $.runtimeNewParameterCodec|raw$($.Scheme$)$end -$` - -var registryRegistration = ` - -func init() { - $.metav1AddToGroupVersion|raw$($.Scheme$, $.schemaGroupVersion|raw${Version: "v1"}) - Install($.Scheme$) -} - -// Install registers the API group and adds types to a scheme -func Install(scheme *$.runtimeScheme|raw$) { - $- range .allInstallGroups$ - $.InstallPackageAlias$.Install(scheme) - $- end$ - $if .customRegister$ - ExtraInstall(scheme) - $end -$ -} -` - -var simpleRegistration = ` -var localSchemeBuilder = $.runtimeSchemeBuilder|raw${ - $- range .allGroupVersions$ - $.PackageAlias$.AddToScheme, - $- end$ - $if .customRegister$ - ExtraAddToScheme, - $end -$ -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - $.metav1AddToGroupVersion|raw$($.Scheme$, $.schemaGroupVersion|raw${Version: "v1"}) - $.runtimeUtilMust|raw$(AddToScheme($.Scheme$)) -} -` diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/util/gvpackages.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/util/gvpackages.go deleted file mode 100644 index fcc1950909b..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/util/gvpackages.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2021 The Kubernetes 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 util - -import "strings" - -func ParsePathGroupVersion(pgvString string) (gvPath string, gvString string) { - subs := strings.Split(pgvString, "/") - length := len(subs) - switch length { - case 0, 1, 2: - return "", pgvString - default: - return strings.Join(subs[:length-2], "/"), strings.Join(subs[length-2:], "/") - } -} diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/util/tags.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/util/tags.go deleted file mode 100644 index e74de077629..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/util/tags.go +++ /dev/null @@ -1,344 +0,0 @@ -/* -Copyright 2016 The Kubernetes 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 util - -import ( - "errors" - "fmt" - "strings" - - "k8s.io/gengo/types" -) - -var supportedTags = []string{ - "genclient", - "genclient:nonNamespaced", - "genclient:noVerbs", - "genclient:onlyVerbs", - "genclient:skipVerbs", - "genclient:noStatus", - "genclient:readonly", - "genclient:method", -} - -// SupportedVerbs is a list of supported verbs for +onlyVerbs and +skipVerbs. -var SupportedVerbs = []string{ - "create", - "update", - "updateStatus", - "delete", - "deleteCollection", - "get", - "list", - "watch", - "patch", - "apply", - "applyStatus", -} - -// ReadonlyVerbs represents a list of read-only verbs. -var ReadonlyVerbs = []string{ - "get", - "list", - "watch", -} - -// genClientPrefix is the default prefix for all genclient tags. -const genClientPrefix = "genclient:" - -// unsupportedExtensionVerbs is a list of verbs we don't support generating -// extension client functions for. -var unsupportedExtensionVerbs = []string{ - "updateStatus", - "deleteCollection", - "watch", - "delete", -} - -// inputTypeSupportedVerbs is a list of verb types that supports overriding the -// input argument type. -var inputTypeSupportedVerbs = []string{ - "create", - "update", - "apply", -} - -// resultTypeSupportedVerbs is a list of verb types that supports overriding the -// resulting type. -var resultTypeSupportedVerbs = []string{ - "create", - "update", - "get", - "list", - "patch", - "apply", -} - -// Extensions allows to extend the default set of client verbs -// (CRUD+watch+patch+list+deleteCollection) for a given type with custom defined -// verbs. Custom verbs can have custom input and result types and also allow to -// use a sub-resource in a request instead of top-level resource type. -// -// Example: -// -// +genclient:method=UpdateScale,verb=update,subresource=scale,input=Scale,result=Scale -// -// type ReplicaSet struct { ... } -// -// The 'method=UpdateScale' is the name of the client function. -// The 'verb=update' here means the client function will use 'PUT' action. -// The 'subresource=scale' means we will use SubResource template to generate this client function. -// The 'input' is the input type used for creation (function argument). -// The 'result' (not needed in this case) is the result type returned from the -// client function. -type extension struct { - // VerbName is the name of the custom verb (Scale, Instantiate, etc..) - VerbName string - // VerbType is the type of the verb (only verbs from SupportedVerbs are - // supported) - VerbType string - // SubResourcePath defines a path to a sub-resource to use in the request. - // (optional) - SubResourcePath string - // InputTypeOverride overrides the input parameter type for the verb. By - // default the original type is used. Overriding the input type only works for - // "create" and "update" verb types. The given type must exists in the same - // package as the original type. - // (optional) - InputTypeOverride string - // ResultTypeOverride overrides the resulting object type for the verb. By - // default the original type is used. Overriding the result type works. - // (optional) - ResultTypeOverride string -} - -// IsSubresource indicates if this extension should generate the sub-resource. -func (e *extension) IsSubresource() bool { - return len(e.SubResourcePath) > 0 -} - -// HasVerb checks if the extension matches the given verb. -func (e *extension) HasVerb(verb string) bool { - return e.VerbType == verb -} - -// Input returns the input override package path and the type. -func (e *extension) Input() (string, string) { - parts := strings.Split(e.InputTypeOverride, ".") - return parts[len(parts)-1], strings.Join(parts[0:len(parts)-1], ".") -} - -// Result returns the result override package path and the type. -func (e *extension) Result() (string, string) { - parts := strings.Split(e.ResultTypeOverride, ".") - return parts[len(parts)-1], strings.Join(parts[0:len(parts)-1], ".") -} - -// Tags represents a genclient configuration for a single type. -type Tags struct { - // +genclient - GenerateClient bool - // +genclient:nonNamespaced - NonNamespaced bool - // +genclient:noStatus - NoStatus bool - // +genclient:noVerbs - NoVerbs bool - // +genclient:skipVerbs=get,update - // +genclient:onlyVerbs=create,delete - SkipVerbs []string - // +genclient:method=UpdateScale,verb=update,subresource=scale,input=Scale,result=Scale - Extensions []extension -} - -// HasVerb returns true if we should include the given verb in final client interface and -// generate the function for it. -func (t Tags) HasVerb(verb string) bool { - if len(t.SkipVerbs) == 0 { - return true - } - for _, s := range t.SkipVerbs { - if verb == s { - return false - } - } - return true -} - -// MustParseClientGenTags calls ParseClientGenTags but instead of returning error it panics. -func MustParseClientGenTags(lines []string) Tags { - tags, err := ParseClientGenTags(lines) - if err != nil { - panic(err.Error()) - } - return tags -} - -// ParseClientGenTags parse the provided genclient tags and validates that no unknown -// tags are provided. -func ParseClientGenTags(lines []string) (Tags, error) { - ret := Tags{} - values := types.ExtractCommentTags("+", lines) - var value []string - value, ret.GenerateClient = values["genclient"] - // Check the old format and error when used to avoid generating client when //+genclient=false - if len(value) > 0 && len(value[0]) > 0 { - return ret, fmt.Errorf("+genclient=%s is invalid, use //+genclient if you want to generate client or omit it when you want to disable generation", value) - } - _, ret.NonNamespaced = values[genClientPrefix+"nonNamespaced"] - // Check the old format and error when used - if value := values["nonNamespaced"]; len(value) > 0 && len(value[0]) > 0 { - return ret, fmt.Errorf("+nonNamespaced=%s is invalid, use //+genclient:nonNamespaced instead", value[0]) - } - _, ret.NoVerbs = values[genClientPrefix+"noVerbs"] - _, ret.NoStatus = values[genClientPrefix+"noStatus"] - onlyVerbs := []string{} - if _, isReadonly := values[genClientPrefix+"readonly"]; isReadonly { - onlyVerbs = ReadonlyVerbs - } - // Check the old format and error when used - if value := values["readonly"]; len(value) > 0 && len(value[0]) > 0 { - return ret, fmt.Errorf("+readonly=%s is invalid, use //+genclient:readonly instead", value[0]) - } - if v, exists := values[genClientPrefix+"skipVerbs"]; exists { - ret.SkipVerbs = strings.Split(v[0], ",") - } - if v, exists := values[genClientPrefix+"onlyVerbs"]; exists || len(onlyVerbs) > 0 { - if len(v) > 0 { - onlyVerbs = append(onlyVerbs, strings.Split(v[0], ",")...) - } - skipVerbs := []string{} - for _, m := range SupportedVerbs { - skip := true - for _, o := range onlyVerbs { - if o == m { - skip = false - break - } - } - // Check for conflicts - for _, v := range skipVerbs { - if v == m { - return ret, fmt.Errorf("verb %q used both in genclient:skipVerbs and genclient:onlyVerbs", v) - } - } - if skip { - skipVerbs = append(skipVerbs, m) - } - } - ret.SkipVerbs = skipVerbs - } - var err error - if ret.Extensions, err = parseClientExtensions(values); err != nil { - return ret, err - } - return ret, validateClientGenTags(values) -} - -func parseClientExtensions(tags map[string][]string) ([]extension, error) { - var ret []extension - for name, values := range tags { - if !strings.HasPrefix(name, genClientPrefix+"method") { - continue - } - for _, value := range values { - // the value comes in this form: "Foo,verb=create" - ext := extension{} - parts := strings.Split(value, ",") - if len(parts) == 0 { - return nil, fmt.Errorf("invalid of empty extension verb name: %q", value) - } - // The first part represents the name of the extension - ext.VerbName = parts[0] - if len(ext.VerbName) == 0 { - return nil, fmt.Errorf("must specify a verb name (// +genclient:method=Foo,verb=create)") - } - // Parse rest of the arguments - params := parts[1:] - for _, p := range params { - parts := strings.Split(p, "=") - if len(parts) != 2 { - return nil, fmt.Errorf("invalid extension tag specification %q", p) - } - key, val := strings.TrimSpace(parts[0]), strings.TrimSpace(parts[1]) - if len(val) == 0 { - return nil, fmt.Errorf("empty value of %q for %q extension", key, ext.VerbName) - } - switch key { - case "verb": - ext.VerbType = val - case "subresource": - ext.SubResourcePath = val - case "input": - ext.InputTypeOverride = val - case "result": - ext.ResultTypeOverride = val - default: - return nil, fmt.Errorf("unknown extension configuration key %q", key) - } - } - // Validate resulting extension configuration - if len(ext.VerbType) == 0 { - return nil, fmt.Errorf("verb type must be specified (use '// +genclient:method=%s,verb=create')", ext.VerbName) - } - if len(ext.ResultTypeOverride) > 0 { - supported := false - for _, v := range resultTypeSupportedVerbs { - if ext.VerbType == v { - supported = true - break - } - } - if !supported { - return nil, fmt.Errorf("%s: result type is not supported for %q verbs (supported verbs: %#v)", ext.VerbName, ext.VerbType, resultTypeSupportedVerbs) - } - } - if len(ext.InputTypeOverride) > 0 { - supported := false - for _, v := range inputTypeSupportedVerbs { - if ext.VerbType == v { - supported = true - break - } - } - if !supported { - return nil, fmt.Errorf("%s: input type is not supported for %q verbs (supported verbs: %#v)", ext.VerbName, ext.VerbType, inputTypeSupportedVerbs) - } - } - for _, t := range unsupportedExtensionVerbs { - if ext.VerbType == t { - return nil, fmt.Errorf("verb %q is not supported by extension generator", ext.VerbType) - } - } - ret = append(ret, ext) - } - } - return ret, nil -} - -// validateTags validates that only supported genclient tags were provided. -func validateClientGenTags(values map[string][]string) error { - for _, k := range supportedTags { - delete(values, k) - } - for key := range values { - if strings.HasPrefix(key, strings.TrimSuffix(genClientPrefix, ":")) { - return errors.New("unknown tag detected: " + key) - } - } - return nil -} diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/main.go b/vendor/k8s.io/code-generator/cmd/client-gen/main.go deleted file mode 100644 index bdb55461385..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/main.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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. -*/ - -// client-gen makes the individual typed clients using gengo. -package main - -import ( - "flag" - - "github.com/spf13/pflag" - "k8s.io/klog/v2" - - generatorargs "k8s.io/code-generator/cmd/client-gen/args" - "k8s.io/code-generator/cmd/client-gen/generators" - "k8s.io/code-generator/pkg/util" -) - -func main() { - klog.InitFlags(nil) - genericArgs, customArgs := generatorargs.NewDefaults() - - // Override defaults. - // TODO: move this out of client-gen - genericArgs.GoHeaderFilePath = util.BoilerplatePath() - genericArgs.OutputPackagePath = "k8s.io/kubernetes/pkg/client/clientset_generated/" - - genericArgs.AddFlags(pflag.CommandLine) - customArgs.AddFlags(pflag.CommandLine, "k8s.io/kubernetes/pkg/apis") // TODO: move this input path out of client-gen - flag.Set("logtostderr", "true") - pflag.CommandLine.AddGoFlagSet(flag.CommandLine) - pflag.Parse() - - // add group version package as input dirs for gengo - for _, pkg := range customArgs.Groups { - for _, v := range pkg.Versions { - genericArgs.InputDirs = append(genericArgs.InputDirs, v.Package) - } - } - - if err := generatorargs.Validate(genericArgs); err != nil { - klog.Fatalf("Error: %v", err) - } - - if err := genericArgs.Execute( - generators.NameSystems(util.PluralExceptionListToMapOrDie(customArgs.PluralExceptions)), - generators.DefaultNameSystem(), - generators.Packages, - ); err != nil { - klog.Fatalf("Error: %v", err) - } -} diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/path/path.go b/vendor/k8s.io/code-generator/cmd/client-gen/path/path.go deleted file mode 100644 index 19b269bdf28..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/path/path.go +++ /dev/null @@ -1,31 +0,0 @@ -/* -Copyright 2017 The Kubernetes 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 path - -import "strings" - -// Vendorless removes the longest match of "*/vendor/" from the front of p. -// It is useful if a package locates in vendor/, e.g., -// k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1, because gengo -// indexes the package with its import path, e.g., -// k8s.io/apimachinery/pkg/apis/meta/v1, -func Vendorless(p string) string { - if pos := strings.LastIndex(p, "/vendor/"); pos != -1 { - return p[pos+len("/vendor/"):] - } - return p -} diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/types/helpers.go b/vendor/k8s.io/code-generator/cmd/client-gen/types/helpers.go deleted file mode 100644 index 59f2fd4449b..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/types/helpers.go +++ /dev/null @@ -1,121 +0,0 @@ -/* -Copyright 2016 The Kubernetes 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 types - -import ( - "fmt" - "regexp" - "sort" - "strings" - - "k8s.io/gengo/namer" -) - -// ToGroupVersion turns "group/version" string into a GroupVersion struct. It reports error -// if it cannot parse the string. -func ToGroupVersion(gv string) (GroupVersion, error) { - // this can be the internal version for the legacy kube types - // TODO once we've cleared the last uses as strings, this special case should be removed. - if (len(gv) == 0) || (gv == "/") { - return GroupVersion{}, nil - } - - switch strings.Count(gv, "/") { - case 0: - return GroupVersion{Group(gv), ""}, nil - case 1: - i := strings.Index(gv, "/") - return GroupVersion{Group(gv[:i]), Version(gv[i+1:])}, nil - default: - return GroupVersion{}, fmt.Errorf("unexpected GroupVersion string: %v", gv) - } -} - -type sortableSliceOfVersions []string - -func (a sortableSliceOfVersions) Len() int { return len(a) } -func (a sortableSliceOfVersions) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a sortableSliceOfVersions) Less(i, j int) bool { - vi, vj := strings.TrimLeft(a[i], "v"), strings.TrimLeft(a[j], "v") - major := regexp.MustCompile("^[0-9]+") - viMajor, vjMajor := major.FindString(vi), major.FindString(vj) - viRemaining, vjRemaining := strings.TrimLeft(vi, viMajor), strings.TrimLeft(vj, vjMajor) - switch { - case len(viRemaining) == 0 && len(vjRemaining) == 0: - return viMajor < vjMajor - case len(viRemaining) == 0 && len(vjRemaining) != 0: - // stable version is greater than unstable version - return false - case len(viRemaining) != 0 && len(vjRemaining) == 0: - // stable version is greater than unstable version - return true - } - // neither are stable versions - if viMajor != vjMajor { - return viMajor < vjMajor - } - // assuming at most we have one alpha or one beta version, so if vi contains "alpha", it's the lesser one. - return strings.Contains(viRemaining, "alpha") -} - -// Determine the default version among versions. If a user calls a group client -// without specifying the version (e.g., c.CoreV1(), instead of c.CoreV1()), the -// default version will be returned. -func defaultVersion(versions []PackageVersion) Version { - var versionStrings []string - for _, version := range versions { - versionStrings = append(versionStrings, version.Version.String()) - } - sort.Sort(sortableSliceOfVersions(versionStrings)) - return Version(versionStrings[len(versionStrings)-1]) -} - -// ToGroupVersionInfo is a helper function used by generators for groups. -func ToGroupVersionInfo(groups []GroupVersions, groupGoNames map[GroupVersion]string) []GroupVersionInfo { - var groupVersionPackages []GroupVersionInfo - for _, group := range groups { - for _, version := range group.Versions { - groupGoName := groupGoNames[GroupVersion{Group: group.Group, Version: version.Version}] - groupVersionPackages = append(groupVersionPackages, GroupVersionInfo{ - Group: Group(namer.IC(group.Group.NonEmpty())), - Version: Version(namer.IC(version.Version.String())), - PackageAlias: strings.ToLower(groupGoName + version.Version.NonEmpty()), - GroupGoName: groupGoName, - LowerCaseGroupGoName: namer.IL(groupGoName), - }) - } - } - return groupVersionPackages -} - -func ToGroupInstallPackages(groups []GroupVersions, groupGoNames map[GroupVersion]string) []GroupInstallPackage { - var groupInstallPackages []GroupInstallPackage - for _, group := range groups { - defaultVersion := defaultVersion(group.Versions) - groupGoName := groupGoNames[GroupVersion{Group: group.Group, Version: defaultVersion}] - groupInstallPackages = append(groupInstallPackages, GroupInstallPackage{ - Group: Group(namer.IC(group.Group.NonEmpty())), - InstallPackageAlias: strings.ToLower(groupGoName), - }) - } - return groupInstallPackages -} - -// NormalizeGroupVersion calls normalizes the GroupVersion. -//func NormalizeGroupVersion(gv GroupVersion) GroupVersion { -// return GroupVersion{Group: gv.Group.NonEmpty(), Version: gv.Version, NonEmptyVersion: normalization.Version(gv.Version)} -//} diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/types/types.go b/vendor/k8s.io/code-generator/cmd/client-gen/types/types.go deleted file mode 100644 index a5cc37cf7fc..00000000000 --- a/vendor/k8s.io/code-generator/cmd/client-gen/types/types.go +++ /dev/null @@ -1,97 +0,0 @@ -/* -Copyright 2016 The Kubernetes 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 types - -import "strings" - -type Version string - -func (v Version) String() string { - return string(v) -} - -func (v Version) NonEmpty() string { - if v == "" { - return "internalVersion" - } - return v.String() -} - -func (v Version) PackageName() string { - return strings.ToLower(v.NonEmpty()) -} - -type Group string - -func (g Group) String() string { - return string(g) -} - -func (g Group) NonEmpty() string { - if g == "api" { - return "core" - } - return string(g) -} - -func (g Group) PackageName() string { - parts := strings.Split(g.NonEmpty(), ".") - if parts[0] == "internal" && len(parts) > 1 { - return strings.ToLower(parts[1] + parts[0]) - } - return strings.ToLower(parts[0]) -} - -type PackageVersion struct { - Version - // The fully qualified package, e.g. k8s.io/kubernetes/pkg/apis/apps, where the types.go is found. - Package string -} - -type GroupVersion struct { - Group Group - Version Version -} - -func (gv GroupVersion) ToAPIVersion() string { - if len(gv.Group) > 0 && gv.Group.NonEmpty() != "core" { - return gv.Group.String() + "/" + gv.Version.String() - } else { - return gv.Version.String() - } -} - -type GroupVersions struct { - // The name of the package for this group, e.g. apps. - PackageName string - Group Group - Versions []PackageVersion -} - -// GroupVersionInfo contains all the info around a group version. -type GroupVersionInfo struct { - Group Group - Version Version - PackageAlias string - GroupGoName string - LowerCaseGroupGoName string -} - -type GroupInstallPackage struct { - Group Group - InstallPackageAlias string -} diff --git a/vendor/k8s.io/code-generator/pkg/namer/tag-override.go b/vendor/k8s.io/code-generator/pkg/namer/tag-override.go deleted file mode 100644 index fd8c3a8553c..00000000000 --- a/vendor/k8s.io/code-generator/pkg/namer/tag-override.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2016 The Kubernetes 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 namer - -import ( - "k8s.io/gengo/namer" - "k8s.io/gengo/types" -) - -// TagOverrideNamer is a namer which pulls names from a given tag, if specified, -// and otherwise falls back to a different namer. -type TagOverrideNamer struct { - tagName string - fallback namer.Namer -} - -// Name returns the tag value if it exists. It no tag was found the fallback namer will be used -func (n *TagOverrideNamer) Name(t *types.Type) string { - if nameOverride := extractTag(n.tagName, append(t.SecondClosestCommentLines, t.CommentLines...)); nameOverride != "" { - return nameOverride - } - - return n.fallback.Name(t) -} - -// NewTagOverrideNamer creates a namer.Namer which uses the contents of the given tag as -// the name, or falls back to another Namer if the tag is not present. -func NewTagOverrideNamer(tagName string, fallback namer.Namer) namer.Namer { - return &TagOverrideNamer{ - tagName: tagName, - fallback: fallback, - } -} - -// extractTag gets the comment-tags for the key. If the tag did not exist, it -// returns the empty string. -func extractTag(key string, lines []string) string { - val, present := types.ExtractCommentTags("+", lines)[key] - if !present || len(val) < 1 { - return "" - } - - return val[0] -} diff --git a/vendor/k8s.io/code-generator/pkg/util/build.go b/vendor/k8s.io/code-generator/pkg/util/build.go deleted file mode 100644 index 72ae683d8d8..00000000000 --- a/vendor/k8s.io/code-generator/pkg/util/build.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2017 The Kubernetes 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 util - -import ( - gobuild "go/build" - "os" - "path/filepath" - "reflect" - "strings" - - "golang.org/x/tools/go/packages" -) - -type empty struct{} - -// CurrentPackage returns the go package of the current directory, or "" if it cannot -// be derived from the GOPATH. -func CurrentPackage() string { - for _, root := range gobuild.Default.SrcDirs() { - if pkg, ok := hasSubdir(root, "."); ok { - return pkg - } - } - return "" -} - -func hasSubdir(root, dir string) (rel string, ok bool) { - // ensure a tailing separator to properly compare on word-boundaries - const sep = string(filepath.Separator) - root = filepath.Clean(root) - if !strings.HasSuffix(root, sep) { - root += sep - } - - // check whether root dir starts with root - dir = filepath.Clean(dir) - if !strings.HasPrefix(dir, root) { - return "", false - } - - // cut off root - return filepath.ToSlash(dir[len(root):]), true -} - -// BoilerplatePath returns the path to the boilerplate file in code-generator, -// or "" if the default boilerplate.go.txt file cannot be located. -func BoilerplatePath() string { - // set up paths to check - paths := []string{ - // works when run from root of $GOPATH containing k8s.io/code-generator - filepath.Join(reflect.TypeOf(empty{}).PkgPath(), "/../../hack/boilerplate.go.txt"), - // works when run from root of module vendoring k8s.io/code-generator - "vendor/k8s.io/code-generator/hack/boilerplate.go.txt", - // works when run from root of $GOPATH containing k8s.io/kubernetes - "k8s.io/kubernetes/vendor/k8s.io/code-generator/hack/boilerplate.go.txt", - } - - // see if we can locate the module directory and add that to the list - config := packages.Config{Mode: packages.NeedModule} - if loadedPackages, err := packages.Load(&config, "k8s.io/code-generator/pkg/util"); err == nil { - for _, loadedPackage := range loadedPackages { - if loadedPackage.Module != nil && loadedPackage.Module.Dir != "" { - paths = append(paths, filepath.Join(loadedPackage.Module.Dir, "hack/boilerplate.go.txt")) - } - } - } - - // try all paths and return the first that exists - for _, path := range paths { - if _, err := os.Stat(path); err == nil { - return path - } - } - // cannot be located, invoker will have to explicitly specify boilerplate file - return "" -} - -// Vendorless trims vendor prefix from a package path to make it canonical -func Vendorless(p string) string { - if pos := strings.LastIndex(p, "/vendor/"); pos != -1 { - return p[pos+len("/vendor/"):] - } - return p -} diff --git a/vendor/k8s.io/code-generator/pkg/util/plural_exceptions.go b/vendor/k8s.io/code-generator/pkg/util/plural_exceptions.go deleted file mode 100644 index 73c648d5b59..00000000000 --- a/vendor/k8s.io/code-generator/pkg/util/plural_exceptions.go +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright 2017 The Kubernetes 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 util - -import ( - "fmt" - "strings" -) - -// PluralExceptionListToMapOrDie converts the list in "Type:PluralType" to map[string]string. -// This is used for pluralizer. -// If the format is wrong, this function will panic. -func PluralExceptionListToMapOrDie(pluralExceptions []string) map[string]string { - pluralExceptionMap := make(map[string]string, len(pluralExceptions)) - for i := range pluralExceptions { - parts := strings.Split(pluralExceptions[i], ":") - if len(parts) != 2 { - panic(fmt.Sprintf("invalid plural exception definition: %s", pluralExceptions[i])) - } - pluralExceptionMap[parts[0]] = parts[1] - } - return pluralExceptionMap -} diff --git a/vendor/k8s.io/gengo/LICENSE b/vendor/k8s.io/gengo/LICENSE deleted file mode 100644 index 00b2401109f..00000000000 --- a/vendor/k8s.io/gengo/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2014 The Kubernetes 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. diff --git a/vendor/k8s.io/gengo/args/args.go b/vendor/k8s.io/gengo/args/args.go deleted file mode 100644 index 93d863f0e20..00000000000 --- a/vendor/k8s.io/gengo/args/args.go +++ /dev/null @@ -1,218 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 args has common command-line flags for generation programs. -package args - -import ( - "bytes" - goflag "flag" - "fmt" - "io/ioutil" - "os" - "path" - "path/filepath" - "strconv" - "strings" - "time" - - "k8s.io/gengo/generator" - "k8s.io/gengo/namer" - "k8s.io/gengo/parser" - "k8s.io/gengo/types" - - "github.com/spf13/pflag" -) - -// Default returns a defaulted GeneratorArgs. You may change the defaults -// before calling AddFlags. -func Default() *GeneratorArgs { - return &GeneratorArgs{ - OutputBase: DefaultSourceTree(), - GoHeaderFilePath: filepath.Join(DefaultSourceTree(), "k8s.io/gengo/boilerplate/boilerplate.go.txt"), - GeneratedBuildTag: "ignore_autogenerated", - GeneratedByCommentTemplate: "// Code generated by GENERATOR_NAME. DO NOT EDIT.", - defaultCommandLineFlags: true, - } -} - -// GeneratorArgs has arguments that are passed to generators. -type GeneratorArgs struct { - // Which directories to parse. - InputDirs []string - - // Source tree to write results to. - OutputBase string - - // Package path within the source tree. - OutputPackagePath string - - // Output file name. - OutputFileBaseName string - - // Where to get copyright header text. - GoHeaderFilePath string - - // If GeneratedByCommentTemplate is set, generate a "Code generated by" comment - // below the bloilerplate, of the format defined by this string. - // Any instances of "GENERATOR_NAME" will be replaced with the name of the code generator. - GeneratedByCommentTemplate string - - // If true, only verify, don't write anything. - VerifyOnly bool - - // If true, include *_test.go files - IncludeTestFiles bool - - // GeneratedBuildTag is the tag used to identify code generated by execution - // of this type. Each generator should use a different tag, and different - // groups of generators (external API that depends on Kube generations) should - // keep tags distinct as well. - GeneratedBuildTag string - - // Any custom arguments go here - CustomArgs interface{} - - // If specified, trim the prefix from OutputPackagePath before writing files. - TrimPathPrefix string - - // Whether to use default command line flags - defaultCommandLineFlags bool -} - -// WithoutDefaultFlagParsing disables implicit addition of command line flags and parsing. -func (g *GeneratorArgs) WithoutDefaultFlagParsing() *GeneratorArgs { - g.defaultCommandLineFlags = false - return g -} - -func (g *GeneratorArgs) AddFlags(fs *pflag.FlagSet) { - fs.StringSliceVarP(&g.InputDirs, "input-dirs", "i", g.InputDirs, "Comma-separated list of import paths to get input types from.") - fs.StringVarP(&g.OutputBase, "output-base", "o", g.OutputBase, "Output base; defaults to $GOPATH/src/ or ./ if $GOPATH is not set.") - fs.StringVarP(&g.OutputPackagePath, "output-package", "p", g.OutputPackagePath, "Base package path.") - fs.StringVarP(&g.OutputFileBaseName, "output-file-base", "O", g.OutputFileBaseName, "Base name (without .go suffix) for output files.") - fs.StringVarP(&g.GoHeaderFilePath, "go-header-file", "h", g.GoHeaderFilePath, "File containing boilerplate header text. The string YEAR will be replaced with the current 4-digit year.") - fs.BoolVar(&g.VerifyOnly, "verify-only", g.VerifyOnly, "If true, only verify existing output, do not write anything.") - fs.StringVar(&g.GeneratedBuildTag, "build-tag", g.GeneratedBuildTag, "A Go build tag to use to identify files generated by this command. Should be unique.") - fs.StringVar(&g.TrimPathPrefix, "trim-path-prefix", g.TrimPathPrefix, "If set, trim the specified prefix from --output-package when generating files.") -} - -// LoadGoBoilerplate loads the boilerplate file passed to --go-header-file. -func (g *GeneratorArgs) LoadGoBoilerplate() ([]byte, error) { - b, err := ioutil.ReadFile(g.GoHeaderFilePath) - if err != nil { - return nil, err - } - b = bytes.Replace(b, []byte("YEAR"), []byte(strconv.Itoa(time.Now().UTC().Year())), -1) - - if g.GeneratedByCommentTemplate != "" { - if len(b) != 0 { - b = append(b, byte('\n')) - } - generatorName := path.Base(os.Args[0]) - generatedByComment := strings.Replace(g.GeneratedByCommentTemplate, "GENERATOR_NAME", generatorName, -1) - s := fmt.Sprintf("%s\n\n", generatedByComment) - b = append(b, []byte(s)...) - } - return b, nil -} - -// NewBuilder makes a new parser.Builder and populates it with the input -// directories. -func (g *GeneratorArgs) NewBuilder() (*parser.Builder, error) { - b := parser.New() - - // flag for including *_test.go - b.IncludeTestFiles = g.IncludeTestFiles - - // Ignore all auto-generated files. - b.AddBuildTags(g.GeneratedBuildTag) - - for _, d := range g.InputDirs { - var err error - if strings.HasSuffix(d, "/...") { - err = b.AddDirRecursive(strings.TrimSuffix(d, "/...")) - } else { - err = b.AddDir(d) - } - if err != nil { - return nil, fmt.Errorf("unable to add directory %q: %v", d, err) - } - } - return b, nil -} - -// InputIncludes returns true if the given package is a (sub) package of one of -// the InputDirs. -func (g *GeneratorArgs) InputIncludes(p *types.Package) bool { - for _, dir := range g.InputDirs { - d := dir - if strings.HasSuffix(d, "...") { - d = strings.TrimSuffix(d, "...") - } - if strings.HasPrefix(d, "./vendor/") { - d = strings.TrimPrefix(d, "./vendor/") - } - if strings.HasPrefix(p.Path, d) { - return true - } - } - return false -} - -// DefaultSourceTree returns the /src directory of the first entry in $GOPATH. -// If $GOPATH is empty, it returns "./". Useful as a default output location. -func DefaultSourceTree() string { - paths := strings.Split(os.Getenv("GOPATH"), string(filepath.ListSeparator)) - if len(paths) > 0 && len(paths[0]) > 0 { - return filepath.Join(paths[0], "src") - } - return "./" -} - -// Execute implements main(). -// If you don't need any non-default behavior, use as: -// args.Default().Execute(...) -func (g *GeneratorArgs) Execute(nameSystems namer.NameSystems, defaultSystem string, pkgs func(*generator.Context, *GeneratorArgs) generator.Packages) error { - if g.defaultCommandLineFlags { - g.AddFlags(pflag.CommandLine) - pflag.CommandLine.AddGoFlagSet(goflag.CommandLine) - pflag.Parse() - } - - b, err := g.NewBuilder() - if err != nil { - return fmt.Errorf("Failed making a parser: %v", err) - } - - // pass through the flag on whether to include *_test.go files - b.IncludeTestFiles = g.IncludeTestFiles - - c, err := generator.NewContext(b, nameSystems, defaultSystem) - if err != nil { - return fmt.Errorf("Failed making a context: %v", err) - } - - c.TrimPathPrefix = g.TrimPathPrefix - - c.Verify = g.VerifyOnly - packages := pkgs(c, g) - if err := c.ExecutePackages(g.OutputBase, packages); err != nil { - return fmt.Errorf("Failed executing generator: %v", err) - } - - return nil -} diff --git a/vendor/k8s.io/gengo/generator/default_generator.go b/vendor/k8s.io/gengo/generator/default_generator.go deleted file mode 100644 index f9476682148..00000000000 --- a/vendor/k8s.io/gengo/generator/default_generator.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 generator - -import ( - "io" - - "k8s.io/gengo/namer" - "k8s.io/gengo/types" -) - -const ( - GolangFileType = "golang" -) - -// DefaultGen implements a do-nothing Generator. -// -// It can be used to implement static content files. -type DefaultGen struct { - // OptionalName, if present, will be used for the generator's name, and - // the filename (with ".go" appended). - OptionalName string - - // OptionalBody, if present, will be used as the return from the "Init" - // method. This causes it to be static content for the entire file if - // no other generator touches the file. - OptionalBody []byte -} - -func (d DefaultGen) Name() string { return d.OptionalName } -func (d DefaultGen) Filter(*Context, *types.Type) bool { return true } -func (d DefaultGen) Namers(*Context) namer.NameSystems { return nil } -func (d DefaultGen) Imports(*Context) []string { return []string{} } -func (d DefaultGen) PackageVars(*Context) []string { return []string{} } -func (d DefaultGen) PackageConsts(*Context) []string { return []string{} } -func (d DefaultGen) GenerateType(*Context, *types.Type, io.Writer) error { return nil } -func (d DefaultGen) Filename() string { return d.OptionalName + ".go" } -func (d DefaultGen) FileType() string { return GolangFileType } -func (d DefaultGen) Finalize(*Context, io.Writer) error { return nil } - -func (d DefaultGen) Init(c *Context, w io.Writer) error { - _, err := w.Write(d.OptionalBody) - return err -} - -var ( - _ = Generator(DefaultGen{}) -) diff --git a/vendor/k8s.io/gengo/generator/default_package.go b/vendor/k8s.io/gengo/generator/default_package.go deleted file mode 100644 index dcf0883235d..00000000000 --- a/vendor/k8s.io/gengo/generator/default_package.go +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 generator - -import ( - "k8s.io/gengo/types" -) - -// DefaultPackage contains a default implementation of Package. -type DefaultPackage struct { - // Short name of package, used in the "package xxxx" line. - PackageName string - // Import path of the package, and the location on disk of the package. - PackagePath string - // The location of the package on disk. - Source string - - // Emitted at the top of every file. - HeaderText []byte - - // Emitted only for a "doc.go" file; appended to the HeaderText for - // that file. - PackageDocumentation []byte - - // If non-nil, will be called on "Generators"; otherwise, the static - // list will be used. So you should set only one of these two fields. - GeneratorFunc func(*Context) []Generator - GeneratorList []Generator - - // Optional; filters the types exposed to the generators. - FilterFunc func(*Context, *types.Type) bool -} - -func (d *DefaultPackage) Name() string { return d.PackageName } -func (d *DefaultPackage) Path() string { return d.PackagePath } -func (d *DefaultPackage) SourcePath() string { return d.Source } - -func (d *DefaultPackage) Filter(c *Context, t *types.Type) bool { - if d.FilterFunc != nil { - return d.FilterFunc(c, t) - } - return true -} - -func (d *DefaultPackage) Generators(c *Context) []Generator { - if d.GeneratorFunc != nil { - return d.GeneratorFunc(c) - } - return d.GeneratorList -} - -func (d *DefaultPackage) Header(filename string) []byte { - if filename == "doc.go" { - return append(d.HeaderText, d.PackageDocumentation...) - } - return d.HeaderText -} - -var ( - _ = Package(&DefaultPackage{}) -) diff --git a/vendor/k8s.io/gengo/generator/doc.go b/vendor/k8s.io/gengo/generator/doc.go deleted file mode 100644 index d8e12534a44..00000000000 --- a/vendor/k8s.io/gengo/generator/doc.go +++ /dev/null @@ -1,31 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 generator defines an interface for code generators to implement. -// -// To use this package, you'll implement the "Package" and "Generator" -// interfaces; you'll call NewContext to load up the types you want to work -// with, and then you'll call one or more of the Execute methods. See the -// interface definitions for explanations. All output will have gofmt called on -// it automatically, so you do not need to worry about generating correct -// indentation. -// -// This package also exposes SnippetWriter. SnippetWriter reduces to a minimum -// the boilerplate involved in setting up a template from go's text/template -// package. Additionally, all naming systems in the Context will be added as -// functions to the parsed template, so that they can be called directly from -// your templates! -package generator // import "k8s.io/gengo/generator" diff --git a/vendor/k8s.io/gengo/generator/error_tracker.go b/vendor/k8s.io/gengo/generator/error_tracker.go deleted file mode 100644 index 964dae37ba5..00000000000 --- a/vendor/k8s.io/gengo/generator/error_tracker.go +++ /dev/null @@ -1,50 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 generator - -import ( - "io" -) - -// ErrorTracker tracks errors to the underlying writer, so that you can ignore -// them until you're ready to return. -type ErrorTracker struct { - io.Writer - err error -} - -// NewErrorTracker makes a new error tracker; note that it implements io.Writer. -func NewErrorTracker(w io.Writer) *ErrorTracker { - return &ErrorTracker{Writer: w} -} - -// Write intercepts calls to Write. -func (et *ErrorTracker) Write(p []byte) (n int, err error) { - if et.err != nil { - return 0, et.err - } - n, err = et.Writer.Write(p) - if err != nil { - et.err = err - } - return n, err -} - -// Error returns nil if no error has occurred, otherwise it returns the error. -func (et *ErrorTracker) Error() error { - return et.err -} diff --git a/vendor/k8s.io/gengo/generator/execute.go b/vendor/k8s.io/gengo/generator/execute.go deleted file mode 100644 index f096741bc86..00000000000 --- a/vendor/k8s.io/gengo/generator/execute.go +++ /dev/null @@ -1,329 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 generator - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - - "golang.org/x/tools/imports" - "k8s.io/gengo/namer" - "k8s.io/gengo/types" - - "k8s.io/klog/v2" -) - -func errs2strings(errors []error) []string { - strs := make([]string, len(errors)) - for i := range errors { - strs[i] = errors[i].Error() - } - return strs -} - -// ExecutePackages runs the generators for every package in 'packages'. 'outDir' -// is the base directory in which to place all the generated packages; it -// should be a physical path on disk, not an import path. e.g.: -// /path/to/home/path/to/gopath/src/ -// Each package has its import path already, this will be appended to 'outDir'. -func (c *Context) ExecutePackages(outDir string, packages Packages) error { - var errors []error - for _, p := range packages { - if err := c.ExecutePackage(outDir, p); err != nil { - errors = append(errors, err) - } - } - if len(errors) > 0 { - return fmt.Errorf("some packages had errors:\n%v\n", strings.Join(errs2strings(errors), "\n")) - } - return nil -} - -type DefaultFileType struct { - Format func([]byte) ([]byte, error) - Assemble func(io.Writer, *File) -} - -func (ft DefaultFileType) AssembleFile(f *File, pathname string) error { - klog.V(5).Infof("Assembling file %q", pathname) - destFile, err := os.Create(pathname) - if err != nil { - return err - } - defer destFile.Close() - - b := &bytes.Buffer{} - et := NewErrorTracker(b) - ft.Assemble(et, f) - if et.Error() != nil { - return et.Error() - } - if formatted, err := ft.Format(b.Bytes()); err != nil { - err = fmt.Errorf("unable to format file %q (%v).", pathname, err) - // Write the file anyway, so they can see what's going wrong and fix the generator. - if _, err2 := destFile.Write(b.Bytes()); err2 != nil { - return err2 - } - return err - } else { - _, err = destFile.Write(formatted) - return err - } -} - -func (ft DefaultFileType) VerifyFile(f *File, pathname string) error { - klog.V(5).Infof("Verifying file %q", pathname) - friendlyName := filepath.Join(f.PackageName, f.Name) - b := &bytes.Buffer{} - et := NewErrorTracker(b) - ft.Assemble(et, f) - if et.Error() != nil { - return et.Error() - } - formatted, err := ft.Format(b.Bytes()) - if err != nil { - return fmt.Errorf("unable to format the output for %q: %v", friendlyName, err) - } - existing, err := ioutil.ReadFile(pathname) - if err != nil { - return fmt.Errorf("unable to read file %q for comparison: %v", friendlyName, err) - } - if bytes.Compare(formatted, existing) == 0 { - return nil - } - // Be nice and find the first place where they differ - i := 0 - for i < len(formatted) && i < len(existing) && formatted[i] == existing[i] { - i++ - } - eDiff, fDiff := existing[i:], formatted[i:] - if len(eDiff) > 100 { - eDiff = eDiff[:100] - } - if len(fDiff) > 100 { - fDiff = fDiff[:100] - } - return fmt.Errorf("output for %q differs; first existing/expected diff: \n %q\n %q", friendlyName, string(eDiff), string(fDiff)) -} - -func assembleGolangFile(w io.Writer, f *File) { - w.Write(f.Header) - fmt.Fprintf(w, "package %v\n\n", f.PackageName) - - if len(f.Imports) > 0 { - fmt.Fprint(w, "import (\n") - for i := range f.Imports { - if strings.Contains(i, "\"") { - // they included quotes, or are using the - // `name "path/to/pkg"` format. - fmt.Fprintf(w, "\t%s\n", i) - } else { - fmt.Fprintf(w, "\t%q\n", i) - } - } - fmt.Fprint(w, ")\n\n") - } - - if f.Vars.Len() > 0 { - fmt.Fprint(w, "var (\n") - w.Write(f.Vars.Bytes()) - fmt.Fprint(w, ")\n\n") - } - - if f.Consts.Len() > 0 { - fmt.Fprint(w, "const (\n") - w.Write(f.Consts.Bytes()) - fmt.Fprint(w, ")\n\n") - } - - w.Write(f.Body.Bytes()) -} - -func importsWrapper(src []byte) ([]byte, error) { - return imports.Process("", src, nil) -} - -func NewGolangFile() *DefaultFileType { - return &DefaultFileType{ - Format: importsWrapper, - Assemble: assembleGolangFile, - } -} - -// format should be one line only, and not end with \n. -func addIndentHeaderComment(b *bytes.Buffer, format string, args ...interface{}) { - if b.Len() > 0 { - fmt.Fprintf(b, "\n// "+format+"\n", args...) - } else { - fmt.Fprintf(b, "// "+format+"\n", args...) - } -} - -func (c *Context) filteredBy(f func(*Context, *types.Type) bool) *Context { - c2 := *c - c2.Order = []*types.Type{} - for _, t := range c.Order { - if f(c, t) { - c2.Order = append(c2.Order, t) - } - } - return &c2 -} - -// make a new context; inheret c.Namers, but add on 'namers'. In case of a name -// collision, the namer in 'namers' wins. -func (c *Context) addNameSystems(namers namer.NameSystems) *Context { - if namers == nil { - return c - } - c2 := *c - // Copy the existing name systems so we don't corrupt a parent context - c2.Namers = namer.NameSystems{} - for k, v := range c.Namers { - c2.Namers[k] = v - } - - for name, namer := range namers { - c2.Namers[name] = namer - } - return &c2 -} - -// ExecutePackage executes a single package. 'outDir' is the base directory in -// which to place the package; it should be a physical path on disk, not an -// import path. e.g.: '/path/to/home/path/to/gopath/src/' The package knows its -// import path already, this will be appended to 'outDir'. -func (c *Context) ExecutePackage(outDir string, p Package) error { - path := filepath.Join(outDir, p.Path()) - - // When working outside of GOPATH, we typically won't want to generate the - // full path for a package. For example, if our current project's root/base - // package is github.com/foo/bar, outDir=., p.Path()=github.com/foo/bar/generated, - // then we really want to be writing files to ./generated, not ./github.com/foo/bar/generated. - // The following will trim a path prefix (github.com/foo/bar) from p.Path() to arrive at - // a relative path that works with projects not in GOPATH. - if c.TrimPathPrefix != "" { - separator := string(filepath.Separator) - if !strings.HasSuffix(c.TrimPathPrefix, separator) { - c.TrimPathPrefix += separator - } - - path = strings.TrimPrefix(path, c.TrimPathPrefix) - } - klog.V(5).Infof("Processing package %q, disk location %q", p.Name(), path) - // Filter out any types the *package* doesn't care about. - packageContext := c.filteredBy(p.Filter) - os.MkdirAll(path, 0755) - files := map[string]*File{} - for _, g := range p.Generators(packageContext) { - // Filter out types the *generator* doesn't care about. - genContext := packageContext.filteredBy(g.Filter) - // Now add any extra name systems defined by this generator - genContext = genContext.addNameSystems(g.Namers(genContext)) - - fileType := g.FileType() - if len(fileType) == 0 { - return fmt.Errorf("generator %q must specify a file type", g.Name()) - } - f := files[g.Filename()] - if f == nil { - // This is the first generator to reference this file, so start it. - f = &File{ - Name: g.Filename(), - FileType: fileType, - PackageName: p.Name(), - PackagePath: p.Path(), - PackageSourcePath: p.SourcePath(), - Header: p.Header(g.Filename()), - Imports: map[string]struct{}{}, - } - files[f.Name] = f - } else { - if f.FileType != g.FileType() { - return fmt.Errorf("file %q already has type %q, but generator %q wants to use type %q", f.Name, f.FileType, g.Name(), g.FileType()) - } - } - - if vars := g.PackageVars(genContext); len(vars) > 0 { - addIndentHeaderComment(&f.Vars, "Package-wide variables from generator %q.", g.Name()) - for _, v := range vars { - if _, err := fmt.Fprintf(&f.Vars, "%s\n", v); err != nil { - return err - } - } - } - if consts := g.PackageConsts(genContext); len(consts) > 0 { - addIndentHeaderComment(&f.Consts, "Package-wide consts from generator %q.", g.Name()) - for _, v := range consts { - if _, err := fmt.Fprintf(&f.Consts, "%s\n", v); err != nil { - return err - } - } - } - if err := genContext.executeBody(&f.Body, g); err != nil { - return err - } - if imports := g.Imports(genContext); len(imports) > 0 { - for _, i := range imports { - f.Imports[i] = struct{}{} - } - } - } - - var errors []error - for _, f := range files { - finalPath := filepath.Join(path, f.Name) - assembler, ok := c.FileTypes[f.FileType] - if !ok { - return fmt.Errorf("the file type %q registered for file %q does not exist in the context", f.FileType, f.Name) - } - var err error - if c.Verify { - err = assembler.VerifyFile(f, finalPath) - } else { - err = assembler.AssembleFile(f, finalPath) - } - if err != nil { - errors = append(errors, err) - } - } - if len(errors) > 0 { - return fmt.Errorf("errors in package %q:\n%v\n", p.Path(), strings.Join(errs2strings(errors), "\n")) - } - return nil -} - -func (c *Context) executeBody(w io.Writer, generator Generator) error { - et := NewErrorTracker(w) - if err := generator.Init(c, et); err != nil { - return err - } - for _, t := range c.Order { - if err := generator.GenerateType(c, t, et); err != nil { - return err - } - } - if err := generator.Finalize(c, et); err != nil { - return err - } - return et.Error() -} diff --git a/vendor/k8s.io/gengo/generator/generator.go b/vendor/k8s.io/gengo/generator/generator.go deleted file mode 100644 index 5614ae3b322..00000000000 --- a/vendor/k8s.io/gengo/generator/generator.go +++ /dev/null @@ -1,259 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 generator - -import ( - "bytes" - "io" - - "k8s.io/gengo/namer" - "k8s.io/gengo/parser" - "k8s.io/gengo/types" -) - -// Package contains the contract for generating a package. -type Package interface { - // Name returns the package short name. - Name() string - // Path returns the package import path. - Path() string - // SourcePath returns the location of the package on disk. - SourcePath() string - - // Filter should return true if this package cares about this type. - // Otherwise, this type will be omitted from the type ordering for - // this package. - Filter(*Context, *types.Type) bool - - // Header should return a header for the file, including comment markers. - // Useful for copyright notices and doc strings. Include an - // autogeneration notice! Do not include the "package x" line. - Header(filename string) []byte - - // Generators returns the list of generators for this package. It is - // allowed for more than one generator to write to the same file. - // A Context is passed in case the list of generators depends on the - // input types. - Generators(*Context) []Generator -} - -type File struct { - Name string - FileType string - PackageName string - Header []byte - PackagePath string - PackageSourcePath string - Imports map[string]struct{} - Vars bytes.Buffer - Consts bytes.Buffer - Body bytes.Buffer -} - -type FileType interface { - AssembleFile(f *File, path string) error - VerifyFile(f *File, path string) error -} - -// Packages is a list of packages to generate. -type Packages []Package - -// Generator is the contract for anything that wants to do auto-generation. -// It's expected that the io.Writers passed to the below functions will be -// ErrorTrackers; this allows implementations to not check for io errors, -// making more readable code. -// -// The call order for the functions that take a Context is: -// 1. Filter() // Subsequent calls see only types that pass this. -// 2. Namers() // Subsequent calls see the namers provided by this. -// 3. PackageVars() -// 4. PackageConsts() -// 5. Init() -// 6. GenerateType() // Called N times, once per type in the context's Order. -// 7. Imports() -// -// You may have multiple generators for the same file. -type Generator interface { - // The name of this generator. Will be included in generated comments. - Name() string - - // Filter should return true if this generator cares about this type. - // (otherwise, GenerateType will not be called.) - // - // Filter is called before any of the generator's other functions; - // subsequent calls will get a context with only the types that passed - // this filter. - Filter(*Context, *types.Type) bool - - // If this generator needs special namers, return them here. These will - // override the original namers in the context if there is a collision. - // You may return nil if you don't need special names. These names will - // be available in the context passed to the rest of the generator's - // functions. - // - // A use case for this is to return a namer that tracks imports. - Namers(*Context) namer.NameSystems - - // Init should write an init function, and any other content that's not - // generated per-type. (It's not intended for generator specific - // initialization! Do that when your Package constructs the - // Generators.) - Init(*Context, io.Writer) error - - // Finalize should write finish up functions, and any other content that's not - // generated per-type. - Finalize(*Context, io.Writer) error - - // PackageVars should emit an array of variable lines. They will be - // placed in a var ( ... ) block. There's no need to include a leading - // \t or trailing \n. - PackageVars(*Context) []string - - // PackageConsts should emit an array of constant lines. They will be - // placed in a const ( ... ) block. There's no need to include a leading - // \t or trailing \n. - PackageConsts(*Context) []string - - // GenerateType should emit the code for a particular type. - GenerateType(*Context, *types.Type, io.Writer) error - - // Imports should return a list of necessary imports. They will be - // formatted correctly. You do not need to include quotation marks, - // return only the package name; alternatively, you can also return - // imports in the format `name "path/to/pkg"`. Imports will be called - // after Init, PackageVars, PackageConsts, and GenerateType, to allow - // you to keep track of what imports you actually need. - Imports(*Context) []string - - // Preferred file name of this generator, not including a path. It is - // allowed for multiple generators to use the same filename, but it's - // up to you to make sure they don't have colliding import names. - // TODO: provide per-file import tracking, removing the requirement - // that generators coordinate.. - Filename() string - - // A registered file type in the context to generate this file with. If - // the FileType is not found in the context, execution will stop. - FileType() string -} - -// Context is global context for individual generators to consume. -type Context struct { - // A map from the naming system to the names for that system. E.g., you - // might have public names and several private naming systems. - Namers namer.NameSystems - - // All the types, in case you want to look up something. - Universe types.Universe - - // Incoming imports, i.e. packages importing the given package. - incomingImports map[string][]string - - // Incoming transitive imports, i.e. the transitive closure of IncomingImports - incomingTransitiveImports map[string][]string - - // All the user-specified packages. This is after recursive expansion. - Inputs []string - - // The canonical ordering of the types (will be filtered by both the - // Package's and Generator's Filter methods). - Order []*types.Type - - // A set of types this context can process. If this is empty or nil, - // the default "golang" filetype will be provided. - FileTypes map[string]FileType - - // If true, Execute* calls will just verify that the existing output is - // correct. (You may set this after calling NewContext.) - Verify bool - - // Allows generators to add packages at runtime. - builder *parser.Builder - - // If specified, trim the prefix from a package's path before writing files. - TrimPathPrefix string -} - -// NewContext generates a context from the given builder, naming systems, and -// the naming system you wish to construct the canonical ordering from. -func NewContext(b *parser.Builder, nameSystems namer.NameSystems, canonicalOrderName string) (*Context, error) { - universe, err := b.FindTypes() - if err != nil { - return nil, err - } - - c := &Context{ - Namers: namer.NameSystems{}, - Universe: universe, - Inputs: b.FindPackages(), - FileTypes: map[string]FileType{ - GolangFileType: NewGolangFile(), - }, - builder: b, - } - - for name, systemNamer := range nameSystems { - c.Namers[name] = systemNamer - if name == canonicalOrderName { - orderer := namer.Orderer{Namer: systemNamer} - c.Order = orderer.OrderUniverse(universe) - } - } - return c, nil -} - -// IncomingImports returns the incoming imports for each package. The map is lazily computed. -func (ctxt *Context) IncomingImports() map[string][]string { - if ctxt.incomingImports == nil { - incoming := map[string][]string{} - for _, pkg := range ctxt.Universe { - for imp := range pkg.Imports { - incoming[imp] = append(incoming[imp], pkg.Path) - } - } - ctxt.incomingImports = incoming - } - return ctxt.incomingImports -} - -// TransitiveIncomingImports returns the transitive closure of the incoming imports for each package. -// The map is lazily computed. -func (ctxt *Context) TransitiveIncomingImports() map[string][]string { - if ctxt.incomingTransitiveImports == nil { - ctxt.incomingTransitiveImports = transitiveClosure(ctxt.IncomingImports()) - } - return ctxt.incomingTransitiveImports -} - -// AddDir adds a Go package to the context. The specified path must be a single -// go package import path. GOPATH, GOROOT, and the location of your go binary -// (`which go`) will all be searched, in the normal Go fashion. -// Deprecated. Please use AddDirectory. -func (ctxt *Context) AddDir(path string) error { - ctxt.incomingImports = nil - ctxt.incomingTransitiveImports = nil - return ctxt.builder.AddDirTo(path, &ctxt.Universe) -} - -// AddDirectory adds a Go package to the context. The specified path must be a -// single go package import path. GOPATH, GOROOT, and the location of your go -// binary (`which go`) will all be searched, in the normal Go fashion. -func (ctxt *Context) AddDirectory(path string) (*types.Package, error) { - ctxt.incomingImports = nil - ctxt.incomingTransitiveImports = nil - return ctxt.builder.AddDirectoryTo(path, &ctxt.Universe) -} diff --git a/vendor/k8s.io/gengo/generator/import_tracker.go b/vendor/k8s.io/gengo/generator/import_tracker.go deleted file mode 100644 index 60c899ac464..00000000000 --- a/vendor/k8s.io/gengo/generator/import_tracker.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 generator - -import ( - "go/token" - "strings" - - "k8s.io/klog/v2" - - "k8s.io/gengo/namer" - "k8s.io/gengo/types" -) - -func NewImportTracker(typesToAdd ...*types.Type) namer.ImportTracker { - tracker := namer.NewDefaultImportTracker(types.Name{}) - tracker.IsInvalidType = func(*types.Type) bool { return false } - tracker.LocalName = func(name types.Name) string { return golangTrackerLocalName(&tracker, name) } - tracker.PrintImport = func(path, name string) string { return name + " \"" + path + "\"" } - - tracker.AddTypes(typesToAdd...) - return &tracker - -} - -func golangTrackerLocalName(tracker namer.ImportTracker, t types.Name) string { - path := t.Package - - // Using backslashes in package names causes gengo to produce Go code which - // will not compile with the gc compiler. See the comment on GoSeperator. - if strings.ContainsRune(path, '\\') { - klog.Warningf("Warning: backslash used in import path '%v', this is unsupported.\n", path) - } - - dirs := strings.Split(path, namer.GoSeperator) - for n := len(dirs) - 1; n >= 0; n-- { - // follow kube convention of not having anything between directory names - name := strings.Join(dirs[n:], "") - name = strings.Replace(name, "_", "", -1) - // These characters commonly appear in import paths for go - // packages, but aren't legal go names. So we'll sanitize. - name = strings.Replace(name, ".", "", -1) - name = strings.Replace(name, "-", "", -1) - if _, found := tracker.PathOf(name); found { - // This name collides with some other package - continue - } - - // If the import name is a Go keyword, prefix with an underscore. - if token.Lookup(name).IsKeyword() { - name = "_" + name - } - return name - } - panic("can't find import for " + path) -} diff --git a/vendor/k8s.io/gengo/generator/snippet_writer.go b/vendor/k8s.io/gengo/generator/snippet_writer.go deleted file mode 100644 index 590775ff228..00000000000 --- a/vendor/k8s.io/gengo/generator/snippet_writer.go +++ /dev/null @@ -1,154 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 generator - -import ( - "fmt" - "io" - "runtime" - "text/template" -) - -// SnippetWriter is an attempt to make the template library usable. -// Methods are chainable, and you don't have to check Error() until you're all -// done. -type SnippetWriter struct { - w io.Writer - context *Context - // Left & right delimiters. text/template defaults to "{{" and "}}" - // which is totally unusable for go code based templates. - left, right string - funcMap template.FuncMap - err error -} - -// w is the destination; left and right are the delimiters; @ and $ are both -// reasonable choices. -// -// c is used to make a function for every naming system, to which you can pass -// a type and get the corresponding name. -func NewSnippetWriter(w io.Writer, c *Context, left, right string) *SnippetWriter { - sw := &SnippetWriter{ - w: w, - context: c, - left: left, - right: right, - funcMap: template.FuncMap{}, - } - for name, namer := range c.Namers { - sw.funcMap[name] = namer.Name - } - return sw -} - -// Do parses format and runs args through it. You can have arbitrary logic in -// the format (see the text/template documentation), but consider running many -// short templates with ordinary go logic in between--this may be more -// readable. Do is chainable. Any error causes every other call to do to be -// ignored, and the error will be returned by Error(). So you can check it just -// once, at the end of your function. -// -// 'args' can be quite literally anything; read the text/template documentation -// for details. Maps and structs work particularly nicely. Conveniently, the -// types package is designed to have structs that are easily referencable from -// the template language. -// -// Example: -// -// sw := generator.NewSnippetWriter(outBuffer, context, "$", "$") -// sw.Do(`The public type name is: $.type|public$`, map[string]interface{}{"type": t}) -// return sw.Error() -// -// Where: -// * "$" starts a template directive -// * "." references the entire thing passed as args -// * "type" therefore sees a map and looks up the key "type" -// * "|" means "pass the thing on the left to the thing on the right" -// * "public" is the name of a naming system, so the SnippetWriter has given -// the template a function called "public" that takes a *types.Type and -// returns the naming system's name. E.g., if the type is "string" this might -// return "String". -// * the second "$" ends the template directive. -// -// The map is actually not necessary. The below does the same thing: -// -// sw.Do(`The public type name is: $.|public$`, t) -// -// You may or may not find it more readable to use the map with a descriptive -// key, but if you want to pass more than one arg, the map or a custom struct -// becomes a requirement. You can do arbitrary logic inside these templates, -// but you should consider doing the logic in go and stitching them together -// for the sake of your readers. -// -// TODO: Change Do() to optionally take a list of pairs of parameters (key, value) -// and have it construct a combined map with that and args. -func (s *SnippetWriter) Do(format string, args interface{}) *SnippetWriter { - if s.err != nil { - return s - } - // Name the template by source file:line so it can be found when - // there's an error. - _, file, line, _ := runtime.Caller(1) - tmpl, err := template. - New(fmt.Sprintf("%s:%d", file, line)). - Delims(s.left, s.right). - Funcs(s.funcMap). - Parse(format) - if err != nil { - s.err = err - return s - } - err = tmpl.Execute(s.w, args) - if err != nil { - s.err = err - } - return s -} - -// Args exists to make it convenient to construct arguments for -// SnippetWriter.Do. -type Args map[interface{}]interface{} - -// With makes a copy of a and adds the given key, value pair. -func (a Args) With(key, value interface{}) Args { - a2 := Args{key: value} - for k, v := range a { - a2[k] = v - } - return a2 -} - -// WithArgs makes a copy of a and adds the given arguments. -func (a Args) WithArgs(rhs Args) Args { - a2 := Args{} - for k, v := range rhs { - a2[k] = v - } - for k, v := range a { - a2[k] = v - } - return a2 -} - -func (s *SnippetWriter) Out() io.Writer { - return s.w -} - -// Error returns any encountered error. -func (s *SnippetWriter) Error() error { - return s.err -} diff --git a/vendor/k8s.io/gengo/generator/transitive_closure.go b/vendor/k8s.io/gengo/generator/transitive_closure.go deleted file mode 100644 index 385a49fce31..00000000000 --- a/vendor/k8s.io/gengo/generator/transitive_closure.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 generator - -import "sort" - -type edge struct { - from string - to string -} - -func transitiveClosure(in map[string][]string) map[string][]string { - adj := make(map[edge]bool) - imports := make(map[string]struct{}) - for from, tos := range in { - for _, to := range tos { - adj[edge{from, to}] = true - imports[to] = struct{}{} - } - } - - // Warshal's algorithm - for k := range in { - for i := range in { - if !adj[edge{i, k}] { - continue - } - for j := range imports { - if adj[edge{i, j}] { - continue - } - if adj[edge{k, j}] { - adj[edge{i, j}] = true - } - } - } - } - - out := make(map[string][]string, len(in)) - for i := range in { - for j := range imports { - if adj[edge{i, j}] { - out[i] = append(out[i], j) - } - } - - sort.Strings(out[i]) - } - - return out -} diff --git a/vendor/k8s.io/gengo/namer/doc.go b/vendor/k8s.io/gengo/namer/doc.go deleted file mode 100644 index 8a44ea99597..00000000000 --- a/vendor/k8s.io/gengo/namer/doc.go +++ /dev/null @@ -1,31 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 namer has support for making different type naming systems. -// -// This is because sometimes you want to refer to the literal type, sometimes -// you want to make a name for the thing you're generating, and you want to -// make the name based on the type. For example, if you have `type foo string`, -// you want to be able to generate something like `func FooPrinter(f *foo) { -// Print(string(*f)) }`; that is, you want to refer to a public name, a literal -// name, and the underlying literal name. -// -// This package supports the idea of a "Namer" and a set of "NameSystems" to -// support these use cases. -// -// Additionally, a "RawNamer" can optionally keep track of what needs to be -// imported. -package namer // import "k8s.io/gengo/namer" diff --git a/vendor/k8s.io/gengo/namer/import_tracker.go b/vendor/k8s.io/gengo/namer/import_tracker.go deleted file mode 100644 index 37094b2deb5..00000000000 --- a/vendor/k8s.io/gengo/namer/import_tracker.go +++ /dev/null @@ -1,112 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 namer - -import ( - "sort" - - "k8s.io/gengo/types" -) - -// ImportTracker may be passed to a namer.RawNamer, to track the imports needed -// for the types it names. -// -// TODO: pay attention to the package name (instead of renaming every package). -type DefaultImportTracker struct { - pathToName map[string]string - // forbidden names are in here. (e.g. "go" is a directory in which - // there is code, but "go" is not a legal name for a package, so we put - // it here to prevent us from naming any package "go") - nameToPath map[string]string - local types.Name - - // Returns true if a given types is an invalid type and should be ignored. - IsInvalidType func(*types.Type) bool - // Returns the final local name for the given name - LocalName func(types.Name) string - // Returns the "import" line for a given (path, name). - PrintImport func(string, string) string -} - -func NewDefaultImportTracker(local types.Name) DefaultImportTracker { - return DefaultImportTracker{ - pathToName: map[string]string{}, - nameToPath: map[string]string{}, - local: local, - } -} - -func (tracker *DefaultImportTracker) AddTypes(types ...*types.Type) { - for _, t := range types { - tracker.AddType(t) - } -} -func (tracker *DefaultImportTracker) AddType(t *types.Type) { - if tracker.local.Package == t.Name.Package { - return - } - - if tracker.IsInvalidType(t) { - if t.Kind == types.Builtin { - return - } - if _, ok := tracker.nameToPath[t.Name.Package]; !ok { - tracker.nameToPath[t.Name.Package] = "" - } - return - } - - if len(t.Name.Package) == 0 { - return - } - path := t.Name.Path - if len(path) == 0 { - path = t.Name.Package - } - if _, ok := tracker.pathToName[path]; ok { - return - } - name := tracker.LocalName(t.Name) - tracker.nameToPath[name] = path - tracker.pathToName[path] = name -} - -func (tracker *DefaultImportTracker) ImportLines() []string { - importPaths := []string{} - for path := range tracker.pathToName { - importPaths = append(importPaths, path) - } - sort.Sort(sort.StringSlice(importPaths)) - out := []string{} - for _, path := range importPaths { - out = append(out, tracker.PrintImport(path, tracker.pathToName[path])) - } - return out -} - -// LocalNameOf returns the name you would use to refer to the package at the -// specified path within the body of a file. -func (tracker *DefaultImportTracker) LocalNameOf(path string) string { - return tracker.pathToName[path] -} - -// PathOf returns the path that a given localName is referring to within the -// body of a file. -func (tracker *DefaultImportTracker) PathOf(localName string) (string, bool) { - name, ok := tracker.nameToPath[localName] - return name, ok -} diff --git a/vendor/k8s.io/gengo/namer/namer.go b/vendor/k8s.io/gengo/namer/namer.go deleted file mode 100644 index 6feb2d0c464..00000000000 --- a/vendor/k8s.io/gengo/namer/namer.go +++ /dev/null @@ -1,394 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 namer - -import ( - "fmt" - "path/filepath" - "strconv" - "strings" - - "k8s.io/gengo/types" -) - -const ( - // GoSeperator is used to split go import paths. - // Forward slash is used instead of filepath.Seperator because it is the - // only universally-accepted path delimiter and the only delimiter not - // potentially forbidden by Go compilers. (In particular gc does not allow - // the use of backslashes in import paths.) - // See https://golang.org/ref/spec#Import_declarations. - // See also https://github.com/kubernetes/gengo/issues/83#issuecomment-367040772. - GoSeperator = "/" -) - -// Returns whether a name is a private Go name. -func IsPrivateGoName(name string) bool { - return len(name) == 0 || strings.ToLower(name[:1]) == name[:1] -} - -// NewPublicNamer is a helper function that returns a namer that makes -// CamelCase names. See the NameStrategy struct for an explanation of the -// arguments to this constructor. -func NewPublicNamer(prependPackageNames int, ignoreWords ...string) *NameStrategy { - n := &NameStrategy{ - Join: Joiner(IC, IC), - IgnoreWords: map[string]bool{}, - PrependPackageNames: prependPackageNames, - } - for _, w := range ignoreWords { - n.IgnoreWords[w] = true - } - return n -} - -// NewPrivateNamer is a helper function that returns a namer that makes -// camelCase names. See the NameStrategy struct for an explanation of the -// arguments to this constructor. -func NewPrivateNamer(prependPackageNames int, ignoreWords ...string) *NameStrategy { - n := &NameStrategy{ - Join: Joiner(IL, IC), - IgnoreWords: map[string]bool{}, - PrependPackageNames: prependPackageNames, - } - for _, w := range ignoreWords { - n.IgnoreWords[w] = true - } - return n -} - -// NewRawNamer will return a Namer that makes a name by which you would -// directly refer to a type, optionally keeping track of the import paths -// necessary to reference the names it provides. Tracker may be nil. -// The 'pkg' is the full package name, in which the Namer is used - all -// types from that package will be referenced by just type name without -// referencing the package. -// -// For example, if the type is map[string]int, a raw namer will literally -// return "map[string]int". -// -// Or if the type, in package foo, is "type Bar struct { ... }", then the raw -// namer will return "foo.Bar" as the name of the type, and if 'tracker' was -// not nil, will record that package foo needs to be imported. -func NewRawNamer(pkg string, tracker ImportTracker) *rawNamer { - return &rawNamer{pkg: pkg, tracker: tracker} -} - -// Names is a map from Type to name, as defined by some Namer. -type Names map[*types.Type]string - -// Namer takes a type, and assigns a name. -// -// The purpose of this complexity is so that you can assign coherent -// side-by-side systems of names for the types. For example, you might want a -// public interface, a private implementation struct, and also to reference -// literally the type name. -// -// Note that it is safe to call your own Name() function recursively to find -// the names of keys, elements, etc. This is because anonymous types can't have -// cycles in their names, and named types don't require the sort of recursion -// that would be problematic. -type Namer interface { - Name(*types.Type) string -} - -// NameSystems is a map of a system name to a namer for that system. -type NameSystems map[string]Namer - -// NameStrategy is a general Namer. The easiest way to use it is to copy the -// Public/PrivateNamer variables, and modify the members you wish to change. -// -// The Name method produces a name for the given type, of the forms: -// Anonymous types: -// Named types: -// -// In all cases, every part of the name is run through the capitalization -// functions. -// -// The IgnoreWords map can be set if you have directory names that are -// semantically meaningless for naming purposes, e.g. "proto". -// -// Prefix and Suffix can be used to disambiguate parallel systems of type -// names. For example, if you want to generate an interface and an -// implementation, you might want to suffix one with "Interface" and the other -// with "Implementation". Another common use-- if you want to generate private -// types, and one of your source types could be "string", you can't use the -// default lowercase private namer. You'll have to add a suffix or prefix. -type NameStrategy struct { - Prefix, Suffix string - Join func(pre string, parts []string, post string) string - - // Add non-meaningful package directory names here (e.g. "proto") and - // they will be ignored. - IgnoreWords map[string]bool - - // If > 0, prepend exactly that many package directory names (or as - // many as there are). Package names listed in "IgnoreWords" will be - // ignored. - // - // For example, if Ignore words lists "proto" and type Foo is in - // pkg/server/frobbing/proto, then a value of 1 will give a type name - // of FrobbingFoo, 2 gives ServerFrobbingFoo, etc. - PrependPackageNames int - - // A cache of names thus far assigned by this namer. - Names -} - -// IC ensures the first character is uppercase. -func IC(in string) string { - if in == "" { - return in - } - return strings.ToUpper(in[:1]) + in[1:] -} - -// IL ensures the first character is lowercase. -func IL(in string) string { - if in == "" { - return in - } - return strings.ToLower(in[:1]) + in[1:] -} - -// Joiner lets you specify functions that preprocess the various components of -// a name before joining them. You can construct e.g. camelCase or CamelCase or -// any other way of joining words. (See the IC and IL convenience functions.) -func Joiner(first, others func(string) string) func(pre string, in []string, post string) string { - return func(pre string, in []string, post string) string { - tmp := []string{others(pre)} - for i := range in { - tmp = append(tmp, others(in[i])) - } - tmp = append(tmp, others(post)) - return first(strings.Join(tmp, "")) - } -} - -func (ns *NameStrategy) removePrefixAndSuffix(s string) string { - // The join function may have changed capitalization. - lowerIn := strings.ToLower(s) - lowerP := strings.ToLower(ns.Prefix) - lowerS := strings.ToLower(ns.Suffix) - b, e := 0, len(s) - if strings.HasPrefix(lowerIn, lowerP) { - b = len(ns.Prefix) - } - if strings.HasSuffix(lowerIn, lowerS) { - e -= len(ns.Suffix) - } - return s[b:e] -} - -var ( - importPathNameSanitizer = strings.NewReplacer("-", "_", ".", "") -) - -// filters out unwanted directory names and sanitizes remaining names. -func (ns *NameStrategy) filterDirs(path string) []string { - allDirs := strings.Split(path, GoSeperator) - dirs := make([]string, 0, len(allDirs)) - for _, p := range allDirs { - if ns.IgnoreWords == nil || !ns.IgnoreWords[p] { - dirs = append(dirs, importPathNameSanitizer.Replace(p)) - } - } - return dirs -} - -// See the comment on NameStrategy. -func (ns *NameStrategy) Name(t *types.Type) string { - if ns.Names == nil { - ns.Names = Names{} - } - if s, ok := ns.Names[t]; ok { - return s - } - - if t.Name.Package != "" { - dirs := append(ns.filterDirs(t.Name.Package), t.Name.Name) - i := ns.PrependPackageNames + 1 - dn := len(dirs) - if i > dn { - i = dn - } - name := ns.Join(ns.Prefix, dirs[dn-i:], ns.Suffix) - ns.Names[t] = name - return name - } - - // Only anonymous types remain. - var name string - switch t.Kind { - case types.Builtin: - name = ns.Join(ns.Prefix, []string{t.Name.Name}, ns.Suffix) - case types.Map: - name = ns.Join(ns.Prefix, []string{ - "Map", - ns.removePrefixAndSuffix(ns.Name(t.Key)), - "To", - ns.removePrefixAndSuffix(ns.Name(t.Elem)), - }, ns.Suffix) - case types.Slice: - name = ns.Join(ns.Prefix, []string{ - "Slice", - ns.removePrefixAndSuffix(ns.Name(t.Elem)), - }, ns.Suffix) - case types.Array: - name = ns.Join(ns.Prefix, []string{ - "Array", - ns.removePrefixAndSuffix(fmt.Sprintf("%d", t.Len)), - ns.removePrefixAndSuffix(ns.Name(t.Elem)), - }, ns.Suffix) - case types.Pointer: - name = ns.Join(ns.Prefix, []string{ - "Pointer", - ns.removePrefixAndSuffix(ns.Name(t.Elem)), - }, ns.Suffix) - case types.Struct: - names := []string{"Struct"} - for _, m := range t.Members { - names = append(names, ns.removePrefixAndSuffix(ns.Name(m.Type))) - } - name = ns.Join(ns.Prefix, names, ns.Suffix) - case types.Chan: - name = ns.Join(ns.Prefix, []string{ - "Chan", - ns.removePrefixAndSuffix(ns.Name(t.Elem)), - }, ns.Suffix) - case types.Interface: - // TODO: add to name test - names := []string{"Interface"} - for _, m := range t.Methods { - // TODO: include function signature - names = append(names, m.Name.Name) - } - name = ns.Join(ns.Prefix, names, ns.Suffix) - case types.Func: - // TODO: add to name test - parts := []string{"Func"} - for _, pt := range t.Signature.Parameters { - parts = append(parts, ns.removePrefixAndSuffix(ns.Name(pt))) - } - parts = append(parts, "Returns") - for _, rt := range t.Signature.Results { - parts = append(parts, ns.removePrefixAndSuffix(ns.Name(rt))) - } - name = ns.Join(ns.Prefix, parts, ns.Suffix) - default: - name = "unnameable_" + string(t.Kind) - } - ns.Names[t] = name - return name -} - -// ImportTracker allows a raw namer to keep track of the packages needed for -// import. You can implement yourself or use the one in the generation package. -type ImportTracker interface { - AddType(*types.Type) - LocalNameOf(packagePath string) string - PathOf(localName string) (string, bool) - ImportLines() []string -} - -type rawNamer struct { - pkg string - tracker ImportTracker - Names -} - -// Name makes a name the way you'd write it to literally refer to type t, -// making ordinary assumptions about how you've imported t's package (or using -// r.tracker to specifically track the package imports). -func (r *rawNamer) Name(t *types.Type) string { - if r.Names == nil { - r.Names = Names{} - } - if name, ok := r.Names[t]; ok { - return name - } - if t.Name.Package != "" { - var name string - if r.tracker != nil { - r.tracker.AddType(t) - if t.Name.Package == r.pkg { - name = t.Name.Name - } else { - name = r.tracker.LocalNameOf(t.Name.Package) + "." + t.Name.Name - } - } else { - if t.Name.Package == r.pkg { - name = t.Name.Name - } else { - name = filepath.Base(t.Name.Package) + "." + t.Name.Name - } - } - r.Names[t] = name - return name - } - var name string - switch t.Kind { - case types.Builtin: - name = t.Name.Name - case types.Map: - name = "map[" + r.Name(t.Key) + "]" + r.Name(t.Elem) - case types.Slice: - name = "[]" + r.Name(t.Elem) - case types.Array: - l := strconv.Itoa(int(t.Len)) - name = "[" + l + "]" + r.Name(t.Elem) - case types.Pointer: - name = "*" + r.Name(t.Elem) - case types.Struct: - elems := []string{} - for _, m := range t.Members { - elems = append(elems, m.Name+" "+r.Name(m.Type)) - } - name = "struct{" + strings.Join(elems, "; ") + "}" - case types.Chan: - // TODO: include directionality - name = "chan " + r.Name(t.Elem) - case types.Interface: - // TODO: add to name test - elems := []string{} - for _, m := range t.Methods { - // TODO: include function signature - elems = append(elems, m.Name.Name) - } - name = "interface{" + strings.Join(elems, "; ") + "}" - case types.Func: - // TODO: add to name test - params := []string{} - for _, pt := range t.Signature.Parameters { - params = append(params, r.Name(pt)) - } - results := []string{} - for _, rt := range t.Signature.Results { - results = append(results, r.Name(rt)) - } - name = "func(" + strings.Join(params, ",") + ")" - if len(results) == 1 { - name += " " + results[0] - } else if len(results) > 1 { - name += " (" + strings.Join(results, ",") + ")" - } - default: - name = "unnameable_" + string(t.Kind) - } - r.Names[t] = name - return name -} diff --git a/vendor/k8s.io/gengo/namer/order.go b/vendor/k8s.io/gengo/namer/order.go deleted file mode 100644 index fd89be9b083..00000000000 --- a/vendor/k8s.io/gengo/namer/order.go +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 namer - -import ( - "sort" - - "k8s.io/gengo/types" -) - -// Orderer produces an ordering of types given a Namer. -type Orderer struct { - Namer -} - -// OrderUniverse assigns a name to every type in the Universe, including Types, -// Functions and Variables, and returns a list sorted by those names. -func (o *Orderer) OrderUniverse(u types.Universe) []*types.Type { - list := tList{ - namer: o.Namer, - } - for _, p := range u { - for _, t := range p.Types { - list.types = append(list.types, t) - } - for _, f := range p.Functions { - list.types = append(list.types, f) - } - for _, v := range p.Variables { - list.types = append(list.types, v) - } - for _, v := range p.Constants { - list.types = append(list.types, v) - } - } - sort.Sort(list) - return list.types -} - -// OrderTypes assigns a name to every type, and returns a list sorted by those -// names. -func (o *Orderer) OrderTypes(typeList []*types.Type) []*types.Type { - list := tList{ - namer: o.Namer, - types: typeList, - } - sort.Sort(list) - return list.types -} - -type tList struct { - namer Namer - types []*types.Type -} - -func (t tList) Len() int { return len(t.types) } -func (t tList) Less(i, j int) bool { return t.namer.Name(t.types[i]) < t.namer.Name(t.types[j]) } -func (t tList) Swap(i, j int) { t.types[i], t.types[j] = t.types[j], t.types[i] } diff --git a/vendor/k8s.io/gengo/namer/plural_namer.go b/vendor/k8s.io/gengo/namer/plural_namer.go deleted file mode 100644 index 0e3ebbf262a..00000000000 --- a/vendor/k8s.io/gengo/namer/plural_namer.go +++ /dev/null @@ -1,120 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 namer - -import ( - "strings" - - "k8s.io/gengo/types" -) - -var consonants = "bcdfghjklmnpqrstvwxyz" - -type pluralNamer struct { - // key is the case-sensitive type name, value is the case-insensitive - // intended output. - exceptions map[string]string - finalize func(string) string -} - -// NewPublicPluralNamer returns a namer that returns the plural form of the input -// type's name, starting with a uppercase letter. -func NewPublicPluralNamer(exceptions map[string]string) *pluralNamer { - return &pluralNamer{exceptions, IC} -} - -// NewPrivatePluralNamer returns a namer that returns the plural form of the input -// type's name, starting with a lowercase letter. -func NewPrivatePluralNamer(exceptions map[string]string) *pluralNamer { - return &pluralNamer{exceptions, IL} -} - -// NewAllLowercasePluralNamer returns a namer that returns the plural form of the input -// type's name, with all letters in lowercase. -func NewAllLowercasePluralNamer(exceptions map[string]string) *pluralNamer { - return &pluralNamer{exceptions, strings.ToLower} -} - -// Name returns the plural form of the type's name. If the type's name is found -// in the exceptions map, the map value is returned. -func (r *pluralNamer) Name(t *types.Type) string { - singular := t.Name.Name - var plural string - var ok bool - if plural, ok = r.exceptions[singular]; ok { - return r.finalize(plural) - } - if len(singular) < 2 { - return r.finalize(singular) - } - - switch rune(singular[len(singular)-1]) { - case 's', 'x', 'z': - plural = esPlural(singular) - case 'y': - sl := rune(singular[len(singular)-2]) - if isConsonant(sl) { - plural = iesPlural(singular) - } else { - plural = sPlural(singular) - } - case 'h': - sl := rune(singular[len(singular)-2]) - if sl == 'c' || sl == 's' { - plural = esPlural(singular) - } else { - plural = sPlural(singular) - } - case 'e': - sl := rune(singular[len(singular)-2]) - if sl == 'f' { - plural = vesPlural(singular[:len(singular)-1]) - } else { - plural = sPlural(singular) - } - case 'f': - plural = vesPlural(singular) - default: - plural = sPlural(singular) - } - return r.finalize(plural) -} - -func iesPlural(singular string) string { - return singular[:len(singular)-1] + "ies" -} - -func vesPlural(singular string) string { - return singular[:len(singular)-1] + "ves" -} - -func esPlural(singular string) string { - return singular + "es" -} - -func sPlural(singular string) string { - return singular + "s" -} - -func isConsonant(char rune) bool { - for _, c := range consonants { - if char == c { - return true - } - } - return false -} diff --git a/vendor/k8s.io/gengo/parser/doc.go b/vendor/k8s.io/gengo/parser/doc.go deleted file mode 100644 index 8231b6d4320..00000000000 --- a/vendor/k8s.io/gengo/parser/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 parser provides code to parse go files, type-check them, extract the -// types. -package parser // import "k8s.io/gengo/parser" diff --git a/vendor/k8s.io/gengo/parser/parse.go b/vendor/k8s.io/gengo/parser/parse.go deleted file mode 100644 index f72cde89d55..00000000000 --- a/vendor/k8s.io/gengo/parser/parse.go +++ /dev/null @@ -1,924 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 parser - -import ( - "fmt" - "go/ast" - "go/build" - "go/constant" - "go/parser" - "go/token" - tc "go/types" - "io/ioutil" - "os" - "os/exec" - "path" - "path/filepath" - "regexp" - "sort" - "strings" - - "k8s.io/gengo/types" - "k8s.io/klog/v2" -) - -// This clarifies when a pkg path has been canonicalized. -type importPathString string - -// Builder lets you add all the go files in all the packages that you care -// about, then constructs the type source data. -type Builder struct { - context *build.Context - - // If true, include *_test.go - IncludeTestFiles bool - - // Map of package names to more canonical information about the package. - // This might hold the same value for multiple names, e.g. if someone - // referenced ./pkg/name or in the case of vendoring, which canonicalizes - // differently that what humans would type. - // - // This must only be accessed via getLoadedBuildPackage and setLoadedBuildPackage - buildPackages map[importPathString]*build.Package - - fset *token.FileSet - // map of package path to list of parsed files - parsed map[importPathString][]parsedFile - // map of package path to absolute path (to prevent overlap) - absPaths map[importPathString]string - - // Set by typeCheckPackage(), used by importPackage() and friends. - typeCheckedPackages map[importPathString]*tc.Package - - // Map of package path to whether the user requested it or it was from - // an import. - userRequested map[importPathString]bool - - // All comments from everywhere in every parsed file. - endLineToCommentGroup map[fileLine]*ast.CommentGroup - - // map of package to list of packages it imports. - importGraph map[importPathString]map[string]struct{} -} - -// parsedFile is for tracking files with name -type parsedFile struct { - name string - file *ast.File -} - -// key type for finding comments. -type fileLine struct { - file string - line int -} - -// New constructs a new builder. -func New() *Builder { - c := build.Default - if c.GOROOT == "" { - if p, err := exec.Command("which", "go").CombinedOutput(); err == nil { - // The returned string will have some/path/bin/go, so remove the last two elements. - c.GOROOT = filepath.Dir(filepath.Dir(strings.Trim(string(p), "\n"))) - } else { - klog.Warningf("Warning: $GOROOT not set, and unable to run `which go` to find it: %v\n", err) - } - } - // Force this to off, since we don't properly parse CGo. All symbols must - // have non-CGo equivalents. - c.CgoEnabled = false - return &Builder{ - context: &c, - buildPackages: map[importPathString]*build.Package{}, - typeCheckedPackages: map[importPathString]*tc.Package{}, - fset: token.NewFileSet(), - parsed: map[importPathString][]parsedFile{}, - absPaths: map[importPathString]string{}, - userRequested: map[importPathString]bool{}, - endLineToCommentGroup: map[fileLine]*ast.CommentGroup{}, - importGraph: map[importPathString]map[string]struct{}{}, - } -} - -// AddBuildTags adds the specified build tags to the parse context. -func (b *Builder) AddBuildTags(tags ...string) { - b.context.BuildTags = append(b.context.BuildTags, tags...) -} - -func (b *Builder) getLoadedBuildPackage(importPath string) (*build.Package, bool) { - canonicalized := canonicalizeImportPath(importPath) - if string(canonicalized) != importPath { - klog.V(5).Infof("getLoadedBuildPackage: %s normalized to %s", importPath, canonicalized) - } - buildPkg, ok := b.buildPackages[canonicalized] - return buildPkg, ok -} -func (b *Builder) setLoadedBuildPackage(importPath string, buildPkg *build.Package) { - canonicalizedImportPath := canonicalizeImportPath(importPath) - if string(canonicalizedImportPath) != importPath { - klog.V(5).Infof("setLoadedBuildPackage: importPath %s normalized to %s", importPath, canonicalizedImportPath) - } - - canonicalizedBuildPkgImportPath := canonicalizeImportPath(buildPkg.ImportPath) - if string(canonicalizedBuildPkgImportPath) != buildPkg.ImportPath { - klog.V(5).Infof("setLoadedBuildPackage: buildPkg.ImportPath %s normalized to %s", buildPkg.ImportPath, canonicalizedBuildPkgImportPath) - } - - if canonicalizedImportPath != canonicalizedBuildPkgImportPath { - klog.V(5).Infof("setLoadedBuildPackage: normalized importPath (%s) differs from buildPkg.ImportPath (%s)", canonicalizedImportPath, canonicalizedBuildPkgImportPath) - } - b.buildPackages[canonicalizedImportPath] = buildPkg - b.buildPackages[canonicalizedBuildPkgImportPath] = buildPkg -} - -// Get package information from the go/build package. Automatically excludes -// e.g. test files and files for other platforms-- there is quite a bit of -// logic of that nature in the build package. -func (b *Builder) importBuildPackage(dir string) (*build.Package, error) { - if buildPkg, ok := b.getLoadedBuildPackage(dir); ok { - return buildPkg, nil - } - // This validates the `package foo // github.com/bar/foo` comments. - buildPkg, err := b.importWithMode(dir, build.ImportComment) - if err != nil { - if _, ok := err.(*build.NoGoError); !ok { - return nil, fmt.Errorf("unable to import %q: %v", dir, err) - } - } - if buildPkg == nil { - // Might be an empty directory. Try to just find the dir. - buildPkg, err = b.importWithMode(dir, build.FindOnly) - if err != nil { - return nil, err - } - } - - // Remember it under the user-provided name. - klog.V(5).Infof("saving buildPackage %s", dir) - b.setLoadedBuildPackage(dir, buildPkg) - - return buildPkg, nil -} - -// AddFileForTest adds a file to the set, without verifying that the provided -// pkg actually exists on disk. The pkg must be of the form "canonical/pkg/path" -// and the path must be the absolute path to the file. Because this bypasses -// the normal recursive finding of package dependencies (on disk), test should -// sort their test files topologically first, so all deps are resolved by the -// time we need them. -func (b *Builder) AddFileForTest(pkg string, path string, src []byte) error { - if err := b.addFile(importPathString(pkg), path, src, true); err != nil { - return err - } - if _, err := b.typeCheckPackage(importPathString(pkg), true); err != nil { - return err - } - return nil -} - -// addFile adds a file to the set. The pkgPath must be of the form -// "canonical/pkg/path" and the path must be the absolute path to the file. A -// flag indicates whether this file was user-requested or just from following -// the import graph. -func (b *Builder) addFile(pkgPath importPathString, path string, src []byte, userRequested bool) error { - for _, p := range b.parsed[pkgPath] { - if path == p.name { - klog.V(5).Infof("addFile %s %s already parsed, skipping", pkgPath, path) - return nil - } - } - klog.V(6).Infof("addFile %s %s", pkgPath, path) - p, err := parser.ParseFile(b.fset, path, src, parser.DeclarationErrors|parser.ParseComments) - if err != nil { - return err - } - - // This is redundant with addDir, but some tests call AddFileForTest, which - // call into here without calling addDir. - b.userRequested[pkgPath] = userRequested || b.userRequested[pkgPath] - - b.parsed[pkgPath] = append(b.parsed[pkgPath], parsedFile{path, p}) - for _, c := range p.Comments { - position := b.fset.Position(c.End()) - b.endLineToCommentGroup[fileLine{position.Filename, position.Line}] = c - } - - // We have to get the packages from this specific file, in case the - // user added individual files instead of entire directories. - if b.importGraph[pkgPath] == nil { - b.importGraph[pkgPath] = map[string]struct{}{} - } - for _, im := range p.Imports { - importedPath := strings.Trim(im.Path.Value, `"`) - b.importGraph[pkgPath][importedPath] = struct{}{} - } - return nil -} - -// AddDir adds an entire directory, scanning it for go files. 'dir' should have -// a single go package in it. GOPATH, GOROOT, and the location of your go -// binary (`which go`) will all be searched if dir doesn't literally resolve. -func (b *Builder) AddDir(dir string) error { - _, err := b.importPackage(dir, true) - return err -} - -// AddDirRecursive is just like AddDir, but it also recursively adds -// subdirectories; it returns an error only if the path couldn't be resolved; -// any directories recursed into without go source are ignored. -func (b *Builder) AddDirRecursive(dir string) error { - // Add the root. - if _, err := b.importPackage(dir, true); err != nil { - klog.Warningf("Ignoring directory %v: %v", dir, err) - } - - // filepath.Walk does not follow symlinks. We therefore evaluate symlinks and use that with - // filepath.Walk. - buildPkg, ok := b.getLoadedBuildPackage(dir) - if !ok { - return fmt.Errorf("no loaded build package for %s", dir) - } - realPath, err := filepath.EvalSymlinks(buildPkg.Dir) - if err != nil { - return err - } - - fn := func(filePath string, info os.FileInfo, err error) error { - if info != nil && info.IsDir() { - rel := filepath.ToSlash(strings.TrimPrefix(filePath, realPath)) - if rel != "" { - // Make a pkg path. - buildPkg, ok := b.getLoadedBuildPackage(dir) - if !ok { - return fmt.Errorf("no loaded build package for %s", dir) - } - pkg := path.Join(string(canonicalizeImportPath(buildPkg.ImportPath)), rel) - - // Add it. - if _, err := b.importPackage(pkg, true); err != nil { - klog.Warningf("Ignoring child directory %v: %v", pkg, err) - } - } - } - return nil - } - if err := filepath.Walk(realPath, fn); err != nil { - return err - } - return nil -} - -// AddDirTo adds an entire directory to a given Universe. Unlike AddDir, this -// processes the package immediately, which makes it safe to use from within a -// generator (rather than just at init time. 'dir' must be a single go package. -// GOPATH, GOROOT, and the location of your go binary (`which go`) will all be -// searched if dir doesn't literally resolve. -// Deprecated. Please use AddDirectoryTo. -func (b *Builder) AddDirTo(dir string, u *types.Universe) error { - // We want all types from this package, as if they were directly added - // by the user. They WERE added by the user, in effect. - if _, err := b.importPackage(dir, true); err != nil { - return err - } - pkg, ok := b.getLoadedBuildPackage(dir) - if !ok { - return fmt.Errorf("no such package: %q", dir) - } - return b.findTypesIn(canonicalizeImportPath(pkg.ImportPath), u) -} - -// AddDirectoryTo adds an entire directory to a given Universe. Unlike AddDir, -// this processes the package immediately, which makes it safe to use from -// within a generator (rather than just at init time. 'dir' must be a single go -// package. GOPATH, GOROOT, and the location of your go binary (`which go`) -// will all be searched if dir doesn't literally resolve. -func (b *Builder) AddDirectoryTo(dir string, u *types.Universe) (*types.Package, error) { - // We want all types from this package, as if they were directly added - // by the user. They WERE added by the user, in effect. - if _, err := b.importPackage(dir, true); err != nil { - return nil, err - } - pkg, ok := b.getLoadedBuildPackage(dir) - if !ok || pkg == nil { - return nil, fmt.Errorf("no such package: %q", dir) - } - path := canonicalizeImportPath(pkg.ImportPath) - if err := b.findTypesIn(path, u); err != nil { - return nil, err - } - return u.Package(string(path)), nil -} - -// The implementation of AddDir. A flag indicates whether this directory was -// user-requested or just from following the import graph. -func (b *Builder) addDir(dir string, userRequested bool) error { - klog.V(5).Infof("addDir %s", dir) - buildPkg, err := b.importBuildPackage(dir) - if err != nil { - return err - } - canonicalPackage := canonicalizeImportPath(buildPkg.ImportPath) - pkgPath := canonicalPackage - if dir != string(canonicalPackage) { - klog.V(5).Infof("addDir %s, canonical path is %s", dir, pkgPath) - } - - // Sanity check the pkg dir has not changed. - if prev, found := b.absPaths[pkgPath]; found { - if buildPkg.Dir != prev { - return fmt.Errorf("package %q (%s) previously resolved to %s", pkgPath, buildPkg.Dir, prev) - } - } else { - b.absPaths[pkgPath] = buildPkg.Dir - } - - files := []string{} - files = append(files, buildPkg.GoFiles...) - if b.IncludeTestFiles { - files = append(files, buildPkg.TestGoFiles...) - } - - for _, file := range files { - if !strings.HasSuffix(file, ".go") { - continue - } - absPath := filepath.Join(buildPkg.Dir, file) - data, err := ioutil.ReadFile(absPath) - if err != nil { - return fmt.Errorf("while loading %q: %v", absPath, err) - } - err = b.addFile(pkgPath, absPath, data, userRequested) - if err != nil { - return fmt.Errorf("while parsing %q: %v", absPath, err) - } - } - return nil -} - -// regexErrPackageNotFound helps test the expected error for not finding a package. -var regexErrPackageNotFound = regexp.MustCompile(`^unable to import ".*?":.*`) - -func isErrPackageNotFound(err error) bool { - return regexErrPackageNotFound.MatchString(err.Error()) -} - -// importPackage is a function that will be called by the type check package when it -// needs to import a go package. 'path' is the import path. -func (b *Builder) importPackage(dir string, userRequested bool) (*tc.Package, error) { - klog.V(5).Infof("importPackage %s", dir) - - var pkgPath = importPathString(dir) - - // Get the canonical path if we can. - if buildPkg, _ := b.getLoadedBuildPackage(dir); buildPkg != nil { - canonicalPackage := canonicalizeImportPath(buildPkg.ImportPath) - klog.V(5).Infof("importPackage %s, canonical path is %s", dir, canonicalPackage) - pkgPath = canonicalPackage - } - - // If we have not seen this before, process it now. - ignoreError := false - if _, found := b.parsed[pkgPath]; !found { - // Ignore errors in paths that we're importing solely because - // they're referenced by other packages. - ignoreError = true - - // Add it. - if err := b.addDir(dir, userRequested); err != nil { - if isErrPackageNotFound(err) { - klog.V(6).Info(err) - return nil, nil - } - - return nil, err - } - - // Get the canonical path now that it has been added. - if buildPkg, _ := b.getLoadedBuildPackage(dir); buildPkg != nil { - canonicalPackage := canonicalizeImportPath(buildPkg.ImportPath) - klog.V(5).Infof("importPackage %s, canonical path is %s", dir, canonicalPackage) - pkgPath = canonicalPackage - } - } - - // If it was previously known, just check that the user-requestedness hasn't - // changed. - b.userRequested[pkgPath] = userRequested || b.userRequested[pkgPath] - - // Run the type checker. We may end up doing this to pkgs that are already - // done, or are in the queue to be done later, but it will short-circuit, - // and we can't miss pkgs that are only depended on. - pkg, err := b.typeCheckPackage(pkgPath, !ignoreError) - if err != nil { - switch { - case ignoreError && pkg != nil: - klog.V(4).Infof("type checking encountered some issues in %q, but ignoring.\n", pkgPath) - case !ignoreError && pkg != nil: - klog.V(3).Infof("type checking encountered some errors in %q\n", pkgPath) - return nil, err - default: - return nil, err - } - } - - return pkg, nil -} - -type importAdapter struct { - b *Builder -} - -func (a importAdapter) Import(path string) (*tc.Package, error) { - return a.b.importPackage(path, false) -} - -// typeCheckPackage will attempt to return the package even if there are some -// errors, so you may check whether the package is nil or not even if you get -// an error. -func (b *Builder) typeCheckPackage(pkgPath importPathString, logErr bool) (*tc.Package, error) { - klog.V(5).Infof("typeCheckPackage %s", pkgPath) - if pkg, ok := b.typeCheckedPackages[pkgPath]; ok { - if pkg != nil { - klog.V(6).Infof("typeCheckPackage %s already done", pkgPath) - return pkg, nil - } - // We store a nil right before starting work on a package. So - // if we get here and it's present and nil, that means there's - // another invocation of this function on the call stack - // already processing this package. - return nil, fmt.Errorf("circular dependency for %q", pkgPath) - } - parsedFiles, ok := b.parsed[pkgPath] - if !ok { - return nil, fmt.Errorf("No files for pkg %q", pkgPath) - } - files := make([]*ast.File, len(parsedFiles)) - for i := range parsedFiles { - files[i] = parsedFiles[i].file - } - b.typeCheckedPackages[pkgPath] = nil - c := tc.Config{ - IgnoreFuncBodies: true, - // Note that importAdapter can call b.importPackage which calls this - // method. So there can't be cycles in the import graph. - Importer: importAdapter{b}, - Error: func(err error) { - if logErr { - klog.V(2).Infof("type checker: %v\n", err) - } else { - klog.V(3).Infof("type checker: %v\n", err) - } - }, - } - pkg, err := c.Check(string(pkgPath), b.fset, files, nil) - b.typeCheckedPackages[pkgPath] = pkg // record the result whether or not there was an error - return pkg, err -} - -// FindPackages fetches a list of the user-imported packages. -// Note that you need to call b.FindTypes() first. -func (b *Builder) FindPackages() []string { - // Iterate packages in a predictable order. - pkgPaths := []string{} - for k := range b.typeCheckedPackages { - pkgPaths = append(pkgPaths, string(k)) - } - sort.Strings(pkgPaths) - - result := []string{} - for _, pkgPath := range pkgPaths { - if b.userRequested[importPathString(pkgPath)] { - // Since walkType is recursive, all types that are in packages that - // were directly mentioned will be included. We don't need to - // include all types in all transitive packages, though. - result = append(result, pkgPath) - } - } - return result -} - -// FindTypes finalizes the package imports, and searches through all the -// packages for types. -func (b *Builder) FindTypes() (types.Universe, error) { - // Take a snapshot of pkgs to iterate, since this will recursively mutate - // b.parsed. Iterate in a predictable order. - pkgPaths := []string{} - for pkgPath := range b.parsed { - pkgPaths = append(pkgPaths, string(pkgPath)) - } - sort.Strings(pkgPaths) - - u := types.Universe{} - for _, pkgPath := range pkgPaths { - if err := b.findTypesIn(importPathString(pkgPath), &u); err != nil { - return nil, err - } - } - return u, nil -} - -// addCommentsToType takes any accumulated comment lines prior to obj and -// attaches them to the type t. -func (b *Builder) addCommentsToType(obj tc.Object, t *types.Type) { - c1 := b.priorCommentLines(obj.Pos(), 1) - // c1.Text() is safe if c1 is nil - t.CommentLines = splitLines(c1.Text()) - if c1 == nil { - t.SecondClosestCommentLines = splitLines(b.priorCommentLines(obj.Pos(), 2).Text()) - } else { - t.SecondClosestCommentLines = splitLines(b.priorCommentLines(c1.List[0].Slash, 2).Text()) - } -} - -// findTypesIn finalizes the package import and searches through the package -// for types. -func (b *Builder) findTypesIn(pkgPath importPathString, u *types.Universe) error { - klog.V(5).Infof("findTypesIn %s", pkgPath) - pkg := b.typeCheckedPackages[pkgPath] - if pkg == nil { - return fmt.Errorf("findTypesIn(%s): package is not known", pkgPath) - } - if !b.userRequested[pkgPath] { - // Since walkType is recursive, all types that the - // packages they asked for depend on will be included. - // But we don't need to include all types in all - // *packages* they depend on. - klog.V(5).Infof("findTypesIn %s: package is not user requested", pkgPath) - return nil - } - - // We're keeping this package. This call will create the record. - u.Package(string(pkgPath)).Name = pkg.Name() - u.Package(string(pkgPath)).Path = pkg.Path() - u.Package(string(pkgPath)).SourcePath = b.absPaths[pkgPath] - - for _, f := range b.parsed[pkgPath] { - if _, fileName := filepath.Split(f.name); fileName == "doc.go" { - tp := u.Package(string(pkgPath)) - // findTypesIn might be called multiple times. Clean up tp.Comments - // to avoid repeatedly fill same comments to it. - tp.Comments = []string{} - for i := range f.file.Comments { - tp.Comments = append(tp.Comments, splitLines(f.file.Comments[i].Text())...) - } - if f.file.Doc != nil { - tp.DocComments = splitLines(f.file.Doc.Text()) - } - } - } - - s := pkg.Scope() - for _, n := range s.Names() { - obj := s.Lookup(n) - tn, ok := obj.(*tc.TypeName) - if ok { - t := b.walkType(*u, nil, tn.Type()) - b.addCommentsToType(obj, t) - } - tf, ok := obj.(*tc.Func) - // We only care about functions, not concrete/abstract methods. - if ok && tf.Type() != nil && tf.Type().(*tc.Signature).Recv() == nil { - t := b.addFunction(*u, nil, tf) - b.addCommentsToType(obj, t) - } - tv, ok := obj.(*tc.Var) - if ok && !tv.IsField() { - t := b.addVariable(*u, nil, tv) - b.addCommentsToType(obj, t) - } - tconst, ok := obj.(*tc.Const) - if ok { - t := b.addConstant(*u, nil, tconst) - b.addCommentsToType(obj, t) - } - } - - importedPkgs := []string{} - for k := range b.importGraph[pkgPath] { - importedPkgs = append(importedPkgs, string(k)) - } - sort.Strings(importedPkgs) - for _, p := range importedPkgs { - u.AddImports(string(pkgPath), p) - } - return nil -} - -func (b *Builder) importWithMode(dir string, mode build.ImportMode) (*build.Package, error) { - // This is a bit of a hack. The srcDir argument to Import() should - // properly be the dir of the file which depends on the package to be - // imported, so that vendoring can work properly and local paths can - // resolve. We assume that there is only one level of vendoring, and that - // the CWD is inside the GOPATH, so this should be safe. Nobody should be - // using local (relative) paths except on the CLI, so CWD is also - // sufficient. - cwd, err := os.Getwd() - if err != nil { - return nil, fmt.Errorf("unable to get current directory: %v", err) - } - - // normalize to drop /vendor/ if present - dir = string(canonicalizeImportPath(dir)) - - buildPkg, err := b.context.Import(filepath.ToSlash(dir), cwd, mode) - if err != nil { - return nil, err - } - return buildPkg, nil -} - -// if there's a comment on the line `lines` before pos, return its text, otherwise "". -func (b *Builder) priorCommentLines(pos token.Pos, lines int) *ast.CommentGroup { - position := b.fset.Position(pos) - key := fileLine{position.Filename, position.Line - lines} - return b.endLineToCommentGroup[key] -} - -func splitLines(str string) []string { - return strings.Split(strings.TrimRight(str, "\n"), "\n") -} - -func tcFuncNameToName(in string) types.Name { - name := strings.TrimPrefix(in, "func ") - nameParts := strings.Split(name, "(") - return tcNameToName(nameParts[0]) -} - -func tcVarNameToName(in string) types.Name { - nameParts := strings.Split(in, " ") - // nameParts[0] is "var". - // nameParts[2:] is the type of the variable, we ignore it for now. - return tcNameToName(nameParts[1]) -} - -func tcNameToName(in string) types.Name { - // Detect anonymous type names. (These may have '.' characters because - // embedded types may have packages, so we detect them specially.) - if strings.HasPrefix(in, "struct{") || - strings.HasPrefix(in, "<-chan") || - strings.HasPrefix(in, "chan<-") || - strings.HasPrefix(in, "chan ") || - strings.HasPrefix(in, "func(") || - strings.HasPrefix(in, "*") || - strings.HasPrefix(in, "map[") || - strings.HasPrefix(in, "[") { - return types.Name{Name: in} - } - - // Otherwise, if there are '.' characters present, the name has a - // package path in front. - nameParts := strings.Split(in, ".") - name := types.Name{Name: in} - if n := len(nameParts); n >= 2 { - // The final "." is the name of the type--previous ones must - // have been in the package path. - name.Package, name.Name = strings.Join(nameParts[:n-1], "."), nameParts[n-1] - } - return name -} - -func (b *Builder) convertSignature(u types.Universe, t *tc.Signature) *types.Signature { - signature := &types.Signature{} - for i := 0; i < t.Params().Len(); i++ { - signature.Parameters = append(signature.Parameters, b.walkType(u, nil, t.Params().At(i).Type())) - signature.ParameterNames = append(signature.ParameterNames, t.Params().At(i).Name()) - } - for i := 0; i < t.Results().Len(); i++ { - signature.Results = append(signature.Results, b.walkType(u, nil, t.Results().At(i).Type())) - signature.ResultNames = append(signature.ResultNames, t.Results().At(i).Name()) - } - if r := t.Recv(); r != nil { - signature.Receiver = b.walkType(u, nil, r.Type()) - } - signature.Variadic = t.Variadic() - return signature -} - -// walkType adds the type, and any necessary child types. -func (b *Builder) walkType(u types.Universe, useName *types.Name, in tc.Type) *types.Type { - // Most of the cases are underlying types of the named type. - name := tcNameToName(in.String()) - if useName != nil { - name = *useName - } - - switch t := in.(type) { - case *tc.Struct: - out := u.Type(name) - if out.Kind != types.Unknown { - return out - } - out.Kind = types.Struct - for i := 0; i < t.NumFields(); i++ { - f := t.Field(i) - m := types.Member{ - Name: f.Name(), - Embedded: f.Anonymous(), - Tags: t.Tag(i), - Type: b.walkType(u, nil, f.Type()), - CommentLines: splitLines(b.priorCommentLines(f.Pos(), 1).Text()), - } - out.Members = append(out.Members, m) - } - return out - case *tc.Map: - out := u.Type(name) - if out.Kind != types.Unknown { - return out - } - out.Kind = types.Map - out.Elem = b.walkType(u, nil, t.Elem()) - out.Key = b.walkType(u, nil, t.Key()) - return out - case *tc.Pointer: - out := u.Type(name) - if out.Kind != types.Unknown { - return out - } - out.Kind = types.Pointer - out.Elem = b.walkType(u, nil, t.Elem()) - return out - case *tc.Slice: - out := u.Type(name) - if out.Kind != types.Unknown { - return out - } - out.Kind = types.Slice - out.Elem = b.walkType(u, nil, t.Elem()) - return out - case *tc.Array: - out := u.Type(name) - if out.Kind != types.Unknown { - return out - } - out.Kind = types.Array - out.Elem = b.walkType(u, nil, t.Elem()) - out.Len = in.(*tc.Array).Len() - return out - case *tc.Chan: - out := u.Type(name) - if out.Kind != types.Unknown { - return out - } - out.Kind = types.Chan - out.Elem = b.walkType(u, nil, t.Elem()) - // TODO: need to store direction, otherwise raw type name - // cannot be properly written. - return out - case *tc.Basic: - out := u.Type(types.Name{ - Package: "", - Name: t.Name(), - }) - if out.Kind != types.Unknown { - return out - } - out.Kind = types.Unsupported - return out - case *tc.Signature: - out := u.Type(name) - if out.Kind != types.Unknown { - return out - } - out.Kind = types.Func - out.Signature = b.convertSignature(u, t) - return out - case *tc.Interface: - out := u.Type(name) - if out.Kind != types.Unknown { - return out - } - out.Kind = types.Interface - t.Complete() - for i := 0; i < t.NumMethods(); i++ { - if out.Methods == nil { - out.Methods = map[string]*types.Type{} - } - method := t.Method(i) - name := tcNameToName(method.String()) - mt := b.walkType(u, &name, method.Type()) - mt.CommentLines = splitLines(b.priorCommentLines(method.Pos(), 1).Text()) - out.Methods[method.Name()] = mt - } - return out - case *tc.Named: - var out *types.Type - switch t.Underlying().(type) { - case *tc.Named, *tc.Basic, *tc.Map, *tc.Slice: - name := tcNameToName(t.String()) - out = u.Type(name) - if out.Kind != types.Unknown { - return out - } - out.Kind = types.Alias - out.Underlying = b.walkType(u, nil, t.Underlying()) - default: - // tc package makes everything "named" with an - // underlying anonymous type--we remove that annoying - // "feature" for users. This flattens those types - // together. - name := tcNameToName(t.String()) - if out := u.Type(name); out.Kind != types.Unknown { - return out // short circuit if we've already made this. - } - out = b.walkType(u, &name, t.Underlying()) - } - // If the underlying type didn't already add methods, add them. - // (Interface types will have already added methods.) - if len(out.Methods) == 0 { - for i := 0; i < t.NumMethods(); i++ { - if out.Methods == nil { - out.Methods = map[string]*types.Type{} - } - method := t.Method(i) - name := tcNameToName(method.String()) - mt := b.walkType(u, &name, method.Type()) - mt.CommentLines = splitLines(b.priorCommentLines(method.Pos(), 1).Text()) - out.Methods[method.Name()] = mt - } - } - return out - default: - out := u.Type(name) - if out.Kind != types.Unknown { - return out - } - out.Kind = types.Unsupported - klog.Warningf("Making unsupported type entry %q for: %#v\n", out, t) - return out - } -} - -func (b *Builder) addFunction(u types.Universe, useName *types.Name, in *tc.Func) *types.Type { - name := tcFuncNameToName(in.String()) - if useName != nil { - name = *useName - } - out := u.Function(name) - out.Kind = types.DeclarationOf - out.Underlying = b.walkType(u, nil, in.Type()) - return out -} - -func (b *Builder) addVariable(u types.Universe, useName *types.Name, in *tc.Var) *types.Type { - name := tcVarNameToName(in.String()) - if useName != nil { - name = *useName - } - out := u.Variable(name) - out.Kind = types.DeclarationOf - out.Underlying = b.walkType(u, nil, in.Type()) - return out -} - -func (b *Builder) addConstant(u types.Universe, useName *types.Name, in *tc.Const) *types.Type { - name := tcVarNameToName(in.String()) - if useName != nil { - name = *useName - } - out := u.Constant(name) - out.Kind = types.DeclarationOf - out.Underlying = b.walkType(u, nil, in.Type()) - - var constval string - - // For strings, we use `StringVal()` to get the un-truncated, - // un-quoted string. For other values, `.String()` is preferable to - // get something relatively human readable (especially since for - // floating point types, `ExactString()` will generate numeric - // expressions using `big.(*Float).Text()`. - switch in.Val().Kind() { - case constant.String: - constval = constant.StringVal(in.Val()) - default: - constval = in.Val().String() - } - - out.ConstValue = &constval - return out -} - -// canonicalizeImportPath takes an import path and returns the actual package. -// It doesn't support nested vendoring. -func canonicalizeImportPath(importPath string) importPathString { - if !strings.Contains(importPath, "/vendor/") { - return importPathString(importPath) - } - - return importPathString(importPath[strings.Index(importPath, "/vendor/")+len("/vendor/"):]) -} diff --git a/vendor/k8s.io/gengo/types/comments.go b/vendor/k8s.io/gengo/types/comments.go deleted file mode 100644 index 8150c383875..00000000000 --- a/vendor/k8s.io/gengo/types/comments.go +++ /dev/null @@ -1,82 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 types contains go type information, packaged in a way that makes -// auto-generation convenient, whether by template or straight go functions. -package types - -import ( - "fmt" - "strings" -) - -// ExtractCommentTags parses comments for lines of the form: -// -// 'marker' + "key=value". -// -// Values are optional; "" is the default. A tag can be specified more than -// one time and all values are returned. If the resulting map has an entry for -// a key, the value (a slice) is guaranteed to have at least 1 element. -// -// Example: if you pass "+" for 'marker', and the following lines are in -// the comments: -// +foo=value1 -// +bar -// +foo=value2 -// +baz="qux" -// Then this function will return: -// map[string][]string{"foo":{"value1, "value2"}, "bar": {""}, "baz": {"qux"}} -func ExtractCommentTags(marker string, lines []string) map[string][]string { - out := map[string][]string{} - for _, line := range lines { - line = strings.Trim(line, " ") - if len(line) == 0 { - continue - } - if !strings.HasPrefix(line, marker) { - continue - } - // TODO: we could support multiple values per key if we split on spaces - kv := strings.SplitN(line[len(marker):], "=", 2) - if len(kv) == 2 { - out[kv[0]] = append(out[kv[0]], kv[1]) - } else if len(kv) == 1 { - out[kv[0]] = append(out[kv[0]], "") - } - } - return out -} - -// ExtractSingleBoolCommentTag parses comments for lines of the form: -// -// 'marker' + "key=value1" -// -// If the tag is not found, the default value is returned. Values are asserted -// to be boolean ("true" or "false"), and any other value will cause an error -// to be returned. If the key has multiple values, the first one will be used. -func ExtractSingleBoolCommentTag(marker string, key string, defaultVal bool, lines []string) (bool, error) { - values := ExtractCommentTags(marker, lines)[key] - if values == nil { - return defaultVal, nil - } - if values[0] == "true" { - return true, nil - } - if values[0] == "false" { - return false, nil - } - return false, fmt.Errorf("tag value for %q is not boolean: %q", key, values[0]) -} diff --git a/vendor/k8s.io/gengo/types/doc.go b/vendor/k8s.io/gengo/types/doc.go deleted file mode 100644 index 74a969a763a..00000000000 --- a/vendor/k8s.io/gengo/types/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 types contains go type information, packaged in a way that makes -// auto-generation convenient, whether by template or straight go functions. -package types // import "k8s.io/gengo/types" diff --git a/vendor/k8s.io/gengo/types/flatten.go b/vendor/k8s.io/gengo/types/flatten.go deleted file mode 100644 index 585014e8ba0..00000000000 --- a/vendor/k8s.io/gengo/types/flatten.go +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 types - -// FlattenMembers recursively takes any embedded members and puts them in the -// top level, correctly hiding them if the top level hides them. There must not -// be a cycle-- that implies infinite members. -// -// This is useful for e.g. computing all the valid keys in a json struct, -// properly considering any configuration of embedded structs. -func FlattenMembers(m []Member) []Member { - embedded := []Member{} - normal := []Member{} - type nameInfo struct { - top bool - i int - } - names := map[string]nameInfo{} - for i := range m { - if m[i].Embedded && m[i].Type.Kind == Struct { - embedded = append(embedded, m[i]) - } else { - normal = append(normal, m[i]) - names[m[i].Name] = nameInfo{true, len(normal) - 1} - } - } - for i := range embedded { - for _, e := range FlattenMembers(embedded[i].Type.Members) { - if info, found := names[e.Name]; found { - if info.top { - continue - } - if n := normal[info.i]; n.Name == e.Name && n.Type == e.Type { - continue - } - panic("conflicting members") - } - normal = append(normal, e) - names[e.Name] = nameInfo{false, len(normal) - 1} - } - } - return normal -} diff --git a/vendor/k8s.io/gengo/types/types.go b/vendor/k8s.io/gengo/types/types.go deleted file mode 100644 index 77650255acd..00000000000 --- a/vendor/k8s.io/gengo/types/types.go +++ /dev/null @@ -1,537 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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 types - -import "strings" - -// Ref makes a reference to the given type. It can only be used for e.g. -// passing to namers. -func Ref(packageName, typeName string) *Type { - return &Type{Name: Name{ - Name: typeName, - Package: packageName, - }} -} - -// A type name may have a package qualifier. -type Name struct { - // Empty if embedded or builtin. This is the package path unless Path is specified. - Package string - // The type name. - Name string - // An optional location of the type definition for languages that can have disjoint - // packages and paths. - Path string -} - -// String returns the name formatted as a string. -func (n Name) String() string { - if n.Package == "" { - return n.Name - } - return n.Package + "." + n.Name -} - -// ParseFullyQualifiedName parses a name like k8s.io/kubernetes/pkg/api.Pod into a Name. -func ParseFullyQualifiedName(fqn string) Name { - cs := strings.Split(fqn, ".") - pkg := "" - if len(cs) > 1 { - pkg = strings.Join(cs[0:len(cs)-1], ".") - } - return Name{ - Name: cs[len(cs)-1], - Package: pkg, - } -} - -// The possible classes of types. -type Kind string - -const ( - // Builtin is a primitive, like bool, string, int. - Builtin Kind = "Builtin" - Struct Kind = "Struct" - Map Kind = "Map" - Slice Kind = "Slice" - Pointer Kind = "Pointer" - - // Alias is an alias of another type, e.g. in: - // type Foo string - // type Bar Foo - // Bar is an alias of Foo. - // - // In the real go type system, Foo is a "Named" string; but to simplify - // generation, this type system will just say that Foo *is* a builtin. - // We then need "Alias" as a way for us to say that Bar *is* a Foo. - Alias Kind = "Alias" - - // Interface is any type that could have differing types at run time. - Interface Kind = "Interface" - - // Array is just like slice, but has a fixed length. - Array Kind = "Array" - - // The remaining types are included for completeness, but are not well - // supported. - Chan Kind = "Chan" - Func Kind = "Func" - - // DeclarationOf is different from other Kinds; it indicates that instead of - // representing an actual Type, the type is a declaration of an instance of - // a type. E.g., a top-level function, variable, or constant. See the - // comment for Type.Name for more detail. - DeclarationOf Kind = "DeclarationOf" - Unknown Kind = "" - Unsupported Kind = "Unsupported" - - // Protobuf is protobuf type. - Protobuf Kind = "Protobuf" -) - -// Package holds package-level information. -// Fields are public, as everything in this package, to enable consumption by -// templates (for example). But it is strongly encouraged for code to build by -// using the provided functions. -type Package struct { - // Canonical name of this package-- its path. - Path string - - // The location this package was loaded from - SourcePath string - - // Short name of this package; the name that appears in the - // 'package x' line. - Name string - - // The comment right above the package declaration in doc.go, if any. - DocComments []string - - // All comments from doc.go, if any. - // TODO: remove Comments and use DocComments everywhere. - Comments []string - - // Types within this package, indexed by their name (*not* including - // package name). - Types map[string]*Type - - // Functions within this package, indexed by their name (*not* including - // package name). - Functions map[string]*Type - - // Global variables within this package, indexed by their name (*not* including - // package name). - Variables map[string]*Type - - // Global constants within this package, indexed by their name (*not* including - // package name). - Constants map[string]*Type - - // Packages imported by this package, indexed by (canonicalized) - // package path. - Imports map[string]*Package -} - -// Has returns true if the given name references a type known to this package. -func (p *Package) Has(name string) bool { - _, has := p.Types[name] - return has -} - -// Type gets the given Type in this Package. If the Type is not already -// defined, this will add it and return the new Type value. The caller is -// expected to finish initialization. -func (p *Package) Type(typeName string) *Type { - if t, ok := p.Types[typeName]; ok { - return t - } - if p.Path == "" { - // Import the standard builtin types! - if t, ok := builtins.Types[typeName]; ok { - p.Types[typeName] = t - return t - } - } - t := &Type{Name: Name{Package: p.Path, Name: typeName}} - p.Types[typeName] = t - return t -} - -// Function gets the given function Type in this Package. If the function is -// not already defined, this will add it. If a function is added, it's the -// caller's responsibility to finish construction of the function by setting -// Underlying to the correct type. -func (p *Package) Function(funcName string) *Type { - if t, ok := p.Functions[funcName]; ok { - return t - } - t := &Type{Name: Name{Package: p.Path, Name: funcName}} - t.Kind = DeclarationOf - p.Functions[funcName] = t - return t -} - -// Variable gets the given variable Type in this Package. If the variable is -// not already defined, this will add it. If a variable is added, it's the caller's -// responsibility to finish construction of the variable by setting Underlying -// to the correct type. -func (p *Package) Variable(varName string) *Type { - if t, ok := p.Variables[varName]; ok { - return t - } - t := &Type{Name: Name{Package: p.Path, Name: varName}} - t.Kind = DeclarationOf - p.Variables[varName] = t - return t -} - -// Constant gets the given constant Type in this Package. If the constant is -// not already defined, this will add it. If a constant is added, it's the caller's -// responsibility to finish construction of the constant by setting Underlying -// to the correct type. -func (p *Package) Constant(constName string) *Type { - if t, ok := p.Constants[constName]; ok { - return t - } - t := &Type{Name: Name{Package: p.Path, Name: constName}} - t.Kind = DeclarationOf - p.Constants[constName] = t - return t -} - -// HasImport returns true if p imports packageName. Package names include the -// package directory. -func (p *Package) HasImport(packageName string) bool { - _, has := p.Imports[packageName] - return has -} - -// Universe is a map of all packages. The key is the package name, but you -// should use Package(), Type(), Function(), or Variable() instead of direct -// access. -type Universe map[string]*Package - -// Type returns the canonical type for the given fully-qualified name. Builtin -// types will always be found, even if they haven't been explicitly added to -// the map. If a non-existing type is requested, this will create (a marker for) -// it. -func (u Universe) Type(n Name) *Type { - return u.Package(n.Package).Type(n.Name) -} - -// Function returns the canonical function for the given fully-qualified name. -// If a non-existing function is requested, this will create (a marker for) it. -// If a marker is created, it's the caller's responsibility to finish -// construction of the function by setting Underlying to the correct type. -func (u Universe) Function(n Name) *Type { - return u.Package(n.Package).Function(n.Name) -} - -// Variable returns the canonical variable for the given fully-qualified name. -// If a non-existing variable is requested, this will create (a marker for) it. -// If a marker is created, it's the caller's responsibility to finish -// construction of the variable by setting Underlying to the correct type. -func (u Universe) Variable(n Name) *Type { - return u.Package(n.Package).Variable(n.Name) -} - -// Constant returns the canonical constant for the given fully-qualified name. -// If a non-existing constant is requested, this will create (a marker for) it. -// If a marker is created, it's the caller's responsibility to finish -// construction of the constant by setting Underlying to the correct type. -func (u Universe) Constant(n Name) *Type { - return u.Package(n.Package).Constant(n.Name) -} - -// AddImports registers import lines for packageName. May be called multiple times. -// You are responsible for canonicalizing all package paths. -func (u Universe) AddImports(packagePath string, importPaths ...string) { - p := u.Package(packagePath) - for _, i := range importPaths { - p.Imports[i] = u.Package(i) - } -} - -// Package returns the Package for the given path. -// If a non-existing package is requested, this will create (a marker for) it. -// If a marker is created, it's the caller's responsibility to finish -// construction of the package. -func (u Universe) Package(packagePath string) *Package { - if p, ok := u[packagePath]; ok { - return p - } - p := &Package{ - Path: packagePath, - Types: map[string]*Type{}, - Functions: map[string]*Type{}, - Variables: map[string]*Type{}, - Constants: map[string]*Type{}, - Imports: map[string]*Package{}, - } - u[packagePath] = p - return p -} - -// Type represents a subset of possible go types. -type Type struct { - // There are two general categories of types, those explicitly named - // and those anonymous. Named ones will have a non-empty package in the - // name field. - // - // An exception: If Kind == DeclarationOf, then this name is the name of a - // top-level function, variable, or const, and the type can be found in Underlying. - // We do this to allow the naming system to work against these objects, even - // though they aren't strictly speaking types. - Name Name - - // The general kind of this type. - Kind Kind - - // If there are comment lines immediately before the type definition, - // they will be recorded here. - CommentLines []string - - // If there are comment lines preceding the `CommentLines`, they will be - // recorded here. There are two cases: - // --- - // SecondClosestCommentLines - // a blank line - // CommentLines - // type definition - // --- - // - // or - // --- - // SecondClosestCommentLines - // a blank line - // type definition - // --- - SecondClosestCommentLines []string - - // If Kind == Struct - Members []Member - - // If Kind == Map, Slice, Pointer, or Chan - Elem *Type - - // If Kind == Map, this is the map's key type. - Key *Type - - // If Kind == Alias, this is the underlying type. - // If Kind == DeclarationOf, this is the type of the declaration. - Underlying *Type - - // If Kind == Interface, this is the set of all required functions. - // Otherwise, if this is a named type, this is the list of methods that - // type has. (All elements will have Kind=="Func") - Methods map[string]*Type - - // If Kind == func, this is the signature of the function. - Signature *Signature - - // ConstValue contains a stringified constant value if - // Kind == DeclarationOf and this is a constant value - // declaration. For string constants, this field contains - // the entire, un-quoted value. For other types, it contains - // a human-readable literal. - ConstValue *string - - // TODO: Add: - // * channel direction - - // If Kind == Array - Len int64 -} - -// String returns the name of the type. -func (t *Type) String() string { - return t.Name.String() -} - -// IsPrimitive returns whether the type is a built-in type or is an alias to a -// built-in type. For example: strings and aliases of strings are primitives, -// structs are not. -func (t *Type) IsPrimitive() bool { - if t.Kind == Builtin || (t.Kind == Alias && t.Underlying.Kind == Builtin) { - return true - } - return false -} - -// IsAssignable returns whether the type is deep-assignable. For example, -// slices and maps and pointers are shallow copies, but ints and strings are -// complete. -func (t *Type) IsAssignable() bool { - if t.IsPrimitive() { - return true - } - if t.Kind == Struct { - for _, m := range t.Members { - if !m.Type.IsAssignable() { - return false - } - } - return true - } - return false -} - -// IsAnonymousStruct returns true if the type is an anonymous struct or an alias -// to an anonymous struct. -func (t *Type) IsAnonymousStruct() bool { - return (t.Kind == Struct && t.Name.Name == "struct{}") || (t.Kind == Alias && t.Underlying.IsAnonymousStruct()) -} - -// A single struct member -type Member struct { - // The name of the member. - Name string - - // If the member is embedded (anonymous) this will be true, and the - // Name will be the type name. - Embedded bool - - // If there are comment lines immediately before the member in the type - // definition, they will be recorded here. - CommentLines []string - - // If there are tags along with this member, they will be saved here. - Tags string - - // The type of this member. - Type *Type -} - -// String returns the name and type of the member. -func (m Member) String() string { - return m.Name + " " + m.Type.String() -} - -// Signature is a function's signature. -type Signature struct { - // If a method of some type, this is the type it's a member of. - Receiver *Type - Parameters []*Type - ParameterNames []string - Results []*Type - ResultNames []string - - // True if the last in parameter is of the form ...T. - Variadic bool - - // If there are comment lines immediately before this - // signature/method/function declaration, they will be recorded here. - CommentLines []string -} - -// Built in types. -var ( - String = &Type{ - Name: Name{Name: "string"}, - Kind: Builtin, - } - Int64 = &Type{ - Name: Name{Name: "int64"}, - Kind: Builtin, - } - Int32 = &Type{ - Name: Name{Name: "int32"}, - Kind: Builtin, - } - Int16 = &Type{ - Name: Name{Name: "int16"}, - Kind: Builtin, - } - Int = &Type{ - Name: Name{Name: "int"}, - Kind: Builtin, - } - Uint64 = &Type{ - Name: Name{Name: "uint64"}, - Kind: Builtin, - } - Uint32 = &Type{ - Name: Name{Name: "uint32"}, - Kind: Builtin, - } - Uint16 = &Type{ - Name: Name{Name: "uint16"}, - Kind: Builtin, - } - Uint = &Type{ - Name: Name{Name: "uint"}, - Kind: Builtin, - } - Uintptr = &Type{ - Name: Name{Name: "uintptr"}, - Kind: Builtin, - } - Float64 = &Type{ - Name: Name{Name: "float64"}, - Kind: Builtin, - } - Float32 = &Type{ - Name: Name{Name: "float32"}, - Kind: Builtin, - } - Float = &Type{ - Name: Name{Name: "float"}, - Kind: Builtin, - } - Bool = &Type{ - Name: Name{Name: "bool"}, - Kind: Builtin, - } - Byte = &Type{ - Name: Name{Name: "byte"}, - Kind: Builtin, - } - - builtins = &Package{ - Types: map[string]*Type{ - "bool": Bool, - "string": String, - "int": Int, - "int64": Int64, - "int32": Int32, - "int16": Int16, - "int8": Byte, - "uint": Uint, - "uint64": Uint64, - "uint32": Uint32, - "uint16": Uint16, - "uint8": Byte, - "uintptr": Uintptr, - "byte": Byte, - "float": Float, - "float64": Float64, - "float32": Float32, - }, - Imports: map[string]*Package{}, - Path: "", - Name: "", - } -) - -func IsInteger(t *Type) bool { - switch t { - case Int, Int64, Int32, Int16, Uint, Uint64, Uint32, Uint16, Byte: - return true - default: - return false - } -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 29f51406c69..31ab50bd04c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -195,9 +195,6 @@ github.com/VividCortex/ewma # github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d ## explicit github.com/acarl005/stripansi -# github.com/alvaroloes/enumer v1.1.2 -## explicit; go 1.12 -github.com/alvaroloes/enumer # github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220418222510-f25a4f6275ed ## explicit; go 1.16 github.com/antlr/antlr4/runtime/Go/antlr @@ -563,9 +560,6 @@ github.com/evanphx/json-patch # github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f ## explicit; go 1.15 github.com/exponent-io/jsonpath -# github.com/fatih/color v1.15.0 -## explicit; go 1.17 -github.com/fatih/color # github.com/felixge/httpsnoop v1.0.4 ## explicit; go 1.13 github.com/felixge/httpsnoop @@ -584,10 +578,6 @@ github.com/gabriel-vasile/mimetype/internal/magic # github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 ## explicit github.com/ghodss/yaml -# github.com/go-bindata/go-bindata v3.1.2+incompatible -## explicit -github.com/go-bindata/go-bindata -github.com/go-bindata/go-bindata/go-bindata # github.com/go-chi/chi/v5 v5.0.8 ## explicit; go 1.14 github.com/go-chi/chi/v5 @@ -663,9 +653,6 @@ github.com/go-task/slim-sprig # github.com/go-test/deep v1.1.0 ## explicit; go 1.16 github.com/go-test/deep -# github.com/gobuffalo/flect v0.2.5 -## explicit; go 1.13 -github.com/gobuffalo/flect # github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466 ## explicit; go 1.12 github.com/godbus/dbus/v5 @@ -688,7 +675,6 @@ github.com/golang/groupcache/lru # github.com/golang/mock v1.6.0 ## explicit; go 1.11 github.com/golang/mock/gomock -github.com/golang/mock/mockgen github.com/golang/mock/mockgen/model # github.com/golang/protobuf v1.5.3 ## explicit; go 1.9 @@ -796,10 +782,6 @@ github.com/itchyny/gojq/cli # github.com/itchyny/timefmt-go v0.1.5 ## explicit; go 1.17 github.com/itchyny/timefmt-go -# github.com/jewzaam/go-cosmosdb v0.0.0-20240723075448-058185e3c66d -## explicit; go 1.18 -github.com/jewzaam/go-cosmosdb/cmd/gencosmosdb -github.com/jewzaam/go-cosmosdb/pkg/gencosmosdb # github.com/jinzhu/copier v0.4.0 ## explicit; go 1.13 github.com/jinzhu/copier @@ -860,9 +842,6 @@ github.com/mailru/easyjson/jwriter github.com/manifoldco/promptui github.com/manifoldco/promptui/list github.com/manifoldco/promptui/screenbuf -# github.com/mattn/go-colorable v0.1.13 -## explicit; go 1.15 -github.com/mattn/go-colorable # github.com/mattn/go-isatty v0.0.20 ## explicit; go 1.15 github.com/mattn/go-isatty @@ -1218,9 +1197,6 @@ github.com/openshift/machine-config-operator/pkg/generated/clientset/versioned/t ## explicit github.com/ostreedev/ostree-go/pkg/glibobject github.com/ostreedev/ostree-go/pkg/otbuiltin -# github.com/pascaldekloe/name v0.0.0-20180628100202-0fd16699aae1 -## explicit -github.com/pascaldekloe/name # github.com/peterbourgon/diskv v2.0.1+incompatible ## explicit github.com/peterbourgon/diskv @@ -1461,9 +1437,6 @@ golang.org/x/exp/maps golang.org/x/exp/slices # golang.org/x/mod v0.17.0 ## explicit; go 1.18 -golang.org/x/mod/internal/lazyregexp -golang.org/x/mod/modfile -golang.org/x/mod/module golang.org/x/mod/semver # golang.org/x/net v0.28.0 ## explicit; go 1.18 @@ -1529,7 +1502,6 @@ golang.org/x/text/width golang.org/x/time/rate # golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d ## explicit; go 1.19 -golang.org/x/tools/cmd/goimports golang.org/x/tools/cmd/stringer golang.org/x/tools/cover golang.org/x/tools/go/ast/astutil @@ -1538,7 +1510,6 @@ golang.org/x/tools/go/gcexportdata golang.org/x/tools/go/internal/packagesdriver golang.org/x/tools/go/packages golang.org/x/tools/go/types/objectpath -golang.org/x/tools/imports golang.org/x/tools/internal/aliases golang.org/x/tools/internal/event golang.org/x/tools/internal/event/core @@ -1546,8 +1517,6 @@ golang.org/x/tools/internal/event/keys golang.org/x/tools/internal/event/label golang.org/x/tools/internal/gcimporter golang.org/x/tools/internal/gocommand -golang.org/x/tools/internal/gopathwalk -golang.org/x/tools/internal/imports golang.org/x/tools/internal/packagesinternal golang.org/x/tools/internal/pkgbits golang.org/x/tools/internal/stdlib @@ -2120,18 +2089,6 @@ k8s.io/client-go/util/jsonpath k8s.io/client-go/util/keyutil k8s.io/client-go/util/retry k8s.io/client-go/util/workqueue -# k8s.io/code-generator v0.25.16 => k8s.io/code-generator v0.25.16 -## explicit; go 1.19 -k8s.io/code-generator/cmd/client-gen -k8s.io/code-generator/cmd/client-gen/args -k8s.io/code-generator/cmd/client-gen/generators -k8s.io/code-generator/cmd/client-gen/generators/fake -k8s.io/code-generator/cmd/client-gen/generators/scheme -k8s.io/code-generator/cmd/client-gen/generators/util -k8s.io/code-generator/cmd/client-gen/path -k8s.io/code-generator/cmd/client-gen/types -k8s.io/code-generator/pkg/namer -k8s.io/code-generator/pkg/util # k8s.io/component-base v0.26.2 => k8s.io/component-base v0.25.16 ## explicit; go 1.19 k8s.io/component-base/config @@ -2141,13 +2098,6 @@ k8s.io/component-base/metrics k8s.io/component-base/metrics/legacyregistry k8s.io/component-base/metrics/prometheusextension k8s.io/component-base/version -# k8s.io/gengo v0.0.0-20211129171323-c02415ce4185 -## explicit; go 1.13 -k8s.io/gengo/args -k8s.io/gengo/generator -k8s.io/gengo/namer -k8s.io/gengo/parser -k8s.io/gengo/types # k8s.io/klog/v2 v2.130.1 ## explicit; go 1.18 k8s.io/klog/v2 @@ -2261,22 +2211,6 @@ sigs.k8s.io/controller-runtime/pkg/webhook sigs.k8s.io/controller-runtime/pkg/webhook/admission sigs.k8s.io/controller-runtime/pkg/webhook/conversion sigs.k8s.io/controller-runtime/pkg/webhook/internal/metrics -# sigs.k8s.io/controller-tools v0.9.0 => sigs.k8s.io/controller-tools v0.9.0 -## explicit; go 1.17 -sigs.k8s.io/controller-tools/cmd/controller-gen -sigs.k8s.io/controller-tools/pkg/crd -sigs.k8s.io/controller-tools/pkg/crd/markers -sigs.k8s.io/controller-tools/pkg/deepcopy -sigs.k8s.io/controller-tools/pkg/genall -sigs.k8s.io/controller-tools/pkg/genall/help -sigs.k8s.io/controller-tools/pkg/genall/help/pretty -sigs.k8s.io/controller-tools/pkg/loader -sigs.k8s.io/controller-tools/pkg/markers -sigs.k8s.io/controller-tools/pkg/rbac -sigs.k8s.io/controller-tools/pkg/schemapatcher -sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml -sigs.k8s.io/controller-tools/pkg/version -sigs.k8s.io/controller-tools/pkg/webhook # sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd ## explicit; go 1.18 sigs.k8s.io/json @@ -2399,7 +2333,6 @@ tags.cncf.io/container-device-interface/pkg/parser # k8s.io/kubectl => k8s.io/kubectl v0.25.16 # k8s.io/kubernetes => k8s.io/kubernetes v1.25.16 # sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.11.2 -# sigs.k8s.io/controller-tools => sigs.k8s.io/controller-tools v0.9.0 # sigs.k8s.io/kustomize/api => sigs.k8s.io/kustomize/api v0.11.2 # sigs.k8s.io/kustomize/kyaml => sigs.k8s.io/kustomize/kyaml v0.13.3 # sigs.k8s.io/structured-merge-diff => sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06 diff --git a/vendor/sigs.k8s.io/controller-tools/LICENSE b/vendor/sigs.k8s.io/controller-tools/LICENSE deleted file mode 100644 index 8dada3edaf5..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go b/vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go deleted file mode 100644 index 692b26c8da1..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go +++ /dev/null @@ -1,263 +0,0 @@ -/* -Copyright 2018 The Kubernetes 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 main - -import ( - "encoding/json" - "fmt" - "io" - "os" - "strings" - - "github.com/spf13/cobra" - - "sigs.k8s.io/controller-tools/pkg/crd" - "sigs.k8s.io/controller-tools/pkg/deepcopy" - "sigs.k8s.io/controller-tools/pkg/genall" - "sigs.k8s.io/controller-tools/pkg/genall/help" - prettyhelp "sigs.k8s.io/controller-tools/pkg/genall/help/pretty" - "sigs.k8s.io/controller-tools/pkg/markers" - "sigs.k8s.io/controller-tools/pkg/rbac" - "sigs.k8s.io/controller-tools/pkg/schemapatcher" - "sigs.k8s.io/controller-tools/pkg/version" - "sigs.k8s.io/controller-tools/pkg/webhook" -) - -//go:generate go run ../helpgen/main.go paths=../../pkg/... generate:headerFile=../../boilerplate.go.txt,year=2019 - -// Options are specified to controller-gen by turning generators and output rules into -// markers, and then parsing them using the standard registry logic (without the "+"). -// Each marker and output rule should thus be usable as a marker target. - -var ( - // allGenerators maintains the list of all known generators, giving - // them names for use on the command line. - // each turns into a command line option, - // and has options for output forms. - allGenerators = map[string]genall.Generator{ - "crd": crd.Generator{}, - "rbac": rbac.Generator{}, - "object": deepcopy.Generator{}, - "webhook": webhook.Generator{}, - "schemapatch": schemapatcher.Generator{}, - } - - // allOutputRules defines the list of all known output rules, giving - // them names for use on the command line. - // Each output rule turns into two command line options: - // - output::
(per-generator output) - // - output: (default output) - allOutputRules = map[string]genall.OutputRule{ - "dir": genall.OutputToDirectory(""), - "none": genall.OutputToNothing, - "stdout": genall.OutputToStdout, - "artifacts": genall.OutputArtifacts{}, - } - - // optionsRegistry contains all the marker definitions used to process command line options - optionsRegistry = &markers.Registry{} -) - -func init() { - for genName, gen := range allGenerators { - // make the generator options marker itself - defn := markers.Must(markers.MakeDefinition(genName, markers.DescribesPackage, gen)) - if err := optionsRegistry.Register(defn); err != nil { - panic(err) - } - if helpGiver, hasHelp := gen.(genall.HasHelp); hasHelp { - if help := helpGiver.Help(); help != nil { - optionsRegistry.AddHelp(defn, help) - } - } - - // make per-generation output rule markers - for ruleName, rule := range allOutputRules { - ruleMarker := markers.Must(markers.MakeDefinition(fmt.Sprintf("output:%s:%s", genName, ruleName), markers.DescribesPackage, rule)) - if err := optionsRegistry.Register(ruleMarker); err != nil { - panic(err) - } - if helpGiver, hasHelp := rule.(genall.HasHelp); hasHelp { - if help := helpGiver.Help(); help != nil { - optionsRegistry.AddHelp(ruleMarker, help) - } - } - } - } - - // make "default output" output rule markers - for ruleName, rule := range allOutputRules { - ruleMarker := markers.Must(markers.MakeDefinition("output:"+ruleName, markers.DescribesPackage, rule)) - if err := optionsRegistry.Register(ruleMarker); err != nil { - panic(err) - } - if helpGiver, hasHelp := rule.(genall.HasHelp); hasHelp { - if help := helpGiver.Help(); help != nil { - optionsRegistry.AddHelp(ruleMarker, help) - } - } - } - - // add in the common options markers - if err := genall.RegisterOptionsMarkers(optionsRegistry); err != nil { - panic(err) - } -} - -// noUsageError suppresses usage printing when it occurs -// (since cobra doesn't provide a good way to avoid printing -// out usage in only certain situations). -type noUsageError struct{ error } - -func main() { - helpLevel := 0 - whichLevel := 0 - showVersion := false - - cmd := &cobra.Command{ - Use: "controller-gen", - Short: "Generate Kubernetes API extension resources and code.", - Long: "Generate Kubernetes API extension resources and code.", - Example: ` # Generate RBAC manifests and crds for all types under apis/, - # outputting crds to /tmp/crds and everything else to stdout - controller-gen rbac:roleName= crd paths=./apis/... output:crd:dir=/tmp/crds output:stdout - - # Generate deepcopy/runtime.Object implementations for a particular file - controller-gen object paths=./apis/v1beta1/some_types.go - - # Generate OpenAPI v3 schemas for API packages and merge them into existing CRD manifests - controller-gen schemapatch:manifests=./manifests output:dir=./manifests paths=./pkg/apis/... - - # Run all the generators for a given project - controller-gen paths=./apis/... - - # Explain the markers for generating CRDs, and their arguments - controller-gen crd -ww -`, - RunE: func(c *cobra.Command, rawOpts []string) error { - // print version if asked for it - if showVersion { - version.Print() - return nil - } - - // print the help if we asked for it (since we've got a different help flag :-/), then bail - if helpLevel > 0 { - return c.Usage() - } - - // print the marker docs if we asked for them, then bail - if whichLevel > 0 { - return printMarkerDocs(c, rawOpts, whichLevel) - } - - // otherwise, set up the runtime for actually running the generators - rt, err := genall.FromOptions(optionsRegistry, rawOpts) - if err != nil { - return err - } - if len(rt.Generators) == 0 { - return fmt.Errorf("no generators specified") - } - - if hadErrs := rt.Run(); hadErrs { - // don't obscure the actual error with a bunch of usage - return noUsageError{fmt.Errorf("not all generators ran successfully")} - } - return nil - }, - SilenceUsage: true, // silence the usage, then print it out ourselves if it wasn't suppressed - } - cmd.Flags().CountVarP(&whichLevel, "which-markers", "w", "print out all markers available with the requested generators\n(up to -www for the most detailed output, or -wwww for json output)") - cmd.Flags().CountVarP(&helpLevel, "detailed-help", "h", "print out more detailed help\n(up to -hhh for the most detailed output, or -hhhh for json output)") - cmd.Flags().BoolVar(&showVersion, "version", false, "show version") - cmd.Flags().Bool("help", false, "print out usage and a summary of options") - oldUsage := cmd.UsageFunc() - cmd.SetUsageFunc(func(c *cobra.Command) error { - if err := oldUsage(c); err != nil { - return err - } - if helpLevel == 0 { - helpLevel = summaryHelp - } - fmt.Fprintf(c.OutOrStderr(), "\n\nOptions\n\n") - return helpForLevels(c.OutOrStdout(), c.OutOrStderr(), helpLevel, optionsRegistry, help.SortByOption) - }) - - if err := cmd.Execute(); err != nil { - if _, noUsage := err.(noUsageError); !noUsage { - // print the usage unless we suppressed it - if err := cmd.Usage(); err != nil { - panic(err) - } - } - fmt.Fprintf(cmd.OutOrStderr(), "run `%[1]s %[2]s -w` to see all available markers, or `%[1]s %[2]s -h` for usage\n", cmd.CalledAs(), strings.Join(os.Args[1:], " ")) - os.Exit(1) - } -} - -// printMarkerDocs prints out marker help for the given generators specified in -// the rawOptions, at the given level. -func printMarkerDocs(c *cobra.Command, rawOptions []string, whichLevel int) error { - // just grab a registry so we don't lag while trying to load roots - // (like we'd do if we just constructed the full runtime). - reg, err := genall.RegistryFromOptions(optionsRegistry, rawOptions) - if err != nil { - return err - } - - return helpForLevels(c.OutOrStdout(), c.OutOrStderr(), whichLevel, reg, help.SortByCategory) -} - -func helpForLevels(mainOut io.Writer, errOut io.Writer, whichLevel int, reg *markers.Registry, sorter help.SortGroup) error { - helpInfo := help.ByCategory(reg, sorter) - switch whichLevel { - case jsonHelp: - if err := json.NewEncoder(mainOut).Encode(helpInfo); err != nil { - return err - } - case detailedHelp, fullHelp: - fullDetail := whichLevel == fullHelp - for _, cat := range helpInfo { - if cat.Category == "" { - continue - } - contents := prettyhelp.MarkersDetails(fullDetail, cat.Category, cat.Markers) - if err := contents.WriteTo(errOut); err != nil { - return err - } - } - case summaryHelp: - for _, cat := range helpInfo { - if cat.Category == "" { - continue - } - contents := prettyhelp.MarkersSummary(cat.Category, cat.Markers) - if err := contents.WriteTo(errOut); err != nil { - return err - } - } - } - return nil -} - -const ( - _ = iota - summaryHelp - detailedHelp - fullHelp - jsonHelp -) diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/conv.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/conv.go deleted file mode 100644 index 374e02c373b..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/conv.go +++ /dev/null @@ -1,43 +0,0 @@ -package crd - -import ( - "fmt" - - apiextinternal "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" - apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - apiextv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -var ( - conversionScheme = runtime.NewScheme() -) - -func init() { - if err := apiextinternal.AddToScheme(conversionScheme); err != nil { - panic("must be able to add internal apiextensions to the CRD conversion Scheme") - } - if err := apiext.AddToScheme(conversionScheme); err != nil { - panic("must be able to add apiextensions/v1 to the CRD conversion Scheme") - } -} - -// AsVersion converts a CRD from the canonical internal form (currently v1) to some external form. -func AsVersion(original apiext.CustomResourceDefinition, gv schema.GroupVersion) (runtime.Object, error) { - // TODO: Do we need to keep maintaining this conversion function - // post 1.22 when only CRDv1 is served by the apiserver? - if gv == apiextv1beta1.SchemeGroupVersion { - return nil, fmt.Errorf("apiVersion %q is not supported", gv.String()) - } - // We can use the internal versions an existing conversions from kubernetes, since they're not in k/k itself. - // This punts the problem of conversion down the road for a future maintainer (or future instance of @directxman12) - // when we have to support older versions that get removed, or when API machinery decides to yell at us for this - // questionable decision. - intVer, err := conversionScheme.ConvertToVersion(&original, apiextinternal.SchemeGroupVersion) - if err != nil { - return nil, fmt.Errorf("unable to convert to internal CRD version: %w", err) - } - - return conversionScheme.ConvertToVersion(intVer, gv) -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/desc_visitor.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/desc_visitor.go deleted file mode 100644 index cba36c46cb4..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/desc_visitor.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 crd - -import ( - "strings" - "unicode" - - apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" -) - -// TruncateDescription truncates the description of fields in given schema if it -// exceeds maxLen. -// It tries to chop off the description at the closest sentence boundary. -func TruncateDescription(schema *apiext.JSONSchemaProps, maxLen int) { - EditSchema(schema, descVisitor{maxLen: maxLen}) -} - -// descVisitor recursively visits all fields in the schema and truncates the -// description of the fields to specified maxLen. -type descVisitor struct { - // maxLen is the maximum allowed length for decription of a field - maxLen int -} - -func (v descVisitor) Visit(schema *apiext.JSONSchemaProps) SchemaVisitor { - if schema == nil { - return v - } - if v.maxLen < 0 { - return nil /* no further work to be done for this schema */ - } - if v.maxLen == 0 { - schema.Description = "" - return v - } - if len(schema.Description) > v.maxLen { - schema.Description = truncateString(schema.Description, v.maxLen) - return v - } - return v -} - -// truncateString truncates given desc string if it exceeds maxLen. It may -// return string with length less than maxLen even in cases where original desc -// exceeds maxLen because it tries to chop off the desc at the closest sentence -// boundary to avoid incomplete sentences. -func truncateString(desc string, maxLen int) string { - desc = desc[0:maxLen] - - // Trying to chop off at closest sentence boundary. - if n := strings.LastIndexFunc(desc, isSentenceTerminal); n > 0 { - return desc[0 : n+1] - } - // TODO(droot): Improve the logic to chop off at closest word boundary - // or add elipses (...) to indicate that it's chopped incase no closest - // sentence found within maxLen. - return desc -} - -// helper function to determine if given rune is a sentence terminal or not. -func isSentenceTerminal(r rune) bool { - return unicode.Is(unicode.STerm, r) -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/doc.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/doc.go deleted file mode 100644 index fd48e44aecd..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/doc.go +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 crd contains utilities for generating CustomResourceDefinitions and -// their corresponding OpenAPI validation schemata. -// -// Markers -// -// Markers live under the markers subpackage. Two types of markers exist: -// those that modify schema generation (for validation), and those that modify -// the rest of the CRD. See the subpackage for more information and all -// supported markers. -// -// Collecting Types and Generating CRDs -// -// The Parser is the entrypoint for collecting the information required to -// generate CRDs. Like loader and collector, its methods are idemptotent, not -// doing extra work if called multiple times. -// -// Parser's method start with Need. Calling NeedXYZ indicates that XYZ should -// be made present in the eqivalent field in the Parser, where it can then be -// loaded from. Each Need method will in turn call Need on anything it needs. -// -// In general, root packages should first be loaded into the Parser with -// NeedPackage. Then, CRDs can be generated with NeedCRDFor. -// -// Errors are generally attached directly to the relevant Package with -// AddError. -// -// Known Packages -// -// There are a few types from Kubernetes that have special meaning, but don't -// have validation markers attached. Those specific types have overrides -// listed in KnownPackages that can be added as overrides to any parser. -// -// Flattening -// -// Once schemata are generated, they can be used directly by external tooling -// (like JSONSchema validators), but must first be "flattened" to not contain -// references before use in a CRD (Kubernetes doesn't allow references in the -// CRD's validation schema). -// -// The Flattener built in to the Parser takes care of flattening out references -// when requesting the CRDs, but can be invoked manually. It will not modify -// the input schemata. -// -// Flattened schemata may further be passed to FlattenEmbedded to remove the -// use of AllOf (which is used to describe embedded struct fields when -// references are in use). This done automatically when fetching CRDs. -package crd diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/flatten.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/flatten.go deleted file mode 100644 index 00f4dc4c7d8..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/flatten.go +++ /dev/null @@ -1,441 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 crd - -import ( - "fmt" - "reflect" - "sort" - "strings" - "sync" - - apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - - "sigs.k8s.io/controller-tools/pkg/loader" -) - -// ErrorRecorder knows how to record errors. It wraps the part of -// pkg/loader.Package that we need to record errors in places were it might not -// make sense to have a loader.Package -type ErrorRecorder interface { - // AddError records that the given error occurred. - // See the documentation on loader.Package.AddError for more information. - AddError(error) -} - -// isOrNil checks if val is nil if val is of a nillable type, otherwise, -// it compares val to valInt (which should probably be the zero value). -func isOrNil(val reflect.Value, valInt interface{}, zeroInt interface{}) bool { - switch valKind := val.Kind(); valKind { - case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return val.IsNil() - default: - return valInt == zeroInt - } -} - -// flattenAllOfInto copies properties from src to dst, then copies the properties -// of each item in src's allOf to dst's properties as well. -func flattenAllOfInto(dst *apiext.JSONSchemaProps, src apiext.JSONSchemaProps, errRec ErrorRecorder) { - if len(src.AllOf) > 0 { - for _, embedded := range src.AllOf { - flattenAllOfInto(dst, embedded, errRec) - } - } - - dstVal := reflect.Indirect(reflect.ValueOf(dst)) - srcVal := reflect.ValueOf(src) - typ := dstVal.Type() - - srcRemainder := apiext.JSONSchemaProps{} - srcRemVal := reflect.Indirect(reflect.ValueOf(&srcRemainder)) - dstRemainder := apiext.JSONSchemaProps{} - dstRemVal := reflect.Indirect(reflect.ValueOf(&dstRemainder)) - hoisted := false - - for i := 0; i < srcVal.NumField(); i++ { - fieldName := typ.Field(i).Name - switch fieldName { - case "AllOf": - // don't merge because we deal with it above - continue - case "Title", "Description", "Example", "ExternalDocs": - // don't merge because we pre-merge to properly preserve field docs - continue - } - srcField := srcVal.Field(i) - fldTyp := srcField.Type() - zeroVal := reflect.Zero(fldTyp) - zeroInt := zeroVal.Interface() - srcInt := srcField.Interface() - - if isOrNil(srcField, srcInt, zeroInt) { - // nothing to copy from src, continue - continue - } - - dstField := dstVal.Field(i) - dstInt := dstField.Interface() - if isOrNil(dstField, dstInt, zeroInt) { - // dst is empty, continue - dstField.Set(srcField) - continue - } - - if fldTyp.Comparable() && srcInt == dstInt { - // same value, continue - continue - } - - // resolve conflict - switch fieldName { - case "Properties": - // merge if possible, use all of otherwise - srcMap := srcInt.(map[string]apiext.JSONSchemaProps) - dstMap := dstInt.(map[string]apiext.JSONSchemaProps) - - for k, v := range srcMap { - dstProp, exists := dstMap[k] - if !exists { - dstMap[k] = v - continue - } - flattenAllOfInto(&dstProp, v, errRec) - dstMap[k] = dstProp - } - case "Required": - // merge - dstField.Set(reflect.AppendSlice(dstField, srcField)) - case "Type": - if srcInt != dstInt { - // TODO(directxman12): figure out how to attach this back to a useful point in the Go source or in the schema - errRec.AddError(fmt.Errorf("conflicting types in allOf branches in schema: %s vs %s", dstInt, srcInt)) - } - // keep the destination value, for now - // TODO(directxman12): Default -- use field? - // TODO(directxman12): - // - Dependencies: if field x is present, then either schema validates or all props are present - // - AdditionalItems: like AdditionalProperties - // - Definitions: common named validation sets that can be references (merge, bail if duplicate) - case "AdditionalProperties": - // as of the time of writing, `allows: false` is not allowed, so we don't have to handle it - srcProps := srcInt.(*apiext.JSONSchemaPropsOrBool) - if srcProps.Schema == nil { - // nothing to merge - continue - } - dstProps := dstInt.(*apiext.JSONSchemaPropsOrBool) - if dstProps.Schema == nil { - dstProps.Schema = &apiext.JSONSchemaProps{} - } - flattenAllOfInto(dstProps.Schema, *srcProps.Schema, errRec) - // NB(directxman12): no need to explicitly handle nullable -- false is considered to be the zero value - // TODO(directxman12): src isn't necessarily the field value -- it's just the most recent allOf entry - default: - // hoist into allOf... - hoisted = true - - srcRemVal.Field(i).Set(srcField) - dstRemVal.Field(i).Set(dstField) - // ...and clear the original - dstField.Set(zeroVal) - } - } - - if hoisted { - dst.AllOf = append(dst.AllOf, dstRemainder, srcRemainder) - } - - // dedup required - if len(dst.Required) > 0 { - reqUniq := make(map[string]struct{}) - for _, req := range dst.Required { - reqUniq[req] = struct{}{} - } - dst.Required = make([]string, 0, len(reqUniq)) - for req := range reqUniq { - dst.Required = append(dst.Required, req) - } - // be deterministic - sort.Strings(dst.Required) - } -} - -// allOfVisitor recursively visits allOf fields in the schema, -// merging nested allOf properties into the root schema. -type allOfVisitor struct { - // errRec is used to record errors while flattening (like two conflicting - // field values used in an allOf) - errRec ErrorRecorder -} - -func (v *allOfVisitor) Visit(schema *apiext.JSONSchemaProps) SchemaVisitor { - if schema == nil { - return v - } - - // clear this now so that we can safely preserve edits made my flattenAllOfInto - origAllOf := schema.AllOf - schema.AllOf = nil - - for _, embedded := range origAllOf { - flattenAllOfInto(schema, embedded, v.errRec) - } - return v -} - -// NB(directxman12): FlattenEmbedded is separate from Flattener because -// some tooling wants to flatten out embedded fields, but only actually -// flatten a few specific types first. - -// FlattenEmbedded flattens embedded fields (represented via AllOf) which have -// already had their references resolved into simple properties in the containing -// schema. -func FlattenEmbedded(schema *apiext.JSONSchemaProps, errRec ErrorRecorder) *apiext.JSONSchemaProps { - outSchema := schema.DeepCopy() - EditSchema(outSchema, &allOfVisitor{errRec: errRec}) - return outSchema -} - -// Flattener knows how to take a root type, and flatten all references in it -// into a single, flat type. Flattened types are cached, so it's relatively -// cheap to make repeated calls with the same type. -type Flattener struct { - // Parser is used to lookup package and type details, and parse in new packages. - Parser *Parser - - LookupReference func(ref string, contextPkg *loader.Package) (TypeIdent, error) - - // flattenedTypes hold the flattened version of each seen type for later reuse. - flattenedTypes map[TypeIdent]apiext.JSONSchemaProps - initOnce sync.Once -} - -func (f *Flattener) init() { - f.initOnce.Do(func() { - f.flattenedTypes = make(map[TypeIdent]apiext.JSONSchemaProps) - if f.LookupReference == nil { - f.LookupReference = identFromRef - } - }) -} - -// cacheType saves the flattened version of the given type for later reuse -func (f *Flattener) cacheType(typ TypeIdent, schema apiext.JSONSchemaProps) { - f.init() - f.flattenedTypes[typ] = schema -} - -// loadUnflattenedSchema fetches a fresh, unflattened schema from the parser. -func (f *Flattener) loadUnflattenedSchema(typ TypeIdent) (*apiext.JSONSchemaProps, error) { - f.Parser.NeedSchemaFor(typ) - - baseSchema, found := f.Parser.Schemata[typ] - if !found { - return nil, fmt.Errorf("unable to locate schema for type %s", typ) - } - return &baseSchema, nil -} - -// FlattenType flattens the given pre-loaded type, removing any references from it. -// It deep-copies the schema first, so it won't affect the parser's version of the schema. -func (f *Flattener) FlattenType(typ TypeIdent) *apiext.JSONSchemaProps { - f.init() - if cachedSchema, isCached := f.flattenedTypes[typ]; isCached { - return &cachedSchema - } - baseSchema, err := f.loadUnflattenedSchema(typ) - if err != nil { - typ.Package.AddError(err) - return nil - } - resSchema := f.FlattenSchema(*baseSchema, typ.Package) - f.cacheType(typ, *resSchema) - return resSchema -} - -// FlattenSchema flattens the given schema, removing any references. -// It deep-copies the schema first, so the input schema won't be affected. -func (f *Flattener) FlattenSchema(baseSchema apiext.JSONSchemaProps, currentPackage *loader.Package) *apiext.JSONSchemaProps { - resSchema := baseSchema.DeepCopy() - EditSchema(resSchema, &flattenVisitor{ - Flattener: f, - currentPackage: currentPackage, - }) - - return resSchema -} - -// RefParts splits a reference produced by the schema generator into its component -// type name and package name (if it's a cross-package reference). Note that -// referenced packages *must* be looked up relative to the current package. -func RefParts(ref string) (typ string, pkgName string, err error) { - if !strings.HasPrefix(ref, defPrefix) { - return "", "", fmt.Errorf("non-standard reference link %q", ref) - } - ref = ref[len(defPrefix):] - // decode the json pointer encodings - ref = strings.Replace(ref, "~1", "/", -1) - ref = strings.Replace(ref, "~0", "~", -1) - nameParts := strings.SplitN(ref, "~", 2) - - if len(nameParts) == 1 { - // local reference - return nameParts[0], "", nil - } - // cross-package reference - return nameParts[1], nameParts[0], nil -} - -// identFromRef converts the given schema ref from the given package back -// into the TypeIdent that it represents. -func identFromRef(ref string, contextPkg *loader.Package) (TypeIdent, error) { - typ, pkgName, err := RefParts(ref) - if err != nil { - return TypeIdent{}, err - } - - if pkgName == "" { - // a local reference - return TypeIdent{ - Name: typ, - Package: contextPkg, - }, nil - } - - // an external reference - return TypeIdent{ - Name: typ, - Package: contextPkg.Imports()[pkgName], - }, nil -} - -// preserveFields copies documentation fields from src into dst, preserving -// field-level documentation when flattening, and preserving field-level validation -// as allOf entries. -func preserveFields(dst *apiext.JSONSchemaProps, src apiext.JSONSchemaProps) { - srcDesc := src.Description - srcTitle := src.Title - srcExDoc := src.ExternalDocs - srcEx := src.Example - - src.Description, src.Title, src.ExternalDocs, src.Example = "", "", nil, nil - - src.Ref = nil - *dst = apiext.JSONSchemaProps{ - AllOf: []apiext.JSONSchemaProps{*dst, src}, - - // keep these, in case the source field doesn't specify anything useful - Description: dst.Description, - Title: dst.Title, - ExternalDocs: dst.ExternalDocs, - Example: dst.Example, - } - - if srcDesc != "" { - dst.Description = srcDesc - } - if srcTitle != "" { - dst.Title = srcTitle - } - if srcExDoc != nil { - dst.ExternalDocs = srcExDoc - } - if srcEx != nil { - dst.Example = srcEx - } -} - -// flattenVisitor visits each node in the schema, recursively flattening references. -type flattenVisitor struct { - *Flattener - - currentPackage *loader.Package - currentType *TypeIdent - currentSchema *apiext.JSONSchemaProps - originalField apiext.JSONSchemaProps -} - -func (f *flattenVisitor) Visit(baseSchema *apiext.JSONSchemaProps) SchemaVisitor { - if baseSchema == nil { - // end-of-node marker, cache the results - if f.currentType != nil { - f.cacheType(*f.currentType, *f.currentSchema) - // preserve field information *after* caching so that we don't - // accidentally cache field-level information onto the schema for - // the type in general. - preserveFields(f.currentSchema, f.originalField) - } - return f - } - - // if we get a type that's just a ref, resolve it - if baseSchema.Ref != nil && len(*baseSchema.Ref) > 0 { - // resolve this ref - refIdent, err := f.LookupReference(*baseSchema.Ref, f.currentPackage) - if err != nil { - f.currentPackage.AddError(err) - return nil - } - - // load and potentially flatten the schema - - // check the cache first... - if refSchemaCached, isCached := f.flattenedTypes[refIdent]; isCached { - // shallow copy is fine, it's just to avoid overwriting the doc fields - preserveFields(&refSchemaCached, *baseSchema) - *baseSchema = refSchemaCached - return nil // don't recurse, we're done - } - - // ...otherwise, we need to flatten - refSchema, err := f.loadUnflattenedSchema(refIdent) - if err != nil { - f.currentPackage.AddError(err) - return nil - } - refSchema = refSchema.DeepCopy() - - // keep field around to preserve field-level validation, docs, etc - origField := *baseSchema - *baseSchema = *refSchema - - // avoid loops (which shouldn't exist, but just in case) - // by marking a nil cached pointer before we start recursing - f.cacheType(refIdent, apiext.JSONSchemaProps{}) - - return &flattenVisitor{ - Flattener: f.Flattener, - - currentPackage: refIdent.Package, - currentType: &refIdent, - currentSchema: baseSchema, - originalField: origField, - } - } - - // otherwise, continue recursing... - if f.currentType != nil { - // ...but don't accidentally end this node early (for caching purposes) - return &flattenVisitor{ - Flattener: f.Flattener, - currentPackage: f.currentPackage, - } - } - - return f -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/gen.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/gen.go deleted file mode 100644 index 43293d2a96f..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/gen.go +++ /dev/null @@ -1,293 +0,0 @@ -/* -Copyright 2018 The Kubernetes 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 crd - -import ( - "fmt" - "go/ast" - "go/types" - - apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - - crdmarkers "sigs.k8s.io/controller-tools/pkg/crd/markers" - "sigs.k8s.io/controller-tools/pkg/genall" - "sigs.k8s.io/controller-tools/pkg/loader" - "sigs.k8s.io/controller-tools/pkg/markers" - "sigs.k8s.io/controller-tools/pkg/version" -) - -// The identifier for v1 CustomResourceDefinitions. -const v1 = "v1" - -// The default CustomResourceDefinition version to generate. -const defaultVersion = v1 - -// +controllertools:marker:generateHelp - -// Generator generates CustomResourceDefinition objects. -type Generator struct { - // IgnoreUnexportedFields indicates that we should skip unexported fields. - // - // Left unspecified, the default is false. - IgnoreUnexportedFields *bool `marker:",optional"` - - // AllowDangerousTypes allows types which are usually omitted from CRD generation - // because they are not recommended. - // - // Currently the following additional types are allowed when this is true: - // float32 - // float64 - // - // Left unspecified, the default is false - AllowDangerousTypes *bool `marker:",optional"` - - // MaxDescLen specifies the maximum description length for fields in CRD's OpenAPI schema. - // - // 0 indicates drop the description for all fields completely. - // n indicates limit the description to at most n characters and truncate the description to - // closest sentence boundary if it exceeds n characters. - MaxDescLen *int `marker:",optional"` - - // CRDVersions specifies the target API versions of the CRD type itself to - // generate. Defaults to v1. - // - // Currently, the only supported value is v1. - // - // The first version listed will be assumed to be the "default" version and - // will not get a version suffix in the output filename. - // - // You'll need to use "v1" to get support for features like defaulting, - // along with an API server that supports it (Kubernetes 1.16+). - CRDVersions []string `marker:"crdVersions,optional"` - - // GenerateEmbeddedObjectMeta specifies if any embedded ObjectMeta in the CRD should be generated - GenerateEmbeddedObjectMeta *bool `marker:",optional"` -} - -func (Generator) CheckFilter() loader.NodeFilter { - return filterTypesForCRDs -} -func (Generator) RegisterMarkers(into *markers.Registry) error { - return crdmarkers.Register(into) -} - -// transformRemoveCRDStatus ensures we do not write the CRD status field. -func transformRemoveCRDStatus(obj map[string]interface{}) error { - delete(obj, "status") - return nil -} - -func (g Generator) Generate(ctx *genall.GenerationContext) error { - parser := &Parser{ - Collector: ctx.Collector, - Checker: ctx.Checker, - // Perform defaulting here to avoid ambiguity later - IgnoreUnexportedFields: g.IgnoreUnexportedFields != nil && *g.IgnoreUnexportedFields == true, - AllowDangerousTypes: g.AllowDangerousTypes != nil && *g.AllowDangerousTypes == true, - // Indicates the parser on whether to register the ObjectMeta type or not - GenerateEmbeddedObjectMeta: g.GenerateEmbeddedObjectMeta != nil && *g.GenerateEmbeddedObjectMeta == true, - } - - AddKnownTypes(parser) - for _, root := range ctx.Roots { - parser.NeedPackage(root) - } - - metav1Pkg := FindMetav1(ctx.Roots) - if metav1Pkg == nil { - // no objects in the roots, since nothing imported metav1 - return nil - } - - // TODO: allow selecting a specific object - kubeKinds := FindKubeKinds(parser, metav1Pkg) - if len(kubeKinds) == 0 { - // no objects in the roots - return nil - } - - crdVersions := g.CRDVersions - - if len(crdVersions) == 0 { - crdVersions = []string{defaultVersion} - } - - for groupKind := range kubeKinds { - parser.NeedCRDFor(groupKind, g.MaxDescLen) - crdRaw := parser.CustomResourceDefinitions[groupKind] - addAttribution(&crdRaw) - - // Prevent the top level metadata for the CRD to be generate regardless of the intention in the arguments - FixTopLevelMetadata(crdRaw) - - versionedCRDs := make([]interface{}, len(crdVersions)) - for i, ver := range crdVersions { - conv, err := AsVersion(crdRaw, schema.GroupVersion{Group: apiext.SchemeGroupVersion.Group, Version: ver}) - if err != nil { - return err - } - versionedCRDs[i] = conv - } - - for i, crd := range versionedCRDs { - removeDescriptionFromMetadata(crd.(*apiext.CustomResourceDefinition)) - var fileName string - if i == 0 { - fileName = fmt.Sprintf("%s_%s.yaml", crdRaw.Spec.Group, crdRaw.Spec.Names.Plural) - } else { - fileName = fmt.Sprintf("%s_%s.%s.yaml", crdRaw.Spec.Group, crdRaw.Spec.Names.Plural, crdVersions[i]) - } - if err := ctx.WriteYAML(fileName, []interface{}{crd}, genall.WithTransform(transformRemoveCRDStatus)); err != nil { - return err - } - } - } - - return nil -} - -func removeDescriptionFromMetadata(crd *apiext.CustomResourceDefinition) { - for _, versionSpec := range crd.Spec.Versions { - if versionSpec.Schema != nil { - removeDescriptionFromMetadataProps(versionSpec.Schema.OpenAPIV3Schema) - } - } -} - -func removeDescriptionFromMetadataProps(v *apiext.JSONSchemaProps) { - if m, ok := v.Properties["metadata"]; ok { - meta := &m - if meta.Description != "" { - meta.Description = "" - v.Properties["metadata"] = m - - } - } -} - -// FixTopLevelMetadata resets the schema for the top-level metadata field which is needed for CRD validation -func FixTopLevelMetadata(crd apiext.CustomResourceDefinition) { - for _, v := range crd.Spec.Versions { - if v.Schema != nil && v.Schema.OpenAPIV3Schema != nil && v.Schema.OpenAPIV3Schema.Properties != nil { - schemaProperties := v.Schema.OpenAPIV3Schema.Properties - if _, ok := schemaProperties["metadata"]; ok { - schemaProperties["metadata"] = apiext.JSONSchemaProps{Type: "object"} - } - } - } -} - -// addAttribution adds attribution info to indicate controller-gen tool was used -// to generate this CRD definition along with the version info. -func addAttribution(crd *apiext.CustomResourceDefinition) { - if crd.ObjectMeta.Annotations == nil { - crd.ObjectMeta.Annotations = map[string]string{} - } - crd.ObjectMeta.Annotations["controller-gen.kubebuilder.io/version"] = version.Version() -} - -// FindMetav1 locates the actual package representing metav1 amongst -// the imports of the roots. -func FindMetav1(roots []*loader.Package) *loader.Package { - for _, root := range roots { - pkg := root.Imports()["k8s.io/apimachinery/pkg/apis/meta/v1"] - if pkg != nil { - return pkg - } - } - return nil -} - -// FindKubeKinds locates all types that contain TypeMeta and ObjectMeta -// (and thus may be a Kubernetes object), and returns the corresponding -// group-kinds. -func FindKubeKinds(parser *Parser, metav1Pkg *loader.Package) map[schema.GroupKind]struct{} { - // TODO(directxman12): technically, we should be finding metav1 per-package - kubeKinds := map[schema.GroupKind]struct{}{} - for typeIdent, info := range parser.Types { - hasObjectMeta := false - hasTypeMeta := false - - pkg := typeIdent.Package - pkg.NeedTypesInfo() - typesInfo := pkg.TypesInfo - - for _, field := range info.Fields { - if field.Name != "" { - // type and object meta are embedded, - // so they can't be this - continue - } - - fieldType := typesInfo.TypeOf(field.RawField.Type) - namedField, isNamed := fieldType.(*types.Named) - if !isNamed { - // ObjectMeta and TypeMeta are named types - continue - } - if namedField.Obj().Pkg() == nil { - // Embedded non-builtin universe type (specifically, it's probably `error`), - // so it can't be ObjectMeta or TypeMeta - continue - } - fieldPkgPath := loader.NonVendorPath(namedField.Obj().Pkg().Path()) - fieldPkg := pkg.Imports()[fieldPkgPath] - if fieldPkg != metav1Pkg { - continue - } - - switch namedField.Obj().Name() { - case "ObjectMeta": - hasObjectMeta = true - case "TypeMeta": - hasTypeMeta = true - } - } - - if !hasObjectMeta || !hasTypeMeta { - continue - } - - groupKind := schema.GroupKind{ - Group: parser.GroupVersions[pkg].Group, - Kind: typeIdent.Name, - } - kubeKinds[groupKind] = struct{}{} - } - - return kubeKinds -} - -// filterTypesForCRDs filters out all nodes that aren't used in CRD generation, -// like interfaces and struct fields without JSON tag. -func filterTypesForCRDs(node ast.Node) bool { - switch node := node.(type) { - case *ast.InterfaceType: - // skip interfaces, we never care about references in them - return false - case *ast.StructType: - return true - case *ast.Field: - _, hasTag := loader.ParseAstTag(node.Tag).Lookup("json") - // fields without JSON tags mean we have custom serialization, - // so only visit fields with tags. - return hasTag - default: - return true - } -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/known_types.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/known_types.go deleted file mode 100644 index 7e862cfb17c..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/known_types.go +++ /dev/null @@ -1,179 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 crd - -import ( - apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - - "sigs.k8s.io/controller-tools/pkg/loader" -) - -// KnownPackages overrides types in some comment packages that have custom validation -// but don't have validation markers on them (since they're from core Kubernetes). -var KnownPackages = map[string]PackageOverride{ - "k8s.io/api/core/v1": func(p *Parser, pkg *loader.Package) { - // Explicit defaulting for the corev1.Protocol type in lieu of https://github.com/kubernetes/enhancements/pull/1928 - p.Schemata[TypeIdent{Name: "Protocol", Package: pkg}] = apiext.JSONSchemaProps{ - Type: "string", - Default: &apiext.JSON{Raw: []byte(`"TCP"`)}, - } - p.AddPackage(pkg) - }, - - "k8s.io/apimachinery/pkg/apis/meta/v1": func(p *Parser, pkg *loader.Package) { - p.Schemata[TypeIdent{Name: "ObjectMeta", Package: pkg}] = apiext.JSONSchemaProps{ - Type: "object", - } - p.Schemata[TypeIdent{Name: "Time", Package: pkg}] = apiext.JSONSchemaProps{ - Type: "string", - Format: "date-time", - } - p.Schemata[TypeIdent{Name: "MicroTime", Package: pkg}] = apiext.JSONSchemaProps{ - Type: "string", - Format: "date-time", - } - p.Schemata[TypeIdent{Name: "Duration", Package: pkg}] = apiext.JSONSchemaProps{ - // TODO(directxman12): regexp validation for this (or get kube to support it as a format value) - Type: "string", - } - p.Schemata[TypeIdent{Name: "Fields", Package: pkg}] = apiext.JSONSchemaProps{ - // this is a recursive structure that can't be flattened or, for that matter, properly generated. - // so just treat it as an arbitrary map - Type: "object", - AdditionalProperties: &apiext.JSONSchemaPropsOrBool{Allows: true}, - } - p.AddPackage(pkg) // get the rest of the types - }, - - "k8s.io/apimachinery/pkg/api/resource": func(p *Parser, pkg *loader.Package) { - p.Schemata[TypeIdent{Name: "Quantity", Package: pkg}] = apiext.JSONSchemaProps{ - // TODO(directxman12): regexp validation for this (or get kube to support it as a format value) - XIntOrString: true, - AnyOf: []apiext.JSONSchemaProps{ - {Type: "integer"}, - {Type: "string"}, - }, - Pattern: "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", - } - // No point in calling AddPackage, this is the sole inhabitant - }, - - "k8s.io/apimachinery/pkg/runtime": func(p *Parser, pkg *loader.Package) { - p.Schemata[TypeIdent{Name: "RawExtension", Package: pkg}] = apiext.JSONSchemaProps{ - // TODO(directxman12): regexp validation for this (or get kube to support it as a format value) - Type: "object", - } - p.AddPackage(pkg) // get the rest of the types - }, - - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured": func(p *Parser, pkg *loader.Package) { - p.Schemata[TypeIdent{Name: "Unstructured", Package: pkg}] = apiext.JSONSchemaProps{ - Type: "object", - } - p.AddPackage(pkg) // get the rest of the types - }, - - "k8s.io/apimachinery/pkg/util/intstr": func(p *Parser, pkg *loader.Package) { - p.Schemata[TypeIdent{Name: "IntOrString", Package: pkg}] = apiext.JSONSchemaProps{ - XIntOrString: true, - AnyOf: []apiext.JSONSchemaProps{ - {Type: "integer"}, - {Type: "string"}, - }, - } - // No point in calling AddPackage, this is the sole inhabitant - }, - - "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1": func(p *Parser, pkg *loader.Package) { - p.Schemata[TypeIdent{Name: "JSON", Package: pkg}] = apiext.JSONSchemaProps{ - XPreserveUnknownFields: boolPtr(true), - } - p.AddPackage(pkg) // get the rest of the types - }, - "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1": func(p *Parser, pkg *loader.Package) { - p.Schemata[TypeIdent{Name: "JSON", Package: pkg}] = apiext.JSONSchemaProps{ - XPreserveUnknownFields: boolPtr(true), - } - p.AddPackage(pkg) // get the rest of the types - }, -} - -// ObjectMetaPackages overrides the ObjectMeta in all types -var ObjectMetaPackages = map[string]PackageOverride{ - "k8s.io/apimachinery/pkg/apis/meta/v1": func(p *Parser, pkg *loader.Package) { - // execute the KnowPackages for `k8s.io/apimachinery/pkg/apis/meta/v1` if any - if f, ok := KnownPackages["k8s.io/apimachinery/pkg/apis/meta/v1"]; ok { - f(p, pkg) - } - // This is an allow-listed set of properties of ObjectMeta, other runtime properties are not part of this list - // See more discussion: https://github.com/kubernetes-sigs/controller-tools/pull/395#issuecomment-691919433 - p.Schemata[TypeIdent{Name: "ObjectMeta", Package: pkg}] = apiext.JSONSchemaProps{ - Type: "object", - Properties: map[string]apiext.JSONSchemaProps{ - "name": { - Type: "string", - }, - "namespace": { - Type: "string", - }, - "annotations": { - Type: "object", - AdditionalProperties: &apiext.JSONSchemaPropsOrBool{ - Schema: &apiext.JSONSchemaProps{ - Type: "string", - }, - }, - }, - "labels": { - Type: "object", - AdditionalProperties: &apiext.JSONSchemaPropsOrBool{ - Schema: &apiext.JSONSchemaProps{ - Type: "string", - }, - }, - }, - "finalizers": { - Type: "array", - Items: &apiext.JSONSchemaPropsOrArray{ - Schema: &apiext.JSONSchemaProps{ - Type: "string", - }, - }, - }, - }, - } - }, -} - -func boolPtr(b bool) *bool { - return &b -} - -// AddKnownTypes registers the packages overrides in KnownPackages with the given parser. -func AddKnownTypes(parser *Parser) { - // ensure everything is there before adding to PackageOverrides - // TODO(directxman12): this is a bit of a hack, maybe just use constructors? - parser.init() - for pkgName, override := range KnownPackages { - parser.PackageOverrides[pkgName] = override - } - // if we want to generate the embedded ObjectMeta in the CRD we need to add the ObjectMetaPackages - if parser.GenerateEmbeddedObjectMeta { - for pkgName, override := range ObjectMetaPackages { - parser.PackageOverrides[pkgName] = override - } - } -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/crd.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/crd.go deleted file mode 100644 index 5e99256c126..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/crd.go +++ /dev/null @@ -1,347 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 markers - -import ( - "fmt" - - apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - - "sigs.k8s.io/controller-tools/pkg/markers" -) - -// CRDMarkers lists all markers that directly modify the CRD (not validation -// schemas). -var CRDMarkers = []*definitionWithHelp{ - // TODO(directxman12): more detailed help - must(markers.MakeDefinition("kubebuilder:subresource:status", markers.DescribesType, SubresourceStatus{})). - WithHelp(SubresourceStatus{}.Help()), - - must(markers.MakeDefinition("kubebuilder:subresource:scale", markers.DescribesType, SubresourceScale{})). - WithHelp(SubresourceScale{}.Help()), - - must(markers.MakeDefinition("kubebuilder:printcolumn", markers.DescribesType, PrintColumn{})). - WithHelp(PrintColumn{}.Help()), - - must(markers.MakeDefinition("kubebuilder:resource", markers.DescribesType, Resource{})). - WithHelp(Resource{}.Help()), - - must(markers.MakeDefinition("kubebuilder:storageversion", markers.DescribesType, StorageVersion{})). - WithHelp(StorageVersion{}.Help()), - - must(markers.MakeDefinition("kubebuilder:skipversion", markers.DescribesType, SkipVersion{})). - WithHelp(SkipVersion{}.Help()), - - must(markers.MakeDefinition("kubebuilder:unservedversion", markers.DescribesType, UnservedVersion{})). - WithHelp(UnservedVersion{}.Help()), - - must(markers.MakeDefinition("kubebuilder:deprecatedversion", markers.DescribesType, DeprecatedVersion{})). - WithHelp(DeprecatedVersion{}.Help()), -} - -// TODO: categories and singular used to be annotations types -// TODO: doc - -func init() { - AllDefinitions = append(AllDefinitions, CRDMarkers...) -} - -// +controllertools:marker:generateHelp:category=CRD - -// SubresourceStatus enables the "/status" subresource on a CRD. -type SubresourceStatus struct{} - -func (s SubresourceStatus) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error { - var subresources *apiext.CustomResourceSubresources - for i := range crd.Versions { - ver := &crd.Versions[i] - if ver.Name != version { - continue - } - if ver.Subresources == nil { - ver.Subresources = &apiext.CustomResourceSubresources{} - } - subresources = ver.Subresources - break - } - if subresources == nil { - return fmt.Errorf("status subresource applied to version %q not in CRD", version) - } - subresources.Status = &apiext.CustomResourceSubresourceStatus{} - return nil -} - -// +controllertools:marker:generateHelp:category=CRD - -// SubresourceScale enables the "/scale" subresource on a CRD. -type SubresourceScale struct { - // marker names are leftover legacy cruft - - // SpecPath specifies the jsonpath to the replicas field for the scale's spec. - SpecPath string `marker:"specpath"` - - // StatusPath specifies the jsonpath to the replicas field for the scale's status. - StatusPath string `marker:"statuspath"` - - // SelectorPath specifies the jsonpath to the pod label selector field for the scale's status. - // - // The selector field must be the *string* form (serialized form) of a selector. - // Setting a pod label selector is necessary for your type to work with the HorizontalPodAutoscaler. - SelectorPath *string `marker:"selectorpath"` -} - -func (s SubresourceScale) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error { - var subresources *apiext.CustomResourceSubresources - for i := range crd.Versions { - ver := &crd.Versions[i] - if ver.Name != version { - continue - } - if ver.Subresources == nil { - ver.Subresources = &apiext.CustomResourceSubresources{} - } - subresources = ver.Subresources - break - } - if subresources == nil { - return fmt.Errorf("scale subresource applied to version %q not in CRD", version) - } - subresources.Scale = &apiext.CustomResourceSubresourceScale{ - SpecReplicasPath: s.SpecPath, - StatusReplicasPath: s.StatusPath, - LabelSelectorPath: s.SelectorPath, - } - return nil -} - -// +controllertools:marker:generateHelp:category=CRD - -// StorageVersion marks this version as the "storage version" for the CRD for conversion. -// -// When conversion is enabled for a CRD (i.e. it's not a trivial-versions/single-version CRD), -// one version is set as the "storage version" to be stored in etcd. Attempting to store any -// other version will result in conversion to the storage version via a conversion webhook. -type StorageVersion struct{} - -func (s StorageVersion) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error { - if version == "" { - // single-version, do nothing - return nil - } - // multi-version - for i := range crd.Versions { - ver := &crd.Versions[i] - if ver.Name != version { - continue - } - ver.Storage = true - break - } - return nil -} - -// +controllertools:marker:generateHelp:category=CRD - -// SkipVersion removes the particular version of the CRD from the CRDs spec. -// -// This is useful if you need to skip generating and listing version entries -// for 'internal' resource versions, which typically exist if using the -// Kubernetes upstream conversion-gen tool. -type SkipVersion struct{} - -func (s SkipVersion) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error { - if version == "" { - // single-version, this is an invalid state - return fmt.Errorf("cannot skip a version if there is only a single version") - } - var versions []apiext.CustomResourceDefinitionVersion - // multi-version - for i := range crd.Versions { - ver := crd.Versions[i] - if ver.Name == version { - // skip the skipped version - continue - } - versions = append(versions, ver) - } - crd.Versions = versions - return nil -} - -// +controllertools:marker:generateHelp:category=CRD - -// PrintColumn adds a column to "kubectl get" output for this CRD. -type PrintColumn struct { - // Name specifies the name of the column. - Name string - - // Type indicates the type of the column. - // - // It may be any OpenAPI data type listed at - // https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types. - Type string - - // JSONPath specifies the jsonpath expression used to extract the value of the column. - JSONPath string `marker:"JSONPath"` // legacy cruft - - // Description specifies the help/description for this column. - Description string `marker:",optional"` - - // Format specifies the format of the column. - // - // It may be any OpenAPI data format corresponding to the type, listed at - // https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types. - Format string `marker:",optional"` - - // Priority indicates how important it is that this column be displayed. - // - // Lower priority (*higher* numbered) columns will be hidden if the terminal - // width is too small. - Priority int32 `marker:",optional"` -} - -func (s PrintColumn) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error { - var columns *[]apiext.CustomResourceColumnDefinition - for i := range crd.Versions { - ver := &crd.Versions[i] - if ver.Name != version { - continue - } - if ver.Subresources == nil { - ver.Subresources = &apiext.CustomResourceSubresources{} - } - columns = &ver.AdditionalPrinterColumns - break - } - if columns == nil { - return fmt.Errorf("printer columns applied to version %q not in CRD", version) - } - - *columns = append(*columns, apiext.CustomResourceColumnDefinition{ - Name: s.Name, - Type: s.Type, - JSONPath: s.JSONPath, - Description: s.Description, - Format: s.Format, - Priority: s.Priority, - }) - - return nil -} - -// +controllertools:marker:generateHelp:category=CRD - -// Resource configures naming and scope for a CRD. -type Resource struct { - // Path specifies the plural "resource" for this CRD. - // - // It generally corresponds to a plural, lower-cased version of the Kind. - // See https://book.kubebuilder.io/cronjob-tutorial/gvks.html. - Path string `marker:",optional"` - - // ShortName specifies aliases for this CRD. - // - // Short names are often used when people have work with your resource - // over and over again. For instance, "rs" for "replicaset" or - // "crd" for customresourcedefinition. - ShortName []string `marker:",optional"` - - // Categories specifies which group aliases this resource is part of. - // - // Group aliases are used to work with groups of resources at once. - // The most common one is "all" which covers about a third of the base - // resources in Kubernetes, and is generally used for "user-facing" resources. - Categories []string `marker:",optional"` - - // Singular overrides the singular form of your resource. - // - // The singular form is otherwise defaulted off the plural (path). - Singular string `marker:",optional"` - - // Scope overrides the scope of the CRD (Cluster vs Namespaced). - // - // Scope defaults to "Namespaced". Cluster-scoped ("Cluster") resources - // don't exist in namespaces. - Scope string `marker:",optional"` -} - -func (s Resource) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error { - if s.Path != "" { - crd.Names.Plural = s.Path - } - if s.Singular != "" { - crd.Names.Singular = s.Singular - } - crd.Names.ShortNames = s.ShortName - crd.Names.Categories = s.Categories - - switch s.Scope { - case "": - crd.Scope = apiext.NamespaceScoped - default: - crd.Scope = apiext.ResourceScope(s.Scope) - } - - return nil -} - -// +controllertools:marker:generateHelp:category=CRD - -// UnservedVersion does not serve this version. -// -// This is useful if you need to drop support for a version in favor of a newer version. -type UnservedVersion struct{} - -func (s UnservedVersion) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error { - for i := range crd.Versions { - ver := &crd.Versions[i] - if ver.Name != version { - continue - } - ver.Served = false - break - } - return nil -} - -// NB(directxman12): singular was historically distinct, so we keep it here for backwards compat - -// +controllertools:marker:generateHelp:category=CRD - -// DeprecatedVersion marks this version as deprecated. -type DeprecatedVersion struct { - // Warning message to be shown on the deprecated version - Warning *string `marker:",optional"` -} - -func (s DeprecatedVersion) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error { - if version == "" { - // single-version, do nothing - return nil - } - // multi-version - for i := range crd.Versions { - ver := &crd.Versions[i] - if ver.Name != version { - continue - } - ver.Deprecated = true - ver.DeprecationWarning = s.Warning - break - } - return nil -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/doc.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/doc.go deleted file mode 100644 index 48736401cf3..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/doc.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 markers defines markers for generating schema valiation -// and CRD structure. -// -// All markers related to CRD generation live in AllDefinitions. -// -// Validation Markers -// -// Validation markers have values that implement ApplyToSchema -// (crd.SchemaMarker). Any marker implementing this will automatically -// be run after the rest of a given schema node has been generated. -// Markers that need to be run before any other markers can also -// implement ApplyFirst, but this is discouraged and may change -// in the future. -// -// All validation markers start with "+kubebuilder:validation", and -// have the same name as their type name. -// -// CRD Markers -// -// Markers that modify anything in the CRD itself *except* for the schema -// implement ApplyToCRD (crd.CRDMarker). They are expected to detect whether -// they should apply themselves to a specific version in the CRD (as passed to -// them), or to the root-level CRD for legacy cases. They are applied *after* -// the rest of the CRD is computed. -// -// Misc -// -// This package also defines the "+groupName" and "+versionName" package-level -// markers, for defining package<->group-version mappings. -package markers diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/package.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/package.go deleted file mode 100644 index cebe8fa4b1c..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/package.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 markers - -import ( - "sigs.k8s.io/controller-tools/pkg/markers" -) - -func init() { - AllDefinitions = append(AllDefinitions, - must(markers.MakeDefinition("groupName", markers.DescribesPackage, "")). - WithHelp(markers.SimpleHelp("CRD", "specifies the API group name for this package.")), - - must(markers.MakeDefinition("versionName", markers.DescribesPackage, "")). - WithHelp(markers.SimpleHelp("CRD", "overrides the API group version for this package (defaults to the package name).")), - - must(markers.MakeDefinition("kubebuilder:validation:Optional", markers.DescribesPackage, struct{}{})). - WithHelp(markers.SimpleHelp("CRD validation", "specifies that all fields in this package are optional by default.")), - - must(markers.MakeDefinition("kubebuilder:validation:Required", markers.DescribesPackage, struct{}{})). - WithHelp(markers.SimpleHelp("CRD validation", "specifies that all fields in this package are required by default.")), - - must(markers.MakeDefinition("kubebuilder:skip", markers.DescribesPackage, struct{}{})). - WithHelp(markers.SimpleHelp("CRD", "don't consider this package as an API version.")), - ) -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/register.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/register.go deleted file mode 100644 index 0e7c426942c..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/register.go +++ /dev/null @@ -1,83 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 markers - -import ( - "reflect" - - "sigs.k8s.io/controller-tools/pkg/markers" -) - -type definitionWithHelp struct { - *markers.Definition - Help *markers.DefinitionHelp -} - -func (d *definitionWithHelp) WithHelp(help *markers.DefinitionHelp) *definitionWithHelp { - d.Help = help - return d -} - -func (d *definitionWithHelp) Register(reg *markers.Registry) error { - if err := reg.Register(d.Definition); err != nil { - return err - } - if d.Help != nil { - reg.AddHelp(d.Definition, d.Help) - } - return nil -} - -func must(def *markers.Definition, err error) *definitionWithHelp { - return &definitionWithHelp{ - Definition: markers.Must(def, err), - } -} - -// AllDefinitions contains all marker definitions for this package. -var AllDefinitions []*definitionWithHelp - -type hasHelp interface { - Help() *markers.DefinitionHelp -} - -// mustMakeAllWithPrefix converts each object into a marker definition using -// the object's type's with the prefix to form the marker name. -func mustMakeAllWithPrefix(prefix string, target markers.TargetType, objs ...interface{}) []*definitionWithHelp { - defs := make([]*definitionWithHelp, len(objs)) - for i, obj := range objs { - name := prefix + ":" + reflect.TypeOf(obj).Name() - def, err := markers.MakeDefinition(name, target, obj) - if err != nil { - panic(err) - } - defs[i] = &definitionWithHelp{Definition: def, Help: obj.(hasHelp).Help()} - } - - return defs -} - -// Register registers all definitions for CRD generation to the given registry. -func Register(reg *markers.Registry) error { - for _, def := range AllDefinitions { - if err := def.Register(reg); err != nil { - return err - } - } - - return nil -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/topology.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/topology.go deleted file mode 100644 index 0f4a94b1805..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/topology.go +++ /dev/null @@ -1,155 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 markers - -import ( - "fmt" - - apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - "sigs.k8s.io/controller-tools/pkg/markers" -) - -// TopologyMarkers specify topology markers (i.e. markers that describe if a -// list behaves as an associative-list or a set, if a map is atomic or not). -var TopologyMarkers = []*definitionWithHelp{ - must(markers.MakeDefinition("listMapKey", markers.DescribesField, ListMapKey(""))). - WithHelp(ListMapKey("").Help()), - must(markers.MakeDefinition("listType", markers.DescribesField, ListType(""))). - WithHelp(ListType("").Help()), - must(markers.MakeDefinition("mapType", markers.DescribesField, MapType(""))). - WithHelp(MapType("").Help()), - must(markers.MakeDefinition("structType", markers.DescribesField, StructType(""))). - WithHelp(StructType("").Help()), -} - -func init() { - AllDefinitions = append(AllDefinitions, TopologyMarkers...) -} - -// +controllertools:marker:generateHelp:category="CRD processing" - -// ListType specifies the type of data-structure that the list -// represents (map, set, atomic). -// -// Possible data-structure types of a list are: -// -// - "map": it needs to have a key field, which will be used to build an -// associative list. A typical example is a the pod container list, -// which is indexed by the container name. -// -// - "set": Fields need to be "scalar", and there can be only one -// occurrence of each. -// -// - "atomic": All the fields in the list are treated as a single value, -// are typically manipulated together by the same actor. -type ListType string - -// +controllertools:marker:generateHelp:category="CRD processing" - -// ListMapKey specifies the keys to map listTypes. -// -// It indicates the index of a map list. They can be repeated if multiple keys -// must be used. It can only be used when ListType is set to map, and the keys -// should be scalar types. -type ListMapKey string - -// +controllertools:marker:generateHelp:category="CRD processing" - -// MapType specifies the level of atomicity of the map; -// i.e. whether each item in the map is independent of the others, -// or all fields are treated as a single unit. -// -// Possible values: -// -// - "granular": items in the map are independent of each other, -// and can be manipulated by different actors. -// This is the default behavior. -// -// - "atomic": all fields are treated as one unit. -// Any changes have to replace the entire map. -type MapType string - -// +controllertools:marker:generateHelp:category="CRD processing" - -// StructType specifies the level of atomicity of the struct; -// i.e. whether each field in the struct is independent of the others, -// or all fields are treated as a single unit. -// -// Possible values: -// -// - "granular": fields in the struct are independent of each other, -// and can be manipulated by different actors. -// This is the default behavior. -// -// - "atomic": all fields are treated as one unit. -// Any changes have to replace the entire struct. -type StructType string - -func (l ListType) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if schema.Type != "array" { - return fmt.Errorf("must apply listType to an array, found %s", schema.Type) - } - if l != "map" && l != "atomic" && l != "set" { - return fmt.Errorf(`ListType must be either "map", "set" or "atomic"`) - } - p := string(l) - schema.XListType = &p - return nil -} - -func (l ListType) ApplyFirst() {} - -func (l ListMapKey) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if schema.Type != "array" { - return fmt.Errorf("must apply listMapKey to an array, found %s", schema.Type) - } - if schema.XListType == nil || *schema.XListType != "map" { - return fmt.Errorf("must apply listMapKey to an associative-list") - } - schema.XListMapKeys = append(schema.XListMapKeys, string(l)) - return nil -} - -func (m MapType) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if schema.Type != "object" { - return fmt.Errorf("must apply mapType to an object") - } - - if m != "atomic" && m != "granular" { - return fmt.Errorf(`MapType must be either "granular" or "atomic"`) - } - - p := string(m) - schema.XMapType = &p - - return nil -} - -func (s StructType) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if schema.Type != "object" && schema.Type != "" { - return fmt.Errorf("must apply structType to an object; either explicitly set or defaulted through an empty schema type") - } - - if s != "atomic" && s != "granular" { - return fmt.Errorf(`StructType must be either "granular" or "atomic"`) - } - - p := string(s) - schema.XMapType = &p - - return nil -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/validation.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/validation.go deleted file mode 100644 index 5d149618966..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/validation.go +++ /dev/null @@ -1,495 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 markers - -import ( - "encoding/json" - "fmt" - "math" - - apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - - "sigs.k8s.io/controller-tools/pkg/markers" -) - -const ( - SchemalessName = "kubebuilder:validation:Schemaless" -) - -// ValidationMarkers lists all available markers that affect CRD schema generation, -// except for the few that don't make sense as type-level markers (see FieldOnlyMarkers). -// All markers start with `+kubebuilder:validation:`, and continue with their type name. -// A copy is produced of all markers that describes types as well, for making types -// reusable and writing complex validations on slice items. -var ValidationMarkers = mustMakeAllWithPrefix("kubebuilder:validation", markers.DescribesField, - - // numeric markers - - Maximum(0), - Minimum(0), - ExclusiveMaximum(false), - ExclusiveMinimum(false), - MultipleOf(0), - MinProperties(0), - MaxProperties(0), - - // string markers - - MaxLength(0), - MinLength(0), - Pattern(""), - - // slice markers - - MaxItems(0), - MinItems(0), - UniqueItems(false), - - // general markers - - Enum(nil), - Format(""), - Type(""), - XPreserveUnknownFields{}, - XEmbeddedResource{}, - XIntOrString{}, - XValidation{}, -) - -// FieldOnlyMarkers list field-specific validation markers (i.e. those markers that don't make -// sense on a type, and thus aren't in ValidationMarkers). -var FieldOnlyMarkers = []*definitionWithHelp{ - must(markers.MakeDefinition("kubebuilder:validation:Required", markers.DescribesField, struct{}{})). - WithHelp(markers.SimpleHelp("CRD validation", "specifies that this field is required, if fields are optional by default.")), - must(markers.MakeDefinition("kubebuilder:validation:Optional", markers.DescribesField, struct{}{})). - WithHelp(markers.SimpleHelp("CRD validation", "specifies that this field is optional, if fields are required by default.")), - must(markers.MakeDefinition("optional", markers.DescribesField, struct{}{})). - WithHelp(markers.SimpleHelp("CRD validation", "specifies that this field is optional, if fields are required by default.")), - - must(markers.MakeDefinition("nullable", markers.DescribesField, Nullable{})). - WithHelp(Nullable{}.Help()), - - must(markers.MakeAnyTypeDefinition("kubebuilder:default", markers.DescribesField, Default{})). - WithHelp(Default{}.Help()), - - must(markers.MakeDefinition("kubebuilder:validation:EmbeddedResource", markers.DescribesField, XEmbeddedResource{})). - WithHelp(XEmbeddedResource{}.Help()), - - must(markers.MakeDefinition(SchemalessName, markers.DescribesField, Schemaless{})). - WithHelp(Schemaless{}.Help()), -} - -// ValidationIshMarkers are field-and-type markers that don't fall under the -// :validation: prefix, and/or don't have a name that directly matches their -// type. -var ValidationIshMarkers = []*definitionWithHelp{ - must(markers.MakeDefinition("kubebuilder:pruning:PreserveUnknownFields", markers.DescribesField, XPreserveUnknownFields{})). - WithHelp(XPreserveUnknownFields{}.Help()), - must(markers.MakeDefinition("kubebuilder:pruning:PreserveUnknownFields", markers.DescribesType, XPreserveUnknownFields{})). - WithHelp(XPreserveUnknownFields{}.Help()), -} - -func init() { - AllDefinitions = append(AllDefinitions, ValidationMarkers...) - - for _, def := range ValidationMarkers { - newDef := *def.Definition - // copy both parts so we don't change the definition - typDef := definitionWithHelp{ - Definition: &newDef, - Help: def.Help, - } - typDef.Target = markers.DescribesType - AllDefinitions = append(AllDefinitions, &typDef) - } - - AllDefinitions = append(AllDefinitions, FieldOnlyMarkers...) - AllDefinitions = append(AllDefinitions, ValidationIshMarkers...) -} - -// +controllertools:marker:generateHelp:category="CRD validation" -// Maximum specifies the maximum numeric value that this field can have. -type Maximum float64 - -func (m Maximum) Value() float64 { - return float64(m) -} - -// +controllertools:marker:generateHelp:category="CRD validation" -// Minimum specifies the minimum numeric value that this field can have. Negative numbers are supported. -type Minimum float64 - -func (m Minimum) Value() float64 { - return float64(m) -} - -// +controllertools:marker:generateHelp:category="CRD validation" -// ExclusiveMinimum indicates that the minimum is "up to" but not including that value. -type ExclusiveMinimum bool - -// +controllertools:marker:generateHelp:category="CRD validation" -// ExclusiveMaximum indicates that the maximum is "up to" but not including that value. -type ExclusiveMaximum bool - -// +controllertools:marker:generateHelp:category="CRD validation" -// MultipleOf specifies that this field must have a numeric value that's a multiple of this one. -type MultipleOf float64 - -func (m MultipleOf) Value() float64 { - return float64(m) -} - -// +controllertools:marker:generateHelp:category="CRD validation" -// MaxLength specifies the maximum length for this string. -type MaxLength int - -// +controllertools:marker:generateHelp:category="CRD validation" -// MinLength specifies the minimum length for this string. -type MinLength int - -// +controllertools:marker:generateHelp:category="CRD validation" -// Pattern specifies that this string must match the given regular expression. -type Pattern string - -// +controllertools:marker:generateHelp:category="CRD validation" -// MaxItems specifies the maximum length for this list. -type MaxItems int - -// +controllertools:marker:generateHelp:category="CRD validation" -// MinItems specifies the minimun length for this list. -type MinItems int - -// +controllertools:marker:generateHelp:category="CRD validation" -// UniqueItems specifies that all items in this list must be unique. -type UniqueItems bool - -// +controllertools:marker:generateHelp:category="CRD validation" -// MaxProperties restricts the number of keys in an object -type MaxProperties int - -// +controllertools:marker:generateHelp:category="CRD validation" -// MinProperties restricts the number of keys in an object -type MinProperties int - -// +controllertools:marker:generateHelp:category="CRD validation" -// Enum specifies that this (scalar) field is restricted to the *exact* values specified here. -type Enum []interface{} - -// +controllertools:marker:generateHelp:category="CRD validation" -// Format specifies additional "complex" formatting for this field. -// -// For example, a date-time field would be marked as "type: string" and -// "format: date-time". -type Format string - -// +controllertools:marker:generateHelp:category="CRD validation" -// Type overrides the type for this field (which defaults to the equivalent of the Go type). -// -// This generally must be paired with custom serialization. For example, the -// metav1.Time field would be marked as "type: string" and "format: date-time". -type Type string - -// +controllertools:marker:generateHelp:category="CRD validation" -// Nullable marks this field as allowing the "null" value. -// -// This is often not necessary, but may be helpful with custom serialization. -type Nullable struct{} - -// +controllertools:marker:generateHelp:category="CRD validation" -// Default sets the default value for this field. -// -// A default value will be accepted as any value valid for the -// field. Formatting for common types include: boolean: `true`, string: -// `Cluster`, numerical: `1.24`, array: `{1,2}`, object: `{policy: -// "delete"}`). Defaults should be defined in pruned form, and only best-effort -// validation will be performed. Full validation of a default requires -// submission of the containing CRD to an apiserver. -type Default struct { - Value interface{} -} - -// +controllertools:marker:generateHelp:category="CRD processing" -// PreserveUnknownFields stops the apiserver from pruning fields which are not specified. -// -// By default the apiserver drops unknown fields from the request payload -// during the decoding step. This marker stops the API server from doing so. -// It affects fields recursively, but switches back to normal pruning behaviour -// if nested properties or additionalProperties are specified in the schema. -// This can either be true or undefined. False -// is forbidden. -// -// NB: The kubebuilder:validation:XPreserveUnknownFields variant is deprecated -// in favor of the kubebuilder:pruning:PreserveUnknownFields variant. They function -// identically. -type XPreserveUnknownFields struct{} - -// +controllertools:marker:generateHelp:category="CRD validation" -// EmbeddedResource marks a fields as an embedded resource with apiVersion, kind and metadata fields. -// -// An embedded resource is a value that has apiVersion, kind and metadata fields. -// They are validated implicitly according to the semantics of the currently -// running apiserver. It is not necessary to add any additional schema for these -// field, yet it is possible. This can be combined with PreserveUnknownFields. -type XEmbeddedResource struct{} - -// +controllertools:marker:generateHelp:category="CRD validation" -// IntOrString marks a fields as an IntOrString. -// -// This is required when applying patterns or other validations to an IntOrString -// field. Knwon information about the type is applied during the collapse phase -// and as such is not normally available during marker application. -type XIntOrString struct{} - -// +controllertools:marker:generateHelp:category="CRD validation" -// Schemaless marks a field as being a schemaless object. -// -// Schemaless objects are not introspected, so you must provide -// any type and validation information yourself. One use for this -// tag is for embedding fields that hold JSONSchema typed objects. -// Because this field disables all type checking, it is recommended -// to be used only as a last resort. -type Schemaless struct{} - -func hasNumericType(schema *apiext.JSONSchemaProps) bool { - return schema.Type == "integer" || schema.Type == "number" -} - -func isIntegral(value float64) bool { - return value == math.Trunc(value) && !math.IsNaN(value) && !math.IsInf(value, 0) -} - -// +controllertools:marker:generateHelp:category="CRD validation" -// XValidation marks a field as requiring a value for which a given -// expression evaluates to true. -// -// This marker may be repeated to specify multiple expressions, all of -// which must evaluate to true. -type XValidation struct { - Rule string - Message string `marker:",optional"` -} - -func (m Maximum) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if !hasNumericType(schema) { - return fmt.Errorf("must apply maximum to a numeric value, found %s", schema.Type) - } - - if schema.Type == "integer" && !isIntegral(m.Value()) { - return fmt.Errorf("cannot apply non-integral maximum validation (%v) to integer value", m.Value()) - } - - val := m.Value() - schema.Maximum = &val - return nil -} - -func (m Minimum) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if !hasNumericType(schema) { - return fmt.Errorf("must apply minimum to a numeric value, found %s", schema.Type) - } - - if schema.Type == "integer" && !isIntegral(m.Value()) { - return fmt.Errorf("cannot apply non-integral minimum validation (%v) to integer value", m.Value()) - } - - val := m.Value() - schema.Minimum = &val - return nil -} - -func (m ExclusiveMaximum) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if !hasNumericType(schema) { - return fmt.Errorf("must apply exclusivemaximum to a numeric value, found %s", schema.Type) - } - schema.ExclusiveMaximum = bool(m) - return nil -} - -func (m ExclusiveMinimum) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if !hasNumericType(schema) { - return fmt.Errorf("must apply exclusiveminimum to a numeric value, found %s", schema.Type) - } - - schema.ExclusiveMinimum = bool(m) - return nil -} - -func (m MultipleOf) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if !hasNumericType(schema) { - return fmt.Errorf("must apply multipleof to a numeric value, found %s", schema.Type) - } - - if schema.Type == "integer" && !isIntegral(m.Value()) { - return fmt.Errorf("cannot apply non-integral multipleof validation (%v) to integer value", m.Value()) - } - - val := m.Value() - schema.MultipleOf = &val - return nil -} - -func (m MaxLength) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if schema.Type != "string" { - return fmt.Errorf("must apply maxlength to a string") - } - val := int64(m) - schema.MaxLength = &val - return nil -} - -func (m MinLength) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if schema.Type != "string" { - return fmt.Errorf("must apply minlength to a string") - } - val := int64(m) - schema.MinLength = &val - return nil -} - -func (m Pattern) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - // Allow string types or IntOrStrings. An IntOrString will still - // apply the pattern validation when a string is detected, the pattern - // will not apply to ints though. - if schema.Type != "string" && !schema.XIntOrString { - return fmt.Errorf("must apply pattern to a `string` or `IntOrString`") - } - schema.Pattern = string(m) - return nil -} - -func (m MaxItems) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if schema.Type != "array" { - return fmt.Errorf("must apply maxitem to an array") - } - val := int64(m) - schema.MaxItems = &val - return nil -} - -func (m MinItems) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if schema.Type != "array" { - return fmt.Errorf("must apply minitems to an array") - } - val := int64(m) - schema.MinItems = &val - return nil -} - -func (m UniqueItems) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if schema.Type != "array" { - return fmt.Errorf("must apply uniqueitems to an array") - } - schema.UniqueItems = bool(m) - return nil -} - -func (m MinProperties) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if schema.Type != "object" { - return fmt.Errorf("must apply minproperties to an object") - } - val := int64(m) - schema.MinProperties = &val - return nil -} - -func (m MaxProperties) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - if schema.Type != "object" { - return fmt.Errorf("must apply maxproperties to an object") - } - val := int64(m) - schema.MaxProperties = &val - return nil -} - -func (m Enum) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - // TODO(directxman12): this is a bit hacky -- we should - // probably support AnyType better + using the schema structure - vals := make([]apiext.JSON, len(m)) - for i, val := range m { - // TODO(directxman12): check actual type with schema type? - // if we're expecting a string, marshal the string properly... - // NB(directxman12): we use json.Marshal to ensure we handle JSON escaping properly - valMarshalled, err := json.Marshal(val) - if err != nil { - return err - } - vals[i] = apiext.JSON{Raw: valMarshalled} - } - schema.Enum = vals - return nil -} - -func (m Format) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - schema.Format = string(m) - return nil -} - -// NB(directxman12): we "typecheck" on target schema properties here, -// which means the "Type" marker *must* be applied first. -// TODO(directxman12): find a less hacky way to do this -// (we could preserve ordering of markers, but that feels bad in its own right). - -func (m Type) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - schema.Type = string(m) - return nil -} - -func (m Type) ApplyFirst() {} - -func (m Nullable) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - schema.Nullable = true - return nil -} - -// Defaults are only valid CRDs created with the v1 API -func (m Default) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - marshalledDefault, err := json.Marshal(m.Value) - if err != nil { - return err - } - schema.Default = &apiext.JSON{Raw: marshalledDefault} - return nil -} - -func (m XPreserveUnknownFields) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - defTrue := true - schema.XPreserveUnknownFields = &defTrue - return nil -} - -func (m XEmbeddedResource) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - schema.XEmbeddedResource = true - return nil -} - -// NB(JoelSpeed): we use this property in other markers here, -// which means the "XIntOrString" marker *must* be applied first. - -func (m XIntOrString) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - schema.XIntOrString = true - return nil -} - -func (m XIntOrString) ApplyFirst() {} - -func (m XValidation) ApplyToSchema(schema *apiext.JSONSchemaProps) error { - schema.XValidations = append(schema.XValidations, apiext.ValidationRule{ - Rule: m.Rule, - Message: m.Message, - }) - return nil -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/zz_generated.markerhelp.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/zz_generated.markerhelp.go deleted file mode 100644 index a3c0547486c..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/zz_generated.markerhelp.go +++ /dev/null @@ -1,489 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright2019 The Kubernetes 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. -*/ - -// Code generated by helpgen. DO NOT EDIT. - -package markers - -import ( - "sigs.k8s.io/controller-tools/pkg/markers" -) - -func (Default) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "sets the default value for this field. ", - Details: "A default value will be accepted as any value valid for the field. Formatting for common types include: boolean: `true`, string: `Cluster`, numerical: `1.24`, array: `{1,2}`, object: `{policy: \"delete\"}`). Defaults should be defined in pruned form, and only best-effort validation will be performed. Full validation of a default requires submission of the containing CRD to an apiserver.", - }, - FieldHelp: map[string]markers.DetailedHelp{ - "Value": { - Summary: "", - Details: "", - }, - }, - } -} - -func (DeprecatedVersion) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD", - DetailedHelp: markers.DetailedHelp{ - Summary: "marks this version as deprecated.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{ - "Warning": { - Summary: "message to be shown on the deprecated version", - Details: "", - }, - }, - } -} - -func (Enum) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies that this (scalar) field is restricted to the *exact* values specified here.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (ExclusiveMaximum) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "indicates that the maximum is \"up to\" but not including that value.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (ExclusiveMinimum) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "indicates that the minimum is \"up to\" but not including that value.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (Format) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies additional \"complex\" formatting for this field. ", - Details: "For example, a date-time field would be marked as \"type: string\" and \"format: date-time\".", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (ListMapKey) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD processing", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies the keys to map listTypes. ", - Details: "It indicates the index of a map list. They can be repeated if multiple keys must be used. It can only be used when ListType is set to map, and the keys should be scalar types.", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (ListType) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD processing", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies the type of data-structure that the list represents (map, set, atomic). ", - Details: "Possible data-structure types of a list are: \n - \"map\": it needs to have a key field, which will be used to build an associative list. A typical example is a the pod container list, which is indexed by the container name. \n - \"set\": Fields need to be \"scalar\", and there can be only one occurrence of each. \n - \"atomic\": All the fields in the list are treated as a single value, are typically manipulated together by the same actor.", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (MapType) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD processing", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies the level of atomicity of the map; i.e. whether each item in the map is independent of the others, or all fields are treated as a single unit. ", - Details: "Possible values: \n - \"granular\": items in the map are independent of each other, and can be manipulated by different actors. This is the default behavior. \n - \"atomic\": all fields are treated as one unit. Any changes have to replace the entire map.", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (MaxItems) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies the maximum length for this list.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (MaxLength) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies the maximum length for this string.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (MaxProperties) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "restricts the number of keys in an object", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (Maximum) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies the maximum numeric value that this field can have.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (MinItems) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies the minimun length for this list.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (MinLength) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies the minimum length for this string.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (MinProperties) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "restricts the number of keys in an object", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (Minimum) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies the minimum numeric value that this field can have. Negative numbers are supported.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (MultipleOf) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies that this field must have a numeric value that's a multiple of this one.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (Nullable) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "marks this field as allowing the \"null\" value. ", - Details: "This is often not necessary, but may be helpful with custom serialization.", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (Pattern) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies that this string must match the given regular expression.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (PrintColumn) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD", - DetailedHelp: markers.DetailedHelp{ - Summary: "adds a column to \"kubectl get\" output for this CRD.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{ - "Name": { - Summary: "specifies the name of the column.", - Details: "", - }, - "Type": { - Summary: "indicates the type of the column. ", - Details: "It may be any OpenAPI data type listed at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types.", - }, - "JSONPath": { - Summary: "specifies the jsonpath expression used to extract the value of the column.", - Details: "", - }, - "Description": { - Summary: "specifies the help/description for this column.", - Details: "", - }, - "Format": { - Summary: "specifies the format of the column. ", - Details: "It may be any OpenAPI data format corresponding to the type, listed at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types.", - }, - "Priority": { - Summary: "indicates how important it is that this column be displayed. ", - Details: "Lower priority (*higher* numbered) columns will be hidden if the terminal width is too small.", - }, - }, - } -} - -func (Resource) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD", - DetailedHelp: markers.DetailedHelp{ - Summary: "configures naming and scope for a CRD.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{ - "Path": { - Summary: "specifies the plural \"resource\" for this CRD. ", - Details: "It generally corresponds to a plural, lower-cased version of the Kind. See https://book.kubebuilder.io/cronjob-tutorial/gvks.html.", - }, - "ShortName": { - Summary: "specifies aliases for this CRD. ", - Details: "Short names are often used when people have work with your resource over and over again. For instance, \"rs\" for \"replicaset\" or \"crd\" for customresourcedefinition.", - }, - "Categories": { - Summary: "specifies which group aliases this resource is part of. ", - Details: "Group aliases are used to work with groups of resources at once. The most common one is \"all\" which covers about a third of the base resources in Kubernetes, and is generally used for \"user-facing\" resources.", - }, - "Singular": { - Summary: "overrides the singular form of your resource. ", - Details: "The singular form is otherwise defaulted off the plural (path).", - }, - "Scope": { - Summary: "overrides the scope of the CRD (Cluster vs Namespaced). ", - Details: "Scope defaults to \"Namespaced\". Cluster-scoped (\"Cluster\") resources don't exist in namespaces.", - }, - }, - } -} - -func (Schemaless) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "marks a field as being a schemaless object. ", - Details: "Schemaless objects are not introspected, so you must provide any type and validation information yourself. One use for this tag is for embedding fields that hold JSONSchema typed objects. Because this field disables all type checking, it is recommended to be used only as a last resort.", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (SkipVersion) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD", - DetailedHelp: markers.DetailedHelp{ - Summary: "removes the particular version of the CRD from the CRDs spec. ", - Details: "This is useful if you need to skip generating and listing version entries for 'internal' resource versions, which typically exist if using the Kubernetes upstream conversion-gen tool.", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (StorageVersion) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD", - DetailedHelp: markers.DetailedHelp{ - Summary: "marks this version as the \"storage version\" for the CRD for conversion. ", - Details: "When conversion is enabled for a CRD (i.e. it's not a trivial-versions/single-version CRD), one version is set as the \"storage version\" to be stored in etcd. Attempting to store any other version will result in conversion to the storage version via a conversion webhook.", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (StructType) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD processing", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies the level of atomicity of the struct; i.e. whether each field in the struct is independent of the others, or all fields are treated as a single unit. ", - Details: "Possible values: \n - \"granular\": fields in the struct are independent of each other, and can be manipulated by different actors. This is the default behavior. \n - \"atomic\": all fields are treated as one unit. Any changes have to replace the entire struct.", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (SubresourceScale) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD", - DetailedHelp: markers.DetailedHelp{ - Summary: "enables the \"/scale\" subresource on a CRD.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{ - "SpecPath": { - Summary: "specifies the jsonpath to the replicas field for the scale's spec.", - Details: "", - }, - "StatusPath": { - Summary: "specifies the jsonpath to the replicas field for the scale's status.", - Details: "", - }, - "SelectorPath": { - Summary: "specifies the jsonpath to the pod label selector field for the scale's status. ", - Details: "The selector field must be the *string* form (serialized form) of a selector. Setting a pod label selector is necessary for your type to work with the HorizontalPodAutoscaler.", - }, - }, - } -} - -func (SubresourceStatus) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD", - DetailedHelp: markers.DetailedHelp{ - Summary: "enables the \"/status\" subresource on a CRD.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (Type) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "overrides the type for this field (which defaults to the equivalent of the Go type). ", - Details: "This generally must be paired with custom serialization. For example, the metav1.Time field would be marked as \"type: string\" and \"format: date-time\".", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (UniqueItems) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies that all items in this list must be unique.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (UnservedVersion) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD", - DetailedHelp: markers.DetailedHelp{ - Summary: "does not serve this version. ", - Details: "This is useful if you need to drop support for a version in favor of a newer version.", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (XEmbeddedResource) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "EmbeddedResource marks a fields as an embedded resource with apiVersion, kind and metadata fields. ", - Details: "An embedded resource is a value that has apiVersion, kind and metadata fields. They are validated implicitly according to the semantics of the currently running apiserver. It is not necessary to add any additional schema for these field, yet it is possible. This can be combined with PreserveUnknownFields.", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (XIntOrString) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "IntOrString marks a fields as an IntOrString. ", - Details: "This is required when applying patterns or other validations to an IntOrString field. Knwon information about the type is applied during the collapse phase and as such is not normally available during marker application.", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (XPreserveUnknownFields) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD processing", - DetailedHelp: markers.DetailedHelp{ - Summary: "PreserveUnknownFields stops the apiserver from pruning fields which are not specified. ", - Details: "By default the apiserver drops unknown fields from the request payload during the decoding step. This marker stops the API server from doing so. It affects fields recursively, but switches back to normal pruning behaviour if nested properties or additionalProperties are specified in the schema. This can either be true or undefined. False is forbidden. \n NB: The kubebuilder:validation:XPreserveUnknownFields variant is deprecated in favor of the kubebuilder:pruning:PreserveUnknownFields variant. They function identically.", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (XValidation) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "CRD validation", - DetailedHelp: markers.DetailedHelp{ - Summary: "marks a field as requiring a value for which a given expression evaluates to true. ", - Details: "This marker may be repeated to specify multiple expressions, all of which must evaluate to true.", - }, - FieldHelp: map[string]markers.DetailedHelp{ - "Rule": { - Summary: "", - Details: "", - }, - "Message": { - Summary: "", - Details: "", - }, - }, - } -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/parser.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/parser.go deleted file mode 100644 index 4c15de9072e..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/parser.go +++ /dev/null @@ -1,243 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 crd - -import ( - "fmt" - - apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - - "sigs.k8s.io/controller-tools/pkg/loader" - "sigs.k8s.io/controller-tools/pkg/markers" -) - -// TypeIdent represents some type in a Package. -type TypeIdent struct { - Package *loader.Package - Name string -} - -func (t TypeIdent) String() string { - return fmt.Sprintf("%q.%s", t.Package.ID, t.Name) -} - -// PackageOverride overrides the loading of some package -// (potentially setting custom schemata, etc). It must -// call AddPackage if it wants to continue with the default -// loading behavior. -type PackageOverride func(p *Parser, pkg *loader.Package) - -// Parser knows how to parse out CRD information and generate -// OpenAPI schemata from some collection of types and markers. -// Most methods on Parser cache their results automatically, -// and thus may be called any number of times. -type Parser struct { - Collector *markers.Collector - - // Types contains the known TypeInfo for this parser. - Types map[TypeIdent]*markers.TypeInfo - // Schemata contains the known OpenAPI JSONSchemata for this parser. - Schemata map[TypeIdent]apiext.JSONSchemaProps - // GroupVersions contains the known group-versions of each package in this parser. - GroupVersions map[*loader.Package]schema.GroupVersion - // CustomResourceDefinitions contains the known CustomResourceDefinitions for types in this parser. - CustomResourceDefinitions map[schema.GroupKind]apiext.CustomResourceDefinition - // FlattenedSchemata contains fully flattened schemata for use in building - // CustomResourceDefinition validation. Each schema has been flattened by the flattener, - // and then embedded fields have been flattened with FlattenEmbedded. - FlattenedSchemata map[TypeIdent]apiext.JSONSchemaProps - - // PackageOverrides indicates that the loading of any package with - // the given path should be handled by the given overrider. - PackageOverrides map[string]PackageOverride - - // checker stores persistent partial type-checking/reference-traversal information. - Checker *loader.TypeChecker - // packages marks packages as loaded, to avoid re-loading them. - packages map[*loader.Package]struct{} - - flattener *Flattener - - // AllowDangerousTypes controls the handling of non-recommended types such as float. If - // false (the default), these types are not supported. - // There is a continuum here: - // 1. Types that are always supported. - // 2. Types that are allowed by default, but not recommended (warning emitted when they are encountered as per PR #443). - // Possibly they are allowed by default for historical reasons and may even be "on their way out" at some point in the future. - // 3. Types that are not allowed by default, not recommended, but there are some legitimate reasons to need them in certain corner cases. - // Possibly these types should also emit a warning as per PR #443 even when they are "switched on" (an integration point between - // this feature and #443 if desired). This is the category that this flag deals with. - // 4. Types that are not allowed and will not be allowed, possibly because it just "doesn't make sense" or possibly - // because the implementation is too difficult/clunky to promote them to category 3. - // TODO: Should we have a more formal mechanism for putting "type patterns" in each of the above categories? - AllowDangerousTypes bool - - // IgnoreUnexportedFields specifies if unexported fields on the struct should be skipped - IgnoreUnexportedFields bool - - // GenerateEmbeddedObjectMeta specifies if any embedded ObjectMeta should be generated - GenerateEmbeddedObjectMeta bool -} - -func (p *Parser) init() { - if p.packages == nil { - p.packages = make(map[*loader.Package]struct{}) - } - if p.flattener == nil { - p.flattener = &Flattener{ - Parser: p, - } - } - if p.Schemata == nil { - p.Schemata = make(map[TypeIdent]apiext.JSONSchemaProps) - } - if p.Types == nil { - p.Types = make(map[TypeIdent]*markers.TypeInfo) - } - if p.PackageOverrides == nil { - p.PackageOverrides = make(map[string]PackageOverride) - } - if p.GroupVersions == nil { - p.GroupVersions = make(map[*loader.Package]schema.GroupVersion) - } - if p.CustomResourceDefinitions == nil { - p.CustomResourceDefinitions = make(map[schema.GroupKind]apiext.CustomResourceDefinition) - } - if p.FlattenedSchemata == nil { - p.FlattenedSchemata = make(map[TypeIdent]apiext.JSONSchemaProps) - } -} - -// indexTypes loads all types in the package into Types. -func (p *Parser) indexTypes(pkg *loader.Package) { - // autodetect - pkgMarkers, err := markers.PackageMarkers(p.Collector, pkg) - if err != nil { - pkg.AddError(err) - } else { - if skipPkg := pkgMarkers.Get("kubebuilder:skip"); skipPkg != nil { - return - } - if nameVal := pkgMarkers.Get("groupName"); nameVal != nil { - versionVal := pkg.Name // a reasonable guess - if versionMarker := pkgMarkers.Get("versionName"); versionMarker != nil { - versionVal = versionMarker.(string) - } - - p.GroupVersions[pkg] = schema.GroupVersion{ - Version: versionVal, - Group: nameVal.(string), - } - } - } - - if err := markers.EachType(p.Collector, pkg, func(info *markers.TypeInfo) { - ident := TypeIdent{ - Package: pkg, - Name: info.Name, - } - - p.Types[ident] = info - }); err != nil { - pkg.AddError(err) - } -} - -// LookupType fetches type info from Types. -func (p *Parser) LookupType(pkg *loader.Package, name string) *markers.TypeInfo { - return p.Types[TypeIdent{Package: pkg, Name: name}] -} - -// NeedSchemaFor indicates that a schema should be generated for the given type. -func (p *Parser) NeedSchemaFor(typ TypeIdent) { - p.init() - - p.NeedPackage(typ.Package) - if _, knownSchema := p.Schemata[typ]; knownSchema { - return - } - - info, knownInfo := p.Types[typ] - if !knownInfo { - typ.Package.AddError(fmt.Errorf("unknown type %s", typ)) - return - } - - // avoid tripping recursive schemata, like ManagedFields, by adding an empty WIP schema - p.Schemata[typ] = apiext.JSONSchemaProps{} - - schemaCtx := newSchemaContext(typ.Package, p, p.AllowDangerousTypes, p.IgnoreUnexportedFields) - ctxForInfo := schemaCtx.ForInfo(info) - - pkgMarkers, err := markers.PackageMarkers(p.Collector, typ.Package) - if err != nil { - typ.Package.AddError(err) - } - ctxForInfo.PackageMarkers = pkgMarkers - - schema := infoToSchema(ctxForInfo) - - p.Schemata[typ] = *schema -} - -func (p *Parser) NeedFlattenedSchemaFor(typ TypeIdent) { - p.init() - - if _, knownSchema := p.FlattenedSchemata[typ]; knownSchema { - return - } - - p.NeedSchemaFor(typ) - partialFlattened := p.flattener.FlattenType(typ) - fullyFlattened := FlattenEmbedded(partialFlattened, typ.Package) - - p.FlattenedSchemata[typ] = *fullyFlattened -} - -// NeedCRDFor lives off in spec.go - -// AddPackage indicates that types and type-checking information is needed -// for the the given package, *ignoring* overrides. -// Generally, consumers should call NeedPackage, while PackageOverrides should -// call AddPackage to continue with the normal loading procedure. -func (p *Parser) AddPackage(pkg *loader.Package) { - p.init() - if _, checked := p.packages[pkg]; checked { - return - } - p.indexTypes(pkg) - p.Checker.Check(pkg) - p.packages[pkg] = struct{}{} -} - -// NeedPackage indicates that types and type-checking information -// is needed for the given package. -func (p *Parser) NeedPackage(pkg *loader.Package) { - p.init() - if _, checked := p.packages[pkg]; checked { - return - } - // overrides are going to be written without vendor. This is why we index by the actual - // object when we can. - if override, overridden := p.PackageOverrides[loader.NonVendorPath(pkg.PkgPath)]; overridden { - override(p, pkg) - p.packages[pkg] = struct{}{} - return - } - p.AddPackage(pkg) -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/schema.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/schema.go deleted file mode 100644 index e76d3ea88c8..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/schema.go +++ /dev/null @@ -1,464 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 crd - -import ( - "errors" - "fmt" - "go/ast" - "go/token" - "go/types" - "strings" - - apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - crdmarkers "sigs.k8s.io/controller-tools/pkg/crd/markers" - - "sigs.k8s.io/controller-tools/pkg/loader" - "sigs.k8s.io/controller-tools/pkg/markers" -) - -// Schema flattening is done in a recursive mapping method. -// Start reading at infoToSchema. - -const ( - // defPrefix is the prefix used to link to definitions in the OpenAPI schema. - defPrefix = "#/definitions/" -) - -// byteType is the types.Type for byte (see the types documention -// for why we need to look this up in the Universe), saved -// for quick comparison. -var byteType = types.Universe.Lookup("byte").Type() - -// SchemaMarker is any marker that needs to modify the schema of the underlying type or field. -type SchemaMarker interface { - // ApplyToSchema is called after the rest of the schema for a given type - // or field is generated, to modify the schema appropriately. - ApplyToSchema(*apiext.JSONSchemaProps) error -} - -// applyFirstMarker is applied before any other markers. It's a bit of a hack. -type applyFirstMarker interface { - ApplyFirst() -} - -// schemaRequester knows how to marker that another schema (e.g. via an external reference) is necessary. -type schemaRequester interface { - NeedSchemaFor(typ TypeIdent) -} - -// schemaContext stores and provides information across a hierarchy of schema generation. -type schemaContext struct { - pkg *loader.Package - info *markers.TypeInfo - - schemaRequester schemaRequester - PackageMarkers markers.MarkerValues - - allowDangerousTypes bool - ignoreUnexportedFields bool -} - -// newSchemaContext constructs a new schemaContext for the given package and schema requester. -// It must have type info added before use via ForInfo. -func newSchemaContext(pkg *loader.Package, req schemaRequester, allowDangerousTypes, ignoreUnexportedFields bool) *schemaContext { - pkg.NeedTypesInfo() - return &schemaContext{ - pkg: pkg, - schemaRequester: req, - allowDangerousTypes: allowDangerousTypes, - ignoreUnexportedFields: ignoreUnexportedFields, - } -} - -// ForInfo produces a new schemaContext with containing the same information -// as this one, except with the given type information. -func (c *schemaContext) ForInfo(info *markers.TypeInfo) *schemaContext { - return &schemaContext{ - pkg: c.pkg, - info: info, - schemaRequester: c.schemaRequester, - allowDangerousTypes: c.allowDangerousTypes, - ignoreUnexportedFields: c.ignoreUnexportedFields, - } -} - -// requestSchema asks for the schema for a type in the package with the -// given import path. -func (c *schemaContext) requestSchema(pkgPath, typeName string) { - pkg := c.pkg - if pkgPath != "" { - pkg = c.pkg.Imports()[pkgPath] - } - c.schemaRequester.NeedSchemaFor(TypeIdent{ - Package: pkg, - Name: typeName, - }) -} - -// infoToSchema creates a schema for the type in the given set of type information. -func infoToSchema(ctx *schemaContext) *apiext.JSONSchemaProps { - // If the obj implements a JSON marshaler and has a marker, use the markers value and do not traverse as - // the marshaler could be doing anything. If there is no marker, fall back to traversing. - if obj := ctx.pkg.Types.Scope().Lookup(ctx.info.Name); obj != nil && implementsJSONMarshaler(obj.Type()) { - schema := &apiext.JSONSchemaProps{} - applyMarkers(ctx, ctx.info.Markers, schema, ctx.info.RawSpec.Type) - if schema.Type != "" { - return schema - } - } - return typeToSchema(ctx, ctx.info.RawSpec.Type) -} - -// applyMarkers applies schema markers to the given schema, respecting "apply first" markers. -func applyMarkers(ctx *schemaContext, markerSet markers.MarkerValues, props *apiext.JSONSchemaProps, node ast.Node) { - // apply "apply first" markers first... - for _, markerValues := range markerSet { - for _, markerValue := range markerValues { - if _, isApplyFirst := markerValue.(applyFirstMarker); !isApplyFirst { - continue - } - - schemaMarker, isSchemaMarker := markerValue.(SchemaMarker) - if !isSchemaMarker { - continue - } - - if err := schemaMarker.ApplyToSchema(props); err != nil { - ctx.pkg.AddError(loader.ErrFromNode(err /* an okay guess */, node)) - } - } - } - - // ...then the rest of the markers - for _, markerValues := range markerSet { - for _, markerValue := range markerValues { - if _, isApplyFirst := markerValue.(applyFirstMarker); isApplyFirst { - // skip apply-first markers, which were already applied - continue - } - - schemaMarker, isSchemaMarker := markerValue.(SchemaMarker) - if !isSchemaMarker { - continue - } - if err := schemaMarker.ApplyToSchema(props); err != nil { - ctx.pkg.AddError(loader.ErrFromNode(err /* an okay guess */, node)) - } - } - } -} - -// typeToSchema creates a schema for the given AST type. -func typeToSchema(ctx *schemaContext, rawType ast.Expr) *apiext.JSONSchemaProps { - var props *apiext.JSONSchemaProps - switch expr := rawType.(type) { - case *ast.Ident: - props = localNamedToSchema(ctx, expr) - case *ast.SelectorExpr: - props = namedToSchema(ctx, expr) - case *ast.ArrayType: - props = arrayToSchema(ctx, expr) - case *ast.MapType: - props = mapToSchema(ctx, expr) - case *ast.StarExpr: - props = typeToSchema(ctx, expr.X) - case *ast.StructType: - props = structToSchema(ctx, expr) - default: - ctx.pkg.AddError(loader.ErrFromNode(fmt.Errorf("unsupported AST kind %T", expr), rawType)) - // NB(directxman12): we explicitly don't handle interfaces - return &apiext.JSONSchemaProps{} - } - - props.Description = ctx.info.Doc - - applyMarkers(ctx, ctx.info.Markers, props, rawType) - - return props -} - -// qualifiedName constructs a JSONSchema-safe qualified name for a type -// (`` or `~0`, where `` -// is the package path with `/` replaced by `~1`, according to JSONPointer -// escapes). -func qualifiedName(pkgName, typeName string) string { - if pkgName != "" { - return strings.Replace(pkgName, "/", "~1", -1) + "~0" + typeName - } - return typeName -} - -// TypeRefLink creates a definition link for the given type and package. -func TypeRefLink(pkgName, typeName string) string { - return defPrefix + qualifiedName(pkgName, typeName) -} - -// localNamedToSchema creates a schema (ref) for a *potentially* local type reference -// (could be external from a dot-import). -func localNamedToSchema(ctx *schemaContext, ident *ast.Ident) *apiext.JSONSchemaProps { - typeInfo := ctx.pkg.TypesInfo.TypeOf(ident) - if typeInfo == types.Typ[types.Invalid] { - ctx.pkg.AddError(loader.ErrFromNode(fmt.Errorf("unknown type %s", ident.Name), ident)) - return &apiext.JSONSchemaProps{} - } - if basicInfo, isBasic := typeInfo.(*types.Basic); isBasic { - typ, fmt, err := builtinToType(basicInfo, ctx.allowDangerousTypes) - if err != nil { - ctx.pkg.AddError(loader.ErrFromNode(err, ident)) - } - return &apiext.JSONSchemaProps{ - Type: typ, - Format: fmt, - } - } - // NB(directxman12): if there are dot imports, this might be an external reference, - // so use typechecking info to get the actual object - typeNameInfo := typeInfo.(*types.Named).Obj() - pkg := typeNameInfo.Pkg() - pkgPath := loader.NonVendorPath(pkg.Path()) - if pkg == ctx.pkg.Types { - pkgPath = "" - } - ctx.requestSchema(pkgPath, typeNameInfo.Name()) - link := TypeRefLink(pkgPath, typeNameInfo.Name()) - return &apiext.JSONSchemaProps{ - Ref: &link, - } -} - -// namedSchema creates a schema (ref) for an explicitly external type reference. -func namedToSchema(ctx *schemaContext, named *ast.SelectorExpr) *apiext.JSONSchemaProps { - typeInfoRaw := ctx.pkg.TypesInfo.TypeOf(named) - if typeInfoRaw == types.Typ[types.Invalid] { - ctx.pkg.AddError(loader.ErrFromNode(fmt.Errorf("unknown type %v.%s", named.X, named.Sel.Name), named)) - return &apiext.JSONSchemaProps{} - } - typeInfo := typeInfoRaw.(*types.Named) - typeNameInfo := typeInfo.Obj() - nonVendorPath := loader.NonVendorPath(typeNameInfo.Pkg().Path()) - ctx.requestSchema(nonVendorPath, typeNameInfo.Name()) - link := TypeRefLink(nonVendorPath, typeNameInfo.Name()) - return &apiext.JSONSchemaProps{ - Ref: &link, - } - // NB(directxman12): we special-case things like resource.Quantity during the "collapse" phase. -} - -// arrayToSchema creates a schema for the items of the given array, dealing appropriately -// with the special `[]byte` type (according to OpenAPI standards). -func arrayToSchema(ctx *schemaContext, array *ast.ArrayType) *apiext.JSONSchemaProps { - eltType := ctx.pkg.TypesInfo.TypeOf(array.Elt) - if eltType == byteType && array.Len == nil { - // byte slices are represented as base64-encoded strings - // (the format is defined in OpenAPI v3, but not JSON Schema) - return &apiext.JSONSchemaProps{ - Type: "string", - Format: "byte", - } - } - // TODO(directxman12): backwards-compat would require access to markers from base info - items := typeToSchema(ctx.ForInfo(&markers.TypeInfo{}), array.Elt) - - return &apiext.JSONSchemaProps{ - Type: "array", - Items: &apiext.JSONSchemaPropsOrArray{Schema: items}, - } -} - -// mapToSchema creates a schema for items of the given map. Key types must eventually resolve -// to string (other types aren't allowed by JSON, and thus the kubernetes API standards). -func mapToSchema(ctx *schemaContext, mapType *ast.MapType) *apiext.JSONSchemaProps { - keyInfo := ctx.pkg.TypesInfo.TypeOf(mapType.Key) - // check that we've got a type that actually corresponds to a string - for keyInfo != nil { - switch typedKey := keyInfo.(type) { - case *types.Basic: - if typedKey.Info()&types.IsString == 0 { - ctx.pkg.AddError(loader.ErrFromNode(fmt.Errorf("map keys must be strings, not %s", keyInfo.String()), mapType.Key)) - return &apiext.JSONSchemaProps{} - } - keyInfo = nil // stop iterating - case *types.Named: - keyInfo = typedKey.Underlying() - default: - ctx.pkg.AddError(loader.ErrFromNode(fmt.Errorf("map keys must be strings, not %s", keyInfo.String()), mapType.Key)) - return &apiext.JSONSchemaProps{} - } - } - - // TODO(directxman12): backwards-compat would require access to markers from base info - var valSchema *apiext.JSONSchemaProps - switch val := mapType.Value.(type) { - case *ast.Ident: - valSchema = localNamedToSchema(ctx.ForInfo(&markers.TypeInfo{}), val) - case *ast.SelectorExpr: - valSchema = namedToSchema(ctx.ForInfo(&markers.TypeInfo{}), val) - case *ast.ArrayType: - valSchema = arrayToSchema(ctx.ForInfo(&markers.TypeInfo{}), val) - case *ast.StarExpr: - valSchema = typeToSchema(ctx.ForInfo(&markers.TypeInfo{}), val) - case *ast.MapType: - valSchema = typeToSchema(ctx.ForInfo(&markers.TypeInfo{}), val) - default: - ctx.pkg.AddError(loader.ErrFromNode(fmt.Errorf("not a supported map value type: %T", mapType.Value), mapType.Value)) - return &apiext.JSONSchemaProps{} - } - - return &apiext.JSONSchemaProps{ - Type: "object", - AdditionalProperties: &apiext.JSONSchemaPropsOrBool{ - Schema: valSchema, - Allows: true, /* set automatically by serialization, but useful for testing */ - }, - } -} - -// structToSchema creates a schema for the given struct. Embedded fields are placed in AllOf, -// and can be flattened later with a Flattener. -func structToSchema(ctx *schemaContext, structType *ast.StructType) *apiext.JSONSchemaProps { - props := &apiext.JSONSchemaProps{ - Type: "object", - Properties: make(map[string]apiext.JSONSchemaProps), - } - - if ctx.info.RawSpec.Type != structType { - ctx.pkg.AddError(loader.ErrFromNode(fmt.Errorf("encountered non-top-level struct (possibly embedded), those aren't allowed"), structType)) - return props - } - - for _, field := range ctx.info.Fields { - // Skip if the field is not an inline field, ignoreUnexportedFields is true, and the field is not exported - if field.Name != "" && ctx.ignoreUnexportedFields && !ast.IsExported(field.Name) { - continue - } - - jsonTag, hasTag := field.Tag.Lookup("json") - if !hasTag { - // if the field doesn't have a JSON tag, it doesn't belong in output (and shouldn't exist in a serialized type) - ctx.pkg.AddError(loader.ErrFromNode(fmt.Errorf("encountered struct field %q without JSON tag in type %q", field.Name, ctx.info.Name), field.RawField)) - continue - } - jsonOpts := strings.Split(jsonTag, ",") - if len(jsonOpts) == 1 && jsonOpts[0] == "-" { - // skipped fields have the tag "-" (note that "-," means the field is named "-") - continue - } - - inline := false - omitEmpty := false - for _, opt := range jsonOpts[1:] { - switch opt { - case "inline": - inline = true - case "omitempty": - omitEmpty = true - } - } - fieldName := jsonOpts[0] - inline = inline || fieldName == "" // anonymous fields are inline fields in YAML/JSON - - // if no default required mode is set, default to required - defaultMode := "required" - if ctx.PackageMarkers.Get("kubebuilder:validation:Optional") != nil { - defaultMode = "optional" - } - - switch defaultMode { - // if this package isn't set to optional default... - case "required": - // ...everything that's not inline, omitempty, or explicitly optional is required - if !inline && !omitEmpty && field.Markers.Get("kubebuilder:validation:Optional") == nil && field.Markers.Get("optional") == nil { - props.Required = append(props.Required, fieldName) - } - - // if this package isn't set to required default... - case "optional": - // ...everything that isn't explicitly required is optional - if field.Markers.Get("kubebuilder:validation:Required") != nil { - props.Required = append(props.Required, fieldName) - } - } - - var propSchema *apiext.JSONSchemaProps - if field.Markers.Get(crdmarkers.SchemalessName) != nil { - propSchema = &apiext.JSONSchemaProps{} - } else { - propSchema = typeToSchema(ctx.ForInfo(&markers.TypeInfo{}), field.RawField.Type) - } - propSchema.Description = field.Doc - - applyMarkers(ctx, field.Markers, propSchema, field.RawField) - - if inline { - props.AllOf = append(props.AllOf, *propSchema) - continue - } - - props.Properties[fieldName] = *propSchema - } - - return props -} - -// builtinToType converts builtin basic types to their equivalent JSON schema form. -// It *only* handles types allowed by the kubernetes API standards. Floats are not -// allowed unless allowDangerousTypes is true -func builtinToType(basic *types.Basic, allowDangerousTypes bool) (typ string, format string, err error) { - // NB(directxman12): formats from OpenAPI v3 are slightly different than those defined - // in JSONSchema. This'll use the OpenAPI v3 ones, since they're useful for bounding our - // non-string types. - basicInfo := basic.Info() - switch { - case basicInfo&types.IsBoolean != 0: - typ = "boolean" - case basicInfo&types.IsString != 0: - typ = "string" - case basicInfo&types.IsInteger != 0: - typ = "integer" - case basicInfo&types.IsFloat != 0: - if allowDangerousTypes { - typ = "number" - } else { - return "", "", errors.New("found float, the usage of which is highly discouraged, as support for them varies across languages. Please consider serializing your float as string instead. If you are really sure you want to use them, re-run with crd:allowDangerousTypes=true") - } - default: - return "", "", fmt.Errorf("unsupported type %q", basic.String()) - } - - switch basic.Kind() { - case types.Int32, types.Uint32: - format = "int32" - case types.Int64, types.Uint64: - format = "int64" - } - - return typ, format, nil -} - -// Open coded go/types representation of encoding/json.Marshaller -var jsonMarshaler = types.NewInterfaceType([]*types.Func{ - types.NewFunc(token.NoPos, nil, "MarshalJSON", - types.NewSignature(nil, nil, - types.NewTuple( - types.NewVar(token.NoPos, nil, "", types.NewSlice(types.Universe.Lookup("byte").Type())), - types.NewVar(token.NoPos, nil, "", types.Universe.Lookup("error").Type())), false)), -}, nil).Complete() - -func implementsJSONMarshaler(typ types.Type) bool { - return types.Implements(typ, jsonMarshaler) || types.Implements(types.NewPointer(typ), jsonMarshaler) -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/schema_visitor.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/schema_visitor.go deleted file mode 100644 index 2604d739b61..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/schema_visitor.go +++ /dev/null @@ -1,131 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 crd - -import ( - apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" -) - -// SchemaVisitor walks the nodes of a schema. -type SchemaVisitor interface { - // Visit is called for each schema node. If it returns a visitor, - // the visitor will be called on each direct child node, and then - // this visitor will be called again with `nil` to indicate that - // all children have been visited. If a nil visitor is returned, - // children are not visited. - // - // It is *NOT* safe to save references to the given schema. - // Make deepcopies if you need to keep things around beyond - // the lifetime of the call. - Visit(schema *apiext.JSONSchemaProps) SchemaVisitor -} - -// EditSchema walks the given schema using the given visitor. Actual -// pointers to each schema node are passed to the visitor, so any changes -// made by the visitor will be reflected to the passed-in schema. -func EditSchema(schema *apiext.JSONSchemaProps, visitor SchemaVisitor) { - walker := schemaWalker{visitor: visitor} - walker.walkSchema(schema) -} - -// schemaWalker knows how to walk the schema, saving modifications -// made by the given visitor. -type schemaWalker struct { - visitor SchemaVisitor -} - -// walkSchema walks the given schema, saving modifications made by the visitor -// (this is as simple as passing a pointer in most cases, but special care -// needs to be taken to persist with maps). It also visits referenced -// schemata, dealing with circular references appropriately. The returned -// visitor will be used to visit all "children" of the current schema, followed -// by a nil schema with the returned visitor to mark completion. If a nil visitor -// is returned, traversal will no continue into the children of the current schema. -func (w schemaWalker) walkSchema(schema *apiext.JSONSchemaProps) { - // Walk a potential chain of schema references, keeping track of seen - // references to avoid circular references - subVisitor := w.visitor - seenRefs := map[string]bool{} - if schema.Ref != nil { - seenRefs[*schema.Ref] = true - } - for { - subVisitor = subVisitor.Visit(schema) - if subVisitor == nil { - return - } - // mark completion of the visitor - defer subVisitor.Visit(nil) - - // Break if schema is not a reference or a cycle is detected - if schema.Ref == nil || len(*schema.Ref) == 0 || seenRefs[*schema.Ref] { - break - } - seenRefs[*schema.Ref] = true - } - - // walk sub-schemata - subWalker := schemaWalker{visitor: subVisitor} - if schema.Items != nil { - subWalker.walkPtr(schema.Items.Schema) - subWalker.walkSlice(schema.Items.JSONSchemas) - } - subWalker.walkSlice(schema.AllOf) - subWalker.walkSlice(schema.OneOf) - subWalker.walkSlice(schema.AnyOf) - subWalker.walkPtr(schema.Not) - subWalker.walkMap(schema.Properties) - if schema.AdditionalProperties != nil { - subWalker.walkPtr(schema.AdditionalProperties.Schema) - } - subWalker.walkMap(schema.PatternProperties) - for name, dep := range schema.Dependencies { - subWalker.walkPtr(dep.Schema) - schema.Dependencies[name] = dep - } - if schema.AdditionalItems != nil { - subWalker.walkPtr(schema.AdditionalItems.Schema) - } - subWalker.walkMap(schema.Definitions) -} - -// walkMap walks over values of the given map, saving changes to them. -func (w schemaWalker) walkMap(defs map[string]apiext.JSONSchemaProps) { - for name, def := range defs { - // this is iter var reference is because we immediately preseve it below - //nolint:gosec - w.walkSchema(&def) - // make sure the edits actually go through since we can't - // take a reference to the value in the map - defs[name] = def - } -} - -// walkSlice walks over items of the given slice. -func (w schemaWalker) walkSlice(defs []apiext.JSONSchemaProps) { - for i := range defs { - w.walkSchema(&defs[i]) - } -} - -// walkPtr walks over the contents of the given pointer, if it's not nil. -func (w schemaWalker) walkPtr(def *apiext.JSONSchemaProps) { - if def == nil { - return - } - w.walkSchema(def) -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/spec.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/spec.go deleted file mode 100644 index fc009952827..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/spec.go +++ /dev/null @@ -1,168 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 crd - -import ( - "fmt" - "sort" - "strings" - - "github.com/gobuffalo/flect" - - apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - - "sigs.k8s.io/controller-tools/pkg/loader" -) - -// SpecMarker is a marker that knows how to apply itself to a particular -// version in a CRD. -type SpecMarker interface { - // ApplyToCRD applies this marker to the given CRD, in the given version - // within that CRD. It's called after everything else in the CRD is populated. - ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error -} - -// NeedCRDFor requests the full CRD for the given group-kind. It requires -// that the packages containing the Go structs for that CRD have already -// been loaded with NeedPackage. -func (p *Parser) NeedCRDFor(groupKind schema.GroupKind, maxDescLen *int) { - p.init() - - if _, exists := p.CustomResourceDefinitions[groupKind]; exists { - return - } - - var packages []*loader.Package - for pkg, gv := range p.GroupVersions { - if gv.Group != groupKind.Group { - continue - } - packages = append(packages, pkg) - } - - defaultPlural := strings.ToLower(flect.Pluralize(groupKind.Kind)) - crd := apiext.CustomResourceDefinition{ - TypeMeta: metav1.TypeMeta{ - APIVersion: apiext.SchemeGroupVersion.String(), - Kind: "CustomResourceDefinition", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: defaultPlural + "." + groupKind.Group, - }, - Spec: apiext.CustomResourceDefinitionSpec{ - Group: groupKind.Group, - Names: apiext.CustomResourceDefinitionNames{ - Kind: groupKind.Kind, - ListKind: groupKind.Kind + "List", - Plural: defaultPlural, - Singular: strings.ToLower(groupKind.Kind), - }, - Scope: apiext.NamespaceScoped, - }, - } - - for _, pkg := range packages { - typeIdent := TypeIdent{Package: pkg, Name: groupKind.Kind} - typeInfo := p.Types[typeIdent] - if typeInfo == nil { - continue - } - p.NeedFlattenedSchemaFor(typeIdent) - fullSchema := p.FlattenedSchemata[typeIdent] - fullSchema = *fullSchema.DeepCopy() // don't mutate the cache (we might be truncating description, etc) - if maxDescLen != nil { - TruncateDescription(&fullSchema, *maxDescLen) - } - ver := apiext.CustomResourceDefinitionVersion{ - Name: p.GroupVersions[pkg].Version, - Served: true, - Schema: &apiext.CustomResourceValidation{ - OpenAPIV3Schema: &fullSchema, // fine to take a reference since we deepcopy above - }, - } - crd.Spec.Versions = append(crd.Spec.Versions, ver) - } - - // markers are applied *after* initial generation of objects - for _, pkg := range packages { - typeIdent := TypeIdent{Package: pkg, Name: groupKind.Kind} - typeInfo := p.Types[typeIdent] - if typeInfo == nil { - continue - } - ver := p.GroupVersions[pkg].Version - - for _, markerVals := range typeInfo.Markers { - for _, val := range markerVals { - crdMarker, isCrdMarker := val.(SpecMarker) - if !isCrdMarker { - continue - } - if err := crdMarker.ApplyToCRD(&crd.Spec, ver); err != nil { - pkg.AddError(loader.ErrFromNode(err /* an okay guess */, typeInfo.RawSpec)) - } - } - } - } - - // fix the name if the plural was changed (this is the form the name *has* to take, so no harm in changing it). - crd.Name = crd.Spec.Names.Plural + "." + groupKind.Group - - // nothing to actually write - if len(crd.Spec.Versions) == 0 { - return - } - - // it is necessary to make sure the order of CRD versions in crd.Spec.Versions is stable and explicitly set crd.Spec.Version. - // Otherwise, crd.Spec.Version may point to different CRD versions across different runs. - sort.Slice(crd.Spec.Versions, func(i, j int) bool { return crd.Spec.Versions[i].Name < crd.Spec.Versions[j].Name }) - - // make sure we have *a* storage version - // (default it if we only have one, otherwise, bail) - if len(crd.Spec.Versions) == 1 { - crd.Spec.Versions[0].Storage = true - } - - hasStorage := false - for _, ver := range crd.Spec.Versions { - if ver.Storage { - hasStorage = true - break - } - } - if !hasStorage { - // just add the error to the first relevant package for this CRD, - // since there's no specific error location - packages[0].AddError(fmt.Errorf("CRD for %s has no storage version", groupKind)) - } - - served := false - for _, ver := range crd.Spec.Versions { - if ver.Served { - served = true - break - } - } - if !served { - // just add the error to the first relevant package for this CRD, - // since there's no specific error location - packages[0].AddError(fmt.Errorf("CRD for %s with version(s) %v does not serve any version", groupKind, crd.Spec.Versions)) - } - - p.CustomResourceDefinitions[groupKind] = crd -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/crd/zz_generated.markerhelp.go b/vendor/sigs.k8s.io/controller-tools/pkg/crd/zz_generated.markerhelp.go deleted file mode 100644 index fee8de4b945..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/crd/zz_generated.markerhelp.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright2019 The Kubernetes 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. -*/ - -// Code generated by helpgen. DO NOT EDIT. - -package crd - -import ( - "sigs.k8s.io/controller-tools/pkg/markers" -) - -func (Generator) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "", - DetailedHelp: markers.DetailedHelp{ - Summary: "generates CustomResourceDefinition objects.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{ - "IgnoreUnexportedFields": { - Summary: "indicates that we should skip unexported fields. ", - Details: "Left unspecified, the default is false.", - }, - "AllowDangerousTypes": { - Summary: "allows types which are usually omitted from CRD generation because they are not recommended. ", - Details: "Currently the following additional types are allowed when this is true: float32 float64 \n Left unspecified, the default is false", - }, - "MaxDescLen": { - Summary: "specifies the maximum description length for fields in CRD's OpenAPI schema. ", - Details: "0 indicates drop the description for all fields completely. n indicates limit the description to at most n characters and truncate the description to closest sentence boundary if it exceeds n characters.", - }, - "CRDVersions": { - Summary: "specifies the target API versions of the CRD type itself to generate. Defaults to v1. ", - Details: "Currently, the only supported value is v1. \n The first version listed will be assumed to be the \"default\" version and will not get a version suffix in the output filename. \n You'll need to use \"v1\" to get support for features like defaulting, along with an API server that supports it (Kubernetes 1.16+).", - }, - "GenerateEmbeddedObjectMeta": { - Summary: "specifies if any embedded ObjectMeta in the CRD should be generated", - Details: "", - }, - }, - } -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/doc.go b/vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/doc.go deleted file mode 100644 index f4200f2fc13..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/doc.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 deepcopy generates DeepCopy, DeepCopyInto, and DeepCopyObject -// implementations for types. -// -// It's ported from k8s.io/code-generator's / k8s.io/gengo's deepcopy-gen, -// but it's scoped specifically to runtime.Object and skips support for -// deepcopying interfaces, which aren't handled in CRDs anyway. -package deepcopy diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/gen.go b/vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/gen.go deleted file mode 100644 index 7e674a80aab..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/gen.go +++ /dev/null @@ -1,305 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 deepcopy - -import ( - "bytes" - "fmt" - "go/ast" - "go/format" - "io" - "sort" - "strings" - - "sigs.k8s.io/controller-tools/pkg/genall" - "sigs.k8s.io/controller-tools/pkg/loader" - "sigs.k8s.io/controller-tools/pkg/markers" -) - -// NB(directxman12): markers.LoadRoots ignores autogenerated code via a build tag -// so any time we check for existing deepcopy functions, we only seen manually written ones. - -const ( - runtimeObjPath = "k8s.io/apimachinery/pkg/runtime.Object" -) - -var ( - enablePkgMarker = markers.Must(markers.MakeDefinition("kubebuilder:object:generate", markers.DescribesPackage, false)) - enableTypeMarker = markers.Must(markers.MakeDefinition("kubebuilder:object:generate", markers.DescribesType, false)) - isObjectMarker = markers.Must(markers.MakeDefinition("kubebuilder:object:root", markers.DescribesType, false)) - - legacyEnablePkgMarker = markers.Must(markers.MakeDefinition("k8s:deepcopy-gen", markers.DescribesPackage, markers.RawArguments(nil))) - legacyEnableTypeMarker = markers.Must(markers.MakeDefinition("k8s:deepcopy-gen", markers.DescribesType, markers.RawArguments(nil))) - legacyIsObjectMarker = markers.Must(markers.MakeDefinition("k8s:deepcopy-gen:interfaces", markers.DescribesType, "")) -) - -// +controllertools:marker:generateHelp - -// Generator generates code containing DeepCopy, DeepCopyInto, and -// DeepCopyObject method implementations. -type Generator struct { - // HeaderFile specifies the header text (e.g. license) to prepend to generated files. - HeaderFile string `marker:",optional"` - // Year specifies the year to substitute for " YEAR" in the header file. - Year string `marker:",optional"` -} - -func (Generator) CheckFilter() loader.NodeFilter { - return func(node ast.Node) bool { - // ignore interfaces - _, isIface := node.(*ast.InterfaceType) - return !isIface - } -} - -func (Generator) RegisterMarkers(into *markers.Registry) error { - if err := markers.RegisterAll(into, - enablePkgMarker, legacyEnablePkgMarker, enableTypeMarker, - legacyEnableTypeMarker, isObjectMarker, legacyIsObjectMarker); err != nil { - return err - } - into.AddHelp(enablePkgMarker, - markers.SimpleHelp("object", "enables or disables object interface & deepcopy implementation generation for this package")) - into.AddHelp( - enableTypeMarker, markers.SimpleHelp("object", "overrides enabling or disabling deepcopy generation for this type")) - into.AddHelp(isObjectMarker, - markers.SimpleHelp("object", "enables object interface implementation generation for this type")) - - into.AddHelp(legacyEnablePkgMarker, - markers.DeprecatedHelp(enablePkgMarker.Name, "object", "enables or disables object interface & deepcopy implementation generation for this package")) - into.AddHelp(legacyEnableTypeMarker, - markers.DeprecatedHelp(enableTypeMarker.Name, "object", "overrides enabling or disabling deepcopy generation for this type")) - into.AddHelp(legacyIsObjectMarker, - markers.DeprecatedHelp(isObjectMarker.Name, "object", "enables object interface implementation generation for this type")) - return nil -} - -func enabledOnPackage(col *markers.Collector, pkg *loader.Package) (bool, error) { - pkgMarkers, err := markers.PackageMarkers(col, pkg) - if err != nil { - return false, err - } - pkgMarker := pkgMarkers.Get(enablePkgMarker.Name) - if pkgMarker != nil { - return pkgMarker.(bool), nil - } - legacyMarker := pkgMarkers.Get(legacyEnablePkgMarker.Name) - if legacyMarker != nil { - legacyMarkerVal := string(legacyMarker.(markers.RawArguments)) - firstArg := strings.Split(legacyMarkerVal, ",")[0] - return firstArg == "package", nil - } - - return false, nil -} - -func enabledOnType(allTypes bool, info *markers.TypeInfo) bool { - if typeMarker := info.Markers.Get(enableTypeMarker.Name); typeMarker != nil { - return typeMarker.(bool) - } - legacyMarker := info.Markers.Get(legacyEnableTypeMarker.Name) - if legacyMarker != nil { - legacyMarkerVal := string(legacyMarker.(markers.RawArguments)) - return legacyMarkerVal == "true" - } - return allTypes || genObjectInterface(info) -} - -func genObjectInterface(info *markers.TypeInfo) bool { - objectEnabled := info.Markers.Get(isObjectMarker.Name) - if objectEnabled != nil { - return objectEnabled.(bool) - } - - for _, legacyEnabled := range info.Markers[legacyIsObjectMarker.Name] { - if legacyEnabled == runtimeObjPath { - return true - } - } - return false -} - -func (d Generator) Generate(ctx *genall.GenerationContext) error { - var headerText string - - if d.HeaderFile != "" { - headerBytes, err := ctx.ReadFile(d.HeaderFile) - if err != nil { - return err - } - headerText = string(headerBytes) - } - headerText = strings.ReplaceAll(headerText, " YEAR", " "+d.Year) - - objGenCtx := ObjectGenCtx{ - Collector: ctx.Collector, - Checker: ctx.Checker, - HeaderText: headerText, - } - - for _, root := range ctx.Roots { - outContents := objGenCtx.generateForPackage(root) - if outContents == nil { - continue - } - - writeOut(ctx, root, outContents) - } - - return nil -} - -// ObjectGenCtx contains the common info for generating deepcopy implementations. -// It mostly exists so that generating for a package can be easily tested without -// requiring a full set of output rules, etc. -type ObjectGenCtx struct { - Collector *markers.Collector - Checker *loader.TypeChecker - HeaderText string -} - -// writeHeader writes out the build tag, package declaration, and imports -func writeHeader(pkg *loader.Package, out io.Writer, packageName string, imports *importsList, headerText string) { - // NB(directxman12): blank line after build tags to distinguish them from comments - _, err := fmt.Fprintf(out, `//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -%[3]s - -// Code generated by controller-gen. DO NOT EDIT. - -package %[1]s - -import ( -%[2]s -) - -`, packageName, strings.Join(imports.ImportSpecs(), "\n"), headerText) - if err != nil { - pkg.AddError(err) - } - -} - -// generateForPackage generates DeepCopy and runtime.Object implementations for -// types in the given package, writing the formatted result to given writer. -// May return nil if source could not be generated. -func (ctx *ObjectGenCtx) generateForPackage(root *loader.Package) []byte { - allTypes, err := enabledOnPackage(ctx.Collector, root) - if err != nil { - root.AddError(err) - return nil - } - - ctx.Checker.Check(root) - - root.NeedTypesInfo() - - byType := make(map[string][]byte) - imports := &importsList{ - byPath: make(map[string]string), - byAlias: make(map[string]string), - pkg: root, - } - // avoid confusing aliases by "reserving" the root package's name as an alias - imports.byAlias[root.Name] = "" - - if err := markers.EachType(ctx.Collector, root, func(info *markers.TypeInfo) { - outContent := new(bytes.Buffer) - - // copy when nabled for all types and not disabled, or enabled - // specifically on this type - if !enabledOnType(allTypes, info) { - return - } - - // avoid copying non-exported types, etc - if !shouldBeCopied(root, info) { - return - } - - copyCtx := ©MethodMaker{ - pkg: root, - importsList: imports, - codeWriter: &codeWriter{out: outContent}, - } - - copyCtx.GenerateMethodsFor(root, info) - - outBytes := outContent.Bytes() - if len(outBytes) > 0 { - byType[info.Name] = outBytes - } - }); err != nil { - root.AddError(err) - return nil - } - - if len(byType) == 0 { - return nil - } - - outContent := new(bytes.Buffer) - writeHeader(root, outContent, root.Name, imports, ctx.HeaderText) - writeMethods(root, outContent, byType) - - outBytes := outContent.Bytes() - formattedBytes, err := format.Source(outBytes) - if err != nil { - root.AddError(err) - // we still write the invalid source to disk to figure out what went wrong - } else { - outBytes = formattedBytes - } - - return outBytes -} - -// writeMethods writes each method to the file, sorted by type name. -func writeMethods(pkg *loader.Package, out io.Writer, byType map[string][]byte) { - sortedNames := make([]string, 0, len(byType)) - for name := range byType { - sortedNames = append(sortedNames, name) - } - sort.Strings(sortedNames) - - for _, name := range sortedNames { - _, err := out.Write(byType[name]) - if err != nil { - pkg.AddError(err) - } - } -} - -// writeFormatted outputs the given code, after gofmt-ing it. If we couldn't gofmt, -// we write the unformatted code for debugging purposes. -func writeOut(ctx *genall.GenerationContext, root *loader.Package, outBytes []byte) { - outputFile, err := ctx.Open(root, "zz_generated.deepcopy.go") - if err != nil { - root.AddError(err) - return - } - defer outputFile.Close() - n, err := outputFile.Write(outBytes) - if err != nil { - root.AddError(err) - return - } - if n < len(outBytes) { - root.AddError(io.ErrShortWrite) - } -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/traverse.go b/vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/traverse.go deleted file mode 100644 index 3a751757d5d..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/traverse.go +++ /dev/null @@ -1,829 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 deepcopy - -import ( - "fmt" - "go/ast" - "go/types" - "io" - "path" - "strings" - "unicode" - "unicode/utf8" - - "sigs.k8s.io/controller-tools/pkg/loader" - "sigs.k8s.io/controller-tools/pkg/markers" -) - -// NB(directxman12): This code is a bit of a byzantine mess. -// I've tried to clean it up a bit from the original in deepcopy-gen, -// but parts remain a bit convoluted. Exercise caution when changing. -// It's perhaps a tad over-commented now, but better safe than sorry. -// It also seriously needs auditing for sanity -- there's parts where we -// copy the original deepcopy-gen's output just to be safe, but some of that -// could be simplified away if we're careful. - -// codeWriter assists in writing out Go code lines and blocks to a writer. -type codeWriter struct { - out io.Writer -} - -// Line writes a single line. -func (c *codeWriter) Line(line string) { - fmt.Fprintln(c.out, line) -} - -// Linef writes a single line with formatting (as per fmt.Sprintf). -func (c *codeWriter) Linef(line string, args ...interface{}) { - fmt.Fprintf(c.out, line+"\n", args...) -} - -// If writes an if statement with the given setup/condition clause, executing -// the given function to write the contents of the block. -func (c *codeWriter) If(setup string, block func()) { - c.Linef("if %s {", setup) - block() - c.Line("}") -} - -// If writes if and else statements with the given setup/condition clause, executing -// the given functions to write the contents of the blocks. -func (c *codeWriter) IfElse(setup string, ifBlock func(), elseBlock func()) { - c.Linef("if %s {", setup) - ifBlock() - c.Line("} else {") - elseBlock() - c.Line("}") -} - -// For writes an for statement with the given setup/condition clause, executing -// the given function to write the contents of the block. -func (c *codeWriter) For(setup string, block func()) { - c.Linef("for %s {", setup) - block() - c.Line("}") -} - -// importsList keeps track of required imports, automatically assigning aliases -// to import statement. -type importsList struct { - byPath map[string]string - byAlias map[string]string - - pkg *loader.Package -} - -// NeedImport marks that the given package is needed in the list of imports, -// returning the ident (import alias) that should be used to reference the package. -func (l *importsList) NeedImport(importPath string) string { - // we get an actual path from Package, which might include venddored - // packages if running on a package in vendor. - if ind := strings.LastIndex(importPath, "/vendor/"); ind != -1 { - importPath = importPath[ind+8: /* len("/vendor/") */] - } - - // check to see if we've already assigned an alias, and just return that. - alias, exists := l.byPath[importPath] - if exists { - return alias - } - - // otherwise, calculate an import alias by joining path parts till we get something unique - restPath, nextWord := path.Split(importPath) - - for otherPath, exists := "", true; exists && otherPath != importPath; otherPath, exists = l.byAlias[alias] { - if restPath == "" { - // do something else to disambiguate if we're run out of parts and - // still have duplicates, somehow - alias += "x" - } - - // can't have a first digit, per Go identifier rules, so just skip them - for firstRune, runeLen := utf8.DecodeRuneInString(nextWord); unicode.IsDigit(firstRune); firstRune, runeLen = utf8.DecodeRuneInString(nextWord) { - nextWord = nextWord[runeLen:] - } - - // make a valid identifier by replacing "bad" characters with underscores - nextWord = strings.Map(func(r rune) rune { - if unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' { - return r - } - return '_' - }, nextWord) - - alias = nextWord + alias - if len(restPath) > 0 { - restPath, nextWord = path.Split(restPath[:len(restPath)-1] /* chop off final slash */) - } - } - - l.byPath[importPath] = alias - l.byAlias[alias] = importPath - return alias -} - -// ImportSpecs returns a string form of each import spec -// (i.e. `alias "path/to/import"). Aliases are only present -// when they don't match the package name. -func (l *importsList) ImportSpecs() []string { - res := make([]string, 0, len(l.byPath)) - for importPath, alias := range l.byPath { - pkg := l.pkg.Imports()[importPath] - if pkg != nil && pkg.Name == alias { - // don't print if alias is the same as package name - // (we've already taken care of duplicates). - res = append(res, fmt.Sprintf("%q", importPath)) - } else { - res = append(res, fmt.Sprintf("%s %q", alias, importPath)) - } - } - return res -} - -// namingInfo holds package and syntax for referencing a field, type, -// etc. It's used to allow lazily marking import usage. -// You should generally retrieve the syntax using Syntax. -type namingInfo struct { - // typeInfo is the type being named. - typeInfo types.Type - nameOverride string -} - -// Syntax calculates the code representation of the given type or name, -// and marks that is used (potentially marking an import as used). -func (n *namingInfo) Syntax(basePkg *loader.Package, imports *importsList) string { - if n.nameOverride != "" { - return n.nameOverride - } - - // NB(directxman12): typeInfo.String gets us most of the way there, - // but fails (for us) on named imports, since it uses the full package path. - switch typeInfo := n.typeInfo.(type) { - case *types.Named: - // register that we need an import for this type, - // so we can get the appropriate alias to use. - typeName := typeInfo.Obj() - otherPkg := typeName.Pkg() - if otherPkg == basePkg.Types { - // local import - return typeName.Name() - } - alias := imports.NeedImport(loader.NonVendorPath(otherPkg.Path())) - return alias + "." + typeName.Name() - case *types.Basic: - return typeInfo.String() - case *types.Pointer: - return "*" + (&namingInfo{typeInfo: typeInfo.Elem()}).Syntax(basePkg, imports) - case *types.Slice: - return "[]" + (&namingInfo{typeInfo: typeInfo.Elem()}).Syntax(basePkg, imports) - case *types.Map: - return fmt.Sprintf( - "map[%s]%s", - (&namingInfo{typeInfo: typeInfo.Key()}).Syntax(basePkg, imports), - (&namingInfo{typeInfo: typeInfo.Elem()}).Syntax(basePkg, imports)) - default: - basePkg.AddError(fmt.Errorf("name requested for invalid type: %s", typeInfo)) - return typeInfo.String() - } -} - -// copyMethodMakers makes DeepCopy (and related) methods for Go types, -// writing them to its codeWriter. -type copyMethodMaker struct { - pkg *loader.Package - *importsList - *codeWriter -} - -// GenerateMethodsFor makes DeepCopy, DeepCopyInto, and DeepCopyObject methods -// for the given type, when appropriate -func (c *copyMethodMaker) GenerateMethodsFor(root *loader.Package, info *markers.TypeInfo) { - typeInfo := root.TypesInfo.TypeOf(info.RawSpec.Name) - if typeInfo == types.Typ[types.Invalid] { - root.AddError(loader.ErrFromNode(fmt.Errorf("unknown type: %s", info.Name), info.RawSpec)) - } - - // figure out if we need to use a pointer receiver -- most types get a pointer receiver, - // except those that are aliases to types that are already pass-by-reference (pointers, - // interfaces. maps, slices). - ptrReceiver := usePtrReceiver(typeInfo) - - hasManualDeepCopyInto := hasDeepCopyIntoMethod(root, typeInfo) - hasManualDeepCopy, deepCopyOnPtr := hasDeepCopyMethod(root, typeInfo) - - // only generate each method if it hasn't been implemented. - if !hasManualDeepCopyInto { - c.Line("// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.") - if ptrReceiver { - c.Linef("func (in *%s) DeepCopyInto(out *%s) {", info.Name, info.Name) - } else { - c.Linef("func (in %s) DeepCopyInto(out *%s) {", info.Name, info.Name) - c.Line("{in := &in") // add an extra block so that we can redefine `in` without type issues - } - - // just wrap the existing deepcopy if present - if hasManualDeepCopy { - if deepCopyOnPtr { - c.Line("clone := in.DeepCopy()") - c.Line("*out = *clone") - } else { - c.Line("*out = in.DeepCopy()") - } - } else { - c.genDeepCopyIntoBlock(&namingInfo{nameOverride: info.Name}, typeInfo) - } - - if !ptrReceiver { - c.Line("}") // close our extra "in redefinition" block - } - c.Line("}") - } - - if !hasManualDeepCopy { - // these are both straightforward, so we just template them out. - if ptrReceiver { - c.Linef(ptrDeepCopy, info.Name) - } else { - c.Linef(bareDeepCopy, info.Name) - } - - // maybe also generate DeepCopyObject, if asked. - if genObjectInterface(info) { - // we always need runtime.Object for DeepCopyObject - runtimeAlias := c.NeedImport("k8s.io/apimachinery/pkg/runtime") - if ptrReceiver { - c.Linef(ptrDeepCopyObj, info.Name, runtimeAlias) - } else { - c.Linef(bareDeepCopyObj, info.Name, runtimeAlias) - } - } - } -} - -// genDeepCopyBody generates a DeepCopyInto block for the given type. The -// block is *not* wrapped in curly braces. -func (c *copyMethodMaker) genDeepCopyIntoBlock(actualName *namingInfo, typeInfo types.Type) { - // we calculate *how* we should copy mostly based on the "eventual" type of - // a given type (i.e. the type that results from following all aliases) - last := eventualUnderlyingType(typeInfo) - - // we might hit a type that has a manual deepcopy method written on non-root types - // (this case is handled for root types in GenerateMethodFor). - // In that case (when we're not dealing with a pointer, since those need special handling - // to match 1-to-1 with k8s deepcopy-gen), just use that. - if _, isPtr := last.(*types.Pointer); !isPtr && hasAnyDeepCopyMethod(c.pkg, typeInfo) { - c.Line("*out = in.DeepCopy()") - return - } - - switch last := last.(type) { - case *types.Basic: - switch last.Kind() { - case types.Invalid, types.UnsafePointer: - c.pkg.AddError(fmt.Errorf("invalid type: %s", last)) - default: - // basic types themselves can be "shallow" copied, so all we need - // to do is check if our *actual* type (not the underlying one) has - // a custom method implemented. - if hasMethod, _ := hasDeepCopyMethod(c.pkg, typeInfo); hasMethod { - c.Line("*out = in.DeepCopy()") - } - c.Line("*out = *in") - } - case *types.Map: - c.genMapDeepCopy(actualName, last) - case *types.Slice: - c.genSliceDeepCopy(actualName, last) - case *types.Struct: - c.genStructDeepCopy(actualName, last) - case *types.Pointer: - c.genPointerDeepCopy(actualName, last) - case *types.Named: - // handled via the above loop, should never happen - c.pkg.AddError(fmt.Errorf("interface type %s encountered directly, invalid condition", last)) - default: - c.pkg.AddError(fmt.Errorf("invalid type: %s", last)) - } -} - -// genMapDeepCopy generates DeepCopy code for the given named type whose eventual -// type is the given map type. -func (c *copyMethodMaker) genMapDeepCopy(actualName *namingInfo, mapType *types.Map) { - // maps *must* have shallow-copiable types, since we just iterate - // through the keys, only trying to deepcopy the values. - if !fineToShallowCopy(mapType.Key()) { - c.pkg.AddError(fmt.Errorf("invalid map key type: %s", mapType.Key())) - return - } - - // make our actual type (not the underlying one)... - c.Linef("*out = make(%[1]s, len(*in))", actualName.Syntax(c.pkg, c.importsList)) - - // ...and copy each element appropriately - c.For("key, val := range *in", func() { - // check if we have manually written methods, - // in which case we'll just try and use those - hasDeepCopy, copyOnPtr := hasDeepCopyMethod(c.pkg, mapType.Elem()) - hasDeepCopyInto := hasDeepCopyIntoMethod(c.pkg, mapType.Elem()) - switch { - case hasDeepCopyInto || hasDeepCopy: - // use the manually-written methods - _, fieldIsPtr := mapType.Elem().(*types.Pointer) // is "out" actually a pointer - inIsPtr := resultWillBePointer(mapType.Elem(), hasDeepCopy, copyOnPtr) // does copying "in" produce a pointer - if hasDeepCopy { - // If we're calling DeepCopy, check if it's receiver needs a pointer - inIsPtr = copyOnPtr - } - if inIsPtr == fieldIsPtr { - c.Line("(*out)[key] = val.DeepCopy()") - } else if fieldIsPtr { - c.Line("{") // use a block because we use `x` as a temporary - c.Line("x := val.DeepCopy()") - c.Line("(*out)[key] = &x") - c.Line("}") - } else { - c.Line("(*out)[key] = *val.DeepCopy()") - } - case fineToShallowCopy(mapType.Elem()): - // just shallow copy types for which it's safe to do so - c.Line("(*out)[key] = val") - default: - // otherwise, we've got some kind-specific actions, - // based on the element's eventual type. - - underlyingElem := eventualUnderlyingType(mapType.Elem()) - - // if it passes by reference, let the main switch handle it - if passesByReference(underlyingElem) { - c.Linef("var outVal %[1]s", (&namingInfo{typeInfo: underlyingElem}).Syntax(c.pkg, c.importsList)) - c.IfElse("val == nil", func() { - c.Line("(*out)[key] = nil") - }, func() { - c.Line("in, out := &val, &outVal") - c.genDeepCopyIntoBlock(&namingInfo{typeInfo: mapType.Elem()}, mapType.Elem()) - }) - c.Line("(*out)[key] = outVal") - - return - } - - // otherwise... - switch underlyingElem := underlyingElem.(type) { - case *types.Struct: - // structs will have deepcopy generated for them, so use that - c.Line("(*out)[key] = *val.DeepCopy()") - default: - c.pkg.AddError(fmt.Errorf("invalid map value type: %s", underlyingElem)) - return - } - } - }) -} - -// genSliceDeepCopy generates DeepCopy code for the given named type whose -// underlying type is the given slice. -func (c *copyMethodMaker) genSliceDeepCopy(actualName *namingInfo, sliceType *types.Slice) { - underlyingElem := eventualUnderlyingType(sliceType.Elem()) - - // make the actual type (not the underlying) - c.Linef("*out = make(%[1]s, len(*in))", actualName.Syntax(c.pkg, c.importsList)) - - // check if we need to do anything special, or just copy each element appropriately - switch { - case hasAnyDeepCopyMethod(c.pkg, sliceType.Elem()): - // just use deepcopy if it's present (deepcopyinto will be filled in by our code) - c.For("i := range *in", func() { - c.Line("(*in)[i].DeepCopyInto(&(*out)[i])") - }) - case fineToShallowCopy(underlyingElem): - // shallow copy if ok - c.Line("copy(*out, *in)") - default: - // copy each element appropriately - c.For("i := range *in", func() { - // fall back to normal code for reference types or those with custom logic - if passesByReference(underlyingElem) || hasAnyDeepCopyMethod(c.pkg, sliceType.Elem()) { - c.If("(*in)[i] != nil", func() { - c.Line("in, out := &(*in)[i], &(*out)[i]") - c.genDeepCopyIntoBlock(&namingInfo{typeInfo: sliceType.Elem()}, sliceType.Elem()) - }) - return - } - - switch underlyingElem.(type) { - case *types.Struct: - // structs will always have deepcopy - c.Linef("(*in)[i].DeepCopyInto(&(*out)[i])") - default: - c.pkg.AddError(fmt.Errorf("invalid slice element type: %s", underlyingElem)) - } - }) - } -} - -// genStructDeepCopy generates DeepCopy code for the given named type whose -// underlying type is the given struct. -func (c *copyMethodMaker) genStructDeepCopy(_ *namingInfo, structType *types.Struct) { - c.Line("*out = *in") - - for i := 0; i < structType.NumFields(); i++ { - field := structType.Field(i) - - // if we have a manual deepcopy, use that - hasDeepCopy, copyOnPtr := hasDeepCopyMethod(c.pkg, field.Type()) - hasDeepCopyInto := hasDeepCopyIntoMethod(c.pkg, field.Type()) - if hasDeepCopyInto || hasDeepCopy { - // NB(directxman12): yes, I know this is kind-of weird that we - // have all this special-casing here, but it's nice for testing - // purposes to be 1-to-1 with deepcopy-gen, which does all sorts of - // stuff like this (I'm pretty sure I found some codepaths that - // never execute there, because they're pretty clearly invalid - // syntax). - - _, fieldIsPtr := field.Type().(*types.Pointer) - inIsPtr := resultWillBePointer(field.Type(), hasDeepCopy, copyOnPtr) - if fieldIsPtr { - // we'll need a if block to check for nilness - // we'll let genDeepCopyIntoBlock handle the details, we just needed the setup - c.If(fmt.Sprintf("in.%s != nil", field.Name()), func() { - c.Linef("in, out := &in.%[1]s, &out.%[1]s", field.Name()) - c.genDeepCopyIntoBlock(&namingInfo{typeInfo: field.Type()}, field.Type()) - }) - } else { - // special-case for compatibility with deepcopy-gen - if inIsPtr == fieldIsPtr { - c.Linef("out.%[1]s = in.%[1]s.DeepCopy()", field.Name()) - } else { - c.Linef("in.%[1]s.DeepCopyInto(&out.%[1]s)", field.Name()) - } - } - continue - } - - // pass-by-reference fields get delegated to the main type - underlyingField := eventualUnderlyingType(field.Type()) - if passesByReference(underlyingField) { - c.If(fmt.Sprintf("in.%s != nil", field.Name()), func() { - c.Linef("in, out := &in.%[1]s, &out.%[1]s", field.Name()) - c.genDeepCopyIntoBlock(&namingInfo{typeInfo: field.Type()}, field.Type()) - }) - continue - } - - // otherwise... - switch underlyingField := underlyingField.(type) { - case *types.Basic: - switch underlyingField.Kind() { - case types.Invalid, types.UnsafePointer: - c.pkg.AddError(loader.ErrFromNode(fmt.Errorf("invalid field type: %s", underlyingField), field)) - return - default: - // nothing to do, initial assignment copied this - } - case *types.Struct: - if fineToShallowCopy(field.Type()) { - c.Linef("out.%[1]s = in.%[1]s", field.Name()) - } else { - c.Linef("in.%[1]s.DeepCopyInto(&out.%[1]s)", field.Name()) - } - default: - c.pkg.AddError(loader.ErrFromNode(fmt.Errorf("invalid field type: %s", underlyingField), field)) - return - } - } -} - -// genPointerDeepCopy generates DeepCopy code for the given named type whose -// underlying type is the given struct. -func (c *copyMethodMaker) genPointerDeepCopy(_ *namingInfo, pointerType *types.Pointer) { - underlyingElem := eventualUnderlyingType(pointerType.Elem()) - - // if we have a manually written deepcopy, just use that - hasDeepCopy, copyOnPtr := hasDeepCopyMethod(c.pkg, pointerType.Elem()) - hasDeepCopyInto := hasDeepCopyIntoMethod(c.pkg, pointerType.Elem()) - if hasDeepCopyInto || hasDeepCopy { - outNeedsPtr := resultWillBePointer(pointerType.Elem(), hasDeepCopy, copyOnPtr) - if hasDeepCopy { - outNeedsPtr = copyOnPtr - } - if outNeedsPtr { - c.Line("*out = (*in).DeepCopy()") - } else { - c.Line("x := (*in).DeepCopy()") - c.Line("*out = &x") - } - return - } - - // shallow-copiable types are pretty easy - if fineToShallowCopy(underlyingElem) { - c.Linef("*out = new(%[1]s)", (&namingInfo{typeInfo: pointerType.Elem()}).Syntax(c.pkg, c.importsList)) - c.Line("**out = **in") - return - } - - // pass-by-reference types get delegated to the main switch - if passesByReference(underlyingElem) { - c.Linef("*out = new(%s)", (&namingInfo{typeInfo: underlyingElem}).Syntax(c.pkg, c.importsList)) - c.If("**in != nil", func() { - c.Line("in, out := *in, *out") - c.genDeepCopyIntoBlock(&namingInfo{typeInfo: underlyingElem}, eventualUnderlyingType(underlyingElem)) - }) - return - } - - // otherwise... - switch underlyingElem := underlyingElem.(type) { - case *types.Struct: - c.Linef("*out = new(%[1]s)", (&namingInfo{typeInfo: pointerType.Elem()}).Syntax(c.pkg, c.importsList)) - c.Line("(*in).DeepCopyInto(*out)") - default: - c.pkg.AddError(fmt.Errorf("invalid pointer element type: %s", underlyingElem)) - return - } -} - -// usePtrReceiver checks if we need a pointer receiver on methods for the given type -// Pass-by-reference types don't get pointer receivers. -func usePtrReceiver(typeInfo types.Type) bool { - switch typeInfo.(type) { - case *types.Pointer: - return false - case *types.Map: - return false - case *types.Slice: - return false - case *types.Named: - return usePtrReceiver(typeInfo.Underlying()) - default: - return true - } -} - -func resultWillBePointer(typeInfo types.Type, hasDeepCopy, deepCopyOnPtr bool) bool { - // if we have a manual deepcopy, we can just check what that returns - if hasDeepCopy { - return deepCopyOnPtr - } - - // otherwise, we'll need to check its type - switch typeInfo := typeInfo.(type) { - case *types.Pointer: - // NB(directxman12): we don't have to worry about the elem having a deepcopy, - // since hasManualDeepCopy would've caught that. - - // we'll be calling on the elem, so check that - return resultWillBePointer(typeInfo.Elem(), false, false) - case *types.Map: - return false - case *types.Slice: - return false - case *types.Named: - return resultWillBePointer(typeInfo.Underlying(), false, false) - default: - return true - } -} - -// shouldBeCopied checks if we're supposed to make deepcopy methods the given type. -// -// This is the case if it's exported *and* either: -// - has a partial manual DeepCopy implementation (in which case we fill in the rest) -// - aliases to a non-basic type eventually -// - is a struct -func shouldBeCopied(pkg *loader.Package, info *markers.TypeInfo) bool { - if !ast.IsExported(info.Name) { - return false - } - - typeInfo := pkg.TypesInfo.TypeOf(info.RawSpec.Name) - if typeInfo == types.Typ[types.Invalid] { - pkg.AddError(loader.ErrFromNode(fmt.Errorf("unknown type: %s", info.Name), info.RawSpec)) - return false - } - - // according to gengo, everything named is an alias, except for an alias to a pointer, - // which is just a pointer, afaict. Just roll with it. - if asPtr, isPtr := typeInfo.(*types.Named).Underlying().(*types.Pointer); isPtr { - typeInfo = asPtr - } - - lastType := typeInfo - if _, isNamed := typeInfo.(*types.Named); isNamed { - // if it has a manual deepcopy or deepcopyinto, we're fine - if hasAnyDeepCopyMethod(pkg, typeInfo) { - return true - } - - for underlyingType := typeInfo.Underlying(); underlyingType != lastType; lastType, underlyingType = underlyingType, underlyingType.Underlying() { - // if it has a manual deepcopy or deepcopyinto, we're fine - if hasAnyDeepCopyMethod(pkg, underlyingType) { - return true - } - - // aliases to other things besides basics need copy methods - // (basics can be straight-up shallow-copied) - if _, isBasic := underlyingType.(*types.Basic); !isBasic { - return true - } - } - } - - // structs are the only thing that's not a basic that's copiable by default - _, isStruct := lastType.(*types.Struct) - return isStruct -} - -// hasDeepCopyMethod checks if this type has a manual DeepCopy method and if -// the method has a pointer receiver. -func hasDeepCopyMethod(pkg *loader.Package, typeInfo types.Type) (bool, bool) { - deepCopyMethod, ind, _ := types.LookupFieldOrMethod(typeInfo, true /* check pointers too */, pkg.Types, "DeepCopy") - if len(ind) != 1 { - // ignore embedded methods - return false, false - } - if deepCopyMethod == nil { - return false, false - } - - methodSig := deepCopyMethod.Type().(*types.Signature) - if methodSig.Params() != nil && methodSig.Params().Len() != 0 { - return false, false - } - if methodSig.Results() == nil || methodSig.Results().Len() != 1 { - return false, false - } - - recvAsPtr, recvIsPtr := methodSig.Recv().Type().(*types.Pointer) - if recvIsPtr { - // NB(directxman12): the pointer type returned here isn't comparable even though they - // have the same underlying type, for some reason (probably that - // LookupFieldOrMethod calls types.NewPointer for us), so check the - // underlying values. - - resultPtr, resultIsPtr := methodSig.Results().At(0).Type().(*types.Pointer) - if !resultIsPtr { - // pointer vs non-pointer are different types - return false, false - } - - if recvAsPtr.Elem() != resultPtr.Elem() { - return false, false - } - } else if methodSig.Results().At(0).Type() != methodSig.Recv().Type() { - return false, false - } - - return true, recvIsPtr -} - -// hasDeepCopyIntoMethod checks if this type has a manual DeepCopyInto method. -func hasDeepCopyIntoMethod(pkg *loader.Package, typeInfo types.Type) bool { - deepCopyMethod, ind, _ := types.LookupFieldOrMethod(typeInfo, true /* check pointers too */, pkg.Types, "DeepCopyInto") - if len(ind) != 1 { - // ignore embedded methods - return false - } - if deepCopyMethod == nil { - return false - } - - methodSig := deepCopyMethod.Type().(*types.Signature) - if methodSig.Params() == nil || methodSig.Params().Len() != 1 { - return false - } - paramPtr, isPtr := methodSig.Params().At(0).Type().(*types.Pointer) - if !isPtr { - return false - } - if methodSig.Results() != nil && methodSig.Results().Len() != 0 { - return false - } - - if recvPtr, recvIsPtr := methodSig.Recv().Type().(*types.Pointer); recvIsPtr { - // NB(directxman12): the pointer type returned here isn't comparable even though they - // have the same underlying type, for some reason (probably that - // LookupFieldOrMethod calls types.NewPointer for us), so check the - // underlying values. - return paramPtr.Elem() == recvPtr.Elem() - } - return methodSig.Recv().Type() == paramPtr.Elem() -} - -// hasAnyDeepCopyMethod checks if the given method has DeepCopy or DeepCopyInto -// (either of which implies the other will exist eventually). -func hasAnyDeepCopyMethod(pkg *loader.Package, typeInfo types.Type) bool { - hasDeepCopy, _ := hasDeepCopyMethod(pkg, typeInfo) - return hasDeepCopy || hasDeepCopyIntoMethod(pkg, typeInfo) -} - -// eventualUnderlyingType gets the "final" type in a sequence of named aliases. -// It's effectively a shortcut for calling Underlying in a loop. -func eventualUnderlyingType(typeInfo types.Type) types.Type { - last := typeInfo - for underlying := typeInfo.Underlying(); underlying != last; last, underlying = underlying, underlying.Underlying() { - // get the actual underlying type - } - return last -} - -// fineToShallowCopy checks if a shallow-copying a type is equivalent to deepcopy-ing it. -func fineToShallowCopy(typeInfo types.Type) bool { - switch typeInfo := typeInfo.(type) { - case *types.Basic: - // basic types (int, string, etc) are always fine to shallow-copy, - // except for Invalid and UnsafePointer, which can't be copied at all. - switch typeInfo.Kind() { - case types.Invalid, types.UnsafePointer: - return false - default: - return true - } - case *types.Named: - // aliases are fine to shallow-copy as long as they resolve to a shallow-copyable type - return fineToShallowCopy(typeInfo.Underlying()) - case *types.Struct: - // structs are fine to shallow-copy if they have all shallow-copyable fields - for i := 0; i < typeInfo.NumFields(); i++ { - field := typeInfo.Field(i) - if !fineToShallowCopy(field.Type()) { - return false - } - } - return true - default: - return false - } -} - -// passesByReference checks if the given type passesByReference -// (except for interfaces, which are handled separately). -func passesByReference(typeInfo types.Type) bool { - switch typeInfo.(type) { - case *types.Slice: - return true - case *types.Map: - return true - case *types.Pointer: - return true - default: - return false - } -} - -var ( - // ptrDeepCopy is a DeepCopy for a type with an existing DeepCopyInto and a pointer receiver. - ptrDeepCopy = ` -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new %[1]s. -func (in *%[1]s) DeepCopy() *%[1]s { - if in == nil { return nil } - out := new(%[1]s) - in.DeepCopyInto(out) - return out -} -` - - // ptrDeepCopy is a DeepCopy for a type with an existing DeepCopyInto and a non-pointer receiver. - bareDeepCopy = ` -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new %[1]s. -func (in %[1]s) DeepCopy() %[1]s { - if in == nil { return nil } - out := new(%[1]s) - in.DeepCopyInto(out) - return *out -} -` - - // ptrDeepCopy is a DeepCopyObject for a type with an existing DeepCopyInto and a pointer receiver. - ptrDeepCopyObj = ` -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *%[1]s) DeepCopyObject() %[2]s.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} -` - // ptrDeepCopy is a DeepCopyObject for a type with an existing DeepCopyInto and a non-pointer receiver. - bareDeepCopyObj = ` -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in %[1]s) DeepCopyObject() %[2]s.Object { - return in.DeepCopy() -} -` -) diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/zz_generated.markerhelp.go b/vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/zz_generated.markerhelp.go deleted file mode 100644 index 913bc1fb7f7..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/deepcopy/zz_generated.markerhelp.go +++ /dev/null @@ -1,46 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright2019 The Kubernetes 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. -*/ - -// Code generated by helpgen. DO NOT EDIT. - -package deepcopy - -import ( - "sigs.k8s.io/controller-tools/pkg/markers" -) - -func (Generator) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "", - DetailedHelp: markers.DetailedHelp{ - Summary: "generates code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{ - "HeaderFile": { - Summary: "specifies the header text (e.g. license) to prepend to generated files.", - Details: "", - }, - "Year": { - Summary: "specifies the year to substitute for \" YEAR\" in the header file.", - Details: "", - }, - }, - } -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/genall/doc.go b/vendor/sigs.k8s.io/controller-tools/pkg/genall/doc.go deleted file mode 100644 index df8dd713893..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/genall/doc.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 genall defines entrypoints for generation tools to hook into and -// share the same set of parsing, typechecking, and marker information. -// -// Generators -// -// Each Generator knows how to register its markers into a central Registry, -// and then how to generate output using a Collector and some root packages. -// Each generator can be considered to be the output type of a marker, for easy -// command line parsing. -// -// Output and Input -// -// Generators output artifacts via an OutputRule. OutputRules know how to -// write output for different package-associated (code) files, as well as -// config files. Each OutputRule should also be considered to be the output -// type as a marker, for easy command-line parsing. -// -// OutputRules groups together an OutputRule per generator, plus a default -// output rule for any not explicitly specified. -// -// OutputRules are defined for stdout, file writing, and sending to /dev/null -// (useful for doing "type-checking" without actually saving the results). -// -// InputRule defines custom input loading, but its shared across all -// Generators. There's currently only a filesystem implementation. -// -// Runtime and Context -// -// Runtime maps together Generators, and constructs "contexts" which provide -// the common collector and roots, plus the output rule for that generator, and -// a handle for reading files (like boilerplate headers). -// -// It will run all associated generators, printing errors and automatically -// skipping type-checking errors (since those are commonly caused by the -// partial type-checking of loader.TypeChecker). -// -// Options -// -// The FromOptions (and associated helpers) function makes it easy to use generators -// and output rules as markers that can be parsed from the command line, producing -// a registry from command line args. -package genall diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/genall/genall.go b/vendor/sigs.k8s.io/controller-tools/pkg/genall/genall.go deleted file mode 100644 index 63afbac07c8..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/genall/genall.go +++ /dev/null @@ -1,269 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 genall - -import ( - "encoding/json" - "fmt" - "io" - "io/ioutil" - "os" - - "golang.org/x/tools/go/packages" - rawyaml "gopkg.in/yaml.v2" - - "sigs.k8s.io/controller-tools/pkg/loader" - "sigs.k8s.io/controller-tools/pkg/markers" -) - -// Generators are a list of Generators. -// NB(directxman12): this is a pointer so that we can uniquely identify each -// instance of a generator, even if it's not hashable. Different *instances* -// of a generator are treated differently. -type Generators []*Generator - -// RegisterMarkers registers all markers defined by each of the Generators in -// this list into the given registry. -func (g Generators) RegisterMarkers(reg *markers.Registry) error { - for _, gen := range g { - if err := (*gen).RegisterMarkers(reg); err != nil { - return err - } - } - return nil -} - -// CheckFilters returns the set of NodeFilters for all Generators that -// implement NeedsTypeChecking. -func (g Generators) CheckFilters() []loader.NodeFilter { - var filters []loader.NodeFilter - for _, gen := range g { - withFilter, needsChecking := (*gen).(NeedsTypeChecking) - if !needsChecking { - continue - } - filters = append(filters, withFilter.CheckFilter()) - } - return filters -} - -// NeedsTypeChecking indicates that a particular generator needs & has opinions -// on typechecking. If this is not implemented, a generator will be given a -// context with a nil typechecker. -type NeedsTypeChecking interface { - // CheckFilter indicates the loader.NodeFilter (if any) that should be used - // to prune out unused types/packages when type-checking (nodes for which - // the filter returns true are considered "interesting"). This filter acts - // as a baseline -- all types the pass through this filter will be checked, - // but more than that may also be checked due to other generators' filters. - CheckFilter() loader.NodeFilter -} - -// Generator knows how to register some set of markers, and then produce -// output artifacts based on loaded code containing those markers, -// sharing common loaded data. -type Generator interface { - // RegisterMarkers registers all markers needed by this Generator - // into the given registry. - RegisterMarkers(into *markers.Registry) error - // Generate generates artifacts produced by this marker. - // It's called *after* RegisterMarkers has been called. - Generate(*GenerationContext) error -} - -// HasHelp is some Generator, OutputRule, etc with a help method. -type HasHelp interface { - // Help returns help for this generator. - Help() *markers.DefinitionHelp -} - -// Runtime collects generators, loaded program data (Collector, root Packages), -// and I/O rules, running them together. -type Runtime struct { - // Generators are the Generators to be run by this Runtime. - Generators Generators - // GenerationContext is the base generation context that's copied - // to produce the context for each Generator. - GenerationContext - // OutputRules defines how to output artifacts for each Generator. - OutputRules OutputRules - // ErrorWriter defines where to write error messages. - ErrorWriter io.Writer -} - -// GenerationContext defines the common information needed for each Generator -// to run. -type GenerationContext struct { - // Collector is the shared marker collector. - Collector *markers.Collector - // Roots are the base packages to be processed. - Roots []*loader.Package - // Checker is the shared partial type-checker. - Checker *loader.TypeChecker - // OutputRule describes how to output artifacts. - OutputRule - // InputRule describes how to load associated boilerplate artifacts. - // It should *not* be used to load source files. - InputRule -} - -// WriteYAMLOptions implements the Options Pattern for WriteYAML. -type WriteYAMLOptions struct { - transform func(obj map[string]interface{}) error -} - -// WithTransform applies a transformation to objects just before writing them. -func WithTransform(transform func(obj map[string]interface{}) error) *WriteYAMLOptions { - return &WriteYAMLOptions{ - transform: transform, - } -} - -// WriteYAML writes the given objects out, serialized as YAML, using the -// context's OutputRule. Objects are written as separate documents, separated -// from each other by `---` (as per the YAML spec). -func (g GenerationContext) WriteYAML(itemPath string, objs []interface{}, options ...*WriteYAMLOptions) error { - out, err := g.Open(nil, itemPath) - if err != nil { - return err - } - defer out.Close() - - for _, obj := range objs { - yamlContent, err := yamlMarshal(obj, options...) - if err != nil { - return err - } - n, err := out.Write(append([]byte("---\n"), yamlContent...)) - if err != nil { - return err - } - if n < len(yamlContent) { - return io.ErrShortWrite - } - } - - return nil -} - -// yamlMarshal is based on sigs.k8s.io/yaml.Marshal, but allows for transforming the final data before writing. -func yamlMarshal(o interface{}, options ...*WriteYAMLOptions) ([]byte, error) { - j, err := json.Marshal(o) - if err != nil { - return nil, fmt.Errorf("error marshaling into JSON: %v", err) - } - - return yamlJSONToYAMLWithFilter(j, options...) -} - -// yamlJSONToYAMLWithFilter is based on sigs.k8s.io/yaml.JSONToYAML, but allows for transforming the final data before writing. -func yamlJSONToYAMLWithFilter(j []byte, options ...*WriteYAMLOptions) ([]byte, error) { - // Convert the JSON to an object. - var jsonObj map[string]interface{} - // We are using yaml.Unmarshal here (instead of json.Unmarshal) because the - // Go JSON library doesn't try to pick the right number type (int, float, - // etc.) when unmarshalling to interface{}, it just picks float64 - // universally. go-yaml does go through the effort of picking the right - // number type, so we can preserve number type throughout this process. - if err := rawyaml.Unmarshal(j, &jsonObj); err != nil { - return nil, err - } - - for _, option := range options { - if option.transform != nil { - if err := option.transform(jsonObj); err != nil { - return nil, err - } - } - } - - // Marshal this object into YAML. - return rawyaml.Marshal(jsonObj) -} - -// ReadFile reads the given boilerplate artifact using the context's InputRule. -func (g GenerationContext) ReadFile(path string) ([]byte, error) { - file, err := g.OpenForRead(path) - if err != nil { - return nil, err - } - defer file.Close() - return ioutil.ReadAll(file) -} - -// ForRoots produces a Runtime to run the given generators against the -// given packages. It outputs to /dev/null by default. -func (g Generators) ForRoots(rootPaths ...string) (*Runtime, error) { - roots, err := loader.LoadRoots(rootPaths...) - if err != nil { - return nil, err - } - rt := &Runtime{ - Generators: g, - GenerationContext: GenerationContext{ - Collector: &markers.Collector{ - Registry: &markers.Registry{}, - }, - Roots: roots, - InputRule: InputFromFileSystem, - Checker: &loader.TypeChecker{ - NodeFilters: g.CheckFilters(), - }, - }, - OutputRules: OutputRules{Default: OutputToNothing}, - } - if err := rt.Generators.RegisterMarkers(rt.Collector.Registry); err != nil { - return nil, err - } - return rt, nil -} - -// Run runs the Generators in this Runtime against its packages, printing -// errors (except type errors, which common result from using TypeChecker with -// filters), returning true if errors were found. -func (r *Runtime) Run() bool { - // TODO(directxman12): we could make this parallel, - // but we'd need to ensure all underlying machinery is threadsafe - - if r.ErrorWriter == nil { - r.ErrorWriter = os.Stderr - } - if len(r.Generators) == 0 { - fmt.Fprintln(r.ErrorWriter, "no generators to run") - return true - } - - hadErrs := false - for _, gen := range r.Generators { - ctx := r.GenerationContext // make a shallow copy - ctx.OutputRule = r.OutputRules.ForGenerator(gen) - - // don't pass a typechecker to generators that don't provide a filter - // to avoid accidents - if _, needsChecking := (*gen).(NeedsTypeChecking); !needsChecking { - ctx.Checker = nil - } - - if err := (*gen).Generate(&ctx); err != nil { - fmt.Fprintln(r.ErrorWriter, err) - hadErrs = true - } - } - - // skip TypeErrors -- they're probably just from partial typechecking in crd-gen - return loader.PrintErrors(r.Roots, packages.TypeError) || hadErrs -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/doc.go b/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/doc.go deleted file mode 100644 index d84d1798b45..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/doc.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 help contains utilities for actually writing out marker help. -// -// Namely, it contains a series of structs (and helpers for producing them) -// that represent a merged view of marker definition and help that can be used -// for consumption by the pretty subpackage (for terminal help) or serialized -// as JSON (e.g. for generating HTML help). -package help diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/doc.go b/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/doc.go deleted file mode 100644 index 06622db7442..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/doc.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 pretty contains utilities for formatting terminal help output, -// and a use of those to display marker help. -// -// Terminal Output -// -// The Span interface and Table struct allow you to construct tables with -// colored formatting, without causing ANSI formatting characters to mess up width -// calculations. -// -// Marker Help -// -// The MarkersSummary prints a summary table for marker help, while the MarkersDetails -// prints out more detailed information, with explainations of the individual marker fields. -package pretty diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/help.go b/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/help.go deleted file mode 100644 index 3e34cc0d6cb..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/help.go +++ /dev/null @@ -1,171 +0,0 @@ -package pretty - -import ( - "fmt" - "io" - - "sigs.k8s.io/controller-tools/pkg/genall/help" - - "github.com/fatih/color" -) - -var ( - headingStyle = Decoration(*color.New(color.Bold, color.Underline)) - markerNameStyle = Decoration(*color.New(color.Bold)) - fieldSummaryStyle = Decoration(*color.New(color.FgGreen, color.Italic)) - markerTargetStyle = Decoration(*color.New(color.Faint)) - fieldDetailStyle = Decoration(*color.New(color.Italic, color.FgGreen)) - deprecatedStyle = Decoration(*color.New(color.CrossedOut)) -) - -// MarkersSummary returns a condensed summary of help for the given markers. -func MarkersSummary(groupName string, markers []help.MarkerDoc) Span { - out := new(SpanWriter) - - out.Print(Text("\n")) - out.Print(headingStyle.Containing(Text(groupName))) - out.Print(Text("\n\n")) - - table := &Table{Sizing: &TableCalculator{Padding: 2}} - for _, marker := range markers { - table.StartRow() - table.Column(MarkerSyntaxHelp(marker)) - table.Column(markerTargetStyle.Containing(Text(marker.Target))) - - summary := new(SpanWriter) - if marker.DeprecatedInFavorOf != nil && len(*marker.DeprecatedInFavorOf) > 0 { - summary.Print(markerNameStyle.Containing(Text("(use "))) - summary.Print(markerNameStyle.Containing(Text(*marker.DeprecatedInFavorOf))) - summary.Print(markerNameStyle.Containing(Text(") "))) - } - summary.Print(Text(marker.Summary)) - table.Column(summary) - - table.EndRow() - } - out.Print(table) - - out.Print(Text("\n")) - - return out -} - -// MarkersDetails returns detailed help for the given markers, including detailed field help. -func MarkersDetails(fullDetail bool, groupName string, markers []help.MarkerDoc) Span { - out := new(SpanWriter) - - out.Print(Line(headingStyle.Containing(Text(groupName)))) - out.Print(Newlines(2)) - - for _, marker := range markers { - out.Print(Line(markerName(marker))) - out.Print(Text(" ")) - out.Print(markerTargetStyle.Containing(Text(marker.Target))) - - summary := new(SpanWriter) - if marker.DeprecatedInFavorOf != nil && len(*marker.DeprecatedInFavorOf) > 0 { - summary.Print(markerNameStyle.Containing(Text("(use "))) - summary.Print(markerNameStyle.Containing(Text(*marker.DeprecatedInFavorOf))) - summary.Print(markerNameStyle.Containing(Text(") "))) - } - summary.Print(Text(marker.Summary)) - - if !marker.AnonymousField() { - out.Print(Indented(1, Line(summary))) - if len(marker.Details) > 0 && fullDetail { - out.Print(Indented(1, Line(Text(marker.Details)))) - } - } - - if marker.AnonymousField() { - out.Print(Indented(1, Line(fieldDetailStyle.Containing(FieldSyntaxHelp(marker.Fields[0]))))) - out.Print(Text(" ")) - out.Print(summary) - if len(marker.Details) > 0 && fullDetail { - out.Print(Indented(2, Line(Text(marker.Details)))) - } - out.Print(Newlines(1)) - } else if !marker.Empty() { - out.Print(Newlines(1)) - if fullDetail { - for _, arg := range marker.Fields { - out.Print(Indented(1, Line(fieldDetailStyle.Containing(FieldSyntaxHelp(arg))))) - out.Print(Indented(2, Line(Text(arg.Summary)))) - if len(arg.Details) > 0 && fullDetail { - out.Print(Indented(2, Line(Text(arg.Details)))) - out.Print(Newlines(1)) - } - } - out.Print(Newlines(1)) - } else { - table := &Table{Sizing: &TableCalculator{Padding: 2}} - for _, arg := range marker.Fields { - table.StartRow() - table.Column(fieldDetailStyle.Containing(FieldSyntaxHelp(arg))) - table.Column(Text(arg.Summary)) - table.EndRow() - } - - out.Print(Indented(1, table)) - } - } else { - out.Print(Newlines(1)) - } - } - - return out -} - -func FieldSyntaxHelp(arg help.FieldHelp) Span { - return fieldSyntaxHelp(arg, "") -} - -// fieldSyntaxHelp prints the syntax help for a particular marker argument. -func fieldSyntaxHelp(arg help.FieldHelp, sep string) Span { - if arg.Optional { - return FromWriter(func(out io.Writer) error { - _, err := fmt.Fprintf(out, "[%s%s=<%s>]", sep, arg.Name, arg.TypeString()) - return err - }) - } - return FromWriter(func(out io.Writer) error { - _, err := fmt.Fprintf(out, "%s%s=<%s>", sep, arg.Name, arg.TypeString()) - return err - }) -} - -// markerName returns a span containing just the appropriately-formatted marker name. -func markerName(def help.MarkerDoc) Span { - if def.DeprecatedInFavorOf != nil { - return deprecatedStyle.Containing(Text("+" + def.Name)) - } - return markerNameStyle.Containing(Text("+" + def.Name)) -} - -// MarkerSyntaxHelp assembles syntax help for a given marker. -func MarkerSyntaxHelp(def help.MarkerDoc) Span { - out := new(SpanWriter) - - out.Print(markerName(def)) - - if def.Empty() { - return out - } - - sep := ":" - if def.AnonymousField() { - sep = "" - } - - fieldStyle := fieldSummaryStyle - if def.DeprecatedInFavorOf != nil { - fieldStyle = deprecatedStyle - } - - for _, arg := range def.Fields { - out.Print(fieldStyle.Containing(fieldSyntaxHelp(arg, sep))) - sep = "," - } - - return out -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/print.go b/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/print.go deleted file mode 100644 index 8d7452a0b25..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/print.go +++ /dev/null @@ -1,304 +0,0 @@ -package pretty - -import ( - "bytes" - "fmt" - "io" - - "github.com/fatih/color" -) - -// NB(directxman12): this isn't particularly elegant, but it's also -// sufficiently simple as to be maintained here. Man (roff) would've -// probably worked, but it's not necessarily on Windows by default. - -// Span is a chunk of content that is writable to an output, but knows how to -// calculate its apparent visual "width" on the terminal (not to be confused -// with the raw length, which may include zero-width coloring sequences). -type Span interface { - // VisualLength reports the "width" as perceived by the user on the terminal - // (i.e. widest line, ignoring ANSI escape characters). - VisualLength() int - // WriteTo writes the full span contents to the given writer. - WriteTo(io.Writer) error -} - -// Table is a Span that writes its data in table form, with sizing controlled -// by the given table calculator. Rows are started with StartRow, followed by -// some calls to Column, followed by a call to EndRow. Once all rows are -// added, the table can be used as a Span. -type Table struct { - Sizing *TableCalculator - - cellsByRow [][]Span - colSizes []int -} - -// StartRow starts a new row. -// It must eventually be followed by EndRow. -func (t *Table) StartRow() { - t.cellsByRow = append(t.cellsByRow, []Span(nil)) -} - -// EndRow ends the currently started row. -func (t *Table) EndRow() { - lastRow := t.cellsByRow[len(t.cellsByRow)-1] - sizes := make([]int, len(lastRow)) - for i, cell := range lastRow { - sizes[i] = cell.VisualLength() - } - t.Sizing.AddRowSizes(sizes...) -} - -// Column adds the given span as a new column to the current row. -func (t *Table) Column(contents Span) { - currentRowInd := len(t.cellsByRow) - 1 - t.cellsByRow[currentRowInd] = append(t.cellsByRow[currentRowInd], contents) -} - -// SkipRow prints a span without having it contribute to the table calculation. -func (t *Table) SkipRow(contents Span) { - t.cellsByRow = append(t.cellsByRow, []Span{contents}) -} - -func (t *Table) WriteTo(out io.Writer) error { - if t.colSizes == nil { - t.colSizes = t.Sizing.ColumnWidths() - } - - for _, cells := range t.cellsByRow { - currentPosition := 0 - for colInd, cell := range cells { - colSize := t.colSizes[colInd] - diff := colSize - cell.VisualLength() - - if err := cell.WriteTo(out); err != nil { - return err - } - - if diff > 0 { - if err := writePadding(out, columnPadding, diff); err != nil { - return err - } - } - currentPosition += colSize - } - - if _, err := fmt.Fprint(out, "\n"); err != nil { - return err - } - } - - return nil -} - -func (t *Table) VisualLength() int { - if t.colSizes == nil { - t.colSizes = t.Sizing.ColumnWidths() - } - - res := 0 - for _, colSize := range t.colSizes { - res += colSize - } - return res -} - -// Text is a span that simply contains raw text. It's a good starting point. -type Text string - -func (t Text) VisualLength() int { return len(t) } -func (t Text) WriteTo(w io.Writer) error { - _, err := w.Write([]byte(t)) - return err -} - -// indented is a span that indents all lines by the given number of tabs. -type indented struct { - Amount int - Content Span -} - -func (i *indented) VisualLength() int { return i.Content.VisualLength() } -func (i *indented) WriteTo(w io.Writer) error { - var out bytes.Buffer - if err := i.Content.WriteTo(&out); err != nil { - return err - } - - lines := bytes.Split(out.Bytes(), []byte("\n")) - for lineInd, line := range lines { - if lineInd != 0 { - if _, err := w.Write([]byte("\n")); err != nil { - return err - } - } - if len(line) == 0 { - continue - } - - if err := writePadding(w, indentPadding, i.Amount); err != nil { - return err - } - if _, err := w.Write(line); err != nil { - return err - } - } - return nil -} - -// Indented returns a span that indents all lines by the given number of tabs. -func Indented(amt int, content Span) Span { - return &indented{Amount: amt, Content: content} -} - -// fromWriter is a span that takes content from a function expecting a Writer. -type fromWriter struct { - cache []byte - cacheError error - run func(io.Writer) error -} - -func (f *fromWriter) VisualLength() int { - if f.cache == nil { - var buf bytes.Buffer - if err := f.run(&buf); err != nil { - f.cacheError = err - } - f.cache = buf.Bytes() - } - return len(f.cache) -} -func (f *fromWriter) WriteTo(w io.Writer) error { - if f.cache != nil { - if f.cacheError != nil { - return f.cacheError - } - _, err := w.Write(f.cache) - return err - } - return f.run(w) -} - -// FromWriter returns a span that takes content from a function expecting a Writer. -func FromWriter(run func(io.Writer) error) Span { - return &fromWriter{run: run} -} - -// Decoration represents a terminal decoration. -type Decoration color.Color - -// Containing returns a Span that has the given decoration applied. -func (d Decoration) Containing(contents Span) Span { - return &decorated{ - Contents: contents, - Attributes: color.Color(d), - } -} - -// decorated is a span that has some terminal decoration applied. -type decorated struct { - Contents Span - Attributes color.Color -} - -func (d *decorated) VisualLength() int { return d.Contents.VisualLength() } -func (d *decorated) WriteTo(w io.Writer) error { - oldOut := color.Output - color.Output = w - defer func() { color.Output = oldOut }() - - d.Attributes.Set() - defer color.Unset() - - return d.Contents.WriteTo(w) -} - -// SpanWriter is a span that contains multiple sub-spans. -type SpanWriter struct { - contents []Span -} - -func (m *SpanWriter) VisualLength() int { - res := 0 - for _, span := range m.contents { - res += span.VisualLength() - } - return res -} -func (m *SpanWriter) WriteTo(w io.Writer) error { - for _, span := range m.contents { - if err := span.WriteTo(w); err != nil { - return err - } - } - return nil -} - -// Print adds a new span to this SpanWriter. -func (m *SpanWriter) Print(s Span) { - m.contents = append(m.contents, s) -} - -// lines is a span that adds some newlines, optionally followed by some content. -type lines struct { - content Span - amountBefore int -} - -func (l *lines) VisualLength() int { - if l.content == nil { - return 0 - } - return l.content.VisualLength() -} -func (l *lines) WriteTo(w io.Writer) error { - if err := writePadding(w, linesPadding, l.amountBefore); err != nil { - return err - } - if l.content != nil { - if err := l.content.WriteTo(w); err != nil { - return err - } - } - return nil -} - -// Newlines returns a span just containing some newlines. -func Newlines(amt int) Span { - return &lines{amountBefore: amt} -} - -// Line returns a span that emits a newline, followed by the given content. -func Line(content Span) Span { - return &lines{amountBefore: 1, content: content} -} - -var ( - columnPadding = []byte(" ") - indentPadding = []byte("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t") - linesPadding = []byte("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n") -) - -// writePadding writes out padding of the given type in the given amount to the writer. -// Each byte in the padding buffer contributes 1 to the amount -- the padding being -// a buffer is just for efficiency. -func writePadding(out io.Writer, typ []byte, amt int) error { - if amt <= len(typ) { - _, err := out.Write(typ[:amt]) - return err - } - - num := amt / len(typ) - rem := amt % len(typ) - for i := 0; i < num; i++ { - if _, err := out.Write(typ); err != nil { - return err - } - } - - if _, err := out.Write(typ[:rem]); err != nil { - return err - } - return nil -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/table.go b/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/table.go deleted file mode 100644 index 5a0b4752af0..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/pretty/table.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 pretty - -// TableCalculator calculates column widths (with optional padding) -// for a table based on the maximum required column width. -type TableCalculator struct { - cellSizesByCol [][]int - - Padding int - MaxWidth int -} - -// AddRowSizes registers a new row with cells of the given sizes. -func (c *TableCalculator) AddRowSizes(cellSizes ...int) { - if len(cellSizes) > len(c.cellSizesByCol) { - for range cellSizes[len(c.cellSizesByCol):] { - c.cellSizesByCol = append(c.cellSizesByCol, []int(nil)) - } - } - for i, size := range cellSizes { - c.cellSizesByCol[i] = append(c.cellSizesByCol[i], size) - } -} - -// ColumnWidths calculates the appropriate column sizes given the -// previously registered rows. -func (c *TableCalculator) ColumnWidths() []int { - maxColWidths := make([]int, len(c.cellSizesByCol)) - - for colInd, cellSizes := range c.cellSizesByCol { - max := 0 - for _, cellSize := range cellSizes { - if max < cellSize { - max = cellSize - } - } - maxColWidths[colInd] = max - } - - actualMaxWidth := c.MaxWidth - c.Padding - for i, width := range maxColWidths { - if actualMaxWidth > 0 && width > actualMaxWidth { - maxColWidths[i] = actualMaxWidth - } - maxColWidths[i] += c.Padding - } - - return maxColWidths -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/sort.go b/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/sort.go deleted file mode 100644 index 53c923e34ba..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/sort.go +++ /dev/null @@ -1,106 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 help - -import ( - "strings" - - "sigs.k8s.io/controller-tools/pkg/markers" -) - -// SortGroup knows how to sort and group marker definitions. -type SortGroup interface { - // Less is equivalent to the Less function from sort, and is used to sort the markers. - Less(*markers.Definition, *markers.Definition) bool - // Group returns the "group" that a given marker belongs to. - Group(*markers.Definition, *markers.DefinitionHelp) string -} - -var ( - // SortByCategory sorts the markers by name and groups them by their help category. - SortByCategory = sortByCategory{} - - // SortByOption sorts by the generator that the option belongs to. - SortByOption = optionsSort{} -) - -type sortByCategory struct{} - -func (sortByCategory) Group(_ *markers.Definition, help *markers.DefinitionHelp) string { - if help == nil { - return "" - } - return help.Category -} -func (sortByCategory) Less(i, j *markers.Definition) bool { - return i.Name < j.Name -} - -type optionsSort struct{} - -func (optionsSort) Less(i, j *markers.Definition) bool { - iParts := strings.Split(i.Name, ":") - jParts := strings.Split(j.Name, ":") - - iGen := "" - iRule := "" - jGen := "" - jRule := "" - - switch len(iParts) { - case 1: - iGen = iParts[0] - // two means a default output rule, so ignore - case 2: - iRule = iParts[1] - case 3: - iGen = iParts[1] - iRule = iParts[2] - } - switch len(jParts) { - case 1: - jGen = jParts[0] - // two means a default output rule, so ignore - case 2: - jRule = jParts[1] - case 3: - jGen = jParts[1] - jRule = jParts[2] - } - - if iGen != jGen { - return iGen > jGen - } - - return iRule < jRule -} -func (optionsSort) Group(def *markers.Definition, _ *markers.DefinitionHelp) string { - parts := strings.Split(def.Name, ":") - - switch len(parts) { - case 1: - if parts[0] == "paths" { - return "generic" - } - return "generators" - case 2: - return "output rules (optionally as output::...)" - default: - return "" - // three means a marker-specific output rule, ignore - } -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/types.go b/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/types.go deleted file mode 100644 index be111043243..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/genall/help/types.go +++ /dev/null @@ -1,215 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 help - -import ( - "sort" - "strings" - - "sigs.k8s.io/controller-tools/pkg/markers" -) - -// DetailedHelp contains both a summary and further details. -type DetailedHelp struct { - // Summary contains a one-line description. - Summary string `json:"summary"` - // Details contains further information. - Details string `json:"details,omitempty"` -} - -// Argument is the type data for a marker argument. -type Argument struct { - // Type is the data type of the argument (string, bool, int, slice, any, raw, invalid) - Type string `json:"type"` - // Optional marks this argument as optional. - Optional bool `json:"optional"` - // ItemType contains the type of the slice item, if this is a slice - ItemType *Argument `json:"itemType,omitempty"` -} - -func (a Argument) typeString(out *strings.Builder) { - if a.Type == "slice" { - out.WriteString("[]") - a.ItemType.typeString(out) - return - } - - out.WriteString(a.Type) -} - -// TypeString returns a string roughly equivalent -// (but not identical) to the underlying Go type that -// this argument would parse to. It's mainly useful -// for user-friendly formatting of this argument (e.g. -// help strings). -func (a Argument) TypeString() string { - out := &strings.Builder{} - a.typeString(out) - return out.String() -} - -// FieldHelp contains information required to print documentation for a marker field. -type FieldHelp struct { - // Name is the field name. - Name string `json:"name"` - // Argument is the type of the field. - Argument `json:",inline"` - - // DetailedHelp contains the textual help for the field. - DetailedHelp `json:",inline"` -} - -// MarkerDoc contains information required to print documentation for a marker. -type MarkerDoc struct { - // definition - - // Name is the name of the marker. - Name string `json:"name"` - // Target is the target (field, package, type) of the marker. - Target string `json:"target"` - - // help - - // DetailedHelp is the textual help for the marker. - DetailedHelp `json:",inline"` - // Category is the general "category" that this marker belongs to. - Category string `json:"category"` - // DeprecatedInFavorOf marks that this marker shouldn't be used when - // non-nil. If also non-empty, another marker should be used instead. - DeprecatedInFavorOf *string `json:"deprecatedInFavorOf,omitempty"` - // Fields is the type and help data for each field of this marker. - Fields []FieldHelp `json:"fields,omitempty"` -} - -// Empty checks if this marker has any arguments, returning true if not. -func (m MarkerDoc) Empty() bool { - return len(m.Fields) == 0 -} - -// AnonymousField chekcs if this is an single-valued marker -// (as opposed to having named fields). -func (m MarkerDoc) AnonymousField() bool { - return len(m.Fields) == 1 && m.Fields[0].Name == "" -} - -// ForArgument returns the equivalent documentation for a marker argument. -func ForArgument(argRaw markers.Argument) Argument { - res := Argument{ - Optional: argRaw.Optional, - } - - if argRaw.ItemType != nil { - itemType := ForArgument(*argRaw.ItemType) - res.ItemType = &itemType - } - - switch argRaw.Type { - case markers.IntType: - res.Type = "int" - case markers.StringType: - res.Type = "string" - case markers.BoolType: - res.Type = "bool" - case markers.AnyType: - res.Type = "any" - case markers.SliceType: - res.Type = "slice" - case markers.RawType: - res.Type = "raw" - case markers.InvalidType: - res.Type = "invalid" - } - - return res -} - -// ForDefinition returns the equivalent marker documentation for a given marker definition and spearate help. -func ForDefinition(defn *markers.Definition, maybeHelp *markers.DefinitionHelp) MarkerDoc { - var help markers.DefinitionHelp - if maybeHelp != nil { - help = *maybeHelp - } - - res := MarkerDoc{ - Name: defn.Name, - Category: help.Category, - DeprecatedInFavorOf: help.DeprecatedInFavorOf, - Target: defn.Target.String(), - DetailedHelp: DetailedHelp{Summary: help.Summary, Details: help.Details}, - } - - helpByField := help.FieldsHelp(defn) - - // TODO(directxman12): deterministic ordering - for fieldName, fieldHelpRaw := range helpByField { - fieldInfo := defn.Fields[fieldName] - fieldHelp := FieldHelp{ - Name: fieldName, - DetailedHelp: DetailedHelp{Summary: fieldHelpRaw.Summary, Details: fieldHelpRaw.Details}, - Argument: ForArgument(fieldInfo), - } - - res.Fields = append(res.Fields, fieldHelp) - } - - sort.Slice(res.Fields, func(i, j int) bool { return res.Fields[i].Name < res.Fields[j].Name }) - - return res -} - -// CategoryDoc contains help information for all markers in a Category. -type CategoryDoc struct { - Category string `json:"category"` - Markers []MarkerDoc `json:"markers"` -} - -// ByCategory returns the marker help for markers in the given -// registry, grouped and sorted according to the given method. -func ByCategory(reg *markers.Registry, sorter SortGroup) []CategoryDoc { - groupedMarkers := make(map[string][]*markers.Definition) - - for _, marker := range reg.AllDefinitions() { - group := sorter.Group(marker, reg.HelpFor(marker)) - groupedMarkers[group] = append(groupedMarkers[group], marker) - } - allGroups := make([]string, 0, len(groupedMarkers)) - for groupName := range groupedMarkers { - allGroups = append(allGroups, groupName) - } - - sort.Strings(allGroups) - - res := make([]CategoryDoc, len(allGroups)) - for i, groupName := range allGroups { - markers := groupedMarkers[groupName] - sort.Slice(markers, func(i, j int) bool { - return sorter.Less(markers[i], markers[j]) - }) - - markerDocs := make([]MarkerDoc, len(markers)) - for i, marker := range markers { - markerDocs[i] = ForDefinition(marker, reg.HelpFor(marker)) - } - - res[i] = CategoryDoc{ - Category: groupName, - Markers: markerDocs, - } - } - - return res -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/genall/input.go b/vendor/sigs.k8s.io/controller-tools/pkg/genall/input.go deleted file mode 100644 index 46e191c0c2d..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/genall/input.go +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 genall - -import ( - "io" - "os" -) - -// InputRule describes how to load non-code boilerplate artifacts. -// It's not used for loading code. -type InputRule interface { - // OpenForRead opens the given non-code artifact for reading. - OpenForRead(path string) (io.ReadCloser, error) -} -type inputFromFileSystem struct{} - -func (inputFromFileSystem) OpenForRead(path string) (io.ReadCloser, error) { - return os.Open(path) -} - -// InputFromFileSystem reads from the filesystem as normal. -var InputFromFileSystem = inputFromFileSystem{} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/genall/options.go b/vendor/sigs.k8s.io/controller-tools/pkg/genall/options.go deleted file mode 100644 index 45e3bc41f34..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/genall/options.go +++ /dev/null @@ -1,192 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 genall - -import ( - "fmt" - "strings" - - "sigs.k8s.io/controller-tools/pkg/markers" -) - -var ( - InputPathsMarker = markers.Must(markers.MakeDefinition("paths", markers.DescribesPackage, InputPaths(nil))) -) - -// +controllertools:marker:generateHelp:category="" - -// InputPaths represents paths and go-style path patterns to use as package roots. -type InputPaths []string - -// RegisterOptionsMarkers registers "mandatory" options markers for FromOptions into the given registry. -// At this point, that's just InputPaths. -func RegisterOptionsMarkers(into *markers.Registry) error { - if err := into.Register(InputPathsMarker); err != nil { - return err - } - // NB(directxman12): we make this optional so we don't have a bootstrap problem with helpgen - if helpGiver, hasHelp := ((interface{})(InputPaths(nil))).(HasHelp); hasHelp { - into.AddHelp(InputPathsMarker, helpGiver.Help()) - } - return nil -} - -// RegistryFromOptions produces just the marker registry that would be used by FromOptions, without -// attempting to produce a full Runtime. This can be useful if you want to display help without -// trying to load roots. -func RegistryFromOptions(optionsRegistry *markers.Registry, options []string) (*markers.Registry, error) { - protoRt, err := protoFromOptions(optionsRegistry, options) - if err != nil { - return nil, err - } - reg := &markers.Registry{} - if err := protoRt.Generators.RegisterMarkers(reg); err != nil { - return nil, err - } - return reg, nil -} - -// FromOptions parses the options from markers stored in the given registry out into a runtime. -// The markers in the registry must be either -// -// a) Generators -// b) OutputRules -// c) InputPaths -// -// The paths specified in InputPaths are loaded as package roots, and the combined with -// the generators and the specified output rules to produce a runtime that can be run or -// further modified. Not default generators are used if none are specified -- you can check -// the output and rerun for that. -func FromOptions(optionsRegistry *markers.Registry, options []string) (*Runtime, error) { - - protoRt, err := protoFromOptions(optionsRegistry, options) - if err != nil { - return nil, err - } - - // make the runtime - genRuntime, err := protoRt.Generators.ForRoots(protoRt.Paths...) - if err != nil { - return nil, err - } - - // attempt to figure out what the user wants without a lot of verbose specificity: - // if the user specifies a default rule, assume that they probably want to fall back - // to that. Otherwise, assume that they just wanted to customize one option from the - // set, and leave the rest in the standard configuration. - if protoRt.OutputRules.Default != nil { - genRuntime.OutputRules = protoRt.OutputRules - return genRuntime, nil - } - - outRules := DirectoryPerGenerator("config", protoRt.GeneratorsByName) - for gen, rule := range protoRt.OutputRules.ByGenerator { - outRules.ByGenerator[gen] = rule - } - - genRuntime.OutputRules = outRules - return genRuntime, nil -} - -// protoFromOptions returns a proto-Runtime from the given options registry and -// options set. This can then be used to construct an actual Runtime. See the -// FromOptions function for more details about how the options work. -func protoFromOptions(optionsRegistry *markers.Registry, options []string) (protoRuntime, error) { - var gens Generators - rules := OutputRules{ - ByGenerator: make(map[*Generator]OutputRule), - } - var paths []string - - // collect the generators first, so that we can key the output on the actual - // generator, which matters if there's settings in the gen object and it's not a pointer. - outputByGen := make(map[string]OutputRule) - gensByName := make(map[string]*Generator) - - for _, rawOpt := range options { - if rawOpt[0] != '+' { - rawOpt = "+" + rawOpt // add a `+` to make it acceptable for usage with the registry - } - defn := optionsRegistry.Lookup(rawOpt, markers.DescribesPackage) - if defn == nil { - return protoRuntime{}, fmt.Errorf("unknown option %q", rawOpt[1:]) - } - - val, err := defn.Parse(rawOpt) - if err != nil { - return protoRuntime{}, fmt.Errorf("unable to parse option %q: %w", rawOpt[1:], err) - } - - switch val := val.(type) { - case Generator: - gens = append(gens, &val) - gensByName[defn.Name] = &val - case OutputRule: - _, genName := splitOutputRuleOption(defn.Name) - if genName == "" { - // it's a default rule - rules.Default = val - continue - } - - outputByGen[genName] = val - continue - case InputPaths: - paths = append(paths, val...) - default: - return protoRuntime{}, fmt.Errorf("unknown option marker %q", defn.Name) - } - } - - // actually associate the rules now that we know the generators - for genName, outputRule := range outputByGen { - gen, knownGen := gensByName[genName] - if !knownGen { - return protoRuntime{}, fmt.Errorf("non-invoked generator %q", genName) - } - - rules.ByGenerator[gen] = outputRule - } - - return protoRuntime{ - Paths: paths, - Generators: Generators(gens), - OutputRules: rules, - GeneratorsByName: gensByName, - }, nil -} - -// protoRuntime represents the raw pieces needed to compose a runtime, as -// parsed from some options. -type protoRuntime struct { - Paths []string - Generators Generators - OutputRules OutputRules - GeneratorsByName map[string]*Generator -} - -// splitOutputRuleOption splits a marker name of "output:rule:gen" or "output:rule" -// into its compontent rule and generator name. -func splitOutputRuleOption(name string) (ruleName string, genName string) { - parts := strings.SplitN(name, ":", 3) - if len(parts) == 3 { - // output:: - return parts[2], parts[1] - } - // output: - return parts[1], "" -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/genall/output.go b/vendor/sigs.k8s.io/controller-tools/pkg/genall/output.go deleted file mode 100644 index b5a09e1692e..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/genall/output.go +++ /dev/null @@ -1,160 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 genall - -import ( - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - - "sigs.k8s.io/controller-tools/pkg/loader" -) - -// nopCloser is a WriteCloser whose Close -// is a no-op. -type nopCloser struct { - io.Writer -} - -func (n nopCloser) Close() error { - return nil -} - -// DirectoryPerGenerator produces output rules mapping output to a different subdirectory -// of the given base directory for each generator (with each subdirectory specified as -// the key in the input map). -func DirectoryPerGenerator(base string, generators map[string]*Generator) OutputRules { - rules := OutputRules{ - Default: OutputArtifacts{Config: OutputToDirectory(base)}, - ByGenerator: make(map[*Generator]OutputRule, len(generators)), - } - - for name, gen := range generators { - rules.ByGenerator[gen] = OutputArtifacts{ - Config: OutputToDirectory(filepath.Join(base, name)), - } - } - - return rules -} - -// OutputRules defines how to output artificats on a per-generator basis. -type OutputRules struct { - // Default is the output rule used when no specific per-generator overrides match. - Default OutputRule - // ByGenerator contains specific per-generator overrides. - // NB(directxman12): this is a pointer to avoid issues if a given Generator becomes unhashable - // (interface values compare by "dereferencing" their internal pointer first, whereas pointers - // compare by the actual pointer itself). - ByGenerator map[*Generator]OutputRule -} - -// ForGenerator returns the output rule that should be used -// by the given Generator. -func (o OutputRules) ForGenerator(gen *Generator) OutputRule { - if forGen, specific := o.ByGenerator[gen]; specific { - return forGen - } - return o.Default -} - -// OutputRule defines how to output artifacts from a generator. -type OutputRule interface { - // Open opens the given artifact path for writing. If a package is passed, - // the artifact is considered to be used as part of the package (e.g. - // generated code), while a nil package indicates that the artifact is - // config (or something else not involved in Go compilation). - Open(pkg *loader.Package, path string) (io.WriteCloser, error) -} - -// OutputToNothing skips outputting anything. -var OutputToNothing = outputToNothing{} - -// +controllertools:marker:generateHelp:category="" - -// outputToNothing skips outputting anything. -type outputToNothing struct{} - -func (o outputToNothing) Open(_ *loader.Package, _ string) (io.WriteCloser, error) { - return nopCloser{ioutil.Discard}, nil -} - -// +controllertools:marker:generateHelp:category="" - -// OutputToDirectory outputs each artifact to the given directory, regardless -// of if it's package-associated or not. -type OutputToDirectory string - -func (o OutputToDirectory) Open(_ *loader.Package, itemPath string) (io.WriteCloser, error) { - // ensure the directory exists - if err := os.MkdirAll(string(o), os.ModePerm); err != nil { - return nil, err - } - path := filepath.Join(string(o), itemPath) - return os.Create(path) -} - -// OutputToStdout outputs everything to standard-out, with no separation. -// -// Generally useful for single-artifact outputs. -var OutputToStdout = outputToStdout{} - -// +controllertools:marker:generateHelp:category="" - -// outputToStdout outputs everything to standard-out, with no separation. -// -// Generally useful for single-artifact outputs. -type outputToStdout struct{} - -func (o outputToStdout) Open(_ *loader.Package, itemPath string) (io.WriteCloser, error) { - return nopCloser{os.Stdout}, nil -} - -// +controllertools:marker:generateHelp:category="" - -// OutputArtifacts outputs artifacts to different locations, depending on -// whether they're package-associated or not. -// -// Non-package associated artifacts -// are output to the Config directory, while package-associated ones are output -// to their package's source files' directory, unless an alternate path is -// specified in Code. -type OutputArtifacts struct { - // Config points to the directory to which to write configuration. - Config OutputToDirectory - // Code overrides the directory in which to write new code (defaults to where the existing code lives). - Code OutputToDirectory `marker:",optional"` -} - -func (o OutputArtifacts) Open(pkg *loader.Package, itemPath string) (io.WriteCloser, error) { - if pkg == nil { - return o.Config.Open(pkg, itemPath) - } - - if o.Code != "" { - return o.Code.Open(pkg, itemPath) - } - - if len(pkg.CompiledGoFiles) == 0 { - return nil, fmt.Errorf("cannot output to a package with no path on disk") - } - outDir := filepath.Dir(pkg.CompiledGoFiles[0]) - outPath := filepath.Join(outDir, itemPath) - return os.Create(outPath) -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/genall/zz_generated.markerhelp.go b/vendor/sigs.k8s.io/controller-tools/pkg/genall/zz_generated.markerhelp.go deleted file mode 100644 index cc9ae7b800b..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/genall/zz_generated.markerhelp.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright2019 The Kubernetes 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. -*/ - -// Code generated by helpgen. DO NOT EDIT. - -package genall - -import ( - "sigs.k8s.io/controller-tools/pkg/markers" -) - -func (InputPaths) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "", - DetailedHelp: markers.DetailedHelp{ - Summary: "represents paths and go-style path patterns to use as package roots.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (OutputArtifacts) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "", - DetailedHelp: markers.DetailedHelp{ - Summary: "outputs artifacts to different locations, depending on whether they're package-associated or not. ", - Details: "Non-package associated artifacts are output to the Config directory, while package-associated ones are output to their package's source files' directory, unless an alternate path is specified in Code.", - }, - FieldHelp: map[string]markers.DetailedHelp{ - "Config": { - Summary: "points to the directory to which to write configuration.", - Details: "", - }, - "Code": { - Summary: "overrides the directory in which to write new code (defaults to where the existing code lives).", - Details: "", - }, - }, - } -} - -func (OutputToDirectory) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "", - DetailedHelp: markers.DetailedHelp{ - Summary: "outputs each artifact to the given directory, regardless of if it's package-associated or not.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (outputToNothing) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "", - DetailedHelp: markers.DetailedHelp{ - Summary: "skips outputting anything.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} - -func (outputToStdout) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "", - DetailedHelp: markers.DetailedHelp{ - Summary: "outputs everything to standard-out, with no separation. ", - Details: "Generally useful for single-artifact outputs.", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/loader/doc.go b/vendor/sigs.k8s.io/controller-tools/pkg/loader/doc.go deleted file mode 100644 index a80065ec749..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/loader/doc.go +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 loader defines helpers for loading packages from sources. It wraps -// go/packages, allow incremental loading of source code and manual control -// over which packages get type-checked. This allows for faster loading in -// cases where you don't actually care about certain imports. -// -// Because it uses go/packages, it's modules-aware, and works in both modules- -// and non-modules environments. -// -// Loading -// -// The main entrypoint for loading is LoadRoots, which traverse the package -// graph starting at the given patterns (file, package, path, or ...-wildcard, -// as one might pass to go list). Packages beyond the roots can be accessed -// via the Imports() method. Packages are initially loaded with export data -// paths, filenames, and imports. -// -// Packages are suitable for comparison, as each unique package only ever has -// one *Package object returned. -// -// Syntax and TypeChecking -// -// ASTs and type-checking information can be loaded with NeedSyntax and -// NeedTypesInfo, respectively. Both are idempotent -- repeated calls will -// simply re-use the cached contents. Note that NeedTypesInfo will *only* type -// check the current package -- if you want to type-check imports as well, -// you'll need to type-check them first. -// -// Reference Pruning and Recursive Checking -// -// In order to type-check using only the packages you care about, you can use a -// TypeChecker. TypeChecker will visit each top-level type declaration, -// collect (optionally filtered) references, and type-check references -// packages. -// -// Errors -// -// Errors can be added to each package. Use ErrFromNode to create an error -// from an AST node. Errors can then be printed (complete with file and -// position information) using PrintErrors, optionally filtered by error type. -// It's generally a good idea to filter out TypeErrors when doing incomplete -// type-checking with TypeChecker. You can use MaybeErrList to return multiple -// errors if you need to return an error instead of adding it to a package. -// AddError will later unroll it into individual errors. -package loader diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/loader/errors.go b/vendor/sigs.k8s.io/controller-tools/pkg/loader/errors.go deleted file mode 100644 index 5a675798e23..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/loader/errors.go +++ /dev/null @@ -1,67 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 loader - -import ( - "fmt" - "go/token" -) - -// PositionedError represents some error with an associated position. -// The position is tied to some external token.FileSet. -type PositionedError struct { - Pos token.Pos - error -} - -// Node is the intersection of go/ast.Node and go/types.Var. -type Node interface { - Pos() token.Pos // position of first character belonging to the node -} - -// ErrFromNode returns the given error, with additional information -// attaching it to the given AST node. It will automatically map -// over error lists. -func ErrFromNode(err error, node Node) error { - if asList, isList := err.(ErrList); isList { - resList := make(ErrList, len(asList)) - for i, baseErr := range asList { - resList[i] = ErrFromNode(baseErr, node) - } - return resList - } - return PositionedError{ - Pos: node.Pos(), - error: err, - } -} - -// MaybeErrList constructs an ErrList if the given list of -// errors has any errors, otherwise returning nil. -func MaybeErrList(errs []error) error { - if len(errs) == 0 { - return nil - } - return ErrList(errs) -} - -// ErrList is a list of errors aggregated together into a single error. -type ErrList []error - -func (l ErrList) Error() string { - return fmt.Sprintf("%v", []error(l)) -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/loader/loader.go b/vendor/sigs.k8s.io/controller-tools/pkg/loader/loader.go deleted file mode 100644 index 064efa30fae..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/loader/loader.go +++ /dev/null @@ -1,592 +0,0 @@ -/* -Copyright 2019-2022 The Kubernetes 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 loader - -import ( - "fmt" - "go/ast" - "go/parser" - "go/scanner" - "go/token" - "go/types" - "io/ioutil" - "os" - "path/filepath" - "regexp" - "sync" - - "golang.org/x/tools/go/packages" - "k8s.io/apimachinery/pkg/util/sets" -) - -// Much of this is strongly inspired by the contents of go/packages, -// except that it allows for lazy loading of syntax and type-checking -// information to speed up cases where full traversal isn't needed. - -// PrintErrors print errors associated with all packages -// in the given package graph, starting at the given root -// packages and traversing through all imports. It will skip -// any errors of the kinds specified in filterKinds. It will -// return true if any errors were printed. -func PrintErrors(pkgs []*Package, filterKinds ...packages.ErrorKind) bool { - pkgsRaw := make([]*packages.Package, len(pkgs)) - for i, pkg := range pkgs { - pkgsRaw[i] = pkg.Package - } - toSkip := make(map[packages.ErrorKind]struct{}) - for _, errKind := range filterKinds { - toSkip[errKind] = struct{}{} - } - hadErrors := false - packages.Visit(pkgsRaw, nil, func(pkgRaw *packages.Package) { - for _, err := range pkgRaw.Errors { - if _, skip := toSkip[err.Kind]; skip { - continue - } - hadErrors = true - fmt.Fprintln(os.Stderr, err) - } - }) - return hadErrors -} - -// Package is a single, unique Go package that can be -// lazily parsed and type-checked. Packages should not -// be constructed directly -- instead, use LoadRoots. -// For a given call to LoadRoots, only a single instance -// of each package exists, and thus they may be used as keys -// and for comparison. -type Package struct { - *packages.Package - - imports map[string]*Package - - loader *loader - sync.Mutex -} - -// Imports returns the imports for the given package, indexed by -// package path (*not* name in any particular file). -func (p *Package) Imports() map[string]*Package { - if p.imports == nil { - p.imports = p.loader.packagesFor(p.Package.Imports) - } - - return p.imports -} - -// NeedTypesInfo indicates that type-checking information is needed for this package. -// Actual type-checking information can be accessed via the Types and TypesInfo fields. -func (p *Package) NeedTypesInfo() { - if p.TypesInfo != nil { - return - } - p.NeedSyntax() - p.loader.typeCheck(p) -} - -// NeedSyntax indicates that a parsed AST is needed for this package. -// Actual ASTs can be accessed via the Syntax field. -func (p *Package) NeedSyntax() { - if p.Syntax != nil { - return - } - out := make([]*ast.File, len(p.CompiledGoFiles)) - var wg sync.WaitGroup - wg.Add(len(p.CompiledGoFiles)) - for i, filename := range p.CompiledGoFiles { - go func(i int, filename string) { - defer wg.Done() - src, err := ioutil.ReadFile(filename) - if err != nil { - p.AddError(err) - return - } - out[i], err = p.loader.parseFile(filename, src) - if err != nil { - p.AddError(err) - return - } - }(i, filename) - } - wg.Wait() - for _, file := range out { - if file == nil { - return - } - } - p.Syntax = out -} - -// AddError adds an error to the errors associated with the given package. -func (p *Package) AddError(err error) { - switch typedErr := err.(type) { - case *os.PathError: - // file-reading errors - p.Errors = append(p.Errors, packages.Error{ - Pos: typedErr.Path + ":1", - Msg: typedErr.Err.Error(), - Kind: packages.ParseError, - }) - case scanner.ErrorList: - // parsing/scanning errors - for _, subErr := range typedErr { - p.Errors = append(p.Errors, packages.Error{ - Pos: subErr.Pos.String(), - Msg: subErr.Msg, - Kind: packages.ParseError, - }) - } - case types.Error: - // type-checking errors - p.Errors = append(p.Errors, packages.Error{ - Pos: typedErr.Fset.Position(typedErr.Pos).String(), - Msg: typedErr.Msg, - Kind: packages.TypeError, - }) - case ErrList: - for _, subErr := range typedErr { - p.AddError(subErr) - } - case PositionedError: - p.Errors = append(p.Errors, packages.Error{ - Pos: p.loader.cfg.Fset.Position(typedErr.Pos).String(), - Msg: typedErr.Error(), - Kind: packages.UnknownError, - }) - default: - // should only happen for external errors, like ref checking - p.Errors = append(p.Errors, packages.Error{ - Pos: p.ID + ":-", - Msg: err.Error(), - Kind: packages.UnknownError, - }) - } -} - -// loader loads packages and their imports. Loaded packages will have -// type size, imports, and exports file information populated. Additional -// information, like ASTs and type-checking information, can be accessed -// via methods on individual packages. -type loader struct { - // Roots are the loaded "root" packages in the package graph loaded via - // LoadRoots. - Roots []*Package - - // cfg contains the package loading config (initialized on demand) - cfg *packages.Config - // packages contains the cache of Packages indexed by the underlying - // package.Package, so that we don't ever produce two Packages with - // the same underlying packages.Package. - packages map[*packages.Package]*Package - packagesMu sync.Mutex -} - -// packageFor returns a wrapped Package for the given packages.Package, -// ensuring that there's a one-to-one mapping between the two. -// It's *not* threadsafe -- use packagesFor for that. -func (l *loader) packageFor(pkgRaw *packages.Package) *Package { - if l.packages[pkgRaw] == nil { - l.packages[pkgRaw] = &Package{ - Package: pkgRaw, - loader: l, - } - } - return l.packages[pkgRaw] -} - -// packagesFor returns a map of Package objects for each packages.Package in the input -// map, ensuring that there's a one-to-one mapping between package.Package and Package -// (as per packageFor). -func (l *loader) packagesFor(pkgsRaw map[string]*packages.Package) map[string]*Package { - l.packagesMu.Lock() - defer l.packagesMu.Unlock() - - out := make(map[string]*Package, len(pkgsRaw)) - for name, rawPkg := range pkgsRaw { - out[name] = l.packageFor(rawPkg) - } - return out -} - -// typeCheck type-checks the given package. -func (l *loader) typeCheck(pkg *Package) { - // don't conflict with typeCheckFromExportData - - pkg.TypesInfo = &types.Info{ - Types: make(map[ast.Expr]types.TypeAndValue), - Defs: make(map[*ast.Ident]types.Object), - Uses: make(map[*ast.Ident]types.Object), - Implicits: make(map[ast.Node]types.Object), - Scopes: make(map[ast.Node]*types.Scope), - Selections: make(map[*ast.SelectorExpr]*types.Selection), - } - - pkg.Fset = l.cfg.Fset - pkg.Types = types.NewPackage(pkg.PkgPath, pkg.Name) - - importer := importerFunc(func(path string) (*types.Package, error) { - if path == "unsafe" { - return types.Unsafe, nil - } - - // The imports map is keyed by import path. - importedPkg := pkg.Imports()[path] - if importedPkg == nil { - return nil, fmt.Errorf("package %q possibly creates an import loop", path) - } - - // it's possible to have a call to check in parallel to a call to this - // if one package in the package graph gets its dependency filtered out, - // but another doesn't (so one wants a "placeholder" package here, and another - // wants the full check). - // - // Thus, we need to lock here (at least for the time being) to avoid - // races between the above write to `pkg.Types` and this checking of - // importedPkg.Types. - importedPkg.Lock() - defer importedPkg.Unlock() - - if importedPkg.Types != nil && importedPkg.Types.Complete() { - return importedPkg.Types, nil - } - - // if we haven't already loaded typecheck data, we don't care about this package's types - return types.NewPackage(importedPkg.PkgPath, importedPkg.Name), nil - }) - - var errs []error - - // type-check - checkConfig := &types.Config{ - Importer: importer, - - IgnoreFuncBodies: true, // we only need decl-level info - - Error: func(err error) { - errs = append(errs, err) - }, - - Sizes: pkg.TypesSizes, - } - if err := types.NewChecker(checkConfig, l.cfg.Fset, pkg.Types, pkg.TypesInfo).Files(pkg.Syntax); err != nil { - errs = append(errs, err) - } - - // make sure that if a given sub-import is ill-typed, we mark this package as ill-typed as well. - illTyped := len(errs) > 0 - if !illTyped { - for _, importedPkg := range pkg.Imports() { - if importedPkg.IllTyped { - illTyped = true - break - } - } - } - pkg.IllTyped = illTyped - - // publish errors to the package error list. - for _, err := range errs { - pkg.AddError(err) - } -} - -// parseFile parses the given file, including comments. -func (l *loader) parseFile(filename string, src []byte) (*ast.File, error) { - // skip function bodies - file, err := parser.ParseFile(l.cfg.Fset, filename, src, parser.AllErrors|parser.ParseComments) - if err != nil { - return nil, err - } - - return file, nil -} - -// LoadRoots loads the given "root" packages by path, transitively loading -// and all imports as well. -// -// Loaded packages will have type size, imports, and exports file information -// populated. Additional information, like ASTs and type-checking information, -// can be accessed via methods on individual packages. -func LoadRoots(roots ...string) ([]*Package, error) { - return LoadRootsWithConfig(&packages.Config{}, roots...) -} - -// LoadRootsWithConfig functions like LoadRoots, except that it allows passing -// a custom loading config. The config will be modified to suit the needs of -// the loader. -// -// This is generally only useful for use in testing when you need to modify -// loading settings to load from a fake location. -// -// This function will traverse Go module boundaries for roots that are file- -// system paths and end with "...". Please note this feature currently only -// supports roots that are filesystem paths. For more information, please -// refer to the high-level outline of this function's logic: -// -// 1. If no roots are provided then load the working directory and return -// early. -// -// 2. Otherwise sort the provided roots into two, distinct buckets: -// -// a. package/module names -// b. filesystem paths -// -// A filesystem path is distinguished from a Go package/module name by -// the same rules as followed by the "go" command. At a high level, a -// root is a filesystem path IFF it meets ANY of the following criteria: -// -// * is absolute -// * begins with . -// * begins with .. -// -// For more information please refer to the output of the command -// "go help packages". -// -// 3. Load the package/module roots as a single call to packages.Load. If -// there are no filesystem path roots then return early. -// -// 4. For filesystem path roots ending with "...", check to see if its -// descendants include any nested, Go modules. If so, add the directory -// that contains the nested Go module to the filesystem path roots. -// -// 5. Load the filesystem path roots and return the load packages for the -// package/module roots AND the filesystem path roots. -func LoadRootsWithConfig(cfg *packages.Config, roots ...string) ([]*Package, error) { - l := &loader{ - cfg: cfg, - packages: make(map[*packages.Package]*Package), - } - l.cfg.Mode |= packages.LoadImports | packages.NeedTypesSizes - if l.cfg.Fset == nil { - l.cfg.Fset = token.NewFileSet() - } - // put our build flags first so that callers can override them - l.cfg.BuildFlags = append([]string{"-tags", "ignore_autogenerated"}, l.cfg.BuildFlags...) - - // uniquePkgIDs is used to keep track of the discovered packages to be nice - // and try and prevent packages from showing up twice when nested module - // support is enabled. there is not harm that comes from this per se, but - // it makes testing easier when a known number of modules can be asserted - uniquePkgIDs := sets.String{} - - // loadPackages returns the Go packages for the provided roots - // - // if validatePkgFn is nil, a package will be returned in the slice, - // otherwise the package is only returned if the result of - // validatePkgFn(pkg.ID) is truthy - loadPackages := func(roots ...string) ([]*Package, error) { - rawPkgs, err := packages.Load(l.cfg, roots...) - if err != nil { - return nil, err - } - var pkgs []*Package - for _, rp := range rawPkgs { - p := l.packageFor(rp) - if !uniquePkgIDs.Has(p.ID) { - pkgs = append(pkgs, p) - uniquePkgIDs.Insert(p.ID) - } - } - return pkgs, nil - } - - // if no roots were provided then load the current package and return early - if len(roots) == 0 { - pkgs, err := loadPackages() - if err != nil { - return nil, err - } - l.Roots = append(l.Roots, pkgs...) - return l.Roots, nil - } - - // pkgRoots is a slice of roots that are package/modules and fspRoots - // is a slice of roots that are local filesystem paths. - // - // please refer to this function's godoc comments for more information on - // how these two types of roots are distinguished from one another - var ( - pkgRoots []string - fspRoots []string - fspRootRx = regexp.MustCompile(`^\.{1,2}`) - ) - for _, r := range roots { - if filepath.IsAbs(r) || fspRootRx.MatchString(r) { - fspRoots = append(fspRoots, r) - } else { - pkgRoots = append(pkgRoots, r) - } - } - - // handle the package roots by sending them into the packages.Load function - // all at once. this is more efficient, but cannot be used for the file- - // system path roots due to them needing a custom, calculated value for the - // cfg.Dir field - if len(pkgRoots) > 0 { - pkgs, err := loadPackages(pkgRoots...) - if err != nil { - return nil, err - } - l.Roots = append(l.Roots, pkgs...) - } - - // if there are no filesystem path roots then go ahead and return early - if len(fspRoots) == 0 { - return l.Roots, nil - } - - // - // at this point we are handling filesystem path roots - // - - // ensure the cfg.Dir field is reset to its original value upon - // returning from this function. it should honestly be fine if it is - // not given most callers will not send in the cfg parameter directly, - // as it's largely for testing, but still, let's be good stewards. - defer func(d string) { - cfg.Dir = d - }(cfg.Dir) - - // store the value of cfg.Dir so we can use it later if it is non-empty. - // we need to store it now as the value of cfg.Dir will be updated by - // a loop below - cfgDir := cfg.Dir - - // addNestedGoModulesToRoots is given to filepath.WalkDir and adds the - // directory part of p to the list of filesystem path roots IFF p is the - // path to a file named "go.mod" - addNestedGoModulesToRoots := func( - p string, - d os.DirEntry, - e error) error { - - if e != nil { - return e - } - if !d.IsDir() && filepath.Base(p) == "go.mod" { - fspRoots = append(fspRoots, filepath.Join(filepath.Dir(p), "...")) - } - return nil - } - - // in the first pass over the filesystem path roots we: - // - // 1. make the root into an absolute path - // - // 2. check to see if a root uses the nested path syntax, ex. ... - // - // 3. if so, walk the root's descendants, searching for any nested Go - // modules - // - // 4. if found then the directory containing the Go module is added to - // the list of the filesystem path roots - for i := range fspRoots { - r := fspRoots[i] - - // clean up the root - r = filepath.Clean(r) - - // get the absolute path of the root - if !filepath.IsAbs(r) { - - // if the initial value of cfg.Dir was non-empty then use it when - // building the absolute path to this root. otherwise use the - // filepath.Abs function to get the absolute path of the root based - // on the working directory - if cfgDir != "" { - r = filepath.Join(cfgDir, r) - } else { - ar, err := filepath.Abs(r) - if err != nil { - return nil, err - } - r = ar - } - } - - // update the root to be an absolute path - fspRoots[i] = r - - b, d := filepath.Base(r), filepath.Dir(r) - - // if the base element is "..." then it means nested traversal is - // activated. this can be passed directly to the loader. however, if - // specified we also want to traverse the path manually to determine if - // there are any nested Go modules we want to add to the list of file- - // system path roots to process - if b == "..." { - if err := filepath.WalkDir( - d, - addNestedGoModulesToRoots); err != nil { - - return nil, err - } - } - } - - // in the second pass over the filesystem path roots we: - // - // 1. determine the directory from which to execute the loader - // - // 2. update the loader config's Dir property to be the directory from - // step one - // - // 3. determine whether the root passed to the loader should be "./." - // or "./..." - // - // 4. execute the loader with the value from step three - for _, r := range fspRoots { - b, d := filepath.Base(r), filepath.Dir(r) - - // we want the base part of the path to be either "..." or ".", except - // Go's filepath utilities clean paths during manipulation, removing the - // ".". thus, if not "...", let's update the path components so that: - // - // d = r - // b = "." - if b != "..." { - d = r - b = "." - } - - // update the loader configuration's Dir field to the directory part of - // the root - l.cfg.Dir = d - - // update the root to be "./..." or "./." - // (with OS-specific filepath separator). please note filepath.Join - // would clean up the trailing "." character that we want preserved, - // hence the more manual path concatenation logic - r = fmt.Sprintf(".%s%s", string(filepath.Separator), b) - - // load the packages from the roots - pkgs, err := loadPackages(r) - if err != nil { - return nil, err - } - l.Roots = append(l.Roots, pkgs...) - } - - return l.Roots, nil -} - -// importFunc is an implementation of the single-method -// types.Importer interface based on a function value. -type importerFunc func(path string) (*types.Package, error) - -func (f importerFunc) Import(path string) (*types.Package, error) { return f(path) } diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/loader/paths.go b/vendor/sigs.k8s.io/controller-tools/pkg/loader/paths.go deleted file mode 100644 index 3b783e1685c..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/loader/paths.go +++ /dev/null @@ -1,32 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 loader - -import ( - "strings" -) - -// NonVendorPath returns a package path that does not include anything before the -// last vendor directory. This is useful for when using vendor directories, -// and using go/types.Package.Path(), which returns the full path including vendor. -// -// If you're using this, make sure you really need it -- it's better to index by -// the actual Package object when you can. -func NonVendorPath(rawPath string) string { - parts := strings.Split(rawPath, "/vendor/") - return parts[len(parts)-1] -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/loader/refs.go b/vendor/sigs.k8s.io/controller-tools/pkg/loader/refs.go deleted file mode 100644 index 37c3295f140..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/loader/refs.go +++ /dev/null @@ -1,273 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 loader - -import ( - "fmt" - - "go/ast" - "strconv" - "sync" -) - -// NB(directxman12): most of this is done by the typechecker, -// but it's a bit slow/heavyweight for what we want -- we want -// to resolve external imports *only* if we actually need them. - -// Basically, what we do is: -// 1. Map imports to names -// 2. Find all explicit external references (`name.type`) -// 3. Find all referenced packages by merging explicit references and dot imports -// 4. Only type-check those packages -// 5. Ignore type-checking errors from the missing packages, because we won't ever -// touch unloaded types (they're probably used in ignored fields/types, variables, or functions) -// (done using PrintErrors with an ignore argument from the caller). -// 6. Notice any actual type-checking errors via invalid types - -// importsMap saves import aliases, mapping them to underlying packages. -type importsMap struct { - // dotImports maps package IDs to packages for any packages that have/ been imported as `.` - dotImports map[string]*Package - // byName maps package aliases or names to the underlying package. - byName map[string]*Package -} - -// mapImports maps imports from the names they use in the given file to the underlying package, -// using a map of package import paths to packages (generally from Package.Imports()). -func mapImports(file *ast.File, importedPkgs map[string]*Package) (*importsMap, error) { - m := &importsMap{ - dotImports: make(map[string]*Package), - byName: make(map[string]*Package), - } - for _, importSpec := range file.Imports { - path, err := strconv.Unquote(importSpec.Path.Value) - if err != nil { - return nil, ErrFromNode(err, importSpec.Path) - } - importedPkg := importedPkgs[path] - if importedPkg == nil { - return nil, ErrFromNode(fmt.Errorf("no such package located"), importSpec.Path) - } - if importSpec.Name == nil { - m.byName[importedPkg.Name] = importedPkg - continue - } - if importSpec.Name.Name == "." { - m.dotImports[importedPkg.ID] = importedPkg - continue - } - m.byName[importSpec.Name.Name] = importedPkg - } - - return m, nil -} - -// referenceSet finds references to external packages' types in the given file, -// without otherwise calling into the type-checker. When checking structs, -// it only checks fields with JSON tags. -type referenceSet struct { - file *ast.File - imports *importsMap - pkg *Package - - externalRefs map[*Package]struct{} -} - -func (r *referenceSet) init() { - if r.externalRefs == nil { - r.externalRefs = make(map[*Package]struct{}) - } -} - -// NodeFilter filters nodes, accepting them for reference collection -// when true is returned and rejecting them when false is returned. -type NodeFilter func(ast.Node) bool - -// collectReferences saves all references to external types in the given info. -func (r *referenceSet) collectReferences(rawType ast.Expr, filterNode NodeFilter) { - r.init() - col := &referenceCollector{ - refs: r, - filterNode: filterNode, - } - ast.Walk(col, rawType) -} - -// external saves an external reference to the given named package. -func (r *referenceSet) external(pkgName string) { - pkg := r.imports.byName[pkgName] - if pkg == nil { - r.pkg.AddError(fmt.Errorf("use of unimported package %q", pkgName)) - return - } - r.externalRefs[pkg] = struct{}{} -} - -// referenceCollector visits nodes in an AST, adding external references to a -// referenceSet. -type referenceCollector struct { - refs *referenceSet - filterNode NodeFilter -} - -func (c *referenceCollector) Visit(node ast.Node) ast.Visitor { - if !c.filterNode(node) { - return nil - } - switch typedNode := node.(type) { - case *ast.Ident: - // local reference or dot-import, ignore - return nil - case *ast.SelectorExpr: - switch x := typedNode.X.(type) { - case *ast.Ident: - pkgName := x.Name - c.refs.external(pkgName) - return nil - default: - return c - } - default: - return c - } -} - -// allReferencedPackages finds all directly referenced packages in the given package. -func allReferencedPackages(pkg *Package, filterNodes NodeFilter) []*Package { - pkg.NeedSyntax() - refsByFile := make(map[*ast.File]*referenceSet) - for _, file := range pkg.Syntax { - imports, err := mapImports(file, pkg.Imports()) - if err != nil { - pkg.AddError(err) - return nil - } - refs := &referenceSet{ - file: file, - imports: imports, - pkg: pkg, - } - refsByFile[file] = refs - } - - EachType(pkg, func(file *ast.File, decl *ast.GenDecl, spec *ast.TypeSpec) { - refs := refsByFile[file] - refs.collectReferences(spec.Type, filterNodes) - }) - - allPackages := make(map[*Package]struct{}) - for _, refs := range refsByFile { - for _, pkg := range refs.imports.dotImports { - allPackages[pkg] = struct{}{} - } - for ref := range refs.externalRefs { - allPackages[ref] = struct{}{} - } - } - - res := make([]*Package, 0, len(allPackages)) - for pkg := range allPackages { - res = append(res, pkg) - } - return res -} - -// TypeChecker performs type-checking on a limitted subset of packages by -// checking each package's types' externally-referenced types, and only -// type-checking those packages. -type TypeChecker struct { - // NodeFilters are used to filter the set of references that are followed - // when typechecking. If any of the filters returns true for a given node, - // its package will be added to the set of packages to check. - // - // If no filters are specified, all references are followed (this may be slow). - // - // Modifying this after the first call to check may yield strange/invalid - // results. - NodeFilters []NodeFilter - - checkedPackages map[*Package]struct{} - sync.Mutex -} - -// Check type-checks the given package and all packages referenced by types -// that pass through (have true returned by) any of the NodeFilters. -func (c *TypeChecker) Check(root *Package) { - c.init() - - // use a sub-checker with the appropriate settings - (&TypeChecker{ - NodeFilters: c.NodeFilters, - checkedPackages: c.checkedPackages, - }).check(root) -} - -func (c *TypeChecker) isNodeInteresting(node ast.Node) bool { - // no filters --> everything is important - if len(c.NodeFilters) == 0 { - return true - } - - // otherwise, passing through any one filter means this node is important - for _, filter := range c.NodeFilters { - if filter(node) { - return true - } - } - return false -} - -func (c *TypeChecker) init() { - if c.checkedPackages == nil { - c.checkedPackages = make(map[*Package]struct{}) - } -} - -// check recursively type-checks the given package, only loading packages that -// are actually referenced by our types (it's the actual implementation of Check, -// without initialization). -func (c *TypeChecker) check(root *Package) { - root.Lock() - defer root.Unlock() - - c.Lock() - _, ok := c.checkedPackages[root] - c.Unlock() - if ok { - return - } - - refedPackages := allReferencedPackages(root, c.isNodeInteresting) - - // first, resolve imports for all leaf packages... - var wg sync.WaitGroup - for _, pkg := range refedPackages { - wg.Add(1) - go func(pkg *Package) { - defer wg.Done() - c.check(pkg) - }(pkg) - } - wg.Wait() - - // ...then, we can safely type-check ourself - root.NeedTypesInfo() - - c.Lock() - defer c.Unlock() - c.checkedPackages[root] = struct{}{} -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/loader/visit.go b/vendor/sigs.k8s.io/controller-tools/pkg/loader/visit.go deleted file mode 100644 index b5646fde1d4..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/loader/visit.go +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 loader - -import ( - "go/ast" - "reflect" - "strconv" -) - -// TypeCallback is a callback called for each raw AST (gendecl, typespec) combo. -type TypeCallback func(file *ast.File, decl *ast.GenDecl, spec *ast.TypeSpec) - -// EachType calls the given callback for each (gendecl, typespec) combo in the -// given package. Generally, using markers.EachType is better when working -// with marker data, and has a more convinient representation. -func EachType(pkg *Package, cb TypeCallback) { - visitor := &typeVisitor{ - callback: cb, - } - pkg.NeedSyntax() - for _, file := range pkg.Syntax { - visitor.file = file - ast.Walk(visitor, file) - } -} - -// typeVisitor visits all TypeSpecs, calling the given callback for each. -type typeVisitor struct { - callback TypeCallback - decl *ast.GenDecl - file *ast.File -} - -// Visit visits all TypeSpecs. -func (v *typeVisitor) Visit(node ast.Node) ast.Visitor { - if node == nil { - v.decl = nil - return v - } - - switch typedNode := node.(type) { - case *ast.File: - v.file = typedNode - return v - case *ast.GenDecl: - v.decl = typedNode - return v - case *ast.TypeSpec: - v.callback(v.file, v.decl, typedNode) - return nil // don't recurse - default: - return nil - } -} - -// ParseAstTag parses the given raw tag literal into a reflect.StructTag. -func ParseAstTag(tag *ast.BasicLit) reflect.StructTag { - if tag == nil { - return reflect.StructTag("") - } - tagStr, err := strconv.Unquote(tag.Value) - if err != nil { - return reflect.StructTag("") - } - return reflect.StructTag(tagStr) -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/markers/collect.go b/vendor/sigs.k8s.io/controller-tools/pkg/markers/collect.go deleted file mode 100644 index c5ea2345fdd..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/markers/collect.go +++ /dev/null @@ -1,422 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 markers - -import ( - "go/ast" - "go/token" - "strings" - "sync" - - "sigs.k8s.io/controller-tools/pkg/loader" -) - -// Collector collects and parses marker comments defined in the registry -// from package source code. If no registry is provided, an empty one will -// be initialized on the first call to MarkersInPackage. -type Collector struct { - *Registry - - byPackage map[string]map[ast.Node]MarkerValues - mu sync.Mutex -} - -// MarkerValues are all the values for some set of markers. -type MarkerValues map[string][]interface{} - -// Get fetches the first value that for the given marker, returning -// nil if no values are available. -func (v MarkerValues) Get(name string) interface{} { - vals := v[name] - if len(vals) == 0 { - return nil - } - return vals[0] -} - -func (c *Collector) init() { - if c.Registry == nil { - c.Registry = &Registry{} - } - if c.byPackage == nil { - c.byPackage = make(map[string]map[ast.Node]MarkerValues) - } -} - -// MarkersInPackage computes the marker values by node for the given package. Results -// are cached by package ID, so this is safe to call repeatedly from different functions. -// Each file in the package is treated as a distinct node. -// -// We consider a marker to be associated with a given AST node if either of the following are true: -// -// - it's in the Godoc for that AST node -// -// - it's in the closest non-godoc comment group above that node, -// *and* that node is a type or field node, *and* [it's either -// registered as type-level *or* it's not registered as being -// package-level] -// -// - it's not in the Godoc of a node, doesn't meet the above criteria, and -// isn't in a struct definition (in which case it's package-level) -func (c *Collector) MarkersInPackage(pkg *loader.Package) (map[ast.Node]MarkerValues, error) { - c.mu.Lock() - c.init() - if markers, exist := c.byPackage[pkg.ID]; exist { - c.mu.Unlock() - return markers, nil - } - // unlock early, it's ok if we do a bit extra work rather than locking while we're working - c.mu.Unlock() - - pkg.NeedSyntax() - nodeMarkersRaw := c.associatePkgMarkers(pkg) - markers, err := c.parseMarkersInPackage(nodeMarkersRaw) - if err != nil { - return nil, err - } - - c.mu.Lock() - defer c.mu.Unlock() - c.byPackage[pkg.ID] = markers - - return markers, nil -} - -// parseMarkersInPackage parses the given raw marker comments into output values using the registry. -func (c *Collector) parseMarkersInPackage(nodeMarkersRaw map[ast.Node][]markerComment) (map[ast.Node]MarkerValues, error) { - var errors []error - nodeMarkerValues := make(map[ast.Node]MarkerValues) - for node, markersRaw := range nodeMarkersRaw { - var target TargetType - switch node.(type) { - case *ast.File: - target = DescribesPackage - case *ast.Field: - target = DescribesField - default: - target = DescribesType - } - markerVals := make(map[string][]interface{}) - for _, markerRaw := range markersRaw { - markerText := markerRaw.Text() - def := c.Registry.Lookup(markerText, target) - if def == nil { - continue - } - val, err := def.Parse(markerText) - if err != nil { - errors = append(errors, loader.ErrFromNode(err, markerRaw)) - continue - } - markerVals[def.Name] = append(markerVals[def.Name], val) - } - nodeMarkerValues[node] = markerVals - } - - return nodeMarkerValues, loader.MaybeErrList(errors) -} - -// associatePkgMarkers associates markers with AST nodes in the given package. -func (c *Collector) associatePkgMarkers(pkg *loader.Package) map[ast.Node][]markerComment { - nodeMarkers := make(map[ast.Node][]markerComment) - for _, file := range pkg.Syntax { - fileNodeMarkers := c.associateFileMarkers(file) - for node, markers := range fileNodeMarkers { - nodeMarkers[node] = append(nodeMarkers[node], markers...) - } - } - - return nodeMarkers -} - -// associateFileMarkers associates markers with AST nodes in the given file. -func (c *Collector) associateFileMarkers(file *ast.File) map[ast.Node][]markerComment { - // grab all the raw marker comments by node - visitor := markerSubVisitor{ - collectPackageLevel: true, - markerVisitor: &markerVisitor{ - nodeMarkers: make(map[ast.Node][]markerComment), - allComments: file.Comments, - }, - } - ast.Walk(visitor, file) - - // grab the last package-level comments at the end of the file (if any) - lastFileMarkers := visitor.markersBetween(false, visitor.commentInd, len(visitor.allComments)) - visitor.pkgMarkers = append(visitor.pkgMarkers, lastFileMarkers...) - - // figure out if any type-level markers are actually package-level markers - for node, markers := range visitor.nodeMarkers { - _, isType := node.(*ast.TypeSpec) - if !isType { - continue - } - endOfMarkers := 0 - for _, marker := range markers { - if marker.fromGodoc { - // markers from godoc are never package level - markers[endOfMarkers] = marker - endOfMarkers++ - continue - } - markerText := marker.Text() - typeDef := c.Registry.Lookup(markerText, DescribesType) - if typeDef != nil { - // prefer assuming type-level markers - markers[endOfMarkers] = marker - endOfMarkers++ - continue - } - def := c.Registry.Lookup(markerText, DescribesPackage) - if def == nil { - // assume type-level unless proven otherwise - markers[endOfMarkers] = marker - endOfMarkers++ - continue - } - // it's package-level, since a package-level definition exists - visitor.pkgMarkers = append(visitor.pkgMarkers, marker) - } - visitor.nodeMarkers[node] = markers[:endOfMarkers] // re-set after trimming the package markers - } - visitor.nodeMarkers[file] = visitor.pkgMarkers - - return visitor.nodeMarkers -} - -// markerComment is an AST comment that contains a marker. -// It may or may not be from a Godoc comment, which affects -// marker re-associated (from type-level to package-level) -type markerComment struct { - *ast.Comment - fromGodoc bool -} - -// Text returns the text of the marker, stripped of the comment -// marker and leading spaces, as should be passed to Registry.Lookup -// and Registry.Parse. -func (c markerComment) Text() string { - return strings.TrimSpace(c.Comment.Text[2:]) -} - -// markerVisistor visits AST nodes, recording markers associated with each node. -type markerVisitor struct { - allComments []*ast.CommentGroup - commentInd int - - declComments []markerComment - lastLineCommentGroup *ast.CommentGroup - - pkgMarkers []markerComment - nodeMarkers map[ast.Node][]markerComment -} - -// isMarkerComment checks that the given comment is a single-line (`//`) -// comment and it's first non-space content is `+`. -func isMarkerComment(comment string) bool { - if comment[0:2] != "//" { - return false - } - stripped := strings.TrimSpace(comment[2:]) - if len(stripped) < 1 || stripped[0] != '+' { - return false - } - return true -} - -// markersBetween grabs the markers between the given indicies in the list of all comments. -func (v *markerVisitor) markersBetween(fromGodoc bool, start, end int) []markerComment { - if start < 0 || end < 0 { - return nil - } - var res []markerComment - for i := start; i < end; i++ { - commentGroup := v.allComments[i] - for _, comment := range commentGroup.List { - if !isMarkerComment(comment.Text) { - continue - } - res = append(res, markerComment{Comment: comment, fromGodoc: fromGodoc}) - } - } - return res -} - -type markerSubVisitor struct { - *markerVisitor - node ast.Node - collectPackageLevel bool -} - -// Visit collects markers for each node in the AST, optionally -// collecting unassociated markers as package-level. -func (v markerSubVisitor) Visit(node ast.Node) ast.Visitor { - if node == nil { - // end of the node, so we might need to advance comments beyond the end - // of the block if we don't want to collect package-level markers in - // this block. - - if !v.collectPackageLevel { - if v.commentInd < len(v.allComments) { - lastCommentInd := v.commentInd - nextGroup := v.allComments[lastCommentInd] - for nextGroup.Pos() < v.node.End() { - lastCommentInd++ - if lastCommentInd >= len(v.allComments) { - // after the increment so our decrement below still makes sense - break - } - nextGroup = v.allComments[lastCommentInd] - } - v.commentInd = lastCommentInd - } - } - - return nil - } - - // skip comments on the same line as the previous node - // making sure to double-check for the case where we've gone past the end of the comments - // but still have to finish up typespec-gendecl association (see below). - if v.lastLineCommentGroup != nil && v.commentInd < len(v.allComments) && v.lastLineCommentGroup.Pos() == v.allComments[v.commentInd].Pos() { - v.commentInd++ - } - - // stop visiting if there are no more comments in the file - // NB(directxman12): we can't just stop immediately, because we - // still need to check if there are typespecs associated with gendecls. - var markerCommentBlock []markerComment - var docCommentBlock []markerComment - lastCommentInd := v.commentInd - if v.commentInd < len(v.allComments) { - // figure out the first comment after the node in question... - nextGroup := v.allComments[lastCommentInd] - for nextGroup.Pos() < node.Pos() { - lastCommentInd++ - if lastCommentInd >= len(v.allComments) { - // after the increment so our decrement below still makes sense - break - } - nextGroup = v.allComments[lastCommentInd] - } - lastCommentInd-- // ...then decrement to get the last comment before the node in question - - // figure out the godoc comment so we can deal with it separately - var docGroup *ast.CommentGroup - docGroup, v.lastLineCommentGroup = associatedCommentsFor(node) - - // find the last comment group that's not godoc - markerCommentInd := lastCommentInd - if docGroup != nil && v.allComments[markerCommentInd].Pos() == docGroup.Pos() { - markerCommentInd-- - } - - // check if we have freestanding package markers, - // and find the markers in our "closest non-godoc" comment block, - // plus our godoc comment block - if markerCommentInd >= v.commentInd { - if v.collectPackageLevel { - // assume anything between the comment ind and the marker ind (not including it) - // are package-level - v.pkgMarkers = append(v.pkgMarkers, v.markersBetween(false, v.commentInd, markerCommentInd)...) - } - markerCommentBlock = v.markersBetween(false, markerCommentInd, markerCommentInd+1) - docCommentBlock = v.markersBetween(true, markerCommentInd+1, lastCommentInd+1) - } else { - docCommentBlock = v.markersBetween(true, markerCommentInd+1, lastCommentInd+1) - } - } - - resVisitor := markerSubVisitor{ - collectPackageLevel: false, // don't collect package level by default - markerVisitor: v.markerVisitor, - node: node, - } - - // associate those markers with a node - switch typedNode := node.(type) { - case *ast.GenDecl: - // save the comments associated with the gen-decl if it's a single-line type decl - if typedNode.Lparen != token.NoPos || typedNode.Tok != token.TYPE { - // not a single-line type spec, treat them as free comments - v.pkgMarkers = append(v.pkgMarkers, markerCommentBlock...) - break - } - // save these, we'll need them when we encounter the actual type spec - v.declComments = append(v.declComments, markerCommentBlock...) - v.declComments = append(v.declComments, docCommentBlock...) - case *ast.TypeSpec: - // add in comments attributed to the gen-decl, if any, - // as well as comments associated with the actual type - v.nodeMarkers[node] = append(v.nodeMarkers[node], v.declComments...) - v.nodeMarkers[node] = append(v.nodeMarkers[node], markerCommentBlock...) - v.nodeMarkers[node] = append(v.nodeMarkers[node], docCommentBlock...) - - v.declComments = nil - v.collectPackageLevel = false // don't collect package-level inside type structs - case *ast.Field: - v.nodeMarkers[node] = append(v.nodeMarkers[node], markerCommentBlock...) - v.nodeMarkers[node] = append(v.nodeMarkers[node], docCommentBlock...) - case *ast.File: - v.pkgMarkers = append(v.pkgMarkers, markerCommentBlock...) - v.pkgMarkers = append(v.pkgMarkers, docCommentBlock...) - - // collect markers in root file scope - resVisitor.collectPackageLevel = true - default: - // assume markers before anything else are package-level markers, - // *but* don't include any markers in godoc - if v.collectPackageLevel { - v.pkgMarkers = append(v.pkgMarkers, markerCommentBlock...) - } - } - - // increment the comment ind so that we start at the right place for the next node - v.commentInd = lastCommentInd + 1 - - return resVisitor - -} - -// associatedCommentsFor returns the doc comment group (if relevant and present) and end-of-line comment -// (again if relevant and present) for the given AST node. -func associatedCommentsFor(node ast.Node) (docGroup *ast.CommentGroup, lastLineCommentGroup *ast.CommentGroup) { - switch typedNode := node.(type) { - case *ast.Field: - docGroup = typedNode.Doc - lastLineCommentGroup = typedNode.Comment - case *ast.File: - docGroup = typedNode.Doc - case *ast.FuncDecl: - docGroup = typedNode.Doc - case *ast.GenDecl: - docGroup = typedNode.Doc - case *ast.ImportSpec: - docGroup = typedNode.Doc - lastLineCommentGroup = typedNode.Comment - case *ast.TypeSpec: - docGroup = typedNode.Doc - lastLineCommentGroup = typedNode.Comment - case *ast.ValueSpec: - docGroup = typedNode.Doc - lastLineCommentGroup = typedNode.Comment - default: - lastLineCommentGroup = nil - } - - return docGroup, lastLineCommentGroup -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/markers/doc.go b/vendor/sigs.k8s.io/controller-tools/pkg/markers/doc.go deleted file mode 100644 index 707036de8f9..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/markers/doc.go +++ /dev/null @@ -1,113 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 markers contains utilities for defining and parsing "marker -// comments", also occasionally called tag comments (we use the term marker to -// avoid confusing with struct tags). Parsed result (output) values take the -// form of Go values, much like the "encoding/json" package. -// -// Definitions and Parsing -// -// Markers are defined as structured Definitions which can be used to -// consistently parse marker comments. A Definition contains an concrete -// output type for the marker, which can be a simple type (like string), a -// struct, or a wrapper type (useful for defining additional methods on marker -// types). -// -// Markers take the general form -// -// +path:to:marker=val -// -// +path:to:marker:arg1=val,arg2=val2 -// -// +path:to:marker -// -// Arguments may be ints, bools, strings, and slices. Ints and bool take their -// standard form from Go. Strings may take any of their standard forms, or any -// sequence of unquoted characters up until a `,` or `;` is encountered. Lists -// take either of the following forms: -// -// val;val;val -// -// {val, val, val} -// -// Note that the first form will not properly parse nested slices, but is -// generally convenient and is the form used in many existing markers. -// -// Each of those argument types maps to the corresponding go type. Pointers -// mark optional fields (a struct tag, below, may also be used). The empty -// interface will match any type. -// -// Struct fields may optionally be annotated with the `marker` struct tag. The -// first argument is a name override. If it's left blank (or the tag isn't -// present), the camelCase version of the name will be used. The only -// additional argument defined is `optional`, which marks a field as optional -// without using a pointer. -// -// All parsed values are unmarshalled into the output type. If any -// non-optional fields aren't mentioned, an error will be raised unless -// `Strict` is set to false. -// -// Registries and Lookup -// -// Definitions can be added to registries to facilitate lookups. Each -// definition is marked as either describing a type, struct field, or package -// (unassociated). The same marker name may be registered multiple times, as -// long as each describes a different construct (type, field, or package). -// Definitions can then be looked up by passing unparsed markers. -// -// Collection and Extraction -// -// Markers can be collected from a loader.Package using a Collector. The -// Collector will read from a given Registry, collecting comments that look -// like markers and parsing them if they match some definition on the registry. -// -// Markers are considered associated with a particular field or type if they -// exist in the Godoc, or the closest non-godoc comment. Any other markers not -// inside a some other block (e.g. a struct definition, interface definition, -// etc) are considered package level. Markers in a "closest non-Go comment -// block" may also be considered package level if registered as such and no -// identical type-level definition exists. -// -// Like loader.Package, Collector's methods are idempotent and will not -// reperform work. -// -// Traversal -// -// EachType function iterates over each type in a Package, providing -// conveniently structured type and field information with marker values -// associated. -// -// PackageMarkers can be used to fetch just package-level markers. -// -// Help -// -// Help can be defined for each marker using the DefinitionHelp struct. It's -// mostly intended to be generated off of godocs using cmd/helpgen, which takes -// the first line as summary (removing the type/field name), and considers the -// rest as details. It looks for the -// -// +controllertools:generateHelp[:category=] -// -// marker to start generation. -// -// If you can't use godoc-based generation for whatever reasons (e.g. -// primitive-typed markers), you can use the SimpleHelp and DeprecatedHelp -// helper functions to generate help structs. -// -// Help is then registered into a registry as associated with the actual -// definition, and can then be later retrieved from the registry. -package markers diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/markers/help.go b/vendor/sigs.k8s.io/controller-tools/pkg/markers/help.go deleted file mode 100644 index 26ca059bc8b..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/markers/help.go +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 markers - -// You *probably* don't want to write these structs by hand -// -- use cmd/helpgen if you can write Godoc, and {Simple,Deprecated}Help -// otherwise. - -// DetailedHelp contains brief help, as well as more details. -// For the "full" help, join the two together. -type DetailedHelp struct { - Summary string - Details string -} - -// DefinitionHelp contains overall help for a marker Definition, -// as well as per-field help. -type DefinitionHelp struct { - // DetailedHelp contains the overall help for the marker. - DetailedHelp - // Category describes what kind of marker this is. - Category string - // DeprecatedInFavorOf marks the marker as deprecated. - // If non-nil & empty, it's assumed to just mean deprecated permanently. - // If non-empty, it's assumed to be a marker name. - DeprecatedInFavorOf *string - - // NB(directxman12): we make FieldHelp be in terms of the Go struct field - // names so that we don't have to know the conversion or processing rules - // for struct fields at compile-time for help generation. - - // FieldHelp defines the per-field help for this marker, *in terms of the - // go struct field names. Use the FieldsHelp method to map this to - // marker argument names. - FieldHelp map[string]DetailedHelp -} - -// FieldsHelp maps per-field help to the actual marker argument names from the -// given definition. -func (d *DefinitionHelp) FieldsHelp(def *Definition) map[string]DetailedHelp { - fieldsHelp := make(map[string]DetailedHelp, len(def.FieldNames)) - for fieldName, argName := range def.FieldNames { - fieldsHelp[fieldName] = d.FieldHelp[argName] - } - return fieldsHelp -} - -// SimpleHelp returns help that just has marker-level summary information -// (e.g. for use with empty or primitive-typed markers, where Godoc-based -// generation isn't possible). -func SimpleHelp(category, summary string) *DefinitionHelp { - return &DefinitionHelp{ - Category: category, - DetailedHelp: DetailedHelp{Summary: summary}, - } -} - -// DeprecatedHelp returns simple help (a la SimpleHelp), except marked as -// deprecated in favor of the given marker (or an empty string for just -// deprecated). -func DeprecatedHelp(inFavorOf, category, summary string) *DefinitionHelp { - return &DefinitionHelp{ - Category: category, - DetailedHelp: DetailedHelp{Summary: summary}, - DeprecatedInFavorOf: &inFavorOf, - } -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/markers/parse.go b/vendor/sigs.k8s.io/controller-tools/pkg/markers/parse.go deleted file mode 100644 index 3e1d75a8336..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/markers/parse.go +++ /dev/null @@ -1,963 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 markers - -import ( - "bytes" - "fmt" - "reflect" - "strconv" - "strings" - sc "text/scanner" - "unicode" - - "sigs.k8s.io/controller-tools/pkg/loader" -) - -// expect checks that the next token of the scanner is the given token, adding an error -// to the scanner if not. It returns whether the token was as expected. -func expect(scanner *sc.Scanner, expected rune, errDesc string) bool { - tok := scanner.Scan() - if tok != expected { - scanner.Error(scanner, fmt.Sprintf("expected %s, got %q", errDesc, scanner.TokenText())) - return false - } - return true -} - -// peekNoSpace is equivalent to scanner.Peek, except that it will consume intervening whitespace. -func peekNoSpace(scanner *sc.Scanner) rune { - hint := scanner.Peek() - for ; hint <= rune(' ') && ((1<") - case IntType: - out.WriteString("int") - case NumberType: - out.WriteString("float64") - case StringType: - out.WriteString("string") - case BoolType: - out.WriteString("bool") - case AnyType: - out.WriteString("") - case SliceType: - out.WriteString("[]") - // arguments can't be non-pointer optional, so just call into typeString again. - a.ItemType.typeString(out) - case MapType: - out.WriteString("map[string]") - a.ItemType.typeString(out) - case RawType: - out.WriteString("") - } -} - -// TypeString returns a string roughly equivalent -// (but not identical) to the underlying Go type that -// this argument would parse to. It's mainly useful -// for user-friendly formatting of this argument (e.g. -// help strings). -func (a Argument) TypeString() string { - out := &strings.Builder{} - a.typeString(out) - return out.String() -} - -func (a Argument) String() string { - if a.Optional { - return fmt.Sprintf("", a.TypeString()) - } - return fmt.Sprintf("", a.TypeString()) -} - -// castAndSet casts val to out's type if needed, -// then sets out to val. -func castAndSet(out, val reflect.Value) { - outType := out.Type() - if outType != val.Type() { - val = val.Convert(outType) - } - out.Set(val) -} - -// makeSliceType makes a reflect.Type for a slice of the given type. -// Useful for constructing the out value for when AnyType's guess returns a slice. -func makeSliceType(itemType Argument) (reflect.Type, error) { - var itemReflectedType reflect.Type - switch itemType.Type { - case IntType: - itemReflectedType = reflect.TypeOf(int(0)) - case NumberType: - itemReflectedType = reflect.TypeOf(float64(0)) - case StringType: - itemReflectedType = reflect.TypeOf("") - case BoolType: - itemReflectedType = reflect.TypeOf(false) - case SliceType: - subItemType, err := makeSliceType(*itemType.ItemType) - if err != nil { - return nil, err - } - itemReflectedType = subItemType - case MapType: - subItemType, err := makeMapType(*itemType.ItemType) - if err != nil { - return nil, err - } - itemReflectedType = subItemType - // TODO(directxman12): support non-uniform slices? (probably not) - default: - return nil, fmt.Errorf("invalid type when constructing guessed slice out: %v", itemType.Type) - } - - if itemType.Pointer { - itemReflectedType = reflect.PtrTo(itemReflectedType) - } - - return reflect.SliceOf(itemReflectedType), nil -} - -// makeMapType makes a reflect.Type for a map of the given item type. -// Useful for constructing the out value for when AnyType's guess returns a map. -func makeMapType(itemType Argument) (reflect.Type, error) { - var itemReflectedType reflect.Type - switch itemType.Type { - case IntType: - itemReflectedType = reflect.TypeOf(int(0)) - case NumberType: - itemReflectedType = reflect.TypeOf(float64(0)) - case StringType: - itemReflectedType = reflect.TypeOf("") - case BoolType: - itemReflectedType = reflect.TypeOf(false) - case SliceType: - subItemType, err := makeSliceType(*itemType.ItemType) - if err != nil { - return nil, err - } - itemReflectedType = subItemType - // TODO(directxman12): support non-uniform slices? (probably not) - case MapType: - subItemType, err := makeMapType(*itemType.ItemType) - if err != nil { - return nil, err - } - itemReflectedType = subItemType - case AnyType: - // NB(directxman12): maps explicitly allow non-uniform item types, unlike slices at the moment - itemReflectedType = interfaceType - default: - return nil, fmt.Errorf("invalid type when constructing guessed slice out: %v", itemType.Type) - } - - if itemType.Pointer { - itemReflectedType = reflect.PtrTo(itemReflectedType) - } - - return reflect.MapOf(reflect.TypeOf(""), itemReflectedType), nil -} - -// guessType takes an educated guess about the type of the next field. If allowSlice -// is false, it will not guess slices. It's less efficient than parsing with actual -// type information, since we need to allocate to peek ahead full tokens, and the scanner -// only allows peeking ahead one character. -// Maps are *always* non-uniform (i.e. type the AnyType item type), since they're frequently -// used to represent things like defaults for an object in JSON. -func guessType(scanner *sc.Scanner, raw string, allowSlice bool) *Argument { - if allowSlice { - maybeItem := guessType(scanner, raw, false) - - subRaw := raw[scanner.Pos().Offset:] - subScanner := parserScanner(subRaw, scanner.Error) - - var tok rune - for tok = subScanner.Scan(); tok != ',' && tok != sc.EOF && tok != ';'; tok = subScanner.Scan() { - // wait till we get something interesting - } - - // semicolon means it's a legacy slice - if tok == ';' { - return &Argument{ - Type: SliceType, - ItemType: maybeItem, - } - } - - return maybeItem - } - - // everything else needs a duplicate scanner to scan properly - // (so we don't consume our scanner tokens until we actually - // go to use this -- Go doesn't like scanners that can be rewound). - subRaw := raw[scanner.Pos().Offset:] - subScanner := parserScanner(subRaw, scanner.Error) - - // skip whitespace - hint := peekNoSpace(subScanner) - - // first, try the easy case -- quoted strings strings - switch hint { - case '"', '\'', '`': - return &Argument{Type: StringType} - } - - // next, check for slices or maps - if hint == '{' { - subScanner.Scan() - - // TODO(directxman12): this can't guess at empty objects, but that's generally ok. - // We'll cross that bridge when we get there. - - // look ahead till we can figure out if this is a map or a slice - firstElemType := guessType(subScanner, subRaw, false) - if firstElemType.Type == StringType { - // might be a map or slice, parse the string and check for colon - // (blech, basically arbitrary look-ahead due to raw strings). - var keyVal string // just ignore this - (&Argument{Type: StringType}).parseString(subScanner, raw, reflect.Indirect(reflect.ValueOf(&keyVal))) - - if subScanner.Scan() == ':' { - // it's got a string followed by a colon -- it's a map - return &Argument{ - Type: MapType, - ItemType: &Argument{Type: AnyType}, - } - } - } - - // definitely a slice -- maps have to have string keys and have a value followed by a colon - return &Argument{ - Type: SliceType, - ItemType: firstElemType, - } - } - - // then, bools... - probablyString := false - if hint == 't' || hint == 'f' { - // maybe a bool - if nextTok := subScanner.Scan(); nextTok == sc.Ident { - switch subScanner.TokenText() { - case "true", "false": - // definitely a bool - return &Argument{Type: BoolType} - } - // probably a string - probablyString = true - } else { - // we shouldn't ever get here - scanner.Error(scanner, fmt.Sprintf("got a token (%q) that looked like an ident, but was not", scanner.TokenText())) - return &Argument{Type: InvalidType} - } - } - - // then, integers... - if !probablyString { - nextTok := subScanner.Scan() - if nextTok == '-' { - nextTok = subScanner.Scan() - } - - if nextTok == sc.Int { - return &Argument{Type: IntType} - } - if nextTok == sc.Float { - return &Argument{Type: NumberType} - } - } - - // otherwise assume bare strings - return &Argument{Type: StringType} -} - -// parseString parses either of the two accepted string forms (quoted, or bare tokens). -func (a *Argument) parseString(scanner *sc.Scanner, raw string, out reflect.Value) { - // strings are a bit weird -- the "easy" case is quoted strings (tokenized as strings), - // the "hard" case (present for backwards compat) is a bare sequence of tokens that aren't - // a comma. - tok := scanner.Scan() - if tok == sc.String || tok == sc.RawString { - // the easy case - val, err := strconv.Unquote(scanner.TokenText()) - if err != nil { - scanner.Error(scanner, fmt.Sprintf("unable to parse string: %v", err)) - return - } - castAndSet(out, reflect.ValueOf(val)) - return - } - - // the "hard" case -- bare tokens not including ',' (the argument - // separator), ';' (the slice separator), ':' (the map separator), or '}' - // (delimitted slice ender) - startPos := scanner.Position.Offset - for hint := peekNoSpace(scanner); hint != ',' && hint != ';' && hint != ':' && hint != '}' && hint != sc.EOF; hint = peekNoSpace(scanner) { - // skip this token - scanner.Scan() - } - endPos := scanner.Position.Offset + len(scanner.TokenText()) - castAndSet(out, reflect.ValueOf(raw[startPos:endPos])) -} - -// parseSlice parses either of the two slice forms (curly-brace-delimitted and semicolon-separated). -func (a *Argument) parseSlice(scanner *sc.Scanner, raw string, out reflect.Value) { - // slices have two supported formats, like string: - // - `{val, val, val}` (preferred) - // - `val;val;val` (legacy) - resSlice := reflect.Zero(out.Type()) - elem := reflect.Indirect(reflect.New(out.Type().Elem())) - - // preferred case - if peekNoSpace(scanner) == '{' { - // NB(directxman12): supporting delimitted slices in bare slices - // would require an extra look-ahead here :-/ - - scanner.Scan() // skip '{' - for hint := peekNoSpace(scanner); hint != '}' && hint != sc.EOF; hint = peekNoSpace(scanner) { - a.ItemType.parse(scanner, raw, elem, true /* parsing a slice */) - resSlice = reflect.Append(resSlice, elem) - tok := peekNoSpace(scanner) - if tok == '}' { - break - } - if !expect(scanner, ',', "comma") { - return - } - } - if !expect(scanner, '}', "close curly brace") { - return - } - castAndSet(out, resSlice) - return - } - - // legacy case - for hint := peekNoSpace(scanner); hint != ',' && hint != '}' && hint != sc.EOF; hint = peekNoSpace(scanner) { - a.ItemType.parse(scanner, raw, elem, true /* parsing a slice */) - resSlice = reflect.Append(resSlice, elem) - tok := peekNoSpace(scanner) - if tok == ',' || tok == '}' || tok == sc.EOF { - break - } - scanner.Scan() - if tok != ';' { - scanner.Error(scanner, fmt.Sprintf("expected comma, got %q", scanner.TokenText())) - return - } - } - castAndSet(out, resSlice) -} - -// parseMap parses a map of the form {string: val, string: val, string: val} -func (a *Argument) parseMap(scanner *sc.Scanner, raw string, out reflect.Value) { - resMap := reflect.MakeMap(out.Type()) - elem := reflect.Indirect(reflect.New(out.Type().Elem())) - key := reflect.Indirect(reflect.New(out.Type().Key())) - - if !expect(scanner, '{', "open curly brace") { - return - } - - for hint := peekNoSpace(scanner); hint != '}' && hint != sc.EOF; hint = peekNoSpace(scanner) { - a.parseString(scanner, raw, key) - if !expect(scanner, ':', "colon") { - return - } - a.ItemType.parse(scanner, raw, elem, false /* not in a slice */) - resMap.SetMapIndex(key, elem) - - if peekNoSpace(scanner) == '}' { - break - } - if !expect(scanner, ',', "comma") { - return - } - } - - if !expect(scanner, '}', "close curly brace") { - return - } - - castAndSet(out, resMap) -} - -// parse functions like Parse, except that it allows passing down whether or not we're -// already in a slice, to avoid duplicate legacy slice detection for AnyType -func (a *Argument) parse(scanner *sc.Scanner, raw string, out reflect.Value, inSlice bool) { - // nolint:gocyclo - if a.Type == InvalidType { - scanner.Error(scanner, "cannot parse invalid type") - return - } - if a.Pointer { - out.Set(reflect.New(out.Type().Elem())) - out = reflect.Indirect(out) - } - switch a.Type { - case RawType: - // raw consumes everything else - castAndSet(out, reflect.ValueOf(raw[scanner.Pos().Offset:])) - // consume everything else - for tok := scanner.Scan(); tok != sc.EOF; tok = scanner.Scan() { - } - case NumberType: - nextChar := scanner.Peek() - isNegative := false - if nextChar == '-' { - isNegative = true - scanner.Scan() // eat the '-' - } - - tok := scanner.Scan() - if tok != sc.Float && tok != sc.Int { - scanner.Error(scanner, fmt.Sprintf("expected integer or float, got %q", scanner.TokenText())) - return - } - - text := scanner.TokenText() - if isNegative { - text = "-" + text - } - - val, err := strconv.ParseFloat(text, 64) - if err != nil { - scanner.Error(scanner, fmt.Sprintf("unable to parse number: %v", err)) - return - } - - castAndSet(out, reflect.ValueOf(val)) - case IntType: - nextChar := scanner.Peek() - isNegative := false - if nextChar == '-' { - isNegative = true - scanner.Scan() // eat the '-' - } - if !expect(scanner, sc.Int, "integer") { - return - } - // TODO(directxman12): respect the size when parsing - text := scanner.TokenText() - if isNegative { - text = "-" + text - } - val, err := strconv.Atoi(text) - if err != nil { - scanner.Error(scanner, fmt.Sprintf("unable to parse integer: %v", err)) - return - } - castAndSet(out, reflect.ValueOf(val)) - case StringType: - // strings are a bit weird -- the "easy" case is quoted strings (tokenized as strings), - // the "hard" case (present for backwards compat) is a bare sequence of tokens that aren't - // a comma. - a.parseString(scanner, raw, out) - case BoolType: - if !expect(scanner, sc.Ident, "true or false") { - return - } - switch scanner.TokenText() { - case "true": - castAndSet(out, reflect.ValueOf(true)) - case "false": - castAndSet(out, reflect.ValueOf(false)) - default: - scanner.Error(scanner, fmt.Sprintf("expected true or false, got %q", scanner.TokenText())) - return - } - case AnyType: - guessedType := guessType(scanner, raw, !inSlice) - newOut := out - - // we need to be able to construct the right element types, below - // in parse, so construct a concretely-typed value to use as "out" - switch guessedType.Type { - case SliceType: - newType, err := makeSliceType(*guessedType.ItemType) - if err != nil { - scanner.Error(scanner, err.Error()) - return - } - newOut = reflect.Indirect(reflect.New(newType)) - case MapType: - newType, err := makeMapType(*guessedType.ItemType) - if err != nil { - scanner.Error(scanner, err.Error()) - return - } - newOut = reflect.Indirect(reflect.New(newType)) - } - if !newOut.CanSet() { - panic("at the disco") // TODO(directxman12): this is left over from debugging -- it might need to be an error - } - guessedType.Parse(scanner, raw, newOut) - castAndSet(out, newOut) - case SliceType: - // slices have two supported formats, like string: - // - `{val, val, val}` (preferred) - // - `val;val;val` (legacy) - a.parseSlice(scanner, raw, out) - case MapType: - // maps are {string: val, string: val, string: val} - a.parseMap(scanner, raw, out) - } -} - -// Parse attempts to consume the argument from the given scanner (based on the given -// raw input as well for collecting ranges of content), and places the output value -// in the given reflect.Value. Errors are reported via the given scanner. -func (a *Argument) Parse(scanner *sc.Scanner, raw string, out reflect.Value) { - a.parse(scanner, raw, out, false) -} - -// ArgumentFromType constructs an Argument by examining the given -// raw reflect.Type. It can construct arguments from the Go types -// corresponding to any of the types listed in ArgumentType. -func ArgumentFromType(rawType reflect.Type) (Argument, error) { - if rawType == rawArgsType { - return Argument{ - Type: RawType, - }, nil - } - - if rawType == interfaceType { - return Argument{ - Type: AnyType, - }, nil - } - - arg := Argument{} - if rawType.Kind() == reflect.Ptr { - rawType = rawType.Elem() - arg.Pointer = true - arg.Optional = true - } - - switch rawType.Kind() { - case reflect.String: - arg.Type = StringType - case reflect.Int, reflect.Int32: // NB(directxman12): all ints in kubernetes are int32, so explicitly support that - arg.Type = IntType - case reflect.Float64: - arg.Type = NumberType - case reflect.Bool: - arg.Type = BoolType - case reflect.Slice: - arg.Type = SliceType - itemType, err := ArgumentFromType(rawType.Elem()) - if err != nil { - return Argument{}, fmt.Errorf("bad slice item type: %w", err) - } - arg.ItemType = &itemType - case reflect.Map: - arg.Type = MapType - if rawType.Key().Kind() != reflect.String { - return Argument{}, fmt.Errorf("bad map key type: map keys must be strings") - } - itemType, err := ArgumentFromType(rawType.Elem()) - if err != nil { - return Argument{}, fmt.Errorf("bad slice item type: %w", err) - } - arg.ItemType = &itemType - default: - return Argument{}, fmt.Errorf("type has unsupported kind %s", rawType.Kind()) - } - - return arg, nil -} - -// TargetType describes which kind of node a given marker is associated with. -type TargetType int - -const ( - // DescribesPackage indicates that a marker is associated with a package. - DescribesPackage TargetType = iota - // DescribesType indicates that a marker is associated with a type declaration. - DescribesType - // DescribesField indicates that a marker is associated with a struct field. - DescribesField -) - -func (t TargetType) String() string { - switch t { - case DescribesPackage: - return "package" - case DescribesType: - return "type" - case DescribesField: - return "field" - default: - return "(unknown)" - } -} - -// Definition is a parsed definition of a marker. -type Definition struct { - // Output is the deserialized Go type of the marker. - Output reflect.Type - // Name is the marker's name. - Name string - // Target indicates which kind of node this marker can be associated with. - Target TargetType - // Fields lists out the types of each field that this marker has, by - // argument name as used in the marker (if the output type isn't a struct, - // it'll have a single, blank field name). This only lists exported fields, - // (as per reflection rules). - Fields map[string]Argument - // FieldNames maps argument names (as used in the marker) to struct field name - // in the output type. - FieldNames map[string]string - // Strict indicates that this definition should error out when parsing if - // not all non-optional fields were seen. - Strict bool -} - -// AnonymousField indicates that the definition has one field, -// (actually the original object), and thus the field -// doesn't get named as part of the name. -func (d *Definition) AnonymousField() bool { - if len(d.Fields) != 1 { - return false - } - _, hasAnonField := d.Fields[""] - return hasAnonField -} - -// Empty indicates that this definition has no fields. -func (d *Definition) Empty() bool { - return len(d.Fields) == 0 -} - -// argumentInfo returns information about an argument field as the marker parser's field loader -// would see it. This can be useful if you have to interact with marker definition structs -// externally (e.g. at compile time). -func argumentInfo(fieldName string, tag reflect.StructTag) (argName string, optionalOpt bool) { - argName = lowerCamelCase(fieldName) - markerTag, tagSpecified := tag.Lookup("marker") - markerTagParts := strings.Split(markerTag, ",") - if tagSpecified && markerTagParts[0] != "" { - // allow overriding to support legacy cases where we don't follow camelCase conventions - argName = markerTagParts[0] - } - optionalOpt = false - for _, tagOption := range markerTagParts[1:] { - switch tagOption { - case "optional": - optionalOpt = true - } - } - - return argName, optionalOpt -} - -// loadFields uses reflection to populate argument information from the Output type. -func (d *Definition) loadFields() error { - if d.Fields == nil { - d.Fields = make(map[string]Argument) - d.FieldNames = make(map[string]string) - } - if d.Output.Kind() != reflect.Struct { - // anonymous field type - argType, err := ArgumentFromType(d.Output) - if err != nil { - return err - } - d.Fields[""] = argType - d.FieldNames[""] = "" - return nil - } - - for i := 0; i < d.Output.NumField(); i++ { - field := d.Output.Field(i) - if field.PkgPath != "" { - // as per the reflect package docs, pkgpath is empty for exported fields, - // so non-empty package path means a private field, which we should skip - continue - } - argName, optionalOpt := argumentInfo(field.Name, field.Tag) - - argType, err := ArgumentFromType(field.Type) - if err != nil { - return fmt.Errorf("unable to extract type information for field %q: %w", field.Name, err) - } - - if argType.Type == RawType { - return fmt.Errorf("RawArguments must be the direct type of a marker, and not a field") - } - - argType.Optional = optionalOpt || argType.Optional - - d.Fields[argName] = argType - d.FieldNames[argName] = field.Name - } - - return nil -} - -// parserScanner makes a new scanner appropriate for use in parsing definitions and arguments. -func parserScanner(raw string, err func(*sc.Scanner, string)) *sc.Scanner { - scanner := &sc.Scanner{} - scanner.Init(bytes.NewBufferString(raw)) - scanner.Mode = sc.ScanIdents | sc.ScanInts | sc.ScanFloats | sc.ScanStrings | sc.ScanRawStrings | sc.SkipComments - scanner.Error = err - - return scanner -} - -// Parse uses the type information in this Definition to parse the given -// raw marker in the form `+a:b:c=arg,d=arg` into an output object of the -// type specified in the definition. -func (d *Definition) Parse(rawMarker string) (interface{}, error) { - name, anonName, fields := splitMarker(rawMarker) - - out := reflect.Indirect(reflect.New(d.Output)) - - // if we're a not a struct or have no arguments, treat the full `a:b:c` as the name, - // otherwise, treat `c` as a field name, and `a:b` as the marker name. - if !d.AnonymousField() && !d.Empty() && len(anonName) >= len(name)+1 { - fields = anonName[len(name)+1:] + "=" + fields - } - - var errs []error - scanner := parserScanner(fields, func(scanner *sc.Scanner, msg string) { - errs = append(errs, &ScannerError{Msg: msg, Pos: scanner.Position}) - }) - - // TODO(directxman12): strict parsing where we error out if certain fields aren't optional - seen := make(map[string]struct{}, len(d.Fields)) - if d.AnonymousField() && scanner.Peek() != sc.EOF { - // might still be a struct that something fiddled with, so double check - structFieldName := d.FieldNames[""] - outTarget := out - if structFieldName != "" { - // it's a struct field mapped to an anonymous marker - outTarget = out.FieldByName(structFieldName) - if !outTarget.CanSet() { - scanner.Error(scanner, fmt.Sprintf("cannot set field %q (might not exist)", structFieldName)) - return out.Interface(), loader.MaybeErrList(errs) - } - } - - // no need for trying to parse field names if we're not a struct - field := d.Fields[""] - field.Parse(scanner, fields, outTarget) - seen[""] = struct{}{} // mark as seen for strict definitions - } else if !d.Empty() && scanner.Peek() != sc.EOF { - // if we expect *and* actually have arguments passed - for { - // parse the argument name - if !expect(scanner, sc.Ident, "argument name") { - break - } - argName := scanner.TokenText() - if !expect(scanner, '=', "equals") { - break - } - - // make sure we know the field - fieldName, known := d.FieldNames[argName] - if !known { - scanner.Error(scanner, fmt.Sprintf("unknown argument %q", argName)) - break - } - fieldType, known := d.Fields[argName] - if !known { - scanner.Error(scanner, fmt.Sprintf("unknown argument %q", argName)) - break - } - seen[argName] = struct{}{} // mark as seen for strict definitions - - // parse the field value - fieldVal := out.FieldByName(fieldName) - if !fieldVal.CanSet() { - scanner.Error(scanner, fmt.Sprintf("cannot set field %q (might not exist)", fieldName)) - break - } - fieldType.Parse(scanner, fields, fieldVal) - - if len(errs) > 0 { - break - } - - if scanner.Peek() == sc.EOF { - break - } - if !expect(scanner, ',', "comma") { - break - } - } - } - - if tok := scanner.Scan(); tok != sc.EOF { - scanner.Error(scanner, fmt.Sprintf("extra arguments provided: %q", fields[scanner.Position.Offset:])) - } - - if d.Strict { - for argName, arg := range d.Fields { - if _, wasSeen := seen[argName]; !wasSeen && !arg.Optional { - scanner.Error(scanner, fmt.Sprintf("missing argument %q", argName)) - } - } - } - - return out.Interface(), loader.MaybeErrList(errs) -} - -// MakeDefinition constructs a definition from a name, type, and the output type. -// All such definitions are strict by default. If a struct is passed as the output -// type, its public fields will automatically be populated into Fields (and similar -// fields in Definition). Other values will have a single, empty-string-named Fields -// entry. -func MakeDefinition(name string, target TargetType, output interface{}) (*Definition, error) { - def := &Definition{ - Name: name, - Target: target, - Output: reflect.TypeOf(output), - Strict: true, - } - - if err := def.loadFields(); err != nil { - return nil, err - } - - return def, nil -} - -// MakeAnyTypeDefinition constructs a definition for an output struct with a -// field named `Value` of type `interface{}`. The argument to the marker will -// be parsed as AnyType and assigned to the field named `Value`. -func MakeAnyTypeDefinition(name string, target TargetType, output interface{}) (*Definition, error) { - defn, err := MakeDefinition(name, target, output) - if err != nil { - return nil, err - } - defn.FieldNames = map[string]string{"": "Value"} - defn.Fields = map[string]Argument{"": defn.Fields["value"]} - return defn, nil -} - -// splitMarker takes a marker in the form of `+a:b:c=arg,d=arg` and splits it -// into the name (`a:b`), the name if it's not a struct (`a:b:c`), and the parts -// that are definitely fields (`arg,d=arg`). -func splitMarker(raw string) (name string, anonymousName string, restFields string) { - raw = raw[1:] // get rid of the leading '+' - nameFieldParts := strings.SplitN(raw, "=", 2) - if len(nameFieldParts) == 1 { - return nameFieldParts[0], nameFieldParts[0], "" - } - anonymousName = nameFieldParts[0] - name = anonymousName - restFields = nameFieldParts[1] - - nameParts := strings.Split(name, ":") - if len(nameParts) > 1 { - name = strings.Join(nameParts[:len(nameParts)-1], ":") - } - return name, anonymousName, restFields -} - -type ScannerError struct { - Msg string - Pos sc.Position -} - -func (e *ScannerError) Error() string { - return fmt.Sprintf("%s (at %s)", e.Msg, e.Pos) -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/markers/reg.go b/vendor/sigs.k8s.io/controller-tools/pkg/markers/reg.go deleted file mode 100644 index b0124630f86..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/markers/reg.go +++ /dev/null @@ -1,153 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 markers - -import ( - "fmt" - "sync" -) - -// Registry keeps track of registered definitions, and allows for easy lookup. -// It's thread-safe, and the zero-value can be safely used. -type Registry struct { - forPkg map[string]*Definition - forType map[string]*Definition - forField map[string]*Definition - helpFor map[*Definition]*DefinitionHelp - - mu sync.RWMutex - initOnce sync.Once -} - -func (r *Registry) init() { - r.initOnce.Do(func() { - if r.forPkg == nil { - r.forPkg = make(map[string]*Definition) - } - if r.forType == nil { - r.forType = make(map[string]*Definition) - } - if r.forField == nil { - r.forField = make(map[string]*Definition) - } - if r.helpFor == nil { - r.helpFor = make(map[*Definition]*DefinitionHelp) - } - }) -} - -// Define defines a new marker with the given name, target, and output type. -// It's a shortcut around -// r.Register(MakeDefinition(name, target, obj)) -func (r *Registry) Define(name string, target TargetType, obj interface{}) error { - def, err := MakeDefinition(name, target, obj) - if err != nil { - return err - } - return r.Register(def) -} - -// Register registers the given marker definition with this registry for later lookup. -func (r *Registry) Register(def *Definition) error { - r.init() - - r.mu.Lock() - defer r.mu.Unlock() - - switch def.Target { - case DescribesPackage: - r.forPkg[def.Name] = def - case DescribesType: - r.forType[def.Name] = def - case DescribesField: - r.forField[def.Name] = def - default: - return fmt.Errorf("unknown target type %v", def.Target) - } - return nil -} - -// AddHelp stores the given help in the registry, marking it as associated with -// the given definition. -func (r *Registry) AddHelp(def *Definition, help *DefinitionHelp) { - r.init() - - r.mu.Lock() - defer r.mu.Unlock() - - r.helpFor[def] = help -} - -// Lookup fetches the definition corresponding to the given name and target type. -func (r *Registry) Lookup(name string, target TargetType) *Definition { - r.init() - - r.mu.RLock() - defer r.mu.RUnlock() - - switch target { - case DescribesPackage: - return tryAnonLookup(name, r.forPkg) - case DescribesType: - return tryAnonLookup(name, r.forType) - case DescribesField: - return tryAnonLookup(name, r.forField) - default: - return nil - } -} - -// HelpFor fetches the help for a given definition, if present. -func (r *Registry) HelpFor(def *Definition) *DefinitionHelp { - r.init() - - r.mu.RLock() - defer r.mu.RUnlock() - - return r.helpFor[def] -} - -// AllDefinitions returns all marker definitions known to this registry. -func (r *Registry) AllDefinitions() []*Definition { - res := make([]*Definition, 0, len(r.forPkg)+len(r.forType)+len(r.forField)) - for _, def := range r.forPkg { - res = append(res, def) - } - for _, def := range r.forType { - res = append(res, def) - } - for _, def := range r.forField { - res = append(res, def) - } - return res -} - -// tryAnonLookup tries looking up the given marker as both an struct-based -// marker and an anonymous marker, returning whichever format matches first, -// preferring the longer (anonymous) name in case of conflicts. -func tryAnonLookup(name string, defs map[string]*Definition) *Definition { - // NB(directxman12): we look up anonymous names first to work with - // legacy style marker definitions that have a namespaced approach - // (e.g. deepcopy-gen, which uses `+k8s:deepcopy-gen=foo,bar` *and* - // `+k8s.io:deepcopy-gen:interfaces=foo`). - name, anonName, _ := splitMarker(name) - if def, exists := defs[anonName]; exists { - return def - } - - return defs[name] -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/markers/regutil.go b/vendor/sigs.k8s.io/controller-tools/pkg/markers/regutil.go deleted file mode 100644 index a9160c3c2f1..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/markers/regutil.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 markers - -// Must panics on errors creating definitions. -func Must(def *Definition, err error) *Definition { - if err != nil { - panic(err) - } - return def -} - -// RegisterAll attempts to register all definitions against the given registry, -// stopping and returning if an error occurs. -func RegisterAll(reg *Registry, defs ...*Definition) error { - for _, def := range defs { - if err := reg.Register(def); err != nil { - return err - } - } - return nil -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/markers/zip.go b/vendor/sigs.k8s.io/controller-tools/pkg/markers/zip.go deleted file mode 100644 index 0ef1fb133ba..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/markers/zip.go +++ /dev/null @@ -1,201 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 markers - -import ( - "go/ast" - "go/token" - "reflect" - "strings" - - "sigs.k8s.io/controller-tools/pkg/loader" -) - -// extractDoc extracts documentation from the given node, skipping markers -// in the godoc and falling back to the decl if necessary (for single-line decls). -func extractDoc(node ast.Node, decl *ast.GenDecl) string { - var docs *ast.CommentGroup - switch docced := node.(type) { - case *ast.Field: - docs = docced.Doc - case *ast.File: - docs = docced.Doc - case *ast.GenDecl: - docs = docced.Doc - case *ast.TypeSpec: - docs = docced.Doc - // type Ident expr expressions get docs attached to the decl, - // so check for that case (missing Lparen == single line type decl) - if docs == nil && decl.Lparen == token.NoPos { - docs = decl.Doc - } - } - - if docs == nil { - return "" - } - - // filter out markers - var outGroup ast.CommentGroup - outGroup.List = make([]*ast.Comment, 0, len(docs.List)) - for _, comment := range docs.List { - if isMarkerComment(comment.Text) { - continue - } - outGroup.List = append(outGroup.List, comment) - } - - // split lines, and re-join together as a single - // paragraph, respecting double-newlines as - // paragraph markers. - outLines := strings.Split(outGroup.Text(), "\n") - if outLines[len(outLines)-1] == "" { - // chop off the extraneous last part - outLines = outLines[:len(outLines)-1] - } - - for i, line := range outLines { - // Trim any extranous whitespace, - // for handling /*…*/-style comments, - // which have whitespace preserved in go/ast: - line = strings.TrimSpace(line) - - // Respect that double-newline means - // actual newline: - if line == "" { - outLines[i] = "\n" - } else { - outLines[i] = line - } - } - - return strings.Join(outLines, " ") -} - -// PackageMarkers collects all the package-level marker values for the given package. -func PackageMarkers(col *Collector, pkg *loader.Package) (MarkerValues, error) { - markers, err := col.MarkersInPackage(pkg) - if err != nil { - return nil, err - } - res := make(MarkerValues) - for _, file := range pkg.Syntax { - fileMarkers := markers[file] - for name, vals := range fileMarkers { - res[name] = append(res[name], vals...) - } - } - - return res, nil -} - -// FieldInfo contains marker values and commonly used information for a struct field. -type FieldInfo struct { - // Name is the name of the field (or "" for embedded fields) - Name string - // Doc is the Godoc of the field, pre-processed to remove markers and joine - // single newlines together. - Doc string - // Tag struct tag associated with this field (or "" if non existed). - Tag reflect.StructTag - - // Markers are all registered markers associated with this field. - Markers MarkerValues - - // RawField is the raw, underlying field AST object that this field represents. - RawField *ast.Field -} - -// TypeInfo contains marker values and commonly used information for a type declaration. -type TypeInfo struct { - // Name is the name of the type. - Name string - // Doc is the Godoc of the type, pre-processed to remove markers and joine - // single newlines together. - Doc string - - // Markers are all registered markers associated with the type. - Markers MarkerValues - - // Fields are all the fields associated with the type, if it's a struct. - // (if not, Fields will be nil). - Fields []FieldInfo - - // RawDecl contains the raw GenDecl that the type was declared as part of. - RawDecl *ast.GenDecl - // RawSpec contains the raw Spec that declared this type. - RawSpec *ast.TypeSpec - // RawFile contains the file in which this type was declared. - RawFile *ast.File -} - -// TypeCallback is a callback called for each type declaration in a package. -type TypeCallback func(info *TypeInfo) - -// EachType collects all markers, then calls the given callback for each type declaration in a package. -// Each individual spec is considered separate, so -// -// type ( -// Foo string -// Bar int -// Baz struct{} -// ) -// -// yields three calls to the callback. -func EachType(col *Collector, pkg *loader.Package, cb TypeCallback) error { - markers, err := col.MarkersInPackage(pkg) - if err != nil { - return err - } - - loader.EachType(pkg, func(file *ast.File, decl *ast.GenDecl, spec *ast.TypeSpec) { - var fields []FieldInfo - if structSpec, isStruct := spec.Type.(*ast.StructType); isStruct { - for _, field := range structSpec.Fields.List { - for _, name := range field.Names { - fields = append(fields, FieldInfo{ - Name: name.Name, - Doc: extractDoc(field, nil), - Tag: loader.ParseAstTag(field.Tag), - Markers: markers[field], - RawField: field, - }) - } - if field.Names == nil { - fields = append(fields, FieldInfo{ - Doc: extractDoc(field, nil), - Tag: loader.ParseAstTag(field.Tag), - Markers: markers[field], - RawField: field, - }) - } - } - } - - cb(&TypeInfo{ - Name: spec.Name.Name, - Markers: markers[spec], - Doc: extractDoc(spec, decl), - Fields: fields, - RawDecl: decl, - RawSpec: spec, - RawFile: file, - }) - }) - - return nil -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/rbac/parser.go b/vendor/sigs.k8s.io/controller-tools/pkg/rbac/parser.go deleted file mode 100644 index 3bbf11fd458..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/rbac/parser.go +++ /dev/null @@ -1,267 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 rbac contain libraries for generating RBAC manifests from RBAC -// markers in Go source files. -// -// The markers take the form: -// -// +kubebuilder:rbac:groups=,resources=,resourceNames=,verbs=,urls= -package rbac - -import ( - "fmt" - "sort" - "strings" - - rbacv1 "k8s.io/api/rbac/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "sigs.k8s.io/controller-tools/pkg/genall" - "sigs.k8s.io/controller-tools/pkg/markers" -) - -var ( - // RuleDefinition is a marker for defining RBAC rules. - // Call ToRule on the value to get a Kubernetes RBAC policy rule. - RuleDefinition = markers.Must(markers.MakeDefinition("kubebuilder:rbac", markers.DescribesPackage, Rule{})) -) - -// +controllertools:marker:generateHelp:category=RBAC - -// Rule specifies an RBAC rule to all access to some resources or non-resource URLs. -type Rule struct { - // Groups specifies the API groups that this rule encompasses. - Groups []string `marker:",optional"` - // Resources specifies the API resources that this rule encompasses. - Resources []string `marker:",optional"` - // ResourceNames specifies the names of the API resources that this rule encompasses. - // - // Create requests cannot be restricted by resourcename, as the object's name - // is not known at authorization time. - ResourceNames []string `marker:",optional"` - // Verbs specifies the (lowercase) kubernetes API verbs that this rule encompasses. - Verbs []string - // URL specifies the non-resource URLs that this rule encompasses. - URLs []string `marker:"urls,optional"` - // Namespace specifies the scope of the Rule. - // If not set, the Rule belongs to the generated ClusterRole. - // If set, the Rule belongs to a Role, whose namespace is specified by this field. - Namespace string `marker:",optional"` -} - -// ruleKey represents the resources and non-resources a Rule applies. -type ruleKey struct { - Groups string - Resources string - ResourceNames string - URLs string -} - -func (key ruleKey) String() string { - return fmt.Sprintf("%s + %s + %s + %s", key.Groups, key.Resources, key.ResourceNames, key.URLs) -} - -// ruleKeys implements sort.Interface -type ruleKeys []ruleKey - -func (keys ruleKeys) Len() int { return len(keys) } -func (keys ruleKeys) Swap(i, j int) { keys[i], keys[j] = keys[j], keys[i] } -func (keys ruleKeys) Less(i, j int) bool { return keys[i].String() < keys[j].String() } - -// key normalizes the Rule and returns a ruleKey object. -func (r *Rule) key() ruleKey { - r.normalize() - return ruleKey{ - Groups: strings.Join(r.Groups, "&"), - Resources: strings.Join(r.Resources, "&"), - ResourceNames: strings.Join(r.ResourceNames, "&"), - URLs: strings.Join(r.URLs, "&"), - } -} - -// addVerbs adds new verbs into a Rule. -// The duplicates in `r.Verbs` will be removed, and then `r.Verbs` will be sorted. -func (r *Rule) addVerbs(verbs []string) { - r.Verbs = removeDupAndSort(append(r.Verbs, verbs...)) -} - -// normalize removes duplicates from each field of a Rule, and sorts each field. -func (r *Rule) normalize() { - r.Groups = removeDupAndSort(r.Groups) - r.Resources = removeDupAndSort(r.Resources) - r.ResourceNames = removeDupAndSort(r.ResourceNames) - r.Verbs = removeDupAndSort(r.Verbs) - r.URLs = removeDupAndSort(r.URLs) -} - -// removeDupAndSort removes duplicates in strs, sorts the items, and returns a -// new slice of strings. -func removeDupAndSort(strs []string) []string { - set := make(map[string]bool) - for _, str := range strs { - if _, ok := set[str]; !ok { - set[str] = true - } - } - - var result []string - for str := range set { - result = append(result, str) - } - sort.Strings(result) - return result -} - -// ToRule converts this rule to its Kubernetes API form. -func (r *Rule) ToRule() rbacv1.PolicyRule { - // fix the group names first, since letting people type "core" is nice - for i, group := range r.Groups { - if group == "core" { - r.Groups[i] = "" - } - } - return rbacv1.PolicyRule{ - APIGroups: r.Groups, - Verbs: r.Verbs, - Resources: r.Resources, - ResourceNames: r.ResourceNames, - NonResourceURLs: r.URLs, - } -} - -// +controllertools:marker:generateHelp - -// Generator generates ClusterRole objects. -type Generator struct { - // RoleName sets the name of the generated ClusterRole. - RoleName string -} - -func (Generator) RegisterMarkers(into *markers.Registry) error { - if err := into.Register(RuleDefinition); err != nil { - return err - } - into.AddHelp(RuleDefinition, Rule{}.Help()) - return nil -} - -// GenerateRoles generate a slice of objs representing either a ClusterRole or a Role object -// The order of the objs in the returned slice is stable and determined by their namespaces. -func GenerateRoles(ctx *genall.GenerationContext, roleName string) ([]interface{}, error) { - rulesByNS := make(map[string][]*Rule) - for _, root := range ctx.Roots { - markerSet, err := markers.PackageMarkers(ctx.Collector, root) - if err != nil { - root.AddError(err) - } - - // group RBAC markers by namespace - for _, markerValue := range markerSet[RuleDefinition.Name] { - rule := markerValue.(Rule) - namespace := rule.Namespace - if _, ok := rulesByNS[namespace]; !ok { - rules := make([]*Rule, 0) - rulesByNS[namespace] = rules - } - rulesByNS[namespace] = append(rulesByNS[namespace], &rule) - } - } - - // NormalizeRules merge Rule with the same ruleKey and sort the Rules - NormalizeRules := func(rules []*Rule) []rbacv1.PolicyRule { - ruleMap := make(map[ruleKey]*Rule) - // all the Rules having the same ruleKey will be merged into the first Rule - for _, rule := range rules { - key := rule.key() - if _, ok := ruleMap[key]; !ok { - ruleMap[key] = rule - continue - } - ruleMap[key].addVerbs(rule.Verbs) - } - - // sort the Rules in rules according to their ruleKeys - keys := make([]ruleKey, 0, len(ruleMap)) - for key := range ruleMap { - keys = append(keys, key) - } - sort.Sort(ruleKeys(keys)) - - var policyRules []rbacv1.PolicyRule - for _, key := range keys { - policyRules = append(policyRules, ruleMap[key].ToRule()) - - } - return policyRules - } - - // collect all the namespaces and sort them - var namespaces []string - for ns := range rulesByNS { - namespaces = append(namespaces, ns) - } - sort.Strings(namespaces) - - // process the items in rulesByNS by the order specified in `namespaces` to make sure that the Role order is stable - var objs []interface{} - for _, ns := range namespaces { - rules := rulesByNS[ns] - policyRules := NormalizeRules(rules) - if len(policyRules) == 0 { - continue - } - if ns == "" { - objs = append(objs, rbacv1.ClusterRole{ - TypeMeta: metav1.TypeMeta{ - Kind: "ClusterRole", - APIVersion: rbacv1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: roleName, - }, - Rules: policyRules, - }) - } else { - objs = append(objs, rbacv1.Role{ - TypeMeta: metav1.TypeMeta{ - Kind: "Role", - APIVersion: rbacv1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: roleName, - Namespace: ns, - }, - Rules: policyRules, - }) - } - } - - return objs, nil -} - -func (g Generator) Generate(ctx *genall.GenerationContext) error { - objs, err := GenerateRoles(ctx, g.RoleName) - if err != nil { - return err - } - - if len(objs) == 0 { - return nil - } - - return ctx.WriteYAML("role.yaml", objs) -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/rbac/zz_generated.markerhelp.go b/vendor/sigs.k8s.io/controller-tools/pkg/rbac/zz_generated.markerhelp.go deleted file mode 100644 index 0e2083a23d1..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/rbac/zz_generated.markerhelp.go +++ /dev/null @@ -1,78 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright2019 The Kubernetes 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. -*/ - -// Code generated by helpgen. DO NOT EDIT. - -package rbac - -import ( - "sigs.k8s.io/controller-tools/pkg/markers" -) - -func (Generator) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "", - DetailedHelp: markers.DetailedHelp{ - Summary: "generates ClusterRole objects.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{ - "RoleName": { - Summary: "sets the name of the generated ClusterRole.", - Details: "", - }, - }, - } -} - -func (Rule) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "RBAC", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies an RBAC rule to all access to some resources or non-resource URLs.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{ - "Groups": { - Summary: "specifies the API groups that this rule encompasses.", - Details: "", - }, - "Resources": { - Summary: "specifies the API resources that this rule encompasses.", - Details: "", - }, - "ResourceNames": { - Summary: "specifies the names of the API resources that this rule encompasses. ", - Details: "Create requests cannot be restricted by resourcename, as the object's name is not known at authorization time.", - }, - "Verbs": { - Summary: "specifies the (lowercase) kubernetes API verbs that this rule encompasses.", - Details: "", - }, - "URLs": { - Summary: "URL specifies the non-resource URLs that this rule encompasses.", - Details: "", - }, - "Namespace": { - Summary: "specifies the scope of the Rule. If not set, the Rule belongs to the generated ClusterRole. If set, the Rule belongs to a Role, whose namespace is specified by this field.", - Details: "", - }, - }, - } -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/gen.go b/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/gen.go deleted file mode 100644 index 6aec36ca6eb..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/gen.go +++ /dev/null @@ -1,429 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 schemapatcher - -import ( - "fmt" - "io/ioutil" - "path/filepath" - - "gopkg.in/yaml.v3" - apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - "k8s.io/apimachinery/pkg/api/equality" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - kyaml "sigs.k8s.io/yaml" - - crdgen "sigs.k8s.io/controller-tools/pkg/crd" - crdmarkers "sigs.k8s.io/controller-tools/pkg/crd/markers" - "sigs.k8s.io/controller-tools/pkg/genall" - "sigs.k8s.io/controller-tools/pkg/loader" - "sigs.k8s.io/controller-tools/pkg/markers" - yamlop "sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml" -) - -// NB(directxman12): this code is quite fragile, but there are a sufficient -// number of corner cases that it's hard to decompose into separate tools. -// When in doubt, ping @sttts. -// -// Namely: -// - It needs to only update existing versions -// - It needs to make "stable" changes that don't mess with map key ordering -// (in order to facilitate validating that no change has occurred) -// - It needs to collapse identical schema versions into a top-level schema, -// if all versions are identical (this is a common requirement to all CRDs, -// but in this case it means simple jsonpatch wouldn't suffice) - -// TODO(directxman12): When CRD v1 rolls around, consider splitting this into a -// tool that generates a patch, and a separate tool for applying stable YAML -// patches. - -var ( - currentAPIExtVersion = apiext.SchemeGroupVersion.String() -) - -// +controllertools:marker:generateHelp - -// Generator patches existing CRDs with new schemata. -// -// It will generate output for each "CRD Version" (API version of the CRD type -// itself) , e.g. apiextensions/v1) available. -type Generator struct { - // ManifestsPath contains the CustomResourceDefinition YAML files. - ManifestsPath string `marker:"manifests"` - - // MaxDescLen specifies the maximum description length for fields in CRD's OpenAPI schema. - // - // 0 indicates drop the description for all fields completely. - // n indicates limit the description to at most n characters and truncate the description to - // closest sentence boundary if it exceeds n characters. - MaxDescLen *int `marker:",optional"` - - // GenerateEmbeddedObjectMeta specifies if any embedded ObjectMeta in the CRD should be generated - GenerateEmbeddedObjectMeta *bool `marker:",optional"` -} - -var _ genall.Generator = &Generator{} - -func (Generator) CheckFilter() loader.NodeFilter { - return crdgen.Generator{}.CheckFilter() -} - -func (Generator) RegisterMarkers(into *markers.Registry) error { - return crdmarkers.Register(into) -} - -func (g Generator) Generate(ctx *genall.GenerationContext) (result error) { - parser := &crdgen.Parser{ - Collector: ctx.Collector, - Checker: ctx.Checker, - // Indicates the parser on whether to register the ObjectMeta type or not - GenerateEmbeddedObjectMeta: g.GenerateEmbeddedObjectMeta != nil && *g.GenerateEmbeddedObjectMeta == true, - } - - crdgen.AddKnownTypes(parser) - for _, root := range ctx.Roots { - parser.NeedPackage(root) - } - - metav1Pkg := crdgen.FindMetav1(ctx.Roots) - if metav1Pkg == nil { - // no objects in the roots, since nothing imported metav1 - return nil - } - - // load existing CRD manifests with group-kind and versions - partialCRDSets, err := crdsFromDirectory(ctx, g.ManifestsPath) - if err != nil { - return err - } - - // generate schemata for the types we care about, and save them to be written later. - for groupKind := range crdgen.FindKubeKinds(parser, metav1Pkg) { - existingSet, wanted := partialCRDSets[groupKind] - if !wanted { - continue - } - - for pkg, gv := range parser.GroupVersions { - if gv.Group != groupKind.Group { - continue - } - if _, wantedVersion := existingSet.Versions[gv.Version]; !wantedVersion { - continue - } - - typeIdent := crdgen.TypeIdent{Package: pkg, Name: groupKind.Kind} - parser.NeedFlattenedSchemaFor(typeIdent) - - fullSchema := parser.FlattenedSchemata[typeIdent] - if g.MaxDescLen != nil { - fullSchema = *fullSchema.DeepCopy() - crdgen.TruncateDescription(&fullSchema, *g.MaxDescLen) - } - - // Fix top level ObjectMeta regardless of the settings. - if _, ok := fullSchema.Properties["metadata"]; ok { - fullSchema.Properties["metadata"] = apiext.JSONSchemaProps{Type: "object"} - } - - existingSet.NewSchemata[gv.Version] = fullSchema - } - } - - // patch existing CRDs with new schemata - for _, existingSet := range partialCRDSets { - // first, figure out if we need to merge schemata together if they're *all* - // identical (meaning we also don't have any "unset" versions) - - if len(existingSet.NewSchemata) == 0 { - continue - } - - // copy over the new versions that we have, keeping old versions so - // that we can tell if a schema would be nil - var someVer string - for ver := range existingSet.NewSchemata { - someVer = ver - existingSet.Versions[ver] = struct{}{} - } - - allSame := true - firstSchema := existingSet.NewSchemata[someVer] - for ver := range existingSet.Versions { - otherSchema, hasSchema := existingSet.NewSchemata[ver] - if !hasSchema || !equality.Semantic.DeepEqual(firstSchema, otherSchema) { - allSame = false - break - } - } - - if allSame { - if err := existingSet.setGlobalSchema(); err != nil { - return fmt.Errorf("failed to set global firstSchema for %s: %w", existingSet.GroupKind, err) - } - } else { - if err := existingSet.setVersionedSchemata(); err != nil { - return fmt.Errorf("failed to set versioned schemas for %s: %w", existingSet.GroupKind, err) - } - } - } - - // write the final result out to the new location - for _, set := range partialCRDSets { - // We assume all CRD versions came from different files, since this - // is how controller-gen works. If they came from the same file, - // it'd be non-sensical, since you couldn't reasonably use kubectl - // with them against older servers. - for _, crd := range set.CRDVersions { - if err := func() error { - outWriter, err := ctx.OutputRule.Open(nil, crd.FileName) - if err != nil { - return err - } - defer outWriter.Close() - - enc := yaml.NewEncoder(outWriter) - // yaml.v2 defaults to indent=2, yaml.v3 defaults to indent=4, - // so be compatible with everything else in k8s and choose 2. - enc.SetIndent(2) - - return enc.Encode(crd.Yaml) - }(); err != nil { - return err - } - } - } - - return nil -} - -// partialCRDSet represents a set of CRDs of different apiext versions -// (v1beta1.CRD vs v1.CRD) that represent the same GroupKind. -// -// It tracks modifications to the schemata of those CRDs from this source file, -// plus some useful structured content, and keeps track of the raw YAML representation -// of the different apiext versions. -type partialCRDSet struct { - // GroupKind is the GroupKind represented by this CRD. - GroupKind schema.GroupKind - // NewSchemata are the new schemata generated from Go IDL by controller-gen. - NewSchemata map[string]apiext.JSONSchemaProps - // CRDVersions are the forms of this CRD across different apiextensions - // versions - CRDVersions []*partialCRD - // Versions are the versions of the given GroupKind in this set of CRDs. - Versions map[string]struct{} -} - -// partialCRD represents the raw YAML encoding of a given CRD instance, plus -// the versions contained therein for easy lookup. -type partialCRD struct { - // Yaml is the raw YAML structure of the CRD. - Yaml *yaml.Node - // FileName is the source name of the file that this was read from. - // - // This isn't on partialCRDSet because we could have different CRD versions - // stored in the same file (like controller-tools does by default) or in - // different files. - FileName string - - // CRDVersion is the version of the CRD object itself, from - // apiextensions (currently apiextensions/v1 or apiextensions/v1beta1). - CRDVersion string -} - -// setGlobalSchema sets the versioned schemas (as per setVersionedSchemata). -func (e *partialCRDSet) setGlobalSchema() error { - for _, crdInfo := range e.CRDVersions { - if err := crdInfo.setVersionedSchemata(e.NewSchemata); err != nil { - return err - } - } - return nil -} - -// getVersionsNode gets the YAML node of .spec.versions YAML mapping, -// if returning the node, and whether or not it was present. -func (e *partialCRD) getVersionsNode() (*yaml.Node, bool, error) { - versions, found, err := yamlop.GetNode(e.Yaml, "spec", "versions") - if err != nil { - return nil, false, err - } - if !found { - return nil, false, nil - } - if versions.Kind != yaml.SequenceNode { - return nil, true, fmt.Errorf("unexpected non-sequence versions") - } - return versions, found, nil -} - -// setVersionedSchemata sets the versioned schemata on each encoding in this set as per -// setVersionedSchemata on partialCRD. -func (e *partialCRDSet) setVersionedSchemata() error { - for _, crdInfo := range e.CRDVersions { - if err := crdInfo.setVersionedSchemata(e.NewSchemata); err != nil { - return err - } - } - return nil -} - -// setVersionedSchemata populates all existing versions with new schemata, -// wiping the schema of any version that doesn't have a listed schema. -// Any "unknown" versions are ignored. -func (e *partialCRD) setVersionedSchemata(newSchemata map[string]apiext.JSONSchemaProps) error { - var err error - if err := yamlop.DeleteNode(e.Yaml, "spec", "validation"); err != nil { - return err - } - - versions, found, err := e.getVersionsNode() - if err != nil { - return err - } - if !found { - return fmt.Errorf("unexpected missing versions") - } - - for i, verNode := range versions.Content { - nameNode, _, _ := yamlop.GetNode(verNode, "name") - if nameNode.Kind != yaml.ScalarNode || nameNode.ShortTag() != "!!str" { - return fmt.Errorf("version name was not a string at spec.versions[%d]", i) - } - name := nameNode.Value - if name == "" { - return fmt.Errorf("unexpected empty name at spec.versions[%d]", i) - } - newSchema, found := newSchemata[name] - if !found { - if err := yamlop.DeleteNode(verNode, "schema"); err != nil { - return fmt.Errorf("spec.versions[%d]: %w", i, err) - } - } else { - schemaNodeTree, err := yamlop.ToYAML(newSchema) - if err != nil { - return fmt.Errorf("failed to convert schema to YAML: %w", err) - } - schemaNodeTree = schemaNodeTree.Content[0] // get rid of the document node - yamlop.SetStyle(schemaNodeTree, 0) // clear the style so it defaults to an auto-chosen one - if err := yamlop.SetNode(verNode, *schemaNodeTree, "schema", "openAPIV3Schema"); err != nil { - return fmt.Errorf("spec.versions[%d]: %w", i, err) - } - } - } - return nil -} - -// crdsFromDirectory returns loads all CRDs from the given directory in a -// manner that preserves ordering, comments, etc in order to make patching -// minimally invasive. Returned CRDs are mapped by group-kind. -func crdsFromDirectory(ctx *genall.GenerationContext, dir string) (map[schema.GroupKind]*partialCRDSet, error) { - res := map[schema.GroupKind]*partialCRDSet{} - dirEntries, err := ioutil.ReadDir(dir) - if err != nil { - return nil, err - } - for _, fileInfo := range dirEntries { - // find all files that are YAML - if fileInfo.IsDir() || filepath.Ext(fileInfo.Name()) != ".yaml" { - continue - } - - rawContent, err := ctx.ReadFile(filepath.Join(dir, fileInfo.Name())) - if err != nil { - return nil, err - } - - // NB(directxman12): we could use the universal deserializer for this, but it's - // really pretty clunky, and the alternative is actually kinda easier to understand - - // ensure that this is a CRD - var typeMeta metav1.TypeMeta - if err := kyaml.Unmarshal(rawContent, &typeMeta); err != nil { - continue - } - if !isSupportedAPIExtGroupVer(typeMeta.APIVersion) { - return nil, fmt.Errorf("load %q: apiVersion %q not supported", filepath.Join(dir, fileInfo.Name()), typeMeta.APIVersion) - } - if typeMeta.Kind != "CustomResourceDefinition" { - continue - } - - // collect the group-kind and versions from the actual structured form - var actualCRD crdIsh - if err := kyaml.Unmarshal(rawContent, &actualCRD); err != nil { - continue - } - groupKind := schema.GroupKind{Group: actualCRD.Spec.Group, Kind: actualCRD.Spec.Names.Kind} - versions := make(map[string]struct{}, len(actualCRD.Spec.Versions)) - for _, ver := range actualCRD.Spec.Versions { - versions[ver.Name] = struct{}{} - } - - // then actually unmarshal in a manner that preserves ordering, etc - var yamlNodeTree yaml.Node - if err := yaml.Unmarshal(rawContent, &yamlNodeTree); err != nil { - continue - } - - // then store this CRDVersion of the CRD in a set, populating the set if necessary - if res[groupKind] == nil { - res[groupKind] = &partialCRDSet{ - GroupKind: groupKind, - NewSchemata: make(map[string]apiext.JSONSchemaProps), - Versions: make(map[string]struct{}), - } - } - for ver := range versions { - res[groupKind].Versions[ver] = struct{}{} - } - res[groupKind].CRDVersions = append(res[groupKind].CRDVersions, &partialCRD{ - Yaml: &yamlNodeTree, - FileName: fileInfo.Name(), - CRDVersion: typeMeta.APIVersion, - }) - } - return res, nil -} - -// isSupportedAPIExtGroupVer checks if the given string-form group-version -// is one of the known apiextensions versions (v1). -func isSupportedAPIExtGroupVer(groupVer string) bool { - return groupVer == currentAPIExtVersion -} - -// crdIsh is a merged blob of CRD fields that looks enough like all versions of -// CRD to extract the relevant information for partialCRDSet and partialCRD. -// -// We keep this separate so it's clear what info we need, and so we don't break -// when we switch canonical internal versions and lose old fields while gaining -// new ones (like in v1beta1 --> v1). -// -// Its use is tied directly to crdsFromDirectory, and is mostly an implementation detail of that. -type crdIsh struct { - Spec struct { - Group string `json:"group"` - Names struct { - Kind string `json:"kind"` - } `json:"names"` - Versions []struct { - Name string `json:"name"` - } `json:"versions"` - } `json:"spec"` -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml/convert.go b/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml/convert.go deleted file mode 100644 index b0ac001580e..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml/convert.go +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 yaml - -import ( - "encoding/json" - "fmt" - - "gopkg.in/yaml.v3" -) - -// ToYAML converts some object that serializes to JSON into a YAML node tree. -// It's useful since it pays attention to JSON tags, unlike yaml.Unmarshal or -// yaml.Node.Decode. -func ToYAML(rawObj interface{}) (*yaml.Node, error) { - if rawObj == nil { - return &yaml.Node{Kind: yaml.ScalarNode, Value: "null", Tag: "!!null"}, nil - } - - rawJSON, err := json.Marshal(rawObj) - if err != nil { - return nil, fmt.Errorf("failed to marshal object: %w", err) - } - - var out yaml.Node - if err := yaml.Unmarshal(rawJSON, &out); err != nil { - return nil, fmt.Errorf("unable to unmarshal marshalled object: %w", err) - } - return &out, nil -} - -// changeAll calls the given callback for all nodes in -// the given YAML node tree. -func changeAll(root *yaml.Node, cb func(*yaml.Node)) { - cb(root) - for _, child := range root.Content { - changeAll(child, cb) - } -} - -// SetStyle sets the style for all nodes in the given -// node tree to the given style. -func SetStyle(root *yaml.Node, style yaml.Style) { - changeAll(root, func(node *yaml.Node) { - node.Style = style - }) -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml/nested.go b/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml/nested.go deleted file mode 100644 index 70d43dbeb33..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml/nested.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 yaml - -import ( - "fmt" - - "gopkg.in/yaml.v3" -) - -// ValueInMapping finds the value node with the corresponding string key -// in the given mapping node. If the given node is not a mapping, an -// error will be returned. -func ValueInMapping(root *yaml.Node, key string) (*yaml.Node, error) { - if root.Kind != yaml.MappingNode { - return nil, fmt.Errorf("unexpected non-mapping node") - } - - for i := 0; i < len(root.Content)/2; i++ { - keyNode := root.Content[i*2] - if keyNode.Value == key { - return root.Content[i*2+1], nil - } - } - return nil, nil -} - -// asCloseAsPossible goes as deep on the given path as possible, returning the -// last node that existed from the given path in the given tree of mapping -// nodes, as well as the rest of the path that could not be fetched, if any. -func asCloseAsPossible(root *yaml.Node, path ...string) (*yaml.Node, []string, error) { - if root == nil { - return nil, path, nil - } - if root.Kind == yaml.DocumentNode && len(root.Content) > 0 { - root = root.Content[0] - } - - currNode := root - for ; len(path) > 0; path = path[1:] { - if currNode.Kind != yaml.MappingNode { - return nil, nil, fmt.Errorf("unexpected non-mapping (%v) before path %v", currNode.Kind, path) - } - - nextNode, err := ValueInMapping(currNode, path[0]) - if err != nil { - return nil, nil, fmt.Errorf("unable to get next node in path %v: %w", path, err) - } - - if nextNode == nil { - // we're as close as possible - break - } - - currNode = nextNode - } - - return currNode, path, nil -} - -// GetNode gets the node at the given path in the given sequence of mapping -// nodes, or, if it doesn't exist, returning false. -func GetNode(root *yaml.Node, path ...string) (*yaml.Node, bool, error) { - resNode, restPath, err := asCloseAsPossible(root, path...) - if err != nil { - return nil, false, err - } - // more path means the node didn't exist - if len(restPath) != 0 { - return nil, false, nil - } - return resNode, true, nil -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml/set.go b/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml/set.go deleted file mode 100644 index ede417f1cf2..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml/set.go +++ /dev/null @@ -1,80 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 yaml - -import ( - "fmt" - - "gopkg.in/yaml.v3" -) - -// SetNode sets the given path to the given yaml Node, creating mapping nodes along the way. -func SetNode(root *yaml.Node, val yaml.Node, path ...string) error { - currNode, path, err := asCloseAsPossible(root, path...) - if err != nil { - return err - } - - if len(path) > 0 { - if currNode.Kind != yaml.MappingNode { - return fmt.Errorf("unexpected non-mapping before path %v", path) - } - - for ; len(path) > 0; path = path[1:] { - keyNode := yaml.Node{Kind: yaml.ScalarNode, Tag: "!!str", Style: yaml.DoubleQuotedStyle, Value: path[0]} - nextNode := &yaml.Node{Kind: yaml.MappingNode} - currNode.Content = append(currNode.Content, &keyNode, nextNode) - - currNode = nextNode - } - } - - *currNode = val - return nil -} - -// DeleteNode deletes the node at the given path in the given tree of mapping nodes. -// It's a noop if the path doesn't exist. -func DeleteNode(root *yaml.Node, path ...string) error { - if len(path) == 0 { - return fmt.Errorf("must specify a path to delete") - } - pathToParent, keyToDelete := path[:len(path)-1], path[len(path)-1] - parentNode, path, err := asCloseAsPossible(root, pathToParent...) - if err != nil { - return err - } - if len(path) > 0 { - // no-op, parent node doesn't exist - return nil - } - - if parentNode.Kind != yaml.MappingNode { - return fmt.Errorf("unexpected non-mapping node") - } - - for i := 0; i < len(parentNode.Content)/2; i++ { - keyNode := parentNode.Content[i*2] - if keyNode.Value == keyToDelete { - parentNode.Content = append(parentNode.Content[:i*2], parentNode.Content[i*2+2:]...) - return nil - } - } - - // no-op, key not found in parent node - return nil -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/zz_generated.markerhelp.go b/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/zz_generated.markerhelp.go deleted file mode 100644 index db9745d767a..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/zz_generated.markerhelp.go +++ /dev/null @@ -1,50 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright2019 The Kubernetes 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. -*/ - -// Code generated by helpgen. DO NOT EDIT. - -package schemapatcher - -import ( - "sigs.k8s.io/controller-tools/pkg/markers" -) - -func (Generator) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "", - DetailedHelp: markers.DetailedHelp{ - Summary: "patches existing CRDs with new schemata. ", - Details: "It will generate output for each \"CRD Version\" (API version of the CRD type itself) , e.g. apiextensions/v1) available.", - }, - FieldHelp: map[string]markers.DetailedHelp{ - "ManifestsPath": { - Summary: "contains the CustomResourceDefinition YAML files.", - Details: "", - }, - "MaxDescLen": { - Summary: "specifies the maximum description length for fields in CRD's OpenAPI schema. ", - Details: "0 indicates drop the description for all fields completely. n indicates limit the description to at most n characters and truncate the description to closest sentence boundary if it exceeds n characters.", - }, - "GenerateEmbeddedObjectMeta": { - Summary: "specifies if any embedded ObjectMeta in the CRD should be generated", - Details: "", - }, - }, - } -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/version/version.go b/vendor/sigs.k8s.io/controller-tools/pkg/version/version.go deleted file mode 100644 index 99f383c2e31..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/version/version.go +++ /dev/null @@ -1,49 +0,0 @@ -/* -Copyright 2019 The Kubernetes 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 version - -import ( - "fmt" - "runtime/debug" -) - -// Version returns the version of the main module -func Version() string { - info, ok := debug.ReadBuildInfo() - if !ok || info == nil || info.Main.Version == "" { - // binary has not been built with module support or doesn't contain a version. - return "(unknown)" - } - return info.Main.Version -} - -// Print prints the main module version on stdout. -// -// Print will display either: -// -// - "Version: v0.2.1" when the program has been compiled with: -// -// $ go get github.com/controller-tools/cmd/controller-gen@v0.2.1 -// -// Note: go modules requires the usage of semver compatible tags starting with -// 'v' to have nice human-readable versions. -// -// - "Version: (devel)" when the program is compiled from a local git checkout. -// -// - "Version: (unknown)" when not using go modules. -func Print() { - fmt.Printf("Version: %s\n", Version()) -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/webhook/parser.go b/vendor/sigs.k8s.io/controller-tools/pkg/webhook/parser.go deleted file mode 100644 index 392acfc7764..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/webhook/parser.go +++ /dev/null @@ -1,408 +0,0 @@ -/* -Copyright 2018 The Kubernetes 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 webhook contains libraries for generating webhookconfig manifests -// from markers in Go source files. -// -// The markers take the form: -// -// +kubebuilder:webhook:webhookVersions=<[]string>,failurePolicy=,matchPolicy=,groups=<[]string>,resources=<[]string>,verbs=<[]string>,versions=<[]string>,name=,path=,mutating=,sideEffects=,admissionReviewVersions=<[]string> -package webhook - -import ( - "fmt" - "strings" - - admissionregv1 "k8s.io/api/admissionregistration/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/sets" - - "sigs.k8s.io/controller-tools/pkg/genall" - "sigs.k8s.io/controller-tools/pkg/markers" -) - -// The default {Mutating,Validating}WebhookConfiguration version to generate. -const ( - v1 = "v1" - defaultWebhookVersion = v1 -) - -var ( - // ConfigDefinition s a marker for defining Webhook manifests. - // Call ToWebhook on the value to get a Kubernetes Webhook. - ConfigDefinition = markers.Must(markers.MakeDefinition("kubebuilder:webhook", markers.DescribesPackage, Config{})) -) - -// supportedWebhookVersions returns currently supported API version of {Mutating,Validating}WebhookConfiguration. -func supportedWebhookVersions() []string { - return []string{defaultWebhookVersion} -} - -// +controllertools:marker:generateHelp:category=Webhook - -// Config specifies how a webhook should be served. -// -// It specifies only the details that are intrinsic to the application serving -// it (e.g. the resources it can handle, or the path it serves on). -type Config struct { - // Mutating marks this as a mutating webhook (it's validating only if false) - // - // Mutating webhooks are allowed to change the object in their response, - // and are called *before* all validating webhooks. Mutating webhooks may - // choose to reject an object, similarly to a validating webhook. - Mutating bool - // FailurePolicy specifies what should happen if the API server cannot reach the webhook. - // - // It may be either "ignore" (to skip the webhook and continue on) or "fail" (to reject - // the object in question). - FailurePolicy string - // MatchPolicy defines how the "rules" list is used to match incoming requests. - // Allowed values are "Exact" (match only if it exactly matches the specified rule) - // or "Equivalent" (match a request if it modifies a resource listed in rules, even via another API group or version). - MatchPolicy string `marker:",optional"` - // SideEffects specify whether calling the webhook will have side effects. - // This has an impact on dry runs and `kubectl diff`: if the sideEffect is "Unknown" (the default) or "Some", then - // the API server will not call the webhook on a dry-run request and fails instead. - // If the value is "None", then the webhook has no side effects and the API server will call it on dry-run. - // If the value is "NoneOnDryRun", then the webhook is responsible for inspecting the "dryRun" property of the - // AdmissionReview sent in the request, and avoiding side effects if that value is "true." - SideEffects string `marker:",optional"` - - // Groups specifies the API groups that this webhook receives requests for. - Groups []string - // Resources specifies the API resources that this webhook receives requests for. - Resources []string - // Verbs specifies the Kubernetes API verbs that this webhook receives requests for. - // - // Only modification-like verbs may be specified. - // May be "create", "update", "delete", "connect", or "*" (for all). - Verbs []string - // Versions specifies the API versions that this webhook receives requests for. - Versions []string - - // Name indicates the name of this webhook configuration. Should be a domain with at least three segments separated by dots - Name string - - // Path specifies that path that the API server should connect to this webhook on. Must be - // prefixed with a '/validate-' or '/mutate-' depending on the type, and followed by - // $GROUP-$VERSION-$KIND where all values are lower-cased and the periods in the group - // are substituted for hyphens. For example, a validating webhook path for type - // batch.tutorial.kubebuilder.io/v1,Kind=CronJob would be - // /validate-batch-tutorial-kubebuilder-io-v1-cronjob - Path string - - // WebhookVersions specifies the target API versions of the {Mutating,Validating}WebhookConfiguration objects - // itself to generate. The only supported value is v1. Defaults to v1. - WebhookVersions []string `marker:"webhookVersions,optional"` - - // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` - // versions the Webhook expects. - AdmissionReviewVersions []string `marker:"admissionReviewVersions"` -} - -// verbToAPIVariant converts a marker's verb to the proper value for the API. -// Unrecognized verbs are passed through. -func verbToAPIVariant(verbRaw string) admissionregv1.OperationType { - switch strings.ToLower(verbRaw) { - case strings.ToLower(string(admissionregv1.Create)): - return admissionregv1.Create - case strings.ToLower(string(admissionregv1.Update)): - return admissionregv1.Update - case strings.ToLower(string(admissionregv1.Delete)): - return admissionregv1.Delete - case strings.ToLower(string(admissionregv1.Connect)): - return admissionregv1.Connect - case strings.ToLower(string(admissionregv1.OperationAll)): - return admissionregv1.OperationAll - default: - return admissionregv1.OperationType(verbRaw) - } -} - -// ToMutatingWebhook converts this rule to its Kubernetes API form. -func (c Config) ToMutatingWebhook() (admissionregv1.MutatingWebhook, error) { - if !c.Mutating { - return admissionregv1.MutatingWebhook{}, fmt.Errorf("%s is a validating webhook", c.Name) - } - - matchPolicy, err := c.matchPolicy() - if err != nil { - return admissionregv1.MutatingWebhook{}, err - } - - return admissionregv1.MutatingWebhook{ - Name: c.Name, - Rules: c.rules(), - FailurePolicy: c.failurePolicy(), - MatchPolicy: matchPolicy, - ClientConfig: c.clientConfig(), - SideEffects: c.sideEffects(), - AdmissionReviewVersions: c.AdmissionReviewVersions, - }, nil -} - -// ToValidatingWebhook converts this rule to its Kubernetes API form. -func (c Config) ToValidatingWebhook() (admissionregv1.ValidatingWebhook, error) { - if c.Mutating { - return admissionregv1.ValidatingWebhook{}, fmt.Errorf("%s is a mutating webhook", c.Name) - } - - matchPolicy, err := c.matchPolicy() - if err != nil { - return admissionregv1.ValidatingWebhook{}, err - } - - return admissionregv1.ValidatingWebhook{ - Name: c.Name, - Rules: c.rules(), - FailurePolicy: c.failurePolicy(), - MatchPolicy: matchPolicy, - ClientConfig: c.clientConfig(), - SideEffects: c.sideEffects(), - AdmissionReviewVersions: c.AdmissionReviewVersions, - }, nil -} - -// rules returns the configuration of what operations on what -// resources/subresources a webhook should care about. -func (c Config) rules() []admissionregv1.RuleWithOperations { - whConfig := admissionregv1.RuleWithOperations{ - Rule: admissionregv1.Rule{ - APIGroups: c.Groups, - APIVersions: c.Versions, - Resources: c.Resources, - }, - Operations: make([]admissionregv1.OperationType, len(c.Verbs)), - } - - for i, verbRaw := range c.Verbs { - whConfig.Operations[i] = verbToAPIVariant(verbRaw) - } - - // fix the group names, since letting people type "core" is nice - for i, group := range whConfig.APIGroups { - if group == "core" { - whConfig.APIGroups[i] = "" - } - } - - return []admissionregv1.RuleWithOperations{whConfig} -} - -// failurePolicy converts the string value to the proper value for the API. -// Unrecognized values are passed through. -func (c Config) failurePolicy() *admissionregv1.FailurePolicyType { - var failurePolicy admissionregv1.FailurePolicyType - switch strings.ToLower(c.FailurePolicy) { - case strings.ToLower(string(admissionregv1.Ignore)): - failurePolicy = admissionregv1.Ignore - case strings.ToLower(string(admissionregv1.Fail)): - failurePolicy = admissionregv1.Fail - default: - failurePolicy = admissionregv1.FailurePolicyType(c.FailurePolicy) - } - return &failurePolicy -} - -// matchPolicy converts the string value to the proper value for the API. -func (c Config) matchPolicy() (*admissionregv1.MatchPolicyType, error) { - var matchPolicy admissionregv1.MatchPolicyType - switch strings.ToLower(c.MatchPolicy) { - case strings.ToLower(string(admissionregv1.Exact)): - matchPolicy = admissionregv1.Exact - case strings.ToLower(string(admissionregv1.Equivalent)): - matchPolicy = admissionregv1.Equivalent - case "": - return nil, nil - default: - return nil, fmt.Errorf("unknown value %q for matchPolicy", c.MatchPolicy) - } - return &matchPolicy, nil -} - -// clientConfig returns the client config for a webhook. -func (c Config) clientConfig() admissionregv1.WebhookClientConfig { - path := c.Path - return admissionregv1.WebhookClientConfig{ - Service: &admissionregv1.ServiceReference{ - Name: "webhook-service", - Namespace: "system", - Path: &path, - }, - } -} - -// sideEffects returns the sideEffects config for a webhook. -func (c Config) sideEffects() *admissionregv1.SideEffectClass { - var sideEffects admissionregv1.SideEffectClass - switch strings.ToLower(c.SideEffects) { - case strings.ToLower(string(admissionregv1.SideEffectClassNone)): - sideEffects = admissionregv1.SideEffectClassNone - case strings.ToLower(string(admissionregv1.SideEffectClassNoneOnDryRun)): - sideEffects = admissionregv1.SideEffectClassNoneOnDryRun - case strings.ToLower(string(admissionregv1.SideEffectClassSome)): - sideEffects = admissionregv1.SideEffectClassSome - case "": - return nil - default: - return nil - } - return &sideEffects -} - -// webhookVersions returns the target API versions of the {Mutating,Validating}WebhookConfiguration objects for a webhook. -func (c Config) webhookVersions() ([]string, error) { - // If WebhookVersions is not specified, we default it to `v1`. - if len(c.WebhookVersions) == 0 { - return []string{defaultWebhookVersion}, nil - } - supportedWebhookVersions := sets.NewString(supportedWebhookVersions()...) - for _, version := range c.WebhookVersions { - if !supportedWebhookVersions.Has(version) { - return nil, fmt.Errorf("unsupported webhook version: %s", version) - } - } - return sets.NewString(c.WebhookVersions...).UnsortedList(), nil -} - -// +controllertools:marker:generateHelp - -// Generator generates (partial) {Mutating,Validating}WebhookConfiguration objects. -type Generator struct{} - -func (Generator) RegisterMarkers(into *markers.Registry) error { - if err := into.Register(ConfigDefinition); err != nil { - return err - } - into.AddHelp(ConfigDefinition, Config{}.Help()) - return nil -} - -func (Generator) Generate(ctx *genall.GenerationContext) error { - supportedWebhookVersions := supportedWebhookVersions() - mutatingCfgs := make(map[string][]admissionregv1.MutatingWebhook, len(supportedWebhookVersions)) - validatingCfgs := make(map[string][]admissionregv1.ValidatingWebhook, len(supportedWebhookVersions)) - for _, root := range ctx.Roots { - markerSet, err := markers.PackageMarkers(ctx.Collector, root) - if err != nil { - root.AddError(err) - } - - for _, cfg := range markerSet[ConfigDefinition.Name] { - cfg := cfg.(Config) - webhookVersions, err := cfg.webhookVersions() - if err != nil { - return err - } - if cfg.Mutating { - w, err := cfg.ToMutatingWebhook() - if err != nil { - return err - } - for _, webhookVersion := range webhookVersions { - mutatingCfgs[webhookVersion] = append(mutatingCfgs[webhookVersion], w) - } - } else { - w, err := cfg.ToValidatingWebhook() - if err != nil { - return err - } - for _, webhookVersion := range webhookVersions { - validatingCfgs[webhookVersion] = append(validatingCfgs[webhookVersion], w) - } - } - } - } - - versionedWebhooks := make(map[string][]interface{}, len(supportedWebhookVersions)) - for _, version := range supportedWebhookVersions { - if cfgs, ok := mutatingCfgs[version]; ok { - // The only possible version in supportedWebhookVersions is v1, - // so use it for all versioned types in this context. - objRaw := &admissionregv1.MutatingWebhookConfiguration{} - objRaw.SetGroupVersionKind(schema.GroupVersionKind{ - Group: admissionregv1.SchemeGroupVersion.Group, - Version: version, - Kind: "MutatingWebhookConfiguration", - }) - objRaw.SetName("mutating-webhook-configuration") - objRaw.Webhooks = cfgs - for i := range objRaw.Webhooks { - // SideEffects is required in admissionregistration/v1, if this is not set or set to `Some` or `Known`, - // return an error - if err := checkSideEffectsForV1(objRaw.Webhooks[i].SideEffects); err != nil { - return err - } - // AdmissionReviewVersions is required in admissionregistration/v1, if this is not set, - // return an error - if len(objRaw.Webhooks[i].AdmissionReviewVersions) == 0 { - return fmt.Errorf("AdmissionReviewVersions is mandatory for v1 {Mutating,Validating}WebhookConfiguration") - } - } - versionedWebhooks[version] = append(versionedWebhooks[version], objRaw) - } - - if cfgs, ok := validatingCfgs[version]; ok { - // The only possible version in supportedWebhookVersions is v1, - // so use it for all versioned types in this context. - objRaw := &admissionregv1.ValidatingWebhookConfiguration{} - objRaw.SetGroupVersionKind(schema.GroupVersionKind{ - Group: admissionregv1.SchemeGroupVersion.Group, - Version: version, - Kind: "ValidatingWebhookConfiguration", - }) - objRaw.SetName("validating-webhook-configuration") - objRaw.Webhooks = cfgs - for i := range objRaw.Webhooks { - // SideEffects is required in admissionregistration/v1, if this is not set or set to `Some` or `Known`, - // return an error - if err := checkSideEffectsForV1(objRaw.Webhooks[i].SideEffects); err != nil { - return err - } - // AdmissionReviewVersions is required in admissionregistration/v1, if this is not set, - // return an error - if len(objRaw.Webhooks[i].AdmissionReviewVersions) == 0 { - return fmt.Errorf("AdmissionReviewVersions is mandatory for v1 {Mutating,Validating}WebhookConfiguration") - } - } - versionedWebhooks[version] = append(versionedWebhooks[version], objRaw) - } - } - - for k, v := range versionedWebhooks { - var fileName string - if k == defaultWebhookVersion { - fileName = fmt.Sprintf("manifests.yaml") - } else { - fileName = fmt.Sprintf("manifests.%s.yaml", k) - } - if err := ctx.WriteYAML(fileName, v); err != nil { - return err - } - } - return nil -} - -func checkSideEffectsForV1(sideEffects *admissionregv1.SideEffectClass) error { - if sideEffects == nil { - return fmt.Errorf("SideEffects is required for creating v1 {Mutating,Validating}WebhookConfiguration") - } - if *sideEffects == admissionregv1.SideEffectClassUnknown || - *sideEffects == admissionregv1.SideEffectClassSome { - return fmt.Errorf("SideEffects should not be set to `Some` or `Unknown` for v1 {Mutating,Validating}WebhookConfiguration") - } - return nil -} diff --git a/vendor/sigs.k8s.io/controller-tools/pkg/webhook/zz_generated.markerhelp.go b/vendor/sigs.k8s.io/controller-tools/pkg/webhook/zz_generated.markerhelp.go deleted file mode 100644 index 2a34608e82f..00000000000 --- a/vendor/sigs.k8s.io/controller-tools/pkg/webhook/zz_generated.markerhelp.go +++ /dev/null @@ -1,97 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright2019 The Kubernetes 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. -*/ - -// Code generated by helpgen. DO NOT EDIT. - -package webhook - -import ( - "sigs.k8s.io/controller-tools/pkg/markers" -) - -func (Config) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "Webhook", - DetailedHelp: markers.DetailedHelp{ - Summary: "specifies how a webhook should be served. ", - Details: "It specifies only the details that are intrinsic to the application serving it (e.g. the resources it can handle, or the path it serves on).", - }, - FieldHelp: map[string]markers.DetailedHelp{ - "Mutating": { - Summary: "marks this as a mutating webhook (it's validating only if false) ", - Details: "Mutating webhooks are allowed to change the object in their response, and are called *before* all validating webhooks. Mutating webhooks may choose to reject an object, similarly to a validating webhook.", - }, - "FailurePolicy": { - Summary: "specifies what should happen if the API server cannot reach the webhook. ", - Details: "It may be either \"ignore\" (to skip the webhook and continue on) or \"fail\" (to reject the object in question).", - }, - "MatchPolicy": { - Summary: "defines how the \"rules\" list is used to match incoming requests. Allowed values are \"Exact\" (match only if it exactly matches the specified rule) or \"Equivalent\" (match a request if it modifies a resource listed in rules, even via another API group or version).", - Details: "", - }, - "SideEffects": { - Summary: "specify whether calling the webhook will have side effects. This has an impact on dry runs and `kubectl diff`: if the sideEffect is \"Unknown\" (the default) or \"Some\", then the API server will not call the webhook on a dry-run request and fails instead. If the value is \"None\", then the webhook has no side effects and the API server will call it on dry-run. If the value is \"NoneOnDryRun\", then the webhook is responsible for inspecting the \"dryRun\" property of the AdmissionReview sent in the request, and avoiding side effects if that value is \"true.\"", - Details: "", - }, - "Groups": { - Summary: "specifies the API groups that this webhook receives requests for.", - Details: "", - }, - "Resources": { - Summary: "specifies the API resources that this webhook receives requests for.", - Details: "", - }, - "Verbs": { - Summary: "specifies the Kubernetes API verbs that this webhook receives requests for. ", - Details: "Only modification-like verbs may be specified. May be \"create\", \"update\", \"delete\", \"connect\", or \"*\" (for all).", - }, - "Versions": { - Summary: "specifies the API versions that this webhook receives requests for.", - Details: "", - }, - "Name": { - Summary: "indicates the name of this webhook configuration. Should be a domain with at least three segments separated by dots", - Details: "", - }, - "Path": { - Summary: "specifies that path that the API server should connect to this webhook on. Must be prefixed with a '/validate-' or '/mutate-' depending on the type, and followed by $GROUP-$VERSION-$KIND where all values are lower-cased and the periods in the group are substituted for hyphens. For example, a validating webhook path for type batch.tutorial.kubebuilder.io/v1,Kind=CronJob would be /validate-batch-tutorial-kubebuilder-io-v1-cronjob", - Details: "", - }, - "WebhookVersions": { - Summary: "specifies the target API versions of the {Mutating,Validating}WebhookConfiguration objects itself to generate. The only supported value is v1. Defaults to v1.", - Details: "", - }, - "AdmissionReviewVersions": { - Summary: "is an ordered list of preferred `AdmissionReview` versions the Webhook expects.", - Details: "", - }, - }, - } -} - -func (Generator) Help() *markers.DefinitionHelp { - return &markers.DefinitionHelp{ - Category: "", - DetailedHelp: markers.DetailedHelp{ - Summary: "generates (partial) {Mutating,Validating}WebhookConfiguration objects.", - Details: "", - }, - FieldHelp: map[string]markers.DetailedHelp{}, - } -} From 9f60a87a0716612f00e3f5752daecf44b509be68 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Thu, 5 Sep 2024 12:12:14 +1000 Subject: [PATCH 3/3] fix --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 87c3429aaf0..708745b0426 100644 --- a/Makefile +++ b/Makefile @@ -342,8 +342,8 @@ vendor: xmlcov: $(GOCOV) $(GOCOV_XML) $(GOCOV) convert cover.out | $(GOCOV_XML) > coverage.xml -.PHONY: install-go-tools -install-go-tools: $(BINGO) +.PHONY: install-tools +install-tools: $(BINGO) $(BINGO) get -l ###############################################################################