Bash
public
Go Module Check
Share this script safely, inspect its metadata, and copy the exact command you need.
Ready to run
One-liner
curl -fsSL https://runny.sh/r/YAG7CX2VSWQK | bash
Current version: 1.1 · Updated by Godmode · 2026-09-07 02:38:59.739
At a glance
Script metadata
Readable before runnable
Preview
#!/usr/bin/env bash
# Go module check
# Read-only: go env GOPATH/version, and go list -m when go.mod exists. No downloads.
# Exit 0 if the toolchain is usable, 1 if GOPATH/module info is incomplete, 2 if go is missing.
# Hosted on Runny.sh. Review the script page before you run it.
set -u
status=0
note() { printf '%s\n' "$*"; }
bump() {
case $1 in
crit) status=2 ;;
warn) [ "$status" -lt 1 ] && status=1 ;;
esac
}
note "=== Go module / toolchain ==="
note "Cwd: $(pwd)"
if ! command -v go >/dev/null 2>&1; then
note "go: not found in PATH"
note "Result: CRITICAL"
exit 2
fi
ver=$(go env GOVERSION 2>/dev/null || true)
gopath=$(go env GOPATH 2>/dev/null || true)
goroot=$(go env GOROOT 2>/dev/null || true)
note "Version: ${ver:-unknown}"
note "GOROOT: ${goroot:-unknown}"
note "GOPATH: ${gopath:-unknown}"
if [ -z "${ver}" ] || [ -z "${gopath}" ]; then
note " WARNING: go env did not return GOPATH/version"
bump warn
fi
if [ -f go.mod ]; then
note ""
note "go.mod: present"
if mods=$(go list -m 2>&1); then
note "Module: ${mods}"
note " OK"
else
note "$mods"
note " WARNING: go list -m failed (offline or malformed go.mod)"
bump warn
fi
else
note "go.mod: not in cwd (toolchain-only check)"
fi
note ""
case $status in
0) note "Result: HEALTHY" ;;
1) note "Result: WARNING" ;;
*) note "Result: CRITICAL" ;;
esac
exit "$status"
Raw endpointhttps://runny.sh/r/YAG7CX2VSWQK
See something unsafe?
Report this script
Tell us why it should come down. Anyone can also report a URL at /abuse.