diff --git a/.travis.yml b/.travis.yml index 153f5c05..d717bfbe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,18 @@ install: - go get github.com/haya14busa/goverage matrix: + include: + - go: 1.12 + env: GO111MODULE=on + before_install: + - go mod download + install: + - go get golang.org/x/lint/golint + - go get github.com/haya14busa/goverage allow_failures: - go: tip + - go: 1.12 + env: GO111MODULE=on fast_finish: true notifications: @@ -33,4 +43,4 @@ script: - golint $LINT_PKGS # lint - ignore failures for now after_success: - - bash <(curl -s https://codecov.io/bash) + - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..76e68829 --- /dev/null +++ b/go.mod @@ -0,0 +1,10 @@ +module github.com/aws/aws-lambda-go + +go 1.12 + +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/stretchr/testify v1.2.1 + gopkg.in/urfave/cli.v1 v1.20.0 +) diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..c9a878ca --- /dev/null +++ b/go.sum @@ -0,0 +1,8 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.2.1 h1:52QO5WkIUcHGIR7EnGagH88x1bUzqGXTC5/1bDTUQ7U= +github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= +gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= diff --git a/lambda/panic_test.go b/lambda/panic_test.go index 597e76be..92db8fd7 100644 --- a/lambda/panic_test.go +++ b/lambda/panic_test.go @@ -112,6 +112,7 @@ func testRuntimeStackTrace(t *testing.T) { assert.NoError(t, err) frame := panicInfo.StackTrace[0] + assert.Equal(t, packagePath+"/panic_test.go", frame.Path) assert.True(t, frame.Line > 0) assert.Equal(t, "testRuntimeStackTrace", frame.Label) @@ -123,14 +124,16 @@ func getPackagePath() (string, error) { return "", err } - basePath := os.Getenv("GOPATH") - if basePath == "" { - if runtime.GOOS == "windows" { - basePath = os.Getenv("USERPROFILE") + "/go" - } else { - basePath = os.Getenv("HOME") + "/go" - } + var paths []string + if runtime.GOOS == "windows" { + paths = strings.Split(fullPath, "\\") + } else { + paths = strings.Split(fullPath, "/") + } + + // The frame.Path will only contain the last 5 directories if there are more than 5 directories. + if len(paths) >= 5 { + paths = paths[len(paths)-4:] } - basePath = strings.Split(basePath, ":")[0] - return strings.Replace(fullPath, basePath+"/src/", "", 1), nil + return strings.Join(paths, "/"), nil }