Skip to content

Instantly share code, notes, and snippets.

@gourytch
Created February 10, 2026 12:56
Show Gist options
  • Select an option

  • Save gourytch/8e2b4ca07202e12eb9f3a6ff351c6af4 to your computer and use it in GitHub Desktop.

Select an option

Save gourytch/8e2b4ca07202e12eb9f3a6ff351c6af4 to your computer and use it in GitHub Desktop.
GOST v3 cross-compiling
#! /bin/bash
: ${GOOS:=linux}
: ${GOARCH:=amd64}
: ${EXE:=./gost-${GOOS}-${GOARCH}}
PAIR="${GOOS}/${GOARCH}"
if ! go tool dist list | grep -q "${PAIR}"
then
echo "unsupported pair: ${PAIR}"
exit 1
fi
echo "=== BUILD FOR: ${PAIR}"
echo "=== UPDATE SOURCES ==="
test -d gost || git clone https://github.com/go-gost/gost ./gost
cd ./gost
git pull
echo "=== UPDATE MODULES ==="
GOOS=${GOOS} GOARCH=${GOARCH} go mod tidy -v
echo "=== BUILD ${EXE} ==="
GOOS=${GOOS} GOARCH=${GOARCH} go build -v -o ${EXE} \
-ldflags "-w -s -X main.version=stripped -buildid= -extldflags=static" \
-buildvcs=false -a -installsuffix cgo -trimpath \
./cmd/gost
file ${EXE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment