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

      # Go 1.15 及之前版本
      GO111MODULE=on go get -u github.com/tal-tech/go-zero/tools/goctl@cli
    
      # Go 1.16 及以后版本
      go install github.com/tal-tech/go-zero/tools/goctl@cli
    
  • 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.

      $ sudo vim /etc/paths
    

    Add the following in the last line

      $GOPATH/bin
    

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

  • Installation result verification

      $ goctl -v
    
      goctl version 1.1.4 darwin/amd64
    

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

Copyright © 2019-2021 go-zero all right reserved,powered by GitbookLast UpdateTime: 2021-12-05 09:48:50

results matching ""

    No results matching ""