mirror of
https://github.com/golang/go
synced 2024-11-18 21:14:44 -07:00
f87c222f14
The go/format.Node function fails silently on malformed ASTs, even though it writes out an invalid tree containing the strings "BadExpr" and "BadStmt". We fix this by checking for *ast.Bad{Expr,Decl,Stmt} before running the function. Ultimately, this should be fixed upstream and just return an error from format.Node. Change-Id: I2ba25551f0e97c0321d8e757de67360af44044d7 Reviewed-on: https://go-review.googlesource.com/c/149613 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
9 lines
154 B
Go
9 lines
154 B
Go
// +build go1.11
|
|
|
|
package noparse_format //@format("package")
|
|
|
|
func what() {
|
|
var b int
|
|
if { hi() //@diag("{", "missing condition in if statement")
|
|
}
|
|
} |