Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How the golang project is deployed to the server to run

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the golang project deployment to the server how to run, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

If you want the project to execute in the background: execute nohup. / main &, so that the program can run in the background

In the case of the windows development environment, after the windows development, use the cmd window to enter the directory of the project that needs to be compiled

Execution

Set GOOS=linux

Then compile, and ru gets the result: user

Go build

After the compilation is completed, the user of the binary file is placed in the specified directory of the linux environment through xshell (of course, the necessary go runtime environment has been installed in the linux environment). The user cannot be executed at this time, so you need to execute the following command:

Chmod 755 user

The user now becomes an executable file. You can use the command to start:

Nohup. / user &

You can also use the git bash window directly:

ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build thank you for reading this article carefully. I hope the article "how to deploy the golang project to the server" shared by the editor will be helpful to you. At the same time, I also hope you will support us and follow the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report