Fix linter error

This commit is contained in:
Daniel 2020-05-01 22:20:27 +02:00
parent 3460725f66
commit 28445f642e

View file

@ -2,20 +2,18 @@ package osdetail
import ( import (
"fmt" "fmt"
"regexp"
"strings" "strings"
"sync" "sync"
"github.com/hashicorp/go-version" "github.com/hashicorp/go-version"
versionCmp "github.com/hashicorp/go-version"
"github.com/shirou/gopsutil/host" "github.com/shirou/gopsutil/host"
) )
var ( var (
versionRe = regexp.MustCompile(`[0-9\.]+`) // versionRe = regexp.MustCompile(`[0-9\.]+`)
windowsNTVersion string windowsNTVersion string
windowsNTVersionForCmp *versionCmp.Version windowsNTVersionForCmp *version.Version
fetching sync.Mutex fetching sync.Mutex
fetched bool fetched bool
@ -49,13 +47,13 @@ func WindowsNTVersion() (string, error) {
} }
// IsAtLeastWindowsNTVersion returns whether the current WindowsNT version is at least the given version or newer. // IsAtLeastWindowsNTVersion returns whether the current WindowsNT version is at least the given version or newer.
func IsAtLeastWindowsNTVersion(version string) (bool, error) { func IsAtLeastWindowsNTVersion(v string) (bool, error) {
_, err := WindowsNTVersion() _, err := WindowsNTVersion()
if err != nil { if err != nil {
return false, err return false, err
} }
versionForCmp, err := versionCmp.NewVersion(version) versionForCmp, err := version.NewVersion(v)
if err != nil { if err != nil {
return false, err return false, err
} }
@ -74,9 +72,7 @@ func IsAtLeastWindowsNTVersionWithDefault(v string, defaultValue bool) bool {
// IsAtLeastWindowsVersion returns whether the current Windows version is at least the given version or newer. // IsAtLeastWindowsVersion returns whether the current Windows version is at least the given version or newer.
func IsAtLeastWindowsVersion(v string) (bool, error) { func IsAtLeastWindowsVersion(v string) (bool, error) {
var ( var NTVersion string
NTVersion string
)
switch v { switch v {
case "7": case "7":
NTVersion = "6.1" NTVersion = "6.1"