This PR addes a LookupNetwork method. This behaves similarly to Lookup except that it returns the network associated with the record in the database and an ok boolean indicating whether a record was found or not.
This also includes some minor cleanup and adds golangci-lint to Travis.
Benchmarks from the branch:
$ go test -bench=. -benchmem -benchtime=20s
goos: linux
goarch: amd64
pkg: github.com/oschwald/maxminddb-golang
BenchmarkLookup-8 2000000 16109 ns/op 5360 B/op 205 allocs/op
BenchmarkLookupNetwork-8 2000000 17076 ns/op 5417 B/op 208 allocs/op
BenchmarkCountryCode-8 20000000 1222 ns/op 1 B/op 0 allocs/op
PASS
ok github.com/oschwald/maxminddb-golang 125.193s
Benchmarks of master + the err handling change:
$ go test -bench=. -benchmem -benchtime=20s
goos: linux
goarch: amd64
pkg: github.com/oschwald/maxminddb-golang
BenchmarkMaxMindDB-8 2000000 16281 ns/op 5361 B/op 205 allocs/op
BenchmarkCountryCode-8 20000000 1221 ns/op 1 B/op 0 allocs/op
PASS
ok github.com/oschwald/maxminddb-golang 75.826s
Closes #36 and #41.
This PR addes a
LookupNetwork
method. This behaves similarly toLookup
except that it returns the network associated with the record in the database and an ok boolean indicating whether a record was found or not.This also includes some minor cleanup and adds
golangci-lint
to Travis.Benchmarks from the branch:
Benchmarks of master + the
err
handling change: