go tool pprof http://192.168.1.43:8201/debug/pprof/profilegoimports -w .golint .unused[]byte 不能用 chan.io.pipe().godoc 命令支持额外参数 -analysis ,能列出都有哪些类型实现了某个接口,相关参考 godoc -h 或 Static analysis features of godoc。另外,我做了一个官网镜像,能查看接口所有的实现类型,地址:http://docs.studygolang.com
go get github.com/nsqio/nsq/...go fmt ./...go test ./...{
xxx
}
func() {
xxxx
}()
这种可以用defer来清理资源, 可以用return语句, 来提前退出.
if true {
}
GOOS=linux GOARCH=amd64 go build -o upx-linux-amd64-$(VER) -ldflags "-X main.version=$(VER)" .
GOOS=linux GOARCH=386 go build -o upx-linux-i386-$(VER) -ldflags "-X main.version=$(VER)" .
GOOS=darwin GOARCH=amd64 go build -o upx-darwin-amd64-$(VER) -ldflags "-X main.version=$(VER)" .
GOOS=windows GOARCH=386 go build -o smk_win
go build -o smk_osx
GOOS=linux GOARCH=amd64 go build -o smk_linux
GOOS=windows GOARCH=386 go build -o smk_win
请问 Go 现在对于社区的态度如何,之前看过篇文章作者的一些提交被无视了,不知道迁移到 GitHub 后社区参与程度怎样了 应该说迁移到 GitHub 之后 更严格了, Google 的背景也更明显了:
Golang编程百例: https://www.zybuluo.com/Gestapo/note/32082
go test -v gotest.go gotest_test.gogo test -v -test.run Test_Division_1src, pkg, bin_test.go为后缀.* testing.T 或 *testing.B的参数.// 功能测试函数
func TestFind(t *testing.T) {
// 省略若干条语句
}
// 性能/基准测试函数
func BenchmarkFind(b *testing.B) {
// 省略若干条语句
}
go installGOBIN, 这生成的二进制在$GOBIN/bin下, 如果没设置GOBIN, 生成在当前工作区的bin目录下.pkg目录下.go getGOPATH中包含的第一个工作区的src目录中.# 为了方便使用Go语言命令和Go程序的可执行文件, 需要追加其值
export PATH=$PATH:$GOROOT/bin:$GOBIN
gocode (you must have the autocomplete-plus package activated for this to work)gofmt, goimports, or goreturnsgo vetgolintgo build and go testgo test -coverprofilegodef