How to compile and build go from source
How to compile and build go from source — notes from the Go collection.
bash
cd ~/go-src/go
# Switch to the master branch
git checkout master
# Pull the latest commits
git pull origin master
cd src
# Set environment variables for the build
export CC=gcc
export GOROOT_BOOTSTRAP=$(go env GOROOT)
# Rebuild the toolchain
./make.bash
# This is usually unnecessary; stick to `../bin/go test ./time`
../bin/go test -v ./time/format_test.go ./time/format.go ./time/export_test.go
# 1. Navigate to the src directory
cd ~/go-src/go/src
# 2. Explicitly set GOROOT to the root of your source tree
# (This uses the absolute POSIX path, which MSYS2 translates correctly for the Windows go.exe)
export GOROOT=$(cd .. && pwd)
# 3. Clean the build cache to remove stale module data
../bin/go clean -cache
# Run the test using the package name
../bin/go test -v time -run Format
../bin/go test -bench=Format ./time
cd time
../../bin/go.exe test -test.fullpath=true -timeout 30s -run ^TestAppendInt$
../../bin/go.exe test -v -test.fullpath=true -timeout 30s -run ^TestFormat$go/README.md
Related articles
- HostingHow to export yaml from vultrTo view config · To list nodes
- GitTo create new branch from committed hash idTo push this new branch to the github
- HostingHow to Build & Run for Host NginxBuild the Image Run the Container Bound to Localhost Verify Host Port Security: Check that port 5000 is bound strictly to 127.0.0.1 and not 0.0.0.0: # 1. Symlink configuration if…
- DockerError response from daemon: conflict: unable to remove repository reference "postgres:15" (must force) - container d8c593fad145 is using its referenced image 9a18aed4ecddCheck whether it's running: If you no longer need it, remove it: If it's running, stop it first: Then remove the image: Option 2: Force remove the image Option 3: Find all…