What version of Go are you using (go version
)?
C:\dev\src\github.com\dgraph-io\badger>go version
go version go1.15.6 windows/amd64
What operating system are you using?
C:\dev\src\github.com\dgraph-io\badger>ver
Microsoft Windows [Version 10.0.19041.685]
What version of Badger are you using?
C:\dev\src\github.com\dgraph-io\badger>git log -n 1 --oneline
d4217bc (HEAD -> master, origin/master, origin/HEAD) opt(DropPrefix): check if there exist some data to drop before dropping prefixes (#1621)
Does this issue reproduce with the latest master?
Yes
Steps to Reproduce the issue
Running badger test with -race option and CGO disabled:
- Fails as expected with CGO enabled, but no gcc installed:
C:\dev\src\github.com\dgraph-io\badger>go env CGO_ENABLED
1
C:\dev\src\github.com\dgraph-io\badger>go env CC
gcc
C:\dev\src\github.com\dgraph-io\badger>gcc
'gcc' is not recognized as an internal or external command,
operable program or batch file.
C:\dev\src\github.com\dgraph-io\badger>go test -v --test.run=TestMismatch
# runtime/cgo
exec: "gcc": executable file not found in %PATH%
FAIL github.com/dgraph-io/badger/v2 [build failed]
- Works as expected with CGO disabled:
C:\dev\src\github.com\dgraph-io\badger>set CGO_ENABLED=0
C:\dev\src\github.com\dgraph-io\badger>go env CGO_ENABLED
0
C:\dev\src\github.com\dgraph-io\badger>go test -v --test.run=TestMismatch
=== RUN TestMismatch
--- PASS: TestMismatch (0.02s)
PASS
ok github.com/dgraph-io/badger/v2 0.236s
- Problem is when running with -race option:
C:\dev\src\github.com\dgraph-io\badger>go test -v --test.run=TestMismatch -race
go test: -race requires cgo; enable cgo by setting CGO_ENABLED=1
I don’t want zstd compression, but want cgo enabled to run race tests on my project that includes badger.
To confirm that gcc is not needed for -race, tested with a small project from github. Same as above, cgo is enabled, gcc is not installed, run test with -race option, and runs fine without needing gcc:
C:\dev\src\github.com\im7mortal>git clone https://github.com/im7mortal/kmutex.git
Cloning into 'kmutex'...
remote: Enumerating objects: 77, done.
remote: Total 77 (delta 0), reused 0 (delta 0), pack-reused 77
Receiving objects: 100% (77/77), 22.95 KiB | 258.00 KiB/s, done.
Resolving deltas: 100% (37/37), done.
C:\dev\src\github.com\im7mortal>cd kmutex
C:\dev\src\github.com\im7mortal\kmutex>go mod init github.com/im7mortal/kmutex
go: creating new go.mod: module github.com/im7mortal/kmutex
C:\dev\src\github.com\im7mortal\kmutex>go env CGO_ENABLED
1
C:\dev\src\github.com\im7mortal\kmutex>go env CC
gcc
C:\dev\src\github.com\im7mortal\kmutex>gcc
'gcc' is not recognized as an internal or external command,
operable program or batch file.
C:\dev\src\github.com\im7mortal\kmutex>go test -race
PASS
ok github.com/im7mortal/kmutex 2.640s
What Badger options were set?
No changes to repo, using badger master branch as is.
What did you do?
Ran the tests.
What did you expect to see?
Test to pass.
=== RUN TestMismatch
--- PASS: TestMismatch (0.02s)
PASS
ok github.com/dgraph-io/badger/v2 0.236s
What did you see instead?
C:\dev\src\github.com\dgraph-io\badger>go test -v --test.run=TestMismatch -race
go test: -race requires cgo; enable cgo by setting CGO_ENABLED=1