-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve build config issue error scenario #483 #487
Conversation
Codecov Report
@@ Coverage Diff @@
## main #487 +/- ##
==========================================
- Coverage 53.13% 52.96% -0.18%
==========================================
Files 36 36
Lines 1848 1854 +6
==========================================
Hits 982 982
- Misses 715 718 +3
- Partials 151 154 +3
Continue to review full report at Codecov.
|
README.md
Outdated
@@ -127,7 +127,7 @@ baseImageOverrides: | |||
### Overriding Go build settings | |||
|
|||
By default, `ko` builds the binary with no additional build flags other than | |||
`--trimpath` (depending on the Go version). You can replace the default build | |||
`-trimpath` (depending on the Go version). You can replace the default build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're here, we removed the 1.13 compat code a while back, so we always pass -trimpath now, regardless of go version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Thanks.
README.md
Outdated
@@ -139,8 +139,7 @@ builds: | |||
env: | |||
- GOPRIVATE=git.internal.example.com,source.developers.google.com | |||
flags: | |||
- -tags | |||
- netgo | |||
- -trimpath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need to change this example. Can we revert this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. No problem. I was recently made aware that the netgo
build flag is not necessary anymore, at least there where I was using it. That was why I thought we could remove it here as well. However, it serves as an example and therefore helps with regards to understanding the idea behind that field.
99d079d
to
3a52ca2
Compare
There is currently no indication whether `ko` picks one of the configured build configurations from the `.ko.yaml` configuration file for a build. Add log statement to print the build config being picked for the build. Introduce default entry for build config `ID` in case it is not specified.
Add `os.Stat` to verify that the path that is configured in the build configuration entry is valid. As a side effect, this will print out an error message in case someone sets an import path like `github.com/google/ko` in the `main` field of the build config.
3a52ca2
to
d064eae
Compare
Had to rebase due to recent changes. |
Fixed wrong command line flag `--trimpath` to `-trimpath`.
d064eae
to
5c10215
Compare
Fixes #483
Introduced a log statement to see which build config is picked for a respective import path. Also, added piece of code to initialize the
ID
of a build config with a default value (index) so that the log statement always has an ID to show.Added a check to verify that the build config path (set by
dir
andmain
) actually points to a local file. This should help with use cases as described in #483 to find out configuration issues more quickly.Fixed the wording in the build config section of the README since it was misleading as towards import paths could be used in the
main
field. Removed obsoletenetgo
build tag from the example and fixed the-trimpath
in the example, which had two instead of just one dash.