package main import ( "fmt" "strings" "go.wit.com/log" "net/http" "sort" ) /*
Nothing to see here. Please move along. */ func doGui(w http.ResponseWriter, gourl string, realurl string) { realurl = "https://" + realurl log.Info("go repo =", gourl, "real url =", realurl) fmt.Fprintln(w, "") fmt.Fprintln(w, "") fmt.Fprintln(w, "") // fmt.Fprintln(w, fmt.Fprintln(w, "") fmt.Fprintln(w, "") fmt.Fprintln(w, "") fmt.Fprintln(w, "") fmt.Fprintln(w, "") fmt.Fprintln(w, "Nothing to see here. Please move along.\"") fmt.Fprintln(w, "") fmt.Fprintln(w, "") /* var tmp string tmp = r.URL.String() if tmp == "/gui" { findFile(w) return } fmt.Fprintln(w, "OK") */ } var repoMap map[string]string var configfile []string var keysSorted []string func findkey(url string) (string, string) { key := "go.wit.com" + url if repoMap[key] != "" { return key, repoMap[key] } return key, "" // parts := strings.Split(key, "/") } func readconfigfile() { repoMap = make(map[string]string) pfile, err := htmlFiles.ReadFile("files/repomap") if err != nil { log.Error(err, "missing repomap in the binary") return } configfile = strings.Split(string(pfile), "\n") for _, line := range configfile { fields := strings.Fields(line) if (len(fields) < 2) { continue } repo := fields[0] realurl := fields[1] repoMap[repo] = realurl // log.Info("repo =", repo, "real url =", realurl) } for repo, _ := range repoMap { // log.Info("repo =", repo, "real url =", url) keysSorted = append(keysSorted, repo) } log.Info("sorted:") sort.Strings(keysSorted) // sort.Reverse(keys) sort.Sort(sort.Reverse(sort.StringSlice(keysSorted))) for _, key := range keysSorted { log.Info("repo =", key, "real url =", repoMap[key]) } }