diff --git a/helpers/windows/pdh/pdh_query_windows.go b/helpers/windows/pdh/pdh_query_windows.go index 95aafdb..857753e 100644 --- a/helpers/windows/pdh/pdh_query_windows.go +++ b/helpers/windows/pdh/pdh_query_windows.go @@ -219,7 +219,7 @@ func (q *Query) GetRawCounterValue(counterName string) (PdhRawCounter, error) { return c, nil } -func (q *Query) GetRawCounterArray(counterName string, filterTotal bool) (RawCouterArray, error) { +func (q *Query) GetRawCounterArray(counterName string, filterTotal bool) (RawCounterArray, error) { if _, ok := q.Counters[counterName]; !ok { return nil, fmt.Errorf("%s doesn't exist in the map; call AddCounter()", counterName) } diff --git a/helpers/windows/pdh/pdh_query_windows_test.go b/helpers/windows/pdh/pdh_query_windows_test.go index 9a9d92d..17b6f85 100644 --- a/helpers/windows/pdh/pdh_query_windows_test.go +++ b/helpers/windows/pdh/pdh_query_windows_test.go @@ -233,7 +233,7 @@ func TestSortOrder(t *testing.T) { // confirm that each index corresponds to one particular instance (i.e. core) for i := 0; i < len(rawCounters)-1; i++ { for j := 0; j < len(rawCounters[i]); j++ { - assert.Equalf(t, rawCounters[i][j].InstanceName, rawCounters[i+1][j].InstanceName, "Instanse name should be equal") + assert.Equalf(t, rawCounters[i][j].InstanceName, rawCounters[i+1][j].InstanceName, "Instance name should be equal") } } }) diff --git a/helpers/windows/pdh/pdh_windows.go b/helpers/windows/pdh/pdh_windows.go index 8f28f8a..d44ec56 100644 --- a/helpers/windows/pdh/pdh_windows.go +++ b/helpers/windows/pdh/pdh_windows.go @@ -122,17 +122,17 @@ type PdhRawCounterItem struct { RawValue PdhRawCounter } -type RawCouterArray []PdhRawCounterItem +type RawCounterArray []PdhRawCounterItem -func (a RawCouterArray) Len() int { +func (a RawCounterArray) Len() int { return len(a) } -func (a RawCouterArray) Swap(i, j int) { +func (a RawCounterArray) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a RawCouterArray) Less(i, j int) bool { +func (a RawCounterArray) Less(i, j int) bool { return a[i].InstanceName < a[j].InstanceName } @@ -243,7 +243,7 @@ func PdhGetRawCounterValue(counter PdhCounterHandle) (PdhRawCounter, error) { return value, nil } -func PdhGetRawCounterArray(counter PdhCounterHandle, filterTotal bool) (RawCouterArray, error) { +func PdhGetRawCounterArray(counter PdhCounterHandle, filterTotal bool) (RawCounterArray, error) { var bufferSize, itemCount uint32 if err := _PdhGetRawCounterArray(counter, &bufferSize, &itemCount, nil); err != nil { if PdhErrno(err.(syscall.Errno)) != PDH_MORE_DATA { @@ -267,7 +267,7 @@ func PdhGetRawCounterArray(counter PdhCounterHandle, filterTotal bool) (RawCoute } // we sort the array by the instance name to ensure that each index in the final array corresponds to a specific core // This is important because we will be collecting three different types of counters, and sorting ensures that each index in each counter aligns with the correct core. - sort.Sort(RawCouterArray(ret)) + sort.Sort(RawCounterArray(ret)) return ret, nil } return nil, PdhErrno(syscall.ERROR_NOT_FOUND)