Skip to content

Use 'go install' instead of 'go get' to install tools

M. Ángel requested to merge jimen0/gitlab-runner:use-go-install into main

I was trying to build gitlab-runner as part of my tests for your Bug Bounty program and noticed it didn't work because I was using gotip (> 1.18) and thus go get command only downloaded the code but never built it. This led to my system not having the required dependencies in order to build gitlab-runner.

This MR makes the project use go install instead of the legacy go get to build the dependencies.

I tried to pin versions of the projects you depend on to the contents of their master/main branch at time I worked on this MR since some of them had additional changes after the latest version was tagged.

Starting Go 1.18, go get doesn't build any code. It works always as if -d flag was supplied and just downloads the code. See Go 1.18 release notes for additional details. https://go.dev/doc/go1.18#:~:text=possibly%20several%20GBs).-,Go,-command

I'm submitting this MR without opening an issue prior to it since I assume GitLab will always work on maintained Go versions. Since these now are 1.17 and 1.18, the go install module@version syntax is always supported. From the release notes I linked above:

This form of go install was added in Go 1.16, so projects supporting older versions may need to provide install instructions for both go install and go get. go get now reports an error when used outside a module, since there is no go.mod file to update. In GOPATH mode (with GO111MODULE=off), go get still builds and installs packages, as before.

Haven't tested this too much since I'm still getting used to the codebase. Please, feel free to close this without further comments if you wanna stick to older Go versions.

Regards,

Edited by Arran Walker

Merge request reports