Hacker News new | past | comments | ask | show | jobs | submit login

> Yes, add a replace directive to A's go.mod and point it to B's directory. It'll pick up changes immediately.

Nowadays you just create a go.work file. That's much less cumbersome than 'replace' directives.

If a module is in the go.work it isn't downloaded from a remote git repo, but overshadowed by your local files.




Ehhh... I find it far more similar than not in terms of effort/maintenance, and much less likely to work with [random tool X] tbh. Replaces work with basically everything, and you can vendor when they don't - workspaces have no vendor equivalent AFAIK.

go.work is also rough to use with existing folders / a gopath-like setup, because they're super awkward if you don't have a dedicated folder with dedicated clones with just the stuff you're using in the workspace (which has some nice benefits, but most people are not even aware you can do that afaict, GOPATH caused so much pain that there's now mental scar tissue that'll take a while to clear). Replaces work fine with that if you open two editor instances, workspaces generally index everything or nothing and get confused.

Tooling support has likely improved since I last tried it (around 1.19?), and I 100% agree that it's a viable option worth considering (thanks for the comment!), but I'm not sold on them yet. Better for some things, worse for others.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: