這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。Golang指標的聲明是非常清晰明了的。 var i int :聲明一個普通變數,類型為int。可以這麼讀:聲明了一個變數i,類型為int。(注意:Golang把變數類型放在變數名的後面) var ip *int:聲明一個指標變數,類型為*int(為什麼不把*放在右邊?也許是怕把乘號和指標混淆)。指標變數儲存的是記憶體位址(相當於位元組數組的索引),記憶體位址上對應內容為int類型。 var array
這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。先看一段代碼ackage mainimport ( "fmt" "sync")func main() { var wg sync.WaitGroup s := make([]int, 0, 1000) for i := 0; i < 1000; i++ { v := i wg.Add(1) go func() { s =
這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。In April and May I’ll be speaking at GopherChina and GopherCon Singapore, respectively. This post is a teaser for the talks that were selected by the organisers. If you’re in the area, I hope you’ll come and hear me
這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。In Go, goroutines are cheap to create and efficient to schedule. The Go runtime has been written for programs with tens of thousands of goroutines as the norm, hundreds of thousands are not unexpected. But goroutines
這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。This post is a spin-off from various conversations around improving (I’m trying not to say standardising, otherwise I’ll have to link to XKCD) the way logging is performed in Go projects.Consider this familiar
這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。This is a short blog post about my thoughts on using Go in anger through several workplaces, as a developer and an advocate.What is $GOPATH?Back when Go was first announced we used Makefiles to compile Go code. These
這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。This is a progress report on the Go toolchain improvements during the 1.8 development cycle.Now we’re well into November, the 1.8 development window is closing fast on the few remaining in fly change lists, with the