gb version 0.4.0
The 0.4 series focuses on improvements to project dependency management.
New features
The headline feature of the 0.4 series will be adding support for an alternative mechanism to fetch, at build time, dependencies that are not vendored into the gb project.
This mechanism is opt in only and is activated by the presence of a file at the root of your project, tentatively named $PROJECT/depfile
. The depfile
contains the missing information required to download a specific release version of a library from upstream.
gb 0.4.0 lays most of the groundwork for implementing this feature, but not the feature itself.
Please consult issue #536 for full details.
gb 0.4.0 also features the following improvements.
-
In preparation for adding support for automatically downloading missing dependencies, see above, the use of
go/build
for package source code resolution has been replaced by a home grown version. This has solved a number of long standing issues that were caused by an impedance mismatch between gb's needs and thego/build
API. Fixes #306There may be some discrepancies between how packages are resolved in 0.4.0 vs 0.3.5. It is my priority to address these issues before moving on implementing #536, please raise issues if you experience difficulties.
-
As a result of moving away from the
go/build
package you can now create a command package calledcmd
, ie$PROJECT/src/cmd/main.go
-- but really you shouldn't do that because the name of the binary would be$PROJECT/bin/cmd
. Fixes #416 -
When cross compiling, gb will always append the value of
GOOS
andGOARCH
to the output binary. ieenv GOOS=linux GOARCH=amd64 gb build
Will produce
$PROJECT/bin/$BINARY-linux-amd64
even if this is alinux/amd64
machine. This is important for people automating their build pipeline and rely on a predictable file name. Thanks @rafael84. Fixes #346 -
To support users who want to vendor tools to build their projects, protobufs is an example, gb will now let you build those packages if you name them explicitly. This is an exception to the rule that code in
$PROJECT/vendor/src
is not consider to be buildable (it is only built if referenced transitively from$PROJECT/src
). See #528.
Bug fixes
gb help {build,test}
now lists-race
correctly. Fixes #543- A bug relating to the hard coded name of the linker on FreeBSD has been fixed. Thanks @derekmarcotte. Fixes #506
- The OSX binary installer (.pkg installer) for Go 1.5 (and probably earlier) had a bug that causes the timestamps of the
.a
files in the distribution to be incorrect with respect to their.go
source. The issue has been fixed upstream and gb has a workaround. Fixes #515 - Various gb commands that shell out to the
go
tool, like gb generate and gb doc should now work more reliably with go installations that have modified the locations of thego
tool relative to$GOROOT
. This only affects users of operating system distros of Go, if you use the ones from golang.org, you can ignore this issue. Fixes #521 gb vendor fetch
now permits~
in import paths. Thanks @FiloSottile. See #535gb generate
now uses the correct operating system path separator when constructing the environment to executego generate
. Thanks @ChrisHines. See #540