You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.
// %+s function name and path of source file relative to the compile time
// GOPATH separated by \n\t (<funcname>\n\t<path>)
// %+v equivalent to %+s:%d
However the absolute path is printed, not relative to GOPATH. This maches what is documented in StackTrace.Format:
// %+v Prints filename, function, and line number for each Frame in the stack.
Note no mention of being relative to GOPATH.
Go version: go version go1.10.3 linux/amd64
Steps to reproduce
$GOPATH/src/frame/main.go:
package main
import (
"fmt"
"github.com/pkg/errors"
)
type stackTracer interface {
StackTrace() errors.StackTrace
}
func main() {
fmt.Printf("%+s\n", errors.New("frame").(stackTracer).StackTrace()[0])
}
go run main.go
Expected output
main.main
src/frame/main.go
Actual results
With GOPATH=/tmp/gopath:
main.main
/tmp/gopath/src/frame/main.go
Proposed solution
Change the documentation of Frame.Format to be consistent with StackTrace.Format. If instead %+s is implemented to be relative to GOPATH, then update the documentation of StackTrace.Format. However note that out-of-GOPATH builds are coming in Go 1.11.
The text was updated successfully, but these errors were encountered:
Description
The documentation of Frame.Format promises:
However the absolute path is printed, not relative to GOPATH. This maches what is documented in StackTrace.Format:
Note no mention of being relative to GOPATH.
Go version:
go version go1.10.3 linux/amd64
Steps to reproduce
$GOPATH/src/frame/main.go
:go run main.go
Expected output
Actual results
With
GOPATH=/tmp/gopath
:Proposed solution
Change the documentation of
Frame.Format
to be consistent withStackTrace.Format
. If instead%+s
is implemented to be relative toGOPATH
, then update the documentation ofStackTrace.Format
. However note that out-of-GOPATH builds are coming in Go 1.11.The text was updated successfully, but these errors were encountered: