我的问题是go run someprogram.go usecomand change_variable=value这可能吗,我该怎么做?
import (
"github.com/spf13/cobra"
"fmt"
"math/rand"
"time"
"github.com/brocaar/lorawan"
MQTT "github.com/eclipse/paho.mqtt.golang"
lds "github.com/iegomez/loraserver-device-sim"
)
func mainCmd() *cobra.Command {
return &cobra.Command{
Use: "sensor", RunE: func(cmd *cobra.Command,args []string) error {
ip := "tcp://127.0.0.1:1883"
cmd.Println("O IP da gateway e o port são:",ip)
//Connect to the broker
opts :=MQTT.NewClientOptions() opts.AddBroker(ip)
看到这是我的go文件包含的内容,我想在命令行中构建go文件并执行并更改ip变量
吃鸡游戏
相关分类