mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-04 09:36:16 +00:00
Merge pull request #23660 from goltermann/vetclean
Automatic merge from submit-queue Additional go vet fixes Mostly: - pass lock by value - bad syntax for struct tag value - example functions not formatted properly
This commit is contained in:
@@ -18,7 +18,6 @@ package e2e
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -90,13 +89,13 @@ func runK8petstore(restServers int, loadGenerators int, c *client.Client, ns str
|
||||
// Run the k8petstore app, and log / fail if it returns any errors.
|
||||
// This should return quickly, assuming containers are downloaded.
|
||||
if err = cmd.Start(); err != nil {
|
||||
log.Fatal(err)
|
||||
Failf("%v", err)
|
||||
}
|
||||
// Make sure there are no command errors.
|
||||
if err = cmd.Wait(); err != nil {
|
||||
if exiterr, ok := err.(*exec.ExitError); ok {
|
||||
if status, ok := exiterr.Sys().(syscall.WaitStatus); ok {
|
||||
log.Printf("Exit Status: %d", status.ExitStatus())
|
||||
Logf("Exit Status: %d", status.ExitStatus())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -67,7 +67,7 @@ type LogsSizeVerifier struct {
|
||||
client *client.Client
|
||||
stopChannel chan bool
|
||||
// data stores LogSizeData groupped per IP and log_path
|
||||
data LogsSizeData
|
||||
data *LogsSizeData
|
||||
masterAddress string
|
||||
nodeAddresses []string
|
||||
wg sync.WaitGroup
|
||||
@@ -117,13 +117,13 @@ type WorkItem struct {
|
||||
backoffMultiplier int
|
||||
}
|
||||
|
||||
func prepareData(masterAddress string, nodeAddresses []string) LogsSizeData {
|
||||
func prepareData(masterAddress string, nodeAddresses []string) *LogsSizeData {
|
||||
data := make(LogSizeDataTimeseries)
|
||||
ips := append(nodeAddresses, masterAddress)
|
||||
for _, ip := range ips {
|
||||
data[ip] = make(map[string][]TimestampedSize)
|
||||
}
|
||||
return LogsSizeData{
|
||||
return &LogsSizeData{
|
||||
data: data,
|
||||
lock: sync.Mutex{},
|
||||
}
|
||||
@@ -164,7 +164,7 @@ func NewLogsVerifier(c *client.Client, stopChannel chan bool) *LogsSizeVerifier
|
||||
for i := 0; i < workersNo; i++ {
|
||||
workers[i] = &LogSizeGatherer{
|
||||
stopChannel: stopChannel,
|
||||
data: &verifier.data,
|
||||
data: verifier.data,
|
||||
wg: &verifier.wg,
|
||||
workChannel: workChannel,
|
||||
}
|
||||
|
@@ -309,23 +309,23 @@ func nowStamp() string {
|
||||
return time.Now().Format(time.StampMilli)
|
||||
}
|
||||
|
||||
func logf(level string, format string, args ...interface{}) {
|
||||
func log(level string, format string, args ...interface{}) {
|
||||
fmt.Fprintf(GinkgoWriter, nowStamp()+": "+level+": "+format+"\n", args...)
|
||||
}
|
||||
|
||||
func Logf(format string, args ...interface{}) {
|
||||
logf("INFO", format, args...)
|
||||
log("INFO", format, args...)
|
||||
}
|
||||
|
||||
func Failf(format string, args ...interface{}) {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
logf("FAIL", msg)
|
||||
log("INFO", msg)
|
||||
Fail(nowStamp()+": "+msg, 1)
|
||||
}
|
||||
|
||||
func Skipf(format string, args ...interface{}) {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
logf("SKIP", msg)
|
||||
log("INFO", msg)
|
||||
Skip(nowStamp() + ": " + msg)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user