diff --git a/cli/kata-check.go b/cli/kata-check.go index d47328867c..22c615fcf7 100644 --- a/cli/kata-check.go +++ b/cli/kata-check.go @@ -52,9 +52,9 @@ const ( kernelPropertyCorrect = "Kernel property value correct" // these refer to fields in the procCPUINFO file - genericCPUFlagsTag = "flags" - genericCPUVendorField = "vendor_id" - genericCPUModelField = "model name" + genericCPUFlagsTag = "flags" // nolint: varcheck, unused + genericCPUVendorField = "vendor_id" // nolint: varcheck, unused + genericCPUModelField = "model name" // nolint: varcheck, unused ) // variables rather than consts to allow tests to modify them diff --git a/cli/kata-check_arm64.go b/cli/kata-check_arm64.go index 615e5aeaf4..0b116ad65b 100644 --- a/cli/kata-check_arm64.go +++ b/cli/kata-check_arm64.go @@ -121,12 +121,12 @@ func normalizeArmModel(model string) string { return model } -func getCPUDetails() (vendor, model string, err error) { - if vendor, model, err := genericGetCPUDetails(); err == nil { +func getCPUDetails() (string, string, error) { + vendor, model, err := genericGetCPUDetails() + if err == nil { vendor = normalizeArmVendor(vendor) model = normalizeArmModel(model) - return vendor, model, err - } else { - return vendor, model, err } + + return vendor, model, err } diff --git a/cli/kata-check_test.go b/cli/kata-check_test.go index 7c2cde4d59..6fcf3aa230 100644 --- a/cli/kata-check_test.go +++ b/cli/kata-check_test.go @@ -27,12 +27,14 @@ type testModuleData struct { contents string } +// nolint: structcheck, unused type testCPUData struct { vendorID string flags string expectError bool } +// nolint: structcheck, unused type testCPUDetail struct { contents string expectedVendor string @@ -145,6 +147,7 @@ func makeCPUInfoFile(path, vendorID, flags string) error { return ioutil.WriteFile(path, contents.Bytes(), testFileMode) } +// nolint: unused func genericTestGetCPUDetails(t *testing.T, validVendor string, validModel string, validContents string, data []testCPUDetail) { tmpdir, err := ioutil.TempDir("", "") if err != nil { diff --git a/cli/kata-env_test.go b/cli/kata-env_test.go index 966b818bc6..7cb8071b6c 100644 --- a/cli/kata-env_test.go +++ b/cli/kata-env_test.go @@ -244,6 +244,7 @@ func getExpectedAgentDetails(config oci.RuntimeConfig) (AgentInfo, error) { }, nil } +// nolint: unused func genericGetExpectedHostDetails(tmpdir string, expectedVendor string, expectedModel string) (HostInfo, error) { type filesToCreate struct { file string diff --git a/virtcontainers/qemu.go b/virtcontainers/qemu.go index 38836e55ac..8b06e89963 100644 --- a/virtcontainers/qemu.go +++ b/virtcontainers/qemu.go @@ -1400,6 +1400,7 @@ func (q *qemu) resizeMemory(reqMemMB uint32, memoryBlockSizeMB uint32) (uint32, } // genericAppendBridges appends to devices the given bridges +// nolint: unused func genericAppendBridges(devices []govmmQemu.Device, bridges []types.PCIBridge, machineType string) []govmmQemu.Device { bus := defaultPCBridgeBus switch machineType { @@ -1431,6 +1432,7 @@ func genericAppendBridges(devices []govmmQemu.Device, bridges []types.PCIBridge, return devices } +// nolint: unused func genericBridges(number uint32, machineType string) []types.PCIBridge { var bridges []types.PCIBridge var bt types.PCIType @@ -1463,6 +1465,7 @@ func genericBridges(number uint32, machineType string) []types.PCIBridge { return bridges } +// nolint: unused func genericMemoryTopology(memoryMb, hostMemoryMb uint64, slots uint8, memoryOffset uint32) govmmQemu.Memory { // image NVDIMM device needs memory space 1024MB // See https://github.com/clearcontainers/runtime/issues/380