我试图将“ExpFloat64()”功能称作“大包”(http://golang.org/pkg/rand/)。 但是,它有以下错误:“prog.go:4:进口,而不是使用:rand prog.go:7:未界定:ExpFloat64”。 谁能帮助我为什么会错过? 《刑法》如下。
package main
import "fmt"
import "rand"
func main() {
fmt.Println(ExpFloat64())
}
我试图将“ExpFloat64()”功能称作“大包”(http://golang.org/pkg/rand/)。 但是,它有以下错误:“prog.go:4:进口,而不是使用:rand prog.go:7:未界定:ExpFloat64”。 谁能帮助我为什么会错过? 《刑法》如下。
package main
import "fmt"
import "rand"
func main() {
fmt.Println(ExpFloat64())
}
错误信息很好地解释了这一信息——在戈里,你可以不使用进口包裹。 这里,它说,你重新进口大地,而不是使用大地,所以要么使用,要么进口。 你的主要职能是:
fmt.Println(rand.ExpFloat64())
除了Chris Bunch所说的话外,如果你真的想要使用包裹中的名称(例如ExpFloat64
),你可以这样做:
import . "rand"
What is the difference between Go s multithreading approach and other approaches, such as pthread, boost::thread or Java Threads?
Does anyone know approximately what the minimum work size is needed in order for a goroutine to be beneficial (assuming that there are free cores for the work to be offloaded to)?
How do I get the terminal size in Go. In C it would look like this: struct ttysize ts; ioctl(0, TIOCGWINSZ, &ts); But how to i access TIOCGWINSZ in Go
I know its a bit too early, but I ve been trying out Go (Google s Programming Language) and its kindof annoying to write code in gedit. So, my question: What do you use to experiment with Go?
All the examples I ve seen so far involve blocking to get the result (via the <-chan operator). My current approach involves passing a pointer to a struct: type goresult struct { result ...
One of Go s slogans is Do not communicate by sharing memory; instead, share memory by communicating. I am wondering whether Go allows two different Go-compiled binaries running on the same machine to ...
What is your opinion of this design decision? What advantages does it have and what disadvantages? Links: Embedding description
Does Google s Golang address the problems with languages addressed in Paul s Graham s post Why Arc isn t Especially Object Oriented ?