1 // Copyright 2018 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // This is a sample test file illustrating the use 6 // of error comments with the error test harness. 7 8 package p 9 10 // The following are invalid error comments; they are 11 // silently ignored. The prefix must be exactly one of 12 // "/* ERROR " or "// ERROR ". 13 // 14 /*ERROR*/ 15 /*ERROR foo*/ 16 /* ERRORfoo */ 17 /* ERROR foo */ 18 //ERROR 19 // ERROR 20 // ERRORfoo 21 // ERROR foo 22 23 // This is a valid error comment; it applies to the 24 // immediately following token. 25 import "math" /* ERROR unexpected comma */ , 26 27 // If there are multiple /*-style error comments before 28 // the next token, only the last one is considered. 29 type x = /* ERROR ignored */ /* ERROR literal 0 in type declaration */ 0 30 31 // A //-style error comment matches any error position 32 // on the same line. 33 func () foo() // ERROR method has no receiver 34