mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
build: address gocritic
warnings
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
4e6675df76
commit
53c94efc02
@ -232,7 +232,7 @@ func (ns *NodeServer) mountNFS(
|
||||
volumeID, source, mountPoint, mountOptions)
|
||||
if netNamespaceFilePath != "" {
|
||||
_, stderr, err = util.ExecuteCommandWithNSEnter(
|
||||
ctx, netNamespaceFilePath, "mount", args[:]...)
|
||||
ctx, netNamespaceFilePath, "mount", args...)
|
||||
} else {
|
||||
err = ns.Mounter.Mount(source, mountPoint, "nfs", mountOptions)
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ func TestStrategicActionOnLogFile(t *testing.T) {
|
||||
var err error
|
||||
switch tt.args.logStrategy {
|
||||
case "compress":
|
||||
newExt := strings.Replace(tt.args.logFile, ".log", ".gz", -1)
|
||||
newExt := strings.ReplaceAll(tt.args.logFile, ".log", ".gz")
|
||||
if _, err = os.Stat(newExt); os.IsNotExist(err) {
|
||||
t.Errorf("compressed logFile (%s) not found: %v", newExt, err)
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ func getCrushLocationMap(crushLocationLabels string, nodeLabels map[string]strin
|
||||
crushLocationType = "host"
|
||||
}
|
||||
// replace "." with "-" to satisfy ceph crush map.
|
||||
value = strings.Replace(strings.TrimSpace(value), ".", "-", -1)
|
||||
value = strings.ReplaceAll(strings.TrimSpace(value), ".", "-")
|
||||
crushLocationMap[crushLocationType] = value
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ func GzipLogFile(pathToFile string) error {
|
||||
}
|
||||
|
||||
// Replace .log extension with .gz extension.
|
||||
newExt := strings.Replace(pathToFile, ".log", ".gz", -1)
|
||||
newExt := strings.ReplaceAll(pathToFile, ".log", ".gz")
|
||||
|
||||
// Open file for writing.
|
||||
gf, err := os.OpenFile(newExt, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0o644) // #nosec:G304,G302, file inclusion & perms
|
||||
|
@ -37,7 +37,7 @@ func TestGzipLogFile(t *testing.T) {
|
||||
t.Errorf("GzipLogFile failed: %v", err)
|
||||
}
|
||||
|
||||
newExt := strings.Replace(logFile.Name(), ".log", ".gz", -1)
|
||||
newExt := strings.ReplaceAll(logFile.Name(), ".log", ".gz")
|
||||
if _, err = os.Stat(newExt); errors.Is(err, os.ErrNotExist) {
|
||||
t.Errorf("compressed logFile (%s) not found: %v", newExt, err)
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ func GetTopologyFromDomainLabels(domainLabels, nodeName, driverName string) (map
|
||||
// driverName is validated, and we are adding a lowercase "topology." to it, so no validation for conformance
|
||||
|
||||
// Convert passed in labels to a map, and check for uniqueness
|
||||
labelsToRead := strings.SplitN(domainLabels, labelSeparator, -1)
|
||||
labelsToRead := strings.Split(domainLabels, labelSeparator)
|
||||
log.DefaultLog("passed in node labels for processing: %+v", labelsToRead)
|
||||
|
||||
labelsIn := make(map[string]bool)
|
||||
@ -158,7 +158,7 @@ func GetTopologyFromRequest(
|
||||
}
|
||||
|
||||
// extract topology based pools configuration
|
||||
err := json.Unmarshal([]byte(strings.Replace(topologyPoolsStr, "\n", " ", -1)), &topologyPools)
|
||||
err := json.Unmarshal([]byte(strings.ReplaceAll(topologyPoolsStr, "\n", " ")), &topologyPools)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf(
|
||||
"failed to parse JSON encoded topology constrained pools parameter (%s): %w",
|
||||
|
Loading…
Reference in New Issue
Block a user