linter: enable wastedassign
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
parent
070e401499
commit
bb6b69b4ab
|
|
@ -65,7 +65,6 @@ linters:
|
||||||
- errchkjson
|
- errchkjson
|
||||||
- maintidx
|
- maintidx
|
||||||
- nilerr
|
- nilerr
|
||||||
- wastedassign
|
|
||||||
- nilnil
|
- nilnil
|
||||||
linters-settings:
|
linters-settings:
|
||||||
errcheck:
|
errcheck:
|
||||||
|
|
|
||||||
|
|
@ -721,7 +721,7 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
|
||||||
"Optional parent cgroup for the container",
|
"Optional parent cgroup for the container",
|
||||||
)
|
)
|
||||||
_ = cmd.RegisterFlagCompletionFunc(cgroupParentFlagName, completion.AutocompleteDefault)
|
_ = cmd.RegisterFlagCompletionFunc(cgroupParentFlagName, completion.AutocompleteDefault)
|
||||||
conmonPidfileFlagName := ""
|
var conmonPidfileFlagName string
|
||||||
if !isInfra {
|
if !isInfra {
|
||||||
conmonPidfileFlagName = "conmon-pidfile"
|
conmonPidfileFlagName = "conmon-pidfile"
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -734,7 +734,7 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
|
||||||
)
|
)
|
||||||
_ = cmd.RegisterFlagCompletionFunc(conmonPidfileFlagName, completion.AutocompleteDefault)
|
_ = cmd.RegisterFlagCompletionFunc(conmonPidfileFlagName, completion.AutocompleteDefault)
|
||||||
|
|
||||||
entrypointFlagName := ""
|
var entrypointFlagName string
|
||||||
if !isInfra {
|
if !isInfra {
|
||||||
entrypointFlagName = "entrypoint"
|
entrypointFlagName = "entrypoint"
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -58,9 +58,8 @@ func clone(cmd *cobra.Command, args []string) error {
|
||||||
case 3:
|
case 3:
|
||||||
ctrClone.CreateOpts.Name = args[1]
|
ctrClone.CreateOpts.Name = args[1]
|
||||||
ctrClone.Image = args[2]
|
ctrClone.Image = args[2]
|
||||||
rawImageName := ""
|
|
||||||
if !cliVals.RootFS {
|
if !cliVals.RootFS {
|
||||||
rawImageName = args[0]
|
rawImageName := args[0]
|
||||||
name, err := PullImage(ctrClone.Image, ctrClone.CreateOpts)
|
name, err := PullImage(ctrClone.Image, ctrClone.CreateOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -375,7 +375,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanTmpFile := false
|
var cleanTmpFile bool
|
||||||
flags.Authfile, cleanTmpFile = buildahUtil.MirrorToTempFileIfPathIsDescriptor(flags.Authfile)
|
flags.Authfile, cleanTmpFile = buildahUtil.MirrorToTempFileIfPathIsDescriptor(flags.Authfile)
|
||||||
if cleanTmpFile {
|
if cleanTmpFile {
|
||||||
defer os.Remove(flags.Authfile)
|
defer os.Remove(flags.Authfile)
|
||||||
|
|
@ -474,7 +474,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
format := ""
|
var format string
|
||||||
flags.Format = strings.ToLower(flags.Format)
|
flags.Format = strings.ToLower(flags.Format)
|
||||||
switch {
|
switch {
|
||||||
case strings.HasPrefix(flags.Format, buildahDefine.OCI):
|
case strings.HasPrefix(flags.Format, buildahDefine.OCI):
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ func scp(cmd *cobra.Command, args []string) (finalErr error) {
|
||||||
}
|
}
|
||||||
locations := []*entities.ImageScpOptions{}
|
locations := []*entities.ImageScpOptions{}
|
||||||
cliConnections := []string{}
|
cliConnections := []string{}
|
||||||
flipConnections := false
|
var flipConnections bool
|
||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
loc, connect, err := parseImageSCPArg(arg)
|
loc, connect, err := parseImageSCPArg(arg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -233,7 +233,7 @@ func loadToRemote(localFile string, tag string, url *urlP.URL, iden string) (str
|
||||||
errOut := strconv.Itoa(int(n)) + " Bytes copied before error"
|
errOut := strconv.Itoa(int(n)) + " Bytes copied before error"
|
||||||
return " ", errors.Wrapf(err, errOut)
|
return " ", errors.Wrapf(err, errOut)
|
||||||
}
|
}
|
||||||
run := ""
|
var run string
|
||||||
if tag != "" {
|
if tag != "" {
|
||||||
return "", errors.Wrapf(define.ErrInvalidArg, "Renaming of an image is currently not supported")
|
return "", errors.Wrapf(define.ErrInvalidArg, "Renaming of an image is currently not supported")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ func searchFlags(cmd *cobra.Command) {
|
||||||
|
|
||||||
// imageSearch implements the command for searching images.
|
// imageSearch implements the command for searching images.
|
||||||
func imageSearch(cmd *cobra.Command, args []string) error {
|
func imageSearch(cmd *cobra.Command, args []string) error {
|
||||||
searchTerm := ""
|
var searchTerm string
|
||||||
switch len(args) {
|
switch len(args) {
|
||||||
case 1:
|
case 1:
|
||||||
searchTerm = args[0]
|
searchTerm = args[0]
|
||||||
|
|
|
||||||
|
|
@ -1596,7 +1596,7 @@ func readConmonPipeData(runtimeName string, pipe *os.File, ociLog string) (int,
|
||||||
ch <- syncStruct{si: si}
|
ch <- syncStruct{si: si}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
data := -1
|
data := -1 //nolint: wastedassign
|
||||||
select {
|
select {
|
||||||
case ss := <-ch:
|
case ss := <-ch:
|
||||||
if ss.err != nil {
|
if ss.err != nil {
|
||||||
|
|
|
||||||
|
|
@ -262,8 +262,8 @@ func addDevice(g *generate.Generator, device string) error {
|
||||||
|
|
||||||
// ParseDevice parses device mapping string to a src, dest & permissions string
|
// ParseDevice parses device mapping string to a src, dest & permissions string
|
||||||
func ParseDevice(device string) (string, string, string, error) { //nolint
|
func ParseDevice(device string) (string, string, string, error) { //nolint
|
||||||
src := ""
|
var src string
|
||||||
dst := ""
|
var dst string
|
||||||
permissions := "rwm"
|
permissions := "rwm"
|
||||||
arr := strings.Split(device, ":")
|
arr := strings.Split(device, ":")
|
||||||
switch len(arr) {
|
switch len(arr) {
|
||||||
|
|
|
||||||
|
|
@ -847,7 +847,8 @@ func makeHealthCheckFromCli(inCmd, interval string, retries uint, timeout, start
|
||||||
if len(cmdArr) == 0 {
|
if len(cmdArr) == 0 {
|
||||||
return nil, errors.New("Must define a healthcheck command for all healthchecks")
|
return nil, errors.New("Must define a healthcheck command for all healthchecks")
|
||||||
}
|
}
|
||||||
concat := ""
|
|
||||||
|
var concat string
|
||||||
if cmdArr[0] == "CMD" || cmdArr[0] == "none" { // this is for compat, we are already split properly for most compat cases
|
if cmdArr[0] == "CMD" || cmdArr[0] == "none" { // this is for compat, we are already split properly for most compat cases
|
||||||
cmdArr = strings.Fields(inCmd)
|
cmdArr = strings.Fields(inCmd)
|
||||||
} else if cmdArr[0] != "CMD-SHELL" { // this is for podman side of things, won't contain the keywords
|
} else if cmdArr[0] != "CMD-SHELL" { // this is for podman side of things, won't contain the keywords
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ func IsSystemdSessionValid(uid int) bool {
|
||||||
|
|
||||||
if rootless.IsRootless() {
|
if rootless.IsRootless() {
|
||||||
conn, err = GetLogindConnection(rootless.GetRootlessUID())
|
conn, err = GetLogindConnection(rootless.GetRootlessUID())
|
||||||
object = conn.Object(dbusDest, godbus.ObjectPath(dbusPath))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//unable to fetch systemd object for logind
|
//unable to fetch systemd object for logind
|
||||||
logrus.Debugf("systemd-logind: %s", err)
|
logrus.Debugf("systemd-logind: %s", err)
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,10 @@ func Split(src string) (entries []string) {
|
||||||
}
|
}
|
||||||
entries = []string{}
|
entries = []string{}
|
||||||
var runes [][]rune
|
var runes [][]rune
|
||||||
lastClass := 0
|
var lastClass int
|
||||||
class := 0
|
|
||||||
// split into fields based on class of unicode character
|
// split into fields based on class of unicode character
|
||||||
for _, r := range src {
|
for _, r := range src {
|
||||||
|
var class int
|
||||||
switch {
|
switch {
|
||||||
case unicode.IsLower(r):
|
case unicode.IsLower(r):
|
||||||
class = 1
|
class = 1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue