runtime: gofmt code

Looks like we have merged a lot of code that is not properly formated.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Peng Tao 2021-03-24 14:36:47 +08:00
parent 190f813427
commit 0153f76b07
46 changed files with 155 additions and 128 deletions

View File

@ -25,10 +25,10 @@ import (
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config"
persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api" persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/uuid" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/uuid"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types"
) )
// Since ACRN is using the store in a quite abnormal way, let's first draw it back from store to here // Since ACRN is using the store in a quite abnormal way, let's first draw it back from store to here

View File

@ -206,7 +206,7 @@ type agent interface {
// getOOMEvent will wait on OOM events that occur in the sandbox. // getOOMEvent will wait on OOM events that occur in the sandbox.
// Will return the ID of the container where the event occurred. // Will return the ID of the container where the event occurred.
getOOMEvent(ctx context.Context, ) (string, error) getOOMEvent(ctx context.Context) (string, error)
// getAgentMetrics get metrics of agent and guest through agent // getAgentMetrics get metrics of agent and guest through agent
getAgentMetrics(context.Context, *grpc.GetMetricsRequest) (*grpc.Metrics, error) getAgentMetrics(context.Context, *grpc.GetMetricsRequest) (*grpc.Metrics, error)

View File

@ -30,9 +30,9 @@ import (
otelTrace "go.opentelemetry.io/otel/trace" otelTrace "go.opentelemetry.io/otel/trace"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types"
) )
// //

View File

@ -15,8 +15,8 @@ import (
"strings" "strings"
"github.com/go-ini/ini" "github.com/go-ini/ini"
"golang.org/x/sys/unix"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types" vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types"
"golang.org/x/sys/unix"
) )
// DeviceType indicates device type // DeviceType indicates device type

View File

@ -31,8 +31,8 @@ import (
vcAnnotations "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/annotations" vcAnnotations "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/mock" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/mock"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/rootless" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/rootless"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types" vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
) )
var ( var (

View File

@ -17,8 +17,8 @@ import (
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/drivers" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/drivers"
persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api" persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/cgroups" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/cgroups"
"github.com/safchain/ethtool"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types" vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types"
"github.com/safchain/ethtool"
) )
// PhysicalEndpoint gathers a physical network interface and its properties // PhysicalEndpoint gathers a physical network interface and its properties

View File

@ -7248,7 +7248,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)
@ -7359,7 +7359,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

@ -6653,7 +6653,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)
@ -6852,7 +6852,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

