diff --git a/.golangci.yml b/.golangci.yml index 0d848ef..ec327a2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -60,9 +60,15 @@ issues: - G502 - G505 exclude-rules: - - path: browser/browser\.go + - path: _test\.go linters: - - 'unused' + - gocyclo + - errcheck + - dupl + - gosec + - unparam + - staticcheck + - paralleltest max-issues-per-linter: 0 max-same-issues: 0 diff --git a/browser.go b/browser.go index 2836e9e..af842ee 100644 --- a/browser.go +++ b/browser.go @@ -39,7 +39,7 @@ func (c *chromium) AllBrowsingData() ([]BrowserData, error) { return nil, nil } -func (f *firefox) BrowsingData(items []browserDataType) (BrowserData, error) { +func (f *firefox) BrowsingData(_ []browserDataType) (BrowserData, error) { return nil, nil } @@ -68,19 +68,17 @@ func (b browser) Type() browserType { } } -var ( - browsers = map[browser]Browser{ - Chrome: &chromium{ - name: Chrome, - storage: chromeStorageName, - profilePath: chromeProfilePath, - supportedData: []browserDataType{TypePassword}, - }, - Firefox: &firefox{ - name: "", - storage: "", - profilePath: "", - }, - Yandex: &chromium{}, - } -) +var browsers = map[browser]Browser{ + Chrome: &chromium{ + name: Chrome, + storage: chromeStorageName, + profilePath: chromeProfilePath, + supportedData: []browserDataType{TypePassword}, + }, + Firefox: &firefox{ + name: "", + storage: "", + profilePath: "", + }, + Yandex: &chromium{}, +} diff --git a/chromium.go b/chromium.go index 27dee5c..37aa5ca 100644 --- a/chromium.go +++ b/chromium.go @@ -33,10 +33,7 @@ func (c *chromium) Init() error { if err := c.initProfile(); err != nil { return fmt.Errorf("profile path '%s' does not exist %w", c.profilePath, ErrBrowserNotExists) } - if err := c.initMasterKey(); err != nil { - return err - } - return nil + return c.initMasterKey() } func (c *chromium) initBrowserData() error { @@ -94,9 +91,7 @@ func (c *chromium) findAllProfiles() ([]string, error) { } func (c *chromium) initMasterKey() error { - var ( - stdout, stderr bytes.Buffer - ) + var stdout, stderr bytes.Buffer args := []string{"find-generic-password", "-wa", strings.TrimSpace(c.storage)} cmd := exec.Command("security", args...) //nolint:gosec cmd.Stdout = &stdout diff --git a/chromium_test.go b/chromium_test.go index 622b376..8084613 100644 --- a/chromium_test.go +++ b/chromium_test.go @@ -4,8 +4,7 @@ import ( "testing" ) -func TestChromium_Init(t *testing.T) { - +func TestChromium_Init(_ *testing.T) { } func BenchmarkChromium_Init(b *testing.B) { diff --git a/consts.go b/consts.go index 94a5fd4..0322e98 100644 --- a/consts.go +++ b/consts.go @@ -17,9 +17,7 @@ const ( arcStorageName = "Arc" ) -var ( - homeDir, _ = os.UserHomeDir() -) +var homeDir, _ = os.UserHomeDir() var ( chromeProfilePath = homeDir + "/Library/Application Support/Google/Chrome/Default/"