

If there does happen to be a go.work file you do not receive any error messaging (or messaging at all) when you run go run. You could have a replace directive in here (and you still might, for other reasons than go.work) but at least it was all in one place.

Before go 1.18, everything module related would be in go.mod. This will lead you to read up on go.mod and likely take a look at it.

If you know nothing about go or just the basics if you try and run an application it's going to spit out some error message about go modules or vendoring. The reason I still raised it as if I view the go tooling through the eyes of a beginner, I can see confusion and bad things happening with the current setup. I hear you on making the tool less ergonomic for those who use it well and is something I thought quite a bit before raising this proposal. I therefore propose GOWORK should alway be off by default, and if you want to use it, you should explicitly flag it on when executing the go run command such as: There is nothing stopping someone simply cloning a repo and running go run on a server and I have done this for side projects in the past. Good practise dictates you should use a binary in production environments and probably not commit your go.work file, but that's all it is, good practise. For those less familiar with the go ecosystem, perhaps who are cloning and running someone else's project for the first time, it may not even be entirely clear that this is happening. , you will use this module and there is no warning in the console that it has happened. if you forget to set GOWORK=off when running go run.
Git windows fix runningsomeoneelse scode vulnerability code#
This means, in my opinion, it is more likely that people will take code intended for local development and deploy it into a production environment.įor example, you might use a go.work file to override your complex auth module to always return true locally. As of go 1.18, if you have a go.work file present at the time of running go run, it will use the module referenced in the go.work file.
