go的cmd.run()报错问题

问题 @

go的cmd.run()报错

解决 @

//  `'/local:/{N;s/.*ip:.*/local:\n  ip: %s/}'` Command参数不能加单引号(')
cmd_str = fmt.Sprintf(`/local:/{N;s/.*ip:.*/local:\n  ip: %s/}`, IpAddr)
cmd = exec.Command("sed", "-i", cmd_str, config.IrisConf.Agent.DeployerLocalPath)
mlog.Debug("cmd info", zap.String("cmd", cmd.String()))
if err := cmd.Run(); err != nil {
    return err
}