摘要: package mainimport ( "encoding/json" "fmt" )type Contact struct { Name string `json:"name"` Title string `json:"title,omitempty"` Contact struct { Hom 阅读全文
posted @ 2021-01-29 13:50 yangxl-dev 阅读(456) 评论(0) 推荐(0)
摘要: package mainimport ( "log" "os" "time" "fmt")func main() { datetime := "2015-01-01 00:00:00" //待转化为时间戳的字符串 //日期转化为时间戳 timeLayout := "2006-01-02 15:04: 阅读全文
posted @ 2021-01-29 11:38 yangxl-dev 阅读(266) 评论(0) 推荐(0)
摘要: package mainimport ( "fmt" "flag" gexpect "github.com/ThomasRooney/gexpect")func main() { cmdStr := flag.String("cmd", "", "cmds") hostStr := flag.Str 阅读全文
posted @ 2021-01-27 19:04 yangxl-dev 阅读(423) 评论(0) 推荐(0)
摘要: https://oktools.net/json2go json转go struct package mainimport ( "io/ioutil" "encoding/json" "fmt")type AutoGenerated struct { NodeName string `json:"n 阅读全文
posted @ 2021-01-27 18:18 yangxl-dev 阅读(83) 评论(0) 推荐(0)
摘要: 启用mod模式,设置代理地址,下载模块 go env -w GO111MODULE=on go env -w GOPROXY=https://goproxy.io go get -u -v github.com/kataras/iris 新建项目文件main.go ,package main 初始化 阅读全文
posted @ 2021-01-26 13:36 yangxl-dev 阅读(206) 评论(0) 推荐(0)
摘要: client.go:9:2: cannot find module providing package google.golang.org/grpc: working directory is not part of a module 因为开启mod模式了export GO111MODULE=aut 阅读全文
posted @ 2021-01-24 18:33 yangxl-dev 阅读(2497) 评论(0) 推荐(0)
摘要: 下面是在centos7 minial环境下测试通过的一段sh脚本,利用expect命令,对远端设备自动执行命令 首先要安装expect 远程执行 ssh -o ssh -o 'StrictHostKeyChecking no' 'appdeploy@10.71.2.156' -a "uptime" 阅读全文
posted @ 2021-01-22 11:45 yangxl-dev 阅读(1407) 评论(0) 推荐(0)
摘要: 通过 vi sudo命令编辑sudo文件找到生效的行du(前面没有zhi#号的) sudo文件说明:比如dao把yum安装zhuan的权限给user1,只要添加有效行:shuuser1 ALL=(root) yum install然后在user1的命令行输入sudo yum install **** 阅读全文
posted @ 2021-01-20 17:48 yangxl-dev 阅读(2007) 评论(0) 推荐(0)
摘要: SSH 三步解决免密 1.客户端生成公私钥 本地客户端生成公私钥:(一路回车默认即可) ssh-keygen 1 上面这个命令会在用户目录.ssh文件夹下创建公私钥 cd ~/.ssh 1 ls 1 下创建两个密钥: id_rsa (私钥) id_rsa.pub (公钥) 2.上传公钥到服务器 这里 阅读全文
posted @ 2021-01-19 15:08 yangxl-dev 阅读(63) 评论(0) 推荐(0)
摘要: Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.” 一、报错信息 Warning: Using a password with '-a' or '-u' 阅读全文
posted @ 2021-01-18 13:24 yangxl-dev 阅读(6176) 评论(0) 推荐(0)