From cb782aa3037b854b06cb070b30b9163742f1d46f Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 9 Nov 2015 23:05:52 +1100 Subject: [PATCH] internal/cmd/bloom-false-positives: Switch to tagflag Was looking at using github.com/tylertreat/BoomFilters instead of github.com/willf/bloom --- internal/cmd/bloom-false-positives/main.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/cmd/bloom-false-positives/main.go b/internal/cmd/bloom-false-positives/main.go index 0b94480a..456e2106 100644 --- a/internal/cmd/bloom-false-positives/main.go +++ b/internal/cmd/bloom-false-positives/main.go @@ -2,18 +2,20 @@ package main import ( "bufio" - "flag" "fmt" "os" + "github.com/anacrolix/tagflag" "github.com/willf/bloom" ) func main() { - m := flag.Uint("m", 0, "") - k := flag.Uint("k", 0, "") - flag.Parse() - filter := bloom.New(*m, *k) + var args struct { + M uint `help:"num bits"` + K uint `help:"num hashing functions"` + } + tagflag.Parse(&args, tagflag.Description("adds lines from stdin to a bloom filter with the given configuration, and gives collision stats at EOF")) + filter := bloom.New(args.M, args.K) scanner := bufio.NewScanner(os.Stdin) n := 0 collisions := 0 -- 2.48.1