Skip to content

Commit a278173

Browse files
committed
fix bloom filter
1 parent e28926c commit a278173

31 files changed

+368
-411
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
go: [ '1.21' ]
15+
go: [ '1.22.11' ]
1616
steps:
1717
- uses: actions/checkout@v3
1818

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ coverage.out
1919
bin/
2020
vendor/
2121
build/
22+
23+
.env

.golangci.yml

Lines changed: 60 additions & 227 deletions
Original file line numberDiff line numberDiff line change
@@ -1,179 +1,87 @@
1-
# options for analysis running
2-
run:
3-
# timeout for analysis, e.g. 30s, 5m, default is 1m
4-
deadline: 5m
51

6-
# exit code when at least one issue was found, default is 1
2+
run:
3+
go: "1.22"
4+
concurrency: 4
5+
timeout: 5m
6+
tests: false
77
issues-exit-code: 1
8-
9-
# include test files or not, default is true
10-
tests: true
11-
12-
# which files to skip: they will be analyzed, but issues from them
13-
# won't be reported. Default value is empty list, but there is
14-
# no need to include all autogenerated files, we confidently recognize
15-
# autogenerated files. If it's not please let us know.
16-
skip-files:
17-
- easyjson
8+
modules-download-mode: readonly
189

1910
issues:
20-
# Independently from option 'exclude' we use default exclude patterns,
21-
# it can be disabled by this option. To list all
22-
# excluded by default patterns execute 'golangci-lint run --help'.
23-
# Default value for this option is true.
2411
exclude-use-default: false
25-
# Excluding configuration per-path, per-linter, per-text and per-source
26-
exclude-rules:
27-
# Exclude some linters from running on tests files.
28-
- path: _test\.go
29-
linters:
30-
- prealloc
31-
- errcheck
12+
max-issues-per-linter: 100
13+
max-same-issues: 4
14+
new: false
15+
exclude-files:
16+
- ".+_test.go"
17+
exclude-dirs:
18+
- "vendor$"
3219

33-
# output configuration options
3420
output:
35-
# colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number"
36-
format: colored-line-number
21+
formats:
22+
- format: line-number
23+
sort-results: true
3724

