From a5b2501cd10b9b7f10cee11bf2faef7b0d3115b7 Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Tue, 12 Dec 2023 22:14:21 -0800 Subject: [PATCH] [chore][receiver/hostmetrics] Fix lint on Windows issues (#29792) **Description:** Fixing lint issues when GOOS=windows. This is in preparation to eventually include lint with GOOS=windows as part of CI. **Link to tracking Issue:** N/A **Testing:** `make` on component folder on a Windows box **Documentation:** N/A --- .../internal/scraper/pagingscraper/pagefile.go | 2 +- .../internal/scraper/pagingscraper/pagefile_windows.go | 8 ++++---- .../internal/handlecount/handles_windows.go | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/pagefile.go b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/pagefile.go index 5892bfd1c35c3..385e552df87a9 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/pagefile.go +++ b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/pagefile.go @@ -8,5 +8,5 @@ type pageFileStats struct { usedBytes uint64 freeBytes uint64 totalBytes uint64 - cachedBytes *uint64 // Optional + cachedBytes *uint64 //nolint:unused } diff --git a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/pagefile_windows.go b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/pagefile_windows.go index f936999896d8b..3f230a255f3a8 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/pagefile_windows.go +++ b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/pagefile_windows.go @@ -43,17 +43,17 @@ type systemInfo struct { func getPageSize() uint64 { var sysInfo systemInfo - procGetNativeSystemInfo.Call(uintptr(unsafe.Pointer(&sysInfo))) + procGetNativeSystemInfo.Call(uintptr(unsafe.Pointer(&sysInfo))) //nolint:errcheck return uint64(sysInfo.dwPageSize) } // system type as defined in https://docs.microsoft.com/en-us/windows/win32/api/psapi/ns-psapi-enum_page_file_information type enumPageFileInformation struct { - cb uint32 - reserved uint32 + cb uint32 //nolint:unused + reserved uint32 //nolint:unused totalSize uint64 totalInUse uint64 - peakUsage uint64 + peakUsage uint64 //nolint:unused } func getPageFileStats() ([]*pageFileStats, error) { diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/internal/handlecount/handles_windows.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/internal/handlecount/handles_windows.go index 876e450301db1..e6d874ff057db 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/internal/handlecount/handles_windows.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/internal/handlecount/handles_windows.go @@ -53,6 +53,7 @@ func (m *handleCountManager) GetProcessHandleCount(pid int64) (uint32, error) { type wmiHandleCountQueryer struct{} +//revive:disable-next-line:var-naming type Win32_Process struct { ProcessID int64 HandleCount uint32