Skip to content

Commit

Permalink
try unsetting/resetting go111module instead, plus debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-mm committed Sep 28, 2023
1 parent 4a67cd9 commit 11bc700
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,26 @@ function initialize {
## Reimplement ascii graph when we find a better library
# install go ascii

# sending the error to /dev/null because this returns with the following error normally:
# no required module provides package github.com/guptarohit/asciigraph/cmd/asciigraph: go.mod file not found in current directory or any parent directory; see 'go help modules'
# but the module works perfectly fine despite this error, and I don't think we should `go mod init` as we are not building a go module
if [[ $install_go == true ]]; then
echo "GO ENV:"
go env
echo "GO111MODULE Before: $GO111MODULE"
# Save the original value of GO111MODULE (if it was set)
original_go111module="${GO111MODULE:-}"

# Temporarily unset GO111MODULE to avoid module checks
unset GO111MODULE

if go install github.com/guptarohit/asciigraph/cmd/asciigraph@latest 2>/dev/null; then
ascii_graph_path=$(go list -f '{{.Target}}' github.com/guptarohit/asciigraph/cmd/asciigraph)
echo "ascii_graph_path: $ascii_graph_path"
else
echo "Failed to install asciigraph. Continuing without it."
fi

# Restore GO111MODULE to its original value (if it was set)
export GO111MODULE="$original_go111module"
echo "GO111MODULE After: $GO111MODULE"
fi

# check for gcc
Expand Down

0 comments on commit 11bc700

Please sign in to comment.