Fix Lint on Windows and enable the job

[NO NEW TESTS NEEDED] Purely refactoring

Signed-off-by: Matt Heon <mheon@redhat.com>
This commit is contained in:
Matt Heon
2024-02-19 10:46:50 -05:00
parent d5a17ad9a0
commit ec68f07c04
25 changed files with 212 additions and 151 deletions

View File

@ -24,8 +24,8 @@ const (
HvsockPurpose = "Purpose"
// VsockRegistryPath describes the registry path to where the hvsock registry entries live
VsockRegistryPath = `SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\GuestCommunicationServices`
// LinuxVm is the default guid for a Linux VM on Windows
LinuxVm = "FACB-11E6-BD58-64006A7986D3"
// LinuxVM is the default guid for a Linux VM on Windows
LinuxVM = "FACB-11E6-BD58-64006A7986D3"
)
// HVSockPurpose describes what the hvsock is needed for
@ -141,7 +141,6 @@ func (hv *HVSockRegistryEntry) validate() error {
if len(hv.KeyName) < 1 {
return errors.New("required field keypath is empty")
}
//decimal_num, err = strconv.ParseInt(hexadecimal_num, 16, 64)
return nil
}
@ -150,7 +149,7 @@ func (hv *HVSockRegistryEntry) exists() (bool, error) {
_ = foo
_, err := openVSockRegistryEntry(hv.fqPath())
if err == nil {
return true, err
return true, nil
}
if errors.Is(err, registry.ErrNotExist) {
return false, nil
@ -191,7 +190,7 @@ func findOpenHVSockPort() (uint64, error) {
func NewHVSockRegistryEntry(machineName string, purpose HVSockPurpose) (*HVSockRegistryEntry, error) {
// a so-called wildcard entry ... everything from FACB -> 6D3 is MS special sauce
// for a " linux vm". this first segment is hexi for the hvsock port number
//00000400-FACB-11E6-BD58-64006A7986D3
// 00000400-FACB-11E6-BD58-64006A7986D3
port, err := findOpenHVSockPort()
if err != nil {
return nil, err
@ -212,7 +211,7 @@ func portToKeyName(port uint64) string {
// this could be flattened but given the complexity, I thought it might
// be more difficult to read
hexi := strings.ToUpper(fmt.Sprintf("%08x", port))
return fmt.Sprintf("%s-%s", hexi, LinuxVm)
return fmt.Sprintf("%s-%s", hexi, LinuxVM)
}
func LoadHVSockRegistryEntry(port uint64) (*HVSockRegistryEntry, error) {