Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Commit

Permalink
Fix govet:fieldalignment linting errors
Browse files Browse the repository at this point in the history
Change field order of `Config` struct to reduce allocation
requirements and pass `fieldalignment` linting check.

refs GH-127
  • Loading branch information
atc0005 committed Apr 8, 2021
1 parent f36b3a4 commit 52edbbd
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 40 deletions.
27 changes: 17 additions & 10 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,25 @@ issues:

linters:
enable:
- depguard
- dogsled
- dupl
- goconst
- gocritic
- gofmt
- goimports
- golint
- gosec
- stylecheck
- goconst
- depguard
- prealloc
- misspell
- maligned
- dupl
- prealloc
- exportloopref
- stylecheck
- unconvert
- gofmt
- golint
- gocritic
- scopelint

disable:
- maligned

linters-settings:
govet:
enable:
- fieldalignment
2 changes: 1 addition & 1 deletion cmd/bounce/decode-json-body.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
)

type malformedRequest struct {
status int
msg string
status int
}

// malformedRequest wraps errors from decoding JSON request bodies
Expand Down
15 changes: 8 additions & 7 deletions cmd/bounce/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import (
// error or success conditions
type NotifyResult struct {

// Val is the non-error condition message to return from a notification
// operation
Val string

// Err is the error condition message to return from a notification
// operation
Err error

// Val is the non-error condition message to return from a notification
// operation
Val string

// Success indicates whether the notification attempt succeeded or if it
// failed for one reason or another (remote API, timeout, cancellation,
// etc)
Expand All @@ -32,13 +32,14 @@ type NotifyResult struct {
// NotifyQueue represents a channel used to queue input data and responses
// between the main application, the notifications manager and "notifiers".
type NotifyQueue struct {
// The name of a queue. This is intended for display in log messages or
// other output to identify queues with pending items.
Name string

// Channel is a channel used to transport input data and responses.
Channel interface{}

// The name of a queue. This is intended for display in log messages or
// other output to identify queues with pending items.
Name string

// Count is the number of items currently in the queue
Count int

Expand Down
42 changes: 21 additions & 21 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,31 +250,10 @@ func Usage(flagSet *flag.FlagSet) func() {
// command-line flags
type Config struct {

// Retries is the number of attempts that this application will make
// to deliver messages before giving up.
Retries int

// RetriesDelay is the number of seconds to wait between retry attempts.
RetriesDelay int

// LocalTCPPort is the TCP port that this application should listen on for
// incoming requests
LocalTCPPort int

// LocalIPAddress is the IP Address that this application should listen on
// for incoming requests
LocalIPAddress string

// ColorizedJSON indicates whether JSON output should be colorized.
// Coloring the output could aid in in quick visual evaluation of incoming
// payloads
ColorizedJSON bool

// ColorizedJSONIndent controls how many spaces are used when indenting
// colorized JSON output. If ColorizedJSON is not enabled, this setting
// has no effect.
ColorizedJSONIndent int

// LogLevel is the chosen logging level
LogLevel string

Expand All @@ -295,6 +274,27 @@ type Config struct {
// advance by adding/configuring a Webhook Connector in a Microsoft Teams
// channel that you wish to submit messages to using this application.
WebhookURL string

// Retries is the number of attempts that this application will make
// to deliver messages before giving up.
Retries int

// RetriesDelay is the number of seconds to wait between retry attempts.
RetriesDelay int

// LocalTCPPort is the TCP port that this application should listen on for
// incoming requests
LocalTCPPort int

// ColorizedJSONIndent controls how many spaces are used when indenting
// colorized JSON output. If ColorizedJSON is not enabled, this setting
// has no effect.
ColorizedJSONIndent int

// ColorizedJSON indicates whether JSON output should be colorized.
// Coloring the output could aid in in quick visual evaluation of incoming
// payloads
ColorizedJSON bool
}

func (c *Config) String() string {
Expand Down
2 changes: 1 addition & 1 deletion routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
// API.
type Route struct {
Name string
AllowedMethods []string
Pattern string
Description string
HandlerFunc http.HandlerFunc
AllowedMethods []string
}

// Routes is a collection of defined routes, intended for bulk registration
Expand Down

0 comments on commit 52edbbd

Please sign in to comment.