fix(cmd): use pointer instead a copied object of the configFile environment
This commit is contained in:
@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
var compression bool
|
||||
var configFile string
|
||||
var configFile *string
|
||||
var round float64
|
||||
|
||||
var humidityCmd = &cobra.Command{
|
||||
@ -14,7 +14,7 @@ var humidityCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
// Execute a
|
||||
func InitCmd(cmd *cobra.Command, cnfFile string) {
|
||||
func InitCmd(cmd *cobra.Command, cnfFile *string) {
|
||||
configFile = cnfFile
|
||||
|
||||
cmd.AddCommand(humidityCmd)
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ var readHumidityCmd = &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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user