fix(cmd): use pointer instead a copied object of the configFile environment
This commit is contained in:
@ -21,7 +21,7 @@ var listTemperatureCmd = &cobra.Command{
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
||||
// read configuration
|
||||
cnf, err := config.Read(configFile)
|
||||
cnf, err := config.Read(*configFile)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ var readTemperatureCmd = &cobra.Command{
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
||||
// read configuration
|
||||
cnf, err := config.Read(configFile)
|
||||
cnf, err := config.Read(*configFile)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
var compression bool
|
||||
var configFile string
|
||||
var configFile *string
|
||||
var round float64
|
||||
|
||||
var temperatureCmd = &cobra.Command{
|
||||
@ -17,7 +17,7 @@ var temperatureCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
// Execute a
|
||||
func InitCmd(cmd *cobra.Command, cnfFile string) {
|
||||
func InitCmd(cmd *cobra.Command, cnfFile *string) {
|
||||
configFile = cnfFile
|
||||
cmd.AddCommand(temperatureCmd)
|
||||
|
||||
|
Reference in New Issue
Block a user