Ambrose Chua 6 years ago
parent
commit
70562aac4c
  1. 1
      .gitignore
  2. 13
      hello.go

1
.gitignore

@ -0,0 +1 @@
hello-world

13
hello.go

@ -4,17 +4,22 @@ import (
"fmt"
"net/http"
"os"
"runtime"
"time"
)
func handler(w http.ResponseWriter, r *http.Request) {
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()
environ, _ := os.Environ()
uid, _ := os.Getuid()
gid, _ := os.Getgid()
environ := os.Environ()
uid := os.Getuid()
gid := os.Getgid()
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, "Environment: %v\n", environ)
fmt.Fprintf(w, "UID: %v GID: %v\n", uid, gid)

Loading…
Cancel
Save