1
0
mirror of https://github.com/golang/go synced 2024-11-18 07:54:55 -07:00
go/test/fixedbugs/issue29304.go
Robert Griesemer a1aafd8b28 cmd/compile: generate interface method expression wrapper for error.Error
A prior optimization (https://golang.org/cl/106175) removed the
generation of unnecessary method expression wrappers, but also
eliminated the generation of the wrapper for error.Error which
was still required.

Special-case error type in the optimization.

Fixes #29304.

Change-Id: I54c8afc88a2c6d1906afa2d09c68a0a3f3e2f1e3
Reviewed-on: https://go-review.googlesource.com/c/154578
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-17 19:48:36 +00:00

20 lines
404 B
Go

// run
// Copyright 2018 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.
// Verify that relocation target go.builtin.error.Error
// is defined and the code links and runs correctly.
package main
import "errors"
func main() {
err := errors.New("foo")
if error.Error(err) != "foo" {
panic("FAILED")
}
}