From f7d0ed5185290b60973dae3d6f9cac123bb26547 Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Wed, 15 Mar 2023 15:19:24 +0800 Subject: [PATCH] bbolt: remove `CheckWithOptions` and add variadic parameter options to method Check Signed-off-by: Benjamin Wang --- cmd/bbolt/main.go | 2 +- tx_check.go | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cmd/bbolt/main.go b/cmd/bbolt/main.go index ead1d0d..e6b4780 100644 --- a/cmd/bbolt/main.go +++ b/cmd/bbolt/main.go @@ -206,7 +206,7 @@ func (cmd *checkCommand) Run(args ...string) error { // Perform consistency check. return db.View(func(tx *bolt.Tx) error { var count int - for err := range tx.CheckWithOptions(bolt.WithKVStringer(CmdKvStringer())) { + for err := range tx.Check(bolt.WithKVStringer(CmdKvStringer())) { fmt.Fprintln(cmd.Stdout, err) count++ } diff --git a/tx_check.go b/tx_check.go index ee72cda..cc08013 100644 --- a/tx_check.go +++ b/tx_check.go @@ -15,13 +15,10 @@ import ( // because of caching. This overhead can be removed if running on a read-only // transaction, however, it is not safe to execute other writer transactions at // the same time. -func (tx *Tx) Check() <-chan error { - return tx.CheckWithOptions() -} - -// CheckWithOptions allows users to provide a customized `KVStringer` implementation, +// +// It also allows users to provide a customized `KVStringer` implementation, // so that bolt can generate human-readable diagnostic messages. -func (tx *Tx) CheckWithOptions(options ...CheckOption) <-chan error { +func (tx *Tx) Check(options ...CheckOption) <-chan error { chkConfig := checkConfig{ kvStringer: HexKVStringer(), }