diff --git a/.golangci.yaml b/.golangci.yaml index c9f9b66b..4e21c24c 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -3,11 +3,10 @@ linters: enable: - deadcode - errcheck - - golint + - revive - govet - gofmt - ineffassign - - interfacer - structcheck - unconvert - varcheck @@ -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 diff --git a/appveyor.yml b/appveyor.yml index 6afbe874..159f7afe 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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/promu@v0.11.1 - go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.2.0 diff --git a/collector/ad.go b/collector/ad.go index 6511a582..cbf0b57a 100644 --- a/collector/ad.go +++ b/collector/ad.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/adfs.go b/collector/adfs.go index 9357b8b1..8b947896 100644 --- a/collector/adfs.go +++ b/collector/adfs.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/cache.go b/collector/cache.go index cf9d8cd9..bba70f82 100644 --- a/collector/cache.go +++ b/collector/cache.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/collector_test.go b/collector/collector_test.go index cfbc284d..c356d873 100644 --- a/collector/collector_test.go +++ b/collector/collector_test.go @@ -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 } } diff --git a/collector/container.go b/collector/container.go index 0f013457..7f42ed9b 100644 --- a/collector/container.go +++ b/collector/container.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/cpu.go b/collector/cpu.go index 0e3e9f09..5596c71e 100644 --- a/collector/cpu.go +++ b/collector/cpu.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/cpu_info.go b/collector/cpu_info.go index aedec7c1..3c087f04 100644 --- a/collector/cpu_info.go +++ b/collector/cpu_info.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/cs.go b/collector/cs.go index 63e87274..ba70e754 100644 --- a/collector/cs.go +++ b/collector/cs.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/dfsr.go b/collector/dfsr.go index 56d013d2..ef438ee3 100644 --- a/collector/dfsr.go +++ b/collector/dfsr.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector @@ -128,7 +129,7 @@ func NewDFSRCollector() (Collector, error) { ConnectionFilesReceivedTotal: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "connection_received_files_total"), - "Total number of files receieved for connection", + "Total number of files received for connection", []string{"name"}, nil, ), diff --git a/collector/dhcp.go b/collector/dhcp.go index 0848df0d..0544b1b8 100644 --- a/collector/dhcp.go +++ b/collector/dhcp.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/dns.go b/collector/dns.go index c350488a..037766a2 100644 --- a/collector/dns.go +++ b/collector/dns.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector @@ -136,7 +137,7 @@ func NewDNSCollector() (Collector, error) { ), Responses: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "responses_total"), - "Number of reponses sent by DNS server", + "Number of responses sent by DNS server", []string{"protocol"}, nil, ), diff --git a/collector/exchange.go b/collector/exchange.go index b478cdcb..25b0354d 100644 --- a/collector/exchange.go +++ b/collector/exchange.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector @@ -234,7 +235,7 @@ func (c *exchangeCollector) collectADAccessProcesses(ctx *ScrapeContext, ch chan } // since we're not including the PID suffix from the instance names in the label names, - // we get an occational duplicate. This seems to affect about 4 instances only on this object. + // we get an occasional duplicate. This seems to affect about 4 instances only on this object. labelUseCount[labelName]++ if labelUseCount[labelName] > 1 { labelName = fmt.Sprintf("%s_%d", labelName, labelUseCount[labelName]) diff --git a/collector/hyperv.go b/collector/hyperv.go index 279b4894..1ec29995 100644 --- a/collector/hyperv.go +++ b/collector/hyperv.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/iis.go b/collector/iis.go index a4fc4fad..1438ffb0 100644 --- a/collector/iis.go +++ b/collector/iis.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector @@ -1274,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"` diff --git a/collector/logical_disk.go b/collector/logical_disk.go index cf463d3c..36eba9bd 100644 --- a/collector/logical_disk.go +++ b/collector/logical_disk.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/logon.go b/collector/logon.go index df82f66e..182f6bdb 100644 --- a/collector/logon.go +++ b/collector/logon.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/memory.go b/collector/memory.go index 82617e37..695668df 100644 --- a/collector/memory.go +++ b/collector/memory.go @@ -1,6 +1,7 @@ // returns data points from Win32_PerfRawData_PerfOS_Memory // - Win32_PerfRawData_PerfOS_Memory class +//go:build windows // +build windows package collector diff --git a/collector/msmq.go b/collector/msmq.go index 4ce49bd9..d3638f5a 100644 --- a/collector/msmq.go +++ b/collector/msmq.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/mssql.go b/collector/mssql.go index 9975b230..d8430e01 100644 --- a/collector/mssql.go +++ b/collector/mssql.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector @@ -1957,7 +1958,7 @@ func (c *MSSQLCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric } wg.Wait() - // this shoud return an error if any? some? children errord. + // this should return an error if any? some? children errord. if c.mssqlChildCollectorFailure > 0 { return errors.New("at least one child collector failed") } diff --git a/collector/net.go b/collector/net.go index 7e4b10d1..392314c6 100644 --- a/collector/net.go +++ b/collector/net.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/net_test.go b/collector/net_test.go index aeb3bfe3..c28e0426 100644 --- a/collector/net_test.go +++ b/collector/net_test.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/netframework_clrexceptions.go b/collector/netframework_clrexceptions.go index 53d80b16..134e457d 100644 --- a/collector/netframework_clrexceptions.go +++ b/collector/netframework_clrexceptions.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/netframework_clrinterop.go b/collector/netframework_clrinterop.go index 483d799a..fb4cfdcd 100644 --- a/collector/netframework_clrinterop.go +++ b/collector/netframework_clrinterop.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/netframework_clrjit.go b/collector/netframework_clrjit.go index da24e1c4..ca1e3e6e 100644 --- a/collector/netframework_clrjit.go +++ b/collector/netframework_clrjit.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/netframework_clrloading.go b/collector/netframework_clrloading.go index bc28ce87..f0541388 100644 --- a/collector/netframework_clrloading.go +++ b/collector/netframework_clrloading.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/netframework_clrlocksandthreads.go b/collector/netframework_clrlocksandthreads.go index 5d236a80..e5290474 100644 --- a/collector/netframework_clrlocksandthreads.go +++ b/collector/netframework_clrlocksandthreads.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/netframework_clrmemory.go b/collector/netframework_clrmemory.go index 7318161e..2e363621 100644 --- a/collector/netframework_clrmemory.go +++ b/collector/netframework_clrmemory.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/netframework_clrremoting.go b/collector/netframework_clrremoting.go index 4d8a1a41..a4ad25ac 100644 --- a/collector/netframework_clrremoting.go +++ b/collector/netframework_clrremoting.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/netframework_clrsecurity.go b/collector/netframework_clrsecurity.go index 4ae6347c..416bc7af 100644 --- a/collector/netframework_clrsecurity.go +++ b/collector/netframework_clrsecurity.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/os.go b/collector/os.go index 7df0e8d0..27780b2f 100644 --- a/collector/os.go +++ b/collector/os.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector @@ -201,7 +202,7 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) ( return nil, err } - var fsipf float64 = 0 + var fsipf float64 for _, pagingFile := range pagingFiles { fileString := strings.ReplaceAll(pagingFile, `\??\`, "") file, err := os.Stat(fileString) @@ -222,7 +223,7 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) ( } // Get current page file usage. - var pfbRaw float64 = 0 + var pfbRaw float64 for _, pageFile := range pfc { if strings.Contains(strings.ToLower(pageFile.Name), "_total") { continue @@ -302,7 +303,7 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) ( ch <- prometheus.MustNewConstMetric( c.PagingLimitBytes, prometheus.GaugeValue, - float64(fsipf), + fsipf, ) ch <- prometheus.MustNewConstMetric( diff --git a/collector/process.go b/collector/process.go index 2c5b6345..30fdf50a 100644 --- a/collector/process.go +++ b/collector/process.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector @@ -133,7 +134,7 @@ func newProcessCollector() (Collector, error) { ), WorkingSetPrivate: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "working_set_private_bytes"), - "Size of the working set, in bytes, that is use for this process only and not shared nor sharable by other processes.", + "Size of the working set, in bytes, that is use for this process only and not shared nor shareable by other processes.", []string{"process", "process_id", "creating_process_id"}, nil, ), diff --git a/collector/remote_fx.go b/collector/remote_fx.go index 3654ccf9..25be2f35 100644 --- a/collector/remote_fx.go +++ b/collector/remote_fx.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector @@ -60,7 +61,7 @@ func NewRemoteFx() (Collector, error) { ), CurrentTCPBandwidth: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "net_current_tcp_bandwidth"), - "TCP Bandwidth detected in bytes per seccond.", + "TCP Bandwidth detected in bytes per second.", []string{"session_name"}, nil, ), diff --git a/collector/service.go b/collector/service.go index 3ef2f72d..ca20f208 100644 --- a/collector/service.go +++ b/collector/service.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector @@ -231,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() diff --git a/collector/smtp.go b/collector/smtp.go index c98de07d..94650123 100644 --- a/collector/smtp.go +++ b/collector/smtp.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/system.go b/collector/system.go index d76f9b87..2e3f7631 100644 --- a/collector/system.go +++ b/collector/system.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/tcp.go b/collector/tcp.go index 879aaa91..2c5ec130 100644 --- a/collector/tcp.go +++ b/collector/tcp.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/terminal_services.go b/collector/terminal_services.go index 564631fe..2f79fd10 100644 --- a/collector/terminal_services.go +++ b/collector/terminal_services.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/textfile.go b/collector/textfile.go index 4a6bdba4..a5323e61 100644 --- a/collector/textfile.go +++ b/collector/textfile.go @@ -11,6 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !notextfile // +build !notextfile package collector diff --git a/collector/time.go b/collector/time.go index b8c66d09..0f761f96 100644 --- a/collector/time.go +++ b/collector/time.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/collector/vmware.go b/collector/vmware.go index 2c59b657..0373f774 100644 --- a/collector/vmware.go +++ b/collector/vmware.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package collector diff --git a/docs/collector.dfsr.md b/docs/collector.dfsr.md index 429a97a6..7893d5ce 100644 --- a/docs/collector.dfsr.md +++ b/docs/collector.dfsr.md @@ -44,7 +44,7 @@ Name | Description | Type | Labels `windows_dfsr_folder_deleted_bytes_cleaned_up_total` | Total size (in bytes) of replicating deleted files and folders that were cleaned up from the Conflict and Deleted folder. | gauge | name `windows_dfsr_folder_deleted_bytes_generated_total` | Total size (in bytes) of replicated deleted files and folders that were moved to the Conflict and Deleted folder after they were deleted from a replicated folder on a sending member. | counter | name `windows_dfsr_folder_deleted_files_cleaned_up_total` | Number of files and folders that were cleaned up from the Conflict and Deleted folder. | counter | name -`windows_dfsr_folder_deleted_files_generated_total` | Number of deleted fils and folders that were moved to the Conflict and Deleted folder. | counter | name +`windows_dfsr_folder_deleted_files_generated_total` | Number of deleted files and folders that were moved to the Conflict and Deleted folder. | counter | name `windows_dfsr_folder_file_installs_retried_total` | Total number of file installs that are being retried due to sharing violations or other errors encountered when installing the files. The DFS Replication service replicates staged files into a staging folder, uncompresses them in the Installing folder, and renames them to the target location. The second and third steps of this process are known as installing the file. | counter | name `windows_dfsr_folder_file_installs_succeeded_total` | Total number of files that were successfully received from sending members and installed locally on this server. The DFS Replication service replicates staged files into a staging folder, uncompresses them in the Installing folder, and renames them to the target location. The second and third steps of this process are known as installing the file. | counter | name `windows_dfsr_folder_files_received_total` | Total number of files received. | counter | name diff --git a/docs/collector.exchange.md b/docs/collector.exchange.md index 6fddbc08..09510e49 100644 --- a/docs/collector.exchange.md +++ b/docs/collector.exchange.md @@ -36,7 +36,7 @@ Name | Description `windows_exchange_transport_queues_internal_active_remote_delivery` | Internal Active Remote Delivery Queue length `windows_exchange_transport_queues_active_mailbox_delivery` | Active Mailbox Delivery Queue length `windows_exchange_transport_queues_retry_mailbox_delivery` | Retry Mailbox Delivery Queue length -`windows_exchange_transport_queues_unreachable` | Unreachable Queue lengt +`windows_exchange_transport_queues_unreachable` | Unreachable Queue length `windows_exchange_transport_queues_external_largest_delivery` | External Largest Delivery Queue length `windows_exchange_transport_queues_internal_largest_delivery` | Internal Largest Delivery Queue length `windows_exchange_transport_queues_poison` | Poison Queue length diff --git a/docs/collector.fsrmquota.md b/docs/collector.fsrmquota.md index 5d6c60e0..1a7eb0cd 100644 --- a/docs/collector.fsrmquota.md +++ b/docs/collector.fsrmquota.md @@ -1,6 +1,6 @@ # Microsoft File Server Resource Manager (FSRM) Quotas collector -The fsrmquota collector exposes metrics about File Server Ressource Manager Quotas. Note that this collector has only been tested against Windows server 2012R2. +The fsrmquota collector exposes metrics about File Server Resource Manager Quotas. Note that this collector has only been tested against Windows server 2012R2. Other FSRM versions may work but are not tested. ||| @@ -48,5 +48,5 @@ rate(windows_fsrmquota_usage_bytes)[1d] severity: "high" annotations: summary: "High Quotas Usage" - description: "High use of File Ressource.\n Quotas: {{ $labels.path }}\n Current use : {{ $value }}" + description: "High use of File Resource.\n Quotas: {{ $labels.path }}\n Current use : {{ $value }}" ``` diff --git a/docs/collector.os.md b/docs/collector.os.md index 3993e103..74689fd0 100644 --- a/docs/collector.os.md +++ b/docs/collector.os.md @@ -17,7 +17,7 @@ None Name | Description | Type | Labels -----|-------------|------|------- `windows_os_info` | Contains full product name & version in labels | gauge | `product`, `version` -`windows_os_paging_limit_bytes` | Total number of bytes that can be sotred in the operating system paging files. 0 (zero) indicates that there are no paging files | gauge | None +`windows_os_paging_limit_bytes` | Total number of bytes that can be stored in the operating system paging files. 0 (zero) indicates that there are no paging files | gauge | None `windows_os_paging_free_bytes` | Number of bytes that can be mapped into the operating system paging files without causing any other pages to be swapped out | gauge | None `windows_os_physical_memory_free_bytes` | Bytes of physical memory currently unused and available | gauge | None `windows_os_time` | Current time as reported by the operating system, in [Unix time](https://en.wikipedia.org/wiki/Unix_time). See [time.Unix()](https://golang.org/pkg/time/#Unix) for details | gauge | None diff --git a/docs/collector.process.md b/docs/collector.process.md index 9a98b7d2..3501f872 100644 --- a/docs/collector.process.md +++ b/docs/collector.process.md @@ -53,7 +53,7 @@ Name | Description | Type | Labels `windows_process_private_bytes` | Current number of bytes this process has allocated that cannot be shared with other processes. | gauge | `process`, `process_id`, `creating_process_id` `windows_process_thread_count` | Number of threads currently active in this process. An instruction is the basic unit of execution in a processor, and a thread is the object that executes instructions. Every running process has at least one thread. | gauge | `process`, `process_id`, `creating_process_id` `windows_process_virtual_bytes` | Current size, in bytes, of the virtual address space that the process is using. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process can limit its ability to load libraries. | gauge | `process`, `process_id`, `creating_process_id` -`windows_process_working_set_private_bytes` | Size of the working set, in bytes, that is use for this process only and not shared nor sharable by other processes. | gauge | `process`, `process_id`, `creating_process_id` +`windows_process_working_set_private_bytes` | Size of the working set, in bytes, that is use for this process only and not shared nor shareable by other processes. | gauge | `process`, `process_id`, `creating_process_id` `windows_process_working_set_peak_bytes` | Maximum size, in bytes, of the Working Set of this process at any point in time. The Working Set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the Working Set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from Working Sets. If they are needed they will then be soft-faulted back into the Working Set before they leave main memory. | gauge | `process`, `process_id`, `creating_process_id` `windows_process_working_set_bytes` | Maximum number of bytes in the working set of this process at any point in time. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory. | gauge | `process`, `process_id`, `creating_process_id` diff --git a/docs/collector.smtp.md b/docs/collector.smtp.md index c3745c78..f35be89d 100644 --- a/docs/collector.smtp.md +++ b/docs/collector.smtp.md @@ -24,7 +24,7 @@ If given, a virtual SMTP server needs to *not* match the blacklist regexp in ord Name | Description | Type | Labels -----|-------------|------|------- -`windows_smtp_badmailed_messages_bad_pickup_file_total` | Total number of mailformed pickup messages sent to badmail | counter | `server` +`windows_smtp_badmailed_messages_bad_pickup_file_total` | Total number of malformed pickup messages sent to badmail | counter | `server` `windows_smtp_badmailed_messages_general_failure_total` | Total number of messages sent to badmail for reasons not associated with a specific counter | counter | `server` `windows_smtp_badmailed_messages_hop_count_exceeded_total` | Total number of messages sent to badmail because they had exceeded the maximum hop count | counter | `server` `windows_smtp_badmailed_messages_ndr_of_dns_total` | Total number of Delivery Status Notifications sent to badmail because they could not be delivered | counter | `server` diff --git a/exporter.go b/exporter.go index 2b3d42c0..fc085118 100644 --- a/exporter.go +++ b/exporter.go @@ -259,7 +259,7 @@ func main() { var ( configFile = kingpin.Flag( "config.file", - "YAML configuration file to use. Values set in this file will be overriden by CLI flags.", + "YAML configuration file to use. Values set in this file will be overridden by CLI flags.", ).String() webConfig = webflag.AddFlags(kingpin.CommandLine) listenAddress = kingpin.Flag( @@ -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) diff --git a/exporter_test.go b/exporter_test.go index 451cc240..52b709b6 100644 --- a/exporter_test.go +++ b/exporter_test.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package main diff --git a/headers/netapi32/netapi32.go b/headers/netapi32/netapi32.go index 7b58029d..cc536d30 100644 --- a/headers/netapi32/netapi32.go +++ b/headers/netapi32/netapi32.go @@ -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. diff --git a/headers/sysinfoapi/sysinfoapi.go b/headers/sysinfoapi/sysinfoapi.go index ebc6087b..502893f7 100644 --- a/headers/sysinfoapi/sysinfoapi.go +++ b/headers/sysinfoapi/sysinfoapi.go @@ -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, diff --git a/log/eventlog_formatter.go b/log/eventlog_formatter.go index 9ad9e31d..1ec0842d 100644 --- a/log/eventlog_formatter.go +++ b/log/eventlog_formatter.go @@ -13,6 +13,7 @@ // // Implementation forked from github.com/prometheus/common // +//go:build windows // +build windows package log diff --git a/log/gokit_adapter.go b/log/gokit_adapter.go index 4f288441..201d4b20 100644 --- a/log/gokit_adapter.go +++ b/log/gokit_adapter.go @@ -6,13 +6,13 @@ import ( // Returns an adapter implementing the go-kit/kit/log.Logger interface on our // logrus logger -func NewToolkitAdapter() *logAdapter { - return &logAdapter{} +func NewToolkitAdapter() *Adapter { + return &Adapter{} } -type logAdapter struct{} +type Adapter struct{} -func (*logAdapter) Log(keyvals ...interface{}) error { +func (*Adapter) Log(keyvals ...interface{}) error { var lvl level.Value var msg string for i := 0; i < len(keyvals); i += 2 { diff --git a/log/log.go b/log/log.go index 7a8b4b33..eccef380 100644 --- a/log/log.go +++ b/log/log.go @@ -13,7 +13,6 @@ // Package log implements logging via logrus. // Implementation forked from github.com/prometheus/common - package log import (