Skip to content

Commit

Permalink
golangci-lint: Acknowledge all remaining checks and update golanci-li…
Browse files Browse the repository at this point in the history
…nt to v1.43.0

Signed-off-by: Mario Trangoni <[email protected]>
  • Loading branch information
mjtrangoni committed Dec 24, 2021
1 parent df4f6b2 commit 919f90a
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 15 deletions.
8 changes: 5 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ linters:
enable:
- deadcode
- errcheck
- golint
- revive
- govet
- gofmt
- ineffassign
- interfacer
- structcheck
- unconvert
- varcheck
Expand All @@ -20,4 +19,7 @@ issues:
- # Golint has many capitalisation complaints on WMI class names
text: "`?\\w+`? should be `?\\w+`?"
linters:
- golint
- revive
- text: "don't use ALL_CAPS in Go names; use CamelCase"
linters:
- revive
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ install:
- set PATH=%PATH%;C:\msys64\mingw64\bin
- choco install gitversion.portable make -y
- ps: |
appveyor DownloadFile https://github.com/golangci/golangci-lint/releases/download/v1.21.0/golangci-lint-1.21.0-windows-amd64.zip
Expand-Archive golangci-lint-1.21.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
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.43.0-windows-amd64.zip
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/[email protected]
- go install github.com/josephspurrier/goversioninfo/cmd/[email protected]

Expand Down
2 changes: 1 addition & 1 deletion collector/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ func benchmarkCollector(b *testing.B, name string, collectFunc func() (Collector
}()

for i := 0; i < b.N; i++ {
c.Collect(scrapeContext, metrics)
c.Collect(scrapeContext, metrics) //nolint:errcheck
}
}
8 changes: 4 additions & 4 deletions collector/iis.go
Original file line number Diff line number Diff line change
Expand Up @@ -1275,13 +1275,13 @@ type perflibW3SVC_W3WP struct {

URICacheFlushesTotal 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"`
URICacheHitsTotalKernel float64 `perflib:"Kernel\: URI Cache Hits"`
URICacheHitsTotalKernel float64 `perflib:"Kernel\: URI Cache Hits"` //nolint:govet
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"`
URIsCachedKernel float64 `perflib:"Kernel\: Current URIs Cached"`
URIsCachedKernel float64 `perflib:"Kernel\: Current URIs Cached"` //nolint:govet
URIsCachedTotal float64 `perflib:"Total URIs Cached"`
URIsCachedTotalKernel float64 `perflib:"Total URIs Cached"`
URIsFlushedTotal float64 `perflib:"Total Flushed URIs"`
Expand Down
2 changes: 1 addition & 1 deletion collector/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (c *serviceCollector) collectAPI(ch chan<- prometheus.Metric) error {
if err != nil {
return err
}
defer svcmgrConnection.Disconnect()
defer svcmgrConnection.Disconnect() //nolint:errcheck

// List All Services from the Services Manager
serviceList, err := svcmgrConnection.ListServices()
Expand Down
2 changes: 1 addition & 1 deletion exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ func (mh *metricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if err != nil {
log.Warnln("Couldn't create filtered metrics handler: ", err)
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
}
reg.MustRegister(wc)
Expand Down
2 changes: 1 addition & 1 deletion headers/netapi32/netapi32.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var NetApiStatus = map[uint32]string{
// 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
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.
Expand Down
2 changes: 1 addition & 1 deletion headers/sysinfoapi/sysinfoapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func GlobalMemoryStatusEx() (MemoryStatus, error) {
// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsysteminfo
func GetSystemInfo() SystemInfo {
var info lpSystemInfo
procGetSystemInfo.Call(uintptr(unsafe.Pointer(&info)))
procGetSystemInfo.Call(uintptr(unsafe.Pointer(&info))) //nolint:errcheck
return SystemInfo{
Arch: ProcessorArchitecture(info.Arch.WProcessorArchitecture),
PageSize: info.DwPageSize,
Expand Down

0 comments on commit 919f90a

Please sign in to comment.