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)
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var compression bool
 | 
			
		||||
var configFile string
 | 
			
		||||
var configFile *string
 | 
			
		||||
var round float64
 | 
			
		||||
 | 
			
		||||
var pressureCmd = &cobra.Command{
 | 
			
		||||
@@ -14,7 +14,7 @@ var pressureCmd = &cobra.Command{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Execute a
 | 
			
		||||
func InitCmd(cmd *cobra.Command, cnfFile string) {
 | 
			
		||||
func InitCmd(cmd *cobra.Command, cnfFile *string) {
 | 
			
		||||
	configFile = cnfFile
 | 
			
		||||
 | 
			
		||||
	cmd.AddCommand(pressureCmd)
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ var readPressureCmd = &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