安装插件
Ctrl + Shift + P,搜索框输入「Go:Install/Update Tools」,全选后点ok进行安装。显示「All tools successfully installed.」则表示安装完成
.vscode 配置文件
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"env": {
"PATH":"/opt/compiler/gcc-8.2/bin/:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/opt/bin:/home/opt/bin:/usr/local/go/bin:/usr/local/git/bin:/usr/local/sbin:/usr/sbin:/opt/bin:/home/opt/bin:/usr/local/go/bin:/usr/local/git/bin:/opt/bin:/home/opt/bin:/usr/local/go/bin:/opt/bin:/home/opt/bin:/usr/local/go/bin:/usr/local/git/bin:/opt/bin:/home/opt/bin:/usr/local/go/bin:/usr/local/git/bin",
"GOROOT":"/usr/local/go",
"GOPATH":"/Users/lwt/go"
},
"program": "${workspaceRoot}/main.go"
}
]
}
task.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "kill-proxy",
"type": "shell",
"command": "pid=`netstat -tpnl | grep 8081 | awk '{print $7}' | grep -Eo '[0-9]*'`; ret=`if [ $pid!='' ]; then echo $pid | xargs kill -9; fi`; echo $ret"
}
]
}
shell 扫表
#!/bin/bash
TABLE_NAME_PREFIX='order_info_'
COUNTER=0
while [ $COUNTER -lt 32 ]
do
TABLE_NAME=$TABLE_NAME_PREFIX"$COUNTER"
SQL='select * from '${TABLE_NAME}'';
# echo -e "$SQL\n"
# 执行数据表创建
mysql -uuser -h10.151.240.18 -P4444 -pmima -A database -e "${SQL}" >> output
let COUNTER+=1
done