? ??
DevOps? ??? ?? ?? ?????! ? ?? ?? DevOps ??? ?? ???? ?????? ?? ? ??? ??? ? ??? ? ?? ???? ???? ??????. ?? ?????? DevOps ???? ??? ??? 3?? Python ????? ???????.
?? ??? ?? Go-lang? ?? ???????! ? ???? ????? ????? ??? 3?? Go-lang ????? ???? ??? ?????.
- ???? ??? ???? ?? ??? ??? ???? ?????.
- HTTP ??? ???? ??? ????? ??????.
- DevOps ??? ???? ?? RESTful API ????
???? ?? ???? ???? ??? ???! ?
? ?? ?? ??
??? ????? ???? ?? ??? ???? ?? ??? ???? ?????. ??? ?? ??? ????.
1. ?(??)
???? Go? ???? ??? ???. ?? ??? ?? ?? ??? ????.
???
- ?? ?????? ?? Go ?? ????? ???????.
- ?? ????? ???? ??? ??? ????.
- ?? ???? ?? PowerShell? ?? ??? ???? ??? ?????.
go version
???
- ???? ?? ??? ?????.
sudo apt update sudo apt install -y golang
- ?? ??:
go version
macOS
- Homebrew? ???? Go? ?????. ???:
brew install go
- ?? ??:
go version
2. Go? ?? ?? ??
???? ? ??? ??? ??, ??, ???? ?? Go ??? ?? ???? ??? ??? ???? ???? ? ??? ???. ??? ?? ????? ????? ?? ??? ?????? ??????.
??? ?? ??? ???? ?? Go-lang ???? ??? ??? ??? ? ????! ?
? ??? ??? ???? ?
? ?? ????? ??? ??? ???? ??? ??? ???????. ? ????? ???? ?? ????? ?? ??? ???? ???? ? ??? ???.
? GitHub ????? ?? ??? ?? ? ????. disk_usage.go?? ??? ??? ?? ??? ???? ??? ???????.
package main import ( "fmt" "os" "syscall" ) func getDiskUsage(path string) { var stat syscall.Statfs_t err := syscall.Statfs(path, &stat) if err != nil { fmt.Println("Error Fetching Disk Usage:", err) return } total := stat.Blocks * uint64(stat.Bsize) free := stat.Bfree * uint64(stat.Bsize) used := total - free percentUsed := float64(used) / float64(total) * 100 fmt.Printf("Disk usage of %s:\n", path) fmt.Printf("Total: %d GB\n", total/1e9) fmt.Printf("Used: %d GB (%.2f%%)\n", used/1e9, percentUsed) fmt.Printf("Free: %d GB\n", free/1e9) } func main() { path := "/" if len(os.Args) > 1 { path = os.Args[1] } _, err := os.Stat(path) if os.IsNotExist(err) { fmt.Printf("Error: '%s' Path doesn't exist.\n", path) return } else if err != nil { fmt.Printf("Error occurred while accessing path %s: %v \n", path, err) return } getDiskUsage(path) }
???? ?? ??:
- ????? syscall.Statfs ??? ???? ?? ??, ??? ??, ?? ??? ??? ??? ??? ?????.
- ??? ??? ??? ??? ???? ??? ???? ???? ?? ??? ?????.
- ??? ??? ?????, ??? ??? ??? ???? ?? ?? ??? ???????.
???? ??
????? ????? ?? ??? ??????.
- ?? ????? ??? ???? ?????.
go version
- ??? ???? ??? ????? ????? ?? ????(/)? ?????.
sudo apt update sudo apt install -y golang
???? ???? ??? ?? ??? ???? ?? ??? ????.
? ????? Go? ???? ?? API? ??? ?????? ??? ???? ??? ?? ??? ???? ? ? ??? ?????. ?
? HTTP ?? ????: ????? ???? ???
? ?? ????? Go?? ????? ????? ????? HTTP ??? ??? ????. ? ????? ????? ?? ?? ?? ?????? ????? ?? ????? ???? ???? ??? ?????.
? GitHub ????? ?? ??? ?? ? ????.
HTTP ?? ?? ??
- http_server.go?? ??? ??? ?? ??? ?????.
go version
?? ??
- ?? ?? ??: http.FileServer ??? ./static ????? ??? ?????.
- ?? ?? ?????: ??? ?? ?? ??? ???? ?? /health ??? ?????.
- ?? ??: ??? ????? ?? 8090?? ?? ???? ?? ? ??? ?? ?????.
????? ???? ??
-
??: static ?? ??? ??? ?????:
- index.html
- style.css
- profile.jpeg?? ??? ??? ??? ??? ????? ?????.
??? ?? ???? ?????.
index.html:
brew install go
???? ??
- ?? ??? ???? HTTP ??? ?????.
go version
- ??? ????? ????? ?? ???? ?? ?????: ?????:8090
?? ?? ???
?? ??? ????? ??? ?????.
package main import ( "fmt" "os" "syscall" ) func getDiskUsage(path string) { var stat syscall.Statfs_t err := syscall.Statfs(path, &stat) if err != nil { fmt.Println("Error Fetching Disk Usage:", err) return } total := stat.Blocks * uint64(stat.Bsize) free := stat.Bfree * uint64(stat.Bsize) used := total - free percentUsed := float64(used) / float64(total) * 100 fmt.Printf("Disk usage of %s:\n", path) fmt.Printf("Total: %d GB\n", total/1e9) fmt.Printf("Used: %d GB (%.2f%%)\n", used/1e9, percentUsed) fmt.Printf("Free: %d GB\n", free/1e9) } func main() { path := "/" if len(os.Args) > 1 { path = os.Args[1] } _, err := os.Stat(path) if os.IsNotExist(err) { fmt.Printf("Error: '%s' Path doesn't exist.\n", path) return } else if err != nil { fmt.Printf("Error occurred while accessing path %s: %v \n", path, err) return } getDiskUsage(path) }
? ????? Go-lang? ???? ?? ?? ?????? ?? ?? ????? ?? ?? ??? ???? ?? ???? ? ??? ??? ??? ?????. ?
? RESTful API ????: DevOps ?? ??
? ???? ??? ??????? DevOps ?? ??? ??? ? ?? RESTful API? ??????. ? ????? Go? net/http ???? ???? RESTful ??? ???? ???? ???? ??? ?????.
?? ?? ??? ? GitHub ????? ??? ? ????.
RESTful API ??
1??: ?? ????
main.go?? ??? ??? ?? ??? ?????.
go version
2??: ??? ??
?? ?????? data.go?? ??? ??? ??? ?????.
sudo apt update sudo apt install -y golang
3??: ???
?? ?????? handler.go?? ??? ?? ??? ??? ??? ?????.
go version
?? ???
????? ???? ?? Go ??? ??????.
brew install go
??? ?? ?????? ????/?? ???? ??? ? ????.
???? ??
??? ???? ??? ?????.
go version
API ???
- ?? ?? ?? ?? ??? ????? ??? ?????.
package main import ( "fmt" "os" "syscall" ) func getDiskUsage(path string) { var stat syscall.Statfs_t err := syscall.Statfs(path, &stat) if err != nil { fmt.Println("Error Fetching Disk Usage:", err) return } total := stat.Blocks * uint64(stat.Bsize) free := stat.Bfree * uint64(stat.Bsize) used := total - free percentUsed := float64(used) / float64(total) * 100 fmt.Printf("Disk usage of %s:\n", path) fmt.Printf("Total: %d GB\n", total/1e9) fmt.Printf("Used: %d GB (%.2f%%)\n", used/1e9, percentUsed) fmt.Printf("Free: %d GB\n", free/1e9) } func main() { path := "/" if len(os.Args) > 1 { path = os.Args[1] } _, err := os.Stat(path) if os.IsNotExist(err) { fmt.Printf("Error: '%s' Path doesn't exist.\n", path) return } else if err != nil { fmt.Printf("Error occurred while accessing path %s: %v \n", path, err) return } getDiskUsage(path) }
??:
go run disk_usage.go /path/to/directory
- ? ?? ?? ? ??? ????? ??? ??????.
go run disk_usage.go
??:
package main import ( "fmt" "net/http" ) func healthCheckHandler(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) w.Write([]byte("OK")) } func main() { fs := http.FileServer(http.Dir("./static")) http.Handle("/", fs) http.HandleFunc("/health", healthCheckHandler) port := "8090" fmt.Printf("Starting server on port %s....", port) err := http.ListenAndServe(":"+port, nil) if err != nil { fmt.Println("Error starting server:", err) } }
- ???? ?? ???? ?? ??? ????? ????? ??? ?????.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Pravesh Sudha - Portfolio</title> <link rel="stylesheet" href="style.css"> </head> <body> <header> <div> <p><strong>style.css:</strong><br> </p> <pre class="brush:php;toolbar:false">body { font-family: Arial, sans-serif; margin: 0; padding: 0; line-height: 1.6; color: #333; background-color: #f9f9f9; } header { background: #4caf50; color: #fff; padding: 20px 0; text-align: center; } header .profile-picture { width: 150px; height: 150px; border-radius: 50%; margin-bottom: 15px; } header h1 { font-size: 2.5em; margin: 0; } header .subtitle { font-size: 1.2em; margin: 0; } main { padding: 20px; max-width: 800px; margin: 20px auto; background: #fff; border-radius: 8px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); } main .about, main .links { margin-bottom: 20px; } main .links ul { list-style: none; padding: 0; } main .links li { margin: 10px 0; } main .links a { color: #4caf50; text-decoration: none; font-weight: bold; } main .links a:hover { text-decoration: underline; } footer { text-align: center; padding: 10px 0; background: #333; color: #fff; }
??:
go run http_server.go
? ??
? ?????? ????? ??? ??? ??? ?? ???? ? ??? ?? ? ?? ???? Go ????? ???????. ??? ??? ?????? ??? HTTP ?? ??, ????? ???? ???, ????? DevOps ?? ??? ?? RESTful API ??? ????? ??? ????? Go ????? ??? ????? ?? ???? ??? ??? ?????.
- ??? ??? ???? ????????? Go? ??? ??? ?? ?? ?? ??? ???? ??? ?? ???? ?? ???? ??? ?? ???? ?????.
- HTTP ?? ????? ?? ?? ??? ???? ???? ?? ?? ?????? ???? ??? ?? ? ??? Go?? ? ??? ???? ? ??? ?????.
- RESTful API ??????? API? ????, ??? ??? ?? ???? ????, POST ? GET ??? ?? ??????? ????? ??? ??? ??????.
??? ? ????? ?? ??????? ?? ??? ? ?? ?? ?????. ??? ????, ? ?????? ??, API ??? ??? ??? Go? ???? ??? ??? ???? ??? ?????.
? ? ?? ??? ???? ???? ???? Hashnode, X(Twitter) ? LinkedIn?? ?? ??????.
???? ??? ?????!!
??? ??! ?
? ??? DevOps ??? ???? ?? Go-lang ????? ?????.? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

tointegrategolangservices? ?? intectapisorgrpcforinter-servicecommunication, userestapis (viaframworks likeginingoandflaskinpython) orgrppc (viframsks with protoco)? ?????

golangofferssuperiorperperperperferforperformance, nativeconcurrencyviagoroutines ? lefficientresourceusage, makingitidealforhigh-traffic, 2.python, whileslowerduetointerpretationandghilegil, arrethecoSystem, andisbettersuitedfori/o-ko

Golang? ?? ??? ??? ????? ??? ?? ???? ??? ? ??? ? ?? ????. ?? ??? ???, ?? ?? ? ??? ?? ?????? ????? API ??, ???? ???, ?? ???, ?????? ?? ? CLI ??? ?? ??? ?? ????? ???? ? ?????. Golang? ? ??? ??? ?? ??? ???? Gopherjs? ?? JavaScript? ?????? Tinygo? ?? WebAssembly?? ????? ??? ?? ??? ???? ?? ??? ???? HTML ???? ?? ? ? ????. ??? ???? ??? ?? ??? ??? ??JavaScript/TypeScript ? ???? ???????. ??? Golang? ??? ???? ???? ?? ?? ??? ? ?????.

GO? ???? ?? ??? ??? ???? ?? ??? ???? ??? ???? ????. 1. ?? ???? ?? ???? ??????? ?? ? ???? ??????. Windows? .msi ??? ???? MacOS? .pkg ??? ???? Linux? .tar.gz ??? ???? /usr /local ????? ??? ????. 2. Linux/MacOS?? ?? ??, ?? ~/.bashrc ?? ~/.zshrc? ???? ??? Gopath? ???? Windows Set ??? ??? ???? ?????. 3. ?? ??? ???? ??? ???? ??? ???? Hello.Go? ???? ?? ? ??? ???? ??????. ???? ???? ?? ?? ? ??

Golang? ????? ? ???? ?? ? ? Python?? CPU? ???? ? ?????. 1. Golang? Goroutine ??? ????? ????? ?? ?? ?? ??? ??? CPU ???? ????. 2. GO? ?? ??? ????? ??? ?? ?? ??? ???? ??? ??? ???? ????. 3. Python? GIL ? ?? ?? ?????? ?? ?? ?????? ? ? CPU ? ??? ?? ??? ????. 4. Python? ?? ???? ?? ???? ????? ??? ?? ??? ?? ????? ??? ?? ??? ?????.

GO?? GraphQlapi? ????? GQLGEN ?????? ???? ?? ???? ????? ?? ????. 1. ?? ???? ???? ?? ?? ??? ???? GQLGEN? ?? ??? ?????? ??????. 2. ?? ?? GraphQLSchema? ???? POST ?? ? ?? ??? ??? ?? API ?? ? ?? ??? ??????. 3. ?? ?? ????? ????? ?? ??? ???? Resolver?? ???? ??? ?????. 4. ????? ??? Qlhandler? httpserver? ???? ?? ???? ?? API? ???????. ?? ?? ?? ??, ?? ??, ?? ??? ? ?? ??? ???? ???? ?? ??? ?????.

???? ??? ??? ??? ??? ???? ?? ??, ? ?? ?? ? ?? ??? ?? ???????. 1. ??? ?? ??? ??? ? Kitex ?? Gomicro of Go? ?? ??? ????, ?? Kitex? ??? ??? ???? ? ??? ???? ?????. 2. Fastapi ?? Flask of Python? ??? ? ? MVP ????? ??? ?? ?? ? ?? ?????? ? ?????. 3. ?? ?? ??? ?? ??? ???? ??? ??? ?? ?? ? ?? ?? ? ??????. Python ?? ?? ??? ???? ??? ? ? ????. 4. GO ??? ??? ??? ???? ????? ? ???? ?? ?? ??? ?? ???? ?? ? ?? ???? ?????. 5. ?? ?? ? ??? ??? ???? ?? ??? ?? ????? ????? ?? ? ? ????.

sync.waitgroup? ?? ? ??? ??? ?? ? ??? ???? ? ?????. ??? ??? ? ?? ??? ?? ?? ??? ???? : ??, ?? ? ??. 1. Aadd (n) ?? ? ?? ? ?? ?????. 2. DONE ()? ? ? ??? ??? ???? ???? 1 ? ?? ???. 3. Wait ()? ?? ??? ?? ? ??? ?? ? ??? ?????. ?? ??? ?? ?? ?? : ADD? ?? ? ???? ????????. ?? ??? ??? DON? ????? ??????. ??? ?? ???? ?? ????. ? ???? ?? ???, ?? ??? ?? ? ?? ?????? ????? ??? ????? ????? ?? ? ? ????.
