Home > Backend Development > Golang > How to install go's automatic reloading tool

How to install go's automatic reloading tool

藏色散人
Release: 2021-04-27 11:24:57
forward
2109 people have browsed it

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
Copy after login
After successful setting, use the following command to install air:

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

(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
Copy after login

To use air

just need to install it in your Just run
air
Copy after login
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!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template