mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
cmd: Fix tests
This commit is contained in:
parent
defa97f560
commit
b4dbd37a01
2 changed files with 5 additions and 5 deletions
|
@ -142,10 +142,10 @@ package cmd
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
{{if .viper}}
|
||||||
"github.com/spf13/cobra"{{if .viper}}
|
|
||||||
"github.com/spf13/viper"
|
|
||||||
homedir "github.com/mitchellh/go-homedir"{{end}}
|
homedir "github.com/mitchellh/go-homedir"{{end}}
|
||||||
|
"github.com/spf13/cobra"{{if .viper}}
|
||||||
|
"github.com/spf13/viper"{{end}}
|
||||||
){{if .viper}}
|
){{if .viper}}
|
||||||
|
|
||||||
var cfgFile string{{end}}
|
var cfgFile string{{end}}
|
||||||
|
@ -176,7 +176,7 @@ func Execute() {
|
||||||
|
|
||||||
func init() { {{if .viper}}
|
func init() { {{if .viper}}
|
||||||
cobra.OnInitialize(initConfig)
|
cobra.OnInitialize(initConfig)
|
||||||
{{end}}
|
{{end}}
|
||||||
// Here you will define your flags and configuration settings.
|
// Here you will define your flags and configuration settings.
|
||||||
// Cobra supports persistent flags, which, if defined here,
|
// Cobra supports persistent flags, which, if defined here,
|
||||||
// will be global for your application.{{ if .viper }}
|
// will be global for your application.{{ if .viper }}
|
||||||
|
|
2
cobra/cmd/testdata/root.go.golden
vendored
2
cobra/cmd/testdata/root.go.golden
vendored
|
@ -48,7 +48,7 @@ func Execute() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cobra.OnInitialize(initConfig)
|
cobra.OnInitialize(initConfig)
|
||||||
|
|
||||||
// Here you will define your flags and configuration settings.
|
// Here you will define your flags and configuration settings.
|
||||||
|
|
Loading…
Reference in a new issue