| 1 |
This test verifies that we add an [os,arch] suffix to each diagnostic |
| 2 |
that doesn't appear in the default build (=runtime.{GOOS,GOARCH}). |
| 3 |
|
| 4 |
See golang/go#65496. |
| 5 |
|
| 6 |
The two p/*.go files below are written to trigger the same diagnostic |
| 7 |
(range, message, source, etc) but varying only by URI. |
| 8 |
|
| 9 |
In the q test, a single location in the common code q.go has two |
| 10 |
diagnostics, one of which is tagged. |
| 11 |
|
| 12 |
This test would fail on openbsd/riscv64 because it will be the same as |
| 13 |
the default build, so we skip that platform. And it would fail on |
| 14 |
*/riscv64 merely because it produces a diagnostic that doesn't include |
| 15 |
the riscv64 component (since it's the default). So we disable it for |
| 16 |
that GOOS or GOARCH. But the purpose of the test is not coverage |
| 17 |
across all configurations, only to test the mechanism in some configs. |
| 18 |
|
| 19 |
-- flags -- |
| 20 |
-skip_goos=openbsd |
| 21 |
-skip_goarch=riscv64 |
| 22 |
|
| 23 |
-- go.mod -- |
| 24 |
module example.com |
| 25 |
|
| 26 |
-- p/p.go -- |
| 27 |
package p |
| 28 |
|
| 29 |
var _ fmt.Stringer //@diag("fmt", re"unde.*: fmt$") |
| 30 |
|
| 31 |
-- p/p_openbsd_riscv64.go -- |
| 32 |
package p |
| 33 |
|
| 34 |
var _ fmt.Stringer //@diag("fmt", re"unde.*: fmt \\[openbsd,riscv64\\]") |
| 35 |
|
| 36 |
-- q/q_default.go -- |
| 37 |
//+build !openbsd && !riscv64 |
| 38 |
|
| 39 |
package q |
| 40 |
|
| 41 |
func f(int) int |
| 42 |
|
| 43 |
-- q/q_openbsd_riscv64.go -- |
| 44 |
package q |
| 45 |
|
| 46 |
func f(string) int |
| 47 |
|
| 48 |
-- q/q.go -- |
| 49 |
package q |
| 50 |
|
| 51 |
var _ = f() //@ diag(")", re`.*want \(string\) \[openbsd,riscv64\]`), diag(")", re`.*want \(int\)$`) |