mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-04 09:36:35 +00:00
golangci-lint: Acknowledge all remaining checks and update golanci-lint to v1.43.0
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
This commit is contained in:
@@ -3,11 +3,10 @@ linters:
|
|||||||
enable:
|
enable:
|
||||||
- deadcode
|
- deadcode
|
||||||
- errcheck
|
- errcheck
|
||||||
- golint
|
- revive
|
||||||
- govet
|
- govet
|
||||||
- gofmt
|
- gofmt
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- interfacer
|
|
||||||
- structcheck
|
- structcheck
|
||||||
- unconvert
|
- unconvert
|
||||||
- varcheck
|
- varcheck
|
||||||
@@ -20,4 +19,7 @@ issues:
|
|||||||
- # Golint has many capitalisation complaints on WMI class names
|
- # Golint has many capitalisation complaints on WMI class names
|
||||||
text: "`?\\w+`? should be `?\\w+`?"
|
text: "`?\\w+`? should be `?\\w+`?"
|
||||||
linters:
|
linters:
|
||||||
- golint
|
- revive
|
||||||
|
- text: "don't use ALL_CAPS in Go names; use CamelCase"
|
||||||
|
linters:
|
||||||
|
- revive
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ install:
|
|||||||
- set PATH=%PATH%;C:\msys64\mingw64\bin
|
- set PATH=%PATH%;C:\msys64\mingw64\bin
|
||||||
- choco install gitversion.portable make -y
|
- choco install gitversion.portable make -y
|
||||||
- ps: |
|
- ps: |
|
||||||
appveyor DownloadFile https://github.com/golangci/golangci-lint/releases/download/v1.21.0/golangci-lint-1.21.0-windows-amd64.zip
|
appveyor DownloadFile https://github.com/golangci/golangci-lint/releases/download/v1.43.0/golangci-lint-1.43.0-windows-amd64.zip
|
||||||
Expand-Archive golangci-lint-1.21.0-windows-amd64.zip
|
Expand-Archive golangci-lint-1.43.0-windows-amd64.zip
|
||||||
Move-Item golangci-lint-1.21.0-windows-amd64\golangci-lint-1.21.0-windows-amd64\golangci-lint.exe $env:GOPATH\bin\golangci-lint.exe
|
Move-Item golangci-lint-1.43.0-windows-amd64\golangci-lint-1.43.0-windows-amd64\golangci-lint.exe $env:GOPATH\bin\golangci-lint.exe
|
||||||
- go install github.com/prometheus/promu@v0.11.1
|
- go install github.com/prometheus/promu@v0.11.1
|
||||||
- go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.2.0
|
- go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.2.0
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,6 @@ func benchmarkCollector(b *testing.B, name string, collectFunc func() (Collector
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
c.Collect(scrapeContext, metrics)
|
c.Collect(scrapeContext, metrics) //nolint:errcheck
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1275,13 +1275,13 @@ type perflibW3SVC_W3WP struct {
|
|||||||
|
|
||||||
URICacheFlushesTotal float64 `perflib:"Total Flushed URIs"`
|
URICacheFlushesTotal float64 `perflib:"Total Flushed URIs"`
|
||||||
URICacheFlushesTotalKernel float64 `perflib:"Total Flushed URIs"`
|
URICacheFlushesTotalKernel float64 `perflib:"Total Flushed URIs"`
|
||||||
URIsFlushedTotalKernel float64 `perflib:"Kernel\: Total Flushed URIs"`
|
URIsFlushedTotalKernel float64 `perflib:"Kernel\: Total Flushed URIs"` //nolint:govet
|
||||||
URICacheHitsTotal float64 `perflib:"URI Cache Hits"`
|
URICacheHitsTotal float64 `perflib:"URI Cache Hits"`
|
||||||
URICacheHitsTotalKernel float64 `perflib:"Kernel\: URI Cache Hits"`
|
URICacheHitsTotalKernel float64 `perflib:"Kernel\: URI Cache Hits"` //nolint:govet
|
||||||
URICacheMissesTotal float64 `perflib:"URI Cache Misses"`
|
URICacheMissesTotal float64 `perflib:"URI Cache Misses"`
|
||||||
URICacheMissesTotalKernel float64 `perflib:"Kernel\: URI Cache Misses"`
|
URICacheMissesTotalKernel float64 `perflib:"Kernel\: URI Cache Misses"` //nolint:govet
|
||||||
URIsCached float64 `perflib:"Current URIs Cached"`
|
URIsCached float64 `perflib:"Current URIs Cached"`
|
||||||
URIsCachedKernel float64 `perflib:"Kernel\: Current URIs Cached"`
|
URIsCachedKernel float64 `perflib:"Kernel\: Current URIs Cached"` //nolint:govet
|
||||||
URIsCachedTotal float64 `perflib:"Total URIs Cached"`
|
URIsCachedTotal float64 `perflib:"Total URIs Cached"`
|
||||||
URIsCachedTotalKernel float64 `perflib:"Total URIs Cached"`
|
URIsCachedTotalKernel float64 `perflib:"Total URIs Cached"`
|
||||||
URIsFlushedTotal float64 `perflib:"Total Flushed URIs"`
|
URIsFlushedTotal float64 `perflib:"Total Flushed URIs"`
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ func (c *serviceCollector) collectAPI(ch chan<- prometheus.Metric) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer svcmgrConnection.Disconnect()
|
defer svcmgrConnection.Disconnect() //nolint:errcheck
|
||||||
|
|
||||||
// List All Services from the Services Manager
|
// List All Services from the Services Manager
|
||||||
serviceList, err := svcmgrConnection.ListServices()
|
serviceList, err := svcmgrConnection.ListServices()
|
||||||
|
|||||||
@@ -504,7 +504,7 @@ func (mh *metricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnln("Couldn't create filtered metrics handler: ", err)
|
log.Warnln("Couldn't create filtered metrics handler: ", err)
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
w.Write([]byte(fmt.Sprintf("Couldn't create filtered metrics handler: %s", err)))
|
w.Write([]byte(fmt.Sprintf("Couldn't create filtered metrics handler: %s", err))) //nolint:errcheck
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
reg.MustRegister(wc)
|
reg.MustRegister(wc)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ var NetApiStatus = map[uint32]string{
|
|||||||
// NetApiBufferFree frees the memory other network management functions use internally to return information.
|
// NetApiBufferFree frees the memory other network management functions use internally to return information.
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/api/lmapibuf/nf-lmapibuf-netapibufferfree
|
// https://docs.microsoft.com/en-us/windows/win32/api/lmapibuf/nf-lmapibuf-netapibufferfree
|
||||||
func netApiBufferFree(buffer *wKSTAInfo102) {
|
func netApiBufferFree(buffer *wKSTAInfo102) {
|
||||||
procNetApiBufferFree.Call(uintptr(unsafe.Pointer(buffer)))
|
procNetApiBufferFree.Call(uintptr(unsafe.Pointer(buffer))) //nolint:errcheck
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetWkstaGetInfo returns information about the configuration of a workstation.
|
// NetWkstaGetInfo returns information about the configuration of a workstation.
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ func GlobalMemoryStatusEx() (MemoryStatus, error) {
|
|||||||
// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsysteminfo
|
// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsysteminfo
|
||||||
func GetSystemInfo() SystemInfo {
|
func GetSystemInfo() SystemInfo {
|
||||||
var info lpSystemInfo
|
var info lpSystemInfo
|
||||||
procGetSystemInfo.Call(uintptr(unsafe.Pointer(&info)))
|
procGetSystemInfo.Call(uintptr(unsafe.Pointer(&info))) //nolint:errcheck
|
||||||
return SystemInfo{
|
return SystemInfo{
|
||||||
Arch: ProcessorArchitecture(info.Arch.WProcessorArchitecture),
|
Arch: ProcessorArchitecture(info.Arch.WProcessorArchitecture),
|
||||||
PageSize: info.DwPageSize,
|
PageSize: info.DwPageSize,
|
||||||
|
|||||||
Reference in New Issue
Block a user