fix: correctly handle empty params
kubuzetto opened this issue · 0 comments
Hi again;
It seems that I accidentally introduced a rather insidious bug with the PR #33.
If the --tags
argument is not passed; the line below:
c := exec.Command("go", "list", tagsArg, a)
is executed as go list "" ./...
; not go list ./...
. It therefore tries to list the current folder. If there are no Go files directly in the current folder; this will cause the go list
command to fail. Therefore we must only add tagsArg
if it is specified.
The same bug already existed in a more hidden way, with how go list
command can be replaced using GO_TEST_BINARY
. If the new command is only one word; then this part would insert an empty string for the second word:
if len(gt) != 2 {
gt = append(gt, "")
}
which is how I noticed this bug in the first place. Of course, I opened a PR that excludes empty strings in both cases: #36.