# Go is OP
If anyone decides to nerf Go, I'm going to make my own programming language that's decentralized and blockchain. >:(
Jokes aside, I noticed something interesting about Go's net/http/cgi library. Well, aside that its alive and well as other languages are starting to depricate and remove their cgi libraries.
You can route with it.
=>
https://sinza.theunixplace.com/cgi-bin/gotest.cgi You can test it on my website on SDF.
Honestly, vanilla Go is, at this point, more powerful than most web microframeworks. How many microframeworks do you know that still support the Common Gateway Interface in 2025? :)
Actually, if you have an answer to the above question, please email me at
[email protected].
Now, in all fairness, I find CGI to be one of the easier protocols to write for, even without a dedicated library. The net/http/cgi library is compatible with net/http, so what ability net/http has to route, which is on par with an average microframework as of Go version 1.22, net/http/cgi can do as well!
As powerful as this is, I'm not sure if this is necessarily good in production. I'll even say that for a personal website, CGI is perfectly fine. However, I found this routing slightly unwieldy for the size of the application.
Here is the source code for this experiment:
```
package main
import (
"fmt"
"net/http"
"net/http/cgi"
"strconv"
)
func fizzbuzz(n int, w http.ResponseWriter) {
for i := 1; i <= n; i++ {
if (i%3 == 0) && (i%5 == 0) {
fmt.Fprintln(w, "<li>FizzBuzz</li>")
} else if i%3 == 0 {
fmt.Fprintln(w, "<li>Fizz</li>")
} else if i%5 == 0 {
fmt.Fprintln(w, "<li>Buzz</li>")
} else {
fmt.Fprintln(w, "<li>"+strconv.Itoa(i)+"</li>")
}
}
}
func headerWriter(header http.Header, contentType string) {
if contentType == "" {
contentType = "text/html; charset=utf-8"
}
header.Set("Content-Type", contentType)
}
func testHandler(w http.ResponseWriter, r *http.Request) {
header := w.Header()
headerWriter(header, "")
r.ParseForm()
n, err := strconv.Atoi(r.Form.Get("number"))
if err != nil {
fmt.Fprintln(w, "Error, input is not a number.")
return
}
fmt.Fprintln(w, "<ol>")
fizzbuzz(n, w)
fmt.Fprintln(w, "</ol>")
}
func mainHandler(w http.ResponseWriter, r *http.Request) {
header := w.Header()
headerWriter(header, "")
fmt.Fprintln(w, "<form action='gotest.cgi/test' method='post' id='fizzbuzz'>")
fmt.Fprintln(w, "<label for='number'>Input Number:</label>")
fmt.Fprintln(w, "<input type='number' min='0' step='1' id='number' name='number'>")
fmt.Fprintln(w, "<button form='fizzbuzz' type='submit'>Submit Me!</button>")
fmt.Fprintln(w, "</form>")
}
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/cgi-bin/gotest.cgi/test", testHandler)
mux.HandleFunc("/", mainHandler)
err := cgi.Serve(mux)
if err != nil {
fmt.Println(err)
}
}
```
=>
https://spdx.org/licenses/0BSD.html Consider it under the BSD Zero Clause License.