-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'unix' condition #169
Add 'unix' condition #169
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change itself SGTM - I didn't notice that the goos and goarch conditions weren't documented yet.
As for the test, I would say use a "nested" testscript test. See the testdata changes in https://github.com/rogpeppe/go-internal/pull/167/files, for example. You could check that [unix]
matches when the host is [linux]
and not when it's [windows]
, for example - that should keep things simple enough and get us covered with CI.
Sorry, I'm not completely clear on what you're suggesting. Could you elaborate a little?
That was the aim of the two tests guarded by mutually exclusive build tags—I couldn't find a way to get |
Just pushed a commit to show what I mean :) I ended up deciding against using nested testscript, because we really don't need it. The end result is very close to what you had done, but with far less test code, thanks to testscript itself. The test only checks linux/darwin/windows, but I reckon that is enough given how popular they are, and that they are the three OSes that we use CI on. |
Oh, and while there, I also rewrote the existing cond.txt to use the native |
Great! Very good suggestions, thank you @mvdan. |
If it sounds good to you, then squash into your second commit - then we're ready for another review and a merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one question.
From Go 1.19, the build constraint 'unix' proposed in golang/go#20322 is satisfied by any sufficiently Unix-like value of GOOS, as defined by src/go/build/syslist.go. This commit adds a 'UnixOS' list containing the values of GOOS that would satisfy the 'unix' constraint in Go 1.19. Co-authored-by: Paul Jolly <paul@myitcv.io>
From Go 1.19, the build constraint 'unix' proposed in golang/go#20322 is satisfied by any sufficiently Unix-like value of GOOS, as defined by src/go/build/syslist.go. This commit adds a predefined 'unix' condition with the same meaning, available for use in test scripts. The condition is satisfied if the target GOOS is one of the list of Unix-like systems defined in 'imports.UnixOS'. Fixes rogpeppe#166. Co-authored-by: Daniel Martí <mvdan@mvdan.cc>
(see commit messages)
Fixes #166.