Error stacktraces reported by dockerized Go program cannot show original code

Hi,

Program built by Go docker image cannot show source code in Stacktrace.

Code:

package main

import (
	"fmt"
	"os"

	raven "github.com/getsentry/raven-go"
)

func init() {
	raven.SetDSN("OUR_DSN_URL")
}

func main() {
	_, err := os.Open("filename.ext")
	fmt.Println(raven.CaptureErrorAndWait(err, nil))
}

Then I build a binary with following docker command:

docker run --rm -v ~/go:/go -v $PWD:/go/src/github.com/goofansu/test-sentry -w /go/src/github.com/goofansu/test-sentry golang:1.8 go build

Is there anyone meet this problem?

Thanks

The source code needs to be available at runtime by the binary. If it’s not, we can’t get it for, just the binary itself.

Got it, thanks. Then I’ll find another way to deploy our program.

Just a wild idea, but if you clean the project before building it in the container, that might fix possibly embedded source file paths. At least that would be the case for Python and *.pyc files.

What do you mean “clean”? Thanks

The file paths has no problem, the only problem is not showing source code.