Skip to content

Commit

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

refs GH-152
  • Loading branch information
atc0005 committed Apr 5, 2021
1 parent 85d7da9 commit 28bb2a4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
54 changes: 27 additions & 27 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ func (mvf *multiValueFlag) Set(value string) error {
// intended to be retrieved via "Getter" methods.
type Config struct {

// Use our template, define distinct collections of configuration settings
cliConfig configTemplate
fileConfig configTemplate

// configFile represents the fully-qualified path to a configuration file
// consulted for settings not provided via CLI flags
configFile string `toml:"-"`

// Use our template, define distinct collections of configuration settings
cliConfig configTemplate
fileConfig configTemplate

// showVersion is a flag indicating whether the user opted to display only
// the version string and then immediately exit the application
showVersion bool `toml:"-"`
Expand All @@ -208,12 +208,22 @@ type Config struct {
// specified by various configuration sources
type configTemplate struct {

// IgnoreDNSErrors is a boolean *pointer* flag indicating whether
// individual DNS errors should be ignored. If enabled, this setting
// allows query-related DNS errors with one host to not block queries
// against remaining DNS servers. This can be useful to work around
// failures with one server in a pool of many.
DNSErrorsFatal bool `toml:"dns_errors_fatal"`
// LogLevel is the chosen logging level
LogLevel string `toml:"log_level"`

// LogFormat controls which output format is used for log messages
// generated by this application. This value is from a smaller subset
// of the formats supported by the third-party leveled-logging package
// used by this application.
LogFormat string `toml:"log_format"`

// ResultsOutput specifies whether the results summary is composed of a
// single comma-separated line of records for a query, or whether the
// records are returned one per line.
ResultsOutput string `toml:"results_output"`

// Query represents the FQDN query strings submitted to each DNS server
Query string `toml:"query"`

// Servers is a list of the DNS servers used by this application. Most
// commonly set in a configuration file due to the number of servers used
Expand All @@ -226,30 +236,20 @@ type configTemplate struct {
// type (dns.RR).
QueryTypes multiValueFlag `toml:"dns_query_types"`

// Query represents the FQDN query strings submitted to each DNS server
Query string `toml:"query"`

// SrvProtocols is a list of the Service Location (SRV) record protocol
// keywords associated with a given domain name.
SrvProtocols multiValueFlag `toml:"dns_srv_protocols"`

// LogLevel is the chosen logging level
LogLevel string `toml:"log_level"`

// LogFormat controls which output format is used for log messages
// generated by this application. This value is from a smaller subset
// of the formats supported by the third-party leveled-logging package
// used by this application.
LogFormat string `toml:"log_format"`

// ResultsOutput specifies whether the results summary is composed of a
// single comma-separated line of records for a query, or whether the
// records are returned one per line.
ResultsOutput string `toml:"results_output"`

// Timeout is the number of seconds allowed for a DNS query to complete
// before it times out.
Timeout int `toml:"timeout"`

// IgnoreDNSErrors is a boolean *pointer* flag indicating whether
// individual DNS errors should be ignored. If enabled, this setting
// allows query-related DNS errors with one host to not block queries
// against remaining DNS servers. This can be useful to work around
// failures with one server in a pool of many.
DNSErrorsFatal bool `toml:"dns_errors_fatal"`
}

func (c Config) String() string {
Expand Down
18 changes: 9 additions & 9 deletions dqrs/queryresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@ import (
// records).
type DNSQueryResponse struct {

// Answer may potentially be composed of multiple Resource Record types
// such as CNAME and A records. We later separate out the types when
// needed.
Answer []dns.RR

// Server is the DNS server used for this query and response.
Server string

// Query is the FQDN that we requested a record for.
Query string

// RequestedRecordType represents the type of record requested as part of
// the query
RequestedRecordType uint16

// Error records whether an error occurred during any part of performing a
// query
QueryError error

// Answer may potentially be composed of multiple Resource Record types
// such as CNAME and A records. We later separate out the types when
// needed.
Answer []dns.RR

// ResponseTime, also known as the Round-trip Time, can be best summed up
// by this Cloudflare definition: "Round-trip time (RTT) is the duration
// in milliseconds (ms) it takes for a network request to go from a
// starting point to a destination and back again to the starting point."
ResponseTime time.Duration

// RequestedRecordType represents the type of record requested as part of
// the query
RequestedRecordType uint16
}

// DNSQueryResponses is a collection of DNS query responses. Intended for
Expand Down

0 comments on commit 28bb2a4

Please sign in to comment.