是否有可能使用去构建额外的构建步骤? [英] Is it possible use Go build with extra build steps?

查看:151
本文介绍了是否有可能使用去构建额外的构建步骤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

怎么办时,去建设是不够的,那些需要与沿运行额外的命令去打造?难道去工具已经这个用例覆盖?如果是这样,有什么约定?

What to do when go build is not enough and ones need to run extra commands along with go build? Does go tools have this use case covered? If so, what's the convention?

我注意到有可能通过额外的标志来构建工具:

I noticed it's possible to pass extra flags to build tools with:

//#cgo pkg-config: glib-2.0 gobject-2.0 etc etc
import "C"

是否有可能运行额外的命令或至少告诉去建设使用的Makefile?

Is it possible to run extra commands or at least tell go build to use a Makefile?

推荐答案

没有。转到工具不打算成为一个通用的构建系统。有对CGO(如pkg配置)做出了一些规定,但它不是扩展。

No. The go tool isn't intended to be a generic build system. There are some provisions made for cgo (like pkg-config), but it's not extendable.

在go1.4会有 生成命令。这将让你运行pre处理的源文件任意命令,但它总是有是明确运行一个单独的步骤。你不能挂接到去弄去建立去安装

in go1.4 there will be the generate command. This will let you run arbitrary commands for pre-processing source files, but it always has to be a separate step that is run explicitly. You can't hook it into go get, go build, or go install.

这需要更复杂的构建使用脚本或Makefile文件,并避开的一般能力许多项目去弄。但是库包应该努力做到 GET -able在dependecy解决简单。

Many projects that require a more complicated build use a script or a Makefile, and eschew the general ability go get. Library packages however should strive to be get-able for simplicity in dependecy resolution.

这篇关于是否有可能使用去构建额外的构建步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