Skip to content

Commit

Permalink
gofmt fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wrouesnel committed Dec 8, 2023
1 parent 6678178 commit 143bb3e
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Expand Up @@ -24,6 +24,8 @@ linters:
- exhaustruct # ultimately too noisy for most coding
# This one is just infuriating, produces a lot of warnings, and doesn't matter.
- godot
# This has become impossible meet while still using fmt
- nolintlint
# These all stopped working suddenly due to a non-existent compilation error.
# Retry them regularly.
- stylecheck
Expand All @@ -33,6 +35,7 @@ linters:
- govet
- unused


issues:
exclude-rules:
- path: _test\.go
Expand Down
2 changes: 1 addition & 1 deletion cmd/poller_exporter/main.go
Expand Up @@ -19,7 +19,7 @@ import (
"time"

"github.com/samber/lo"
"github.com/wrouesnel/multihttp"
"github.com/wrouesnel/multihttp" //nolint: typecheck

"github.com/wrouesnel/poller_exporter/assets"
"github.com/wrouesnel/poller_exporter/pkg/config"
Expand Down
7 changes: 7 additions & 0 deletions magefile.go
Expand Up @@ -650,13 +650,15 @@ func Coverage() error {
}

// All runs a full suite suitable for CI
//
//nolint:unparam
func All() error {
mg.SerialDeps(Style, Lint, Test, Coverage, Release)
return nil
}

// GithubReleaseMatrix emits a line to setup build matrix jobs for release builds.
//
//nolint:unparam
func GithubReleaseMatrix() error {
output := make([]string, 0, len(platforms))
Expand Down Expand Up @@ -737,6 +739,7 @@ func Binary() error {
}

// doReleaseBin handles the deferred building of an actual release binary.
//
//nolint:gocritic
func doReleaseBin(OSArch string) func() error {
platform, ok := platformsLookup[OSArch]
Expand All @@ -754,6 +757,7 @@ func doReleaseBin(OSArch string) func() error {
}

// ReleaseBin builds cross-platform release binaries under the bin/ directory.
//
//nolint:gocritic
func ReleaseBin(OSArch string) error {
return doReleaseBin(OSArch)()
Expand All @@ -770,6 +774,7 @@ func ReleaseBinAll() error {
}

// Release builds release archives under the release/ directory.
//
//nolint:gocritic
func doRelease(OSArch string) func() error {
platform, ok := platformsLookup[OSArch]
Expand Down Expand Up @@ -825,6 +830,7 @@ func PlatformTargets() error {
}

// Release a binary archive for a specific platform
//
//nolint:gocritic
func Release(OSArch string) error {
return doRelease(OSArch)()
Expand Down Expand Up @@ -857,6 +863,7 @@ func Clean() error {
}

// Debug prints the value of internal state variables
//
//nolint:unparam
func Debug() error {
fmt.Println("Source Files:", goSrc)
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/loading.go
Expand Up @@ -72,6 +72,7 @@ func configMapMerge(left, right map[string]interface{}) {
}

// Decoder returns the decoder for config maps.
//
//nolint:exhaustruct
func Decoder(target interface{}, allowUnused bool) (*mapstructure.Decoder, error) {
decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
Expand Down Expand Up @@ -103,6 +104,7 @@ func LoadAndSanitizeConfig(configData []byte) (string, error) {
}

// Load loads a configuration file from the supplied bytes.
//
//nolint:forcetypeassert,funlen,cyclop,gocognit
func Load(configData []byte) (*Config, error) {
defaultMap := loadDefaultConfigMap()
Expand Down
4 changes: 3 additions & 1 deletion pkg/config/models.go
Expand Up @@ -35,6 +35,7 @@ var (
type HTTPStatusRange map[int]bool

// FromString initializes a new HTTPStatusRange from the given string specifier
//
//nolint:cyclop
func (hsr *HTTPStatusRange) FromString(ranges string) error {
const HTTPStatusRangeBase int = 10
Expand Down Expand Up @@ -279,7 +280,7 @@ func (t *TLSCertificateMap) AddCert(cert *x509.Certificate) error {
}

// MapStructureDecode implements unmarshalling for TLSCertificateMap
//nolint: funlen,cyclop
// nolint: funlen,cyclop
func (t *TLSCertificateMap) MapStructureDecode(input interface{}) error {
// Get the slice
interfaceSlice, ok := input.([]interface{})
Expand Down Expand Up @@ -358,6 +359,7 @@ type TLSCertificatePool struct {
}

// MapStructureDecode implements the yaml.Unmarshaler interface for tls_cacerts.
//
//nolint:funlen,cyclop
func (t *TLSCertificatePool) MapStructureDecode(input interface{}) error {
// Get the slice
Expand Down
1 change: 1 addition & 0 deletions pkg/middleware/auth/auth.go
Expand Up @@ -19,6 +19,7 @@ var (
)

// basicValidator generates a basic auth validator function from the supplied map.
//
//nolint:unparam
func basicValidator(userMap map[string]map[string]struct{}) (basic.AuthenticateFunc, error) {
return func(ctx context.Context, r *http.Request, username, password string) (auth.Info, error) {
Expand Down
1 change: 1 addition & 0 deletions pkg/pollers/challenge_response_service.go
Expand Up @@ -62,6 +62,7 @@ func (crms *ChallengeResponseMetricSet) Collect(ch chan<- prometheus.Metric) {
}

// NewChallengeResponseMetricSet initializes a new set of metrics with the given constant labels.
//
//nolint:funlen
func NewChallengeResponseMetricSet(constantLabels prometheus.Labels) ChallengeResponseMetricSet {
metricSet := ChallengeResponseMetricSet{
Expand Down
2 changes: 1 addition & 1 deletion pkg/pollers/ping/ping.go
Expand Up @@ -38,7 +38,7 @@ func getICMPSequence() uint16 {

// Sends a single ICMP echo to an IP and returns success and latency information.
// Borrowed from BrianBrazil's blackbox exporter
//nolint: funlen,gocyclop,cyclop,nonamedreturns
// nolint: funlen,gocyclop,cyclop,nonamedreturns
func Ping(ip net.IP, maxRTT time.Duration) (success bool, latency time.Duration) {
log := zap.L()
deadline := time.Now().Add(maxRTT)
Expand Down
1 change: 1 addition & 0 deletions pkg/pollers/poller.go
Expand Up @@ -31,6 +31,7 @@ const (

// PollConnection wraps net.Conn and carries additional information about the
// service poll.
//
//nolint:containedctx
type PollConnection struct {
net.Conn
Expand Down

0 comments on commit 143bb3e

Please sign in to comment.