mirror of
https://github.com/containers/podman.git
synced 2025-12-08 06:39:05 +08:00
golangci-lint pass number 2
clean up and prepare to migrate to the golangci-linter Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
@@ -552,9 +552,6 @@ func generatePodPsOutput(pods []*adapter.Pod, opts podPsOptions) error {
|
||||
|
||||
switch opts.Format {
|
||||
case formats.JSONString:
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "unable to create JSON for output")
|
||||
}
|
||||
out = formats.JSONStructArray{Output: podPsToGeneric([]podPsTemplateParams{}, psOutput)}
|
||||
default:
|
||||
psOutput, err := getPodTemplateOutput(psOutput, opts)
|
||||
|
||||
@@ -319,6 +319,9 @@ func psDisplay(c *cliconfig.PsValues, runtime *adapter.LocalRuntime) error {
|
||||
}
|
||||
|
||||
pss, err := runtime.Ps(c, opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Here and down
|
||||
if opts.Sort != "" {
|
||||
pss, err = sortPsOutput(opts.Sort, pss)
|
||||
@@ -376,8 +379,8 @@ func psDisplay(c *cliconfig.PsValues, runtime *adapter.LocalRuntime) error {
|
||||
size = units.HumanSizeWithPrecision(0, 0)
|
||||
} else {
|
||||
size = units.HumanSizeWithPrecision(float64(container.Size.RwSize), 3) + " (virtual " + units.HumanSizeWithPrecision(float64(container.Size.RootFsSize), 3) + ")"
|
||||
fmt.Fprintf(w, "\t%s", size)
|
||||
}
|
||||
fmt.Fprintf(w, "\t%s", size)
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -305,7 +305,7 @@ func generateContainerFilterFuncs(filter, filterValue string, r *libpod.Runtime)
|
||||
}
|
||||
return func(c *libpod.Container) bool {
|
||||
ec, exited, err := c.ExitCode()
|
||||
if ec == int32(exitCode) && err == nil && exited == true {
|
||||
if ec == int32(exitCode) && err == nil && exited {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -611,7 +611,7 @@ func getNamespaceInfo(path string) (string, error) {
|
||||
|
||||
// getStrFromSquareBrackets gets the string inside [] from a string
|
||||
func getStrFromSquareBrackets(cmd string) string {
|
||||
reg, err := regexp.Compile(".*\\[|\\].*")
|
||||
reg, err := regexp.Compile(`.*\[|\].*`)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -93,9 +93,8 @@ func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod.
|
||||
imageName = newImage.ID()
|
||||
}
|
||||
|
||||
var healthCheckCommandInput string
|
||||
// if the user disabled the healthcheck with "none", we skip adding it
|
||||
healthCheckCommandInput = c.String("healthcheck-command")
|
||||
healthCheckCommandInput := c.String("healthcheck-command")
|
||||
|
||||
// the user didnt disable the healthcheck but did pass in a healthcheck command
|
||||
// now we need to make a healthcheck from the commandline input
|
||||
|
||||
@@ -133,7 +133,7 @@ func verifyContainerResources(config *cc.CreateConfig, update bool) ([]string, e
|
||||
if config.Resources.KernelMemory > 0 && config.Resources.KernelMemory < linuxMinMemory {
|
||||
return warnings, fmt.Errorf("minimum kernel memory limit allowed is 4MB")
|
||||
}
|
||||
if config.Resources.DisableOomKiller == true && !sysInfo.OomKillDisable {
|
||||
if config.Resources.DisableOomKiller && !sysInfo.OomKillDisable {
|
||||
// only produce warnings if the setting wasn't to *disable* the OOM Kill; no point
|
||||
// warning the caller if they already wanted the feature to be off
|
||||
warnings = addWarning(warnings, "Your kernel does not support OomKillDisable. OomKillDisable discarded.")
|
||||
|
||||
@@ -101,9 +101,8 @@ func statsCmd(c *cliconfig.StatsValues) error {
|
||||
}
|
||||
|
||||
var ctrs []*libpod.Container
|
||||
var containerFunc func() ([]*libpod.Container, error)
|
||||
|
||||
containerFunc = runtime.GetRunningContainers
|
||||
containerFunc := runtime.GetRunningContainers
|
||||
if len(c.InputArgs) > 0 {
|
||||
containerFunc = func() ([]*libpod.Container, error) { return runtime.GetContainersByList(c.InputArgs) }
|
||||
} else if latest {
|
||||
|
||||
@@ -107,7 +107,7 @@ func printImageChildren(layerMap map[string]*image.LayerInfo, layerID string, pr
|
||||
if !ok {
|
||||
return fmt.Errorf("lookup error: layerid %s, not found", layerID)
|
||||
}
|
||||
fmt.Printf(prefix)
|
||||
fmt.Print(prefix)
|
||||
|
||||
//initialize intend with middleItem to reduce middleItem checks.
|
||||
intend := middleItem
|
||||
|
||||
Reference in New Issue
Block a user