mirror of
https://github.com/golang/go
synced 2024-11-14 06:40:22 -07:00
cmd/compile: make check2 gracefully exit if it reported errors
Otherwise, if -d=panic was set, check2 will treat already reported error as internal compiler error. For #43311 Fixes #44445 Change-Id: I5dbe06334666df21d9107396b9dcfdd905aa1e44 Reviewed-on: https://go-review.googlesource.com/c/go/+/294850 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
1d0256a989
commit
868a110c56
@ -68,10 +68,10 @@ func check2(noders []*noder) {
|
|||||||
}
|
}
|
||||||
pkg, err := conf.Check(base.Ctxt.Pkgpath, files, &info)
|
pkg, err := conf.Check(base.Ctxt.Pkgpath, files, &info)
|
||||||
files = nil
|
files = nil
|
||||||
|
base.ExitIfErrors()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
base.FatalfAt(src.NoXPos, "conf.Check error: %v", err)
|
base.FatalfAt(src.NoXPos, "conf.Check error: %v", err)
|
||||||
}
|
}
|
||||||
base.ExitIfErrors()
|
|
||||||
if base.Flag.G < 2 {
|
if base.Flag.G < 2 {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// errorcheck
|
// errorcheck -d=panic
|
||||||
|
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
@ -9,7 +9,7 @@ package main
|
|||||||
import "sort"
|
import "sort"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
sort.Sort(nil);
|
sort.Sort(nil)
|
||||||
var x int;
|
var x int
|
||||||
sort(x); // ERROR "package"
|
sort(x) // ERROR "package"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// errorcheck
|
// errorcheck -d=panic
|
||||||
|
|
||||||
// Copyright 2011 The Go Authors. All rights reserved.
|
// Copyright 2011 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// errorcheck
|
// errorcheck -d=panic
|
||||||
|
|
||||||
// Copyright 2011 The Go Authors. All rights reserved.
|
// Copyright 2011 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
@ -7,7 +7,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
// Issue 2623
|
// Issue 2623
|
||||||
var m = map[string]int {
|
var m = map[string]int{
|
||||||
"abc":1,
|
"abc": 1,
|
||||||
1:2, // ERROR "cannot use 1.*as type string in map key|incompatible type|cannot convert"
|
1: 2, // ERROR "cannot use 1.*as type string in map key|incompatible type|cannot convert"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user