Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(deps): dependabot #224

Merged
merged 5 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"

charm "github.com/charmbracelet/charm/proto"
"github.com/golang-jwt/jwt/v4"
jwt "github.com/golang-jwt/jwt/v4"
)

// Auth will authenticate a client and cache the result. It will return a
Expand Down
6 changes: 3 additions & 3 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
"strings"
"sync"

"github.com/caarlos0/env/v6"
env "github.com/caarlos0/env/v6"
charm "github.com/charmbracelet/charm/proto"
"github.com/charmbracelet/keygen"
"github.com/golang-jwt/jwt/v4"
"github.com/mitchellh/go-homedir"
jwt "github.com/golang-jwt/jwt/v4"
homedir "github.com/mitchellh/go-homedir"
gap "github.com/muesli/go-app-paths"
"golang.org/x/crypto/ssh"
)
Expand Down
2 changes: 1 addition & 1 deletion client/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (cc *Client) AuthedJSONRequest(method string, path string, reqBody interfac
return err
}
headers := http.Header{
"Content-Type": {"application/json"},
"Content-Type": []string{"application/json"},
}
resp, err := cc.AuthedRequest(method, path, headers, buf)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var CompletionCmd = &cobra.Command{
Long: completionInstructions(),
DisableFlagsInUseLine: true,
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
Args: cobra.ExactValidArgs(1),
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
Run: func(cmd *cobra.Command, args []string) {
switch args[0] {
case "bash":
Expand Down
8 changes: 4 additions & 4 deletions cmd/crypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type cryptFile struct {
Data string `json:"data"`
}

func cryptEncrypt(cmd *cobra.Command, args []string) error {
func cryptEncrypt(_ *cobra.Command, _ []string) error {
cr, err := crypt.NewCrypt()
if err != nil {
return err
Expand All @@ -88,7 +88,7 @@ func cryptEncrypt(cmd *cobra.Command, args []string) error {
return nil
}

func cryptDecrypt(cmd *cobra.Command, args []string) error {
func cryptDecrypt(_ *cobra.Command, args []string) error {
var r io.Reader
cr, err := crypt.NewCrypt()
if err != nil {
Expand Down Expand Up @@ -127,7 +127,7 @@ func cryptDecrypt(cmd *cobra.Command, args []string) error {
return nil
}

func cryptEncryptLookup(cmd *cobra.Command, args []string) error {
func cryptEncryptLookup(_ *cobra.Command, args []string) error {
cr, err := crypt.NewCrypt()
if err != nil {
return err
Expand All @@ -140,7 +140,7 @@ func cryptEncryptLookup(cmd *cobra.Command, args []string) error {
return nil
}

func cryptDecryptLookup(cmd *cobra.Command, args []string) error {
func cryptDecryptLookup(_ *cobra.Command, args []string) error {
cr, err := crypt.NewCrypt()
if err != nil {
return err
Expand Down
10 changes: 5 additions & 5 deletions cmd/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (lrfs *localRemoteFS) copy(srcName string, dstName string, recursive bool)
return lrfs.write(dstName, src)
}

func fsCat(cmd *cobra.Command, args []string) error {
func fsCat(_ *cobra.Command, args []string) error {
lsfs, err := cfs.NewFS()
if err != nil {
return err
Expand Down Expand Up @@ -254,15 +254,15 @@ func fsMove(cmd *cobra.Command, args []string) error {
return fsRemove(cmd, args[:1])
}

func fsRemove(cmd *cobra.Command, args []string) error {
func fsRemove(_ *cobra.Command, args []string) error {
lsfs, err := cfs.NewFS()
if err != nil {
return err
}
return lsfs.Remove(args[0])
}

func fsCopy(cmd *cobra.Command, args []string) error {
func fsCopy(_ *cobra.Command, args []string) error {
lrfs, err := newLocalRemoteFS()
if err != nil {
return err
Expand All @@ -287,7 +287,7 @@ func fsCopy(cmd *cobra.Command, args []string) error {
return lrfs.copy(src, dst, isRecursive)
}

func fsList(cmd *cobra.Command, args []string) error {
func fsList(_ *cobra.Command, args []string) error {
lsfs, err := cfs.NewFS()
if err != nil {
return err
Expand All @@ -312,7 +312,7 @@ func fsList(cmd *cobra.Command, args []string) error {
return nil
}

func fsTree(cmd *cobra.Command, args []string) error {
func fsTree(_ *cobra.Command, args []string) error {
lsfs, err := cfs.NewFS()
if err != nil {
return err
Expand Down
9 changes: 3 additions & 6 deletions cmd/import_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,12 @@ func restoreFromReader(r io.Reader, dd string) error {
return err
}

if err := os.WriteFile(
err = os.WriteFile(
keypath+".pub",
ssh.MarshalAuthorizedKey(signer.PublicKey()),
0o600,
); err != nil {
return err
}

return nil
)
return err
}

func untar(tarball, targetDir string) error {
Expand Down
14 changes: 7 additions & 7 deletions cmd/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/charmbracelet/charm/kv"
"github.com/charmbracelet/charm/ui/common"
"github.com/dgraph-io/badger/v3"
badger "github.com/dgraph-io/badger/v3"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -80,7 +80,7 @@ var (
}
)

func kvSet(cmd *cobra.Command, args []string) error {
func kvSet(_ *cobra.Command, args []string) error {
k, n, err := keyParser(args[0])
if err != nil {
return err
Expand All @@ -95,7 +95,7 @@ func kvSet(cmd *cobra.Command, args []string) error {
return db.SetReader(k, os.Stdin)
}

func kvGet(cmd *cobra.Command, args []string) error {
func kvGet(_ *cobra.Command, args []string) error {
k, n, err := keyParser(args[0])
if err != nil {
return err
Expand All @@ -112,7 +112,7 @@ func kvGet(cmd *cobra.Command, args []string) error {
return nil
}

func kvDelete(cmd *cobra.Command, args []string) error {
func kvDelete(_ *cobra.Command, args []string) error {
k, n, err := keyParser(args[0])
if err != nil {
return err
Expand All @@ -124,7 +124,7 @@ func kvDelete(cmd *cobra.Command, args []string) error {
return db.Delete(k)
}

func kvList(cmd *cobra.Command, args []string) error {
func kvList(_ *cobra.Command, args []string) error {
var k string
var pf string
if keysIterate || valuesIterate {
Expand Down Expand Up @@ -178,7 +178,7 @@ func kvList(cmd *cobra.Command, args []string) error {
})
}

func kvSync(cmd *cobra.Command, args []string) error {
func kvSync(_ *cobra.Command, args []string) error {
n, err := nameFromArgs(args)
if err != nil {
return err
Expand All @@ -190,7 +190,7 @@ func kvSync(cmd *cobra.Command, args []string) error {
return db.Sync()
}

func kvReset(cmd *cobra.Command, args []string) error {
func kvReset(_ *cobra.Command, args []string) error {
n, err := nameFromArgs(args)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ func (cfs *FS) WriteFile(name string, src fs.File) error {
}
path := fmt.Sprintf("/v1/fs/%s?mode=%d", ep, info.Mode())
headers := http.Header{
"Content-Type": {w.FormDataContentType()},
"Content-Length": {fmt.Sprintf("%d", contentLength)},
"Content-Type": []string{w.FormDataContentType()},
"Content-Length": []string{fmt.Sprintf("%d", contentLength)},
}
resp, err := cfs.cc.AuthedRequest("POST", path, headers, rr)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ func (s *HTTPServer) renderCustomError(w http.ResponseWriter, msg string, status
_ = json.NewEncoder(w).Encode(charm.Message{Message: msg})
}

func (s *HTTPServer) handleJWKS(w http.ResponseWriter, r *http.Request) {
func (s *HTTPServer) handleJWKS(w http.ResponseWriter, _ *http.Request) {
jwks := jose.JSONWebKeySet{Keys: []jose.JSONWebKey{s.cfg.jwtKeyPair.JWK.Public()}}
w.Header().Set("Content-Type", "application/json")
w.Header().Set("Access-Control-Allow-Origin", "*")
_ = json.NewEncoder(w).Encode(jwks)
}

func (s *HTTPServer) handleOpenIDConfig(w http.ResponseWriter, r *http.Request) {
func (s *HTTPServer) handleOpenIDConfig(w http.ResponseWriter, _ *http.Request) {
pj := providerJSON{JWKSURL: fmt.Sprintf("%s/v1/public/jwks", s.cfg.httpURL())}
w.Header().Set("Content-Type", "application/json")
w.Header().Set("Access-Control-Allow-Origin", "*")
Expand Down
2 changes: 1 addition & 1 deletion server/jwk.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"crypto/sha256"
"fmt"

"gopkg.in/square/go-jose.v2"
jose "gopkg.in/square/go-jose.v2"
)

// JSONWebKeyPair holds the ED25519 private key and JSON Web Key used in JWT
Expand Down
2 changes: 1 addition & 1 deletion server/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (sl *SSHLinker) TokenCreated(token charm.Token) {
}

// TokenSent implements the proto.LinkTransport interface for the SSHLinker.
func (sl *SSHLinker) TokenSent(l *charm.Link) {
func (sl *SSHLinker) TokenSent(_ *charm.Link) {
log.Debug("Token sent")
}

Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"net/url"
"path/filepath"

"github.com/caarlos0/env/v6"
env "github.com/caarlos0/env/v6"
charm "github.com/charmbracelet/charm/proto"
"github.com/charmbracelet/charm/server/db"
"github.com/charmbracelet/charm/server/db/sqlite"
Expand Down
4 changes: 2 additions & 2 deletions server/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/charmbracelet/wish"
rm "github.com/charmbracelet/wish/recover"
"github.com/gliderlabs/ssh"
"github.com/golang-jwt/jwt/v4"
jwt "github.com/golang-jwt/jwt/v4"
)

// Session represents a Charm User's SSH session.
Expand Down Expand Up @@ -104,7 +104,7 @@ func (me *SSHServer) sendJSON(s ssh.Session, o interface{}) error {
return json.NewEncoder(s).Encode(o)
}

func (me *SSHServer) authHandler(ctx ssh.Context, key ssh.PublicKey) bool {
func (me *SSHServer) authHandler(_ ssh.Context, _ ssh.PublicKey) bool {
return true
}

Expand Down
6 changes: 3 additions & 3 deletions server/storage/local/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestPut(t *testing.T) {
t.Fatal(err)
}

paths := []string{"/", "///"}
paths := []string{filepath.Join(string(os.PathSeparator), ""), filepath.Join(string(os.PathSeparator), "//")}
for _, path := range paths {
err = lfs.Put(charmID, path, buf, fs.FileMode(0o644))
if err == nil {
Expand All @@ -30,7 +30,7 @@ func TestPut(t *testing.T) {
}

content := "hello world"
path := "/hello.txt"
path := filepath.Join(string(os.PathSeparator), "hello.txt")
t.Run(path, func(t *testing.T) {
buf = bytes.NewBufferString(content)
err = lfs.Put(charmID, path, buf, fs.FileMode(0o644))
Expand Down Expand Up @@ -63,7 +63,7 @@ func TestPut(t *testing.T) {
})

content = "bar"
path = "/foo/hello.txt"
path = filepath.Join(string(os.PathSeparator), "foo", "hello.txt")
t.Run(path, func(t *testing.T) {
buf = bytes.NewBufferString(content)
err = lfs.Put(charmID, path, buf, fs.FileMode(0o644))
Expand Down
2 changes: 1 addition & 1 deletion ui/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"sync"

"github.com/mattn/go-isatty"
isatty "github.com/mattn/go-isatty"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion ui/common/views.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var (

// NewSpinner returns a spinner model.
func NewSpinner() spinner.Model {
s := spinner.NewModel()
s := spinner.New()
s.Spinner = spinner.Dot
s.Style = spinnerStyle
return s
Expand Down
6 changes: 3 additions & 3 deletions ui/keys/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (m *Model) SetCharmClient(cc *client.Client) {
func NewModel(cfg *client.Config) Model {
st := common.DefaultStyles()

p := pager.NewModel()
p := pager.New()
p.PerPage = keysPerPage
p.Type = pager.Dots
p.InactiveDot = st.InactivePagination.Render("•")
Expand All @@ -122,7 +122,7 @@ func NewModel(cfg *client.Config) Model {
func (m Model) Init() tea.Cmd {
return tea.Batch(
charmclient.NewClient(m.cfg),
spinner.Tick,
m.spinner.Tick,
)
}

Expand Down Expand Up @@ -355,7 +355,7 @@ func LoadKeys(m Model) tea.Cmd {
}
return tea.Batch(
fetchKeys(m.cc),
spinner.Tick,
m.spinner.Tick,
)
}

Expand Down
2 changes: 1 addition & 1 deletion ui/link/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func newModel(cfg *client.Config, code string) model {
func (m model) Init() tea.Cmd {
return tea.Batch(
charmclient.NewClient(m.cfg),
spinner.Tick,
m.spinner.Tick,
)
}

Expand Down
Loading