Can golang be hot updated?

Release: 2020-03-27 11:13:24
Original
4957 people have browsed it

Can golang be hot updated?

golang can be hot updated.

Let’s take a look at using go realize to implement hot updates:

Install realize

Because it was installed in the previous project Gin is used as a web framework, so the routes have been written for later testing.

go get github.com/oxequa/realize
Copy after login

During installation, you may be prompted to fail to install a certain package (starting with golang.org). Don’t panic. These packages can be cloned from the golang warehouse and placed in $GOPATH/src/golang.org /x directory.

Configuration

Run realize init for step-by-step configuration. You can also press Enter all the time, and then refer to my configuration and modify it. The name and path under the schema Please write according to the actual situation. If your machine is a Mac, please replace the process killing command with pkill. This step is very important, otherwise Gin will keep prompting like this when recompiling, causing the hot update to fail.

[GIN-debug] [ERROR] listen tcp :8080: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted
Copy after login
settings: files: outputs: status: false path: "" name: .r.outputs.log logs: status: false path: "" name: .r.logs.log errors: status: true path: "" name: .r.errors.log legacy: force: false interval: 100ms server: status: true open: false port: 8080 host: http://localhost schema: - name: gin_app path: E:/WorkPlace/Go/app/gin_app/ commands: # clean: # status: true # vet: # status: true # fmt: # status: true # test: # status: true # generate: # status: true install: status: true # build: # status: true run: status: true watcher: extensions: - go paths: - / scripts: - type: before command: tskill gin_app output: true ignored_paths: - .git - .realize - vendor
Copy after login

Modify the realize package

Execute the following commands in sequence

cd /go/src/github.com/oxequa/realize git fetch git checkout v2.0.2 go get github.com/oxequa/realize
Copy after login

Go to the project directory and run realize start. Hot update is also normal. .

For more golang knowledge, please pay attention to thegolang tutorialcolumn on the PHP Chinese website.

The above is the detailed content of Can golang be hot updated?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!