livebud / bud

The Full-Stack Web Framework for Go
MIT License
5.58k stars 178 forks source link

`bud build` and `bud run` add bogus entry to `go.mod` #183

Open vito opened 2 years ago

vito commented 2 years ago

I think this started happening with pretty recent changes - I'm using v0.1.9:

diff --git a/go.mod b/go.mod
index feb9af9..69e8957 100644
--- a/go.mod
+++ b/go.mod
@@ -136,3 +136,5 @@ require (

 // keep in sync with upstream buildkit
 replace github.com/docker/docker => github.com/docker/docker v20.10.3-0.20220224222438-c78f6963a1c0+incompatible
+
+replace github.com/livebud/bud => /home/vito/go/pkg/mod/github.com/livebud/bud@v0.1.9

This has an absolute path on my dev machine so I have to avoid accidentally committing it.

matthewmueller commented 2 years ago

Ahh, I can see that being annoying. This happens when using the latest version of bud, so not one of the releases: https://github.com/livebud/bud/blob/f3872335de4f45ae51453ff5082e1ad16c38343a/internal/cli/bud/bud.go#L149-L168

Some context: I originally added this when testing Bass Loop before releasing v0.1.9 to test that Bud continued to work. The runtime had breaking changes so testing the latest CLI with Bud's runtime fixed within Bass Loop's go.mod to an earlier version was causing errors.

I'm not sure what the right solution is here. Originally it did nothing on latest: https://github.com/livebud/bud/blob/e4c96b51b08e979e7a7bdfa921c778633f5275e9/internal/cli/bud/bud.go#L150-L153

Maybe default do nothing, but support a --link or --dev flag?

Update: What seems best is if you could tweak the replace with an environment variable or flag instead of modifying go.mod each time go run is called. There might be a way to do this.