Skip to content

include go build output in build error#1127

Merged
imjasonh merged 1 commit intoko-build:mainfrom
imjasonh:include-error
Sep 7, 2023
Merged

include go build output in build error#1127
imjasonh merged 1 commit intoko-build:mainfrom
imjasonh:include-error

Conversation

@imjasonh
Copy link
Member

@imjasonh imjasonh commented Sep 7, 2023

This doesn't change much for users of ko as a CLI, the output still contains relevant error output:

$ go run ./ build ./test/                                 
2023/09/07 09:18:11 Using base cgr.dev/chainguard/static:latest@sha256:a432665213f109d5e48111316030eecc5191654cf02a5b66ac6c5d6b310a5511 for github.com/google/ko/test
2023/09/07 09:18:11 Building github.com/google/ko/test for linux/amd64
Error: failed to publish images: error building "ko://github.com/google/ko/test": build: go build: exit status 1: # github.com/google/ko/test
test/main.go:80:1: syntax error: non-declaration statement outside function body

Previously, this was:

ko build ./test/
2023/09/07 09:19:21 Using base cgr.dev/chainguard/static:latest@sha256:a432665213f109d5e48111316030eecc5191654cf02a5b66ac6c5d6b310a5511 for github.com/google/ko/test
2023/09/07 09:19:22 Building github.com/google/ko/test for linux/amd64
2023/09/07 09:19:22 Unexpected error running "go build": exit status 1
# github.com/google/ko/test
test/main.go:79:1: syntax error: non-declaration statement outside function body
Error: failed to publish images: error building "ko://github.com/google/ko/test": build: go build: exit status 1
exit status 1

For users of ko as a library, mainly tf-ko, which swallows log output, this will be very helpful in surfacing the go build error.

Signed-off-by: Jason Hall <jason@chainguard.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants