Yes
parent
bcbeb34e09
commit
70562aac4c
|
@ -0,0 +1 @@
|
||||||
|
hello-world
|
13
hello.go
13
hello.go
|
@ -4,17 +4,22 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func handler(w http.ResponseWriter, r *http.Request) {
|
func handler(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintf(w, "Hello world! Here's some info:\n\n")
|
fmt.Fprintf(w, "Hello world! Here's some info:\n\n")
|
||||||
time, _ := time.Now()
|
time := time.Now()
|
||||||
|
numCPU := runtime.NumCPU()
|
||||||
|
version := runtime.Version()
|
||||||
hostname, _ := os.Hostname()
|
hostname, _ := os.Hostname()
|
||||||
environ, _ := os.Environ()
|
environ := os.Environ()
|
||||||
uid, _ := os.Getuid()
|
uid := os.Getuid()
|
||||||
gid, _ := os.Getgid()
|
gid := os.Getgid()
|
||||||
fmt.Fprintf(w, "Time: %v", time)
|
fmt.Fprintf(w, "Time: %v", time)
|
||||||
|
fmt.Fprintf(w, "CPUs: %v", numCPU)
|
||||||
|
fmt.Fprintf(w, "Go version: %v", version)
|
||||||
fmt.Fprintf(w, "Hostname: %v\n", hostname)
|
fmt.Fprintf(w, "Hostname: %v\n", hostname)
|
||||||
fmt.Fprintf(w, "Environment: %v\n", environ)
|
fmt.Fprintf(w, "Environment: %v\n", environ)
|
||||||
fmt.Fprintf(w, "UID: %v GID: %v\n", uid, gid)
|
fmt.Fprintf(w, "UID: %v GID: %v\n", uid, gid)
|
||||||
|
|
Loading…
Reference in New Issue