我在什么地方应该把我的包裹放在一边,以便用另一个包裹进口吗?
$ tree
.
├── main.go
└── src
└── test.go
1 directory, 2 files
$ cat src/test.go
package test
$ cat main.go
package main
import "test"
$ go build main.go
main.go:3:8: import "test": cannot find package
我在什么地方应该把我的包裹放在一边,以便用另一个包裹进口吗?
$ tree
.
├── main.go
└── src
└── test.go
1 directory, 2 files
$ cat src/test.go
package test
$ cat main.go
package main
import "test"
$ go build main.go
main.go:3:8: import "test": cannot find package
您。 • 在GOPATH/src/optional-what/foo/*.go的包裹 f源,并在编码中使用
import "optional-whatever/foo"
您
有一些事情需要发生。 你们必须首先安装“测试”包:
$ export GOPATH=$(pwd) # Assumes a bourne shell (not csh)
$ mkdir src/test
$ mv src/test.go src/test/test.go
$ mkdir pkg # go install will put packages here
$ go install test # build the package and put it in $GOPATH/pkg
$ go build main.go
Note that it is not necessary to create pkg, as go install
will do that for you.
Once you ve installed the test package (generally a bad name, BTW) go build main.go
should now give different errors (eg, "imported and not used")
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 ?