Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Update golint from v1.61.0 to v1.62.0 #19935

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ MINIKUBE_RELEASES_URL=https://github.com/kubernetes/minikube/releases/download
KERNEL_VERSION ?= 5.10.207
# latest from https://github.com/golangci/golangci-lint/releases
# update this only by running `make update-golint-version`
GOLINT_VERSION ?= v1.61.0
GOLINT_VERSION ?= v1.62.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
Expand Down
4 changes: 2 additions & 2 deletions hack/benchmark/cpu_usage/auto_pause/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ var FOLDER = "site/static/images/benchmarks/cpuUsage/autoPause"

type integerTicks struct{}

func (integerTicks) Ticks(min, max float64) []plot.Tick {
func (integerTicks) Ticks(minimum, maximum float64) []plot.Tick {
var t []plot.Tick
for i := math.Trunc(min); i <= max; i += 50 {
for i := math.Trunc(minimum); i <= maximum; i += 50 {
t = append(t, plot.Tick{Value: i, Label: fmt.Sprint(i)})
}
return t
Expand Down
4 changes: 2 additions & 2 deletions hack/benchmark/cpu_usage/idle_only/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ var FOLDER = "site/static/images/benchmarks/cpuUsage/idleOnly"

type integerTicks struct{}

func (integerTicks) Ticks(min, max float64) []plot.Tick {
func (integerTicks) Ticks(minimum, maximum float64) []plot.Tick {
var t []plot.Tick
for i := math.Trunc(min); i <= max; i += 50 {
for i := math.Trunc(minimum); i <= maximum; i += 50 {
t = append(t, plot.Tick{Value: i, Label: fmt.Sprint(i)})
}
return t
Expand Down
4 changes: 2 additions & 2 deletions pkg/drivers/qemu/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ func parsePortRange(rawPortRange string) (int, int, error) {
return minPort, maxPort, nil
}

func getRandomPortNumberInRange(min, max int) int {
return rand.Intn(max-min) + min
func getRandomPortNumberInRange(minimum, maximum int) int {
return rand.Intn(maximum-minimum) + minimum
}

func getAvailableTCPPortFromRange(minPort, maxPort int) (int, error) {
Expand Down
8 changes: 4 additions & 4 deletions pkg/minikube/assets/vm_assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ func (m *MemoryAsset) GetLength() int {
}

// SetLength returns length
func (m *MemoryAsset) SetLength(len int) {
m.length = len
func (m *MemoryAsset) SetLength(length int) {
m.length = length
}

// Read reads the asset
Expand Down Expand Up @@ -403,8 +403,8 @@ func (m *BinAsset) GetLength() int {
}

// SetLength sets length
func (m *BinAsset) SetLength(len int) {
m.length = len
func (m *BinAsset) SetLength(length int) {
m.length = length
}

// Read reads the asset
Expand Down
8 changes: 4 additions & 4 deletions pkg/minikube/cruntime/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,13 @@ func (r *Containerd) StopContainers(ids []string) error {
}

// ContainerLogCmd returns the command to retrieve the log for a container based on ID
func (r *Containerd) ContainerLogCmd(id string, len int, follow bool) string {
return criContainerLogCmd(r.Runner, id, len, follow)
func (r *Containerd) ContainerLogCmd(id string, length int, follow bool) string {
return criContainerLogCmd(r.Runner, id, length, follow)
}

// SystemLogCmd returns the command to retrieve system logs
func (r *Containerd) SystemLogCmd(len int) string {
return fmt.Sprintf("sudo journalctl -u containerd -n %d", len)
func (r *Containerd) SystemLogCmd(length int) string {
return fmt.Sprintf("sudo journalctl -u containerd -n %d", length)
}

// Preload preloads the container runtime with k8s images
Expand Down
6 changes: 3 additions & 3 deletions pkg/minikube/cruntime/cri.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,14 @@ func listCRIImages(cr CommandRunner) ([]ListImage, error) {
}

// criContainerLogCmd returns the command to retrieve the log for a container based on ID
func criContainerLogCmd(cr CommandRunner, id string, len int, follow bool) string {
func criContainerLogCmd(cr CommandRunner, id string, length int, follow bool) string {
crictl := getCrictlPath(cr)
var cmd strings.Builder
cmd.WriteString("sudo ")
cmd.WriteString(crictl)
cmd.WriteString(" logs ")
if len > 0 {
cmd.WriteString(fmt.Sprintf("--tail %d ", len))
if length > 0 {
cmd.WriteString(fmt.Sprintf("--tail %d ", length))
}
if follow {
cmd.WriteString("--follow ")
Expand Down
8 changes: 4 additions & 4 deletions pkg/minikube/cruntime/crio.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,13 @@ func (r *CRIO) StopContainers(ids []string) error {
}

// ContainerLogCmd returns the command to retrieve the log for a container based on ID
func (r *CRIO) ContainerLogCmd(id string, len int, follow bool) string {
return criContainerLogCmd(r.Runner, id, len, follow)
func (r *CRIO) ContainerLogCmd(id string, length int, follow bool) string {
return criContainerLogCmd(r.Runner, id, length, follow)
}

// SystemLogCmd returns the command to retrieve system logs
func (r *CRIO) SystemLogCmd(len int) string {
return fmt.Sprintf("sudo journalctl -u crio -n %d", len)
func (r *CRIO) SystemLogCmd(length int) string {
return fmt.Sprintf("sudo journalctl -u crio -n %d", length)
}

// Preload preloads the container runtime with k8s images
Expand Down
12 changes: 6 additions & 6 deletions pkg/minikube/cruntime/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,14 +524,14 @@ func (r *Docker) UnpauseContainers(ids []string) error {
}

// ContainerLogCmd returns the command to retrieve the log for a container based on ID
func (r *Docker) ContainerLogCmd(id string, len int, follow bool) string {
func (r *Docker) ContainerLogCmd(id string, length int, follow bool) string {
if r.UseCRI {
return criContainerLogCmd(r.Runner, id, len, follow)
return criContainerLogCmd(r.Runner, id, length, follow)
}
var cmd strings.Builder
cmd.WriteString("docker logs ")
if len > 0 {
cmd.WriteString(fmt.Sprintf("--tail %d ", len))
if length > 0 {
cmd.WriteString(fmt.Sprintf("--tail %d ", length))
}
if follow {
cmd.WriteString("--follow ")
Expand All @@ -542,8 +542,8 @@ func (r *Docker) ContainerLogCmd(id string, len int, follow bool) string {
}

// SystemLogCmd returns the command to retrieve system logs
func (r *Docker) SystemLogCmd(len int) string {
return fmt.Sprintf("sudo journalctl -u docker -u cri-docker -n %d", len)
func (r *Docker) SystemLogCmd(length int) string {
return fmt.Sprintf("sudo journalctl -u docker -u cri-docker -n %d", length)
}

type dockerDaemonConfig struct {
Expand Down
12 changes: 3 additions & 9 deletions pkg/minikube/perf/binary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,10 @@ func TestNewBinary(t *testing.T) {
for _, test := range tests {
t.Run(test.input, func(t *testing.T) {
bin, err := NewBinary(test.input)
if err == nil && test.errExpected {
t.Fatalf("Input %v returned unexpected error", test.input)
if wantErr, gotErr := test.errExpected, (err != nil); wantErr != gotErr {
t.Fatalf("NewBinary(%s) returned err = %v; expected err %t", test.input, err, wantErr)
}
if test.errExpected {
return
}
if bin == nil {
t.Fatalf("Input string(%v) returned unexpected empty binary", test.input)
}
if !strings.Contains(bin.path, test.prNum) {
if err == nil && !strings.Contains(bin.path, test.prNum) {
t.Fatalf("Binary path(%v) doesn't contain expected(%v)", bin.path, test.prNum)
}
})
Expand Down
12 changes: 6 additions & 6 deletions pkg/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ var Inspect = func(addr string) (*Parameters, error) {
}
gatewayIP := binary.BigEndian.Uint32(gateway)

min := make(net.IP, 4)
binary.BigEndian.PutUint32(min, gatewayIP+1) // clients-from: first network IP address after gateway
n.ClientMin = min.String()
minIP := make(net.IP, 4)
binary.BigEndian.PutUint32(minIP, gatewayIP+1) // clients-from: first network IP address after gateway
n.ClientMin = minIP.String()

max := make(net.IP, 4)
binary.BigEndian.PutUint32(max, broadcastIP-1) // clients-to: last network IP address before broadcast
n.ClientMax = max.String()
maxIP := make(net.IP, 4)
binary.BigEndian.PutUint32(maxIP, broadcastIP-1) // clients-to: last network IP address before broadcast
n.ClientMax = maxIP.String()

return n, nil
}
Expand Down
Loading