'make install' should `go:embed` stdlibs, examples folder, and other dynamic dependencies
I propose that when running 'make install,' we should embed the standard libraries, examples folder, and other dynamic dependencies into the binary. This approach allows us to develop without worrying about the location of the cloned directory.
We have a few options to consider:
- Utilizing the
$GNOROOTenvironment variable (#1233). - Using
gno mod downloadfor standard libraries, although this approach can be error-prone during development. - Embedding the source code with
go:embedso that the file system is not required to retrieve configuration. This embedding should occur only when running 'make install,' while using 'go run ./...' would allow developers to skip embedding and work with the most up-to-date source.
Initially, I leaned towards option 1, but I recommend considering the third option. It encourages GNOROOT but doesn't make it mandatory.
cc @thehowl, as this relates to #814.
So, I've given this some thought. While I still believe that long-term, we want to encourage also all "proper" installations to have the stdlibs they use as inspectable files, I do agree that embedding the stdlibs directory will lead to the gno command not needing any configuration to set up, even without other OS configuration.
The standard libraries are a few megabytes. So, my proposed plan is this:
- go:embed stdlibs
-
gnodoes not require aGNOROOT/root-diranymore;gnolanddoes (for the examples directory) - If any of the current methods for finding GNOROOT work (flag, env var, go list), then we use that as a GNOROOT.