all repos — goget @ 048d28ac4d6a163e48102a83cae453cd260d2e56

returns a go-import meta tag

Init
Anirudh Oppiliappan x@icyphox.sh
Tue, 29 Nov 2022 22:17:20 +0530
commit

048d28ac4d6a163e48102a83cae453cd260d2e56

3 files changed, 28 insertions(+), 0 deletions(-)

jump to
A .gitignore

@@ -0,0 +1,1 @@

+goget
A go.mod

@@ -0,0 +1,3 @@

+module git.icyphox.sh/goget + +go 1.19
A main.go

@@ -0,0 +1,24 @@

+package main + +import ( + "fmt" + "log" + "net/http" + "path" +) + +func goget( w http.ResponseWriter, r *http.Request) { + w.Header().Set("content-type", "text/html") + p := path.Join(r.Host, r.URL.Path) + fmt.Fprintf( + w, `<head><meta name="go-import" content="%s git https://%s"></head>`, + p, p, + ) + return +} + +func main() { + mux := http.NewServeMux() + mux.HandleFunc("/", goget) + log.Fatal(http.ListenAndServe("0.0.0.0:6868", mux)) +}