Skip to content

Commit

Permalink
chore: make golangci-lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
fbreckle committed Nov 4, 2024
1 parent 1c0b05f commit 4efeadf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion netbox/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (cfg *Config) Client() (*netboxclient.NetBoxAPI, error) {

trans.(*http.Transport).Proxy = http.ProxyFromEnvironment

if cfg.Headers != nil && len(cfg.Headers) > 0 {
if len(cfg.Headers) > 0 {
log.WithFields(log.Fields{
"custom_headers": cfg.Headers,
}).Debug("Setting custom headers on every request to Netbox")
Expand Down
8 changes: 4 additions & 4 deletions netbox/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,31 @@ func init() {
desc += "."
}

if s.AtLeastOneOf != nil && len(s.AtLeastOneOf) > 0 {
if len(s.AtLeastOneOf) > 0 {
atLeastOneOf := make([]string, len(s.AtLeastOneOf))
for i, l := range s.AtLeastOneOf {
atLeastOneOf[i] = fmt.Sprintf("`%s`", l)
}
desc += fmt.Sprintf(" At least one of %s must be given.", joinStringWithFinalConjunction(atLeastOneOf, ", ", "or"))
}

if s.ExactlyOneOf != nil && len(s.ExactlyOneOf) > 0 {
if len(s.ExactlyOneOf) > 0 {
exactlyOneOf := make([]string, len(s.ExactlyOneOf))
for i, l := range s.ExactlyOneOf {
exactlyOneOf[i] = fmt.Sprintf("`%s`", l)
}
desc += fmt.Sprintf(" Exactly one of %s must be given.", joinStringWithFinalConjunction(exactlyOneOf, ", ", "or"))
}

if s.RequiredWith != nil && len(s.RequiredWith) > 0 {
if len(s.RequiredWith) > 0 {
requires := make([]string, len(s.RequiredWith))
for i, c := range s.RequiredWith {
requires[i] = fmt.Sprintf("`%s`", c)
}
desc += fmt.Sprintf(" Required when %s is set.", joinStringWithFinalConjunction(requires, ", ", "and"))
}

if s.ConflictsWith != nil && len(s.ConflictsWith) > 0 {
if len(s.ConflictsWith) > 0 {
conflicts := make([]string, len(s.ConflictsWith))
for i, c := range s.ConflictsWith {
conflicts[i] = fmt.Sprintf("`%s`", c)
Expand Down

0 comments on commit 4efeadf

Please sign in to comment.