I really WANT to use go modules on all my projects, but there are times I just want to write a quick piece of code that I can 'go run'. Its usually just 20 lines, just used to test something out like a rest call to an internal server (can't do that on go playground) and for me go modules just makes it more complex. So what I do is what Reto stated above, set an environment variable for GO111MODULE=OFF. Now at the command line I can write a quick code sample and just type 'go run sample.go' and it runs. For my projects where I want go modules I use a Make file:
GO111MODULE=on GOOS=linux GOARCH=amd64 go build $(compilerFlag) -o mygoproject mygoproject.go othergofiles.go... On Monday, March 29, 2021 at 12:33:57 AM UTC-4 amits...@gmail.com wrote: > On Mon, Mar 29, 2021 at 12:15 PM Reto <re...@labrat.space> wrote: > > > > On Mon, Mar 29, 2021 at 11:18:28AM +1100, Amit Saha wrote: > > > "Module-aware mode is enabled by default, regardless of whether a > > > go.mod file is present in the current working directory or a parent > > > directory. More precisely, the GO111MODULE environment variable now > > > defaults to on. To switch to the previous behavior, set GO111MODULE to > > > auto. " > > > Is that implying the above behavior? > > > > Yes: https://golang.org/ref/mod#mod-commands > > > > Note that you can still run the hello world programs via `go run` without > > having a module. > > Thanks. > > > > > -- > > You received this message because you are subscribed to the Google > Groups "golang-nuts" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to golang-nuts...@googlegroups.com. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/20210329011453.3dddpz3syc6wv636%40feather.localdomain > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/c62dd3f2-da7f-494a-8bdc-f7c7f1c4b308n%40googlegroups.com.