runtime: Fix gofmt issues

It seems that bumping the version of golang and golangci-lint new format
changes are required.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio 2022-11-17 13:52:54 +01:00
parent 16b8375095
commit d94718fb30
21 changed files with 81 additions and 82 deletions

View File

@ -202,6 +202,7 @@ func checkCPUAttribs(cpuinfo string, attribs map[string]string) uint32 {
// onVMM - `true` if the host is running under a VMM environment // onVMM - `true` if the host is running under a VMM environment
// fields - A set of fields showing the expected and actual module parameter values. // fields - A set of fields showing the expected and actual module parameter values.
// msg - The message that would be logged showing the incorrect kernel module // msg - The message that would be logged showing the incorrect kernel module
//
// parameter. // parameter.
// //
// The function must return `true` if the kernel module parameter error should // The function must return `true` if the kernel module parameter error should

View File

@ -92,10 +92,11 @@ func getKernelVersion() (string, error) {
// //
// For some self compiled kernel, the kernel version will be with "+" as its suffix // For some self compiled kernel, the kernel version will be with "+" as its suffix
// For example: // For example:
//
// 5.12.0-rc4+ // 5.12.0-rc4+
//
// These kernel version can't be parsed by the current lib and lead to panic // These kernel version can't be parsed by the current lib and lead to panic
// therefore the '+' should be removed. // therefore the '+' should be removed.
//
func fixKernelVersion(version string) string { func fixKernelVersion(version string) string {
version = strings.Replace(version, "_", "-", -1) version = strings.Replace(version, "_", "-", -1)
return strings.Replace(version, "+", "", -1) return strings.Replace(version, "+", "", -1)

View File

@ -1,7 +1,6 @@
// Copyright (c) 2020 Ant Group // Copyright (c) 2020 Ant Group
// //
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
//
package types package types
import ( import (

View File

@ -230,9 +230,7 @@ var vmAddNetPutRequest = func(clh *cloudHypervisor) error {
return nil return nil
} }
//
// Cloud hypervisor state // Cloud hypervisor state
//
type CloudHypervisorState struct { type CloudHypervisorState struct {
apiSocket string apiSocket string
PID int PID int

View File

@ -1136,17 +1136,18 @@ func addRxRateLimiter(endpoint Endpoint, maxRate uint64) error {
// from their parents once they have exceeded rate. A child class will continue to attempt to borrow until // from their parents once they have exceeded rate. A child class will continue to attempt to borrow until
// it reaches ceil. See more details in https://tldp.org/HOWTO/Traffic-Control-HOWTO/classful-qdiscs.html. // it reaches ceil. See more details in https://tldp.org/HOWTO/Traffic-Control-HOWTO/classful-qdiscs.html.
// //
// * +-----+ +---------+ +-----------+ +-----------+ // - +-----+ +---------+ +-----------+ +-----------+
// * | | | qdisc | | class 1:1 | | class 1:2 | // - | | | qdisc | | class 1:1 | | class 1:2 |
// * | NIC | | htb | | rate | | rate | // - | NIC | | htb | | rate | | rate |
// * | | --> | def 1:2 | --> | ceil | -+-> | ceil | // - | | --> | def 1:2 | --> | ceil | -+-> | ceil |
// * +-----+ +---------+ +-----------+ | +-----------+ // - +-----+ +---------+ +-----------+ | +-----------+
// * | // - |
// * | +-----------+ // - | +-----------+
// * | | class 1:n | // - | | class 1:n |
// * | | rate | // - | | rate |
// * +-> | ceil | // - +-> | ceil |
// * | +-----------+ // - | +-----------+
//
// Seeing from pic, after the routing decision, all packets will be sent to the interface root htb qdisc. // Seeing from pic, after the routing decision, all packets will be sent to the interface root htb qdisc.
// This root qdisc has only one direct child class (with id 1:1) which shapes the overall maximum rate // This root qdisc has only one direct child class (with id 1:1) which shapes the overall maximum rate
// that will be sent through interface. Then, this class has at least one default child (1:2) meant to control all // that will be sent through interface. Then, this class has at least one default child (1:2) meant to control all

View File

@ -7664,7 +7664,7 @@ func (this *MemoryStats) String() string {
return "nil" return "nil"
} }
keysForStats := make([]string, 0, len(this.Stats)) keysForStats := make([]string, 0, len(this.Stats))
for k, _ := range this.Stats { for k := range this.Stats {
keysForStats = append(keysForStats, k) keysForStats = append(keysForStats, k)
} }
github_com_gogo_protobuf_sortkeys.Strings(keysForStats) github_com_gogo_protobuf_sortkeys.Strings(keysForStats)
@ -7775,7 +7775,7 @@ func (this *CgroupStats) String() string {
return "nil" return "nil"
} }
keysForHugetlbStats := make([]string, 0, len(this.HugetlbStats)) keysForHugetlbStats := make([]string, 0, len(this.HugetlbStats))
for k, _ := range this.HugetlbStats { for k := range this.HugetlbStats {
keysForHugetlbStats = append(keysForHugetlbStats, k) keysForHugetlbStats = append(keysForHugetlbStats, k)
} }
github_com_gogo_protobuf_sortkeys.Strings(keysForHugetlbStats) github_com_gogo_protobuf_sortkeys.Strings(keysForHugetlbStats)

View File

@ -6797,7 +6797,7 @@ func (this *Spec) String() string {
} }
repeatedStringForMounts += "}" repeatedStringForMounts += "}"
keysForAnnotations := make([]string, 0, len(this.Annotations)) keysForAnnotations := make([]string, 0, len(this.Annotations))
for k, _ := range this.Annotations { for k := range this.Annotations {
keysForAnnotations = append(keysForAnnotations, k) keysForAnnotations = append(keysForAnnotations, k)
} }
github_com_gogo_protobuf_sortkeys.Strings(keysForAnnotations) github_com_gogo_protobuf_sortkeys.Strings(keysForAnnotations)
@ -6996,7 +6996,7 @@ func (this *Linux) String() string {
} }
repeatedStringForDevices += "}" repeatedStringForDevices += "}"
keysForSysctl := make([]string, 0, len(this.Sysctl)) keysForSysctl := make([]string, 0, len(this.Sysctl))
for k, _ := range this.Sysctl { for k := range this.Sysctl {
keysForSysctl = append(keysForSysctl, k) keysForSysctl = append(keysForSysctl, k)
} }
github_com_gogo_protobuf_sortkeys.Strings(keysForSysctl) github_com_gogo_protobuf_sortkeys.Strings(keysForSysctl)

View File

@ -47,7 +47,6 @@ func Ioctl(fd uintptr, request, data uintptr) error {
// Benefits of using random context IDs: // Benefits of using random context IDs:
// - Reduce the probability of a *DoS attack*, since other processes don't know whatis the initial context ID // - Reduce the probability of a *DoS attack*, since other processes don't know whatis the initial context ID
// used by findContextID to find a context ID available // used by findContextID to find a context ID available
//
func FindContextID() (*os.File, uint64, error) { func FindContextID() (*os.File, uint64, error) {
// context IDs 0x0, 0x1 and 0x2 are reserved, 0x3 is the first context ID usable. // context IDs 0x0, 0x1 and 0x2 are reserved, 0x3 is the first context ID usable.
var firstContextID uint64 = 0x3 var firstContextID uint64 = 0x3

View File

@ -149,6 +149,7 @@ func findVhostUserNetSocketPath(netInfo NetworkInfo) (string, error) {
// vhostUserSocketPath returns the path of the socket discovered. This discovery // vhostUserSocketPath returns the path of the socket discovered. This discovery
// will vary depending on the type of vhost-user socket. // will vary depending on the type of vhost-user socket.
//
// Today only VhostUserNetDevice is supported. // Today only VhostUserNetDevice is supported.
func vhostUserSocketPath(info interface{}) (string, error) { func vhostUserSocketPath(info interface{}) (string, error) {

View File

@ -50,7 +50,6 @@ const logEntryFormatVersion = "0.0.2"
// struct is converted to various formats (specifically CSV, text and YAML). // struct is converted to various formats (specifically CSV, text and YAML).
// //
// - XXX: If you change this struct, update logEntryFormatVersion! // - XXX: If you change this struct, update logEntryFormatVersion!
//
type LogEntry struct { type LogEntry struct {
// Used to store additional (non-standard) fields // Used to store additional (non-standard) fields
Data MapSS Data MapSS