Skip to content

Commit

Permalink
ci: bump golangci-lint to v1.60.1 (#4407)
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian committed Aug 14, 2024
1 parent a02733f commit 25473b5
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ concurrency:
env:
GO_VERSION: ''
KIND_VERSION: v0.23.0
GOLANGCI_LINT_VERSION: 'v1.59.1'
GOLANGCI_LINT_VERSION: 'v1.60.1'
HELM_VERSION: v3.15.3
SUBMARINER_VERSION: '0.18.0'

Expand Down
2 changes: 1 addition & 1 deletion cmd/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const ovnLeaderResource = "kube-ovn-controller"
func CmdMain() {
defer klog.Flush()

klog.Infof(versions.String())
klog.Info(versions.String())

currentCaps := cap.GetProc()
klog.Infof("current capabilities: %s", currentCaps.String())
Expand Down
2 changes: 1 addition & 1 deletion cmd/daemon/cniserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
metrics.InitKlogMetrics()

config := daemon.ParseFlags()
klog.Infof(versions.String())
klog.Info(versions.String())

if config.InstallCNIConfig {
if err := mvCNIConf(config.CniConfDir, config.CniConfFile, config.CniConfName); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ovn_ic_controller/ovn_ic_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func CmdMain() {
defer klog.Flush()

klog.Infof(versions.String())
klog.Info(versions.String())

currentCaps := cap.GetProc()
klog.Infof("current capabilities: %s", currentCaps.String())
Expand Down
2 changes: 1 addition & 1 deletion cmd/ovn_monitor/ovn_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const port = 10661
func CmdMain() {
defer klog.Flush()

klog.Infof(versions.String())
klog.Info(versions.String())

currentCaps := cap.GetProc()
klog.Infof("current capabilities: %s", currentCaps.String())
Expand Down
2 changes: 1 addition & 1 deletion cmd/pinger/pinger.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
func main() {
defer klog.Flush()

klog.Infof(versions.String())
klog.Info(versions.String())

currentCaps := cap.GetProc()
klog.Infof("current capabilities: %s", currentCaps.String())
Expand Down
2 changes: 1 addition & 1 deletion cmd/speaker/speaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
func CmdMain() {
defer klog.Flush()

klog.Infof(versions.String())
klog.Info(versions.String())

currentCaps := cap.GetProc()
klog.Infof("current capabilities: %s", currentCaps.String())
Expand Down
2 changes: 1 addition & 1 deletion cmd/webhook/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func init() {
}

func CmdMain() {
klog.Infof(versions.String())
klog.Info(versions.String())

port := pflag.Int("port", 8443, "The port webhook listen on.")
healthProbePort := pflag.Int32("health-probe-port", 8080, "The port health probes listen on.")
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (c *Controller) handleAddNamespace(key string) error {
excludeIps = append(excludeIps, strings.Join(subnet.Spec.ExcludeIps, ","))
}

if namespace.Annotations == nil || len(namespace.Annotations) == 0 {
if len(namespace.Annotations) == 0 {
namespace.Annotations = map[string]string{}
} else if namespace.Annotations[util.LogicalSwitchAnnotation] == strings.Join(lss, ",") &&
namespace.Annotations[util.CidrAnnotation] == strings.Join(cidrs, ";") &&
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/service_lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (c *Controller) deleteLbSvc(svc *corev1.Service) error {

func (c *Controller) execNatRules(pod *corev1.Pod, operation string, rules []string) error {
cmd := fmt.Sprintf("bash /kube-ovn/lb-svc.sh %s %s", operation, strings.Join(rules, " "))
klog.V(3).Infof(cmd)
klog.V(3).Info(cmd)
stdOutput, errOutput, err := util.ExecuteCommandInContainer(c.config.KubeClient, c.config.KubeRestConfig, pod.Namespace, pod.Name, "lb-svc", []string{"/bin/bash", "-c", cmd}...)
if err != nil {
if len(errOutput) > 0 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/vpc_nat_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ func (c *Controller) handleUpdateVpcDnat(natGwKey string) error {
func (c *Controller) getIptablesVersion(pod *corev1.Pod) (version string, err error) {
operation := getIptablesVersion
cmd := fmt.Sprintf("bash /kube-ovn/nat-gateway.sh %s", operation)
klog.V(3).Infof(cmd)
klog.V(3).Info(cmd)
stdOutput, errOutput, err := util.ExecuteCommandInContainer(c.config.KubeClient, c.config.KubeRestConfig, pod.Namespace, pod.Name, "vpc-nat-gw", []string{"/bin/bash", "-c", cmd}...)
if err != nil {
if len(errOutput) > 0 {
Expand Down Expand Up @@ -712,7 +712,7 @@ func (c *Controller) handleUpdateNatGwSubnetRoute(natGwKey string) error {

func (c *Controller) execNatGwRules(pod *corev1.Pod, operation string, rules []string) error {
cmd := fmt.Sprintf("bash /kube-ovn/nat-gateway.sh %s %s", operation, strings.Join(rules, " "))
klog.V(3).Infof(cmd)
klog.V(3).Info(cmd)
stdOutput, errOutput, err := util.ExecuteCommandInContainer(c.config.KubeClient, c.config.KubeRestConfig, pod.Namespace, pod.Name, "vpc-nat-gw", []string{"/bin/bash", "-c", cmd}...)
if err != nil {
if len(errOutput) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/daemon/ovs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func (csh cniServerHandler) releaseVf(podName, podNamespace, podNetns, ifName, n
return nil
})
if err != nil {
klog.Errorf(err.Error())
klog.Error(err)
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/daemon/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ func createHandler(csh *cniServerHandler) http.Handler {
func requestAndResponseLogger(request *restful.Request, response *restful.Response,
chain *restful.FilterChain,
) {
klog.Infof(formatRequestLog(request))
klog.Info(formatRequestLog(request))
start := time.Now()
chain.ProcessFilter(request, response)
elapsed := float64((time.Since(start)) / time.Millisecond)
cniOperationHistogram.WithLabelValues(
nodeName,
getRequestURI(request),
strconv.Itoa(response.StatusCode())).Observe(elapsed / 1000)
klog.Infof(formatResponseLog(response, request, elapsed))
klog.Info(formatResponseLog(response, request, elapsed))
}

// formatRequestLog formats request log string.
Expand Down
2 changes: 1 addition & 1 deletion pkg/speaker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func ParseFlags() (*Configuration, error) {
if *argRouterID != "" && net.ParseIP(*argRouterID) == nil {
return nil, fmt.Errorf("invalid router-id format: %s", *argRouterID)
}
if *argEbgpMultihopTTL < 1 || *argEbgpMultihopTTL > 255 {
if *argEbgpMultihopTTL == 0 {
return nil, errors.New("the bgp MultihopTtl must be in the range 1 to 255")
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/util/network_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func parsePodNetworkObjectName(podNetwork string) (string, string, string, error
case 1:
networkName = slashItems[0]
default:
klog.Errorf("parsePodNetworkObjectName: Invalid network object (failed at '/')")
klog.Error("parsePodNetworkObjectName: Invalid network object (failed at '/')")
return "", "", "", errors.New("parsePodNetworkObjectName: Invalid network object (failed at '/')")
}

Expand All @@ -49,7 +49,7 @@ func parsePodNetworkObjectName(podNetwork string) (string, string, string, error
allItems := []string{netNsName, networkName, netIfName}
for i := range allItems {
if !attachmentRegexp.MatchString(allItems[i]) && len([]rune(allItems[i])) > 0 {
klog.Errorf(fmt.Sprintf("parsePodNetworkObjectName: Failed to parse: "+
klog.Error(fmt.Sprintf("parsePodNetworkObjectName: Failed to parse: "+
"one or more items did not match comma-delimited format (must consist of lower case alphanumeric characters). "+
"Must start and end with an alphanumeric character), mismatch @ '%v'", allItems[i]))
return "", "", "", fmt.Errorf("parsePodNetworkObjectName: Failed to parse: "+
Expand Down
9 changes: 4 additions & 5 deletions test/e2e/iptables-vpc-nat-gw/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1069,20 +1069,19 @@ func createNatGwAndSetQosCases(f *framework.Framework,
}

func validRateLimit(text string, limit int) bool {
maxValue := float64(limit) * 1024 * 1024 * 1.2
minValue := float64(limit) * 1024 * 1024 * 0.8
lines := strings.Split(text, "\n")
for _, line := range lines {
if line == "" {
continue
}
fields := strings.Split(line, ",")
lastField := fields[len(fields)-1]
number, err := strconv.Atoi(lastField)
number, err := strconv.Atoi(fields[len(fields)-1])
if err != nil {
continue
}
max := float64(limit) * 1024 * 1024 * 1.2
min := float64(limit) * 1024 * 1024 * 0.8
if min <= float64(number) && float64(number) <= max {
if v := float64(number); v >= minValue && v <= maxValue {
return true
}
}
Expand Down

0 comments on commit 25473b5

Please sign in to comment.