Reviewed-on: #18
This commit is contained in:
parent
3b778a7883
commit
bea90fb621
|
@ -1,13 +1,12 @@
|
||||||
run:
|
run:
|
||||||
tests: true
|
tests: true
|
||||||
|
timeout: 5m
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
enable:
|
enable:
|
||||||
- bodyclose
|
- bodyclose
|
||||||
- deadcode
|
|
||||||
- depguard
|
- depguard
|
||||||
- dupl
|
|
||||||
- errcheck
|
- errcheck
|
||||||
- gocritic
|
- gocritic
|
||||||
- gofmt
|
- gofmt
|
||||||
|
@ -19,19 +18,68 @@ linters:
|
||||||
- nakedret
|
- nakedret
|
||||||
- prealloc
|
- prealloc
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- structcheck
|
|
||||||
- typecheck
|
- typecheck
|
||||||
- unconvert
|
- unconvert
|
||||||
- unused
|
- unused
|
||||||
- varcheck
|
|
||||||
- lll
|
- lll
|
||||||
- nestif
|
- nestif
|
||||||
- thelper
|
- thelper
|
||||||
- nonamedreturns
|
- nonamedreturns
|
||||||
|
- gocyclo
|
||||||
|
- tenv
|
||||||
|
- testpackage
|
||||||
|
- noctx
|
||||||
|
- tparallel
|
||||||
|
- usestdlibvars
|
||||||
|
- unconvert
|
||||||
|
- makezero
|
||||||
|
- grouper
|
||||||
|
- errname
|
||||||
|
- exhaustive
|
||||||
|
- tagliatelle
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
lll:
|
lll:
|
||||||
line-length: 150
|
line-length: 150
|
||||||
|
gocyclo:
|
||||||
|
min-complexity: 10
|
||||||
|
govet:
|
||||||
|
enable:
|
||||||
|
- asmdecl
|
||||||
|
- assign
|
||||||
|
- atomic
|
||||||
|
- atomicalign
|
||||||
|
- bools
|
||||||
|
- buildtag
|
||||||
|
- cgocall
|
||||||
|
- composites
|
||||||
|
- copylocks
|
||||||
|
- deepequalerrors
|
||||||
|
- errorsas
|
||||||
|
- findcall
|
||||||
|
- framepointer
|
||||||
|
- httpresponse
|
||||||
|
- ifaceassert
|
||||||
|
- loopclosure
|
||||||
|
- lostcancel
|
||||||
|
- nilfunc
|
||||||
|
- nilness
|
||||||
|
- printf
|
||||||
|
- reflectvaluecompare
|
||||||
|
- shadow
|
||||||
|
- shift
|
||||||
|
- sigchanyzer
|
||||||
|
- sortslice
|
||||||
|
- stdmethods
|
||||||
|
- stringintconv
|
||||||
|
- structtag
|
||||||
|
- testinggoroutine
|
||||||
|
- tests
|
||||||
|
- unmarshal
|
||||||
|
- unreachable
|
||||||
|
- unsafeptr
|
||||||
|
- unusedresult
|
||||||
|
- unusedwrite
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
exclude-rules:
|
exclude-rules:
|
||||||
|
@ -39,6 +87,7 @@ issues:
|
||||||
- path: _test\.go
|
- path: _test\.go
|
||||||
linters:
|
linters:
|
||||||
- dupl
|
- dupl
|
||||||
|
- gocyclo
|
||||||
- linters:
|
- linters:
|
||||||
- lll
|
- lll
|
||||||
source: "^//go:generate "
|
source: "^//go:generate "
|
||||||
|
|
|
@ -34,11 +34,11 @@ func Encrypt(plaintext, password []byte) ([]byte, error) {
|
||||||
|
|
||||||
binary.BigEndian.PutUint32(iter, uint32(iterations))
|
binary.BigEndian.PutUint32(iter, uint32(iterations))
|
||||||
|
|
||||||
if _, err := rand.Read(iv); err != nil {
|
if _, err = rand.Read(iv); err != nil {
|
||||||
return nil, fmt.Errorf("rand.Read(iv): %w", err)
|
return nil, fmt.Errorf("rand.Read(iv): %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := rand.Read(salt); err != nil {
|
if _, err = rand.Read(salt); err != nil {
|
||||||
return nil, fmt.Errorf("rand.Read(salt): %w", err)
|
return nil, fmt.Errorf("rand.Read(salt): %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ func DecryptAsEntries(text, password []byte) ([]Entry, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var entries []Entry
|
var entries []Entry
|
||||||
if err := json.Unmarshal(result, &entries); err != nil {
|
if err = json.Unmarshal(result, &entries); err != nil {
|
||||||
return nil, fmt.Errorf("json.Unmarshal: %w", err)
|
return nil, fmt.Errorf("json.Unmarshal: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
main.go
2
main.go
|
@ -54,7 +54,7 @@ func newApp() (*cli.App, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
p := tea.NewProgram(internal.NewUI(entries), tea.WithAltScreen())
|
p := tea.NewProgram(internal.NewUI(entries), tea.WithAltScreen())
|
||||||
if err := p.Start(); err != nil {
|
if _, err := p.Run(); err != nil {
|
||||||
return fmt.Errorf("p.Start: %w", err)
|
return fmt.Errorf("p.Start: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue