Skip to content

Commit 8acadf7

Browse files
committed
Remove unused viper package
1 parent 887b8ad commit 8acadf7

File tree

3 files changed

+0
-518
lines changed

3 files changed

+0
-518
lines changed

cmd/root.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
package cmd
22

33
import (
4-
"fmt"
54
"os"
65

76
"github.com/fosskey/cli/internal/util"
87
"github.com/spf13/cobra"
9-
"github.com/spf13/viper"
108
)
119

12-
var cfgFile string
13-
1410
// rootCmd represents the base command when called without any subcommands
1511
var rootCmd = &cobra.Command{
1612
Use: "foss",
@@ -36,8 +32,6 @@ func Execute() {
3632
}
3733

3834
func init() {
39-
cobra.OnInitialize(initConfig)
40-
4135
// Here you will define your flags and configuration settings.
4236
// Cobra supports persistent flags, which, if defined here,
4337
// will be global for your application.
@@ -52,27 +46,3 @@ func init() {
5246
// when this action is called directly.
5347
// rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
5448
}
55-
56-
// initConfig reads in config file and ENV variables if set.
57-
func initConfig() {
58-
if cfgFile != "" {
59-
// Use config file from the flag.
60-
viper.SetConfigFile(cfgFile)
61-
} else {
62-
// Find home directory.
63-
home, err := os.UserHomeDir()
64-
cobra.CheckErr(err)
65-
66-
// Search config in home directory with name ".foss" (without extension).
67-
viper.AddConfigPath(home)
68-
viper.SetConfigType("yaml")
69-
viper.SetConfigName(".foss")
70-
}
71-
72-
viper.AutomaticEnv() // read in environment variables that match
73-
74-
// If a config file is found, read it in.
75-
if err := viper.ReadInConfig(); err == nil {
76-
fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed())
77-
}
78-
}

go.mod

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,12 @@ go 1.19
44

55
require (
66
github.com/spf13/cobra v1.6.1
7-
github.com/spf13/viper v1.14.0
87
golang.org/x/crypto v0.4.0
98
golang.org/x/term v0.3.0
109
)
1110

1211
require (
13-
github.com/fsnotify/fsnotify v1.6.0 // indirect
14-
github.com/hashicorp/hcl v1.0.0 // indirect
1512
github.com/inconshreveable/mousetrap v1.0.1 // indirect
16-
github.com/magiconair/properties v1.8.6 // indirect
17-
github.com/mitchellh/mapstructure v1.5.0 // indirect
18-
github.com/pelletier/go-toml v1.9.5 // indirect
19-
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
20-
github.com/spf13/afero v1.9.2 // indirect
21-
github.com/spf13/cast v1.5.0 // indirect
22-
github.com/spf13/jwalterweatherman v1.1.0 // indirect
2313
github.com/spf13/pflag v1.0.5 // indirect
24-
github.com/subosito/gotenv v1.4.1 // indirect
2514
golang.org/x/sys v0.3.0 // indirect
26-
golang.org/x/text v0.5.0 // indirect
27-
gopkg.in/ini.v1 v1.67.0 // indirect
28-
gopkg.in/yaml.v2 v2.4.0 // indirect
29-
gopkg.in/yaml.v3 v3.0.1 // indirect
3015
)

0 commit comments

Comments
 (0)