38-
# print lines of code with issue, default is true
39-
print-issued-lines: true
40-
41-
# print linter name in the end of issue text, default is true
42-
print-linter-name: true
43-
44-
# all available settings of specific linters
4525
linters-settings:
4626
govet:
47-
# report about shadowed variables
4827
check-shadowing: true
49-
enable:
50-
# report mismatches between assembly files and Go declarations
51-
- asmdecl
52-
# check for useless assignments
53-
- assign
54-
# check for common mistakes using the sync/atomic package
55-
- atomic
56-
# check for non-64-bits-aligned arguments to sync/atomic functions
57-
- atomicalign
58-
# check for common mistakes involving boolean operators
59-
- bools
60-
# check that +build tags are well-formed and correctly located
61-
- buildtag
62-
# detect some violations of the cgo pointer passing rules
63-
- cgocall
64-
# check for unkeyed composite literals
65-
- composites
66-
# check for locks erroneously passed by value
67-
- copylocks
68-
# check for calls of reflect.DeepEqual on error values
69-
- deepequalerrors
70-
# report passing non-pointer or non-error values to errors.As
71-
- errorsas
72-
# find calls to a particular function
73-
- findcall
74-
# report assembly that clobbers the frame pointer before saving it
75-
- framepointer
76-
# check for mistakes using HTTP responses
77-
- httpresponse
78-
# detect impossible interface-to-interface type assertions
79-
- ifaceassert
80-
# check references to loop variables from within nested functions
81-
- loopclosure
82-
# check cancel func returned by context.WithCancel is called
83-
- lostcancel
84-
# check for useless comparisons between functions and nil
85-
- nilfunc
86-
# check for redundant or impossible nil comparisons
87-
- nilness
88-
# check consistency of Printf format strings and arguments
89-
- printf
90-
# check for comparing reflect.Value values with == or reflect.DeepEqual
91-
- reflectvaluecompare
92-
# check for possible unintended shadowing of variables
93-
- shadow
94-
# check for shifts that equal or exceed the width of the integer
95-
- shift
96-
# check for unbuffered channel of os.Signal
97-
- sigchanyzer
98-
# check the argument type of sort.Slice
99-
- sortslice
100-
# check signature of methods of well-known interfaces
101-
- stdmethods
102-
# check for string(int) conversions
103-
- stringintconv
104-
# check that struct field tags conform to reflect.StructTag.Get
105-
- structtag
106-
# report calls to (*testing.T).Fatal from goroutines started by a test.
107-
- testinggoroutine
108-
# check for common mistaken usages of tests and examples
109-
- tests
110-
# report passing non-pointer or non-interface values to unmarshal
111-
- unmarshal
112-
# check for unreachable code
113-
- unreachable
114-
# check for invalid conversions of uintptr to unsafe.Pointer
115-
- unsafeptr
116-
# check for unused results of calls to some functions
117-
- unusedresult
118-
# checks for unused writes
119-
- unusedwrite
120-
disable:
121-
# find structs that would use less memory if their fields were sorted
122-
- fieldalignment
28+
enable:
29+
- asmdecl
30+
- assign
31+
- atomic
32+
- atomicalign
33+
- bools
34+
- buildtag
35+
- cgocall
36+
- composites
37+
- copylocks
38+
- deepequalerrors
39+
- errorsas
40+
- findcall
41+
- framepointer
42+
- httpresponse
43+
- ifaceassert
44+
- loopclosure
45+
- lostcancel
46+
- nilfunc
47+
- nilness
48+
- printf
49+
- reflectvaluecompare
50+
- shadow
51+
- shift
52+
- sigchanyzer
53+
- sortslice
54+
- stdmethods
55+
- stringintconv
56+
- structtag
57+
- testinggoroutine
58+
- tests
59+
- unmarshal
60+
- unreachable
61+
- unsafeptr
62+
- unusedresult
63+
- unusedwrite
64+
disable:
65+
- fieldalignment
12366
gofmt:
124-
# simplify code: gofmt with '-s' option, true by default
12567
simplify: true
12668
errcheck:
127-
# report about not checking of errors in type assetions: 'a := b.(MyStruct)';
128-
# default is false: such cases aren't reported by default.
12969
check-type-assertions: true
130-
# report about assignment of errors to blank identifier: 'num, _ := strconv.Atoi(numStr)';
131-
# default is false: such cases aren't reported by default.
13270
check-blank: true
13371
gocyclo:
134-
# minimal code complexity to report, 30 by default (but we recommend 10-20)
135-
min-complexity: 15
72+
min-complexity: 30
13673
misspell:
137-
# Correct spellings using locale preferences for US or UK.
138-
# Default is to use a neutral variety of English.
139-
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
14074
locale: US
14175
prealloc:
142-
# XXX: we don't recommend using this linter before doing performance profiling.
143-
# For most programs usage of prealloc will be a premature optimization.
144-
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
145-
# True by default.
14676
simple: true
147-
range-loops: true # Report preallocation suggestions on range loops, true by default
148-
for-loops: true # Report preallocation suggestions on for loops, false by default
77+
range-loops: true
78+
for-loops: true
14979
unparam:
150-
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
151-
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
152-
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
153-
# with golangci-lint call it on a directory with the changed file.
15480
check-exported: false
15581
gci:
156-
# Section configuration to compare against.
157-
# Section names are case-insensitive and may contain parameters in ().
158-
# The default order of sections is 'standard > default > custom > blank > dot',
159-
# If 'custom-order' is 'true', it follows the order of 'sections' option.
160-
# Default: ["standard", "default"]
161-
#sections:
162-
#- standard # Standard section: captures all standard packages.
163-
#- default # Default section: contains all imports that could not be matched to another section type.
164-
#- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
165-
#- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
166-
# Skip generated files.
167-
# Default: true
16882
skip-generated: true
169-
# Enable custom order of sections.
170-
# If 'true', make the section order the same as the order of 'sections'.
171-
# Default: false
17283
custom-order: false
17384
gosec:
174-
# To select a subset of rules to run.
175-
# Available rules: https://github.com/securego/gosec#available-rules
176-
# Default: [] - means include all rules
17785
includes:
17886
- G101 # Look for hard coded credentials
17987
- G102 # Bind to all interfaces
@@ -209,9 +117,6 @@ linters-settings:
209117
- G504 # Import blocklist: net/http/cgi
210118
- G505 # Import blocklist: crypto/sha1
211119
- G601 # Implicit memory aliasing of items from a range statement
212-
# To specify a set of rules to explicitly exclude.
213-
# Available rules: https://github.com/securego/gosec#available-rules
214-
# Default: []
215120
excludes:
216121
- G101 # Look for hard coded credentials
217122
- G102 # Bind to all interfaces
@@ -247,106 +152,35 @@ linters-settings:
247152
- G504 # Import blocklist: net/http/cgi
248153
- G505 # Import blocklist: crypto/sha1
249154
- G601 # Implicit memory aliasing of items from a range statement
250-
# Exclude generated files
251-
# Default: false
252155
exclude-generated: true
253-
# Filter out the issues with a lower severity than the given value.
254-
# Valid options are: low, medium, high.
255-
# Default: low
256156
severity: medium
257-
# Filter out the issues with a lower confidence than the given value.
258-
# Valid options are: low, medium, high.
259-
# Default: low
260157
confidence: medium
261-
# Concurrency value.
262-
# Default: the number of logical CPUs usable by the current process.
263158
concurrency: 12
264-
# To specify the configuration of rules.
265159
config:
266-
# Globals are applicable to all rules.
267160
global:
268-
# If true, ignore #nosec in comments (and an alternative as well).
269-
# Default: false
270161
nosec: true
271-
# Add an alternative comment prefix to #nosec (both will work at the same time).
272-
# Default: ""
273162
"#nosec": "#my-custom-nosec"
274-
# Define whether nosec issues are counted as finding or not.
275-
# Default: false
276163
show-ignored: true
277-
# Audit mode enables addition checks that for normal code analysis might be too nosy.
278-
# Default: false
279164
audit: true
280165
G101:
281-
# Regexp pattern for variables and constants to find.
282-
# Default: "(?i)passwd|pass|password|pwd|secret|token|pw|apiKey|bearer|cred"
283-
pattern: "(?i)example"
284-
# If true, complain about all cases (even with low entropy).
285-
# Default: false
166+
pattern: "(?i)passwd|pass|password|pwd|secret|token|pw|apiKey|bearer|cred"
286167
ignore_entropy: false
287-
# Maximum allowed entropy of the string.
288-
# Default: "80.0"
289168
entropy_threshold: "80.0"
290-
# Maximum allowed value of entropy/string length.
291-
# Is taken into account if entropy >= entropy_threshold/2.
292-
# Default: "3.0"
293169
per_char_threshold: "3.0"
294-
# Calculate entropy for first N chars of the string.
295-
# Default: "16"
296170
truncate: "32"
297-
# Additional functions to ignore while checking unhandled errors.
298-
# Following functions always ignored:
299-
# bytes.Buffer:
300-
# - Write
301-
# - WriteByte
302-
# - WriteRune
303-
# - WriteString
304-
# fmt:
305-
# - Print
306-
# - Printf
307-
# - Println
308-
# - Fprint
309-
# - Fprintf
310-
# - Fprintln
311-
# strings.Builder:
312-
# - Write
313-
# - WriteByte
314-
# - WriteRune
315-
# - WriteString
316-
# io.PipeWriter:
317-
# - CloseWithError
318-
# hash.Hash:
319-
# - Write
320-
# os:
321-
# - Unsetenv
322-
# Default: {}
323171
G104:
324172
fmt:
325173
- Fscanf
326174
G111:
327-
# Regexp pattern to find potential directory traversal.
328-
# Default: "http\\.Dir\\(\"\\/\"\\)|http\\.Dir\\('\\/'\\)"
329-
pattern: "custom\\.Dir\\(\\)"
330-
# Maximum allowed permissions mode for os.Mkdir and os.MkdirAll
331-
# Default: "0750"
175+
pattern: "http\\.Dir\\(\"\\/\"\\)|http\\.Dir\\('\\/'\\)"
332176
G301: "0750"
333-
# Maximum allowed permissions mode for os.OpenFile and os.Chmod
334-
# Default: "0600"
335177
G302: "0600"
336-
# Maximum allowed permissions mode for os.WriteFile and ioutil.WriteFile
337-
# Default: "0600"
338178
G306: "0600"
339179

340180
lll:
341-
# Max line length, lines longer will be reported.
342-
# '\t' is counted as 1 character by default, and can be changed with the tab-width option.
343-
# Default: 120.
344181
line-length: 130
345-
# Tab width in spaces.
346-
# Default: 1
347182
tab-width: 1
348183
staticcheck:
349-
# Deprecated: use the global `run.go` instead.
350184
go: "1.15"
351185
# SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
352186
# Default: ["*"]
@@ -373,7 +207,6 @@ linters:
373207
- errorlint
374208
- bodyclose
375209
- exportloopref
376-
# - gci
377210
- gosec
378-
# - lll
211+
- lll
379212
fast: false

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2019-2024, Mikhail Knyazhev <markus621@yandex.com>
3+
Copyright (c) 2019-2025, Mikhail Knyazhev <markus621@yandex.com>
44

55
Redistribution and use in source and binary forms, with or without
66
modification, are permitted provided that the following conditions are met:

0 commit comments

Comments
 (0)