golang
WangPengJu__
码码码码码码码,代码!
展开
-
Golang 连接MySql数据库使用方法
package main import ( "database/sql" "fmt" _ "github.com/go-sql-driver/mysql" ) var ( dbhostsip = "127.0.0.1:3306" //IP地址 dbusername = "root" //用户名 dbpassword = "123456" //密码 dbname原创 2016-03-06 19:52:44 · 20162 阅读 · 0 评论 -
Golang websocket使用方法
package main import ( "fmt" "log" "net/http" "code.google.com/p/go.net/websocket" ) func main() { http.Handle("/", websocket.Handler(Echo)) if err := http.ListenAndServe(":1234", nil); err !=原创 2016-03-13 12:49:48 · 4522 阅读 · 0 评论 -
golang执行命令 exec.Command
cmd := exec.Command("cmd") in := bytes.NewBuffer(nil) cmd.Stdin = in //绑定输入 var out bytes.Buffer cmd.Stdout = &out //绑定输出 go func() { in.WriteString("node E:/design/test.js\n")//写入你的命令,可以有多行,"\原创 2016-12-19 19:52:49 · 22832 阅读 · 0 评论