From 8d6b9d6a43155059d5b6ef5380728348c8583010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20Suszy=C5=84ski?= Date: Wed, 7 Sep 2022 18:42:30 +0200 Subject: [PATCH 1/7] Source embedded hack scripts --- cmd/script/main.go | 31 +++++++++++++ cmd/script/main_test.go | 53 +++++++++++++++++++++++ hack.go => embed.go | 13 +++--- embed_test.go | 53 +++++++++++++++++++++++ go.mod | 16 +++++++ go.sum | 34 +++++++++++++++ go.work.sum | 58 +++++++++++++++++++++++++ script/cli/app.go | 42 ++++++++++++++++++ script/cli/flags.go | 15 +++++++ script/extract/errors.go | 21 +++++++++ script/extract/extract.go | 91 +++++++++++++++++++++++++++++++++++++++ script/extract/logger.go | 12 ++++++ 12 files changed, 432 insertions(+), 7 deletions(-) create mode 100644 cmd/script/main.go create mode 100644 cmd/script/main_test.go rename hack.go => embed.go (74%) create mode 100644 embed_test.go create mode 100644 go.work.sum create mode 100644 script/cli/app.go create mode 100644 script/cli/flags.go create mode 100644 script/extract/errors.go create mode 100644 script/extract/extract.go create mode 100644 script/extract/logger.go diff --git a/cmd/script/main.go b/cmd/script/main.go new file mode 100644 index 00000000..8fbd8134 --- /dev/null +++ b/cmd/script/main.go @@ -0,0 +1,31 @@ +/* +Copyright 2022 The Knative 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 + + https://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 ( + "github.com/wavesoftware/go-commandline" + "knative.dev/hack/script/cli" +) + +func main() { + commandline.New(new(cli.App)).ExecuteOrDie(cli.Options...) +} + +// RunMain is used by tests to run the main function. +func RunMain() { // nolint:deadcode + main() +} diff --git a/cmd/script/main_test.go b/cmd/script/main_test.go new file mode 100644 index 00000000..88a80098 --- /dev/null +++ b/cmd/script/main_test.go @@ -0,0 +1,53 @@ +/* +Copyright 2022 The Knative 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 + + https://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_test + +import ( + "bytes" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/wavesoftware/go-commandline" + main "knative.dev/hack/cmd/script" + "knative.dev/hack/script/cli" +) + +func TestMainFn(t *testing.T) { + var buf bytes.Buffer + var retcode *int + withOptions( + func() { + main.RunMain() + }, + commandline.WithArgs("--help"), + commandline.WithOutput(&buf), + commandline.WithExit(func(c int) { + retcode = &c + }), + ) + assert.Nil(t, retcode) + assert.Contains(t, buf.String(), "Script will extract Hack scripts") +} + +func withOptions(fn func(), options ...commandline.Option) { + prev := cli.Options + cli.Options = options + defer func(p []commandline.Option) { + cli.Options = p + }(prev) + fn() +} diff --git a/hack.go b/embed.go similarity index 74% rename from hack.go rename to embed.go index 25603fc6..4e39c21a 100644 --- a/hack.go +++ b/embed.go @@ -1,8 +1,5 @@ -//go:build hack -// +build hack - /* -Copyright 2020 The Knative Authors +Copyright 2022 The Knative Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,7 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -// package hack is a collection of scripts used to bootstrap CI processes and -// other vital entrypoint functionality. - package hack + +import "embed" + +//go:embed *.sh +var Scripts embed.FS diff --git a/embed_test.go b/embed_test.go new file mode 100644 index 00000000..9d305d87 --- /dev/null +++ b/embed_test.go @@ -0,0 +1,53 @@ +/* +Copyright 2022 The Knative 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 + + https://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 hack_test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "knative.dev/hack" +) + +func TestScriptsAreEmbedded(t *testing.T) { + entries, err := hack.Scripts.ReadDir(".") + require.NoError(t, err) + names := make([]string, 0, len(entries)) + for _, entry := range entries { + names = append(names, entry.Name()) + if !entry.IsDir() { + fi, err := entry.Info() + require.NoError(t, err) + assert.Greater(t, fi.Size(), int64(0)) + } + } + requiredLibs := []string{ + "codegen-library.sh", + "e2e-tests.sh", + "infra-library.sh", + "library.sh", + "microbenchmarks.sh", + "performance-tests.sh", + "presubmit-tests.sh", + "release.sh", + "shellcheck-presubmit.sh", + } + for _, lib := range requiredLibs { + assert.Contains(t, names, lib) + } +} diff --git a/go.mod b/go.mod index c3481aba..7713bec1 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,19 @@ module knative.dev/hack go 1.18 + +require ( + github.com/stretchr/testify v1.8.0 + github.com/wavesoftware/go-commandline v1.0.0 + k8s.io/apimachinery v0.25.0 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/spf13/cobra v1.5.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/wavesoftware/go-retcode v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum index e69de29b..9f8e522e 100644 --- a/go.sum +++ b/go.sum @@ -0,0 +1,34 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +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/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +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/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= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/wavesoftware/go-commandline v1.0.0 h1:n7nrFr1unfiUcF7shA1rYf+YhXB12pY8uNYqPgFsHio= +github.com/wavesoftware/go-commandline v1.0.0/go.mod h1:C9yRtwZxJSck99kk6SRRkOtC2ppQF/KDRy0yrzWJuHU= +github.com/wavesoftware/go-retcode v1.0.0 h1:Z53+VpIHMvRMtjS6jPScdihbAN1ks3lIJ5Mj32gCpno= +github.com/wavesoftware/go-retcode v1.0.0/go.mod h1:BLqIIXhB/PQ+izkkRGfSQgu95BDtMmUBuvTJ/gkSWVM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +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= +gotest.tools/v3 v3.3.0 h1:MfDY1b1/0xN1CyMlQDac0ziEy9zJQd9CXBRRDHw2jJo= +k8s.io/apimachinery v0.25.0 h1:MlP0r6+3XbkUG2itd6vp3oxbtdQLQI94fD5gCS+gnoU= +k8s.io/apimachinery v0.25.0/go.mod h1:qMx9eAk0sZQGsXGu86fab8tZdffHbwUfsvzqKn4mfB0= diff --git a/go.work.sum b/go.work.sum new file mode 100644 index 00000000..b30c273f --- /dev/null +++ b/go.work.sum @@ -0,0 +1,58 @@ +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +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/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= +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/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= +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/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +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.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/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/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/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/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +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.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU= +k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= diff --git a/script/cli/app.go b/script/cli/app.go new file mode 100644 index 00000000..ea3d7cb9 --- /dev/null +++ b/script/cli/app.go @@ -0,0 +1,42 @@ +package cli + +import ( + "os" + + "github.com/spf13/cobra" + "github.com/wavesoftware/go-commandline" + "knative.dev/hack/script/extract" +) + +// Options to override the commandline for testing purposes. +var Options []commandline.Option //nolint:gochecknoglobals + +type App struct{} + +func (a App) Command() *cobra.Command { + fl := &flags{} + c := &cobra.Command{ + Use: "script library.sh", + Short: "Script is a tool for running Hack scripts", + Long: "Script will extract Hack scripts to a temporary directory, " + + "and provide a source file path to requested script", + Example: ` +# In Bash script +source "$(go run knative.dev/hack/cmd/script library.sh)"`, + SilenceUsage: true, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, argv []string) error { + op := createOperation(fl, argv) + return op.Extract(cmd) + }, + } + c.SetOut(os.Stdout) + return fl.withFlags(c) +} + +func createOperation(fl *flags, argv []string) extract.Operation { + return extract.Operation{ + ScriptName: argv[0], + Verbose: fl.verbose, + } +} diff --git a/script/cli/flags.go b/script/cli/flags.go new file mode 100644 index 00000000..ee5e6d4d --- /dev/null +++ b/script/cli/flags.go @@ -0,0 +1,15 @@ +package cli + +import ( + "github.com/spf13/cobra" +) + +type flags struct { + verbose bool +} + +func (f *flags) withFlags(c *cobra.Command) *cobra.Command { + fl := c.PersistentFlags() + fl.BoolVarP(&f.verbose, "verbose", "v", false, "Print verbose output on Stderr") + return c +} diff --git a/script/extract/errors.go b/script/extract/errors.go new file mode 100644 index 00000000..8a9f1c0b --- /dev/null +++ b/script/extract/errors.go @@ -0,0 +1,21 @@ +package extract + +import ( + "errors" + "fmt" +) + +var ( + // ErrBug is an error that indicates a bug in the code. + ErrBug = errors.New("probably a bug in the code") + + // ErrUnexpected is an error that indicates an unexpected situation. + ErrUnexpected = errors.New("unexpected situation") +) + +func wrapErr(err error, target error) error { + if errors.Is(err, target) { + return err + } + return fmt.Errorf("%w: %v", target, err) +} diff --git a/script/extract/extract.go b/script/extract/extract.go new file mode 100644 index 00000000..1edae939 --- /dev/null +++ b/script/extract/extract.go @@ -0,0 +1,91 @@ +package extract + +import ( + "io/fs" + "os" + "path" + + "knative.dev/hack" +) + +const ( + DirPerm = 0o750 + FilePerm = 0o640 +) + +// Printer is an interface for printing messages. +type Printer interface { + Println(i ...interface{}) + Printf(format string, i ...interface{}) + PrintErr(i ...interface{}) + PrintErrf(format string, i ...interface{}) +} + +// Operation is the main extract object that can extract scripts. +type Operation struct { + // ScriptName is the name of the script to extract. + ScriptName string + // Verbose will print more information. + Verbose bool +} + +// Extract will extract a script from the library to a temporary directory and +// provide the file path to it. +func (o Operation) Extract(prtr Printer) error { + l := logger{o.Verbose, prtr} + artifactsDir := os.Getenv("ARTIFACTS") + if artifactsDir == "" { + var err error + if artifactsDir, err = os.MkdirTemp("", "knative.*"); err != nil { + return wrapErr(err, ErrBug) + } + } + hackRootDir := path.Join(artifactsDir, "hack-scripts") + l.debugf("Extracting hack scripts to directory: %s", hackRootDir) + libs, err := hack.Scripts.ReadDir(".") + if err != nil { + return wrapErr(err, ErrBug) + } + for _, lib := range libs { + if err = copy(l, hack.Scripts, hackRootDir, lib.Name()); err != nil { + return err + } + } + return nil +} + +func copy(l logger, files fs.ReadDirFS, destRoot, dir string) error { + entries, err := files.ReadDir(dir) + if err != nil { + return wrapErr(err, ErrBug) + } + for _, entry := range entries { + entryPath := path.Join(dir, entry.Name()) + if entry.IsDir() { + if err = copy(l, files, destRoot, entryPath); err != nil { + return err + } + } else { + if err = copyFile(l, files, destRoot, entryPath); err != nil { + return err + } + } + } + return nil +} + +func copyFile(l logger, files fs.ReadDirFS, root string, filePath string) error { + f, err := files.Open(filePath) + if err != nil { + return wrapErr(err, ErrBug) + } + defer func(f fs.File) { + _ = f.Close() + }(f) + destPath := path.Join(root, filePath) + destDir := path.Dir(destPath) + if err = os.MkdirAll(destDir, DirPerm); err != nil { + return wrapErr(err, ErrUnexpected) + } + +} diff --git a/script/extract/logger.go b/script/extract/logger.go new file mode 100644 index 00000000..5f7e25b4 --- /dev/null +++ b/script/extract/logger.go @@ -0,0 +1,12 @@ +package extract + +type logger struct { + verbose bool + Printer +} + +func (l logger) debugf(format string, i ...interface{}) { + if l.verbose { + l.PrintErrf("[hack] "+format+"\n", i...) + } +} From 4a77e40dc9eaf55dffaf06fa6a1ecdaa285f154b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20Suszy=C5=84ski?= Date: Thu, 8 Sep 2022 19:49:15 +0200 Subject: [PATCH 2/7] Implement the extract of hack scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chris SuszyƄski --- cmd/script/main.go | 2 +- cmd/script/main_test.go | 2 +- go.mod | 1 + go.sum | 2 + {script => pkg/inflator}/cli/app.go | 4 +- pkg/inflator/cli/app_test.go | 29 ++ {script => pkg/inflator}/cli/flags.go | 0 {script => pkg/inflator}/extract/errors.go | 8 +- pkg/inflator/extract/extract.go | 135 ++++++++ pkg/inflator/extract/extract_test.go | 84 +++++ {script => pkg/inflator}/extract/logger.go | 0 script/extract/extract.go | 91 ------ .../github.com/pkg/errors/LICENSE | 23 ++ vendor/github.com/pkg/errors/.gitignore | 24 ++ vendor/github.com/pkg/errors/.travis.yml | 10 + vendor/github.com/pkg/errors/LICENSE | 23 ++ vendor/github.com/pkg/errors/Makefile | 44 +++ vendor/github.com/pkg/errors/README.md | 59 ++++ vendor/github.com/pkg/errors/appveyor.yml | 32 ++ vendor/github.com/pkg/errors/errors.go | 288 ++++++++++++++++++ vendor/github.com/pkg/errors/go113.go | 38 +++ vendor/github.com/pkg/errors/stack.go | 177 +++++++++++ vendor/modules.txt | 3 + 23 files changed, 982 insertions(+), 97 deletions(-) rename {script => pkg/inflator}/cli/app.go (89%) create mode 100644 pkg/inflator/cli/app_test.go rename {script => pkg/inflator}/cli/flags.go (100%) rename {script => pkg/inflator}/extract/errors.go (75%) create mode 100644 pkg/inflator/extract/extract.go create mode 100644 pkg/inflator/extract/extract_test.go rename {script => pkg/inflator}/extract/logger.go (100%) delete mode 100644 script/extract/extract.go create mode 100644 third_party/VENDOR-LICENSE/github.com/pkg/errors/LICENSE create mode 100644 vendor/github.com/pkg/errors/.gitignore create mode 100644 vendor/github.com/pkg/errors/.travis.yml create mode 100644 vendor/github.com/pkg/errors/LICENSE create mode 100644 vendor/github.com/pkg/errors/Makefile create mode 100644 vendor/github.com/pkg/errors/README.md create mode 100644 vendor/github.com/pkg/errors/appveyor.yml create mode 100644 vendor/github.com/pkg/errors/errors.go create mode 100644 vendor/github.com/pkg/errors/go113.go create mode 100644 vendor/github.com/pkg/errors/stack.go diff --git a/cmd/script/main.go b/cmd/script/main.go index 8fbd8134..c80d3490 100644 --- a/cmd/script/main.go +++ b/cmd/script/main.go @@ -18,7 +18,7 @@ package main import ( "github.com/wavesoftware/go-commandline" - "knative.dev/hack/script/cli" + "knative.dev/hack/pkg/inflator/cli" ) func main() { diff --git a/cmd/script/main_test.go b/cmd/script/main_test.go index 88a80098..599accec 100644 --- a/cmd/script/main_test.go +++ b/cmd/script/main_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/wavesoftware/go-commandline" main "knative.dev/hack/cmd/script" - "knative.dev/hack/script/cli" + "knative.dev/hack/pkg/inflator/cli" ) func TestMainFn(t *testing.T) { diff --git a/go.mod b/go.mod index 4f9a5510..0360a90d 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module knative.dev/hack go 1.18 require ( + github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.5.0 github.com/stretchr/testify v1.8.0 github.com/wavesoftware/go-commandline v1.0.0 diff --git a/go.sum b/go.sum index 9f8e522e..3c12be3f 100644 --- a/go.sum +++ b/go.sum @@ -7,6 +7,8 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= diff --git a/script/cli/app.go b/pkg/inflator/cli/app.go similarity index 89% rename from script/cli/app.go rename to pkg/inflator/cli/app.go index ea3d7cb9..5a5cfeb4 100644 --- a/script/cli/app.go +++ b/pkg/inflator/cli/app.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" "github.com/wavesoftware/go-commandline" - "knative.dev/hack/script/extract" + "knative.dev/hack/pkg/inflator/extract" ) // Options to override the commandline for testing purposes. @@ -22,7 +22,7 @@ func (a App) Command() *cobra.Command { "and provide a source file path to requested script", Example: ` # In Bash script -source "$(go run knative.dev/hack/cmd/script library.sh)"`, +source "$(go run knative.dev/hack/cmd/script@latest library.sh)"`, SilenceUsage: true, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, argv []string) error { diff --git a/pkg/inflator/cli/app_test.go b/pkg/inflator/cli/app_test.go new file mode 100644 index 00000000..56405966 --- /dev/null +++ b/pkg/inflator/cli/app_test.go @@ -0,0 +1,29 @@ +package cli_test + +import ( + "bytes" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "knative.dev/hack/pkg/inflator/cli" + "knative.dev/hack/pkg/inflator/extract" +) + +func TestApp(t *testing.T) { + tmpdir := t.TempDir() + t.Setenv(extract.ArtifactsEnvVar, tmpdir) + c := cli.App{}.Command() + var ( + outb bytes.Buffer + errb bytes.Buffer + ) + c.SetOut(&outb) + c.SetErr(&errb) + c.SetArgs([]string{"e2e-tests.sh"}) + err := c.Execute() + + require.NoError(t, err) + assert.Equal(t, outb.String(), tmpdir+"/hack-scripts/e2e-tests.sh\n") + assert.Equal(t, errb.String(), "") +} diff --git a/script/cli/flags.go b/pkg/inflator/cli/flags.go similarity index 100% rename from script/cli/flags.go rename to pkg/inflator/cli/flags.go diff --git a/script/extract/errors.go b/pkg/inflator/extract/errors.go similarity index 75% rename from script/extract/errors.go rename to pkg/inflator/extract/errors.go index 8a9f1c0b..0d09d7a5 100644 --- a/script/extract/errors.go +++ b/pkg/inflator/extract/errors.go @@ -1,8 +1,9 @@ package extract import ( - "errors" "fmt" + + "github.com/pkg/errors" ) var ( @@ -14,8 +15,11 @@ var ( ) func wrapErr(err error, target error) error { + if err == nil { + return nil + } if errors.Is(err, target) { return err } - return fmt.Errorf("%w: %v", target, err) + return errors.WithStack(fmt.Errorf("%w: %v", target, err)) } diff --git a/pkg/inflator/extract/extract.go b/pkg/inflator/extract/extract.go new file mode 100644 index 00000000..b9a07f89 --- /dev/null +++ b/pkg/inflator/extract/extract.go @@ -0,0 +1,135 @@ +package extract + +import ( + "io/fs" + "math" + "os" + "path" + "strings" + + "knative.dev/hack" +) + +const ( + // ArtifactsEnvVar is the name of the environment variable that points + // to ARTIFACTS directory. + ArtifactsEnvVar = "ARTIFACTS" + // PermOwnerWrite is the permission bits for owner write. + PermOwnerWrite = 0o200 + // PermAllExecutable is the permission bits for executable. + PermAllExecutable = 0o111 +) + +// Printer is an interface for printing messages. +type Printer interface { + Print(i ...interface{}) + Println(i ...interface{}) + Printf(format string, i ...interface{}) + PrintErr(i ...interface{}) + PrintErrln(i ...interface{}) + PrintErrf(format string, i ...interface{}) +} + +// Operation is the main extract object that can extract scripts. +type Operation struct { + // ScriptName is the name of the script to extract. + ScriptName string + // Verbose will print more information. + Verbose bool +} + +// Extract will extract a script from the library to a temporary directory and +// provide the file path to it. +func (o Operation) Extract(prtr Printer) error { + l := logger{o.Verbose, prtr} + artifactsDir := os.Getenv(ArtifactsEnvVar) + if artifactsDir == "" { + var err error + if artifactsDir, err = os.MkdirTemp("", "knative.*"); err != nil { + return wrapErr(err, ErrBug) + } + } + hackRootDir := path.Join(artifactsDir, "hack-scripts") + l.debugf("Extracting hack scripts to directory: %s", hackRootDir) + if err := copyDir(l, hack.Scripts, hackRootDir, "."); err != nil { + return err + } + scriptPath := path.Join(hackRootDir, o.ScriptName) + l.Println(scriptPath) + return nil +} + +func copyDir(l logger, inputFS fs.ReadDirFS, destRootDir, dir string) error { + return wrapErr(fs.WalkDir(inputFS, dir, func(filePath string, dirEntry fs.DirEntry, err error) error { + if err != nil { + return wrapErr(err, ErrBug) + } + return copyFile(l, inputFS, destRootDir, filePath, dirEntry) + }), ErrUnexpected) +} + +func copyFile( + l logger, + inputFS fs.ReadDirFS, + destRootDir, filePath string, + dirEntry fs.DirEntry, +) error { + inputFI, err := dirEntry.Info() + if err != nil { + return wrapErr(err, ErrBug) + } + + destPath := path.Join(destRootDir, filePath) + perm := inputFI.Mode().Perm() + + perm |= PermOwnerWrite + if dirEntry.IsDir() { + perm |= PermAllExecutable + if err = os.MkdirAll(destPath, perm); err != nil { + return wrapErr(err, ErrUnexpected) + } + return nil + } + + var ( + inputCS checksum + destCS checksum + destFI fs.FileInfo + bytes []byte + ) + inputCS = asChecksum(inputFI) + if destFI, err = os.Stat(destPath); err != nil { + if !os.IsNotExist(err) { + return wrapErr(err, ErrUnexpected) + } + } else { + destCS = asChecksum(destFI) + } + if inputCS == destCS { + l.debugf("%-30s up-to-date", filePath) + return nil + } + if bytes, err = fs.ReadFile(inputFS, filePath); err != nil { + return wrapErr(err, ErrBug) + } + if err = os.WriteFile(destPath, bytes, perm); err != nil { + return wrapErr(err, ErrUnexpected) + } + + sizeKB := int(inputFI.Size() / 1024) + size5k := int(math.Ceil(float64(sizeKB) / 5)) + l.debugf("%-30s %3d KiB %s", filePath, sizeKB, strings.Repeat("+", size5k)) + return nil +} + +func asChecksum(f fs.FileInfo) checksum { + return checksum{ + exists: true, + size: f.Size(), + } +} + +type checksum struct { + exists bool + size int64 +} diff --git a/pkg/inflator/extract/extract_test.go b/pkg/inflator/extract/extract_test.go new file mode 100644 index 00000000..dbf44886 --- /dev/null +++ b/pkg/inflator/extract/extract_test.go @@ -0,0 +1,84 @@ +package extract_test + +import ( + "bytes" + "fmt" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "knative.dev/hack/pkg/inflator/extract" +) + +func TestExtract(t *testing.T) { + tmpdir := t.TempDir() + t.Setenv(extract.ArtifactsEnvVar, tmpdir) + op := extract.Operation{ + ScriptName: "library.sh", + Verbose: true, + } + prtr := &testPrinter{} + err := op.Extract(prtr) + require.NoError(t, err) + assert.Equal(t, prtr.out.String(), tmpdir+"/hack-scripts/library.sh\n") + assert.Equal(t, + `[hack] Extracting hack scripts to directory: /tmp/x/hack-scripts +[hack] codegen-library.sh 1 KiB + +[hack] e2e-tests.sh 6 KiB ++ +[hack] infra-library.sh 5 KiB + +[hack] library.sh 33 KiB +++++++ +[hack] microbenchmarks.sh 2 KiB + +[hack] performance-tests.sh 6 KiB ++ +[hack] presubmit-tests.sh 12 KiB +++ +[hack] release.sh 26 KiB ++++++ +[hack] shellcheck-presubmit.sh 1 KiB + +`, strings.ReplaceAll(prtr.err.String(), tmpdir, "/tmp/x")) + + // second time should be a no-op + prtr = &testPrinter{} + err = op.Extract(prtr) + require.NoError(t, err) + assert.Equal(t, prtr.out.String(), tmpdir+"/hack-scripts/library.sh\n") + assert.Equal(t, + `[hack] Extracting hack scripts to directory: /tmp/x/hack-scripts +[hack] codegen-library.sh up-to-date +[hack] e2e-tests.sh up-to-date +[hack] infra-library.sh up-to-date +[hack] library.sh up-to-date +[hack] microbenchmarks.sh up-to-date +[hack] performance-tests.sh up-to-date +[hack] presubmit-tests.sh up-to-date +[hack] release.sh up-to-date +[hack] shellcheck-presubmit.sh up-to-date +`, strings.ReplaceAll(prtr.err.String(), tmpdir, "/tmp/x")) +} + +type testPrinter struct { + out bytes.Buffer + err bytes.Buffer +} + +func (t *testPrinter) Print(i ...interface{}) { + _, _ = fmt.Fprint(&t.out, i...) +} + +func (t *testPrinter) Println(i ...interface{}) { + t.Print(fmt.Sprintln(i...)) +} + +func (t *testPrinter) Printf(format string, i ...interface{}) { + t.Print(fmt.Sprintf(format, i...)) +} + +func (t *testPrinter) PrintErr(i ...interface{}) { + _, _ = fmt.Fprint(&t.err, i...) +} + +func (t *testPrinter) PrintErrln(i ...interface{}) { + t.PrintErr(fmt.Sprintln(i...)) +} + +func (t *testPrinter) PrintErrf(format string, i ...interface{}) { + t.PrintErr(fmt.Sprintf(format, i...)) +} diff --git a/script/extract/logger.go b/pkg/inflator/extract/logger.go similarity index 100% rename from script/extract/logger.go rename to pkg/inflator/extract/logger.go diff --git a/script/extract/extract.go b/script/extract/extract.go deleted file mode 100644 index 1edae939..00000000 --- a/script/extract/extract.go +++ /dev/null @@ -1,91 +0,0 @@ -package extract - -import ( - "io/fs" - "os" - "path" - - "knative.dev/hack" -) - -const ( - DirPerm = 0o750 - FilePerm = 0o640 -) - -// Printer is an interface for printing messages. -type Printer interface { - Println(i ...interface{}) - Printf(format string, i ...interface{}) - PrintErr(i ...interface{}) - PrintErrf(format string, i ...interface{}) -} - -// Operation is the main extract object that can extract scripts. -type Operation struct { - // ScriptName is the name of the script to extract. - ScriptName string - // Verbose will print more information. - Verbose bool -} - -// Extract will extract a script from the library to a temporary directory and -// provide the file path to it. -func (o Operation) Extract(prtr Printer) error { - l := logger{o.Verbose, prtr} - artifactsDir := os.Getenv("ARTIFACTS") - if artifactsDir == "" { - var err error - if artifactsDir, err = os.MkdirTemp("", "knative.*"); err != nil { - return wrapErr(err, ErrBug) - } - } - hackRootDir := path.Join(artifactsDir, "hack-scripts") - l.debugf("Extracting hack scripts to directory: %s", hackRootDir) - libs, err := hack.Scripts.ReadDir(".") - if err != nil { - return wrapErr(err, ErrBug) - } - for _, lib := range libs { - if err = copy(l, hack.Scripts, hackRootDir, lib.Name()); err != nil { - return err - } - } - return nil -} - -func copy(l logger, files fs.ReadDirFS, destRoot, dir string) error { - entries, err := files.ReadDir(dir) - if err != nil { - return wrapErr(err, ErrBug) - } - for _, entry := range entries { - entryPath := path.Join(dir, entry.Name()) - if entry.IsDir() { - if err = copy(l, files, destRoot, entryPath); err != nil { - return err - } - } else { - if err = copyFile(l, files, destRoot, entryPath); err != nil { - return err - } - } - } - return nil -} - -func copyFile(l logger, files fs.ReadDirFS, root string, filePath string) error { - f, err := files.Open(filePath) - if err != nil { - return wrapErr(err, ErrBug) - } - defer func(f fs.File) { - _ = f.Close() - }(f) - destPath := path.Join(root, filePath) - destDir := path.Dir(destPath) - if err = os.MkdirAll(destDir, DirPerm); err != nil { - return wrapErr(err, ErrUnexpected) - } - -} diff --git a/third_party/VENDOR-LICENSE/github.com/pkg/errors/LICENSE b/third_party/VENDOR-LICENSE/github.com/pkg/errors/LICENSE new file mode 100644 index 00000000..835ba3e7 --- /dev/null +++ b/third_party/VENDOR-LICENSE/github.com/pkg/errors/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2015, Dave Cheney +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +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 HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/pkg/errors/.gitignore b/vendor/github.com/pkg/errors/.gitignore new file mode 100644 index 00000000..daf913b1 --- /dev/null +++ b/vendor/github.com/pkg/errors/.gitignore @@ -0,0 +1,24 @@ +# 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 diff --git a/vendor/github.com/pkg/errors/.travis.yml b/vendor/github.com/pkg/errors/.travis.yml new file mode 100644 index 00000000..9159de03 --- /dev/null +++ b/vendor/github.com/pkg/errors/.travis.yml @@ -0,0 +1,10 @@ +language: go +go_import_path: github.com/pkg/errors +go: + - 1.11.x + - 1.12.x + - 1.13.x + - tip + +script: + - make check diff --git a/vendor/github.com/pkg/errors/LICENSE b/vendor/github.com/pkg/errors/LICENSE new file mode 100644 index 00000000..835ba3e7 --- /dev/null +++ b/vendor/github.com/pkg/errors/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2015, Dave Cheney +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +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 HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/pkg/errors/Makefile b/vendor/github.com/pkg/errors/Makefile new file mode 100644 index 00000000..ce9d7cde --- /dev/null +++ b/vendor/github.com/pkg/errors/Makefile @@ -0,0 +1,44 @@ +PKGS := github.com/pkg/errors +SRCDIRS := $(shell go list -f '{{.Dir}}' $(PKGS)) +GO := go + +check: test vet gofmt misspell unconvert staticcheck ineffassign unparam + +test: + $(GO) test $(PKGS) + +vet: | test + $(GO) vet $(PKGS) + +staticcheck: + $(GO) get honnef.co/go/tools/cmd/staticcheck + staticcheck -checks all $(PKGS) + +misspell: + $(GO) get github.com/client9/misspell/cmd/misspell + misspell \ + -locale GB \ + -error \ + *.md *.go + +unconvert: + $(GO) get github.com/mdempsky/unconvert + unconvert -v $(PKGS) + +ineffassign: + $(GO) get github.com/gordonklaus/ineffassign + find $(SRCDIRS) -name '*.go' | xargs ineffassign + +pedantic: check errcheck + +unparam: + $(GO) get mvdan.cc/unparam + unparam ./... + +errcheck: + $(GO) get github.com/kisielk/errcheck + errcheck $(PKGS) + +gofmt: + @echo Checking code is gofmted + @test -z "$(shell gofmt -s -l -d -e $(SRCDIRS) | tee /dev/stderr)" diff --git a/vendor/github.com/pkg/errors/README.md b/vendor/github.com/pkg/errors/README.md new file mode 100644 index 00000000..54dfdcb1 --- /dev/null +++ b/vendor/github.com/pkg/errors/README.md @@ -0,0 +1,59 @@ +# errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors) [![Sourcegraph](https://sourcegraph.com/github.com/pkg/errors/-/badge.svg)](https://sourcegraph.com/github.com/pkg/errors?badge) + +Package errors provides simple error handling primitives. + +`go get github.com/pkg/errors` + +The traditional error handling idiom in Go is roughly akin to +```go +if err != nil { + return err +} +``` +which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error. + +## Adding context to an error + +The errors.Wrap function returns a new error that adds context to the original error. For example +```go +_, err := ioutil.ReadAll(r) +if err != nil { + return errors.Wrap(err, "read failed") +} +``` +## Retrieving the cause of an error + +Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`. +```go +type causer interface { + Cause() error +} +``` +`errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example: +```go +switch err := errors.Cause(err).(type) { +case *MyError: + // handle specifically +default: + // unknown error +} +``` + +[Read the package documentation for more information](https://godoc.org/github.com/pkg/errors). + +## Roadmap + +With the upcoming [Go2 error proposals](https://go.googlesource.com/proposal/+/master/design/go2draft.md) this package is moving into maintenance mode. The roadmap for a 1.0 release is as follows: + +- 0.9. Remove pre Go 1.9 and Go 1.10 support, address outstanding pull requests (if possible) +- 1.0. Final release. + +## Contributing + +Because of the Go2 errors changes, this package is not accepting proposals for new functionality. With that said, we welcome pull requests, bug fixes and issue reports. + +Before sending a PR, please discuss your change by raising an issue. + +## License + +BSD-2-Clause diff --git a/vendor/github.com/pkg/errors/appveyor.yml b/vendor/github.com/pkg/errors/appveyor.yml new file mode 100644 index 00000000..a932eade --- /dev/null +++ b/vendor/github.com/pkg/errors/appveyor.yml @@ -0,0 +1,32 @@ +version: build-{build}.{branch} + +clone_folder: C:\gopath\src\github.com\pkg\errors +shallow_clone: true # for startup speed + +environment: + GOPATH: C:\gopath + +platform: + - x64 + +# http://www.appveyor.com/docs/installed-software +install: + # some helpful output for debugging builds + - go version + - go env + # pre-installed MinGW at C:\MinGW is 32bit only + # but MSYS2 at C:\msys64 has mingw64 + - set PATH=C:\msys64\mingw64\bin;%PATH% + - gcc --version + - g++ --version + +build_script: + - go install -v ./... + +test_script: + - set PATH=C:\gopath\bin;%PATH% + - go test -v ./... + +#artifacts: +# - path: '%GOPATH%\bin\*.exe' +deploy: off diff --git a/vendor/github.com/pkg/errors/errors.go b/vendor/github.com/pkg/errors/errors.go new file mode 100644 index 00000000..161aea25 --- /dev/null +++ b/vendor/github.com/pkg/errors/errors.go @@ -0,0 +1,288 @@ +// Package errors provides simple error handling primitives. +// +// The traditional error handling idiom in Go is roughly akin to +// +// if err != nil { +// return err +// } +// +// which when applied recursively up the call stack results in error reports +// without context or debugging information. The errors package allows +// programmers to add context to the failure path in their code in a way +// that does not destroy the original value of the error. +// +// Adding context to an error +// +// The errors.Wrap function returns a new error that adds context to the +// original error by recording a stack trace at the point Wrap is called, +// together with the supplied message. For example +// +// _, err := ioutil.ReadAll(r) +// if err != nil { +// return errors.Wrap(err, "read failed") +// } +// +// If additional control is required, the errors.WithStack and +// errors.WithMessage functions destructure errors.Wrap into its component +// operations: annotating an error with a stack trace and with a message, +// respectively. +// +// Retrieving the cause of an error +// +// Using errors.Wrap constructs a stack of errors, adding context to the +// preceding error. Depending on the nature of the error it may be necessary +// to reverse the operation of errors.Wrap to retrieve the original error +// for inspection. Any error value which implements this interface +// +// type causer interface { +// Cause() error +// } +// +// can be inspected by errors.Cause. errors.Cause will recursively retrieve +// the topmost error that does not implement causer, which is assumed to be +// the original cause. For example: +// +// switch err := errors.Cause(err).(type) { +// case *MyError: +// // handle specifically +// default: +// // unknown error +// } +// +// Although the causer interface is not exported by this package, it is +// considered a part of its stable public interface. +// +// Formatted printing of errors +// +// All error values returned from this package implement fmt.Formatter and can +// be formatted by the fmt package. The following verbs are supported: +// +// %s print the error. If the error has a Cause it will be +// printed recursively. +// %v see %s +// %+v extended format. Each Frame of the error's StackTrace will +// be printed in detail. +// +// Retrieving the stack trace of an error or wrapper +// +// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are +// invoked. This information can be retrieved with the following interface: +// +// type stackTracer interface { +// StackTrace() errors.StackTrace +// } +// +// The returned errors.StackTrace type is defined as +// +// type StackTrace []Frame +// +// The Frame type represents a call site in the stack trace. Frame supports +// the fmt.Formatter interface that can be used for printing information about +// the stack trace of this error. For example: +// +// if err, ok := err.(stackTracer); ok { +// for _, f := range err.StackTrace() { +// fmt.Printf("%+s:%d\n", f, f) +// } +// } +// +// Although the stackTracer interface is not exported by this package, it is +// considered a part of its stable public interface. +// +// See the documentation for Frame.Format for more details. +package errors + +import ( + "fmt" + "io" +) + +// New returns an error with the supplied message. +// New also records the stack trace at the point it was called. +func New(message string) error { + return &fundamental{ + msg: message, + stack: callers(), + } +} + +// Errorf formats according to a format specifier and returns the string +// as a value that satisfies error. +// Errorf also records the stack trace at the point it was called. +func Errorf(format string, args ...interface{}) error { + return &fundamental{ + msg: fmt.Sprintf(format, args...), + stack: callers(), + } +} + +// fundamental is an error that has a message and a stack, but no caller. +type fundamental struct { + msg string + *stack +} + +func (f *fundamental) Error() string { return f.msg } + +func (f *fundamental) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + if s.Flag('+') { + io.WriteString(s, f.msg) + f.stack.Format(s, verb) + return + } + fallthrough + case 's': + io.WriteString(s, f.msg) + case 'q': + fmt.Fprintf(s, "%q", f.msg) + } +} + +// WithStack annotates err with a stack trace at the point WithStack was called. +// If err is nil, WithStack returns nil. +func WithStack(err error) error { + if err == nil { + return nil + } + return &withStack{ + err, + callers(), + } +} + +type withStack struct { + error + *stack +} + +func (w *withStack) Cause() error { return w.error } + +// Unwrap provides compatibility for Go 1.13 error chains. +func (w *withStack) Unwrap() error { return w.error } + +func (w *withStack) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + if s.Flag('+') { + fmt.Fprintf(s, "%+v", w.Cause()) + w.stack.Format(s, verb) + return + } + fallthrough + case 's': + io.WriteString(s, w.Error()) + case 'q': + fmt.Fprintf(s, "%q", w.Error()) + } +} + +// Wrap returns an error annotating err with a stack trace +// at the point Wrap is called, and the supplied message. +// If err is nil, Wrap returns nil. +func Wrap(err error, message string) error { + if err == nil { + return nil + } + err = &withMessage{ + cause: err, + msg: message, + } + return &withStack{ + err, + callers(), + } +} + +// Wrapf returns an error annotating err with a stack trace +// at the point Wrapf is called, and the format specifier. +// If err is nil, Wrapf returns nil. +func Wrapf(err error, format string, args ...interface{}) error { + if err == nil { + return nil + } + err = &withMessage{ + cause: err, + msg: fmt.Sprintf(format, args...), + } + return &withStack{ + err, + callers(), + } +} + +// WithMessage annotates err with a new message. +// If err is nil, WithMessage returns nil. +func WithMessage(err error, message string) error { + if err == nil { + return nil + } + return &withMessage{ + cause: err, + msg: message, + } +} + +// WithMessagef annotates err with the format specifier. +// If err is nil, WithMessagef returns nil. +func WithMessagef(err error, format string, args ...interface{}) error { + if err == nil { + return nil + } + return &withMessage{ + cause: err, + msg: fmt.Sprintf(format, args...), + } +} + +type withMessage struct { + cause error + msg string +} + +func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() } +func (w *withMessage) Cause() error { return w.cause } + +// Unwrap provides compatibility for Go 1.13 error chains. +func (w *withMessage) Unwrap() error { return w.cause } + +func (w *withMessage) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + if s.Flag('+') { + fmt.Fprintf(s, "%+v\n", w.Cause()) + io.WriteString(s, w.msg) + return + } + fallthrough + case 's', 'q': + io.WriteString(s, w.Error()) + } +} + +// Cause returns the underlying cause of the error, if possible. +// An error value has a cause if it implements the following +// interface: +// +// type causer interface { +// Cause() error +// } +// +// If the error does not implement Cause, the original error will +// be returned. If the error is nil, nil will be returned without further +// investigation. +func Cause(err error) error { + type causer interface { + Cause() error + } + + for err != nil { + cause, ok := err.(causer) + if !ok { + break + } + err = cause.Cause() + } + return err +} diff --git a/vendor/github.com/pkg/errors/go113.go b/vendor/github.com/pkg/errors/go113.go new file mode 100644 index 00000000..be0d10d0 --- /dev/null +++ b/vendor/github.com/pkg/errors/go113.go @@ -0,0 +1,38 @@ +// +build go1.13 + +package errors + +import ( + stderrors "errors" +) + +// Is reports whether any error in err's chain matches target. +// +// The chain consists of err itself followed by the sequence of errors obtained by +// repeatedly calling Unwrap. +// +// An error is considered to match a target if it is equal to that target or if +// it implements a method Is(error) bool such that Is(target) returns true. +func Is(err, target error) bool { return stderrors.Is(err, target) } + +// As finds the first error in err's chain that matches target, and if so, sets +// target to that error value and returns true. +// +// The chain consists of err itself followed by the sequence of errors obtained by +// repeatedly calling Unwrap. +// +// An error matches target if the error's concrete value is assignable to the value +// pointed to by target, or if the error has a method As(interface{}) bool such that +// As(target) returns true. In the latter case, the As method is responsible for +// setting target. +// +// As will panic if target is not a non-nil pointer to either a type that implements +// error, or to any interface type. As returns false if err is nil. +func As(err error, target interface{}) bool { return stderrors.As(err, target) } + +// Unwrap returns the result of calling the Unwrap method on err, if err's +// type contains an Unwrap method returning error. +// Otherwise, Unwrap returns nil. +func Unwrap(err error) error { + return stderrors.Unwrap(err) +} diff --git a/vendor/github.com/pkg/errors/stack.go b/vendor/github.com/pkg/errors/stack.go new file mode 100644 index 00000000..779a8348 --- /dev/null +++ b/vendor/github.com/pkg/errors/stack.go @@ -0,0 +1,177 @@ +package errors + +import ( + "fmt" + "io" + "path" + "runtime" + "strconv" + "strings" +) + +// Frame represents a program counter inside a stack frame. +// For historical reasons if Frame is interpreted as a uintptr +// its value represents the program counter + 1. +type Frame uintptr + +// pc returns the program counter for this frame; +// multiple frames may have the same PC value. +func (f Frame) pc() uintptr { return uintptr(f) - 1 } + +// file returns the full path to the file that contains the +// function for this Frame's pc. +func (f Frame) file() string { + fn := runtime.FuncForPC(f.pc()) + if fn == nil { + return "unknown" + } + file, _ := fn.FileLine(f.pc()) + return file +} + +// line returns the line number of source code of the +// function for this Frame's pc. +func (f Frame) line() int { + fn := runtime.FuncForPC(f.pc()) + if fn == nil { + return 0 + } + _, line := fn.FileLine(f.pc()) + return line +} + +// name returns the name of this function, if known. +func (f Frame) name() string { + fn := runtime.FuncForPC(f.pc()) + if fn == nil { + return "unknown" + } + return fn.Name() +} + +// Format formats the frame according to the fmt.Formatter interface. +// +// %s source file +// %d source line +// %n function name +// %v equivalent to %s:%d +// +// Format accepts flags that alter the printing of some verbs, as follows: +// +// %+s function name and path of source file relative to the compile time +// GOPATH separated by \n\t (\n\t) +// %+v equivalent to %+s:%d +func (f Frame) Format(s fmt.State, verb rune) { + switch verb { + case 's': + switch { + case s.Flag('+'): + io.WriteString(s, f.name()) + io.WriteString(s, "\n\t") + io.WriteString(s, f.file()) + default: + io.WriteString(s, path.Base(f.file())) + } + case 'd': + io.WriteString(s, strconv.Itoa(f.line())) + case 'n': + io.WriteString(s, funcname(f.name())) + case 'v': + f.Format(s, 's') + io.WriteString(s, ":") + f.Format(s, 'd') + } +} + +// MarshalText formats a stacktrace Frame as a text string. The output is the +// same as that of fmt.Sprintf("%+v", f), but without newlines or tabs. +func (f Frame) MarshalText() ([]byte, error) { + name := f.name() + if name == "unknown" { + return []byte(name), nil + } + return []byte(fmt.Sprintf("%s %s:%d", name, f.file(), f.line())), nil +} + +// StackTrace is stack of Frames from innermost (newest) to outermost (oldest). +type StackTrace []Frame + +// Format formats the stack of Frames according to the fmt.Formatter interface. +// +// %s lists source files for each Frame in the stack +// %v lists the source file and line number for each Frame in the stack +// +// Format accepts flags that alter the printing of some verbs, as follows: +// +// %+v Prints filename, function, and line number for each Frame in the stack. +func (st StackTrace) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + switch { + case s.Flag('+'): + for _, f := range st { + io.WriteString(s, "\n") + f.Format(s, verb) + } + case s.Flag('#'): + fmt.Fprintf(s, "%#v", []Frame(st)) + default: + st.formatSlice(s, verb) + } + case 's': + st.formatSlice(s, verb) + } +} + +// formatSlice will format this StackTrace into the given buffer as a slice of +// Frame, only valid when called with '%s' or '%v'. +func (st StackTrace) formatSlice(s fmt.State, verb rune) { + io.WriteString(s, "[") + for i, f := range st { + if i > 0 { + io.WriteString(s, " ") + } + f.Format(s, verb) + } + io.WriteString(s, "]") +} + +// stack represents a stack of program counters. +type stack []uintptr + +func (s *stack) Format(st fmt.State, verb rune) { + switch verb { + case 'v': + switch { + case st.Flag('+'): + for _, pc := range *s { + f := Frame(pc) + fmt.Fprintf(st, "\n%+v", f) + } + } + } +} + +func (s *stack) StackTrace() StackTrace { + f := make([]Frame, len(*s)) + for i := 0; i < len(f); i++ { + f[i] = Frame((*s)[i]) + } + return f +} + +func callers() *stack { + const depth = 32 + var pcs [depth]uintptr + n := runtime.Callers(3, pcs[:]) + var st stack = pcs[0:n] + return &st +} + +// funcname removes the path prefix component of a function's name reported by func.Name(). +func funcname(name string) string { + i := strings.LastIndex(name, "/") + name = name[i+1:] + i = strings.Index(name, ".") + return name[i+1:] +} diff --git a/vendor/modules.txt b/vendor/modules.txt index ecf324f3..f066c65a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -4,6 +4,9 @@ github.com/davecgh/go-spew/spew # github.com/inconshreveable/mousetrap v1.0.0 ## explicit github.com/inconshreveable/mousetrap +# github.com/pkg/errors v0.9.1 +## explicit +github.com/pkg/errors # github.com/pmezard/go-difflib v1.0.0 ## explicit github.com/pmezard/go-difflib/difflib From 74194e0f87fd3156a079338c362415a8cf0b4f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20Suszy=C5=84ski?= Date: Fri, 9 Sep 2022 13:32:29 +0200 Subject: [PATCH 3/7] Remove k8s.io/apimachinery dep --- go.mod | 6 +- go.sum | 12 +- go.work.sum | 57 +++++ .../k8s.io/apimachinery/{pkg => }/LICENSE | 0 .../third_party/forked/golang/reflect/LICENSE | 27 -- .../VENDOR-LICENSE/k8s.io/utils/LICENSE | 202 --------------- .../third_party/forked/golang/net/LICENSE | 27 -- .../VENDOR-LICENSE/sigs.k8s.io/json/LICENSE | 238 ------------------ test/unit/presubmit_test.go | 6 +- test/unit/release_test.go | 4 +- test/unit/sharedlib_test.go | 4 +- vendor/github.com/thanhpk/randstr/.gitignore | 26 ++ vendor/github.com/thanhpk/randstr/LICENSE | 21 ++ vendor/github.com/thanhpk/randstr/README.md | 65 +++++ vendor/github.com/thanhpk/randstr/randstr.go | 57 +++++ vendor/k8s.io/apimachinery/LICENSE | 202 --------------- .../k8s.io/apimachinery/pkg/util/rand/rand.go | 127 ---------- vendor/modules.txt | 14 +- 18 files changed, 259 insertions(+), 836 deletions(-) rename schema/third_party/VENDOR-LICENSE/k8s.io/apimachinery/{pkg => }/LICENSE (100%) delete mode 100644 schema/third_party/VENDOR-LICENSE/k8s.io/apimachinery/third_party/forked/golang/reflect/LICENSE delete mode 100644 schema/third_party/VENDOR-LICENSE/k8s.io/utils/LICENSE delete mode 100644 schema/third_party/VENDOR-LICENSE/k8s.io/utils/internal/third_party/forked/golang/net/LICENSE delete mode 100644 schema/third_party/VENDOR-LICENSE/sigs.k8s.io/json/LICENSE create mode 100644 vendor/github.com/thanhpk/randstr/.gitignore create mode 100644 vendor/github.com/thanhpk/randstr/LICENSE create mode 100644 vendor/github.com/thanhpk/randstr/README.md create mode 100644 vendor/github.com/thanhpk/randstr/randstr.go delete mode 100644 vendor/k8s.io/apimachinery/LICENSE delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/rand/rand.go diff --git a/go.mod b/go.mod index 0360a90d..c5cd6072 100644 --- a/go.mod +++ b/go.mod @@ -6,15 +6,19 @@ require ( github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.5.0 github.com/stretchr/testify v1.8.0 + github.com/thanhpk/randstr v1.0.4 github.com/wavesoftware/go-commandline v1.0.0 - k8s.io/apimachinery v0.25.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect + github.com/google/go-cmp v0.5.6 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/wavesoftware/go-retcode v1.0.0 // indirect + gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 3c12be3f..5b452a69 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,18 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.9/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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +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 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -21,16 +27,18 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/thanhpk/randstr v1.0.4 h1:IN78qu/bR+My+gHCvMEXhR/i5oriVHcTB/BJJIRTsNo= +github.com/thanhpk/randstr v1.0.4/go.mod h1:M/H2P1eNLZzlDwAzpkkkUvoyNNMbzRGhESZuEQk3r0U= github.com/wavesoftware/go-commandline v1.0.0 h1:n7nrFr1unfiUcF7shA1rYf+YhXB12pY8uNYqPgFsHio= github.com/wavesoftware/go-commandline v1.0.0/go.mod h1:C9yRtwZxJSck99kk6SRRkOtC2ppQF/KDRy0yrzWJuHU= github.com/wavesoftware/go-retcode v1.0.0 h1:Z53+VpIHMvRMtjS6jPScdihbAN1ks3lIJ5Mj32gCpno= github.com/wavesoftware/go-retcode v1.0.0/go.mod h1:BLqIIXhB/PQ+izkkRGfSQgu95BDtMmUBuvTJ/gkSWVM= +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-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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= gotest.tools/v3 v3.3.0 h1:MfDY1b1/0xN1CyMlQDac0ziEy9zJQd9CXBRRDHw2jJo= -k8s.io/apimachinery v0.25.0 h1:MlP0r6+3XbkUG2itd6vp3oxbtdQLQI94fD5gCS+gnoU= -k8s.io/apimachinery v0.25.0/go.mod h1:qMx9eAk0sZQGsXGu86fab8tZdffHbwUfsvzqKn4mfB0= diff --git a/go.work.sum b/go.work.sum index 83a8a263..b531bfda 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,68 +1,125 @@ +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/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/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= +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/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +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/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= 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/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= 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/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= +github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= 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/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +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/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= 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/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/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 v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= 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/yuin/goldmark v1.1.27/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= 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.3.0/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/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/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-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211209124913-491a49abca63 h1:iocB37TsdFuN6IBRZ+ry36wrkoV51/tl5vOWqkcPGvY= +golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/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-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-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-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/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.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/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.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 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= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/apimachinery v0.23.9 h1:u9Pu7Ffe+9+QJUemtNjuCwvHSnOUeYEwgSHV+88Ne0g= +k8s.io/apimachinery v0.23.9/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM= +k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/klog/v2 v2.30.0 h1:bUO6drIvCIsvZ/XFgfxoGFQU/a4Qkh0iAlvUR7vlHJw= +k8s.io/klog/v2 v2.30.0/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/klog/v2 v2.70.1 h1:7aaoSdahviPmR+XkS7FyxlkkXs6tHISSG03RxleQAVQ= k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65/go.mod h1:sX9MT8g7NVZM5lVL/j8QyCCJe8YSMW30QvGZWaCIDIk= k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU= +k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20211116205334-6203023598ed h1:ck1fRPWPJWsMd8ZRFsWc6mh/zHp5fZ/shhbrgPUxDAE= +k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed h1:jAne/RjBTyawwAy0utX5eqigAwz/lQhTmy+Hr/Cpue4= k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 h1:fD1pz4yfdADVNfFmcP2aBEtudwUQ1AlLnRBALr33v3s= +sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6/go.mod h1:p4QtZmO4uMYipTQNzagwnNoseA6OxSUutVw05NhYDRs= sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k= sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +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/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= diff --git a/schema/third_party/VENDOR-LICENSE/k8s.io/apimachinery/pkg/LICENSE b/schema/third_party/VENDOR-LICENSE/k8s.io/apimachinery/LICENSE similarity index 100% rename from schema/third_party/VENDOR-LICENSE/k8s.io/apimachinery/pkg/LICENSE rename to schema/third_party/VENDOR-LICENSE/k8s.io/apimachinery/LICENSE diff --git a/schema/third_party/VENDOR-LICENSE/k8s.io/apimachinery/third_party/forked/golang/reflect/LICENSE b/schema/third_party/VENDOR-LICENSE/k8s.io/apimachinery/third_party/forked/golang/reflect/LICENSE deleted file mode 100644 index 6a66aea5..00000000 --- a/schema/third_party/VENDOR-LICENSE/k8s.io/apimachinery/third_party/forked/golang/reflect/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/schema/third_party/VENDOR-LICENSE/k8s.io/utils/LICENSE b/schema/third_party/VENDOR-LICENSE/k8s.io/utils/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/schema/third_party/VENDOR-LICENSE/k8s.io/utils/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/schema/third_party/VENDOR-LICENSE/k8s.io/utils/internal/third_party/forked/golang/net/LICENSE b/schema/third_party/VENDOR-LICENSE/k8s.io/utils/internal/third_party/forked/golang/net/LICENSE deleted file mode 100644 index 74487567..00000000 --- a/schema/third_party/VENDOR-LICENSE/k8s.io/utils/internal/third_party/forked/golang/net/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/schema/third_party/VENDOR-LICENSE/sigs.k8s.io/json/LICENSE b/schema/third_party/VENDOR-LICENSE/sigs.k8s.io/json/LICENSE deleted file mode 100644 index e5adf7f0..00000000 --- a/schema/third_party/VENDOR-LICENSE/sigs.k8s.io/json/LICENSE +++ /dev/null @@ -1,238 +0,0 @@ -Files other than internal/golang/* licensed under: - - - 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. - - ------------------- - -internal/golang/* files licensed under: - - -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/test/unit/presubmit_test.go b/test/unit/presubmit_test.go index e080d952..d149e574 100644 --- a/test/unit/presubmit_test.go +++ b/test/unit/presubmit_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "k8s.io/apimachinery/pkg/util/rand" + "github.com/thanhpk/randstr" ) func TestMainFunc(t *testing.T) { @@ -115,8 +115,8 @@ func TestPrType(t *testing.T) { func TestCustomAndMultiScript(t *testing.T) { t.Parallel() - rng1 := rand.String(12) - rng2 := rand.String(12) + rng1 := randstr.String(12) + rng2 := randstr.String(12) sc := newShellScript( loadFile("fake-prow-job.bash", "source-presubmit-tests.bash"), mockGo(), diff --git a/test/unit/release_test.go b/test/unit/release_test.go index ad07e39b..f3728aa9 100644 --- a/test/unit/release_test.go +++ b/test/unit/release_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "k8s.io/apimachinery/pkg/util/rand" + "github.com/thanhpk/randstr" ) func TestReleaseHelperFunctions(t *testing.T) { @@ -166,7 +166,7 @@ func TestReleaseFlagParsingNightly(t *testing.T) { func TestReleaseFlagParsingGithubToken(t *testing.T) { t.Parallel() tmpfile := t.TempDir() + "/github.token" - token := rand.String(12) + token := randstr.String(12) err := os.WriteFile(tmpfile, []byte(token+"\n"), 0o600) require.NoError(t, err) sc := testReleaseShellScript() diff --git a/test/unit/sharedlib_test.go b/test/unit/sharedlib_test.go index 6315b18a..00e633b0 100644 --- a/test/unit/sharedlib_test.go +++ b/test/unit/sharedlib_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "k8s.io/apimachinery/pkg/util/rand" + "github.com/thanhpk/randstr" ) var ( @@ -264,7 +264,7 @@ export PATH="${TMPPATH}:${PATH}" func (s shellScript) write(t TestingT, src string) string { dir := currentDir() - p := path.Join(dir, fmt.Sprintf("unittest-%s.bash", rand.String(12))) + p := path.Join(dir, fmt.Sprintf("unittest-%s.bash", randstr.String(12))) err := os.WriteFile(p, []byte(src), 0o600) require.NoError(t, err) return p diff --git a/vendor/github.com/thanhpk/randstr/.gitignore b/vendor/github.com/thanhpk/randstr/.gitignore new file mode 100644 index 00000000..615baefa --- /dev/null +++ b/vendor/github.com/thanhpk/randstr/.gitignore @@ -0,0 +1,26 @@ +# 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 + +vendor/ diff --git a/vendor/github.com/thanhpk/randstr/LICENSE b/vendor/github.com/thanhpk/randstr/LICENSE new file mode 100644 index 00000000..7a7392fe --- /dev/null +++ b/vendor/github.com/thanhpk/randstr/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2010-2018 Google, Inc. http://angularjs.org + +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/thanhpk/randstr/README.md b/vendor/github.com/thanhpk/randstr/README.md new file mode 100644 index 00000000..d2c07915 --- /dev/null +++ b/vendor/github.com/thanhpk/randstr/README.md @@ -0,0 +1,65 @@ +# Randstr +# [![GoDoc](https://godoc.org/github.com/thanhpk/randstr?status.svg)](http://godoc.org/github.com/thanhpk/randstr) + +Randstr is an Go library for generating secure random strings + +## Install +``` + go get -u github.com/thanhpk/randstr +``` + +## Usage +### Generate a random hex string +```go +token := randstr.Hex(16) // generate 128-bit hex string +``` +Running example +```go + package main + import( + "github.com/thanhpk/randstr" + "fmt" + ) + + func main() { + for i := 0; i < 5; i++ { + token := randstr.Hex(16) // generate 128-bit hex string + fmt.Println(token) + } + } + // Output: + // 67aab2d956bd7cc621af22cfb169cba8 + // 226eeb52947edbf3e97d1e6669e212c2 + // 5f3615e95d103d14ffb5b655aa0eec1e + // ff3ab4efbd74025b87b14b59422d304c + // a6705813c174ca73ed795ea0bab12726 +``` + +### Generate a random ASCII string +```go +token := randstr.String(16) // generate a random 16 character length string +``` +Running example +```go + package main + import( + "github.com/thanhpk/randstr" + "fmt" + ) + + func main() { + for i := 0; i < 5; i++ { + token := randstr.String(16) + fmt.Println(token) + } + } + // Output: + // 7EbxkrHc1l3Ahmyr + // I5XH2gc1EEHgbmGI + // GlCycMpsxGkn9cDQ + // U2OfBDQoak0z8FwV + // kDX1m81u14YwEiCY +``` + +## License [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +MIT diff --git a/vendor/github.com/thanhpk/randstr/randstr.go b/vendor/github.com/thanhpk/randstr/randstr.go new file mode 100644 index 00000000..b617b2aa --- /dev/null +++ b/vendor/github.com/thanhpk/randstr/randstr.go @@ -0,0 +1,57 @@ +// Package randstr provides basic functions for generating random bytes, string +package randstr + +import ( + "bytes" + "crypto/rand" + "encoding/binary" + "encoding/hex" +) + +// Bytes generates n random bytes +func Bytes(n int) []byte { + b := make([]byte, n) + _, err := rand.Read(b) + if err != nil { + panic(err) + } + return b +} + +// Base64 generates a random base64 string with length of n +func Base64(n int) string { + return String(n, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/") +} + +// Base64 generates a random base62 string with length of n +func Base62(s int) string { + return String(s, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") +} + +// Hex generates a random hex string with length of n +// e.g: 67aab2d956bd7cc621af22cfb169cba8 +func Hex(n int) string { return hex.EncodeToString(Bytes(n)) } + +// list of default letters that can be used to make a random string when calling String +// function with no letters provided +var defLetters = []rune("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + +// String generates a random string using only letters provided in the letters parameter +// if user ommit letters parameters, this function will use defLetters instead +func String(n int, letters ...string) string { + var letterRunes []rune + if len(letters) == 0 { + letterRunes = defLetters + } else { + letterRunes = []rune(letters[0]) + } + + var bb bytes.Buffer + bb.Grow(n) + l := uint32(len(letterRunes)) + // on each loop, generate one random rune and append to output + for i := 0; i < n; i++ { + bb.WriteRune(letterRunes[binary.BigEndian.Uint32(Bytes(4))%l]) + } + return bb.String() +} diff --git a/vendor/k8s.io/apimachinery/LICENSE b/vendor/k8s.io/apimachinery/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/vendor/k8s.io/apimachinery/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/apimachinery/pkg/util/rand/rand.go b/vendor/k8s.io/apimachinery/pkg/util/rand/rand.go deleted file mode 100644 index 82a473bb..00000000 --- a/vendor/k8s.io/apimachinery/pkg/util/rand/rand.go +++ /dev/null @@ -1,127 +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 rand provides utilities related to randomization. -package rand - -import ( - "math/rand" - "sync" - "time" -) - -var rng = struct { - sync.Mutex - rand *rand.Rand -}{ - rand: rand.New(rand.NewSource(time.Now().UnixNano())), -} - -// Int returns a non-negative pseudo-random int. -func Int() int { - rng.Lock() - defer rng.Unlock() - return rng.rand.Int() -} - -// Intn generates an integer in range [0,max). -// By design this should panic if input is invalid, <= 0. -func Intn(max int) int { - rng.Lock() - defer rng.Unlock() - return rng.rand.Intn(max) -} - -// IntnRange generates an integer in range [min,max). -// By design this should panic if input is invalid, <= 0. -func IntnRange(min, max int) int { - rng.Lock() - defer rng.Unlock() - return rng.rand.Intn(max-min) + min -} - -// IntnRange generates an int64 integer in range [min,max). -// By design this should panic if input is invalid, <= 0. -func Int63nRange(min, max int64) int64 { - rng.Lock() - defer rng.Unlock() - return rng.rand.Int63n(max-min) + min -} - -// Seed seeds the rng with the provided seed. -func Seed(seed int64) { - rng.Lock() - defer rng.Unlock() - - rng.rand = rand.New(rand.NewSource(seed)) -} - -// Perm returns, as a slice of n ints, a pseudo-random permutation of the integers [0,n) -// from the default Source. -func Perm(n int) []int { - rng.Lock() - defer rng.Unlock() - return rng.rand.Perm(n) -} - -const ( - // We omit vowels from the set of available characters to reduce the chances - // of "bad words" being formed. - alphanums = "bcdfghjklmnpqrstvwxz2456789" - // No. of bits required to index into alphanums string. - alphanumsIdxBits = 5 - // Mask used to extract last alphanumsIdxBits of an int. - alphanumsIdxMask = 1<>= alphanumsIdxBits - remaining-- - } - return string(b) -} - -// SafeEncodeString encodes s using the same characters as rand.String. This reduces the chances of bad words and -// ensures that strings generated from hash functions appear consistent throughout the API. -func SafeEncodeString(s string) string { - r := make([]byte, len(s)) - for i, b := range []rune(s) { - r[i] = alphanums[(int(b) % len(alphanums))] - } - return string(r) -} diff --git a/vendor/modules.txt b/vendor/modules.txt index f066c65a..f4fe4592 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,9 +1,15 @@ # github.com/davecgh/go-spew v1.1.1 ## explicit github.com/davecgh/go-spew/spew +# github.com/google/go-cmp v0.5.6 +## explicit; go 1.8 # github.com/inconshreveable/mousetrap v1.0.0 ## explicit github.com/inconshreveable/mousetrap +# github.com/kr/text v0.2.0 +## explicit +# github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e +## explicit; go 1.12 # github.com/pkg/errors v0.9.1 ## explicit github.com/pkg/errors @@ -20,15 +26,17 @@ github.com/spf13/pflag ## explicit; go 1.13 github.com/stretchr/testify/assert github.com/stretchr/testify/require +# github.com/thanhpk/randstr v1.0.4 +## explicit +github.com/thanhpk/randstr # github.com/wavesoftware/go-commandline v1.0.0 ## explicit; go 1.18 github.com/wavesoftware/go-commandline # github.com/wavesoftware/go-retcode v1.0.0 ## explicit; go 1.18 github.com/wavesoftware/go-retcode +# gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f +## explicit # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# k8s.io/apimachinery v0.25.0 -## explicit; go 1.19 -k8s.io/apimachinery/pkg/util/rand From a98cace2fdd8ee2e7bd930c0b9397bb3a38736c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20Suszy=C5=84ski?= Date: Thu, 3 Nov 2022 14:19:04 +0100 Subject: [PATCH 4/7] Change the extract dir to be constant --- pkg/inflator/cli/app_test.go | 5 +++-- pkg/inflator/cli/flags.go | 20 ++++++++++++++++++- pkg/inflator/extract/extract.go | 16 ++++++--------- pkg/inflator/extract/extract_test.go | 12 +++++------ .../gogo/protobuf/proto/pointer_reflect.go | 1 - .../protobuf/proto/pointer_reflect_gogo.go | 1 - .../gogo/protobuf/proto/pointer_unsafe.go | 1 - .../protobuf/proto/pointer_unsafe_gogo.go | 1 - .../inconshreveable/mousetrap/trap_others.go | 1 - .../inconshreveable/mousetrap/trap_windows.go | 4 ++-- .../mousetrap/trap_windows_1.4.go | 4 ++-- .../vendor/github.com/json-iterator/go/any.go | 3 +-- .../json-iterator/go/iter_skip_sloppy.go | 3 +-- .../json-iterator/go/iter_skip_strict.go | 3 +-- .../json-iterator/go/reflect_array.go | 3 +-- .../json-iterator/go/reflect_dynamic.go | 3 +-- .../json-iterator/go/reflect_extension.go | 3 +-- .../json-iterator/go/reflect_json_number.go | 3 +-- .../go/reflect_json_raw_message.go | 3 +-- .../json-iterator/go/reflect_map.go | 3 +-- .../json-iterator/go/reflect_optional.go | 3 +-- .../json-iterator/go/reflect_slice.go | 3 +-- .../go/reflect_struct_encoder.go | 3 +-- .../modern-go/concurrent/go_above_19.go | 3 +-- .../modern-go/concurrent/go_below_19.go | 3 +-- .../github.com/modern-go/concurrent/log.go | 6 +++--- .../concurrent/unbounded_executor.go | 2 +- .../modern-go/reflect2/go_above_17.go | 3 +-- .../modern-go/reflect2/go_above_19.go | 3 +-- .../modern-go/reflect2/go_below_17.go | 3 +-- .../modern-go/reflect2/go_below_19.go | 3 +-- .../github.com/modern-go/reflect2/reflect2.go | 9 ++++----- .../github.com/spf13/cobra/command_notwin.go | 1 - .../github.com/spf13/cobra/command_win.go | 1 - schema/vendor/golang.org/x/net/http2/go111.go | 1 - .../golang.org/x/net/http2/not_go111.go | 1 - .../golang.org/x/net/idna/idna10.0.0.go | 1 - .../vendor/golang.org/x/net/idna/idna9.0.0.go | 1 - .../golang.org/x/net/idna/tables10.0.0.go | 1 - .../golang.org/x/net/idna/tables11.0.0.go | 1 - .../golang.org/x/net/idna/tables12.0.0.go | 1 - .../golang.org/x/net/idna/tables13.0.0.go | 1 - .../golang.org/x/net/idna/tables9.0.0.go | 1 - .../x/text/secure/bidirule/bidirule10.0.0.go | 1 - .../x/text/secure/bidirule/bidirule9.0.0.go | 1 - .../x/text/unicode/bidi/tables10.0.0.go | 1 - .../x/text/unicode/bidi/tables11.0.0.go | 1 - .../x/text/unicode/bidi/tables12.0.0.go | 1 - .../x/text/unicode/bidi/tables9.0.0.go | 1 - .../x/text/unicode/norm/tables10.0.0.go | 1 - .../x/text/unicode/norm/tables11.0.0.go | 1 - .../x/text/unicode/norm/tables12.0.0.go | 1 - .../x/text/unicode/norm/tables9.0.0.go | 1 - schema/vendor/gopkg.in/yaml.v2/readerc.go | 2 +- schema/vendor/gopkg.in/yaml.v2/resolve.go | 2 +- schema/vendor/gopkg.in/yaml.v2/sorter.go | 2 +- schema/vendor/gopkg.in/yaml.v3/apic.go | 8 ++++---- schema/vendor/gopkg.in/yaml.v3/emitterc.go | 2 +- schema/vendor/gopkg.in/yaml.v3/readerc.go | 8 ++++---- schema/vendor/gopkg.in/yaml.v3/scannerc.go | 8 ++++---- schema/vendor/gopkg.in/yaml.v3/writerc.go | 8 ++++---- schema/vendor/gopkg.in/yaml.v3/yaml.go | 5 +++-- schema/vendor/gopkg.in/yaml.v3/yamlh.go | 1 + .../vendor/gopkg.in/yaml.v3/yamlprivateh.go | 20 +++++++++---------- .../pkg/api/resource/zz_generated.deepcopy.go | 1 - .../pkg/apis/meta/v1/micro_time.go | 2 +- .../apis/meta/v1/zz_generated.conversion.go | 1 - .../pkg/apis/meta/v1/zz_generated.deepcopy.go | 1 - .../pkg/apis/meta/v1/zz_generated.defaults.go | 1 - .../pkg/labels/zz_generated.deepcopy.go | 1 - .../pkg/runtime/zz_generated.deepcopy.go | 1 - .../apimachinery/pkg/util/intstr/intstr.go | 2 +- .../pkg/watch/zz_generated.deepcopy.go | 1 - test/e2e-kind.sh | 5 ++++- test/e2e-tests.sh | 5 ++++- test/hack/update-deps.sh | 5 ++++- test/presubmit-tests.sh | 5 ++++- test/unit/scripts/fake-prow-job.bash | 1 + test/unit/scripts/source-e2e-tests.bash | 7 ++++++- test/unit/scripts/source-library.bash | 7 ++++++- test/unit/scripts/source-presubmit-tests.bash | 7 ++++++- test/unit/scripts/source-release.bash | 7 ++++++- test/unit/sharedlib_test.go | 1 + .../github.com/davecgh/go-spew/spew/bypass.go | 1 - .../davecgh/go-spew/spew/bypasssafe.go | 1 - .../pmezard/go-difflib/difflib/difflib.go | 8 ++++---- .../stretchr/testify/require/require.go | 3 +-- .../testify/require/require_forward.go | 3 +-- test/vendor/gopkg.in/yaml.v3/apic.go | 8 ++++---- test/vendor/gopkg.in/yaml.v3/emitterc.go | 2 +- test/vendor/gopkg.in/yaml.v3/readerc.go | 8 ++++---- test/vendor/gopkg.in/yaml.v3/scannerc.go | 8 ++++---- test/vendor/gopkg.in/yaml.v3/writerc.go | 8 ++++---- test/vendor/gopkg.in/yaml.v3/yaml.go | 5 +++-- test/vendor/gopkg.in/yaml.v3/yamlh.go | 1 + test/vendor/gopkg.in/yaml.v3/yamlprivateh.go | 20 +++++++++---------- 96 files changed, 179 insertions(+), 182 deletions(-) diff --git a/pkg/inflator/cli/app_test.go b/pkg/inflator/cli/app_test.go index 56405966..62686246 100644 --- a/pkg/inflator/cli/app_test.go +++ b/pkg/inflator/cli/app_test.go @@ -12,7 +12,8 @@ import ( func TestApp(t *testing.T) { tmpdir := t.TempDir() - t.Setenv(extract.ArtifactsEnvVar, tmpdir) + t.Setenv(extract.HackScriptsDirEnvVar, tmpdir) + t.Setenv(cli.ManualVerboseEnvVar, "true") c := cli.App{}.Command() var ( outb bytes.Buffer @@ -24,6 +25,6 @@ func TestApp(t *testing.T) { err := c.Execute() require.NoError(t, err) - assert.Equal(t, outb.String(), tmpdir+"/hack-scripts/e2e-tests.sh\n") + assert.Equal(t, outb.String(), tmpdir+"/e2e-tests.sh\n") assert.Equal(t, errb.String(), "") } diff --git a/pkg/inflator/cli/flags.go b/pkg/inflator/cli/flags.go index ee5e6d4d..ce49e7e9 100644 --- a/pkg/inflator/cli/flags.go +++ b/pkg/inflator/cli/flags.go @@ -1,15 +1,33 @@ package cli import ( + "os" + "strings" + "github.com/spf13/cobra" ) +const ( + // ManualVerboseEnvVar is the environment variable that can be set to disable + // automatic verbose mode on CI servers. + ManualVerboseEnvVar = "KNATIVE_HACK_SCRIPT_MANUAL_VERBOSE" +) + type flags struct { verbose bool } func (f *flags) withFlags(c *cobra.Command) *cobra.Command { fl := c.PersistentFlags() - fl.BoolVarP(&f.verbose, "verbose", "v", false, "Print verbose output on Stderr") + fl.BoolVarP(&f.verbose, "verbose", "v", isCiServer(), "Print verbose output on Stderr") return c } + +func isCiServer() bool { + if strings.HasPrefix(strings.ToLower(os.Getenv(ManualVerboseEnvVar)), "t") { + return false + } + return os.Getenv("CI") != "" || + os.Getenv("BUILD_ID") != "" || + os.Getenv("PROW_JOB_ID") != "" +} diff --git a/pkg/inflator/extract/extract.go b/pkg/inflator/extract/extract.go index b9a07f89..2275c165 100644 --- a/pkg/inflator/extract/extract.go +++ b/pkg/inflator/extract/extract.go @@ -11,9 +11,9 @@ import ( ) const ( - // ArtifactsEnvVar is the name of the environment variable that points - // to ARTIFACTS directory. - ArtifactsEnvVar = "ARTIFACTS" + // HackScriptsDirEnvVar is the name of the environment variable that points + // to directory where knative-hack scripts will be extracted. + HackScriptsDirEnvVar = "KNATIVE_HACK_SCRIPTS_DIR" // PermOwnerWrite is the permission bits for owner write. PermOwnerWrite = 0o200 // PermAllExecutable is the permission bits for executable. @@ -42,14 +42,10 @@ type Operation struct { // provide the file path to it. func (o Operation) Extract(prtr Printer) error { l := logger{o.Verbose, prtr} - artifactsDir := os.Getenv(ArtifactsEnvVar) - if artifactsDir == "" { - var err error - if artifactsDir, err = os.MkdirTemp("", "knative.*"); err != nil { - return wrapErr(err, ErrBug) - } + hackRootDir := os.Getenv(HackScriptsDirEnvVar) + if hackRootDir == "" { + hackRootDir = path.Join(os.TempDir(), "knative", "hack", "scripts") } - hackRootDir := path.Join(artifactsDir, "hack-scripts") l.debugf("Extracting hack scripts to directory: %s", hackRootDir) if err := copyDir(l, hack.Scripts, hackRootDir, "."); err != nil { return err diff --git a/pkg/inflator/extract/extract_test.go b/pkg/inflator/extract/extract_test.go index dbf44886..522655b6 100644 --- a/pkg/inflator/extract/extract_test.go +++ b/pkg/inflator/extract/extract_test.go @@ -13,7 +13,7 @@ import ( func TestExtract(t *testing.T) { tmpdir := t.TempDir() - t.Setenv(extract.ArtifactsEnvVar, tmpdir) + t.Setenv(extract.HackScriptsDirEnvVar, tmpdir) op := extract.Operation{ ScriptName: "library.sh", Verbose: true, @@ -21,9 +21,9 @@ func TestExtract(t *testing.T) { prtr := &testPrinter{} err := op.Extract(prtr) require.NoError(t, err) - assert.Equal(t, prtr.out.String(), tmpdir+"/hack-scripts/library.sh\n") + assert.Equal(t, prtr.out.String(), tmpdir+"/library.sh\n") assert.Equal(t, - `[hack] Extracting hack scripts to directory: /tmp/x/hack-scripts + `[hack] Extracting hack scripts to directory: /tmp/x [hack] codegen-library.sh 1 KiB + [hack] e2e-tests.sh 6 KiB ++ [hack] infra-library.sh 5 KiB + @@ -31,7 +31,7 @@ func TestExtract(t *testing.T) { [hack] microbenchmarks.sh 2 KiB + [hack] performance-tests.sh 6 KiB ++ [hack] presubmit-tests.sh 12 KiB +++ -[hack] release.sh 26 KiB ++++++ +[hack] release.sh 27 KiB ++++++ [hack] shellcheck-presubmit.sh 1 KiB + `, strings.ReplaceAll(prtr.err.String(), tmpdir, "/tmp/x")) @@ -39,9 +39,9 @@ func TestExtract(t *testing.T) { prtr = &testPrinter{} err = op.Extract(prtr) require.NoError(t, err) - assert.Equal(t, prtr.out.String(), tmpdir+"/hack-scripts/library.sh\n") + assert.Equal(t, prtr.out.String(), tmpdir+"/library.sh\n") assert.Equal(t, - `[hack] Extracting hack scripts to directory: /tmp/x/hack-scripts + `[hack] Extracting hack scripts to directory: /tmp/x [hack] codegen-library.sh up-to-date [hack] e2e-tests.sh up-to-date [hack] infra-library.sh up-to-date diff --git a/schema/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go b/schema/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go index 461d5821..b6cad908 100644 --- a/schema/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go +++ b/schema/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go @@ -29,7 +29,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -//go:build purego || appengine || js // +build purego appengine js // This file contains an implementation of proto field accesses using package reflect. diff --git a/schema/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go b/schema/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go index d6e07e2f..7ffd3c29 100644 --- a/schema/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go +++ b/schema/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go @@ -26,7 +26,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -//go:build purego || appengine || js // +build purego appengine js // This file contains an implementation of proto field accesses using package reflect. diff --git a/schema/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go b/schema/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go index c998399b..d55a335d 100644 --- a/schema/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go +++ b/schema/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go @@ -29,7 +29,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -//go:build !purego && !appengine && !js // +build !purego,!appengine,!js // This file contains the implementation of the proto field accesses using package unsafe. diff --git a/schema/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go b/schema/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go index 57a14965..aca8eed0 100644 --- a/schema/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go +++ b/schema/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go @@ -26,7 +26,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -//go:build !purego && !appengine && !js // +build !purego,!appengine,!js // This file contains the implementation of the proto field accesses using package unsafe. diff --git a/schema/vendor/github.com/inconshreveable/mousetrap/trap_others.go b/schema/vendor/github.com/inconshreveable/mousetrap/trap_others.go index 06a91f08..9d2d8a4b 100644 --- a/schema/vendor/github.com/inconshreveable/mousetrap/trap_others.go +++ b/schema/vendor/github.com/inconshreveable/mousetrap/trap_others.go @@ -1,4 +1,3 @@ -//go:build !windows // +build !windows package mousetrap diff --git a/schema/vendor/github.com/inconshreveable/mousetrap/trap_windows.go b/schema/vendor/github.com/inconshreveable/mousetrap/trap_windows.go index 2d2adac9..336142a5 100644 --- a/schema/vendor/github.com/inconshreveable/mousetrap/trap_windows.go +++ b/schema/vendor/github.com/inconshreveable/mousetrap/trap_windows.go @@ -1,5 +1,5 @@ -//go:build windows && !go1.4 -// +build windows,!go1.4 +// +build windows +// +build !go1.4 package mousetrap diff --git a/schema/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go b/schema/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go index c78a98fd..9a28e57c 100644 --- a/schema/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go +++ b/schema/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go @@ -1,5 +1,5 @@ -//go:build windows && go1.4 -// +build windows,go1.4 +// +build windows +// +build go1.4 package mousetrap diff --git a/schema/vendor/github.com/json-iterator/go/any.go b/schema/vendor/github.com/json-iterator/go/any.go index 4b7e1cf5..f6b8aeab 100644 --- a/schema/vendor/github.com/json-iterator/go/any.go +++ b/schema/vendor/github.com/json-iterator/go/any.go @@ -3,12 +3,11 @@ package jsoniter import ( "errors" "fmt" + "github.com/modern-go/reflect2" "io" "reflect" "strconv" "unsafe" - - "github.com/modern-go/reflect2" ) // Any generic object representation. diff --git a/schema/vendor/github.com/json-iterator/go/iter_skip_sloppy.go b/schema/vendor/github.com/json-iterator/go/iter_skip_sloppy.go index 3d993f27..9303de41 100644 --- a/schema/vendor/github.com/json-iterator/go/iter_skip_sloppy.go +++ b/schema/vendor/github.com/json-iterator/go/iter_skip_sloppy.go @@ -1,5 +1,4 @@ -//go:build jsoniter_sloppy -// +build jsoniter_sloppy +//+build jsoniter_sloppy package jsoniter diff --git a/schema/vendor/github.com/json-iterator/go/iter_skip_strict.go b/schema/vendor/github.com/json-iterator/go/iter_skip_strict.go index f1ad6591..6cf66d04 100644 --- a/schema/vendor/github.com/json-iterator/go/iter_skip_strict.go +++ b/schema/vendor/github.com/json-iterator/go/iter_skip_strict.go @@ -1,5 +1,4 @@ -//go:build !jsoniter_sloppy -// +build !jsoniter_sloppy +//+build !jsoniter_sloppy package jsoniter diff --git a/schema/vendor/github.com/json-iterator/go/reflect_array.go b/schema/vendor/github.com/json-iterator/go/reflect_array.go index 7eb5b1dc..13a0b7b0 100644 --- a/schema/vendor/github.com/json-iterator/go/reflect_array.go +++ b/schema/vendor/github.com/json-iterator/go/reflect_array.go @@ -2,10 +2,9 @@ package jsoniter import ( "fmt" + "github.com/modern-go/reflect2" "io" "unsafe" - - "github.com/modern-go/reflect2" ) func decoderOfArray(ctx *ctx, typ reflect2.Type) ValDecoder { diff --git a/schema/vendor/github.com/json-iterator/go/reflect_dynamic.go b/schema/vendor/github.com/json-iterator/go/reflect_dynamic.go index 71a0fe27..8b6bc8b4 100644 --- a/schema/vendor/github.com/json-iterator/go/reflect_dynamic.go +++ b/schema/vendor/github.com/json-iterator/go/reflect_dynamic.go @@ -1,10 +1,9 @@ package jsoniter import ( + "github.com/modern-go/reflect2" "reflect" "unsafe" - - "github.com/modern-go/reflect2" ) type dynamicEncoder struct { diff --git a/schema/vendor/github.com/json-iterator/go/reflect_extension.go b/schema/vendor/github.com/json-iterator/go/reflect_extension.go index a820f10c..74a97bfe 100644 --- a/schema/vendor/github.com/json-iterator/go/reflect_extension.go +++ b/schema/vendor/github.com/json-iterator/go/reflect_extension.go @@ -2,13 +2,12 @@ package jsoniter import ( "fmt" + "github.com/modern-go/reflect2" "reflect" "sort" "strings" "unicode" "unsafe" - - "github.com/modern-go/reflect2" ) var typeDecoders = map[string]ValDecoder{} diff --git a/schema/vendor/github.com/json-iterator/go/reflect_json_number.go b/schema/vendor/github.com/json-iterator/go/reflect_json_number.go index 52e11bf3..98d45c1e 100644 --- a/schema/vendor/github.com/json-iterator/go/reflect_json_number.go +++ b/schema/vendor/github.com/json-iterator/go/reflect_json_number.go @@ -2,10 +2,9 @@ package jsoniter import ( "encoding/json" + "github.com/modern-go/reflect2" "strconv" "unsafe" - - "github.com/modern-go/reflect2" ) type Number string diff --git a/schema/vendor/github.com/json-iterator/go/reflect_json_raw_message.go b/schema/vendor/github.com/json-iterator/go/reflect_json_raw_message.go index 70670a8f..f2619936 100644 --- a/schema/vendor/github.com/json-iterator/go/reflect_json_raw_message.go +++ b/schema/vendor/github.com/json-iterator/go/reflect_json_raw_message.go @@ -2,9 +2,8 @@ package jsoniter import ( "encoding/json" - "unsafe" - "github.com/modern-go/reflect2" + "unsafe" ) var jsonRawMessageType = reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem() diff --git a/schema/vendor/github.com/json-iterator/go/reflect_map.go b/schema/vendor/github.com/json-iterator/go/reflect_map.go index 696194bd..58296713 100644 --- a/schema/vendor/github.com/json-iterator/go/reflect_map.go +++ b/schema/vendor/github.com/json-iterator/go/reflect_map.go @@ -2,12 +2,11 @@ package jsoniter import ( "fmt" + "github.com/modern-go/reflect2" "io" "reflect" "sort" "unsafe" - - "github.com/modern-go/reflect2" ) func decoderOfMap(ctx *ctx, typ reflect2.Type) ValDecoder { diff --git a/schema/vendor/github.com/json-iterator/go/reflect_optional.go b/schema/vendor/github.com/json-iterator/go/reflect_optional.go index 112c110a..fa71f474 100644 --- a/schema/vendor/github.com/json-iterator/go/reflect_optional.go +++ b/schema/vendor/github.com/json-iterator/go/reflect_optional.go @@ -1,9 +1,8 @@ package jsoniter import ( - "unsafe" - "github.com/modern-go/reflect2" + "unsafe" ) func decoderOfOptional(ctx *ctx, typ reflect2.Type) ValDecoder { diff --git a/schema/vendor/github.com/json-iterator/go/reflect_slice.go b/schema/vendor/github.com/json-iterator/go/reflect_slice.go index f363a716..9441d79d 100644 --- a/schema/vendor/github.com/json-iterator/go/reflect_slice.go +++ b/schema/vendor/github.com/json-iterator/go/reflect_slice.go @@ -2,10 +2,9 @@ package jsoniter import ( "fmt" + "github.com/modern-go/reflect2" "io" "unsafe" - - "github.com/modern-go/reflect2" ) func decoderOfSlice(ctx *ctx, typ reflect2.Type) ValDecoder { diff --git a/schema/vendor/github.com/json-iterator/go/reflect_struct_encoder.go b/schema/vendor/github.com/json-iterator/go/reflect_struct_encoder.go index edf77bf5..152e3ef5 100644 --- a/schema/vendor/github.com/json-iterator/go/reflect_struct_encoder.go +++ b/schema/vendor/github.com/json-iterator/go/reflect_struct_encoder.go @@ -2,11 +2,10 @@ package jsoniter import ( "fmt" + "github.com/modern-go/reflect2" "io" "reflect" "unsafe" - - "github.com/modern-go/reflect2" ) func encoderOfStruct(ctx *ctx, typ reflect2.Type) ValEncoder { diff --git a/schema/vendor/github.com/modern-go/concurrent/go_above_19.go b/schema/vendor/github.com/modern-go/concurrent/go_above_19.go index 7db70194..aeabf8c4 100644 --- a/schema/vendor/github.com/modern-go/concurrent/go_above_19.go +++ b/schema/vendor/github.com/modern-go/concurrent/go_above_19.go @@ -1,5 +1,4 @@ -//go:build go1.9 -// +build go1.9 +//+build go1.9 package concurrent diff --git a/schema/vendor/github.com/modern-go/concurrent/go_below_19.go b/schema/vendor/github.com/modern-go/concurrent/go_below_19.go index 64544f5b..b9c8df7f 100644 --- a/schema/vendor/github.com/modern-go/concurrent/go_below_19.go +++ b/schema/vendor/github.com/modern-go/concurrent/go_below_19.go @@ -1,5 +1,4 @@ -//go:build !go1.9 -// +build !go1.9 +//+build !go1.9 package concurrent diff --git a/schema/vendor/github.com/modern-go/concurrent/log.go b/schema/vendor/github.com/modern-go/concurrent/log.go index 4899eed0..9756fcc7 100644 --- a/schema/vendor/github.com/modern-go/concurrent/log.go +++ b/schema/vendor/github.com/modern-go/concurrent/log.go @@ -1,13 +1,13 @@ package concurrent import ( - "io/ioutil" - "log" "os" + "log" + "io/ioutil" ) // ErrorLogger is used to print out error, can be set to writer other than stderr var ErrorLogger = log.New(os.Stderr, "", 0) // InfoLogger is used to print informational message, default to off -var InfoLogger = log.New(ioutil.Discard, "", 0) +var InfoLogger = log.New(ioutil.Discard, "", 0) \ No newline at end of file diff --git a/schema/vendor/github.com/modern-go/concurrent/unbounded_executor.go b/schema/vendor/github.com/modern-go/concurrent/unbounded_executor.go index 5ea18eb7..05a77dce 100644 --- a/schema/vendor/github.com/modern-go/concurrent/unbounded_executor.go +++ b/schema/vendor/github.com/modern-go/concurrent/unbounded_executor.go @@ -3,11 +3,11 @@ package concurrent import ( "context" "fmt" - "reflect" "runtime" "runtime/debug" "sync" "time" + "reflect" ) // HandlePanic logs goroutine panic by default diff --git a/schema/vendor/github.com/modern-go/reflect2/go_above_17.go b/schema/vendor/github.com/modern-go/reflect2/go_above_17.go index 2089f126..5c1cea86 100644 --- a/schema/vendor/github.com/modern-go/reflect2/go_above_17.go +++ b/schema/vendor/github.com/modern-go/reflect2/go_above_17.go @@ -1,5 +1,4 @@ -//go:build go1.7 -// +build go1.7 +//+build go1.7 package reflect2 diff --git a/schema/vendor/github.com/modern-go/reflect2/go_above_19.go b/schema/vendor/github.com/modern-go/reflect2/go_above_19.go index 3d65173b..c7e3b780 100644 --- a/schema/vendor/github.com/modern-go/reflect2/go_above_19.go +++ b/schema/vendor/github.com/modern-go/reflect2/go_above_19.go @@ -1,5 +1,4 @@ -//go:build go1.9 -// +build go1.9 +//+build go1.9 package reflect2 diff --git a/schema/vendor/github.com/modern-go/reflect2/go_below_17.go b/schema/vendor/github.com/modern-go/reflect2/go_below_17.go index c3f98f90..65a93c88 100644 --- a/schema/vendor/github.com/modern-go/reflect2/go_below_17.go +++ b/schema/vendor/github.com/modern-go/reflect2/go_below_17.go @@ -1,5 +1,4 @@ -//go:build !go1.7 -// +build !go1.7 +//+build !go1.7 package reflect2 diff --git a/schema/vendor/github.com/modern-go/reflect2/go_below_19.go b/schema/vendor/github.com/modern-go/reflect2/go_below_19.go index 65966f59..b050ef70 100644 --- a/schema/vendor/github.com/modern-go/reflect2/go_below_19.go +++ b/schema/vendor/github.com/modern-go/reflect2/go_below_19.go @@ -1,5 +1,4 @@ -//go:build !go1.9 -// +build !go1.9 +//+build !go1.9 package reflect2 diff --git a/schema/vendor/github.com/modern-go/reflect2/reflect2.go b/schema/vendor/github.com/modern-go/reflect2/reflect2.go index 773932f6..63b49c79 100644 --- a/schema/vendor/github.com/modern-go/reflect2/reflect2.go +++ b/schema/vendor/github.com/modern-go/reflect2/reflect2.go @@ -1,10 +1,9 @@ package reflect2 import ( + "github.com/modern-go/concurrent" "reflect" "unsafe" - - "github.com/modern-go/concurrent" ) type Type interface { @@ -137,7 +136,7 @@ type frozenConfig struct { func (cfg Config) Froze() *frozenConfig { return &frozenConfig{ useSafeImplementation: cfg.UseSafeImplementation, - cache: concurrent.NewMap(), + cache: concurrent.NewMap(), } } @@ -292,8 +291,8 @@ func UnsafeCastString(str string) []byte { stringHeader := (*reflect.StringHeader)(unsafe.Pointer(&str)) sliceHeader := &reflect.SliceHeader{ Data: stringHeader.Data, - Cap: stringHeader.Len, - Len: stringHeader.Len, + Cap: stringHeader.Len, + Len: stringHeader.Len, } return *(*[]byte)(unsafe.Pointer(sliceHeader)) } diff --git a/schema/vendor/github.com/spf13/cobra/command_notwin.go b/schema/vendor/github.com/spf13/cobra/command_notwin.go index bb5dad90..6159c1cc 100644 --- a/schema/vendor/github.com/spf13/cobra/command_notwin.go +++ b/schema/vendor/github.com/spf13/cobra/command_notwin.go @@ -1,4 +1,3 @@ -//go:build !windows // +build !windows package cobra diff --git a/schema/vendor/github.com/spf13/cobra/command_win.go b/schema/vendor/github.com/spf13/cobra/command_win.go index a84f5a82..8768b173 100644 --- a/schema/vendor/github.com/spf13/cobra/command_win.go +++ b/schema/vendor/github.com/spf13/cobra/command_win.go @@ -1,4 +1,3 @@ -//go:build windows // +build windows package cobra diff --git a/schema/vendor/golang.org/x/net/http2/go111.go b/schema/vendor/golang.org/x/net/http2/go111.go index 5bf62b03..3a131016 100644 --- a/schema/vendor/golang.org/x/net/http2/go111.go +++ b/schema/vendor/golang.org/x/net/http2/go111.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.11 // +build go1.11 package http2 diff --git a/schema/vendor/golang.org/x/net/http2/not_go111.go b/schema/vendor/golang.org/x/net/http2/not_go111.go index cc0baa81..161bca7c 100644 --- a/schema/vendor/golang.org/x/net/http2/not_go111.go +++ b/schema/vendor/golang.org/x/net/http2/not_go111.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !go1.11 // +build !go1.11 package http2 diff --git a/schema/vendor/golang.org/x/net/idna/idna10.0.0.go b/schema/vendor/golang.org/x/net/idna/idna10.0.0.go index 7e69ee1b..a98a31f4 100644 --- a/schema/vendor/golang.org/x/net/idna/idna10.0.0.go +++ b/schema/vendor/golang.org/x/net/idna/idna10.0.0.go @@ -4,7 +4,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.10 // +build go1.10 // Package idna implements IDNA2008 using the compatibility processing diff --git a/schema/vendor/golang.org/x/net/idna/idna9.0.0.go b/schema/vendor/golang.org/x/net/idna/idna9.0.0.go index 7c745637..8842146b 100644 --- a/schema/vendor/golang.org/x/net/idna/idna9.0.0.go +++ b/schema/vendor/golang.org/x/net/idna/idna9.0.0.go @@ -4,7 +4,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !go1.10 // +build !go1.10 // Package idna implements IDNA2008 using the compatibility processing diff --git a/schema/vendor/golang.org/x/net/idna/tables10.0.0.go b/schema/vendor/golang.org/x/net/idna/tables10.0.0.go index d1d62ef4..54fddb4b 100644 --- a/schema/vendor/golang.org/x/net/idna/tables10.0.0.go +++ b/schema/vendor/golang.org/x/net/idna/tables10.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.10 && !go1.13 // +build go1.10,!go1.13 package idna diff --git a/schema/vendor/golang.org/x/net/idna/tables11.0.0.go b/schema/vendor/golang.org/x/net/idna/tables11.0.0.go index 167efba7..8ce0811f 100644 --- a/schema/vendor/golang.org/x/net/idna/tables11.0.0.go +++ b/schema/vendor/golang.org/x/net/idna/tables11.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.13 && !go1.14 // +build go1.13,!go1.14 package idna diff --git a/schema/vendor/golang.org/x/net/idna/tables12.0.0.go b/schema/vendor/golang.org/x/net/idna/tables12.0.0.go index ab40f7bc..f39f0cb4 100644 --- a/schema/vendor/golang.org/x/net/idna/tables12.0.0.go +++ b/schema/vendor/golang.org/x/net/idna/tables12.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.14 && !go1.16 // +build go1.14,!go1.16 package idna diff --git a/schema/vendor/golang.org/x/net/idna/tables13.0.0.go b/schema/vendor/golang.org/x/net/idna/tables13.0.0.go index 390c5e56..e8c7a36d 100644 --- a/schema/vendor/golang.org/x/net/idna/tables13.0.0.go +++ b/schema/vendor/golang.org/x/net/idna/tables13.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.16 // +build go1.16 package idna diff --git a/schema/vendor/golang.org/x/net/idna/tables9.0.0.go b/schema/vendor/golang.org/x/net/idna/tables9.0.0.go index 4074b533..8b65fa16 100644 --- a/schema/vendor/golang.org/x/net/idna/tables9.0.0.go +++ b/schema/vendor/golang.org/x/net/idna/tables9.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build !go1.10 // +build !go1.10 package idna diff --git a/schema/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go b/schema/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go index 8a7392c4..e4c62289 100644 --- a/schema/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go +++ b/schema/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.10 // +build go1.10 package bidirule diff --git a/schema/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go b/schema/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go index bb0a9200..02b9e1e9 100644 --- a/schema/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go +++ b/schema/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !go1.10 // +build !go1.10 package bidirule diff --git a/schema/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go b/schema/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go index 42fa8d72..d8c94e1b 100644 --- a/schema/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go +++ b/schema/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.10 && !go1.13 // +build go1.10,!go1.13 package bidi diff --git a/schema/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go b/schema/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go index 56a0e1ea..16b11db5 100644 --- a/schema/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go +++ b/schema/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.13 && !go1.14 // +build go1.13,!go1.14 package bidi diff --git a/schema/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go b/schema/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go index 7501c975..7ffa3651 100644 --- a/schema/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go +++ b/schema/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.14 // +build go1.14 package bidi diff --git a/schema/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go b/schema/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go index f517fdb2..0ca0193e 100644 --- a/schema/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go +++ b/schema/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build !go1.10 // +build !go1.10 package bidi diff --git a/schema/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go b/schema/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go index f5a07882..26fbd55a 100644 --- a/schema/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go +++ b/schema/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.10 && !go1.13 // +build go1.10,!go1.13 package norm diff --git a/schema/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go b/schema/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go index cb7239c4..2c58f09b 100644 --- a/schema/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go +++ b/schema/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.13 && !go1.14 // +build go1.13,!go1.14 package norm diff --git a/schema/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go b/schema/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go index 23eb8c70..10f5202c 100644 --- a/schema/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go +++ b/schema/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.14 // +build go1.14 package norm diff --git a/schema/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go b/schema/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go index 0175eae5..94290692 100644 --- a/schema/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go +++ b/schema/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build !go1.10 // +build !go1.10 package norm diff --git a/schema/vendor/gopkg.in/yaml.v2/readerc.go b/schema/vendor/gopkg.in/yaml.v2/readerc.go index b0c436c4..7c1f5fac 100644 --- a/schema/vendor/gopkg.in/yaml.v2/readerc.go +++ b/schema/vendor/gopkg.in/yaml.v2/readerc.go @@ -95,7 +95,7 @@ func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { // [Go] This function was changed to guarantee the requested length size at EOF. // The fact we need to do this is pretty awful, but the description above implies - // for that to be the case, and there are tests + // for that to be the case, and there are tests // If the EOF flag is set and the raw buffer is empty, do nothing. if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { diff --git a/schema/vendor/gopkg.in/yaml.v2/resolve.go b/schema/vendor/gopkg.in/yaml.v2/resolve.go index e29c364b..4120e0c9 100644 --- a/schema/vendor/gopkg.in/yaml.v2/resolve.go +++ b/schema/vendor/gopkg.in/yaml.v2/resolve.go @@ -180,7 +180,7 @@ func resolve(tag string, in string) (rtag string, out interface{}) { return yaml_INT_TAG, uintv } } else if strings.HasPrefix(plain, "-0b") { - intv, err := strconv.ParseInt("-"+plain[3:], 2, 64) + intv, err := strconv.ParseInt("-" + plain[3:], 2, 64) if err == nil { if true || intv == int64(int(intv)) { return yaml_INT_TAG, int(intv) diff --git a/schema/vendor/gopkg.in/yaml.v2/sorter.go b/schema/vendor/gopkg.in/yaml.v2/sorter.go index 2edd7340..4c45e660 100644 --- a/schema/vendor/gopkg.in/yaml.v2/sorter.go +++ b/schema/vendor/gopkg.in/yaml.v2/sorter.go @@ -52,7 +52,7 @@ func (l keyList) Less(i, j int) bool { var ai, bi int var an, bn int64 if ar[i] == '0' || br[i] == '0' { - for j := i - 1; j >= 0 && unicode.IsDigit(ar[j]); j-- { + for j := i-1; j >= 0 && unicode.IsDigit(ar[j]); j-- { if ar[j] != '0' { an = 1 bn = 1 diff --git a/schema/vendor/gopkg.in/yaml.v3/apic.go b/schema/vendor/gopkg.in/yaml.v3/apic.go index 05fd305d..ae7d049f 100644 --- a/schema/vendor/gopkg.in/yaml.v3/apic.go +++ b/schema/vendor/gopkg.in/yaml.v3/apic.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/schema/vendor/gopkg.in/yaml.v3/emitterc.go b/schema/vendor/gopkg.in/yaml.v3/emitterc.go index f6e50b5b..0f47c9ca 100644 --- a/schema/vendor/gopkg.in/yaml.v3/emitterc.go +++ b/schema/vendor/gopkg.in/yaml.v3/emitterc.go @@ -241,7 +241,7 @@ func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool emitter.indent += 2 } else { // Everything else aligns to the chosen indentation. - emitter.indent = emitter.best_indent * ((emitter.indent + emitter.best_indent) / emitter.best_indent) + emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent) } } return true diff --git a/schema/vendor/gopkg.in/yaml.v3/readerc.go b/schema/vendor/gopkg.in/yaml.v3/readerc.go index 56af2453..b7de0a89 100644 --- a/schema/vendor/gopkg.in/yaml.v3/readerc.go +++ b/schema/vendor/gopkg.in/yaml.v3/readerc.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/schema/vendor/gopkg.in/yaml.v3/scannerc.go b/schema/vendor/gopkg.in/yaml.v3/scannerc.go index 037fcd53..ca007010 100644 --- a/schema/vendor/gopkg.in/yaml.v3/scannerc.go +++ b/schema/vendor/gopkg.in/yaml.v3/scannerc.go @@ -2847,7 +2847,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t continue } if parser.buffer[parser.buffer_pos+peek] == '#' { - seen := parser.mark.index + peek + seen := parser.mark.index+peek for { if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false @@ -2876,7 +2876,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t parser.comments = append(parser.comments, yaml_comment_t{ token_mark: token_mark, start_mark: start_mark, - line: text, + line: text, }) } return true @@ -2910,7 +2910,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo // the foot is the line below it. var foot_line = -1 if scan_mark.line > 0 { - foot_line = parser.mark.line - parser.newlines + 1 + foot_line = parser.mark.line-parser.newlines+1 if parser.newlines == 0 && parser.mark.column > 1 { foot_line++ } @@ -2996,7 +2996,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo recent_empty = false // Consume until after the consumed comment line. - seen := parser.mark.index + peek + seen := parser.mark.index+peek for { if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false diff --git a/schema/vendor/gopkg.in/yaml.v3/writerc.go b/schema/vendor/gopkg.in/yaml.v3/writerc.go index 266d0b09..b8a116bf 100644 --- a/schema/vendor/gopkg.in/yaml.v3/writerc.go +++ b/schema/vendor/gopkg.in/yaml.v3/writerc.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/schema/vendor/gopkg.in/yaml.v3/yaml.go b/schema/vendor/gopkg.in/yaml.v3/yaml.go index 3ba221c2..8cec6da4 100644 --- a/schema/vendor/gopkg.in/yaml.v3/yaml.go +++ b/schema/vendor/gopkg.in/yaml.v3/yaml.go @@ -363,7 +363,7 @@ const ( // Address yaml.Node // } // err := yaml.Unmarshal(data, &person) -// +// // Or by itself: // // var person Node @@ -373,7 +373,7 @@ type Node struct { // Kind defines whether the node is a document, a mapping, a sequence, // a scalar value, or an alias to another node. The specific data type of // scalar nodes may be obtained via the ShortTag and LongTag methods. - Kind Kind + Kind Kind // Style allows customizing the apperance of the node in the tree. Style Style @@ -421,6 +421,7 @@ func (n *Node) IsZero() bool { n.HeadComment == "" && n.LineComment == "" && n.FootComment == "" && n.Line == 0 && n.Column == 0 } + // LongTag returns the long form of the tag that indicates the data type for // the node. If the Tag field isn't explicitly defined, one will be computed // based on the node properties. diff --git a/schema/vendor/gopkg.in/yaml.v3/yamlh.go b/schema/vendor/gopkg.in/yaml.v3/yamlh.go index 9e9afc9e..7c6d0077 100644 --- a/schema/vendor/gopkg.in/yaml.v3/yamlh.go +++ b/schema/vendor/gopkg.in/yaml.v3/yamlh.go @@ -639,6 +639,7 @@ type yaml_parser_t struct { } type yaml_comment_t struct { + scan_mark yaml_mark_t // Position where scanning for comments started token_mark yaml_mark_t // Position after which tokens will be associated with this comment start_mark yaml_mark_t // Position of '#' comment mark diff --git a/schema/vendor/gopkg.in/yaml.v3/yamlprivateh.go b/schema/vendor/gopkg.in/yaml.v3/yamlprivateh.go index dea1ba96..e88f9c54 100644 --- a/schema/vendor/gopkg.in/yaml.v3/yamlprivateh.go +++ b/schema/vendor/gopkg.in/yaml.v3/yamlprivateh.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -137,8 +137,8 @@ func is_crlf(b []byte, i int) bool { func is_breakz(b []byte, i int) bool { //return is_break(b, i) || is_z(b, i) return ( - // is_break: - b[i] == '\r' || // CR (#xD) + // is_break: + b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) @@ -151,8 +151,8 @@ func is_breakz(b []byte, i int) bool { func is_spacez(b []byte, i int) bool { //return is_space(b, i) || is_breakz(b, i) return ( - // is_space: - b[i] == ' ' || + // is_space: + b[i] == ' ' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) @@ -166,8 +166,8 @@ func is_spacez(b []byte, i int) bool { func is_blankz(b []byte, i int) bool { //return is_blank(b, i) || is_breakz(b, i) return ( - // is_blank: - b[i] == ' ' || b[i] == '\t' || + // is_blank: + b[i] == ' ' || b[i] == '\t' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) diff --git a/schema/vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go b/schema/vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go index 5bb530eb..ab474079 100644 --- a/schema/vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go +++ b/schema/vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go b/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go index 2e2db482..cdd9a6a7 100644 --- a/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go +++ b/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go @@ -20,7 +20,7 @@ import ( "encoding/json" "time" - fuzz "github.com/google/gofuzz" + "github.com/google/gofuzz" ) const RFC3339Micro = "2006-01-02T15:04:05.000000Z07:00" diff --git a/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go b/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go index c0819757..06afd9b5 100644 --- a/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go +++ b/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go b/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go index a14fdcf1..1aa73bd2 100644 --- a/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go +++ b/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go b/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go index dac177e9..cce2e603 100644 --- a/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go +++ b/schema/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/schema/vendor/k8s.io/apimachinery/pkg/labels/zz_generated.deepcopy.go b/schema/vendor/k8s.io/apimachinery/pkg/labels/zz_generated.deepcopy.go index fdf4c31e..4d482947 100644 --- a/schema/vendor/k8s.io/apimachinery/pkg/labels/zz_generated.deepcopy.go +++ b/schema/vendor/k8s.io/apimachinery/pkg/labels/zz_generated.deepcopy.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/schema/vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go b/schema/vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go index 069ea4f9..b0393839 100644 --- a/schema/vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go +++ b/schema/vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/schema/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go b/schema/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go index f4e6fe1e..6576def8 100644 --- a/schema/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go +++ b/schema/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go @@ -25,8 +25,8 @@ import ( "strconv" "strings" + "github.com/google/gofuzz" "k8s.io/klog/v2" - fuzz "knative.dev/hack/schema/vendor/github.com/google/gofuzz" ) // IntOrString is a type that can hold an int32 or a string. When used in diff --git a/schema/vendor/k8s.io/apimachinery/pkg/watch/zz_generated.deepcopy.go b/schema/vendor/k8s.io/apimachinery/pkg/watch/zz_generated.deepcopy.go index dd27d452..71ef4da3 100644 --- a/schema/vendor/k8s.io/apimachinery/pkg/watch/zz_generated.deepcopy.go +++ b/schema/vendor/k8s.io/apimachinery/pkg/watch/zz_generated.deepcopy.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/test/e2e-kind.sh b/test/e2e-kind.sh index b5c0d637..f5d0be4c 100755 --- a/test/e2e-kind.sh +++ b/test/e2e-kind.sh @@ -16,7 +16,10 @@ set -Eeo pipefail -source "$(dirname "${BASH_SOURCE[0]:-$0}")/../e2e-tests.sh" +pushd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." > /dev/null +# shellcheck disable=SC1090 +source "$(go run ./cmd/script e2e-tests.sh)" +popd > /dev/null function knative_setup() { start_latest_knative_serving diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index f10eb6f6..f643172f 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -25,7 +25,10 @@ set -Eeuo pipefail -source "$(dirname "${BASH_SOURCE[0]:-$0}")/../e2e-tests.sh" +pushd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." > /dev/null +# shellcheck disable=SC1090 +source "$(go run ./cmd/script e2e-tests.sh)" +popd > /dev/null function knative_setup() { start_latest_knative_serving diff --git a/test/hack/update-deps.sh b/test/hack/update-deps.sh index d7d9c82f..f14b4715 100755 --- a/test/hack/update-deps.sh +++ b/test/hack/update-deps.sh @@ -16,6 +16,9 @@ set -Eeuo pipefail -source "$(dirname "${BASH_SOURCE[0]:-$0}")/../../library.sh" +pushd "$(dirname "${BASH_SOURCE[0]:-$0}")/../.." > /dev/null +# shellcheck disable=SC1090 +source "$(go run ./cmd/script library.sh)" +popd > /dev/null go_update_deps "$@" diff --git a/test/presubmit-tests.sh b/test/presubmit-tests.sh index 42d603db..cf0b34a3 100755 --- a/test/presubmit-tests.sh +++ b/test/presubmit-tests.sh @@ -23,7 +23,10 @@ set -Eeuo pipefail -source "$(dirname "${BASH_SOURCE[0]:-$0}")/../presubmit-tests.sh" +pushd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." > /dev/null +# shellcheck disable=SC1090 +source "$(go run ./cmd/script presubmit-tests.sh)" +popd > /dev/null # Run our custom build tests after the standard build tests. diff --git a/test/unit/scripts/fake-prow-job.bash b/test/unit/scripts/fake-prow-job.bash index c777936a..acd308f4 100644 --- a/test/unit/scripts/fake-prow-job.bash +++ b/test/unit/scripts/fake-prow-job.bash @@ -20,3 +20,4 @@ if [[ -z "${PROW_JOB_ID:-}" ]]; then export JOB_TYPE='presubmit' export PULL_PULL_SHA='deadbeef1234567890' fi +export KNATIVE_HACK_SCRIPT_MANUAL_VERBOSE=true diff --git a/test/unit/scripts/source-e2e-tests.bash b/test/unit/scripts/source-e2e-tests.bash index 2a60102c..1d6c7d4d 100755 --- a/test/unit/scripts/source-e2e-tests.bash +++ b/test/unit/scripts/source-e2e-tests.bash @@ -14,4 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -source "$(dirname "${BASH_SOURCE[0]:-$0}")/../../e2e-tests.sh" +set -Eeuo pipefail + +pushd "$(dirname "${BASH_SOURCE[0]:-$0}")/../.." > /dev/null +# shellcheck disable=SC1090 +source "$(go run ./cmd/script e2e-tests.sh)" +popd > /dev/null diff --git a/test/unit/scripts/source-library.bash b/test/unit/scripts/source-library.bash index 2da767d6..84314911 100755 --- a/test/unit/scripts/source-library.bash +++ b/test/unit/scripts/source-library.bash @@ -14,4 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -source "$(dirname "${BASH_SOURCE[0]:-$0}")/../../library.sh" +set -Eeuo pipefail + +pushd "$(dirname "${BASH_SOURCE[0]:-$0}")/../.." > /dev/null +# shellcheck disable=SC1090 +source "$(go run ./cmd/script library.sh)" +popd > /dev/null diff --git a/test/unit/scripts/source-presubmit-tests.bash b/test/unit/scripts/source-presubmit-tests.bash index f5bd02f8..60ee69d6 100755 --- a/test/unit/scripts/source-presubmit-tests.bash +++ b/test/unit/scripts/source-presubmit-tests.bash @@ -14,4 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -source "$(dirname "${BASH_SOURCE[0]:-$0}")/../../presubmit-tests.sh" +set -Eeuo pipefail + +pushd "$(dirname "${BASH_SOURCE[0]:-$0}")/../.." > /dev/null +# shellcheck disable=SC1090 +source "$(go run ./cmd/script presubmit-tests.sh)" +popd > /dev/null diff --git a/test/unit/scripts/source-release.bash b/test/unit/scripts/source-release.bash index 0c130ef7..23062b5a 100755 --- a/test/unit/scripts/source-release.bash +++ b/test/unit/scripts/source-release.bash @@ -14,7 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -source "$(dirname "${BASH_SOURCE[0]:-$0}")/../../release.sh" +set -Eeuo pipefail + +pushd "$(dirname "${BASH_SOURCE[0]:-$0}")/../.." > /dev/null +# shellcheck disable=SC1090 +source "$(go run ./cmd/script release.sh)" +popd > /dev/null function build_release() { return 0 diff --git a/test/unit/sharedlib_test.go b/test/unit/sharedlib_test.go index 8c59d3f8..235cbb12 100644 --- a/test/unit/sharedlib_test.go +++ b/test/unit/sharedlib_test.go @@ -253,6 +253,7 @@ func mockGo(responses ...response) scriptlet { callOriginals := []args{ startsWith{"run " + lstags}, startsWith{"run " + modscope}, + startsWith{"run ./"}, startsWith{"list"}, startsWith{"env"}, startsWith{"version"}, diff --git a/test/vendor/github.com/davecgh/go-spew/spew/bypass.go b/test/vendor/github.com/davecgh/go-spew/spew/bypass.go index 70ddeaad..79299478 100644 --- a/test/vendor/github.com/davecgh/go-spew/spew/bypass.go +++ b/test/vendor/github.com/davecgh/go-spew/spew/bypass.go @@ -18,7 +18,6 @@ // tag is deprecated and thus should not be used. // Go versions prior to 1.4 are disabled because they use a different layout // for interfaces which make the implementation of unsafeReflectValue more complex. -//go:build !js && !appengine && !safe && !disableunsafe && go1.4 // +build !js,!appengine,!safe,!disableunsafe,go1.4 package spew diff --git a/test/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/test/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go index 5e2d890d..205c28d6 100644 --- a/test/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go +++ b/test/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go @@ -16,7 +16,6 @@ // when the code is running on Google App Engine, compiled by GopherJS, or // "-tags safe" is added to the go build command line. The "disableunsafe" // tag is deprecated and thus should not be used. -//go:build js || appengine || safe || disableunsafe || !go1.4 // +build js appengine safe disableunsafe !go1.4 package spew diff --git a/test/vendor/github.com/pmezard/go-difflib/difflib/difflib.go b/test/vendor/github.com/pmezard/go-difflib/difflib/difflib.go index 3cfbc1f7..003e99fa 100644 --- a/test/vendor/github.com/pmezard/go-difflib/difflib/difflib.go +++ b/test/vendor/github.com/pmezard/go-difflib/difflib/difflib.go @@ -161,12 +161,12 @@ func (m *SequenceMatcher) chainB() { m.bJunk = map[string]struct{}{} if m.IsJunk != nil { junk := m.bJunk - for s := range b2j { + for s, _ := range b2j { if m.IsJunk(s) { junk[s] = struct{}{} } } - for s := range junk { + for s, _ := range junk { delete(b2j, s) } } @@ -181,7 +181,7 @@ func (m *SequenceMatcher) chainB() { popular[s] = struct{}{} } } - for s := range popular { + for s, _ := range popular { delete(b2j, s) } } @@ -416,7 +416,7 @@ func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode { } codes := m.GetOpCodes() if len(codes) == 0 { - codes = []OpCode{{'e', 0, 1, 0, 1}} + codes = []OpCode{OpCode{'e', 0, 1, 0, 1}} } // Fixup leading and trailing groups if they show no changes. if codes[0].Tag == 'e' { diff --git a/test/vendor/github.com/stretchr/testify/require/require.go b/test/vendor/github.com/stretchr/testify/require/require.go index ffdf0ba5..880853f5 100644 --- a/test/vendor/github.com/stretchr/testify/require/require.go +++ b/test/vendor/github.com/stretchr/testify/require/require.go @@ -6,11 +6,10 @@ package require import ( + assert "github.com/stretchr/testify/assert" http "net/http" url "net/url" time "time" - - assert "github.com/stretchr/testify/assert" ) // Condition uses a Comparison to assert a complex condition. diff --git a/test/vendor/github.com/stretchr/testify/require/require_forward.go b/test/vendor/github.com/stretchr/testify/require/require_forward.go index e334b851..960bf6f2 100644 --- a/test/vendor/github.com/stretchr/testify/require/require_forward.go +++ b/test/vendor/github.com/stretchr/testify/require/require_forward.go @@ -6,11 +6,10 @@ package require import ( + assert "github.com/stretchr/testify/assert" http "net/http" url "net/url" time "time" - - assert "github.com/stretchr/testify/assert" ) // Condition uses a Comparison to assert a complex condition. diff --git a/test/vendor/gopkg.in/yaml.v3/apic.go b/test/vendor/gopkg.in/yaml.v3/apic.go index 05fd305d..ae7d049f 100644 --- a/test/vendor/gopkg.in/yaml.v3/apic.go +++ b/test/vendor/gopkg.in/yaml.v3/apic.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/test/vendor/gopkg.in/yaml.v3/emitterc.go b/test/vendor/gopkg.in/yaml.v3/emitterc.go index f6e50b5b..0f47c9ca 100644 --- a/test/vendor/gopkg.in/yaml.v3/emitterc.go +++ b/test/vendor/gopkg.in/yaml.v3/emitterc.go @@ -241,7 +241,7 @@ func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool emitter.indent += 2 } else { // Everything else aligns to the chosen indentation. - emitter.indent = emitter.best_indent * ((emitter.indent + emitter.best_indent) / emitter.best_indent) + emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent) } } return true diff --git a/test/vendor/gopkg.in/yaml.v3/readerc.go b/test/vendor/gopkg.in/yaml.v3/readerc.go index 56af2453..b7de0a89 100644 --- a/test/vendor/gopkg.in/yaml.v3/readerc.go +++ b/test/vendor/gopkg.in/yaml.v3/readerc.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/test/vendor/gopkg.in/yaml.v3/scannerc.go b/test/vendor/gopkg.in/yaml.v3/scannerc.go index 037fcd53..ca007010 100644 --- a/test/vendor/gopkg.in/yaml.v3/scannerc.go +++ b/test/vendor/gopkg.in/yaml.v3/scannerc.go @@ -2847,7 +2847,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t continue } if parser.buffer[parser.buffer_pos+peek] == '#' { - seen := parser.mark.index + peek + seen := parser.mark.index+peek for { if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false @@ -2876,7 +2876,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t parser.comments = append(parser.comments, yaml_comment_t{ token_mark: token_mark, start_mark: start_mark, - line: text, + line: text, }) } return true @@ -2910,7 +2910,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo // the foot is the line below it. var foot_line = -1 if scan_mark.line > 0 { - foot_line = parser.mark.line - parser.newlines + 1 + foot_line = parser.mark.line-parser.newlines+1 if parser.newlines == 0 && parser.mark.column > 1 { foot_line++ } @@ -2996,7 +2996,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo recent_empty = false // Consume until after the consumed comment line. - seen := parser.mark.index + peek + seen := parser.mark.index+peek for { if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false diff --git a/test/vendor/gopkg.in/yaml.v3/writerc.go b/test/vendor/gopkg.in/yaml.v3/writerc.go index 266d0b09..b8a116bf 100644 --- a/test/vendor/gopkg.in/yaml.v3/writerc.go +++ b/test/vendor/gopkg.in/yaml.v3/writerc.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/test/vendor/gopkg.in/yaml.v3/yaml.go b/test/vendor/gopkg.in/yaml.v3/yaml.go index 3ba221c2..8cec6da4 100644 --- a/test/vendor/gopkg.in/yaml.v3/yaml.go +++ b/test/vendor/gopkg.in/yaml.v3/yaml.go @@ -363,7 +363,7 @@ const ( // Address yaml.Node // } // err := yaml.Unmarshal(data, &person) -// +// // Or by itself: // // var person Node @@ -373,7 +373,7 @@ type Node struct { // Kind defines whether the node is a document, a mapping, a sequence, // a scalar value, or an alias to another node. The specific data type of // scalar nodes may be obtained via the ShortTag and LongTag methods. - Kind Kind + Kind Kind // Style allows customizing the apperance of the node in the tree. Style Style @@ -421,6 +421,7 @@ func (n *Node) IsZero() bool { n.HeadComment == "" && n.LineComment == "" && n.FootComment == "" && n.Line == 0 && n.Column == 0 } + // LongTag returns the long form of the tag that indicates the data type for // the node. If the Tag field isn't explicitly defined, one will be computed // based on the node properties. diff --git a/test/vendor/gopkg.in/yaml.v3/yamlh.go b/test/vendor/gopkg.in/yaml.v3/yamlh.go index 9e9afc9e..7c6d0077 100644 --- a/test/vendor/gopkg.in/yaml.v3/yamlh.go +++ b/test/vendor/gopkg.in/yaml.v3/yamlh.go @@ -639,6 +639,7 @@ type yaml_parser_t struct { } type yaml_comment_t struct { + scan_mark yaml_mark_t // Position where scanning for comments started token_mark yaml_mark_t // Position after which tokens will be associated with this comment start_mark yaml_mark_t // Position of '#' comment mark diff --git a/test/vendor/gopkg.in/yaml.v3/yamlprivateh.go b/test/vendor/gopkg.in/yaml.v3/yamlprivateh.go index dea1ba96..e88f9c54 100644 --- a/test/vendor/gopkg.in/yaml.v3/yamlprivateh.go +++ b/test/vendor/gopkg.in/yaml.v3/yamlprivateh.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -137,8 +137,8 @@ func is_crlf(b []byte, i int) bool { func is_breakz(b []byte, i int) bool { //return is_break(b, i) || is_z(b, i) return ( - // is_break: - b[i] == '\r' || // CR (#xD) + // is_break: + b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) @@ -151,8 +151,8 @@ func is_breakz(b []byte, i int) bool { func is_spacez(b []byte, i int) bool { //return is_space(b, i) || is_breakz(b, i) return ( - // is_space: - b[i] == ' ' || + // is_space: + b[i] == ' ' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) @@ -166,8 +166,8 @@ func is_spacez(b []byte, i int) bool { func is_blankz(b []byte, i int) bool { //return is_blank(b, i) || is_breakz(b, i) return ( - // is_blank: - b[i] == ' ' || b[i] == '\t' || + // is_blank: + b[i] == ' ' || b[i] == '\t' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) From ff34f1e9892781ce7373491f288b779a34037719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20Suszy=C5=84ski?= Date: Thu, 3 Nov 2022 14:56:48 +0100 Subject: [PATCH 5/7] TestExtract should not check exact sizes of extracted files --- pkg/inflator/extract/extract_test.go | 32 ++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/pkg/inflator/extract/extract_test.go b/pkg/inflator/extract/extract_test.go index 522655b6..da46ac95 100644 --- a/pkg/inflator/extract/extract_test.go +++ b/pkg/inflator/extract/extract_test.go @@ -3,6 +3,7 @@ package extract_test import ( "bytes" "fmt" + "regexp" "strings" "testing" @@ -21,24 +22,26 @@ func TestExtract(t *testing.T) { prtr := &testPrinter{} err := op.Extract(prtr) require.NoError(t, err) + errOut := standarizeErrOut(prtr.err.String(), tmpdir) assert.Equal(t, prtr.out.String(), tmpdir+"/library.sh\n") assert.Equal(t, `[hack] Extracting hack scripts to directory: /tmp/x -[hack] codegen-library.sh 1 KiB + -[hack] e2e-tests.sh 6 KiB ++ -[hack] infra-library.sh 5 KiB + -[hack] library.sh 33 KiB +++++++ -[hack] microbenchmarks.sh 2 KiB + -[hack] performance-tests.sh 6 KiB ++ -[hack] presubmit-tests.sh 12 KiB +++ -[hack] release.sh 27 KiB ++++++ -[hack] shellcheck-presubmit.sh 1 KiB + -`, strings.ReplaceAll(prtr.err.String(), tmpdir, "/tmp/x")) +[hack] codegen-library.sh +[hack] e2e-tests.sh +[hack] infra-library.sh +[hack] library.sh +[hack] microbenchmarks.sh +[hack] performance-tests.sh +[hack] presubmit-tests.sh +[hack] release.sh +[hack] shellcheck-presubmit.sh +`, errOut) // second time should be a no-op prtr = &testPrinter{} err = op.Extract(prtr) require.NoError(t, err) + errOut = standarizeErrOut(prtr.err.String(), tmpdir) assert.Equal(t, prtr.out.String(), tmpdir+"/library.sh\n") assert.Equal(t, `[hack] Extracting hack scripts to directory: /tmp/x @@ -51,7 +54,14 @@ func TestExtract(t *testing.T) { [hack] presubmit-tests.sh up-to-date [hack] release.sh up-to-date [hack] shellcheck-presubmit.sh up-to-date -`, strings.ReplaceAll(prtr.err.String(), tmpdir, "/tmp/x")) +`, errOut) +} + +func standarizeErrOut(errOut string, tmpdir string) string { + errOut = strings.ReplaceAll(errOut, tmpdir, "/tmp/x") + re := regexp.MustCompile(`\s+\d+ KiB \++`) + errOut = re.ReplaceAllString(errOut, "") + return errOut } type testPrinter struct { From 85b3565837bcd4676630a023e71fc31b1fd004b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20Suszy=C5=84ski?= Date: Thu, 3 Nov 2022 15:19:43 +0100 Subject: [PATCH 6/7] Ensure the manual verbose is set for all unit tests --- test/unit/scripts/fake-prow-job.bash | 1 - test/unit/sharedlib_test.go | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/scripts/fake-prow-job.bash b/test/unit/scripts/fake-prow-job.bash index acd308f4..c777936a 100644 --- a/test/unit/scripts/fake-prow-job.bash +++ b/test/unit/scripts/fake-prow-job.bash @@ -20,4 +20,3 @@ if [[ -z "${PROW_JOB_ID:-}" ]]; then export JOB_TYPE='presubmit' export PULL_PULL_SHA='deadbeef1234567890' fi -export KNATIVE_HACK_SCRIPT_MANUAL_VERBOSE=true diff --git a/test/unit/sharedlib_test.go b/test/unit/sharedlib_test.go index 235cbb12..c182be52 100644 --- a/test/unit/sharedlib_test.go +++ b/test/unit/sharedlib_test.go @@ -333,6 +333,7 @@ func (s shellScript) source(t TestingT, commands []string) string { set -Eeuo pipefail export TMPPATH='%s' export PATH="${TMPPATH}:${PATH}" +export KNATIVE_HACK_SCRIPT_MANUAL_VERBOSE=true `, t.TempDir()) bashShebang := "#!/usr/bin/env bash\n" for _, sclet := range s.scriptlets { From 59b22315bfb1ee2b85ee91293166f9915c6cf8f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20Suszy=C5=84ski?= Date: Tue, 5 Sep 2023 19:27:42 +0200 Subject: [PATCH 7/7] Default E2E_CLUSTER_REGION us-central1 to simplify unit testing --- infra-library.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra-library.sh b/infra-library.sh index 4782d09a..adc37efe 100644 --- a/infra-library.sh +++ b/infra-library.sh @@ -157,7 +157,7 @@ function create_gke_test_cluster() { --v=1 \ --network=e2e-network \ --boskos-acquire-timeout-seconds=1200 \ - --region="${E2E_CLUSTER_REGION},us-east1,us-west1" \ + --region="${E2E_CLUSTER_REGION:-us-central1},us-east1,us-west1" \ --gcloud-extra-flags="${_extra_gcloud_flags[*]}" \ --retryable-error-patterns='.*does not have enough resources available to fulfill.*,.*only \\d+ nodes out of \\d+ have registered; this is likely due to Nodes failing to start correctly.*,.*All cluster resources were brought up.+ but: component .+ from endpoint .+ is unhealthy.*' \ --test=exec \