上一页 1 ··· 55 56 57 58 59 60 61 62 63 ··· 198 下一页
摘要: func main() { wg.Add(2) go test1() go test2() wg.Wait() } func test1() { defer wg.Done() for i:=0;i<10;i++{ fmt.Println(i) } } func test2() { defer wg 阅读全文
posted @ 2020-06-17 09:40 brady-wang 阅读(823) 评论(0) 推荐(0)
摘要: index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script> window.addEventListener("load", function(evt) { var output = document.getElem 阅读全文
posted @ 2020-06-16 08:41 brady-wang 阅读(527) 评论(0) 推荐(0)
摘要: 理解Go协程与并发 协程 Go语言里创建一个协程很简单,使用go关键字就可以让一个普通方法协程化: Copy package main import ( "fmt" "time" ) func main(){ fmt.Println("run in main coroutine.") for i:= 阅读全文
posted @ 2020-06-15 16:49 brady-wang 阅读(693) 评论(0) 推荐(0)
摘要: package main import ( "fmt" "github.com/astaxie/beego/orm" _ "github.com/go-sql-driver/mysql" // import your used driver ) // Model Struct type User s 阅读全文
posted @ 2020-06-15 13:50 brady-wang 阅读(836) 评论(0) 推荐(0)
摘要: go mod 配置 beego 首先cmd bee new blog go mod init 然后复制到任意目录 bee run 就会报错, 要退出该目录,进入上级目录 bee run blog 才行 阅读全文
posted @ 2020-06-15 08:23 brady-wang 阅读(405) 评论(0) 推荐(0)
摘要: router.go package routersimport ( "beego01/controllers" "github.com/astaxie/beego")func init() { beego.Router("/", &controllers.MainController{}) beeg 阅读全文
posted @ 2020-06-14 15:10 brady-wang 阅读(309) 评论(0) 推荐(0)
摘要: package mainimport ( "fmt" "sync")func say(i int ,wg *sync.WaitGroup) { defer wg.Done() fmt.Println(i)}func main() { var wg sync.WaitGroup for i:=0;i< 阅读全文
posted @ 2020-06-12 13:58 brady-wang 阅读(249) 评论(0) 推荐(0)
摘要: all goroutines are asleep - deadlock 简单使用: package main import ( "sync" ) type httpPkg struct{} func (httpPkg) Get(url string) {} var http httpPkg fun 阅读全文
posted @ 2020-06-12 13:55 brady-wang 阅读(1586) 评论(0) 推荐(0)
摘要: package main import ( "fmt" "github.com/antchfx/htmlquery" "golang.org/x/net/html" "io/ioutil" "net/http" "strconv" "strings" "sync" "time" ) var ( ur 阅读全文
posted @ 2020-06-12 12:23 brady-wang 阅读(360) 评论(0) 推荐(0)
摘要: package main import ( "fmt" "io/ioutil" "os" ) func main() { // 读取文件 //fileName := "./crawl/a.txt" //bytes, err := ioutil.ReadFile(fileName) //handErr 阅读全文
posted @ 2020-06-12 09:04 brady-wang 阅读(359) 评论(0) 推荐(0)
上一页 1 ··· 55 56 57 58 59 60 61 62 63 ··· 198 下一页