diff --git a/integration-test/test.bats b/integration-test/test.bats index d8e5be3..cebdde7 100644 --- a/integration-test/test.bats +++ b/integration-test/test.bats @@ -40,6 +40,12 @@ [[ "$output" =~ ^-X\ .* ]] } +@test "govvv list" { + run govvv list ./integration-test/app-empty + echo "$output" + [ "$status" -eq 0 ] +} + @test "govvv build - program with no compile-time variables" { tmp="${BATS_TMPDIR}/a.out" run govvv build -o "$tmp" ./integration-test/app-empty diff --git a/main.go b/main.go index d28ba1f..527050b 100644 --- a/main.go +++ b/main.go @@ -47,9 +47,13 @@ func main() { fmt.Print(ldflags) return } - args, err = addLdFlags(args[1:], ldflags) - if err != nil { - log.Fatalf("failed to add ldflags to args: %v", err) + args = args[1:] // rm executable name + + if args[0] == "build" || args[0] == "install" { + args, err = addLdFlags(args, ldflags) + if err != nil { + log.Fatalf("failed to add ldflags to args: %v", err) + } } if findArg(args, flDryRun) != -1 {