Skip to content

Commit

Permalink
Fix Github Actions tests workflow on newer versions of Ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanmaric committed Jul 10, 2023
1 parent 4591bcc commit ea12d81
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -i {0}
shell: 'script -q -e -c "bash -i -eo pipefail {0}"'

steps:
- name: Checkout code
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Add description and website to help command
- Fix Github Actions tests workflow on newer versions of Ubuntu

## 0.9.1 - 2022-10-23

Expand Down
32 changes: 15 additions & 17 deletions bin/g
Original file line number Diff line number Diff line change
Expand Up @@ -588,24 +588,22 @@ set_version() {
error_and_abort "Version $version is not available. Use 'g install $version' to install it."
fi

if [ "$version" != "$active" ]; then
if [ ! -e "$dir/g.lock" ]; then
for file in "$dir/"*; do
if [ -L "${GOROOT:?}/$(basename "$file")" ]; then
rm "${GOROOT:?}/$(basename "$file")"
elif [ -e "${GOROOT:?}/$(basename "$file")" ]; then
# enable seamless upgrade to symlink behavior
rm -rf "${GOROOT:?}/$(basename "$file")"
fi
ln -sf "$file" "${GOROOT:?}/$(basename "$file")"
done
if [ ! -e "$dir/g.lock" ]; then
for file in "$dir/"*; do
if [ -L "${GOROOT:?}/$(basename "$file")" ]; then
rm "${GOROOT:?}/$(basename "$file")"
elif [ -e "${GOROOT:?}/$(basename "$file")" ]; then
# enable seamless upgrade to symlink behavior
rm -rf "${GOROOT:?}/$(basename "$file")"
fi
ln -sf "$file" "${GOROOT:?}/$(basename "$file")"
done

for file in "$dir/bin/"*; do
ln -sf "$GOROOT/bin/$(basename "$file")" "$GOPATH/bin/"
done
else
error_and_abort "version $version installation might be corrupted"
fi
for file in "$dir/bin/"*; do
ln -sf "$GOROOT/bin/$(basename "$file")" "$GOPATH/bin/"
done
else
error_and_abort "version $version installation might be corrupted"
fi
}

Expand Down

0 comments on commit ea12d81

Please sign in to comment.