Skip to content

Commit cfa4682

Browse files
authored
Merge pull request #62 from klauspost/fix-v3-modules-test
Fix v3 broken modules
2 parents 5792172 + 2f0e5e8 commit cfa4682

File tree

5 files changed

+40
-20
lines changed

5 files changed

+40
-20
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
test:
55
strategy:
66
matrix:
7-
go-version: ['1.13', '1.14']
7+
go-version: [1.14.x, 1.15.x, 1.16.x]
88
os: [ubuntu-latest, macos-latest, windows-latest]
99
runs-on: ${{ matrix.os }}
1010
steps:
@@ -13,10 +13,25 @@ jobs:
1313
with:
1414
go-version: ${{ matrix.go-version }}
1515
- name: Checkout code
16-
uses: actions/checkout@master
17-
- name: Get
18-
run: go get -d ./...
19-
- name: Get murmur
20-
run: go get github.com/spaolacci/murmur3
16+
uses: actions/checkout@v2
17+
- name: Vet
18+
run: go vet ./...
2119
- name: Test
2220
run: go test ./...
21+
22+
single-ver:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Set up Go
26+
uses: actions/setup-go@v2
27+
with:
28+
go-version: 1.16.x
29+
30+
- name: Checkout code
31+
uses: actions/checkout@v2
32+
33+
- name: fmt
34+
run: diff <(gofmt -s -d .) <(printf "")
35+
36+
- name: Test 386
37+
run: GOOS=linux GOARCH=386 go test ./...

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
Bloom filters
22
-------------
3-
[![Test](https://github.com/bits-and-blooms/bloom/workflows/Test/badge.svg)](https://github.com/bits-and-blooms/bloom/actions?query=workflow%3ATest)
4-
[![Coverage Status](https://coveralls.io/repos/github/willf/bloom/badge.svg?branch=master)](https://coveralls.io/github/willf/bloom?branch=master)
5-
[![Go Report Card](https://goreportcard.com/badge/github.com/willf/bloom)](https://goreportcard.com/report/github.com/willf/bloom)
6-
[![GoDoc](https://godoc.org/github.com/bits-and-blooms/bloom?status.svg)](http://godoc.org/github.com/bits-and-blooms/bloom)
3+
[![Test](https://github.com/bits-and-blooms/bloom/actions/workflows/test.yml/badge.svg)](https://github.com/bits-and-blooms/bloom/actions/workflows/test.yml)
4+
[![Go Report Card](https://goreportcard.com/badge/github.com/bits-and-blooms/bloom)](https://goreportcard.com/report/github.com/bits-and-blooms/bloom)
5+
[![Go Reference](https://pkg.go.dev/badge/github.com/bits-and-blooms/bloom.svg)](https://pkg.go.dev/github.com/bits-and-blooms/bloom)
76

87
A Bloom filter is a concise/compressed representation of a set, where the main
98
requirement is to make membership queries; _i.e._, whether an item is a
@@ -50,19 +49,19 @@ For numerical data, we recommend that you look into the encoding/binary library.
5049

5150
Discussion here: [Bloom filter](https://groups.google.com/d/topic/golang-nuts/6MktecKi1bE/discussion)
5251

53-
Godoc documentation: https://godoc.org/github.com/bits-and-blooms/bloom
52+
Godoc documentation: https://pkg.go.dev/github.com/bits-and-blooms/bloom
5453

5554
## Installation
5655

5756
```bash
58-
go get -u github.com/bits-and-blooms/bloom
57+
go get -u github.com/bits-and-blooms/bloom/v3
5958
```
6059

6160
## Contributing
6261

6362
If you wish to contribute to this project, please branch and issue a pull request against master ("[GitHub Flow](https://guides.github.com/introduction/flow/)")
6463

65-
This project include a Makefile that allows you to test and build the project with simple commands.
64+
This project includes a Makefile that allows you to test and build the project with simple commands.
6665
To see all available options:
6766
```bash
6867
make help
@@ -78,9 +77,9 @@ make qa
7877

7978
## Design
8079

81-
A Bloom filter has two parameters: _m_, the number of bits used in storage, and _k_, the number of hashing functions on elements of the set. (The actual hashing functions are important, too, but this is not a parameter for this implementation). A Bloom filter is backed by a [BitSet](https://github.com/willf/bitset); a key is represented in the filter by setting the bits at each value of the hashing functions (modulo _m_). Set membership is done by _testing_ whether the bits at each value of the hashing functions (again, modulo _m_) are set. If so, the item is in the set. If the item is actually in the set, a Bloom filter will never fail (the true positive rate is 1.0); but it is susceptible to false positives. The art is to choose _k_ and _m_ correctly.
80+
A Bloom filter has two parameters: _m_, the number of bits used in storage, and _k_, the number of hashing functions on elements of the set. (The actual hashing functions are important, too, but this is not a parameter for this implementation). A Bloom filter is backed by a [BitSet](https://github.com/bits-and-blooms/bitset); a key is represented in the filter by setting the bits at each value of the hashing functions (modulo _m_). Set membership is done by _testing_ whether the bits at each value of the hashing functions (again, modulo _m_) are set. If so, the item is in the set. If the item is actually in the set, a Bloom filter will never fail (the true positive rate is 1.0); but it is susceptible to false positives. The art is to choose _k_ and _m_ correctly.
8281

83-
In this implementation, the hashing functions used is [murmurhash](github.com/spaolacci/murmur3), a non-cryptographic hashing function.
82+
In this implementation, the hashing functions used is [murmurhash](https://github.com/spaolacci/murmur3), a non-cryptographic hashing function.
8483

8584

8685
Given the particular hashing scheme, it's best to be empirical about this. Note

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/bits-and-blooms/bloom
1+
module github.com/bits-and-blooms/bloom/v3
22

33
go 1.14
44

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/bits-and-blooms/bitset v1.2.0 h1:Kn4yilvwNtMACtf1eYDlG8H77R07mZSPbMjLyS07ChA=
2+
github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
3+
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
4+
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=

murmur_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package bloom
22

33
import (
4-
"github.com/spaolacci/murmur3"
54
"math/rand"
65
"testing"
6+
7+
"github.com/spaolacci/murmur3"
78
)
89

910
// We want to preserve backward compatibility
@@ -31,9 +32,10 @@ func TestHashBasic(t *testing.T) {
3132
}
3233

3334
func TestDocumentation(t *testing.T) {
34-
filter := NewWithEstimates(1000, 0.01)
35-
if filter.EstimateFalsePositiveRate(1000) > 0.0101 {
36-
t.Errorf("Bad false positive rate")
35+
filter := NewWithEstimates(10000, 0.01)
36+
got := filter.EstimateFalsePositiveRate(10000)
37+
if got > 0.011 || got < 0.009 {
38+
t.Errorf("Bad false positive rate %v", got)
3739
}
3840
}
3941

0 commit comments

Comments
 (0)