Goctl Installation

[!TIP] This document is machine-translated by Google. If you find grammatical and semantic errors, and the document description is not clear, please PR

Foreword

Goctl plays a very important role in the development of the go-zero project. It can effectively help developers greatly improve development efficiency, reduce code error rate, and shorten the workload of business development. For more introductions to Goctl, please read Goctl Introduction ,

Here we strongly recommend that you install it, because most of the follow-up demonstration examples will use goctl for demonstration.

Install(mac&linux)

  • download&install
    1. GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/tal-tech/go-zero/tools/goctl
  • Environmental variable detection

    The compiled binary file downloaded by go get is located in the $GOPATH/bin directory. Make sure that $GOPATH/bin has been added to the environment variable.

    1. $ sudo vim /etc/paths

    Add the following in the last line

    1. $GOPATH/bin

    [!TIP] $GOPATH is the filepath on your local machine

  • Installation result verification

    1. $ goctl -v
    1. goctl version 1.1.4 darwin/amd64

[!TIP] For windows users to add environment variables, please Google by yourself.