Skip to content

Commit

Permalink
Fix 'govvv list', add regression test
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
  • Loading branch information
ahmetb committed Aug 18, 2016
1 parent 905d46c commit 826804e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions integration-test/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 826804e

Please # to comment.