From bb9495c0b756d0748e1f6142f1ae2589be68ccc9 Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Tue, 20 Jul 2021 10:29:12 -0500 Subject: [PATCH] runtime: virtcontainers/pkg: fix govet fieldalignment Fix structures alignment Signed-off-by: Julio Montes --- .../virtcontainers/pkg/cgroups/manager.go | 2 +- .../virtcontainers/pkg/compatoci/utils.go | 2 +- .../virtcontainers/pkg/cpuset/cpuset_test.go | 1 + .../virtcontainers/pkg/nsenter/nsenter.go | 2 +- src/runtime/virtcontainers/pkg/oci/utils.go | 43 +++++++++---------- .../virtcontainers/pkg/oci/utils_test.go | 4 ++ .../virtcontainers/pkg/vcmock/types.go | 2 + 7 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/runtime/virtcontainers/pkg/cgroups/manager.go b/src/runtime/virtcontainers/pkg/cgroups/manager.go index 2d955de5cd..859cb76434 100644 --- a/src/runtime/virtcontainers/pkg/cgroups/manager.go +++ b/src/runtime/virtcontainers/pkg/cgroups/manager.go @@ -45,8 +45,8 @@ type Config struct { } type Manager struct { - sync.Mutex mgr libcontcgroups.Manager + sync.Mutex } const ( diff --git a/src/runtime/virtcontainers/pkg/compatoci/utils.go b/src/runtime/virtcontainers/pkg/compatoci/utils.go index 0d43aa0b43..de9c72025c 100644 --- a/src/runtime/virtcontainers/pkg/compatoci/utils.go +++ b/src/runtime/virtcontainers/pkg/compatoci/utils.go @@ -28,8 +28,8 @@ var ociLog = logrus.WithFields(logrus.Fields{ // about the type of the Capabilities field. // Refer to: https://github.com/opencontainers/runtime-spec/commit/37391fb type compatOCIProcess struct { - specs.Process Capabilities interface{} `json:"capabilities,omitempty" platform:"linux"` //nolint:govet + specs.Process } // compatOCISpec is a structure inheriting from specs.Spec defined diff --git a/src/runtime/virtcontainers/pkg/cpuset/cpuset_test.go b/src/runtime/virtcontainers/pkg/cpuset/cpuset_test.go index 433a702d22..53b0327dfd 100644 --- a/src/runtime/virtcontainers/pkg/cpuset/cpuset_test.go +++ b/src/runtime/virtcontainers/pkg/cpuset/cpuset_test.go @@ -325,6 +325,7 @@ func TestCPUSetString(t *testing.T) { } func TestParse(t *testing.T) { + //nolint: govet testCases := []struct { cpusetString string expected CPUSet diff --git a/src/runtime/virtcontainers/pkg/nsenter/nsenter.go b/src/runtime/virtcontainers/pkg/nsenter/nsenter.go index 1a9d10d3e0..70189fc369 100644 --- a/src/runtime/virtcontainers/pkg/nsenter/nsenter.go +++ b/src/runtime/virtcontainers/pkg/nsenter/nsenter.go @@ -26,6 +26,6 @@ const ( type Namespace struct { Path string - PID int Type NSType + PID int } diff --git a/src/runtime/virtcontainers/pkg/oci/utils.go b/src/runtime/virtcontainers/pkg/oci/utils.go index bbdd5dcae1..eebc642f22 100644 --- a/src/runtime/virtcontainers/pkg/oci/utils.go +++ b/src/runtime/virtcontainers/pkg/oci/utils.go @@ -79,44 +79,43 @@ const KernelModulesSeparator = ";" // FactoryConfig is a structure to set the VM factory configuration. type FactoryConfig struct { - // Template enables VM templating support in VM factory. - Template bool - // TemplatePath specifies the path of template. TemplatePath string + // VMCacheEndpoint specifies the endpoint of transport VM from the VM cache server to runtime. + VMCacheEndpoint string + // VMCacheNumber specifies the the number of caches of VMCache. VMCacheNumber uint - // VMCacheEndpoint specifies the endpoint of transport VM from the VM cache server to runtime. - VMCacheEndpoint string + // Template enables VM templating support in VM factory. + Template bool } // RuntimeConfig aggregates all runtime specific settings +// nolint: govet type RuntimeConfig struct { - HypervisorType vc.HypervisorType - HypervisorConfig vc.HypervisorConfig - - NetmonConfig vc.NetmonConfig - - AgentConfig vc.KataAgentConfig - - //Determines how the VM should be connected to the - //the container network interface - InterNetworkModel vc.NetInterworkingModel - FactoryConfig FactoryConfig - - Console string - JaegerEndpoint string - JaegerUser string - JaegerPassword string - //Paths to be bindmounted RO into the guest. SandboxBindMounts []string //Experimental features enabled Experimental []exp.Feature + Console string + JaegerEndpoint string + JaegerUser string + JaegerPassword string + HypervisorType vc.HypervisorType + + FactoryConfig FactoryConfig + HypervisorConfig vc.HypervisorConfig + NetmonConfig vc.NetmonConfig + AgentConfig vc.KataAgentConfig + + //Determines how the VM should be connected to the + //the container network interface + InterNetworkModel vc.NetInterworkingModel + Debug bool Trace bool diff --git a/src/runtime/virtcontainers/pkg/oci/utils_test.go b/src/runtime/virtcontainers/pkg/oci/utils_test.go index 1df3bab461..c751ae0fb5 100644 --- a/src/runtime/virtcontainers/pkg/oci/utils_test.go +++ b/src/runtime/virtcontainers/pkg/oci/utils_test.go @@ -860,6 +860,7 @@ func TestAddRuntimeAnnotations(t *testing.T) { func TestRegexpContains(t *testing.T) { assert := assert.New(t) + //nolint: govet type testData struct { regexps []string toMatch string @@ -888,6 +889,7 @@ func TestRegexpContains(t *testing.T) { func TestCheckPathIsInGlobs(t *testing.T) { assert := assert.New(t) + //nolint: govet type testData struct { globs []string toMatch string @@ -960,6 +962,7 @@ func TestParseAnnotationUintConfiguration(t *testing.T) { return nil } + // nolint: govet testCases := []struct { annotations map[string]string expected uint64 @@ -1043,6 +1046,7 @@ func TestParseAnnotationBoolConfiguration(t *testing.T) { boolKey = "bool_key" ) + // nolint: govet testCases := []struct { annotationKey string annotationValueList []string diff --git a/src/runtime/virtcontainers/pkg/vcmock/types.go b/src/runtime/virtcontainers/pkg/vcmock/types.go index d0060dbbcc..1125090a1b 100644 --- a/src/runtime/virtcontainers/pkg/vcmock/types.go +++ b/src/runtime/virtcontainers/pkg/vcmock/types.go @@ -20,6 +20,7 @@ import ( ) // Sandbox is a fake Sandbox type used for testing +// nolint: govet type Sandbox struct { MockID string MockURL string @@ -70,6 +71,7 @@ type Sandbox struct { } // Container is a fake Container type used for testing +// nolint: govet type Container struct { MockID string MockURL string