Re: [go-nuts] draft design for // +build replacement

2020-07-07 Thread Russ Cox
On Tue, Jul 7, 2020 at 2:56 AM Amnon wrote: > A sensible, well thought out, design. > > My main worry is that we will come unstack in places that are using > versions of the Go toolchain older than N-2. > Is there any reason for them not to upgrade? No > Should they upgrade? Definitely > But

Re: [go-nuts] draft design for // +build replacement

2020-07-07 Thread Amnon
A sensible, well thought out, design. My main worry is that we will come unstack in places that are using versions of the Go toolchain older than N-2. Is there any reason for them not to upgrade? No Should they upgrade? Definitely But some still haven't. Perhaps we should force them to upgrade

Re: [go-nuts] draft design for // +build replacement

2020-07-01 Thread Bakul Shah
My suggestion was a variation on rsc's #2. Still a simple rule that is easy for people to remember and doesn't require asking the go command. Prefer a simple rule compared to any intermediation by a program. > On Jul 1, 2020, at 11:54 AM, jimmy frasche wrote: > > Running find -name "*_*.go" |

Re: [go-nuts] draft design for // +build replacement

2020-07-01 Thread jimmy frasche
Running find -name "*_*.go" | xargs grep " +build" on goroot shows a lot of files with redundant build tags or additional constraints not present in the file name so they don't seem like much of a single point of truth. I'd be fine with removing file names sometimes implying build tags. Add build

Re: [go-nuts] draft design for // +build replacement

2020-07-01 Thread Bakul Shah
4. Use two underscores for constraints. At least new constraints. Aside: Are you plantin' an idea about Plan10? > On Jul 1, 2020, at 11:06 AM, Russ Cox wrote: > > For what it's worth, I am (unsurprisingly) a big fan of the filename-based > constraints. It's a lightweight convention that has

Re: [go-nuts] draft design for // +build replacement

2020-07-01 Thread Russ Cox
For what it's worth, I am (unsurprisingly) a big fan of the filename-based constraints. It's a lightweight convention that has served us incredibly well. I really like being able to see in a directory listing which files go with what. It would be unfortunate if we had to put the redundant info

Re: [go-nuts] draft design for // +build replacement

2020-07-01 Thread go je
This might as well replace makefiles for testing and other tools. or similar formats. //go:test devenv func TestFoo(t *testing.T) {} //go:test devenv -failfast -short -cover ./... func TestFoo2(t *testing.T) {} //go:test prod func TestProduction(t *testing.T) {} $ go test devenv On Wed, Jul

Re: [go-nuts] draft design for // +build replacement

2020-06-30 Thread Sam Whited
I agree. I like the filename based constraints, but having both is annoying and since the comment based constraints are more flexible I think they'd have to be the ones to stay. I frequently find myself looking for constraints by grepping for whatever it is I want, but if I have filename based

Re: [go-nuts] draft design for // +build replacement

2020-06-30 Thread ben...@gmail.com
FWIW, I *like* the filename-based constraints. I can look at the source for the OS package (https://golang.org/src/os/) and immediately go to the _windows.go files to see how they do things on Windows (for example). It's really obvious from the directory listing, and I don't have to dig into

Re: [go-nuts] draft design for // +build replacement

2020-06-30 Thread 'Axel Wagner' via golang-nuts
Hm, though I guess in terms of compatibility, it should be mentioned that according to the design, this currently valid program wouldn't build at go1.(N-1) (and later, unless the `foo` build tag is specified): https://play.golang.org/p/436NUYC7rno If that's okay, then maybe mandating build tags is

Re: [go-nuts] draft design for // +build replacement

2020-06-30 Thread 'Axel Wagner' via golang-nuts
On Wed, Jul 1, 2020 at 1:10 AM roger peppe wrote: > LGTM. This is a welcome change. I often need to look up how to spell > "// +build" currently :) > > One thing I'd really like to see is the eventual deprecation of > filename-based build constraints (e.g. file_linux.go). > They make it hard for

Re: [go-nuts] draft design for // +build replacement

2020-06-30 Thread roger peppe
LGTM. This is a welcome change. I often need to look up how to spell "// +build" currently :) One thing I'd really like to see is the eventual deprecation of filename-based build constraints (e.g. file_linux.go). They make it hard for users (not everyone knows the name of all architectures), hard

[go-nuts] draft design for // +build replacement

2020-06-30 Thread Russ Cox
Hi all, I've posted a draft design for replacing // +build lines with //go:build lines that support standard boolean expression syntax. It is a draft design I'm circulating for feedback, not an official proposal. (I certainly hope it will be well received and can be made into a proposal, but