但其中更多被“go build”命令取代,并且 Go 1 缺少 Makefile。 请参阅“go 工具”博客文章。
Go 包根本没有任何构建配置。没有 makefile,没有依赖关系的描述等。 那么它是如何运作的呢?一切都是从源代码中检索的。为了让奇迹发生,必须先完成一件事。
即使 Makefile 仍然可以使用,对于纯 Go 源代码,它们也可以被删除(就像在这个代码审查 例如)
You can find in Go Utils and Tools all the available build tools for Go.
But more of them are superseded by the "go build" command and the lack of Makefile with Go 1. See "The go tool" blog post.
Go packages don't have any build configuration at all. There's no makefiles, no descriptions of dependencies etc. How it works then? Everything is retrieved from the source code. To let the magic happen one thing has to be done first.
Even if Makefile can still be used, for pure Go source code, they can be removed (like in this code review for instance)
我为此构建了自己的小工具,名为 gobuild,并且仍在研究它。它应该能够编译大多数不与 C 代码交互的程序/库,而无需编写任何构建脚本/makefile。
I've built my own little tool called gobuild for that, and am still working on it. It should be able to compile most programs/libs that don't interfacing with C code without having to write any build-scripts/makefiles.
发布评论
评论(4)
我一直在使用 scons;这是一个示例
SConstruct
文件:I've been using scons; this is an example
SConstruct
file:您可以在Go Utils and Tools中找到所有可用的 Go 构建工具。
但其中更多被“
go build
”命令取代,并且 Go 1 缺少 Makefile。请参阅“go 工具”博客文章。
即使 Makefile 仍然可以使用,对于纯 Go 源代码,它们也可以被删除(就像在这个代码审查 例如)
You can find in Go Utils and Tools all the available build tools for Go.
But more of them are superseded by the "
go build
" command and the lack of Makefile with Go 1.See "The go tool" blog post.
Even if Makefile can still be used, for pure Go source code, they can be removed (like in this code review for instance)
我为此构建了自己的小工具,名为 gobuild,并且仍在研究它。它应该能够编译大多数不与 C 代码交互的程序/库,而无需编写任何构建脚本/makefile。
I've built my own little tool called gobuild for that, and am still working on it. It should be able to compile most programs/libs that don't interfacing with C code without having to write any build-scripts/makefiles.
我还没有编写足够大的项目来需要构建系统,因此一个简单的
build.sh
就足够了。您可以使用
$GOROOT
、$GOARCH
和$GOOS
来确定您需要什么:如果对 Go 来说足够了,那么对我来说也足够了。
I haven't written a large enough project yet to require a build system, so a simple
build.sh
is sufficient.You can use
$GOROOT
,$GOARCH
and$GOOS
to determine what you need:If it's enough for Go, it's enough for me.