- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
go build 和 go run 在我的一个小程序上非常慢(特别是 cgo 调用)。我想去缓存二进制文件,以便它只在源更新时重建。我会使用带有 % 规则的简单 Makefile,但语言设计者声称 Go 的构建支持不需要 Makefile。
我是否忽略了另一种选择? Go 社区是否更喜欢另一种构建系统(可能是基于哈希的构建系统)来缓存和重用构建产品?
最佳答案
go build
和 go install
将很快(Go 1.10,2018 年第一季度)变得更快:参见 this thread和 this文档草稿。
The go command now maintains a cache of built packages and other small metadata (CL 68116 and CL 75473). The cache defaults to the operating system-defined user cache directory but can be moved by setting
$GOCACHE
.
Run "go env GOCACHE
" to see the current effective setting. Right now the go command never deletes anything from the cache. If the cache gets too big, run "go clean -cache
" instead of deleting the directory. That command will preserve the cache'slog.txt
file. In a few weeks I'll ask people to post theirlog.txt
files to a Github issue so that we can evaluate cache size management approaches.The main effect of the build cache is that commands like "
go test
" and "go build
" run fast and do incremental builds always, reusing past build steps as aggressively as possible.
You do not have to use "go test -i
" or "go build -i
" or "go install
" just to get fast incremental builds. We will not have to teach new users those workarounds anymore. Everything will just be fast.
请注意,go install
不会安装指定包的依赖项:请参阅“What does go build
build?”。
关于go - `go build` 不必要地重建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32061750/
jQuery attributeContainsPrefix [name^="value"] 对比 attributeStartsWith [name|="value"] 实际区别是什么? 最佳答案
在1.1部分在RFC 6749中,有四种角色:资源拥有者、资源服务器、客户端和授权服务器。 如果客户端和资源所有者是同一实体,OAuth 是否变得多余或不必要? 例如,我有一个封闭的 API 和一个面
我有一段代码,其中有一个带有保护子句的 raise 语句: def validate_index index # Change to SizeError raise ArgumentError
我看到了这篇文章( JPA Entity Lifecycle Events vs database trigger ),但它并没有像我在这里那样明确地询问: 当我插入 PK 值为 (null) 的行时
所以,我有一段代码看起来像 if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2){ // Do something }
我是一名优秀的程序员,十分优秀!