package main import ( "fmt" "io/ioutil" "net/http" "os" "regexp" ) var ( reEmail = `[\w\.]+@\w+\.[a-z]{2,3}(\.[a-z]{2,3})...
package main import ( "fmt" "io/ioutil" "net/http" "os" "regexp" ) var ( rePhone = `(1[3456789]\d)(\d{4})(\d{4})` ) func...
下载非标准的包,"golang.org/x/net/html"先安装git,使用git命令下载git clone https://github.com/golang/net将net包,放到GOROOT路径下比如:我的是:GOROOT = E:\go\所以最终目录是:E:\go\src\golang.org\x\net注意:如果没有golang.org和x文件夹,就创建创建fetch目录,在...
golang 文件 下载 实现下载文件过程中 生成XXX.download中间文件,下载完成后再重命名为待下载文件XXXpackage mainimport ( "crypto/md5" "errors" "fmt" "io" "io/ioutil" ...
golang 调用win32 api 实现windows注销、重启、关机这是一个创建于 2016-07-02 19:00:01 的文章,其中的信息可能已经有所发展或是发生改变。package main import ( "flag" "fmt" ) import ( . "github.com/CodyGuo/wi...
golang os.Argspackage main import( "os" "fmt" ) func main(){ if len(os.Args)!=0{ fmt.Println(os.Args[0])// args 第一个片 是文件路径 } fmt.Println(os.Args[1]) ...
Golang 实现简单的 Web 服务器下面一段代码,实现了最简单的 Web 服务器:// main.go package main import ( "fmt" "log" "net/http" ) // 处理主页请求 func index(w http.ResponseWriter, r *http....
Golang websocket 实现消息推送服务端实现package main import ( "encoding/json" "fmt" "log" "net/http" "golang.org/x/net/websocket" ) ...
package main import ( "fmt" "io/ioutil" "net/http" "time" ) func main() { go func() { for { fmt.Println("wind...
package main import ( "fmt" "time" ) func main() { go func() { for { fmt.Println("HELLO !") time.Sleep(10 * time.Second)...