mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-12 13:31:52 +00:00
chore: adds consistent vanity import to files and provides tooling for verifying and updating them. (#120642)
* chore: drops update vanity imports from script. * chore: changes copyright year to 2024. * chore: makes lint happy.
This commit is contained in:
parent
f07b47c3d1
commit
6d6398ef92
@ -8,6 +8,7 @@ require (
|
||||
github.com/client9/misspell v0.3.4
|
||||
github.com/golang/mock v1.6.0
|
||||
github.com/golangci/golangci-lint v1.55.2
|
||||
github.com/jcchavezs/porto v0.6.0
|
||||
go.uber.org/automaxprocs v1.5.2
|
||||
gotest.tools/gotestsum v1.6.4
|
||||
honnef.co/go/tools v0.4.6
|
||||
|
@ -318,6 +318,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/jcchavezs/porto v0.6.0 h1:AgQLGwsXaxDkPj4Y+paFkVGLAR4n/1RRF0xV5UKinwg=
|
||||
github.com/jcchavezs/porto v0.6.0/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A=
|
||||
github.com/jgautheron/goconst v1.6.0 h1:gbMLWKRMkzAc6kYsQL6/TxaoBUg3Jm9LSF/Ih1ADWGA=
|
||||
github.com/jgautheron/goconst v1.6.0/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4=
|
||||
github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs=
|
||||
@ -530,6 +532,7 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
_ "github.com/aojea/sloppy-netparser"
|
||||
_ "github.com/client9/misspell/cmd/misspell"
|
||||
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
|
||||
_ "github.com/jcchavezs/porto/cmd/porto"
|
||||
_ "honnef.co/go/tools/cmd/staticcheck"
|
||||
_ "sigs.k8s.io/logtools/logcheck"
|
||||
|
||||
|
34
hack/update-vanity-imports.sh
Executable file
34
hack/update-vanity-imports.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2024 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.
|
||||
|
||||
# This script fixes the vanity imports programmatically.
|
||||
# Usage: `hack/update-vanity-imports.sh`.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::golang::verify_go_version
|
||||
|
||||
pushd "${KUBE_ROOT}/hack/tools" >/dev/null
|
||||
GO111MODULE=on go install github.com/jcchavezs/porto/cmd/porto
|
||||
popd >/dev/null
|
||||
|
||||
porto --restrict-to-dirs="staging" --restrict-to-files="doc\\.go$" -w "${KUBE_ROOT}"
|
||||
|
@ -18,4 +18,4 @@ limitations under the License.
|
||||
// +groupName=cr.example.apiextensions.k8s.io
|
||||
|
||||
// Package v1 is the v1 version of the API.
|
||||
package v1
|
||||
package v1 // import "k8s.io/apiextensions-apiserver/examples/client-go/pkg/apis/cr/v1"
|
||||
|
@ -15,4 +15,4 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
// openapi generated definitions.
|
||||
package openapi
|
||||
package openapi // import "k8s.io/apiextensions-apiserver/pkg/generated/openapi"
|
||||
|
@ -16,4 +16,4 @@ limitations under the License.
|
||||
|
||||
// Package sets has generic set and specified sets. Generic set will
|
||||
// replace specified ones over time. And specific ones are deprecated.
|
||||
package sets
|
||||
package sets // import "k8s.io/apimachinery/pkg/util/sets"
|
||||
|
@ -16,4 +16,4 @@ limitations under the License.
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
|
||||
package webhookadmission
|
||||
package webhookadmission // import "k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission"
|
||||
|
@ -20,4 +20,4 @@ limitations under the License.
|
||||
// +groupName=apiserver.config.k8s.io
|
||||
|
||||
// Package v1 is the v1 version of the API.
|
||||
package v1
|
||||
package v1 // import "k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1"
|
||||
|
@ -20,4 +20,4 @@ limitations under the License.
|
||||
// +groupName=apiserver.config.k8s.io
|
||||
|
||||
// Package v1alpha1 is the v1alpha1 version of the API.
|
||||
package v1alpha1
|
||||
package v1alpha1 // import "k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1"
|
||||
|
@ -116,4 +116,4 @@ limitations under the License.
|
||||
// queue’s virtual start time is advanced by G. When a request
|
||||
// finishes being served, and the actual service time was S, the
|
||||
// queue’s virtual start time is decremented by G - S.
|
||||
package queueset
|
||||
package queueset // import "k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset"
|
||||
|
@ -148,4 +148,4 @@ reconciliation code that performs a "read/modify-in-place/update" (or patch) wor
|
||||
// apply
|
||||
applied, err := deploymentClient.Apply(ctx, extractedDeployment, metav1.ApplyOptions{FieldManager: fieldMgr})
|
||||
*/
|
||||
package applyconfigurations
|
||||
package applyconfigurations // import "k8s.io/client-go/applyconfigurations"
|
||||
|
@ -17,4 +17,4 @@ limitations under the License.
|
||||
// Package fakeclient contains examples on how to use fakeclient in tests.
|
||||
// Note: This file is here to avoid warnings on go build since there are no
|
||||
// non-test files in this package.
|
||||
package fakeclient
|
||||
package fakeclient // import "k8s.io/client-go/examples/fake-client"
|
||||
|
@ -15,4 +15,4 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
// Package informers provides generated informers for Kubernetes APIs.
|
||||
package informers
|
||||
package informers // import "k8s.io/client-go/informers"
|
||||
|
@ -16,4 +16,4 @@ limitations under the License.
|
||||
|
||||
// Package kubernetes holds packages which implement a clientset for Kubernetes
|
||||
// APIs.
|
||||
package kubernetes
|
||||
package kubernetes // import "k8s.io/client-go/kubernetes"
|
||||
|
@ -15,4 +15,4 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
// Package listers provides generated listers for Kubernetes APIs.
|
||||
package listers
|
||||
package listers // import "k8s.io/client-go/listers"
|
||||
|
@ -19,4 +19,4 @@ limitations under the License.
|
||||
// It doesn't have any of its own types -- it's just necessary to
|
||||
// get the expected behavior out of runtime.Scheme.ConvertToVersion
|
||||
// and associated methods.
|
||||
package appsint
|
||||
package appsint // import "k8s.io/client-go/scale/scheme/appsint"
|
||||
|
@ -19,4 +19,4 @@ limitations under the License.
|
||||
// Package scheme contains a runtime.Scheme to be used for serializing
|
||||
// and deserializing different versions of Scale, and for converting
|
||||
// in between them.
|
||||
package scheme
|
||||
package scheme // import "k8s.io/client-go/scale/scheme"
|
||||
|
@ -19,4 +19,4 @@ limitations under the License.
|
||||
// It doesn't have any of its own types -- it's just necessary to
|
||||
// get the expected behavior out of runtime.Scheme.ConvertToVersion
|
||||
// and associated methods.
|
||||
package extensionsint
|
||||
package extensionsint // import "k8s.io/client-go/scale/scheme/extensionsint"
|
||||
|
@ -16,4 +16,4 @@ limitations under the License.
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
|
||||
package api
|
||||
package api // import "k8s.io/client-go/tools/clientcmd/api"
|
||||
|
@ -18,4 +18,4 @@ limitations under the License.
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:defaulter-gen=Kind
|
||||
|
||||
package v1
|
||||
package v1 // import "k8s.io/client-go/tools/clientcmd/api/v1"
|
||||
|
@ -18,4 +18,4 @@ limitations under the License.
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=example-group.hyphens.code-generator.k8s.io
|
||||
// +groupGoName=ExampleGroup
|
||||
package v1
|
||||
package v1 // import "k8s.io/code-generator/examples/HyphenGroup/apis/example/v1"
|
||||
|
@ -17,4 +17,4 @@ limitations under the License.
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=example.crd.code-generator.k8s.io
|
||||
package v1
|
||||
package v1 // import "k8s.io/code-generator/examples/MixedCase/apis/example/v1"
|
||||
|
@ -20,4 +20,4 @@ limitations under the License.
|
||||
// +k8s:conversion-gen=k8s.io/code-generator/examples/apiserver/apis/example
|
||||
// +groupName=example.apiserver.code-generator.k8s.io
|
||||
|
||||
package v1
|
||||
package v1 // import "k8s.io/code-generator/examples/apiserver/apis/example/v1"
|
||||
|
@ -21,4 +21,4 @@ limitations under the License.
|
||||
// +k8s:conversion-gen=k8s.io/code-generator/examples/apiserver/apis/example2
|
||||
// +groupGoName=SecondExample
|
||||
|
||||
package v1
|
||||
package v1 // import "k8s.io/code-generator/examples/apiserver/apis/example2/v1"
|
||||
|
@ -21,4 +21,4 @@ limitations under the License.
|
||||
// +k8s:conversion-gen=k8s.io/code-generator/examples/apiserver/apis/example3.io
|
||||
// +groupGoName=ThirdExample
|
||||
|
||||
package v1
|
||||
package v1 // import "k8s.io/code-generator/examples/apiserver/apis/example3.io/v1"
|
||||
|
@ -18,4 +18,4 @@ limitations under the License.
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=example.crd.code-generator.k8s.io
|
||||
|
||||
package v1
|
||||
package v1 // import "k8s.io/code-generator/examples/crd/apis/example/v1"
|
||||
|
@ -19,4 +19,4 @@ limitations under the License.
|
||||
// +groupName=example.test.crd.code-generator.k8s.io
|
||||
// +groupGoName=SecondExample
|
||||
|
||||
package v1
|
||||
package v1 // import "k8s.io/code-generator/examples/crd/apis/example2/v1"
|
||||
|
@ -16,4 +16,4 @@ limitations under the License.
|
||||
|
||||
// Package kubeletplugin provides helper functions for running a dynamic
|
||||
// resource allocation kubelet plugin.
|
||||
package kubeletplugin
|
||||
package kubeletplugin // import "k8s.io/dynamic-resource-allocation/kubeletplugin"
|
||||
|
@ -15,4 +15,4 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
// Package env provides functions to incorporate environment variables into set env.
|
||||
package env
|
||||
package env // import "k8s.io/kubectl/pkg/cmd/set/env"
|
||||
|
@ -18,4 +18,4 @@ limitations under the License.
|
||||
// from a Kubernetes server and then indexing the type definitions.
|
||||
// The openapi spec contains the object model definitions and extensions metadata
|
||||
// such as the patchStrategy and patchMergeKey for creating patches.
|
||||
package openapi // k8s.io/kubectl/pkg/util/openapi
|
||||
package openapi // import "k8s.io/kubectl/pkg/util/openapi"
|
||||
|
@ -15,4 +15,4 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
// Package remotecommand contains functions related to executing commands in and attaching to pods.
|
||||
package remotecommand
|
||||
package remotecommand // import "k8s.io/kubelet/pkg/cri/streaming/remotecommand"
|
||||
|
@ -17,4 +17,4 @@ limitations under the License.
|
||||
// +k8s:deepcopy-gen=package
|
||||
|
||||
// Package api contains PodSecurity admission configuration file types
|
||||
package api
|
||||
package api // import "k8s.io/pod-security-admission/admission/api"
|
||||
|
@ -20,4 +20,4 @@ limitations under the License.
|
||||
// +groupName=pod-security.admission.config.k8s.io
|
||||
|
||||
// Package v1 contains PodSecurity admission configuration file types
|
||||
package v1
|
||||
package v1 // import "k8s.io/pod-security-admission/admission/api/v1"
|
||||
|
@ -20,4 +20,4 @@ limitations under the License.
|
||||
// +groupName=pod-security.admission.config.k8s.io
|
||||
|
||||
// Package v1alpha1 contains PodSecurity admission configuration file types
|
||||
package v1alpha1
|
||||
package v1alpha1 // import "k8s.io/pod-security-admission/admission/api/v1alpha1"
|
||||
|
@ -20,4 +20,4 @@ limitations under the License.
|
||||
// +groupName=pod-security.admission.config.k8s.io
|
||||
|
||||
// Package v1beta1 contains PodSecurity admission configuration file types
|
||||
package v1beta1
|
||||
package v1beta1 // import "k8s.io/pod-security-admission/admission/api/v1beta1"
|
||||
|
@ -15,4 +15,4 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
// Package admission contains PodSecurity admission logic
|
||||
package admission
|
||||
package admission // import "k8s.io/pod-security-admission/admission"
|
||||
|
Loading…
Reference in New Issue
Block a user