Linux command
go-install 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Install a package from current module
go install
Install specific package
go install [package]
Install latest version of a tool
go install [example.com/tool]@latest
Install specific version
go install [example.com/tool]@v1.2.3
Install with verbose output
go install -v [package]
说明
go install compiles and installs packages and their dependencies. Executables are installed to the directory named by the GOBIN environment variable, defaulting to $GOPATH/bin or $HOME/go/bin. When used with an @version suffix, it installs in module-aware mode regardless of the current directory, ignoring any go.mod present.
参数
- -v
- Print package names as compiled.
- -n
- Print commands without executing.
- -x
- Print commands as executed.
- @version
- Install specific version (latest, v1.2.3, etc.).
FAQ
What is the go-install command used for?
go install compiles and installs packages and their dependencies. Executables are installed to the directory named by the GOBIN environment variable, defaulting to $GOPATH/bin or $HOME/go/bin. When used with an @version suffix, it installs in module-aware mode regardless of the current directory, ignoring any go.mod present.
How do I run a basic go-install example?
Run `go install` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -v do in go-install?
Print package names as compiled.