package main import ( "fmt" "net/http" "strconv" "strings" "time" "go.wit.com/log" ) func indexHeader(w http.ResponseWriter) { fmt.Fprintln(w, "") fmt.Fprintln(w, "") fmt.Fprintln(w, "
") // fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") fmt.Fprintln(w, "") } func indexBodyStart(w http.ResponseWriter) { // fmt.Fprintln(w, " fmt.Fprintln(w, "") fmt.Fprintln(w, "Package | ") fmt.Fprintln(w, "Version | ") fmt.Fprintln(w, "Age | ") fmt.Fprintln(w, "Dev Version | ") fmt.Fprintln(w, "go get | ") fmt.Fprintln(w, "Authoritative sources (IPv6 only) | ") fmt.Fprintln(w, "") fmt.Fprintln(w, " | Documentation | ") fmt.Fprintln(w, "|
---|---|---|---|---|---|---|---|---|
", strings.Join(parts, " "), " | ||||||||
log/ (needed for the gui) | ||||||||
"+gourl+" | ") for i, s := range versionMap { log.Println("found i =", i, "with", "s =", s) } var vtime, version string gourl = strings.TrimSpace(gourl) tmp, _ := versionMap[gourl] parts := strings.Split(tmp, " ") if len(parts) > 0 { version = parts[0] } if len(parts) > 1 { vtime = parts[1] } if vtime != "" { // Convert the string to an integer gitTagTimestampInt, _ := strconv.ParseInt(vtime, 10, 64) // Parse the Unix timestamp into a time.Time object gitTagDate := time.Unix(gitTagTimestampInt, 0) // Get the current time currentTime := time.Now() // Calculate the duration between the git tag date and the current time duration := currentTime.Sub(gitTagDate) vtime = formatDuration(duration) } fmt.Fprintln(w, ""+version+" | ") // version fmt.Fprintln(w, ""+ vtime +" | ") // dev version fmt.Fprintln(w, "") // dev version fmt.Fprintln(w, " | "+gourl+" | ") fmt.Fprintln(w, ""+giturl+" | ") if github == "" { fmt.Fprintln(w, "") } else { fmt.Fprintln(w, " | github.com/wit-go/log | ") } fmt.Fprintln(w, "") fmt.Fprintln(w, " |