diff --git a/log/log.go b/log/log.go index a89e32d..14f522c 100644 --- a/log/log.go +++ b/log/log.go @@ -4,10 +4,8 @@ import ( "github.com/moond4rk/hackbrowserdata/log/level" ) -var ( - // defaultLogger is the default logger used by the package-level functions. - defaultLogger = NewLogger(nil) -) +// defaultLogger is the default logger used by the package-level functions. +var defaultLogger = NewLogger(nil) func SetVerbose() { defaultLogger.SetLevel(level.DebugLevel) diff --git a/log/logger.go b/log/logger.go index 8e7243d..a006208 100644 --- a/log/logger.go +++ b/log/logger.go @@ -136,7 +136,7 @@ func (l *baseLogger) prefixPrint(prefix string, args ...any) { } func (l *baseLogger) getCallDepth() int { - var defaultCallDepth = 2 + defaultCallDepth := 2 pcs := make([]uintptr, 10) n := runtime.Callers(defaultCallDepth, pcs) frames := runtime.CallersFrames(pcs[:n]) diff --git a/log/logger_test.go b/log/logger_test.go index 65e2cd1..9fa8a85 100644 --- a/log/logger_test.go +++ b/log/logger_test.go @@ -22,20 +22,18 @@ type baseTestCase struct { wantedPattern string } -var ( - baseTestCases = []baseTestCase{ - { - description: "without trailing newline, logger adds newline", - message: "hello, hacker!", - suffix: "", - }, - { - description: "with trailing newline, logger preserves newline", - message: "hello, hacker!", - suffix: "\n", - }, - } -) +var baseTestCases = []baseTestCase{ + { + description: "without trailing newline, logger adds newline", + message: "hello, hacker!", + suffix: "", + }, + { + description: "with trailing newline, logger preserves newline", + message: "hello, hacker!", + suffix: "\n", + }, +} func TestLoggerDebug(t *testing.T) { for _, tc := range baseTestCases { @@ -121,25 +119,23 @@ type formatTestCase struct { wantedPattern string } -var ( - formatTestCases = []formatTestCase{ - { - description: "message with format prefix", - format: "hello, %s!", - args: []any{"Hacker"}, - }, - { - description: "message with format prefix", - format: "hello, %d,%d,%d!", - args: []any{1, 2, 3}, - }, - { - description: "message with format prefix", - format: "hello, %s,%d,%d!", - args: []any{"Hacker", 2, 3}, - }, - } -) +var formatTestCases = []formatTestCase{ + { + description: "message with format prefix", + format: "hello, %s!", + args: []any{"Hacker"}, + }, + { + description: "message with format prefix", + format: "hello, %d,%d,%d!", + args: []any{1, 2, 3}, + }, + { + description: "message with format prefix", + format: "hello, %s,%d,%d!", + args: []any{"Hacker", 2, 3}, + }, +} func TestLoggerDebugf(t *testing.T) { for _, tc := range formatTestCases { diff --git a/profile/finder.go b/profile/finder.go index 70a8f9d..251e48e 100644 --- a/profile/finder.go +++ b/profile/finder.go @@ -41,9 +41,7 @@ func (m *Finder) FindProfiles(rootPath string, browserType types2.BrowserType, d return profiles, nil } -var ( - defaultExcludeDirs = []string{"Snapshot", "System Profile", "Crash Reports", "def"} -) +var defaultExcludeDirs = []string{"Snapshot", "System Profile", "Crash Reports", "def"} func (m *Finder) findChromiumProfiles(rootPath string, browserType types2.BrowserType, dataTypes []types2.DataType) (Profiles, error) { profiles := NewProfiles() diff --git a/profile/finder_test.go b/profile/finder_test.go index 06b2d1b..a8be06c 100644 --- a/profile/finder_test.go +++ b/profile/finder_test.go @@ -138,5 +138,4 @@ func Test_extractProfileNameFromPath(t *testing.T) { } }) } - }