Apply fixes suggested by staticcheck

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-07-08 16:10:38 -04:00
parent 82c22e3969
commit 3d7a09347d
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
19 changed files with 26 additions and 315 deletions

View file

@ -22,7 +22,6 @@ import (
"errors"
"fmt"
"io/ioutil"
"math"
"net"
"net/http"
"os"
@ -547,7 +546,7 @@ func (n NGINXController) generateTemplate(cfg ngx_config.Configuration, ingressC
}
if cfg.MaxWorkerConnections == 0 {
maxWorkerConnections := int(math.Ceil(float64(cfg.MaxWorkerOpenFiles * 3.0 / 4)))
maxWorkerConnections := int(float64(cfg.MaxWorkerOpenFiles * 3.0 / 4))
klog.V(3).Infof("Adjusting MaxWorkerConnections variable to %d", maxWorkerConnections)
cfg.MaxWorkerConnections = maxWorkerConnections
}
@ -1090,7 +1089,7 @@ func createOpentracingCfg(cfg ngx_config.Configuration) error {
}
// Expand possible environment variables before writing the configuration to file.
expanded := os.ExpandEnv(string(tmplBuf.Bytes()))
expanded := os.ExpandEnv(tmplBuf.String())
return ioutil.WriteFile("/etc/nginx/opentracing.json", []byte(expanded), file.ReadWriteByUser)
}