Skip to content

Add go module support #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
10 changes: 10 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module github.com/aws/aws-lambda-go
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! thanks!


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
)
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
21 changes: 12 additions & 9 deletions lambda/panic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}