Search Gear #11- Testing and Coverage!

Thanks @rob_pike for sorting me out on cover and style.

Rule for today run ‘go fmt’ to get that go code nice and formatted to standard style conventions!

go-imports tool

go test -v
go test -cover
go test -coverprofile=coverage.out
go tool cover -func=cover.out
go tool cover -html=coverage.out

~Oh you are joking!
Simon-Harpers-iMac:searchgear sharper$ go test -cover


cover: internal error: block 3 overlaps block 4
/Users/sharper/Development/go/src/,#1345 /Users/sharper/Development/go/src/,#1842
coverage: 100.0% of statements
ok 0.013s

Tweet: #golang crew any ideas re test-cover error ‘cover: internal error: block 3 overlaps block 4’ before I stackoverflow it? Much Appreciated

@sharpic Please send me a minimal repro via a playground link if possible. There are a couple of tricky cases in the block discovery code.

Hi @rob_pike not sure how to make repo but there are just two files including one for testing

@sharpic Thanks. Here’s a full repro example.
Never shown up because we run gofmt – problem is no spaces on else.

Issue 8557: confused by else without spaces

Rob Pike ‏@rob_pike 11h
@sharpic Also: Don’t use “this” and run go fmt but anyway: *this = twitter{} will clear your struct.

So constructive comments already!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s