1DOLLY 72PACKAGE go3REQUIRES HOST runtime@04# go downloads modules with net/http, which records http@0.5REQUIRES HOST http@067# Go as Dolly builds it, in its GOROOT: the seed's go command compiles the8# toolchain and the standard library from the seed's sources again, every9# package (-a), with the flags of upstream's release build (cmd/dist's10# toolenv), and installs it over the seed's. The build fails unless every11# command is, byte for byte, the seed's. The commands start it by its own12# path, from which it finds its GOROOT.13FROM /v0.1.4/demos/go/Dollyfile-go-sdk 33104d7b1d04d22e554cbe5ad917ccde932c943ca879a6e61e054a16bbfe895b14REQUIRES TOOL go15SLOP mkdir -p /tmp/seed16SLOP cp -R /usr/lib/go/pkg/tool/dolly_wasm64 /tmp/seed/tool17SLOP cp -R /usr/lib/go/bin /tmp/seed/bin18# Two compiles at a time, each held near 2 GiB: compiling cmd/compile/internal/ssa19# can grow a process to 3.9 GiB with the default collector (1.8 GB natively).20# A spawn waits for a slot beside at most one compile, so the processes stay21# under the 4 GiB a spawn is admitted below, and the build in its 6 GB.22SLOP CWD /usr/lib/go/src CGO_ENABLED=0 GOCACHE=/tmp/go-cache GOMEMLIMIT=2GiB GOFLAGS='-trimpath -ldflags=-w -gcflags=cmd/...=-dwarf=false' go install -a -p 2 cmd/go cmd/gofmt cmd/asm cmd/cgo cmd/compile cmd/cover cmd/fix cmd/link cmd/preprofile cmd/vet23# The rebuilt toolchain compares itself with the seed.24FILE /tmp/same/main.go25    // Fails unless each file of the first directory is, byte for byte, the26    // file of its name in the second.27    package main28    29    import (30    	"bytes"31    	"fmt"32    	"os"33    	"path/filepath"34    )35    36    func main() {37    	entries, err := os.ReadDir(os.Args[1])38    	if err != nil {39    		panic(err)40    	}41    	for _, entry := range entries {42    		seed, seedErr := os.ReadFile(filepath.Join(os.Args[1], entry.Name()))43    		built, builtErr := os.ReadFile(filepath.Join(os.Args[2], entry.Name()))44    		if seedErr != nil || builtErr != nil || !bytes.Equal(seed, built) {45    			fmt.Fprintf(os.Stderr, "%s is not the seed's\n", entry.Name())46    			os.Exit(1)47    		}48    	}49    	fmt.Printf("%d programs equal the seed's\n", len(entries))50    }51SLOP GOCACHE=/tmp/go-cache go run /tmp/same/main.go /tmp/seed/tool /usr/lib/go/pkg/tool/dolly_wasm6452SLOP GOCACHE=/tmp/go-cache go run /tmp/same/main.go /tmp/seed/bin /usr/lib/go/bin53SLOP go version545556FILE /usr/bin/go57    #!/bin/slop58    /usr/lib/go/bin/go "$@"59FILE /usr/bin/gofmt60    #!/bin/slop61    /usr/lib/go/bin/gofmt "$@"62EXPORTS TOOL go63EXPORTS TOOL gofmt64# go.env's GOTOOLCHAIN=auto would fetch newer toolchains, which do not run here.65EXPORTS ENV GOTOOLCHAIN local66# runtime.NumCPU is 1, so go would compile one package at a time; four halve67# the time of a small module's first build.68EXPORTS ENV GOFLAGS -p=469EXPORTS FOLDER go-root /usr/lib/go70FILE /usr/share/man/cat1/go.171    go: the Go toolchain (Go 1.27.3) for GOOS=dolly GOARCH=wasm64, built inside72    Dolly from its pinned sources.73    74      go build              compiles a package and its dependencies75      go run main.go        compiles and runs a program76      gofmt -l .            lists files whose formatting differs77    78    Programs are pure Go: there is no cgo, and they run single-threaded.79    go builds four packages at a time (GOFLAGS=-p=4).80    net/http goes through the page's HTTP broker (its policy, and CORS), so81    go get works with proxy.golang.org; net's sockets reach nothing.82    signal.Notify receives the kernel's signals; syscall.Exec replaces the83    program. Upstream's documentation: https://go.dev/doc/84