From 0ab9f1e1bea5a57a496feed1a82f7b43d276a75e Mon Sep 17 00:00:00 2001 From: cclohmar Date: Sat, 30 May 2026 16:10:42 +0000 Subject: [PATCH] fix: go build module cache permission + README sudo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Set GOMODCACHE + GOPATH to /opt/receiptnext/.go (writable location) - Removes sudo from README one-liner — script self-elevates - Build now works for users whose home directory isn't writable --- README.md | 2 +- install.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4c0137b..23653d9 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ ## 🚀 One-Command Install ```bash -sudo bash -c "$(curl -fsSL https://git.lohmar.co.uk/cclohmar/ReceiptNext/raw/branch/main/install.sh)" +bash -c "$(curl -fsSL https://git.lohmar.co.uk/cclohmar/ReceiptNext/raw/branch/main/install.sh)" ``` Or from a local clone: diff --git a/install.sh b/install.sh index 38c368b..d963e43 100755 --- a/install.sh +++ b/install.sh @@ -126,6 +126,10 @@ esac if command -v go &>/dev/null; then info "Building binary from source (pure Go, no CGO)..." + # Use a writable module cache — the user's home may not be writable + export GOMODCACHE="${INSTALL_DIR}/.go/mod" + export GOPATH="${INSTALL_DIR}/.go" + mkdir -p "${GOMODCACHE}" 2>/dev/null || sudo_if mkdir -p "${GOMODCACHE}" CGO_ENABLED=0 go build -ldflags="-s -w" -o app . else info "Go not found — downloading pre-built binary..."