Build Instructions and Dependencies
darnir opened this issue · 6 comments
Hi,
Thanks for writing this tool. It greatly boosts my productivity with working on any codebase that I know inside out.
However, I am unable to build the latest version. I don't have much knowledge of Go (I jumped on the Rust bandwagon), and so don't know much about the toolchain. A simple list with the dependencies required to build vgrep
and some build instructions would be a great addition!
One of the issues I had was that running make
invokes the check target. Could you please remove that so that make
only compiles and that make check
can run the tests. This is important for packaging it, since we can clearly define the runtime and build time dependencies of the package.
@darnir Thanks, I am glad to know vgrep is a useful tool for you, and thanks a lot for taking the time to give feedback.
Regarding make all
: it is somehow common in golang projects to invoke those checks by default to enforce the coding style. If you only want to compile and skip checks, you can use make build
. Notice that only make release
will set the correct version. Please let me know if this solves your issue. I will extend the README to cover the topics you suggested.
@darnir I extended the README with some explanations. Please let me know if they suit your expectations.
Thanks @vrothberg
Especially the changes with v2.0.1 helped a bit.
I've updated the AUR package for Arch Linux for v2.0.1. However, I'm not sure if the PKGBUILD being used is the cleanest. If you have any ideas about Arch Linux packaging, I'd request a review of the PKGBUILD. It's mostly hacks to deal with my lack of knowledge about Go programs.
@darnir That's great. I had a look at the PKGBUILD and it's a really nice solution. I just suggest removing line 30 get get ./...
as all external dependencies are in the ./vendor
directory. Removing it should speed up the build a bit.
@vrothberg If I remove the go get ./...
as you suggested I end with with the following error:
go build -o ./build/vgrep -ldflags "-s -w -X main.version=2.0.1"
vgrep.go:22:2: cannot find package "github.com/vrothberg/vgrep/ansi" in any of:
/tmp/makepkg/vgrep/src/src/vgrep-2.0.1/vendor/github.com/vrothberg/vgrep/ansi (vendor tree)
/usr/lib/go/src/github.com/vrothberg/vgrep/ansi (from $GOROOT)
/tmp/makepkg/vgrep/src/src/github.com/vrothberg/vgrep/ansi (from $GOPATH)
vgrep.go:23:2: cannot find package "github.com/vrothberg/vgrep/colwriter" in any of:
/tmp/makepkg/vgrep/src/src/vgrep-2.0.1/vendor/github.com/vrothberg/vgrep/colwriter (vendor tree)
/usr/lib/go/src/github.com/vrothberg/vgrep/colwriter (from $GOROOT)
/tmp/makepkg/vgrep/src/src/github.com/vrothberg/vgrep/colwriter (from $GOPATH)
make: *** [Makefile:20: release] Error 1
@darnir Oh, that it is a problem that must be fixed in the PKGBUILD. Sorry for not spotting that.
The compilation error above stems from the source directory not following the required path convention of $GOPATH/src/github.com/vrothberg/vgrep
. Only then the packages can be resolved. What's happening at the moment is that go get ./...
will download vgrep/colwriter
and vgrep/ansi
from HEAD on github, which is bad as this source isn't part of the released tar. Please let me know if that works for you.