gno icon indicating copy to clipboard operation
gno copied to clipboard

'make install' should `go:embed` stdlibs, examples folder, and other dynamic dependencies

Open moul opened this issue 2 years ago • 1 comments

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:

  1. Utilizing the $GNOROOT environment variable (#1233).
  2. Using gno mod download for standard libraries, although this approach can be error-prone during development.
  3. Embedding the source code with go:embed so 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.

moul avatar Oct 17 '23 11:10 moul

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
  • gno does not require a GNOROOT / root-dir anymore; gnoland does (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.

thehowl avatar Oct 23 '23 23:10 thehowl