Skip to content

Commit

Permalink
use up-to-date golang (#218)
Browse files Browse the repository at this point in the history
While running a full `make fmt-build`, I got some failures with
installer scripts for golang formatters. This fixes the problem by
installing an up-to-date golang instead of the version available in
ubuntu 20.04.

The ppa used here, `longsleep/golang-backports` is
[recommended](https://github.com/golang/go/wiki/Ubuntu) by the Go
project.

---------

Co-authored-by: Radon Rosborough <[email protected]>
  • Loading branch information
edslocomb and raxod502 authored Oct 7, 2023
1 parent afa0e54 commit 35f72f6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 3 additions & 1 deletion test/formatters/install-common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euxo pipefail

export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y ca-certificates curl gnupg lsb-release
apt-get install -y ca-certificates curl gnupg lsb-release software-properties-common

curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -

Expand All @@ -15,6 +15,8 @@ tee -a /etc/apt/sources.list.d/nodejs.list >/dev/null <<EOF
deb [arch=amd64] https://deb.nodesource.com/${node_repo} ${ubuntu_name} main
EOF

add-apt-repository -n ppa:longsleep/golang-backports

apt-get update

packages="
Expand Down
9 changes: 3 additions & 6 deletions test/formatters/installers/gofumpt.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Require at least version 1.17 of go
# https://github.com/mvdan/gofumpt/issues/231
curl -OL https://golang.org/dl/go1.19.3.linux-amd64.tar.gz
sudo tar -C /usr/local -xvf go1.19.3.linux-amd64.tar.gz
/usr/local/go/bin/go install mvdan.cc/gofumpt@latest
cp -L "$HOME/go/bin/gofumpt" /usr/local/bin/
apt-get install -y golang-go
go install mvdan.cc/gofumpt@latest
cp -L "$HOME/go/bin/gofumpt" /usr/local/bin/
4 changes: 2 additions & 2 deletions test/formatters/installers/goimports.bash
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
apt-get install -y golang-go
go get -u golang.org/x/tools/cmd/goimports
cp -L "$HOME/go/bin/goimports" /usr/local/bin/
go install golang.org/x/tools/cmd/goimports@latest
cp -L "$HOME/go/bin/goimports" /usr/local/bin/

0 comments on commit 35f72f6

Please sign in to comment.