Use Go 1.5 vendoring instead of Godeps
Change made by: - running "gvt fetch" on each of the packages mentioned in Godeps/Godeps.json - `rm -rf Godeps` - tweaking the build scripts to not mention Godeps - tweaking the build scripts to test `./lib/...`, `./cmd/...` explicitly (to avoid testing vendor) - tweaking the build scripts to not juggle GOPATH for Godeps and instead set GO15VENDOREXPERIMENT. This also results in some updated packages at the same time I bet. Building with Go 1.3 and 1.4 still *works* but won't use our vendored dependencies - the user needs to have the actual packages in their GOPATH then, which they'll get with a normal "go get". Building with Go 1.6+ will get our vendored dependencies by default even when not using our build script, which is nice. By doing this we gain some freedom in that we can pick and choose manually what to include in vendor, as it's not based on just dependency analysis of our own code. This is also a risk as we might pick up dependencies we are unaware of, as the build may work locally with those packages present in GOPATH. On the other hand the build server will detect this as it has no packages in it's GOPATH beyond what is included in the repo. Recommended tool to manage dependencies is github.com/FiloSottile/gvt.
This commit is contained in:
32
vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go
generated
vendored
Normal file
32
vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
package codelocation
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
|
||||
"github.com/onsi/ginkgo/types"
|
||||
)
|
||||
|
||||
func New(skip int) types.CodeLocation {
|
||||
_, file, line, _ := runtime.Caller(skip + 1)
|
||||
stackTrace := PruneStack(string(debug.Stack()), skip)
|
||||
return types.CodeLocation{FileName: file, LineNumber: line, FullStackTrace: stackTrace}
|
||||
}
|
||||
|
||||
func PruneStack(fullStackTrace string, skip int) string {
|
||||
stack := strings.Split(fullStackTrace, "\n")
|
||||
if len(stack) > 2*(skip+1) {
|
||||
stack = stack[2*(skip+1):]
|
||||
}
|
||||
prunedStack := []string{}
|
||||
re := regexp.MustCompile(`\/ginkgo\/|\/pkg\/testing\/|\/pkg\/runtime\/`)
|
||||
for i := 0; i < len(stack)/2; i++ {
|
||||
if !re.Match([]byte(stack[i*2])) {
|
||||
prunedStack = append(prunedStack, stack[i*2])
|
||||
prunedStack = append(prunedStack, stack[i*2+1])
|
||||
}
|
||||
}
|
||||
return strings.Join(prunedStack, "\n")
|
||||
}
|
||||
13
vendor/github.com/onsi/ginkgo/internal/codelocation/code_location_suite_test.go
generated
vendored
Normal file
13
vendor/github.com/onsi/ginkgo/internal/codelocation/code_location_suite_test.go
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
package codelocation_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCodelocation(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "CodeLocation Suite")
|
||||
}
|
||||
79
vendor/github.com/onsi/ginkgo/internal/codelocation/code_location_test.go
generated
vendored
Normal file
79
vendor/github.com/onsi/ginkgo/internal/codelocation/code_location_test.go
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
package codelocation_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
"github.com/onsi/ginkgo/internal/codelocation"
|
||||
"github.com/onsi/ginkgo/types"
|
||||
. "github.com/onsi/gomega"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
var _ = Describe("CodeLocation", func() {
|
||||
var (
|
||||
codeLocation types.CodeLocation
|
||||
expectedFileName string
|
||||
expectedLineNumber int
|
||||
)
|
||||
|
||||
caller0 := func() {
|
||||
codeLocation = codelocation.New(1)
|
||||
}
|
||||
|
||||
caller1 := func() {
|
||||
_, expectedFileName, expectedLineNumber, _ = runtime.Caller(0)
|
||||
expectedLineNumber += 2
|
||||
caller0()
|
||||
}
|
||||
|
||||
BeforeEach(func() {
|
||||
caller1()
|
||||
})
|
||||
|
||||
It("should use the passed in skip parameter to pick out the correct file & line number", func() {
|
||||
Ω(codeLocation.FileName).Should(Equal(expectedFileName))
|
||||
Ω(codeLocation.LineNumber).Should(Equal(expectedLineNumber))
|
||||
})
|
||||
|
||||
Describe("stringer behavior", func() {
|
||||
It("should stringify nicely", func() {
|
||||
Ω(codeLocation.String()).Should(ContainSubstring("code_location_test.go:%d", expectedLineNumber))
|
||||
})
|
||||
})
|
||||
|
||||
//There's no better way than to test this private method as it
|
||||
//goes out of its way to prune out ginkgo related code in the stack trace
|
||||
Describe("PruneStack", func() {
|
||||
It("should remove any references to ginkgo and pkg/testing and pkg/runtime", func() {
|
||||
input := `/Skip/me
|
||||
Skip: skip()
|
||||
/Skip/me
|
||||
Skip: skip()
|
||||
/Users/whoever/gospace/src/github.com/onsi/ginkgo/whatever.go:10 (0x12314)
|
||||
Something: Func()
|
||||
/Users/whoever/gospace/src/github.com/onsi/ginkgo/whatever_else.go:10 (0x12314)
|
||||
SomethingInternalToGinkgo: Func()
|
||||
/usr/goroot/pkg/strings/oops.go:10 (0x12341)
|
||||
Oops: BlowUp()
|
||||
/Users/whoever/gospace/src/mycode/code.go:10 (0x12341)
|
||||
MyCode: Func()
|
||||
/Users/whoever/gospace/src/mycode/code_test.go:10 (0x12341)
|
||||
MyCodeTest: Func()
|
||||
/Users/whoever/gospace/src/mycode/code_suite_test.go:12 (0x37f08)
|
||||
TestFoo: RunSpecs(t, "Foo Suite")
|
||||
/usr/goroot/pkg/testing/testing.go:12 (0x37f08)
|
||||
TestingT: Blah()
|
||||
/usr/goroot/pkg/runtime/runtime.go:12 (0x37f08)
|
||||
Something: Func()
|
||||
`
|
||||
prunedStack := codelocation.PruneStack(input, 1)
|
||||
Ω(prunedStack).Should(Equal(`/usr/goroot/pkg/strings/oops.go:10 (0x12341)
|
||||
Oops: BlowUp()
|
||||
/Users/whoever/gospace/src/mycode/code.go:10 (0x12341)
|
||||
MyCode: Func()
|
||||
/Users/whoever/gospace/src/mycode/code_test.go:10 (0x12341)
|
||||
MyCodeTest: Func()
|
||||
/Users/whoever/gospace/src/mycode/code_suite_test.go:12 (0x37f08)
|
||||
TestFoo: RunSpecs(t, "Foo Suite")`))
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user