Re: [go-nuts] Go 1.16 and modules

2021-03-29 Thread Jon Reiter
i think it's gentler to look at this in the context of c's "hello world"
program.  the first version was missing both #include and void.  then it
got #include. then it got void.  i recall void issues with code from k&r v1
on my compiler in the mid 80s (i do not predate include statements).  i
recall a brian kernighan talk where he comments on precisely this point as
well.  for me it's not so much "it's easy just do it" but rather "it's
fairly easy and worth it for the clarity."

yes i know those are code changes while this is the build process -- this
is about quantum of effort required.  having said that: something to help
with missing modules in dependencies would be helpful as that is
significantly harder.  i was able to adjust c even as a novice.  a
casual/beginner today is likely not able to fork-and-update a dependency.


On Tue, Mar 30, 2021 at 7:56 AM 'Axel Wagner' via golang-nuts <
golang-nuts@googlegroups.com> wrote:

> I understand many criticisms of modules, but I honestly don't really get
> this one.
> You can just do `go mod init foo` in an empty directory, if all you want
> is some throwaway Go code. It doesn't actually seem very complicated to me,
> I must say.
>
> On Tue, Mar 30, 2021 at 1:52 AM Rich  wrote:
>
>> 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  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
>> 
>> .
>>
> --
> 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/CAEkBMfGk52HwKmX3Oj_%2B5yiCi%3Dk6VTvihi4rBbqSdXr1M67UCw%40mail.gmail.com
> 
> .
>

-- 
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/CABZtUk4mCuSSZW9Ci6DJBCYisJL1iKbDPKKqky7uY6GxHC1wXw%40mail.gmail.com.


Re: [go-nuts] Go 1.16 and modules

2021-03-29 Thread Eli Bendersky
On Mon, Mar 29, 2021 at 4:52 PM Rich  wrote:

> 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...
>

I may have missed it, but could you clarify why you can't just create your
sample.go and 'go run' it with Go 1.16? No need to create a module for
this.


/tmp$ ls go.mod
ls: cannot access 'go.mod': No such file or directory

/tmp$ cat sample.go
package main

import "fmt"

func main() {
   fmt.Println("hello")
}

/tmp$ go version
go version go1.16 linux/amd64

/tmp$ go run sample.go
hello


Or is your 'sample.go' importing code from outside the standard library?

Eli





>
>
>
> 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  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
> 
> .
>

-- 
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/CAF-Rda-awCfWXD6aRCVw4Qd2PpFxe3pBgiMW9_iTQC7j9Rg_2A%40mail.gmail.com.


Re: [go-nuts] Go 1.16 and modules

2021-03-29 Thread 'Axel Wagner' via golang-nuts
I understand many criticisms of modules, but I honestly don't really get
this one.
You can just do `go mod init foo` in an empty directory, if all you want is
some throwaway Go code. It doesn't actually seem very complicated to me, I
must say.

On Tue, Mar 30, 2021 at 1:52 AM Rich  wrote:

> 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  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
> 
> .
>

-- 
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/CAEkBMfGk52HwKmX3Oj_%2B5yiCi%3Dk6VTvihi4rBbqSdXr1M67UCw%40mail.gmail.com.


Re: [go-nuts] Go 1.16 and modules

2021-03-29 Thread Rich
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  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.


Re: [go-nuts] Go 1.16 and modules

2021-03-28 Thread Amit Saha
On Mon, Mar 29, 2021 at 12:15 PM Reto  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+unsubscr...@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/CANODV3kx-%2BeP%3DjGYDMv0g%2BrNZ5vcrCpOrmc9mit0FJj-x2iFFw%40mail.gmail.com.


Re: [go-nuts] Go 1.16 and modules

2021-03-28 Thread Reto
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.

-- 
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/20210329011453.3dddpz3syc6wv636%40feather.localdomain.