aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2022-05-26 16:24:02 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2022-05-29 16:12:57 +0200
commitbc1f419cebcf7505db31149fa459e9e3f8260e00 (patch)
tree0a997fdf76f0167692d294505ff3c80a7064a404 /plumbing/transport
parent69aa78ab169e8fa5d96561462b0a07aa5030bad6 (diff)
downloadgo-git-bc1f419cebcf7505db31149fa459e9e3f8260e00.tar.gz
all: replace go-homedir with os.UserHomeDir
Added in Go 1.12, this means we need one less dependency.
Diffstat (limited to 'plumbing/transport')
-rw-r--r--plumbing/transport/ssh/auth_method.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/plumbing/transport/ssh/auth_method.go b/plumbing/transport/ssh/auth_method.go
index 3514669..b4959d6 100644
--- a/plumbing/transport/ssh/auth_method.go
+++ b/plumbing/transport/ssh/auth_method.go
@@ -10,7 +10,6 @@ import (
"github.com/go-git/go-git/v5/plumbing/transport"
- "github.com/mitchellh/go-homedir"
sshagent "github.com/xanzy/ssh-agent"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/knownhosts"
@@ -224,11 +223,13 @@ func (a *PublicKeysCallback) ClientConfig() (*ssh.ClientConfig, error) {
//
// If list of files is empty, then it will be read from the SSH_KNOWN_HOSTS
// environment variable, example:
-// /home/foo/custom_known_hosts_file:/etc/custom_known/hosts_file
+//
+// /home/foo/custom_known_hosts_file:/etc/custom_known/hosts_file
//
// If SSH_KNOWN_HOSTS is not set the following file locations will be used:
-// ~/.ssh/known_hosts
-// /etc/ssh/ssh_known_hosts
+//
+// ~/.ssh/known_hosts
+// /etc/ssh/ssh_known_hosts
func NewKnownHostsCallback(files ...string) (ssh.HostKeyCallback, error) {
var err error
@@ -251,7 +252,7 @@ func getDefaultKnownHostsFiles() ([]string, error) {
return files, nil
}
- homeDirPath, err := homedir.Dir()
+ homeDirPath, err := os.UserHomeDir()
if err != nil {
return nil, err
}