golang 自动化打包并上传到服务器
build-go.sh
# !/bin/bash #调用上传文件脚本把打包好的go-admin二进制文件上传到服务器上 echo "复制文件到服务器" echo "CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go" expect ./scpToServer.sh $i $j
scpToServer.sh
#!/usr/bin/expect -f # 复制main_linux二进制文件到服务器/www/go/server目录 root:服务器用户名 spawn scp /home/qiao/www/go/gocms/cxmall/dockerfile/app/main_linux root@192.168.0.128:/www/go/server ####################### expect { -re ".*es.*o.*" { exp_send "yes\r" exp_continue } -re ".*sword.*" { exp_send "A@#df5677lkse4\r" } } interact