aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2023-10-12 08:35:37 +0700
committerGopher Robot <gobot@golang.org>2023-10-19 11:56:10 +0000
commit1f25f964632b5a650323d638f2cc7d3f2917fe74 (patch)
treee6e13ff59b60b21f7871291ef0f7ba32fb18c83d /test
parent40cdf69fc9279ab28f84a6e0f965de8382c578fe (diff)
downloadgo-1f25f964632b5a650323d638f2cc7d3f2917fe74.tar.gz
go-1f25f964632b5a650323d638f2cc7d3f2917fe74.zip
cmd/compile: report mismatched version set by //go:build
Fixes #63489 Change-Id: I5e02dc5165ada7f5c292d56203dc670e96eaf2c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/534755 Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/issue63489a.go16
-rw-r--r--test/fixedbugs/issue63489b.go11
2 files changed, 27 insertions, 0 deletions
diff --git a/test/fixedbugs/issue63489a.go b/test/fixedbugs/issue63489a.go
new file mode 100644
index 0000000000..b88120f2c0
--- /dev/null
+++ b/test/fixedbugs/issue63489a.go
@@ -0,0 +1,16 @@
+// errorcheck -lang=go1.21
+
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build go1.4
+
+package p
+
+const c = 0o123 // ERROR "file declares //go:build go1.4"
+
+// ERROR "file declares //go:build go1.4"
+
+//line issue63489a.go:13:1
+const d = 0o124
diff --git a/test/fixedbugs/issue63489b.go b/test/fixedbugs/issue63489b.go
new file mode 100644
index 0000000000..2ad590dfc3
--- /dev/null
+++ b/test/fixedbugs/issue63489b.go
@@ -0,0 +1,11 @@
+// errorcheck -lang=go1.4
+
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build go1.4
+
+package p
+
+const c = 0o123 // ERROR "file declares //go:build go1.4"