go

info
namego
full namego
aliasesgo, golang
tagsgo, golang

Go language toolchain, module management, build, test, and installation notes.

go is the main CLI for building, testing, formatting, and managing Go modules.

wget https://go.dev/dl/go1.26.4.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.26.4.linux-amd64.tar.gz
The tar archive installs Go under /usr/local/go. If an older manual install exists in the same location, clean it up first to avoid mixed files.
echo 'export GOPATH=$HOME/go' >> ~/.zshrc
echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >> ~/.zshrc
The user-provided example used $HOME/go/bin directly as GOPATH, but the usual layout is GOPATH=$HOME/go and then add $GOPATH/bin to PATH.
go <command> [arguments]
  • go <command> [flags] [arguments]
  • go mod init module_name 새로운 프로젝트 시작. go.mod 파일 생성.
  • go mod tidy 실제로 import 하는 패키지를 go.mod에 반영하고 쓰지 않는 의존성을 정리.
  • go mod vendor 외부 의존성 소스를 프로젝트 내부 vendor/ 디렉토리로 복사.
  • go get package_path 패키지를 내려받고 go.mod에 추가.
  • go get package_path@version 특정 버전 지정.
  • go run filename.go 컴파일 후 즉시 실행.
  • go run . 현재 모듈 실행.
  • go build 컴파일.
  • go install 패키지를 빌드하고 실행 파일을 $GOPATH/bin에 설치. 예: go install github.com/zerotymer/package@latest
  • go test *_test.go 파일을 찾아 테스트 실행.
  • go fmt Go 표준 스타일로 코드 포맷 정리.
  • go vet 정적 분석으로 잠재적인 실수를 탐지.
  • go version 버전 확인.
  • go env 환경 설정 확인.
  • go clean 객체 파일과 캐시 삭제.
go version
go env
go mod init example.com/hello
go mod tidy
go run .
go build
go test ./...

go --help

  • codex:: 2026-06-14 Reorganized the Go page into CLI reference format and added install and shell environment setup notes.
  • /home/u613600155/domains/cli.zerotymer.net/public_html/data/pages/go.txt
  • 마지막으로 수정됨: 2026/06/14 14:03
  • 저자 127.0.0.1