प्रोग्रामिंग भाषा
गूगल द्वारा विकसित एक तेज़, स्टैटिक टाइप प्रोग्रामिंग भाषा, जो कुशल और स्केलेबल एप्लिकेशन बनाने में सहायक है।
dependency प्रबंधन के साथ सेकंडों में लाखों lines कंपाइल करें
CSP-शैली message passing के साथ हल्की concurrency
आसान डिप्लॉयमेंट के लिए बिना निर्भरता वाली एकल binary
HTTP सर्वर, JSON, crypto, testing और बहुत कुछ बिल्ट-इन
किसी भी प्लेटफ़ॉर्म से Linux, macOS, Windows और ARM के लिए compile करें
go fmt, go test, go mod, race detector और profiler शामिल
# Download latest (check golang.org/dl)
wget https://go.dev/dl/go1.21.5.linux-amd64.tar.gz
# Extract to /usr/local
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.21.5.linux-amd64.tar.gz
# Add to PATH
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
echo 'export GOPATH=$HOME/go' >> ~/.bashrc
source ~/.bashrc
# Verify
go versionहैलो वर्ल्ड:package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}go run main.go
go build -o myapp main.go
./myapp
myapp/
├── go.mod # Module definition
├── go.sum # Dependency checksums
├── main.go # Entry point
├── internal/ # Private packages
└── cmd/ # CLI commandsgo.mod:module github.com/user/myapp
go 1.21
require (
github.com/gin-gonic/gin v1.9.1
github.com/lib/pq v1.10.9
)HTTP Server उदाहरण:package main
import (
"net/http"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
r.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{"message": "Hello"})
})
r.Run(":8080")
}Concurrency उदाहरण:package main
import (
"fmt"
"time"
)
func worker(id int, jobs <-chan int, results chan<- int) {
for j := range jobs {
fmt.Printf("Worker %d processing job %d\n", id, j)
time.Sleep(time.Second)
results <- j * 2
}
}
func main() {
jobs := make(chan int, 100)
results := make(chan int, 100)
// Start 3 workers
for w := 1; w <= 3; w++ {
go worker(w, jobs, results)
}
// Send 5 jobs
for j := 1; j <= 5; j++ {
jobs <- j
}
close(jobs)
// Collect results
for a := 1; a <= 5; a++ {
<-results
}
}
हमारे सादा VPECONECT प्रक्रिया के साथ मिनट में शुरू हो जाओ
Deploy in about 2 minutes • Full root access • Support by ticket and email