mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 08:16:39 +00:00
Add gocritic linter (#1324)
* Add gocritic linter `gocritic` provides diagnostics that check for bugs, performance, and style issues We disable the following checks: - commentFormatting - captLocal - deprecatedComment This PR contains many `//nolint:gocritic` to disable `appendAssign`.
This commit is contained in:
@@ -300,7 +300,7 @@ func toPolicyResponse(account *server.Account, policy *server.Policy) *api.Polic
|
||||
Action: api.PolicyRuleAction(r.Action),
|
||||
}
|
||||
if len(r.Ports) != 0 {
|
||||
portsCopy := r.Ports[:]
|
||||
portsCopy := r.Ports
|
||||
rule.Ports = &portsCopy
|
||||
}
|
||||
for _, gid := range r.Sources {
|
||||
|
||||
@@ -192,13 +192,14 @@ func writeSuccess(w http.ResponseWriter, key *server.SetupKey) {
|
||||
|
||||
func toResponseBody(key *server.SetupKey) *api.SetupKey {
|
||||
var state string
|
||||
if key.IsExpired() {
|
||||
switch {
|
||||
case key.IsExpired():
|
||||
state = "expired"
|
||||
} else if key.IsRevoked() {
|
||||
case key.IsRevoked():
|
||||
state = "revoked"
|
||||
} else if key.IsOverUsed() {
|
||||
case key.IsOverUsed():
|
||||
state = "overused"
|
||||
} else {
|
||||
default:
|
||||
state = "valid"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user