mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-09 14:36:38 +00:00
chore: enable more linter (#1557)
This commit is contained in:
@@ -19,7 +19,7 @@ type wKSTAInfo102 struct {
|
||||
wki102_logged_on_users uint32
|
||||
}
|
||||
|
||||
// WorkstationInfo is an idiomatic wrapper of WKSTAInfo102
|
||||
// WorkstationInfo is an idiomatic wrapper of WKSTAInfo102.
|
||||
type WorkstationInfo struct {
|
||||
PlatformId uint32
|
||||
ComputerName string
|
||||
@@ -89,7 +89,7 @@ func netWkstaGetInfo() (wKSTAInfo102, uint32, error) {
|
||||
return deref, 0, nil
|
||||
}
|
||||
|
||||
// GetWorkstationInfo is an idiomatic wrapper for netWkstaGetInfo
|
||||
// GetWorkstationInfo is an idiomatic wrapper for netWkstaGetInfo.
|
||||
func GetWorkstationInfo() (WorkstationInfo, error) {
|
||||
info, _, err := netWkstaGetInfo()
|
||||
if err != nil {
|
||||
|
||||
@@ -24,7 +24,7 @@ const (
|
||||
SL_GEN_STATE_LAST
|
||||
)
|
||||
|
||||
// SLIsWindowsGenuineLocal function wrapper
|
||||
// SLIsWindowsGenuineLocal function wrapper.
|
||||
func SLIsWindowsGenuineLocal() (SL_GENUINE_STATE, error) {
|
||||
var genuineState SL_GENUINE_STATE
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ type memoryStatusEx struct {
|
||||
UllAvailExtendedVirtual uint64
|
||||
}
|
||||
|
||||
// MemoryStatus is an idiomatic wrapper for MemoryStatusEx
|
||||
// MemoryStatus is an idiomatic wrapper for MemoryStatusEx.
|
||||
type MemoryStatus struct {
|
||||
MemoryLoad uint32
|
||||
TotalPhys uint64
|
||||
@@ -40,17 +40,17 @@ type wProcessorArchitecture struct {
|
||||
WReserved uint16
|
||||
}
|
||||
|
||||
// ProcessorArchitecture is an idiomatic wrapper for wProcessorArchitecture
|
||||
// ProcessorArchitecture is an idiomatic wrapper for wProcessorArchitecture.
|
||||
type ProcessorArchitecture uint16
|
||||
|
||||
// Idiomatic values for wProcessorArchitecture
|
||||
// Idiomatic values for wProcessorArchitecture.
|
||||
const (
|
||||
AMD64 ProcessorArchitecture = 9
|
||||
ARM = 5
|
||||
ARM64 = 12
|
||||
IA64 = 6
|
||||
INTEL = 0
|
||||
UNKNOWN = 0xffff
|
||||
ARM ProcessorArchitecture = 5
|
||||
ARM64 ProcessorArchitecture = 12
|
||||
IA64 ProcessorArchitecture = 6
|
||||
INTEL ProcessorArchitecture = 0
|
||||
UNKNOWN ProcessorArchitecture = 0xffff
|
||||
)
|
||||
|
||||
// LpSystemInfo is a wrapper for LPSYSTEM_INFO
|
||||
@@ -68,7 +68,7 @@ type lpSystemInfo struct {
|
||||
WProcessorRevision uint16
|
||||
}
|
||||
|
||||
// SystemInfo is an idiomatic wrapper for LpSystemInfo
|
||||
// SystemInfo is an idiomatic wrapper for LpSystemInfo.
|
||||
type SystemInfo struct {
|
||||
Arch ProcessorArchitecture
|
||||
PageSize uint32
|
||||
@@ -82,10 +82,10 @@ type SystemInfo struct {
|
||||
ProcessorRevision uint16
|
||||
}
|
||||
|
||||
// WinComputerNameFormat is a wrapper for COMPUTER_NAME_FORMAT
|
||||
// WinComputerNameFormat is a wrapper for COMPUTER_NAME_FORMAT.
|
||||
type WinComputerNameFormat int
|
||||
|
||||
// Definitions for WinComputerNameFormat constants
|
||||
// Definitions for WinComputerNameFormat constants.
|
||||
const (
|
||||
ComputerNameNetBIOS WinComputerNameFormat = iota
|
||||
ComputerNameDNSHostname
|
||||
@@ -112,7 +112,7 @@ func GlobalMemoryStatusEx() (MemoryStatus, error) {
|
||||
mse.dwLength = (uint32)(unsafe.Sizeof(mse))
|
||||
r1, _, err := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&mse)))
|
||||
|
||||
if ret := *(*bool)(unsafe.Pointer(&r1)); ret == false {
|
||||
if ret := *(*bool)(unsafe.Pointer(&r1)); !ret {
|
||||
return MemoryStatus{}, err
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
type WTSTypeClass int
|
||||
|
||||
// The valid values for the WTSTypeClass enumeration
|
||||
// The valid values for the WTSTypeClass enumeration.
|
||||
const (
|
||||
WTSTypeProcessInfoLevel0 WTSTypeClass = iota
|
||||
WTSTypeProcessInfoLevel1
|
||||
@@ -138,11 +138,11 @@ func WTSCloseServer(server syscall.Handle) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func WTSFreeMemoryEx(class WTSTypeClass, pMemory uintptr, NumberOfEntries uint32) error {
|
||||
func WTSFreeMemoryEx(class WTSTypeClass, pMemory uintptr, numberOfEntries uint32) error {
|
||||
r1, _, err := procWTSFreeMemoryEx.Call(
|
||||
uintptr(class),
|
||||
pMemory,
|
||||
uintptr(NumberOfEntries),
|
||||
uintptr(numberOfEntries),
|
||||
)
|
||||
|
||||
if r1 != 1 {
|
||||
@@ -182,7 +182,7 @@ func WTSEnumerateSessionsEx(server syscall.Handle, logger log.Logger) ([]WTSSess
|
||||
sessionSize := unsafe.Sizeof(sizeTest)
|
||||
|
||||
sessions := make([]WTSSession, 0, count)
|
||||
for i := uint32(0); i < count; i++ {
|
||||
for i := range count {
|
||||
curPtr := unsafe.Pointer(sessionInfoPointer + (uintptr(i) * sessionSize))
|
||||
data := (*wtsSessionInfo1)(curPtr)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user