Home>Article>Backend Development> How to install go’s automatic reloading tool

How to install go’s automatic reloading tool

藏色散人
藏色散人 forward
2021-04-27 11:24:57 1999browse

The following tutorial column will introduce you to the automatic reloading tool installation of go. I hope it will be helpful to friends who need it!

Go is a compiled language. Compiled languages have many benefits, such as:

Easy deployment

Detect errors early
  • High execution efficiency
  • However, this also means that after the code is modified, it needs to be recompiled to see the changes, which brings a lot of inconvenience to our local development.

Installing air

Domestic access to the external network is unstable. In order for the installation to proceed smoothly, we need to set up Go Proxy first. Execute the following command:
go env -w GOPROXY=https://goproxy.cn
After successful setting, use the following command to install air:

GO111MODULE=on go get -u github.com/cosmtrek/air

(under windows github.com/cosmtrek/air/releases Download here and put it into the Go installation directory bin directory under the command, rename it to air.exe)

The first GO111MODULE=on only enables Go Module for the current command. After it is enabled, we can use Go Proxy for acceleration.

Note: If you encounter errors during the above operations, please first ensure that your Go version is 1.15. Use this command to check the go version

After the installation is successful, use the following command to check:

air -v __ _ ___ / /\ | | | |_)/_/--\ |_| |_| \_ v1.12.1 // live reload for Go apps, with Go1.14.0

To use air

just need to install it in your Just run
air
in the project root directory.

The above is the detailed content of How to install go’s automatic reloading tool. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete