Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.

Commit 31a737e

Browse files
committed
fix: lint
1 parent 904a846 commit 31a737e

16 files changed

Lines changed: 59 additions & 34 deletions

File tree

.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ linters:
2323
- goimports
2424
- goprintffuncname
2525
- gosec
26-
- ifshort
2726
- misspell
2827
- prealloc
2928
- revive

client/link.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,15 @@ func (cc *Client) SyncEncryptKeys() error {
145145
return cc.deleteUserData()
146146
}
147147

148-
// TODO find a better place for this, or do something more sophisticated than
149-
// just wiping it out.
150148
func (cc *Client) deleteUserData() error {
149+
// nolint: godox
150+
// TODO find a better place for this, or do something more sophisticated than
151+
// just wiping it out.
151152
dd, err := cc.DataPath()
152153
if err != nil {
153154
return err
154155
}
156+
// nolint: godox
155157
// TODO add any other directories that need wiping
156158
kvd := fmt.Sprintf("%s/kv", dd)
157159
return os.RemoveAll(kvd)

cmd/completion.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ var CompletionCmd = &cobra.Command{
5555
Run: func(cmd *cobra.Command, args []string) {
5656
switch args[0] {
5757
case "bash":
58-
cmd.Root().GenBashCompletion(os.Stdout)
58+
cmd.Root().GenBashCompletion(os.Stdout) // nolint: errcheck
5959
case "zsh":
60-
cmd.Root().GenZshCompletion(os.Stdout)
60+
cmd.Root().GenZshCompletion(os.Stdout) // nolint: errcheck
6161
case "fish":
62-
cmd.Root().GenFishCompletion(os.Stdout, true)
62+
cmd.Root().GenFishCompletion(os.Stdout, true) // nolint: errcheck
6363
case "powershell":
64-
cmd.Root().GenPowerShellCompletion(os.Stdout)
64+
cmd.Root().GenPowerShellCompletion(os.Stdout) // nolint: errcheck
6565
}
6666
},
6767
}

cmd/import_keys.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ var (
6868
}
6969
if !empty && !forceImportOverwrite {
7070
if common.IsTTY() {
71-
return newImportConfirmationTUI(cmd.InOrStdin(), path, dd).Start()
71+
p := newImportConfirmationTUI(cmd.InOrStdin(), path, dd)
72+
if _, err := p.Run(); err != nil {
73+
return err
74+
}
75+
return nil
7276
}
7377
return fmt.Errorf("not overwriting the existing keys in %s; to force, use -f", dd)
7478
}

cmd/keys.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ var KeysCmd = &cobra.Command{
3333
}
3434
defer f.Close() // nolint:errcheck
3535
}
36-
return keys.NewProgram(cfg).Start()
36+
p := keys.NewProgram(cfg)
37+
if _, err := p.Run(); err != nil {
38+
return err
39+
}
40+
return nil
3741
}
3842
cc := initCharmClient()
3943

cmd/link.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,19 @@ func LinkCmd(parentName string) *cobra.Command {
3030
defer f.Close() //nolint:errcheck
3131
}
3232

33+
var p *tea.Program
3334
switch len(args) {
3435
case 0:
3536
// Initialize a linking session
36-
p := linkgen.NewProgram(cfg, parentName)
37-
return p.Start()
37+
p = linkgen.NewProgram(cfg, parentName)
3838
default:
3939
// Join in on a linking session
40-
p := link.NewProgram(cfg, args[0])
41-
return p.Start()
40+
p = link.NewProgram(cfg, args[0])
4241
}
42+
if _, err := p.Run(); err != nil {
43+
return err
44+
}
45+
return nil
4346
},
4447
}
4548
}

cmd/migrate_account.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ var (
4747
lc := make(chan string)
4848
go func() {
4949
lh := &linkHandler{desc: "link-gen", linkChan: lc}
50-
rsaClient.LinkGen(lh)
50+
_ = rsaClient.LinkGen(lh)
5151
}()
5252
tok := <-lc
5353
lh := &linkHandler{desc: "link-request", linkChan: lc}
54-
ed25519Client.Link(lh, tok)
54+
_ = ed25519Client.Link(lh, tok)
5555
if verbose {
5656
log.Info("link-gen sync encrypt keys")
5757
}

cmd/where.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9+
// WhereCmd is a command to find the absolute path to your charm data folder.
910
var WhereCmd = &cobra.Command{
1011
Use: "where",
1112
Short: "Find where your cloud.charm.sh folder resides on your machine",

kv/client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ func (kv *KV) restoreSeq(seq uint64) error {
9999
return err
100100
}
101101
defer r.Close() // nolint:errcheck
102+
// nolint: godox
102103
// TODO DB.Load() should be called on a database that is not running any
103104
// other concurrent transactions while it is running.
104105
return kv.DB.Load(r, 1)

main.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ import (
1717
)
1818

1919
var (
20-
Version = ""
20+
// Version is the version of the charm CLI.
21+
Version = ""
22+
// CommitSHA is the commit SHA of the charm CLI.
2123
CommitSHA = ""
2224

2325
styles = common.DefaultStyles()
@@ -46,10 +48,13 @@ var (
4648
log.SetOutput(f)
4749
log.SetPrefix("charm")
4850

49-
defer f.Close()
51+
defer f.Close() // nolint: errcheck
5052
}
5153

52-
return ui.NewProgram(cfg).Start()
54+
p := ui.NewProgram(cfg)
55+
if _, err := p.Run(); err != nil {
56+
return err
57+
}
5358
}
5459

5560
return cmd.Help()

0 commit comments

Comments
 (0)