diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-09-16 15:04:10 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-09-20 17:22:32 +0300 |
commit | d50a4db76b5926a6ab914d882e3f3a161f91d625 (patch) | |
tree | de5325b94be6ba2d73ec13011d3e64b6389cca80 | |
parent | 9a448cffad29418454e073955da124d4a7f8e84a (diff) |
Makefile: Use `go install` to install tool dependencies
Starting with Go 1.16, it is possible to use version suffixes for `go
install`. This gives us the possibility to instead tool dependencies
without having to play tricks via separate per-tool `go.mod` files like
we currently do, and is indeed the recommended way to install tools now.
Quoting the release notes [1]:
go install, with or without a version suffix (as described above),
is now the recommended way to build and install packages in module
mode. go get should be used with the -d flag to adjust the current
module's dependencies without building packages, and use of go get
to build and install packages is deprecated. In a future release,
the -d flag will always be enabled.
Adapt the Makefile to use `go install` instead of `go get` and get rid
of our previous workaround which created separate per-tool module
directories.
[1]: https://golang.org/doc/go1.16
-rw-r--r-- | Makefile | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -558,15 +558,9 @@ ${PROTOC}: ${TOOLS_DIR}/protoc.zip ${Q}rm -rf ${TOOLS_DIR}/protoc ${Q}unzip -DD -q -d ${TOOLS_DIR}/protoc ${TOOLS_DIR}/protoc.zip -# We're using per-tool go.mod files in order to avoid conflicts in the graph in -# case we used a single go.mod file for all tools. -${TOOLS_DIR}/%/go.mod: | ${TOOLS_DIR} - ${Q}mkdir -p $(dir $@) - ${Q}cd $(dir $@) && go mod init _build - ${TOOLS_DIR}/%: GOBIN = ${TOOLS_DIR} -${TOOLS_DIR}/%: ${TOOLS_DIR}/%.version ${TOOLS_DIR}/.%/go.mod - ${Q}cd ${TOOLS_DIR}/.$* && go get ${TOOL_PACKAGE}@${TOOL_VERSION} +${TOOLS_DIR}/%: ${TOOLS_DIR}/%.version + ${Q}go install ${TOOL_PACKAGE}@${TOOL_VERSION} ${PROTOC_GEN_GITALY}: proto | ${TOOLS_DIR} ${Q}go build -o $@ ${SOURCE_DIR}/proto/go/internal/cmd/protoc-gen-gitaly |