-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests fail with Go1.12rc1 #682
Comments
Zap has a hard-coded constant of call stacks to skip added by the standard logger: Reducing this to 1 allows tests to pass in go1.12. To ensure the reasoning made sense, I wrote a simple program, type writer struct{}
func (writer) Write(bs []byte) (int, error) {
pc := make([]uintptr, 100)
n := runtime.Callers(0, pc)
pc = pc[:n]
for _, pc := range pc {
f := runtime.FuncForPC(pc)
fmt.Println(f.FileLine(pc))
}
return 0, nil
}
func main() {
log.SetOutput(writer{})
log.Printf("test")
} When run with Go 1.12, the output is:
When run with Go1.11, the output is:
The go1.12 is missing I'll send out a fix which changes the number of callers to skip by Go version. |
Go1.11 includes a caller for the auto-generated wrapper within the standard library logger, which is no longer included in Go1.12. See #682 (comment) for more details. Fixes #682.
Go1.11 includes a caller for the auto-generated wrapper within the standard library logger, which is no longer included in Go1.12. See #682 (comment) for more details. Fixes #682.
Go 1.12 is old enough that we don't need to try to support it. The files global_go112 and global_prego112 existed to support different stack depths for the standard library logger, which changed going from Go 1.11 to 1.12. This is no longer something we need to support because per our CI configuration, we only support Go 1.15+. Ref #682
Per our CI, we don't support versions of Go older than 1.15. The files global_go112 and global_prego112 existed to support different stack depths for the standard library logger, which changed going from Go 1.11 to 1.12 (ref #682). This is no longer necessary; Go 1.11 is old enough that we don't need to support it.
Go1.11 includes a caller for the auto-generated wrapper within the standard library logger, which is no longer included in Go1.12. See uber-go#682 (comment) for more details. Fixes uber-go#682.
With Go 1.12rc1 when I run
go test go.uber.org/zap
I see the following. I think this is due to the changes in https://golang.org/issue/26839.The text was updated successfully, but these errors were encountered: