Qo'llanma5 min read·22-aprel, 2026

How to Deploy a Go Application on if.uz — Golang Hosting in Uzbekistan

Deploy your Go (Golang) application on if.uz with zero Dockerfile required. Nixpacks auto-detects Go, compiles, and serves it with HTTPS in under 2 minutes.

Go is increasingly popular among Uzbekistan's backend developers for its performance, simplicity, and small binary size. if.uz supports Go out of the box — Nixpacks detects your go.mod file, compiles the binary, and runs it. No Dockerfile, no manual build steps.

Project Structure

bash
my-go-app/
├── main.go
├── go.mod
├── go.sum
└── ...       ← any additional packages

Step 1 — main.go

The critical requirement: read the PORT from the environment. if.uz injects this at runtime.

go
package main

import (
	"fmt"
	"log"
	"net/http"
	"os"
)

func main() {
	port := os.Getenv("PORT")
	if port == "" {
		port = "8080"
	}

	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintln(w, "Hello from if.uz!")
	})

	http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Content-Type", "application/json")
		fmt.Fprintln(w, `{"status":"ok"}`)
	})

	log.Printf("Server starting on port %s", port)
	log.Fatal(http.ListenAndServe(":"+port, nil))
}

Step 2 — go.mod

go
module github.com/yourusername/my-go-app

go 1.22

ℹ️ Info

Nixpacks detects Go 1.22 or the version specified in your go.mod "go" directive. Any Go version ≥ 1.18 is supported.

Step 3 — Deploy on if.uz

  1. 1Push your code to GitHub
  2. 2Open if.uz dashboard → "Deploy new app"
  3. 3Select your Go repo and branch
  4. 4Click Deploy

Nixpacks runs go build -o app . and then executes the compiled binary. The build is fast (~30 seconds for most Go projects) and the binary starts almost instantly.

Using a Popular Go Framework (Gin / Fiber / Echo)

Gin Example

go
package main

import (
	"net/http"
	"os"

	"github.com/gin-gonic/gin"
)

func main() {
	r := gin.Default()

	r.GET("/", func(c *gin.Context) {
		c.JSON(http.StatusOK, gin.H{"message": "Hello from if.uz!"})
	})

	r.GET("/health", func(c *gin.Context) {
		c.JSON(http.StatusOK, gin.H{"status": "ok"})
	})

	port := os.Getenv("PORT")
	if port == "" {
		port = "8080"
	}
	r.Run(":" + port)
}

Connecting to Postgres

Deploy a PostgreSQL instance from the Marketplace, then read DATABASE_URL in your Go app:

go
import (
	"database/sql"
	"os"

	_ "github.com/lib/pq"
)

func initDB() *sql.DB {
	dbURL := os.Getenv("DATABASE_URL")
	db, err := sql.Open("postgres", dbURL)
	if err != nil {
		log.Fatal("Failed to connect to DB:", err)
	}
	return db
}

Environment Variables

bash
DATABASE_URL=postgresql://postgres:[email protected]:5432/mydb
APP_ENV=production
JWT_SECRET=your-secret-here

Why Go + if.uz is a Great Combination

  • Go binaries start in milliseconds — almost no cold-start delay
  • Tiny memory footprint — a typical Go API uses 10–30 MB RAM (well within the free plan's 256 MB)
  • if.uz's local infrastructure means your Uzbek users get responses in < 30ms
  • No Dockerfile needed — Nixpacks compiles and runs Go automatically

Go is one of the most efficient languages to run on if.uz's free plan. A Go API serving hundreds of requests per second easily fits in 256 MB RAM with 0.25 vCPU. Sign up at if.uz and deploy your Go app for free today.

Deploy qilishga tayyormisiz?

Bepul plan, kredit karta kerak emas, 2 daqiqada jonli.

Bepul boshlash →