Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

panic: runtime error: invalid memory address or nil pointer dereference when running go test with no network access #798

Open
@rathann

Description

@rathann

The use case is running the test suite as part of Fedora package build process, but the build server(s) have no network access.

Trying to run the test suite (DNS lookups fail) results in some test failures (skipped, I patched them out) and one segmentation violation:

GOPATH=/builddir/build/BUILD/go-git-4.2.0/_build:/usr/share/gocode go test -buildmode pie -compiler gc -ldflags '-extldflags '\''-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '\'''
OK: 188 passed
--- FAIL: ExampleClone (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x55cdd1fad335]

goroutine 1 [running]:
testing.runExample.func2(0xbea8f9f7942b4ce7, 0x795ad3f90, 0x55cdd2b3f840, 0xc42000f470, 0xc4200a8008, 0xc4238e1ce0, 0x55cdd244dbea, 0xc, 0x55cdd2871850, 0x55cdd24516c6, ...)
	/usr/lib/golang/src/testing/example.go:117 +0x709
panic(0x55cdd27cb5e0, 0x55cdd2aecdd0)
	/usr/lib/golang/src/runtime/panic.go:505 +0x22d
io.copyBuffer(0x55cdd28761a0, 0xc42000f470, 0x0, 0x0, 0xc420754000, 0x8000, 0x8000, 0x55cdd2875460, 0xc42009a140, 0xc422dba870)
	/usr/lib/golang/src/io/io.go:400 +0x145
io.Copy(0x55cdd28761a0, 0xc42000f470, 0x0, 0x0, 0x0, 0x55cdd2875460, 0xc42009a140)
	/usr/lib/golang/src/io/io.go:362 +0x5c
gopkg.in/src-d/go-git%2ev4_test.ExampleClone()
	/builddir/build/BUILD/go-git-4.2.0/_build/src/gopkg.in/src-d/go-git.v4/example_test.go:34 +0x256
testing.runExample(0x55cdd244dbea, 0xc, 0x55cdd2871850, 0x55cdd24516c6, 0x12, 0x0, 0x0)
	/usr/lib/golang/src/testing/example.go:122 +0x1fb
testing.runExamples(0xc423151ee0, 0x55cdd2af3c00, 0x2, 0x2, 0x55cdd1f50101)
	/usr/lib/golang/src/testing/example.go:46 +0x15d
testing.(*M).Run(0xc420110600, 0x0)
	/usr/lib/golang/src/testing/testing.go:979 +0x1ed
main.main()
	_testmain.go:48 +0x153
exit status 2
FAIL	gopkg.in/src-d/go-git.v4	32.596s

It'd be nice if I could have a simple way to exclude tests requiring network access.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions