goctl installation
Overview
goctl is a go-zero’s built-in handcuffle that is a major lever to increase development efficiency, generating code, document, deploying k8s yaml, dockerfile, etc.
Golang Direct
::note
This installation method is used for Golang
, no operating system is required. :::
1.1 View go version
$ go version
1.2. go [get, install]
If the go version is before
1.16
, use the following command to install:$ GO111MODULE=on go get -u github.com/zeromicro/go-zero/tools/goctl@latest
If the go version is
1.16
and later, use the following command to install:$ GO111MODULE=on go install github.com/zeromicro/go-zero/tools/goctl@latest
1.3. Validation
Open the terminal input below to verify the installation successfully:
$ goctl --version
Manual Installation
2.1 Downloads
Windows Intel x86-64 bit processorgoctl-v1.4.3-windows-amd64.zip(14.7MB)
Windows Intel x86-32 bit processorgoctl-v1.4.3-windows-386.zip(14MB)
Support macOS Apple 64-bit processorgoctl-v1.4.3-darwin-arm64.tar.gz(14.5MB)
Support macOS 64-bit processorgoctl-v1.4.3-darwin-amd64.tar.gz(14.7MB)
Support Linux 64 bit processorgoctl-v1.4.3-linux-amd64.tar.gz(14.8MB)
Support Linux 32 bit processorgoctl-v1.4.3-linux-386.tar.gz(13.9MB)
Other versions and operating systems can to go to Github to choose.
2.2 Installation
Extract downloads and move them to $GOBIN
directory, see $GOBIN
directory:
$ go env GOPATH
GOBIN
is $GOPATH/bin
, if you $GOPATH
do not $PATH
you need to add it to $PATH
.
2.3. Validation
Once installed, you can perform the following instructions to verify whether you have installed successfully:
$ goctl --version
Docker Installation
3.1 pull & run
- amd64架构
- arm64(M1)架构
$ docker pull kevinwan/goctl
$ docker run --rm -it -v `pwd`:/app kevinwan/goctl goctl --help
$ docker pull kevinwan/goctl:latest-arm64
$ docker run --rm -it -v `pwd`:/app kevinwan/goctl:latest-arm64 goctl --help
3.2 Validation
Open the terminal input with the following instructions to verify the installation successfully:
- amd64架构
- arm64(M1)架构
$ goctl docker run --rm -it -v `pwd`:/app kevinwan/goctl:latest goctl --version
$ goctl docker run --rm -it -v `pwd`:/app kevinwan/goctl:latest-arm64 goctl --version