... 解压就可以使用了。 centos7: 下载地址: golang.google.cn/dl/ 下载想要的版本: wget https://golang.google.cn/dl/go1.15.15.linux ...
... .Println(db) } 使用示例: https://github.com/astaxie/build-web-application-with-golang/blob/master/zh/05.2.md
... in golang!") } func main() { http.HandleFunc("/", handler) http.ListenAndServeTLS(":9090", "server.crt","server.key", nil) } 访问: go ...
... ;time" ) func main() { ch := make(chan int) quit := make(chan bool) go func() { for { select { case num := <-ch: fmt.Println("num = " ...
... /pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" ) func main() { configPath := "config" ...
... () if err != nil { fmt.Println("err = ", err) return } go HandleConn(conn) } } tcp_client.go package main import ( "fmt" "net" "os ...
... length for that record. // print_r($reader->getWithPrefixLen($ipAddress)); $reader->close(); golang:命令的方式 package main import ( "fmt" "log" ...
... .NewTimer(3 * time.Second) // 3s后往timer通道中写时间 go func() { num := <-timer.C // 未读出内容时一直保持死锁 ...
运行go文件: go run demo.go 在编译源代码之后还安装到指定的目录 go install ... 生成可执行文件 go build demo.go 从指定源上面下载或者更新指定的代码和依赖,并对他们进行编译和安装 go get = git clone + go install
... ("test() hello", i) time.Sleep(time.Millisecond * 100) } } func main() { go test() fmt.Println(" ") for i := 0; i < 20; i ...
... 阻塞 Printer("world") } func main() { // 这样会出现资源竞争 go Person1() go Person2() for { } } channel: package main import ( "fmt" "time ...
... .Index("ssscccaaaccc", "vvv")) // Repeat buf = strings.Repeat("golang", 3) fmt.Println(buf) // Split 分割字符串 buf = "aaa@bbb ...
... main() { buf := `{ "company":"itcast", "subjects": [ "go", "c++", "python" ], "Isok": true, " ...
error接口的使用: package main import ( "errors" "fmt" ) func main() { var err1 error = fmt.Errorf("%s", "This is error1") err2 := fmt.Errorf(& ...
接口的定义和实现: package main import "fmt" type Humaner interface { sayhi() } type Student struct { id int name string } type Teacher struct { addr string group string } func ...
面相对象: package main import "fmt" type long int // 方法,面向对象编程 func (tmp long) Add(other long) long{ return tmp + other } func main(){ var a long = 2 b := a.Add(3) fmt. ...
在git bash里设置代理: export https_proxy=http://192.168.0.10:8118 export http_proxy=http://192.168.0.10:8118 git config --global http.proxy 'http://192.168.0.10:8118' git ...
package main import ( "fmt" "os" ) func main() { // 标准输出设备 // os.Stdout.Close() //fmt.Println("123") // os.Stdout.WriteString("hello") // ...
正则的使用: package main import ( "fmt" "regexp" ) func main() { buf := "abc axc adc qwe fff aaa" // 解析正则 reg := regexp.MustCompile(`a.c`) if reg == nil ...
写入内容到文件: package main import ( "fmt" "os" ) func WriteFile(path string) { f, err := os.Create(path) if err != nil { fmt.Println("err = ", err) ...