零号智能

  • Python
  • 部署
  • go
  • VPS
  • 运维
  • 生活琐事
  • html
go
go

头大的kubernetes client-go exec

今天是第6天被client-go的exec非严重错误如log.info级别,结果直接返回报错弄得头大。目前用的代码是

2021年6月21日 0条评论 3386点热度 2人点赞 vpc 阅读全文
go

go os/exec 弄了一上午被坑

switch runtime.GOOS { case "windows": hms := t.Format("15:04:05") _ = exec.Command("cmd", "/C", "time", hms).Run() date := t.Format("2006-01-02") _ = exec.Command("cmd", "/C", "date", date).Run() default: date := t.Format("2006-01-02 01:01:01") _ = exec.Comman…

2021年1月9日 0条评论 4071点热度 0人点赞 vpc 阅读全文
go

go 在Linux下Exec执行shell

//+build linux e.job.Cmd.SysProcAttr = &syscall.SysProcAttr{} uid, uErr := strconv.Atoi(userInfo.Uid) gid, gErr := strconv.Atoi(userInfo.Gid) fmt.Println(userInfo.Uid, userInfo.Gid) if uErr == nil && gErr == nil { // 仅Linux下有效。 e.job.Cmd.SysProcAtt…

2021年1月7日 0条评论 4078点热度 0人点赞 vpc 阅读全文
go

指针函数解决 golang 的 import cycle not allowed,无需建新文件

本方案代码只为演示而写,不要喷我干嘛不直接在get里面调用Stop~~~ robot/app/app.go文件 package main import ( "fmt" "robot/web" ) func StopRobot(uid int) { fmt.Println("end", uid) } func main() { g := gin.Default() g.GET("/stop", func(c *gin.Context) { b.Stop(StopRobot) } go g.Run() } robot/…

2020年9月18日 4条评论 13087点热度 9人点赞 vpc 阅读全文
分类目录
  • go
  • html
  • Python
  • VPS
  • 生活琐事
  • 运维
  • 部署

COPYRIGHT © 2021 npc0.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

粤ICP备19157245号-1

粤公网安备 44030702002746号