The semantics of the directive are not defined, and there are comments
like this[1] that would introduce breakage for people who target more
than one version of Go.

Which version do we choose to write? Gonum support latest and two
previous versions. We have had to write go 1.10 into that line so that
the tests against master don't fail, but this is another line that we
have to edit we we adjust versions for testing. When it becomes
important, I'd be happy to write it down, but the absence of any
semantic definition, it's just another line of text that has an
expected syntax, but no other apparent value.

[1]https://github.com/golang/go/issues/30791#issuecomment-472431458


On Mon, 2019-06-10 at 22:27 -0700, Ian Lance Taylor wrote:
> On Mon, Jun 10, 2019 at 9:56 PM Dan Kortschak <d...@kortschak.io>
> wrote:
> > 
> > 
> > The semantics of this line of go.mod is not described anywhere, but
> > the
> > tool chain blithely writes it to a go.mod file when there is no go
> > directive present.
> > 
> > Is there a way to mark the go.mod as go version-agnostic?
> No.  But there is no particular reason to do so.
> 
> The semantics, such as they are, are documented at
> https://golang.org/cmd/go/#hdr-The_go_mod_file: it's "the expected
> language version."  It sets the -lang option passed to cmd/compile,
> documented at https://golang.org/cmd/compile/.
> 
> You can write your own Go directive if you like, and it won't be
> modified.  You can also set it programatically using `go mod edit
> -go=version`.
> 
> Ian
> 

-- 
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/1560232311.21310.232.camel%40kortschak.io.
For more options, visit https://groups.google.com/d/optout.

Reply via email to