Skip to content

Commit

Permalink
lint.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhadfield committed Jun 24, 2020
1 parent 903060c commit da75b50
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 17 deletions.
2 changes: 2 additions & 0 deletions cmd/sncli/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ func TestAddOneNoteGetCount(t *testing.T) {
"--text", "testAddOneNoteGetCount Text"})
assert.NoError(t, err)
assert.Contains(t, msg, msgAddSuccess)

_, _, err = startCLI([]string{"sncli", "get", "note"})
assert.NoError(t, err)

msg, _, err = startCLI([]string{"sncli", "get", "note", "--count"})
assert.NoError(t, err)
assert.Equal(t, "1", msg)
Expand Down
2 changes: 1 addition & 1 deletion cmd/sncli/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func processDeleteTags(c *cli.Context, opts configOptsOutput) (msg string, err e
uuidIn := strings.Replace(c.String("uuid"), " ", "", -1)

if titleIn == "" && uuidIn == "" {
cli.ShowSubcommandHelp(c)
_ = cli.ShowSubcommandHelp(c)
return msg, errors.New("title or uuid required")
}

Expand Down
15 changes: 10 additions & 5 deletions export.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package sncli

import (
"fmt"

"github.com/asdine/storm/v3/q"
"github.com/jonhadfield/gosn-v2"
gosn "github.com/jonhadfield/gosn-v2"
"github.com/jonhadfield/gosn-v2/cache"
)

Expand All @@ -14,9 +15,9 @@ type ExportConfig struct {
}

type ImportConfig struct {
Session cache.Session
File string
Debug bool
Session cache.Session
File string
Debug bool
}

func (i *ExportConfig) Run() error {
Expand All @@ -30,7 +31,10 @@ func (i *ExportConfig) Run() error {
if err != nil {
return err
}
defer gio.DB.Close()

defer func() {
_ = gio.DB.Close()
}()

// DB now populated and open with pointer in session
// strip deleted items
Expand All @@ -56,6 +60,7 @@ func (i *ExportConfig) Run() error {
}

var e gosn.EncryptedItems

e, err = out.Encrypt(i.Session.Mk, i.Session.Ak, i.Debug)
if err != nil {
return err
Expand Down
7 changes: 4 additions & 3 deletions export_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package sncli

import (
"github.com/jonhadfield/gosn-v2"
"github.com/jonhadfield/gosn-v2/cache"
"github.com/stretchr/testify/assert"
"io/ioutil"
"log"
"os"
"path/filepath"
"testing"

gosn "github.com/jonhadfield/gosn-v2"
"github.com/jonhadfield/gosn-v2/cache"
"github.com/stretchr/testify/assert"
)

func TestExportOneNote(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package sncli

import (
"github.com/jonhadfield/gosn-v2"
"github.com/jonhadfield/gosn-v2/cache"
"time"

gosn "github.com/jonhadfield/gosn-v2"
"github.com/jonhadfield/gosn-v2/cache"
)

const (
Expand Down
1 change: 1 addition & 0 deletions note.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func addNote(input addNoteInput) (noteUUID string, err error) {
if err != nil {
return
}

defer func() {
_ = so.DB.Close()
}()
Expand Down
5 changes: 3 additions & 2 deletions sync.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package sncli

import (
"github.com/briandowns/spinner"
"github.com/jonhadfield/gosn-v2/cache"
"os"
"time"

"github.com/briandowns/spinner"
"github.com/jonhadfield/gosn-v2/cache"
)

func Sync(si cache.SyncInput, showProgress bool) (so cache.SyncOutput, err error) {
Expand Down
5 changes: 3 additions & 2 deletions tag.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package sncli

import (
"github.com/jonhadfield/gosn-v2"
"github.com/jonhadfield/gosn-v2/cache"
"strings"

gosn "github.com/jonhadfield/gosn-v2"
"github.com/jonhadfield/gosn-v2/cache"
)

type tagNotesInput struct {
Expand Down
4 changes: 2 additions & 2 deletions test_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package sncli

import (
"fmt"
"github.com/jonhadfield/gosn-v2/cache"
"math/rand"
"strings"
"time"

"github.com/jonhadfield/gosn-v2"
gosn "github.com/jonhadfield/gosn-v2"
"github.com/jonhadfield/gosn-v2/cache"
)

var testParas = []string{
Expand Down

0 comments on commit da75b50

Please sign in to comment.