<commit_before>#!/bin/sh -e

SYSTEMS=(windows linux freebsd darwin)
ARCHS=(amd64 386)

clean=$(git status --porcelain --untracked-files=no)
if [ -n "$clean" ]; then
   echo "There are uncommited changes"
   exit 1
fi

rev=$(git describe --tags --always)
if [ -e "$rev" ]; then
    rm -rf "$rev"
fi
mkdir "$rev"

echo "Revision is ${rev}"
for os in ${SYSTEMS[@]}; do
    for arch in ${ARCHS[@]}; do
        echo "Building GOOS=$os GOARCH=$arch..."
        out="staticcheck_${os}_${arch}"
        if [ $os = "windows" ]; then
            out="${out}.exe"
        fi
        CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -o "${rev}/${out}" honnef.co/go/tools/cmd/staticcheck
        (
            cd "$rev"
            sha256sum "$out" > "$out".sha256
        )
    done
done

(
    cd "$rev"
    sha256sum -c --strict *.sha256
)<commit_msg>dist: update build script for Go modules<commit_after>#!/bin/sh -e

SYSTEMS=(windows linux freebsd darwin)
ARCHS=(amd64 386)

rev="$1"
if [ -z "$rev" ]; then
    echo "Usage: $0 <version>"
    exit 1
fi


mkdir "$rev"
d=$(realpath "$rev")

wrk=$(mktemp -d)
trap "{ rm -rf \"$wrk\"; }" EXIT
cd "$wrk"

go mod init foo
GO111MODULE=on go get -d honnef.co/go/tools/cmd/staticcheck@"$rev"

for os in ${SYSTEMS[@]}; do
    for arch in ${ARCHS[@]}; do
        echo "Building GOOS=$os GOARCH=$arch..."
        out="staticcheck_${os}_${arch}"
        if [ $os = "windows" ]; then
            out="${out}.exe"
        fi

        CGO_ENABLED=0 GOOS=$os GOARCH=$arch GO111MODULE=on go build -o "$d/$out" honnef.co/go/tools/cmd/staticcheck
        (
            cd "$d"
            sha256sum "$out" > "$out".sha256
        )
    done
done

(
    cd "$d"
    sha256sum -c --strict *.sha256
)
{'fraction_non_alphanumeric': 0.17900874635568514, 'fraction_numerical': 0.026822157434402333, 'mean_word_length': 2.3846153846153846, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2040530', 'n_tokens_mistral': 679, 'n_tokens_neox': 624, 'n_words': 175}