Skip to content

Commit

Permalink
CI, docs: use go install instead of go get to install executables
Browse files Browse the repository at this point in the history
Use `go install` instead of `go get` to install executables. This is the
recommended installation method as of Go 1.17 and is no longer supported
with Go 1.18, see https://go.dev/doc/go-get-install-deprecation

While at it also update the installed version in some cases where
appropriate and drop the installation command for gomega from the
developer docs. Gomega it is not an executable but a library already
vendored in by Cilium.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
  • Loading branch information
tklauser authored and qmonnet committed Mar 28, 2022
1 parent a256a84 commit edb73b9
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-build-commits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- name: Install ginkgo
run: |
go get github.com/onsi/ginkgo/ginkgo@v1.12.1
go install github.com/onsi/ginkgo/ginkgo@cc0216944b25a88d3259699a029d4e601fb8a222 # v1.12.1
- name: Checkout code
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ jobs:
cilium_pod=$(kubectl -n kube-system get po -o name --field-selector=status.phase==Running -l 'k8s-app=cilium' -o jsonpath='{.items[0].metadata.name}' )
kubectl -n kube-system exec $cilium_pod -- sh -c "apt update && apt install curl -y"
kubectl -n kube-system exec $cilium_pod -- curl http://localhost:9090/metrics > metrics.prom
GO111MODULE=on go get github.com/prometheus/prometheus/cmd/promtool@e4487274853c587717006eeda8804e597d120340 # This is commit hash for v2.24.1
go install github.com/prometheus/prometheus/cmd/promtool@@e4487274853c587717006eeda8804e597d120340 # This is commit hash for v2.24.1
cat metrics.prom | $HOME/go/bin/promtool check metrics
- name: Capture cilium-sysdump
Expand Down
4 changes: 1 addition & 3 deletions .travis/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ install_clang

export PATH="/usr/local/clang/bin:$PATH"

# disable go modules to avoid downloading all dependencies when doing go get
GO111MODULE=off go get golang.org/x/tools/cmd/cover
GO111MODULE=off go get github.com/mattn/goveralls
go install github.com/mattn/goveralls@a36c7ef8f23b2952fa6e39663f52107dfc8ad69d # v0.0.11

# Install golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.31.0
52 changes: 25 additions & 27 deletions Documentation/contributing/development/dev_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,31 @@ Requirements
You need to have the following tools available in order to effectively
contribute to Cilium:

+--------------------------------------------------------------+------------------------------+---------------------------------------------------------+
| Dependency | Version / Commit ID | Download Command |
+==============================================================+==============================+=========================================================+
| git | latest | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+---------------------------------------------------------+
| clang | >= 10.0 (latest recommended) | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+---------------------------------------------------------+
| llvm | >= 10.0 (latest recommended) | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+---------------------------------------------------------+
| `go <https://golang.org/dl/>`_ | |GO_RELEASE| | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+---------------------------------------------------------+
+ `ginkgo <https://github.com/onsi/ginkgo>`__ | >= 1.4.0 | ``go get -u github.com/onsi/ginkgo/ginkgo`` |
+--------------------------------------------------------------+------------------------------+---------------------------------------------------------+
+ `gomega <https://github.com/onsi/gomega>`_ | >= 1.2.0 | ``go get -u github.com/onsi/gomega`` |
+--------------------------------------------------------------+------------------------------+---------------------------------------------------------+
+ `golangci-lint <https://github.com/golangci/golangci-lint>`_ | >= v1.27 | ``go get -u github.com/golangci/golangci-lint`` |
+--------------------------------------------------------------+------------------------------+---------------------------------------------------------+
+ `cfssl <https://github.com/cloudflare/cfssl>`_ | >= v1.6.0 | ``go get -u github.com/cloudflare/cfssl/cmd/cfssl`` |
+--------------------------------------------------------------+------------------------------+---------------------------------------------------------+
+ `cfssljson <https://github.com/cloudflare/cfssl>`_ | >= v1.6.0 | ``go get -u github.com/cloudflare/cfssl/cmd/cfssljson`` |
+--------------------------------------------------------------+------------------------------+---------------------------------------------------------+
+ `Docker <https://docs.docker.com/engine/installation/>`_ | OS-Dependent | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+---------------------------------------------------------+
+ `Docker-Compose <https://docs.docker.com/compose/install/>`_ | OS-Dependent | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+---------------------------------------------------------+
+ python3-pip | latest | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+---------------------------------------------------------+
+--------------------------------------------------------------+------------------------------+-----------------------------------------------------------------+
| Dependency | Version / Commit ID | Download Command |
+==============================================================+==============================+=================================================================+
| git | latest | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+-----------------------------------------------------------------+
| clang | >= 10.0 (latest recommended) | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+-----------------------------------------------------------------+
| llvm | >= 10.0 (latest recommended) | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+-----------------------------------------------------------------+
| `go <https://golang.org/dl/>`_ | |GO_RELEASE| | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+-----------------------------------------------------------------+
+ `ginkgo <https://github.com/onsi/ginkgo>`__ | >= 1.4.0 | ``go install github.com/onsi/ginkgo/ginkgo@latest`` |
+--------------------------------------------------------------+------------------------------+-----------------------------------------------------------------+
+ `golangci-lint <https://github.com/golangci/golangci-lint>`_ | >= v1.27 | ``go install github.com/golangci/golangci-lint@latest`` |
+--------------------------------------------------------------+------------------------------+-----------------------------------------------------------------+
+ `cfssl <https://github.com/cloudflare/cfssl>`_ | >= v1.6.0 | ``go install github.com/cloudflare/cfssl/cmd/cfssl@latest`` |
+--------------------------------------------------------------+------------------------------+-----------------------------------------------------------------+
+ `cfssljson <https://github.com/cloudflare/cfssl>`_ | >= v1.6.0 | ``go install github.com/cloudflare/cfssl/cmd/cfssljson@latest`` |
+--------------------------------------------------------------+------------------------------+-----------------------------------------------------------------+
+ `Docker <https://docs.docker.com/engine/installation/>`_ | OS-Dependent | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+-----------------------------------------------------------------+
+ `Docker-Compose <https://docs.docker.com/compose/install/>`_ | OS-Dependent | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+-----------------------------------------------------------------+
+ python3-pip | latest | N/A (OS-specific) |
+--------------------------------------------------------------+------------------------------+-----------------------------------------------------------------+

