mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 18:05:42 +03:00
Add gocritic to golangci-lint config (#9556)
This commit is contained in:
@@ -1564,10 +1564,10 @@ func (a *ClientConfig) Merge(b *ClientConfig) *ClientConfig {
|
||||
result.BridgeNetworkSubnet = b.BridgeNetworkSubnet
|
||||
}
|
||||
|
||||
result.HostNetworks = a.HostNetworks
|
||||
|
||||
if len(b.HostNetworks) != 0 {
|
||||
result.HostNetworks = append(a.HostNetworks, b.HostNetworks...)
|
||||
} else {
|
||||
result.HostNetworks = a.HostNetworks
|
||||
result.HostNetworks = append(result.HostNetworks, b.HostNetworks...)
|
||||
}
|
||||
|
||||
if b.BindWildcardDefaultHostNetwork {
|
||||
|
||||
@@ -140,7 +140,8 @@ func (s *HTTPServer) nodeToggleDrain(resp http.ResponseWriter, req *http.Request
|
||||
drainRequest.MarkEligible = true
|
||||
}
|
||||
} else {
|
||||
if err := decodeBody(req, &drainRequest); err != nil {
|
||||
err := decodeBody(req, &drainRequest)
|
||||
if err != nil {
|
||||
return nil, CodedError(400, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,10 +43,7 @@ func (s *HTTPServer) scalingPoliciesListRequest(resp http.ResponseWriter, req *h
|
||||
|
||||
func (s *HTTPServer) ScalingPolicySpecificRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
|
||||
path := strings.TrimPrefix(req.URL.Path, "/v1/scaling/policy/")
|
||||
switch {
|
||||
default:
|
||||
return s.scalingPolicyCRUD(resp, req, path)
|
||||
}
|
||||
return s.scalingPolicyCRUD(resp, req, path)
|
||||
}
|
||||
|
||||
func (s *HTTPServer) scalingPolicyCRUD(resp http.ResponseWriter, req *http.Request,
|
||||
|
||||
@@ -122,7 +122,7 @@ func (c *OperatorMetricsCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
resp := string(bs[:])
|
||||
resp := string(bs)
|
||||
c.Ui.Output(resp)
|
||||
}
|
||||
|
||||
|
||||
@@ -634,7 +634,8 @@ func (c *OperatorDebugCommand) collectPprof(path, id string, client *api.Client)
|
||||
return // only exit on 403
|
||||
}
|
||||
} else {
|
||||
if err := c.writeBytes(path, "profile.prof", bs); err != nil {
|
||||
err := c.writeBytes(path, "profile.prof", bs)
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
}
|
||||
}
|
||||
@@ -643,7 +644,8 @@ func (c *OperatorDebugCommand) collectPprof(path, id string, client *api.Client)
|
||||
if err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("%s: Failed to retrieve pprof trace.prof, err: %v", path, err))
|
||||
} else {
|
||||
if err := c.writeBytes(path, "trace.prof", bs); err != nil {
|
||||
err := c.writeBytes(path, "trace.prof", bs)
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
}
|
||||
}
|
||||
@@ -652,7 +654,8 @@ func (c *OperatorDebugCommand) collectPprof(path, id string, client *api.Client)
|
||||
if err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("%s: Failed to retrieve pprof goroutine.prof, err: %v", path, err))
|
||||
} else {
|
||||
if err := c.writeBytes(path, "goroutine.prof", bs); err != nil {
|
||||
err := c.writeBytes(path, "goroutine.prof", bs)
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
}
|
||||
}
|
||||
@@ -664,7 +667,8 @@ func (c *OperatorDebugCommand) collectPprof(path, id string, client *api.Client)
|
||||
if err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("%s: Failed to retrieve pprof goroutine-debug1.txt, err: %v", path, err))
|
||||
} else {
|
||||
if err := c.writeBytes(path, "goroutine-debug1.txt", bs); err != nil {
|
||||
err := c.writeBytes(path, "goroutine-debug1.txt", bs)
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
}
|
||||
}
|
||||
@@ -677,7 +681,8 @@ func (c *OperatorDebugCommand) collectPprof(path, id string, client *api.Client)
|
||||
if err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("%s: Failed to retrieve pprof goroutine-debug2.txt, err: %v", path, err))
|
||||
} else {
|
||||
if err := c.writeBytes(path, "goroutine-debug2.txt", bs); err != nil {
|
||||
err := c.writeBytes(path, "goroutine-debug2.txt", bs)
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user