From b2fb8eb6989b3ba0b1da740cee3350289fd4e609 Mon Sep 17 00:00:00 2001 From: Jiawei Huang Date: Thu, 5 Dec 2024 11:39:45 -0800 Subject: [PATCH] Use Go stdlib to get user home directory `mitchellh/go-homedir`is archived. `os.UserHomeDir()` from Go stdlib should work for the `calico-bpf` command line tool. This change also reduces one direct dependency. --- felix/cmd/calico-bpf/commands/root.go | 3 +-- go.mod | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/felix/cmd/calico-bpf/commands/root.go b/felix/cmd/calico-bpf/commands/root.go index 74636aca9b8..641419be5c0 100644 --- a/felix/cmd/calico-bpf/commands/root.go +++ b/felix/cmd/calico-bpf/commands/root.go @@ -18,7 +18,6 @@ import ( "fmt" "os" - homedir "github.com/mitchellh/go-homedir" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -67,7 +66,7 @@ func initConfig() { viper.SetConfigFile(cfgFile) } else { // Find home directory. - home, err := homedir.Dir() + home, err := os.UserHomeDir() if err != nil { fmt.Println(err) os.Exit(1) diff --git a/go.mod b/go.mod index 7debbd18bc5..5900d863585 100644 --- a/go.mod +++ b/go.mod @@ -50,7 +50,6 @@ require ( github.com/libp2p/go-reuseport v0.4.0 github.com/mcuadros/go-version v0.0.0-20190830083331-035f6764e8d2 github.com/mipearson/rfw v0.0.0-20170619235010-6f0a6f3266ba - github.com/mitchellh/go-homedir v1.1.0 github.com/natefinch/atomic v1.0.1 github.com/nmrshll/go-cp v0.0.0-20180115193924-61436d3b7cfa github.com/olekukonko/tablewriter v0.0.5 @@ -210,6 +209,7 @@ require ( github.com/mdlayher/genetlink v1.0.0 // indirect github.com/mdlayher/netlink v1.1.0 // indirect github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/spdystream v0.2.0 // indirect