Browse Source

Yes

master
Ambrose Chua 3 years ago
parent
commit
70562aac4c
2 changed files with 10 additions and 4 deletions
  1. +1
    -0
      .gitignore
  2. +9
    -4
      hello.go

+ 1
- 0
.gitignore View File

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

+ 9
- 4
hello.go View File

@ -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