@ -157,7 +157,6 @@ func parameterToJson(obj interface{}) (string, error) {
return string(jsonBuf), err return string(jsonBuf), err
} }
// callAPI do the request. // callAPI do the request.
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
if c.cfg.Debug { if c.cfg.Debug {

View File

@ -37,7 +37,6 @@ var (
// ContextAPIKey takes an APIKey as authentication for the request // ContextAPIKey takes an APIKey as authentication for the request
ContextAPIKey = contextKey("apikey") ContextAPIKey = contextKey("apikey")
) )
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth // BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
@ -52,7 +51,6 @@ type APIKey struct {
Prefix string Prefix string
} }
// ServerVariable stores the information about a server variable // ServerVariable stores the information about a server variable
type ServerVariable struct { type ServerVariable struct {
Description string Description string

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// BalloonConfig struct for BalloonConfig // BalloonConfig struct for BalloonConfig
type BalloonConfig struct { type BalloonConfig struct {
Size int64 `json:"size"` Size int64 `json:"size"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// CmdLineConfig struct for CmdLineConfig // CmdLineConfig struct for CmdLineConfig
type CmdLineConfig struct { type CmdLineConfig struct {
Args string `json:"args"` Args string `json:"args"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// ConsoleConfig struct for ConsoleConfig // ConsoleConfig struct for ConsoleConfig
type ConsoleConfig struct { type ConsoleConfig struct {
File string `json:"file,omitempty"` File string `json:"file,omitempty"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// CpuTopology struct for CpuTopology // CpuTopology struct for CpuTopology
type CpuTopology struct { type CpuTopology struct {
ThreadsPerCore int32 `json:"threads_per_core,omitempty"` ThreadsPerCore int32 `json:"threads_per_core,omitempty"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// CpusConfig struct for CpusConfig // CpusConfig struct for CpusConfig
type CpusConfig struct { type CpusConfig struct {
BootVcpus int32 `json:"boot_vcpus"` BootVcpus int32 `json:"boot_vcpus"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// DeviceConfig struct for DeviceConfig // DeviceConfig struct for DeviceConfig
type DeviceConfig struct { type DeviceConfig struct {
Path string `json:"path"` Path string `json:"path"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// DeviceNode struct for DeviceNode // DeviceNode struct for DeviceNode
type DeviceNode struct { type DeviceNode struct {
Id string `json:"id,omitempty"` Id string `json:"id,omitempty"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// DiskConfig struct for DiskConfig // DiskConfig struct for DiskConfig
type DiskConfig struct { type DiskConfig struct {
Path string `json:"path"` Path string `json:"path"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// FsConfig struct for FsConfig // FsConfig struct for FsConfig
type FsConfig struct { type FsConfig struct {
Tag string `json:"tag"` Tag string `json:"tag"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// InitramfsConfig struct for InitramfsConfig // InitramfsConfig struct for InitramfsConfig
type InitramfsConfig struct { type InitramfsConfig struct {
Path string `json:"path"` Path string `json:"path"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// KernelConfig struct for KernelConfig // KernelConfig struct for KernelConfig
type KernelConfig struct { type KernelConfig struct {
Path string `json:"path"` Path string `json:"path"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// MemoryConfig struct for MemoryConfig // MemoryConfig struct for MemoryConfig
type MemoryConfig struct { type MemoryConfig struct {
Size int64 `json:"size"` Size int64 `json:"size"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// MemoryZoneConfig struct for MemoryZoneConfig // MemoryZoneConfig struct for MemoryZoneConfig
type MemoryZoneConfig struct { type MemoryZoneConfig struct {
Id string `json:"id"` Id string `json:"id"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// NetConfig struct for NetConfig // NetConfig struct for NetConfig
type NetConfig struct { type NetConfig struct {
Tap string `json:"tap,omitempty"` Tap string `json:"tap,omitempty"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// NumaConfig struct for NumaConfig // NumaConfig struct for NumaConfig
type NumaConfig struct { type NumaConfig struct {
GuestNumaId int32 `json:"guest_numa_id"` GuestNumaId int32 `json:"guest_numa_id"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// NumaDistance struct for NumaDistance // NumaDistance struct for NumaDistance
type NumaDistance struct { type NumaDistance struct {
Destination int32 `json:"destination"` Destination int32 `json:"destination"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// PciDeviceInfo Information about a PCI device // PciDeviceInfo Information about a PCI device
type PciDeviceInfo struct { type PciDeviceInfo struct {
Id string `json:"id"` Id string `json:"id"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// PmemConfig struct for PmemConfig // PmemConfig struct for PmemConfig
type PmemConfig struct { type PmemConfig struct {
File string `json:"file"` File string `json:"file"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// RestoreConfig struct for RestoreConfig // RestoreConfig struct for RestoreConfig
type RestoreConfig struct { type RestoreConfig struct {
SourceUrl string `json:"source_url"` SourceUrl string `json:"source_url"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// RngConfig struct for RngConfig // RngConfig struct for RngConfig
type RngConfig struct { type RngConfig struct {
Src string `json:"src"` Src string `json:"src"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// SgxEpcConfig struct for SgxEpcConfig // SgxEpcConfig struct for SgxEpcConfig
type SgxEpcConfig struct { type SgxEpcConfig struct {
Size int64 `json:"size"` Size int64 `json:"size"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// VmAddDevice struct for VmAddDevice // VmAddDevice struct for VmAddDevice
type VmAddDevice struct { type VmAddDevice struct {
Path string `json:"path,omitempty"` Path string `json:"path,omitempty"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// VmConfig Virtual machine configuration // VmConfig Virtual machine configuration
type VmConfig struct { type VmConfig struct {
Cpus CpusConfig `json:"cpus,omitempty"` Cpus CpusConfig `json:"cpus,omitempty"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// VmInfo Virtual Machine information // VmInfo Virtual Machine information
type VmInfo struct { type VmInfo struct {
Config VmConfig `json:"config"` Config VmConfig `json:"config"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// VmRemoveDevice struct for VmRemoveDevice // VmRemoveDevice struct for VmRemoveDevice
type VmRemoveDevice struct { type VmRemoveDevice struct {
Id string `json:"id,omitempty"` Id string `json:"id,omitempty"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// VmResize struct for VmResize // VmResize struct for VmResize
type VmResize struct { type VmResize struct {
DesiredVcpus int32 `json:"desired_vcpus,omitempty"` DesiredVcpus int32 `json:"desired_vcpus,omitempty"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// VmResizeZone struct for VmResizeZone // VmResizeZone struct for VmResizeZone
type VmResizeZone struct { type VmResizeZone struct {
Id string `json:"id,omitempty"` Id string `json:"id,omitempty"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// VmSnapshotConfig struct for VmSnapshotConfig // VmSnapshotConfig struct for VmSnapshotConfig
type VmSnapshotConfig struct { type VmSnapshotConfig struct {
DestinationUrl string `json:"destination_url,omitempty"` DestinationUrl string `json:"destination_url,omitempty"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// VmmPingResponse Virtual Machine Monitor information // VmmPingResponse Virtual Machine Monitor information
type VmmPingResponse struct { type VmmPingResponse struct {
Version string `json:"version"` Version string `json:"version"`

View File

@ -8,6 +8,7 @@
*/ */
package openapi package openapi
// VsockConfig struct for VsockConfig // VsockConfig struct for VsockConfig
type VsockConfig struct { type VsockConfig struct {
// Guest Vsock CID // Guest Vsock CID

View File

@ -36,10 +36,10 @@ import (
pkgUtils "github.com/kata-containers/kata-containers/src/runtime/pkg/utils" pkgUtils "github.com/kata-containers/kata-containers/src/runtime/pkg/utils"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config"
persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api" persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/uuid" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/uuid"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types"
) )
// romFile is the file name of the ROM that can be used for virtio-pci devices. // romFile is the file name of the ROM that can be used for virtio-pci devices.

View File

@ -13,8 +13,8 @@ import (
"github.com/vishvananda/netlink" "github.com/vishvananda/netlink"
persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api" persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/uuid"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types" vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/uuid"
) )
// TapEndpoint represents just a tap endpoint // TapEndpoint represents just a tap endpoint

View File

@ -13,8 +13,8 @@ import (
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config"
persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api" persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types" vcTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils"
) )
// Long term, this should be made more configurable. For now matching path // Long term, this should be made more configurable. For now matching path