[go-nuts] Re: When slice decide to expand cap?

2019-04-11 Thread jianfeng ye
and i want to got the code where go build check slice's cap to decide where use growslice? 在 2019年4月11日星期四 UTC+8下午6:19:30,jianfeng ye写道: > > Some article tell me when slice use append function, if slice's cap > is satisfy,it will not grow slice。 > > but I want to

[go-nuts] go tool compile show error “main.go:3: can't find import: "fmt"”

2016-12-02 Thread jianfeng ye
my code like this: package main package main import "fmt" func f(q int) { fmt.Println(q) } func g(p int) int { var sum int for i := 0; i < p; i++ { sum = sum + i } f(sum) return sum } func main() { c := g(4) + 1 _ = c } and i use command: GOOS=linux GOARCH=amd64 go tool compile -S main.go