diff --git a/.golangci.yml b/.golangci.yml index 9702cb9..8705eb7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,7 +8,6 @@ run: linters: enable: - 'asciicheck' - - 'deadcode' - 'depguard' - 'dogsled' - 'errorlint' @@ -29,7 +28,6 @@ linters: - 'revive' - 'typecheck' - 'unconvert' - - 'varcheck' - 'whitespace' disable: # unsupported lint with golang 1.18+ ref: https://github.com/golangci/golangci-lint/issues/2649 @@ -42,6 +40,8 @@ linters: - 'stylecheck' - 'unused' - 'errcheck' + - 'deadcode' + - 'varcheck' issues: exclude-use-default: false @@ -60,10 +60,8 @@ issues: - G502 - G505 exclude-rules: - - path: internal/browser/browser\.go + - path: internal/provider/provider\.go linters: - - 'deadcode' - - 'varcheck' - 'unused' max-issues-per-linter: 0 max-same-issues: 0 diff --git a/internal/browser/chromium/chromium.go b/internal/provider/chromium/chromium.go similarity index 100% rename from internal/browser/chromium/chromium.go rename to internal/provider/chromium/chromium.go diff --git a/internal/browser/chromium/chromium_darwin.go b/internal/provider/chromium/chromium_darwin.go similarity index 100% rename from internal/browser/chromium/chromium_darwin.go rename to internal/provider/chromium/chromium_darwin.go diff --git a/internal/browser/chromium/chromium_linux.go b/internal/provider/chromium/chromium_linux.go similarity index 100% rename from internal/browser/chromium/chromium_linux.go rename to internal/provider/chromium/chromium_linux.go diff --git a/internal/browser/chromium/chromium_windows.go b/internal/provider/chromium/chromium_windows.go similarity index 100% rename from internal/browser/chromium/chromium_windows.go rename to internal/provider/chromium/chromium_windows.go diff --git a/internal/browser/firefox/firefox.go b/internal/provider/firefox/firefox.go similarity index 100% rename from internal/browser/firefox/firefox.go rename to internal/provider/firefox/firefox.go diff --git a/internal/browser/browser.go b/internal/provider/provider.go similarity index 83% rename from internal/browser/browser.go rename to internal/provider/provider.go index a3476e9..cc5b46e 100644 --- a/internal/browser/browser.go +++ b/internal/provider/provider.go @@ -1,4 +1,4 @@ -package browser +package provider import ( "os" @@ -6,23 +6,16 @@ import ( "sort" "strings" - "hack-browser-data/internal/browingdata" - "hack-browser-data/internal/browser/chromium" - "hack-browser-data/internal/browser/firefox" + "hack-browser-data/internal/browser" "hack-browser-data/internal/log" + "hack-browser-data/internal/provider/chromium" + "hack-browser-data/internal/provider/firefox" "hack-browser-data/internal/utils/fileutil" "hack-browser-data/internal/utils/typeutil" ) -type Browser interface { - // Name is browser's name - Name() string - // BrowsingData returns all browsing data in the browser. - BrowsingData() (*browingdata.Data, error) -} - -func PickBrowser(name, profile string) ([]Browser, error) { - var browsers []Browser +func PickBrowsers(name, profile string) ([]browser.Browser, error) { + var browsers []browser.Browser clist := pickChromium(name, profile) for _, b := range clist { if b != nil { @@ -38,8 +31,8 @@ func PickBrowser(name, profile string) ([]Browser, error) { return browsers, nil } -func pickChromium(name, profile string) []Browser { - var browsers []Browser +func pickChromium(name, profile string) []browser.Browser { + var browsers []browser.Browser name = strings.ToLower(name) if name == "all" { for _, v := range chromiumList { @@ -77,8 +70,8 @@ func pickChromium(name, profile string) []Browser { return browsers } -func pickFirefox(name, profile string) []Browser { - var browsers []Browser +func pickFirefox(name, profile string) []browser.Browser { + var browsers []browser.Browser name = strings.ToLower(name) if name == "all" || name == "firefox" { for _, v := range firefoxList { diff --git a/internal/browser/browser_darwin.go b/internal/provider/provider_darwin.go similarity index 99% rename from internal/browser/browser_darwin.go rename to internal/provider/provider_darwin.go index 55b0ba8..6356436 100644 --- a/internal/browser/browser_darwin.go +++ b/internal/provider/provider_darwin.go @@ -1,6 +1,6 @@ //go:build darwin -package browser +package provider import ( "hack-browser-data/internal/item" diff --git a/internal/browser/browser_linux.go b/internal/provider/provider_linux.go similarity index 99% rename from internal/browser/browser_linux.go rename to internal/provider/provider_linux.go index 08ca83f..3f4a3cc 100644 --- a/internal/browser/browser_linux.go +++ b/internal/provider/provider_linux.go @@ -1,6 +1,6 @@ //go:build linux -package browser +package provider import ( "hack-browser-data/internal/item" diff --git a/internal/browser/browser_windows.go b/internal/provider/provider_windows.go similarity index 99% rename from internal/browser/browser_windows.go rename to internal/provider/provider_windows.go index b4c964d..adb3507 100644 --- a/internal/browser/browser_windows.go +++ b/internal/provider/provider_windows.go @@ -1,6 +1,6 @@ //go:build windows -package browser +package provider import ( "hack-browser-data/internal/item"