There would be no advantage to that - all features are either available, or not available, depending on which version you use. There is no "go 1.16 without `embed`". It also needs to be set in `go.mod`, because you might compile modules written for different go versions into one binary - so which language version to use is part of the module description. So, no. Putting a language version into `go.mod` seems to be exactly the right way to do this.
On Tue, Mar 2, 2021 at 12:21 PM tapi...@gmail.com <tapir....@gmail.com> wrote: > BTW, I think the embedding functionality introduced in Go 1.16 should not > be viewed as a feature. > It should be viewed as an API change instead. > I don't understand what you mean by this. There is no intrinsic difference between the two. In this particular case, the `embed` package adds an API to support a new feature "embedding static files in go binaries". > Now Go projects using embedding and setting go directive verison as v1.15 > in go.mod fail to compile with Go toolchain 1.16. > They shouldn't do that. If they use `embed`, they require at least go 1.16, so they set that. I can't reproduce your claim that setting `go 1.15` and using embed will fail to compile with a Go 1.16 toolchain. It works fine for me. IMO, this is unnecessary, for the "//go:embed" directive always requires > importing the "embed" package. > > On Tuesday, March 2, 2021 at 6:14:23 AM UTC-5 tapi...@gmail.com wrote: > >> Would be better to use compile flags to control each language features >> individually? >> > -- > 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/c8e1bd96-78e2-434a-a0cc-4356382e49fcn%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/c8e1bd96-78e2-434a-a0cc-4356382e49fcn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAEkBMfGWDzsPOUs3-VkCsoCGT6vy-8F7p6AoLOh-NjxOibdP%2Bg%40mail.gmail.com.