diff --git a/go.mod b/go.mod index d30d9869..f338cf10 100644 --- a/go.mod +++ b/go.mod @@ -36,8 +36,8 @@ require ( k8s.io/code-generator v0.16.5-beta.1 k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf k8s.io/utils v0.0.0-20190907131718-3d4f5b7dea0b // indirect - knative.dev/pkg v0.0.0-20200427190051-6b9ee63b4aad - knative.dev/test-infra v0.0.0-20200424202250-e6e89d29e93a + knative.dev/pkg v0.0.0-20200428133551-22b961371934 + knative.dev/test-infra v0.0.0-20200427211351-bf3e6802597a ) replace ( diff --git a/go.sum b/go.sum index 487a5d7a..3dc5c70d 100644 --- a/go.sum +++ b/go.sum @@ -446,10 +446,10 @@ k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf/go.mod h1:1TqjTSzOxsLGIKf k8s.io/utils v0.0.0-20190801114015-581e00157fb1/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= k8s.io/utils v0.0.0-20190907131718-3d4f5b7dea0b h1:eMM0sTvh3KBVGwJfuNcU86P38TJhlVMAICbFPDG3t0M= k8s.io/utils v0.0.0-20190907131718-3d4f5b7dea0b/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= -knative.dev/pkg v0.0.0-20200427190051-6b9ee63b4aad h1:NpDDOgClFe9Y7XAOiEP+84ByR8NPfEEj0P/zCh+ZbsA= -knative.dev/pkg v0.0.0-20200427190051-6b9ee63b4aad/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q= -knative.dev/test-infra v0.0.0-20200424202250-e6e89d29e93a h1:O+N0J0RiB3tbYws4Bt0RHE+74N2L01eX2BruW/8pNtU= -knative.dev/test-infra v0.0.0-20200424202250-e6e89d29e93a/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ= +knative.dev/pkg v0.0.0-20200428133551-22b961371934 h1:Bf6KxWNHHTqZYT7e3EeML4lRGviYEAwmMnQEHIR/5CE= +knative.dev/pkg v0.0.0-20200428133551-22b961371934/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q= +knative.dev/test-infra v0.0.0-20200427211351-bf3e6802597a h1:ZgCkn1yvDHHU9LBc4E+Hfeg4LeHu46PhnHzAD7uSAHY= +knative.dev/test-infra v0.0.0-20200427211351-bf3e6802597a/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ= modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= diff --git a/vendor/knative.dev/pkg/injection/context.go b/vendor/knative.dev/pkg/injection/context.go index 38c413e4..4594ebeb 100644 --- a/vendor/knative.dev/pkg/injection/context.go +++ b/vendor/knative.dev/pkg/injection/context.go @@ -18,6 +18,8 @@ package injection import ( "context" + + "k8s.io/client-go/rest" ) // nsKey is the key that namespaces are associated with on @@ -47,3 +49,20 @@ func GetNamespaceScope(ctx context.Context) string { } return value.(string) } + +// cfgKey is the key that the config is associated with. +type cfgKey struct{} + +// WithConfig associates a given config with the context. +func WithConfig(ctx context.Context, cfg *rest.Config) context.Context { + return context.WithValue(ctx, cfgKey{}, cfg) +} + +// GetConfig gets the current config from the context. +func GetConfig(ctx context.Context) *rest.Config { + value := ctx.Value(cfgKey{}) + if value == nil { + return nil + } + return value.(*rest.Config) +} diff --git a/vendor/knative.dev/pkg/metrics/stackdriver_exporter.go b/vendor/knative.dev/pkg/metrics/stackdriver_exporter.go index 90122f6f..e87a3e37 100644 --- a/vendor/knative.dev/pkg/metrics/stackdriver_exporter.go +++ b/vendor/knative.dev/pkg/metrics/stackdriver_exporter.go @@ -227,7 +227,7 @@ func getStackdriverSecret(sdconfig *StackdriverClientConfig) (*corev1.Secret, er sec, secErr := kubeclient.CoreV1().Secrets(secretNamespace).Get(secretName, metav1.GetOptions{}) if secErr != nil { - return nil, fmt.Errorf("Error getting Secret [%v] in namespace [%v]: %v", secretName, secretNamespace, secErr) + return nil, fmt.Errorf("Error getting Secret [%s] in namespace [%s]: %w", secretName, secretNamespace, secErr) } return sec, nil @@ -238,7 +238,7 @@ func convertSecretToExporterOption(secret *corev1.Secret) (option.ClientOption, if data, ok := secret.Data[secretDataFieldKey]; ok { return option.WithCredentialsJSON(data), nil } - return nil, fmt.Errorf("Expected Secret to store key in data field named [%v]", secretDataFieldKey) + return nil, fmt.Errorf("Expected Secret to store key in data field named [%s]", secretDataFieldKey) } // ensureKubeclient is the lazy initializer for kubeclient. diff --git a/vendor/knative.dev/test-infra/scripts/library.sh b/vendor/knative.dev/test-infra/scripts/library.sh index 440394e4..2c099edd 100644 --- a/vendor/knative.dev/test-infra/scripts/library.sh +++ b/vendor/knative.dev/test-infra/scripts/library.sh @@ -479,22 +479,20 @@ function start_latest_knative_eventing() { # $3..$n - parameters passed to the tool. function run_go_tool() { local tool=$2 - if [[ -z "$(which ${tool})" ]]; then - local action=get - [[ $1 =~ ^[\./].* ]] && action=install - # Avoid running `go get` from root dir of the repository, as it can change go.sum and go.mod files. - # See discussions in https://github.com/golang/go/issues/27643. - if [[ ${action} == "get" && $(pwd) == "${REPO_ROOT_DIR}" ]]; then - local temp_dir="$(mktemp -d)" - local install_failed=0 - # Swallow the output as we are returning the stdout in the end. - pushd "${temp_dir}" > /dev/null 2>&1 - GOFLAGS="" go ${action} $1 || install_failed=1 - popd > /dev/null 2>&1 - (( install_failed )) && return ${install_failed} - else - GOFLAGS="" go ${action} $1 - fi + local action=get + [[ $1 =~ ^[\./].* ]] && action=install + # Avoid running `go get` from root dir of the repository, as it can change go.sum and go.mod files. + # See discussions in https://github.com/golang/go/issues/27643. + if [[ ${action} == "get" && $(pwd) == "${REPO_ROOT_DIR}" ]]; then + local temp_dir="$(mktemp -d)" + local install_failed=0 + # Swallow the output as we are returning the stdout in the end. + pushd "${temp_dir}" > /dev/null 2>&1 + GOFLAGS="" go ${action} $1 || install_failed=1 + popd > /dev/null 2>&1 + (( install_failed )) && return ${install_failed} + else + GOFLAGS="" go ${action} $1 fi shift 2 ${tool} "$@" diff --git a/vendor/modules.txt b/vendor/modules.txt index a9ff2bfe..8d5cfd09 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -645,7 +645,7 @@ k8s.io/kube-openapi/pkg/util/sets k8s.io/utils/buffer k8s.io/utils/integer k8s.io/utils/trace -# knative.dev/pkg v0.0.0-20200427190051-6b9ee63b4aad +# knative.dev/pkg v0.0.0-20200428133551-22b961371934 knative.dev/pkg/apis knative.dev/pkg/changeset knative.dev/pkg/codegen/cmd/injection-gen @@ -662,7 +662,7 @@ knative.dev/pkg/logging/logkey knative.dev/pkg/metrics knative.dev/pkg/metrics/metricskey knative.dev/pkg/reconciler -# knative.dev/test-infra v0.0.0-20200424202250-e6e89d29e93a +# knative.dev/test-infra v0.0.0-20200427211351-bf3e6802597a knative.dev/test-infra/scripts knative.dev/test-infra/tools/dep-collector # sigs.k8s.io/yaml v1.1.0