runtime: pkg: fix govet fieldalignment

Fix structures alignment

Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
Julio Montes 2021-07-09 12:53:19 -05:00
parent 2b80091e14
commit 31de8eb75b
8 changed files with 44 additions and 27 deletions

View File

@ -29,10 +29,10 @@ func SetLogger(logger *logrus.Entry) {
// KataMonitor is monitor agent
type KataMonitor struct {
sandboxCache *sandboxCache
containerdAddr string
containerdConfigFile string
containerdStatePath string
sandboxCache *sandboxCache
}
// NewKataMonitor create and return a new KataMonitor instance

View File

@ -44,6 +44,7 @@ func TestComposeSocketAddress(t *testing.T) {
},
}
// nolint: govet
testCases := []struct {
url string
err bool

View File

@ -28,12 +28,6 @@ const (
type Constraints struct {
Issue string
UID int
// Not ideal: set when UID needs to be checked. This allows
// a test for UID 0 to be detected.
UIDSet bool
// DistroName is the name of a distro in all lower-case letters.
DistroName string
@ -44,8 +38,14 @@ type Constraints struct {
// KernelVersion is the version of a particular kernel.
KernelVersion string
UID int
// Operator is the operator to apply to one of the constraints.
Operator Operator
// Not ideal: set when UID needs to be checked. This allows
// a test for UID 0 to be detected.
UIDSet bool
}
// Constraint is a function that operates on a Constraints object to set
@ -54,23 +54,23 @@ type Constraint func(c *Constraints)
// TestConstraint records details about test constraints.
type TestConstraint struct {
Debug bool
// Effective user ID of running test
ActualEUID int
DistroName string
DistroVersion string
KernelVersion string
// Optionally used to record an issue number that relates to the
// constraint.
Issue string
// Used to record all passed and failed constraints in
// human-readable form.
Passed []Result
Failed []Result
// Optionally used to record an issue number that relates to the
// constraint.
Issue string
Debug bool
// Effective user ID of running test
ActualEUID int
}
// NewKataTest creates a new TestConstraint object and is the main interface

View File

@ -27,12 +27,14 @@ const (
skipUnknownDistroName = "skipping test as cannot determine distro name"
)
// nolint: govet
type testDataUID struct {
uid int
op Operator
c Constraints
}
// nolint: govet
type testDataDistro struct {
distro string
op Operator
@ -341,6 +343,7 @@ func testGetKernelVersion() (version string, err error) {
func TestOperatorString(t *testing.T) {
assert := assert.New(t)
// nolint: govet
type testData struct {
op Operator
value string
@ -473,6 +476,7 @@ func TestGetKernelVersion(t *testing.T) {
func TestConstraintHandleDistroName(t *testing.T) {
assert := assert.New(t)
// nolint: govet
type testData struct {
distro string
op Operator
@ -568,6 +572,7 @@ func TestConstraintHandleDistroVersion(t *testing.T) {
assert.NoError(err)
assert.NotEqual(distroVersion, higherVersion)
// nolint: govet
type testData struct {
version string
op Operator
@ -623,6 +628,7 @@ func TestConstraintHandleDistroVersion(t *testing.T) {
func TestConstraintHandleVersionType(t *testing.T) {
assert := assert.New(t)
// nolint: govet
type testData struct {
versionName string
currentVersion string
@ -791,6 +797,7 @@ func TestConstraintHandleKernelVersion(t *testing.T) {
newerPatch, err := semverBumpVersion(ver, false, false, true)
assert.NoError(err)
// nolint: govet
type testData struct {
version string
op Operator
@ -852,6 +859,7 @@ func TestConstraintHandleKernelVersion(t *testing.T) {
func TestConstraintHandleUID(t *testing.T) {
assert := assert.New(t)
// nolint: govet
type testData struct {
uid int
op Operator
@ -897,6 +905,7 @@ func TestConstraintHandleUID(t *testing.T) {
func TestConstraintHandleResults(t *testing.T) {
assert := assert.New(t)
// nolint: govet
type testData struct {
result Result
err error
@ -1330,6 +1339,7 @@ func TestConstraintNotValidDistroVersion(t *testing.T) {
func TestConstraintConstraintValid(t *testing.T) {
assert := assert.New(t)
// nolint: govet
type testData struct {
fn Constraint
valid bool
@ -1522,6 +1532,7 @@ func TestConstraintConstraintValid(t *testing.T) {
func TestEvalIntVersion(t *testing.T) {
assert := assert.New(t)
// nolint: govet
type testData struct {
currentVer string
op Operator
@ -1627,6 +1638,7 @@ func TestEvalIntVersion(t *testing.T) {
func TestEvalFloatVersion(t *testing.T) {
assert := assert.New(t)
// nolint: govet
type testData struct {
currentVer string
op Operator
@ -1742,6 +1754,7 @@ func TestEvalFloatVersion(t *testing.T) {
func TestEvalSemverVersion(t *testing.T) {
assert := assert.New(t)
// nolint: govet
type testData struct {
currentVer string
op Operator

View File

@ -11,10 +11,6 @@ import "strconv"
type RuntimeConfigOptions struct {
Hypervisor string
HypervisorPath string
DefaultVCPUCount uint32
DefaultMaxVCPUCount uint32
DefaultMemSize uint32
DefaultMsize9p uint32
DefaultGuestHookPath string
KernelPath string
ImagePath string
@ -28,8 +24,15 @@ type RuntimeConfigOptions struct {
AgentTraceType string
SharedFS string
VirtioFSDaemon string
JaegerEndpoint string
JaegerUser string
JaegerPassword string
PFlash []string
PCIeRootPort uint32
DefaultVCPUCount uint32
DefaultMaxVCPUCount uint32
DefaultMemSize uint32
DefaultMsize9p uint32
DisableBlock bool
EnableIOThreads bool
HotplugVFIOOnRootBus bool
@ -42,9 +45,6 @@ type RuntimeConfigOptions struct {
AgentDebug bool
AgentTrace bool
EnablePprof bool
JaegerEndpoint string
JaegerUser string
JaegerPassword string
}
// ContainerIDTestDataType is a type used to test Container and Sandbox ID's.

View File

@ -55,21 +55,21 @@ type tomlConfig struct {
Hypervisor map[string]hypervisor
Agent map[string]agent
Runtime runtime
Factory factory
Netmon netmon
Image image
Netmon netmon
Factory factory
}
type image struct {
ServiceOffload bool `toml:"service_offload"`
Provision string `toml:"provision"`
ServiceOffload bool `toml:"service_offload"`
}
type factory struct {
Template bool `toml:"enable_template"`
TemplatePath string `toml:"template_path"`
VMCacheNumber uint `toml:"vm_cache_number"`
VMCacheEndpoint string `toml:"vm_cache_endpoint"`
VMCacheNumber uint `toml:"vm_cache_number"`
Template bool `toml:"enable_template"`
}
type hypervisor struct {

View File

@ -39,6 +39,7 @@ var (
jaegerPassword = "jaeger_password1"
)
// nolint: govet
type testRuntimeConfig struct {
RuntimeConfig oci.RuntimeConfig
RuntimeConfigFile string
@ -1574,6 +1575,7 @@ func TestCheckNetNsConfig(t *testing.T) {
func TestCheckFactoryConfig(t *testing.T) {
assert := assert.New(t)
// nolint: govet
type testData struct {
factoryEnabled bool
expectError bool

View File

@ -57,6 +57,7 @@ func TestEnsureDir(t *testing.T) {
assert.NoError(err)
defer os.RemoveAll(tmpdir)
// nolint: govet
testCases := []struct {
before func()
path string