-
Notifications
You must be signed in to change notification settings - Fork 403
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
Refactor go builder to stop using go/build #305
Comments
+1 What numbers can I provide? |
A matrix like this would give me confidence to merge: cold|warm x before|after x project We'd need the PR to exist before we test it, though. I don't intend to implement this anytime soon, so if someone else wants to jump on it, feel free. |
This issue is stale because it has been open for 90 days with no |
i'm slowly taking a look at this 😄 , no promises |
In #303 I added a big warning about GOROOT mismatches between
ko
andgo
. I think this is necessary given howko
works, but we should be able to remove that warning if we refactor the go builder a bit.Historically,
ko
would attempt toImport
every single string in a document to determine whether or not it should build it. If we succeeded, great. If we failed, just ignore it (i.e. we failed open). That code is here.Per rsc this is bad. If
ko
embeds knowledge of how to import/build go code in its binary, if that logic changes ingo
, we have a mismatch. This happened withGOROOT
, which is why we're here.Unfortunately, shelling out to
go
would be too slow if we needed to do it for every string.Now that #281 has landed, we no longer look at every string. We only consider
ko://
strings, and we expect importing/building those targets will always succeed (i.e. we fail closed). Thus, we shouldn't really need to usego/build.Import
. Shelling out togo
should be fine, because we only do it a handful of times.Similarly, we relied on strange heuristics to avoid shelling out to
go
to get module info than once or using thepackages
package because it was slow for large numbers of strings.I think we should revisit some of these decisions, now that we require
ko://
everywhere.If I remember correctly, we should be able to just use
packages
for everything (it was build for this express purpose), but we should do some careful benchmarking to make sure we don't slow things down unnecessarily.I'd like some numbers for tekton, knative, and maybe mink before merging any of this.
cc @mattmoor @imjasonh thoughts?
The text was updated successfully, but these errors were encountered: