fix(blogo,prefixedsourcer): remove unused hex function
This commit is contained in:
@@ -16,8 +16,6 @@
|
||||
package blogo
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
@@ -40,12 +38,9 @@ type prefixedSourcer struct {
|
||||
acceptDuplicated bool
|
||||
|
||||
panicOnInit bool
|
||||
skipOnHexError bool
|
||||
skipOnSourceError bool
|
||||
skipOnFSError bool
|
||||
|
||||
hexFunc HexFunc
|
||||
|
||||
log *slog.Logger
|
||||
}
|
||||
|
||||
@@ -58,21 +53,9 @@ type PrefixedSourcerOpts struct {
|
||||
NotSkipOnSourceError bool
|
||||
NotSkipOnFSError bool
|
||||
|
||||
HexFunc HexFunc
|
||||
|
||||
Logger *slog.Logger
|
||||
}
|
||||
|
||||
type HexFunc = func(n int) (string, error)
|
||||
|
||||
func hexFunc(n int) (string, error) {
|
||||
bytes := make([]byte, n)
|
||||
if _, err := rand.Read(bytes); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return hex.EncodeToString(bytes), nil
|
||||
}
|
||||
|
||||
func NewPrefixedSourcer(opts ...PrefixedSourcerOpts) PrefixedSourcer {
|
||||
opt := PrefixedSourcerOpts{}
|
||||
if len(opts) > 0 {
|
||||
@@ -83,10 +66,6 @@ func NewPrefixedSourcer(opts ...PrefixedSourcerOpts) PrefixedSourcer {
|
||||
opt.PrefixSeparator = "/"
|
||||
}
|
||||
|
||||
if opt.HexFunc == nil {
|
||||
opt.HexFunc = hexFunc
|
||||
}
|
||||
|
||||
if opt.Logger == nil {
|
||||
opt.Logger = slog.New(slog.NewTextHandler(io.Discard, &slog.HandlerOptions{}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user