chore: fix golangci-lint errors

This commit is contained in:
Oleg Lobanov
2024-04-01 18:24:06 +02:00
parent d194d71293
commit ae0af1f996
54 changed files with 452 additions and 475 deletions

View File

@@ -119,7 +119,7 @@ func parseWindowsCommand(cmd string) []string {
continue
}
if unicode.IsSpace(ch) && !inQuotes && len(part) > 0 {
if unicode.IsSpace(ch) && !inQuotes && part != "" {
parts = append(parts, part)
part = ""
continue
@@ -128,7 +128,7 @@ func parseWindowsCommand(cmd string) []string {
part += string(ch)
}
if len(part) > 0 {
if part != "" {
parts = append(parts, part)
}

View File

@@ -125,7 +125,6 @@ func TestParseWindowsCommand(t *testing.T) {
input: `cmd "a ""quoted value"`,
expected: []string{`cmd`, `a "quoted value`},
},
// TODO - see how many quotes are displayed if we use "", """, """""""
{ // 9 - two quotes outside an inQuote element
input: `cmd a ""quoted value`,
expected: []string{`cmd`, `a`, `"quoted`, `value`},