Requirements
Install Go package from Webuzo Admin Panel.
In case go is not installed, ask your server admin to install it from Webuzo Admin Panel > Apps > Install an App
This will install the latest version of go.
Setup Go Application
Execute the below commands from the user's terminal. Make sure you edit and replace the dummy user path and domain path with the correct ones before executing the below commands.
mkdir sample_go_app
cd sample_go_app
Create a file named main.go and open it in any editor.
vi main.go
Copy the below code and paste it into main.go file and save the file.
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
html := `
<!DOCTYPE html>
<html>
<head>
<title>Hello Go</title>
<style>
body { font-family: Arial, sans-serif; background:#f0f0f0; display:flex; justify-content:center; align-items:center; height:100vh; }
.card { background:#fff; padding:30px; border-radius:10px; box-shadow:0 4px 10px rgba(0,0,0,0.1); text-align:center; }
h1 { color:#4a90e2; }
</style>
</head>
<body>
<div class="card">
<h1>🚀 Hello from Go!</h1>
<p>This is a simple Go web app.</p>
</div>
</body>
</html>`
fmt.Fprint(w, html)
}
func main() {
http.HandleFunc("/", handler)
fmt.Println("Server running at http://localhost:30001")
http.ListenAndServe(":30001", nil)
}
To add Go application go to Webuzo Enduser Panel > Applications > Add Applications
Note : Before adding the application change the port in your project as given in "Add application" wizard.
Fill the required fields, select Go from "Application type" drop down and save it.
Enter the start command "/usr/local/apps/go/bin/go run main.go".
Or you can build your app /usr/local/apps/go/bin/go build -o main main.go and enter the start command ./main

After saving it will be show in "List Applications" wizard.

After the adding application check the domain in browser