For `integration_testing`, you will need to run ``docker`` without privileges.
You can usually achieve this by adding your current user to the ``docker``
Expand Down
2 changes: 1 addition & 1 deletion images/builder/build-go-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ mkdir /src

cd /src

GO111MODULE=on go get github.com/gordonklaus/ineffassign@1003c8bd00dc2869cb5ca5282e6ce33834fed514
go install github.com/gordonklaus/ineffassign@1003c8bd00dc2869cb5ca5282e6ce33834fed514
4 changes: 2 additions & 2 deletions test/consul/gen-cert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ gen() {
if [ -z "$(which cfssl)" ]; then
echo "Please install the cfssl utility and make sure you have it in your \$PATH"
echo "You can install it in your \$GOPATH by running:"
echo "go get -u github.com/cloudflare/cfssl/cmd/cfssl"
echo "go install github.com/cloudflare/cfssl/cmd/cfssl@latest"
exit -1
fi

if [ -z "$(which cfssljson)" ]; then
echo "Please install the cfssljson utility and make sure you have it in your \$PATH"
echo "You can install it in your \$GOPATH by running:"
echo "go get -u github.com/cloudflare/cfssl/cmd/cfssljson"
echo "go install github.com/cloudflare/cfssl/cmd/cfssljson@latest"
exit -1
fi

Expand Down
5 changes: 2 additions & 3 deletions test/packet/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ sudo ln -s /usr/local/go/bin/* /usr/local/bin/
go version
sudo mkdir /go/
export GOPATH=/go/
go get -u github.com/google/gops
go get -u github.com/onsi/ginkgo/ginkgo
go get -u github.com/onsi/gomega/...
go install github.com/google/gops@db6b6e9ba07629c90654a7720c452fb44a864dfb # v0.3.22
go install github.com/onsi/ginkgo/ginkgo@1ed6486197ba2a007858c59bdc4d1522631025d5 # v2.1.3
sudo ln -sf /go/bin/* /usr/local/bin/

echo 'cd /root/go/src/github.com/cilium/cilium' >> /root/.bashrc
2 changes: 1 addition & 1 deletion tools/dev-doctor/rootcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func rootCmdRun(cmd *cobra.Command, args []string) {
versionArgs: []string{"version"},
versionRegexp: regexp.MustCompile(`Ginkgo Version (\d+\.\d+\S*)`),
minVersion: &semver.Version{Major: 1, Minor: 4, Patch: 0},
hint: `Run "go get -u github.com/onsi/ginkgo/ginkgo".`,
hint: `Run "go install github.com/onsi/ginkgo/ginkgo@latest".`,
},
// FIXME add gomega check?
&binaryCheck{
Expand Down

0 comments on commit edb73b9

Please sign in to comment.