* Create a main.go Simple application of , Used gin frame package main import "github.com/gin-gonic/gin"
func main() { r := gin.Default() r.GET("/ping", func(c *gin.Context) { c.JSON(
200, gin.H{ "message": "get", }) }) r.POST("/ping", func(c *gin.Context) { c.
JSON(200, gin.H{ "message": "post", }) }) r.PUT("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{ "message": "put", }) }) r.DELETE("/ping", func(c *gin.Context
) { c.JSON(200, gin.H{ "message": "delete", }) }) r.Run(":8989") // Monitor and Start service on }
2. View your env
Enter at the command line :go env give the result as follows

3. Modify environment variables
$env:GOOS="linux" $env:GOARCH = "amd64"
4. Review environment variables , Save environment variable modified

5. use go build compile main.go, Generate an executable
go build main.go
6. Transfer executable files to linux environment

7. modify main Execution Authority of
chmod +x ./main
8. Run program
9. Access with browser ip:8989/ping, The operation results are as follows

If you don't want to hang up , use nohup start-up
nohup Used to run commands without hanging up in the system background , Not hanging up means that quitting the terminal executing the command will not affect the operation of the program .
nohup ./main
How does it end ? kill Just process `