github.com/riscv/riscv-go@v0.0.0-20200123204226-124ebd6fcc8e/riscvtest/live.go (about) 1 package main 2 3 import "os" 4 5 // Adapted from errors/errors.go 6 // 7 // New fails liveness analysis at build time if Addrs are not optimized away. 8 9 // New returns an error that formats as the given text. 10 func New(text string) error { 11 return &errorString{text} 12 } 13 14 // errorString is a trivial implementation of error. 15 type errorString struct { 16 s string 17 } 18 19 func (e *errorString) Error() string { 20 return e.s 21 } 22 23 func main() { 24 New("foo") 25 os.Exit(0) 26 }