-
Notifications
You must be signed in to change notification settings - Fork 689
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
go mod: migrating from dep to go modules #949
go mod: migrating from dep to go modules #949
Conversation
- Dependencies are vendored before building using `go mod vendor`. - During `go build` and `go test`, the vendored dependencies are used by setting `GOFLAGS=-mod=vendor`. Signed-off-by: Amarnath <[email protected]>
staticcheck \
-checks all,-ST1003 \
github.com/heptio/contour/cmd/contour github.com/heptio/contour/internal/contour github.com/heptio/contour/internal/dag github.com/heptio/contour/internal/debug github.com/heptio/contour/internal/e2e github.com/heptio/contour/internal/envoy github.com/heptio/contour/internal/grpc github.com/heptio/contour/internal/httpsvc github.com/heptio/contour/internal/k8s github.com/heptio/contour/internal/metrics
fatal error: runtime: out of memory
runtime stack:
runtime.throw(0xa1d6b6, 0x16)
/usr/local/go/src/runtime/panic.go:617 +0x72
runtime.sysMap(0xc390000000, 0xa4000000, 0xed84b8)
/usr/local/go/src/runtime/mem_linux.go:170 +0xc7
runtime.(*mheap).sysAlloc(0xec0140, 0xa2894000, 0xec0150, 0x5144a)
/usr/local/go/src/runtime/malloc.go:633 +0x1cd
runtime.(*mheap).grow(0xec0140, 0x5144a, 0x0)
/usr/local/go/src/runtime/mheap.go:1232 +0x42
runtime.(*mheap).allocSpanLocked(0xec0140, 0x5144a, 0xed84c8, 0x0)
/usr/local/go/src/runtime/mheap.go:1150 +0x3a7
runtime.(*mheap).alloc_m(0xec0140, 0x5144a, 0x100, 0x0)
/usr/local/go/src/runtime/mheap.go:977 +0xc2
runtime.(*mheap).alloc.func1()
/usr/local/go/src/runtime/mheap.go:1048 +0x4c
runtime.(*mheap).alloc(0xec0140, 0x5144a, 0x7f0f45010100, 0x428180)
/usr/local/go/src/runtime/mheap.go:1047 +0x8a
runtime.largeAlloc(0xa2894000, 0x450001, 0xc053004000)
/usr/local/go/src/runtime/malloc.go:1055 +0x99
runtime.mallocgc.func1()
/usr/local/go/src/runtime/malloc.go:950 +0x46
runtime.systemstack(0x0)
/usr/local/go/src/runtime/asm_amd64.s:351 +0x66
runtime.mstart()
/usr/local/go/src/runtime/proc.go:1153
goroutine 1 [running]:
runtime.systemstack_switch()
/usr/local/go/src/runtime/asm_amd64.s:311 fp=0xc0d902f648 sp=0xc0d902f640 pc=0x458bc0
runtime.mallocgc(0xa2894000, 0x9d6360, 0xc0de924001, 0x45c329a0)
/usr/local/go/src/runtime/malloc.go:949 +0x872 fp=0xc0d902f6e8 sp=0xc0d902f648 pc=0x40daf2
runtime.growslice(0x9d6360, 0xc1277d0000, 0xabb904, 0xabb93b, 0x190167a, 0xabb904, 0xb37cec, 0xabb904)
/usr/local/go/src/runtime/slice.go:181 +0x1e6 fp=0xc0d902f750 sp=0xc0d902f6e8 pc=0x4444d6
honnef.co/go/tools/lint/lintutil.Lint(0xc0000e8720, 0x4, 0x6, 0xc0000201d0, 0xa, 0xa, 0xc0d902fe40, 0x97f2a0, 0x94a820, 0xf00000001, ...)
/home/amarnath/go/pkg/mod/honnef.co/go/[email protected]/lint/lintutil/util.go:287 +0x56f fp=0xc0d902fa78 sp=0xc0d902f750 pc=0x6e221f
honnef.co/go/tools/lint/lintutil.ProcessFlagSet(0xc0000e8720, 0x4, 0x6, 0xc0000e86c0)
/home/amarnath/go/pkg/mod/honnef.co/go/[email protected]/lint/lintutil/util.go:178 +0x9aa fp=0xc0d902ff00 sp=0xc0d902fa78 pc=0x6e12aa
main.main()
/home/amarnath/go/pkg/mod/honnef.co/go/[email protected]/cmd/staticcheck/staticcheck.go:29 +0x2d0 fp=0xc0d902ff98 sp=0xc0d902ff00 pc=0x8f8ab0
runtime.main()
/usr/local/go/src/runtime/proc.go:200 +0x20c fp=0xc0d902ffe0 sp=0xc0d902ff98 pc=0x42fdbc
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc0d902ffe8 sp=0xc0d902ffe0 pc=0x45ac91
Makefile:59: recipe for target 'staticcheck' failed This might be related to dominikh/go-tools#419 which appears to be a similar issue. |
Are you using a 32 but build of Go?
… On 18 Mar 2019, at 23:09, Amarnath ***@***.***> wrote:
staticcheck is running out of memory after this change. Locally, when I run staticcheck, this is what I see
staticcheck \
-checks all,-ST1003 \
github.com/heptio/contour/cmd/contour github.com/heptio/contour/internal/contour github.com/heptio/contour/internal/dag github.com/heptio/contour/internal/debug github.com/heptio/contour/internal/e2e github.com/heptio/contour/internal/envoy github.com/heptio/contour/internal/grpc github.com/heptio/contour/internal/httpsvc github.com/heptio/contour/internal/k8s github.com/heptio/contour/internal/metrics
fatal error: runtime: out of memory
runtime stack:
runtime.throw(0xa1d6b6, 0x16)
/usr/local/go/src/runtime/panic.go:617 +0x72
runtime.sysMap(0xc390000000, 0xa4000000, 0xed84b8)
/usr/local/go/src/runtime/mem_linux.go:170 +0xc7
runtime.(*mheap).sysAlloc(0xec0140, 0xa2894000, 0xec0150, 0x5144a)
/usr/local/go/src/runtime/malloc.go:633 +0x1cd
runtime.(*mheap).grow(0xec0140, 0x5144a, 0x0)
/usr/local/go/src/runtime/mheap.go:1232 +0x42
runtime.(*mheap).allocSpanLocked(0xec0140, 0x5144a, 0xed84c8, 0x0)
/usr/local/go/src/runtime/mheap.go:1150 +0x3a7
runtime.(*mheap).alloc_m(0xec0140, 0x5144a, 0x100, 0x0)
/usr/local/go/src/runtime/mheap.go:977 +0xc2
runtime.(*mheap).alloc.func1()
/usr/local/go/src/runtime/mheap.go:1048 +0x4c
runtime.(*mheap).alloc(0xec0140, 0x5144a, 0x7f0f45010100, 0x428180)
/usr/local/go/src/runtime/mheap.go:1047 +0x8a
runtime.largeAlloc(0xa2894000, 0x450001, 0xc053004000)
/usr/local/go/src/runtime/malloc.go:1055 +0x99
runtime.mallocgc.func1()
/usr/local/go/src/runtime/malloc.go:950 +0x46
runtime.systemstack(0x0)
/usr/local/go/src/runtime/asm_amd64.s:351 +0x66
runtime.mstart()
/usr/local/go/src/runtime/proc.go:1153
goroutine 1 [running]:
runtime.systemstack_switch()
/usr/local/go/src/runtime/asm_amd64.s:311 fp=0xc0d902f648 sp=0xc0d902f640 pc=0x458bc0
runtime.mallocgc(0xa2894000, 0x9d6360, 0xc0de924001, 0x45c329a0)
/usr/local/go/src/runtime/malloc.go:949 +0x872 fp=0xc0d902f6e8 sp=0xc0d902f648 pc=0x40daf2
runtime.growslice(0x9d6360, 0xc1277d0000, 0xabb904, 0xabb93b, 0x190167a, 0xabb904, 0xb37cec, 0xabb904)
/usr/local/go/src/runtime/slice.go:181 +0x1e6 fp=0xc0d902f750 sp=0xc0d902f6e8 pc=0x4444d6
honnef.co/go/tools/lint/lintutil.Lint(0xc0000e8720, 0x4, 0x6, 0xc0000201d0, 0xa, 0xa, 0xc0d902fe40, 0x97f2a0, 0x94a820, 0xf00000001, ...)
***@***.***/lint/lintutil/util.go:287 +0x56f fp=0xc0d902fa78 sp=0xc0d902f750 pc=0x6e221f
honnef.co/go/tools/lint/lintutil.ProcessFlagSet(0xc0000e8720, 0x4, 0x6, 0xc0000e86c0)
***@***.***/lint/lintutil/util.go:178 +0x9aa fp=0xc0d902ff00 sp=0xc0d902fa78 pc=0x6e12aa
main.main()
***@***.***/cmd/staticcheck/staticcheck.go:29 +0x2d0 fp=0xc0d902ff98 sp=0xc0d902ff00 pc=0x8f8ab0
runtime.main()
/usr/local/go/src/runtime/proc.go:200 +0x20c fp=0xc0d902ffe0 sp=0xc0d902ff98 pc=0x42fdbc
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc0d902ffe8 sp=0xc0d902ffe0 pc=0x45ac91
Makefile:59: recipe for target 'staticcheck' failed
This might be related to dominikh/go-tools#419 which appears to be a similar issue.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
No, I am using 64bit build of Go. ➜ contour git:(migrate-to-go-mod) ✗ which go
/usr/local/go/bin/go
➜ contour git:(migrate-to-go-mod) ✗ file /usr/local/go/bin/go
/usr/local/go/bin//go: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, not stripped
➜ contour git:(migrate-to-go-mod) ✗ file ~/go/bin/staticcheck
/home/amarnath/go/bin/staticcheck: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, not stripped |
Thanks for checking. I thought the pointer offsets looked like 32 bit values but I was wrong. Please ignore my question.
… On 19 Mar 2019, at 00:56, Amarnath ***@***.***> wrote:
No, I am using 64bit build of Go.
➜ contour git:(migrate-to-go-mod) ✗ which go
/usr/local/go/bin/go
➜ contour git:(migrate-to-go-mod) ✗ file /usr/local/go/bin/go
/usr/local/go/bin//go: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, not stripped
➜ contour git:(migrate-to-go-mod) ✗ file ~/go/bin/staticcheck
/home/amarnath/go/bin/staticcheck: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, not stripped
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@vaamarnath thanks for working on this. Why do we need to use -mod vendor mode all the way through the makefile and build tools? |
My thought process was to make use of the Quoting from https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away
From what I understand, it avoids @davecheney Is this a wrong approach to take here? |
@vaamarnath my understanding is that wiki page is non canonical, it is community maintained and non authoratative. The goal of switching to using go modules is to switch away from vendor entirely. I don't see the value in using modules to continue working in a vendor mode |
@davecheney TIL that I should not rely on that wiki page. Thanks for pointing out. Can you point to the best documentation for go modules that I should read upon? Big thanks in advance! |
Honestly I don't know what the canonical manual for modules is; I
guess its `go help mod`. I have complained to the maintainers that the
wiki is non canonical in the past, I hope they address this with
canonical documentation soon.
…On Thu, 21 Mar 2019 at 14:16, Amarnath ***@***.***> wrote:
@davecheney TIL that I should not rely on that wiki page. Thanks for pointing out. Can you point to the best documentation for go modules that I should read upon? Big thanks in advance!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
go mod vendor
.go build
andgo test
, the vendored dependencies areused by setting
GOFLAGS=-mod=vendor
.Fixes #598
Signed-off-by: Amarnath [email protected]