From 73abb160b576fd3e10c8ac381be242bb16c78215 Mon Sep 17 00:00:00 2001 From: minikube-bot Date: Mon, 8 Aug 2022 10:02:18 +0000 Subject: [PATCH 1/2] bump golint versions --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 924655be04..a1d1e11718 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ MINIKUBE_RELEASES_URL=https://github.com/kubernetes/minikube/releases/download KERNEL_VERSION ?= 5.10.57 # latest from https://github.com/golangci/golangci-lint/releases # update this only by running `make update-golint-version` -GOLINT_VERSION ?= v1.47.2 +GOLINT_VERSION ?= v1.48.0 # Limit number of default jobs, to avoid the CI builds running out of memory GOLINT_JOBS ?= 4 # see https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint From 744187868db57d098ebc1263497059fa565a45d5 Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Mon, 8 Aug 2022 09:29:19 -0700 Subject: [PATCH 2/2] fix linting --- cmd/performance/pr-bot/bot.go | 6 +++--- deploy/minikube/release_sanity_test.go | 6 ++++-- .../test-flake-chart/compute_flake_rate.go | 15 ++++++++------- .../golint_version/update_golint_version.go | 1 - pkg/drivers/kic/oci/types.go | 19 +++++++++++-------- pkg/gvisor/enable.go | 13 +++++++------ .../bootstrapper/bsutil/kubeadm_test.go | 3 ++- .../bootstrapper/bsutil/kverify/kverify.go | 2 +- pkg/minikube/cni/calico.go | 1 + pkg/minikube/image/image.go | 9 +++++---- pkg/minikube/machine/info.go | 4 ++-- pkg/minikube/tunnel/route_windows_test.go | 2 +- pkg/network/network.go | 10 ++++++---- test/integration/json_output_test.go | 2 +- test/integration/start_stop_delete_test.go | 11 +++++++---- translations/translations.go | 1 + 16 files changed, 60 insertions(+), 45 deletions(-) diff --git a/cmd/performance/pr-bot/bot.go b/cmd/performance/pr-bot/bot.go index 340c4ef8f4..106c446f4b 100644 --- a/cmd/performance/pr-bot/bot.go +++ b/cmd/performance/pr-bot/bot.go @@ -37,9 +37,9 @@ func main() { } // analyzePerformance is responsible for: -// 1. collecting PRs to run performance analysis on -// 2. running mkcmp against those PRs -// 3. commenting results on those PRs +// 1. collecting PRs to run performance analysis on +// 2. running mkcmp against those PRs +// 3. commenting results on those PRs func analyzePerformance(ctx context.Context) error { client := monitor.NewClient(ctx, monitor.GithubOwner, monitor.GithubRepo) prs, err := client.ListOpenPRsWithLabel(monitor.OkToTestLabel) diff --git a/deploy/minikube/release_sanity_test.go b/deploy/minikube/release_sanity_test.go index 4dd248dae0..d1663c8ccc 100644 --- a/deploy/minikube/release_sanity_test.go +++ b/deploy/minikube/release_sanity_test.go @@ -46,7 +46,8 @@ func getSHAFromURL(url string) (string, error) { } // TestReleasesJSON checks if all *GA* releases -// enlisted in https://storage.googleapis.com/minikube/releases.json +// +// enlisted in https://storage.googleapis.com/minikube/releases.json // are available to download and have correct hashsum func TestReleasesJSON(t *testing.T) { releases, err := notify.AllVersionsFromURL(notify.GithubMinikubeReleasesURL) @@ -57,7 +58,8 @@ func TestReleasesJSON(t *testing.T) { } // TestBetaReleasesJSON checks if all *BETA* releases -// enlisted in https://storage.googleapis.com/minikube/releases-beta.json +// +// enlisted in https://storage.googleapis.com/minikube/releases-beta.json // are available to download and have correct hashsum func TestBetaReleasesJSON(t *testing.T) { releases, err := notify.AllVersionsFromURL(notify.GithubMinikubeBetaReleasesURL) diff --git a/hack/jenkins/test-flake-chart/compute_flake_rate.go b/hack/jenkins/test-flake-chart/compute_flake_rate.go index 03142cef2b..ca60f3df74 100644 --- a/hack/jenkins/test-flake-chart/compute_flake_rate.go +++ b/hack/jenkins/test-flake-chart/compute_flake_rate.go @@ -58,13 +58,14 @@ func main() { } // One entry of a test run. -// Example: TestEntry { -// name: "TestFunctional/parallel/LogsCmd", -// environment: "Docker_Linux", -// date: time.Now, -// status: "Passed", -// duration: 0.1, -// } +// +// Example: TestEntry { +// name: "TestFunctional/parallel/LogsCmd", +// environment: "Docker_Linux", +// date: time.Now, +// status: "Passed", +// duration: 0.1, +// } type testEntry struct { name string environment string diff --git a/hack/update/golint_version/update_golint_version.go b/hack/update/golint_version/update_golint_version.go index 5c8d38a043..b748e9edb9 100644 --- a/hack/update/golint_version/update_golint_version.go +++ b/hack/update/golint_version/update_golint_version.go @@ -62,7 +62,6 @@ func main() { update.Apply(schema, data) } -// // golintVersions returns stable version in semver format. func golintVersion(ctx context.Context, owner, repo string) (stable string, err error) { // get Kubernetes versions from GitHub Releases diff --git a/pkg/drivers/kic/oci/types.go b/pkg/drivers/kic/oci/types.go index 6b97fe36c9..0b0efb471d 100644 --- a/pkg/drivers/kic/oci/types.go +++ b/pkg/drivers/kic/oci/types.go @@ -84,11 +84,13 @@ https://github.com/kubernetes/kubernetes/blob/063e7ff358fdc8b0916e6f39beedc0d025 // names on disk as opposed to the int32 values, and the serlialzed field names // have been made closer to core/v1 VolumeMount field names // In yaml this looks like: -// containerPath: /foo -// hostPath: /bar -// readOnly: true -// selinuxRelabel: false -// propagation: None +// +// containerPath: /foo +// hostPath: /bar +// readOnly: true +// selinuxRelabel: false +// propagation: None +// // Propagation may be one of: None, HostToContainer, Bidirectional type Mount struct { // Path of the mount within the container. @@ -158,9 +160,10 @@ func ParseMountString(spec string) (m Mount, err error) { // PortMapping specifies a host port mapped into a container port. // In yaml this looks like: -// containerPort: 80 -// hostPort: 8000 -// listenAddress: 127.0.0.1 +// +// containerPort: 80 +// hostPort: 8000 +// listenAddress: 127.0.0.1 type PortMapping struct { // Port within the container. ContainerPort int32 `protobuf:"varint,1,opt,name=container_port,json=containerPort,proto3" json:"containerPort,omitempty"` diff --git a/pkg/gvisor/enable.go b/pkg/gvisor/enable.go index 51200c5d1a..ec74c749f5 100644 --- a/pkg/gvisor/enable.go +++ b/pkg/gvisor/enable.go @@ -43,10 +43,10 @@ const ( ) // Enable follows these steps for enabling gvisor in minikube: -// 1. creates necessary directories for storing binaries and runsc logs -// 2. downloads runsc and gvisor-containerd-shim -// 3. copies necessary containerd config files -// 4. restarts containerd +// 1. creates necessary directories for storing binaries and runsc logs +// 2. downloads runsc and gvisor-containerd-shim +// 3. copies necessary containerd config files +// 4. restarts containerd func Enable() error { if err := makeGvisorDirs(); err != nil { return errors.Wrap(err, "creating directories on node") @@ -149,8 +149,9 @@ func downloadFileToDest(url, dest string) error { } // Must write the following files: -// 1. gvisor-containerd-shim.toml -// 2. gvisor containerd config.toml +// 1. gvisor-containerd-shim.toml +// 2. gvisor containerd config.toml +// // and save the default version of config.toml func copyConfigFiles() error { log.Printf("Storing default config.toml at %s", storedContainerdConfigTomlPath) diff --git a/pkg/minikube/bootstrapper/bsutil/kubeadm_test.go b/pkg/minikube/bootstrapper/bsutil/kubeadm_test.go index ea67f7331f..baa9cebe81 100644 --- a/pkg/minikube/bootstrapper/bsutil/kubeadm_test.go +++ b/pkg/minikube/bootstrapper/bsutil/kubeadm_test.go @@ -122,7 +122,8 @@ func recentReleases(n int) ([]string, error) { return versions, nil } -/** +/* +* This test case has only 1 thing to test and that is the networking/dnsDomain value */ diff --git a/pkg/minikube/bootstrapper/bsutil/kverify/kverify.go b/pkg/minikube/bootstrapper/bsutil/kverify/kverify.go index f938a550d2..08fc7872ad 100644 --- a/pkg/minikube/bootstrapper/bsutil/kverify/kverify.go +++ b/pkg/minikube/bootstrapper/bsutil/kverify/kverify.go @@ -41,7 +41,7 @@ const ( ExtraKey = "extra" ) -// vars related to the --wait flag +// vars related to the --wait flag var ( // DefaultComponents is map of the the default components to wait for DefaultComponents = map[string]bool{APIServerWaitKey: true, SystemPodsWaitKey: true} diff --git a/pkg/minikube/cni/calico.go b/pkg/minikube/cni/calico.go index 9d5ec46287..cd8827311b 100644 --- a/pkg/minikube/cni/calico.go +++ b/pkg/minikube/cni/calico.go @@ -29,6 +29,7 @@ import ( ) // https://docs.projectcalico.org/manifests/calico.yaml +// //go:embed calico.yaml var calicoYaml string diff --git a/pkg/minikube/image/image.go b/pkg/minikube/image/image.go index b66b240acb..6214b53386 100644 --- a/pkg/minikube/image/image.go +++ b/pkg/minikube/image/image.go @@ -302,10 +302,11 @@ func cleanImageCacheDir() error { // normalizeTagName automatically tag latest to image // Example: -// nginx -> nginx:latest -// localhost:5000/nginx -> localhost:5000/nginx:latest -// localhost:5000/nginx:latest -> localhost:5000/nginx:latest -// docker.io/dotnet/core/sdk -> docker.io/dotnet/core/sdk:latest +// +// nginx -> nginx:latest +// localhost:5000/nginx -> localhost:5000/nginx:latest +// localhost:5000/nginx:latest -> localhost:5000/nginx:latest +// docker.io/dotnet/core/sdk -> docker.io/dotnet/core/sdk:latest func normalizeTagName(image string) string { base := image tag := "latest" diff --git a/pkg/minikube/machine/info.go b/pkg/minikube/machine/info.go index e1a897d0c6..1e28b79984 100644 --- a/pkg/minikube/machine/info.go +++ b/pkg/minikube/machine/info.go @@ -142,7 +142,7 @@ var ( cachedSystemMemoryErr *error ) -// cachedSysMemLimit will return a cached limit for the system's virtual memory. +// cachedSysMemLimit will return a cached limit for the system's virtual memory. func cachedSysMemLimit() (*mem.VirtualMemoryStat, error) { if cachedSystemMemoryLimit == nil { v, err := mem.VirtualMemory() @@ -178,7 +178,7 @@ var ( cachedCPUErr *error ) -// cachedCPUInfo will return a cached cpu info +// cachedCPUInfo will return a cached cpu info func cachedCPUInfo() ([]cpu.InfoStat, error) { if cachedCPU == nil { // one InfoStat per thread diff --git a/pkg/minikube/tunnel/route_windows_test.go b/pkg/minikube/tunnel/route_windows_test.go index 43e8ab6504..88843e4cb7 100644 --- a/pkg/minikube/tunnel/route_windows_test.go +++ b/pkg/minikube/tunnel/route_windows_test.go @@ -139,7 +139,7 @@ Persistent Routes: expectedRt := routingTable{ routingTableLine{ route: unsafeParseRoute("127.0.0.1", "10.96.0.0/12"), - line: " 10.96.0.0 255.240.0.0 127.0.0.1 127.0.0.1 281", + line: " 10.96.0.0 255.240.0.0 127.0.0.1 127.0.0.1 281", }, routingTableLine{ route: unsafeParseRoute("192.168.1.2", "10.211.55.0/24"), diff --git a/pkg/network/network.go b/pkg/network/network.go index 11ab78bf93..cc5ba15f50 100644 --- a/pkg/network/network.go +++ b/pkg/network/network.go @@ -80,8 +80,9 @@ type Interface struct { // lookupInInterfaces iterates over all local network interfaces // and tries to match "ip" with associated networks // returns (network parameters, ip network, nil) if found -// (nil, nil, nil) it nof -// (nil, nil, error) if any error happened +// +// (nil, nil, nil) it nof +// (nil, nil, error) if any error happened func lookupInInterfaces(ip net.IP) (*Parameters, *net.IPNet, error) { // check local network interfaces ifaces, err := net.Interfaces() @@ -255,8 +256,9 @@ func FreeSubnet(startSubnet string, step, tries int) (*Parameters, error) { } // reserveSubnet returns if subnet was successfully reserved for given period: -// - false, if it already has unexpired reservation -// - true, if new reservation was created or expired one renewed +// - false, if it already has unexpired reservation +// - true, if new reservation was created or expired one renewed +// // uses sync.Map to manage reservations thread-safe func reserveSubnet(subnet string, period time.Duration) bool { // put 'zero' reservation{} Map value for subnet Map key diff --git a/test/integration/json_output_test.go b/test/integration/json_output_test.go index 72eda4bb5c..0f4e53debb 100644 --- a/test/integration/json_output_test.go +++ b/test/integration/json_output_test.go @@ -102,7 +102,7 @@ func TestJSONOutput(t *testing.T) { } } -// validateDistinctCurrentSteps makes sure each step has a distinct step number +// validateDistinctCurrentSteps makes sure each step has a distinct step number func validateDistinctCurrentSteps(ctx context.Context, t *testing.T, ces []*cloudEvent) { steps := map[string]string{} for _, ce := range ces { diff --git a/test/integration/start_stop_delete_test.go b/test/integration/start_stop_delete_test.go index 3f249f06d8..54bd85e0ad 100644 --- a/test/integration/start_stop_delete_test.go +++ b/test/integration/start_stop_delete_test.go @@ -445,11 +445,14 @@ func testPause(ctx context.Context, t *testing.T, profile string) { // Remove container-specific prefixes for naming consistency // for example in `docker` runtime we get this: -// $ docker@minikube:~$ sudo crictl images -o json | grep dash -// "kubernetesui/dashboard:vX.X.X" +// +// $ docker@minikube:~$ sudo crictl images -o json | grep dash +// "kubernetesui/dashboard:vX.X.X" +// // but for 'containerd' we get full name -// $ docker@minikube:~$ sudo crictl images -o json | grep dash -// "docker.io/kubernetesui/dashboard:vX.X.X" +// +// $ docker@minikube:~$ sudo crictl images -o json | grep dash +// "docker.io/kubernetesui/dashboard:vX.X.X" func trimImageName(name string) string { name = strings.TrimPrefix(name, "docker.io/") name = strings.TrimPrefix(name, "localhost/") diff --git a/translations/translations.go b/translations/translations.go index 2407a74dc2..d2283705db 100644 --- a/translations/translations.go +++ b/translations/translations.go @@ -19,5 +19,6 @@ package translations import "embed" // Translations contains all translation JSON files. +// //go:embed *.json var Translations embed.FS