Some time back, I said I was revisiting some old friends. One of them, was the Go Programming language by Google. Well, things have been awesome, I have been learning quite a bit of ‘go’ (for Go Lang). I haven’t done any projects yet, but my next project will definitely be in ‘go’.
I am currently reading the language specification again, after watching a ton of videos and doing some simple programs.
For example, this would be the conical “hello world” programing:
package main
import "fmt"
func main(){    fmt.Println("Hello, world") }
Pretty readable isn’t it?
Well, what about something more modern? What would an “hello world” look like for the web? Yup, you got it, an application that when run, behaves as a web server that says “hello, world” when you connect with your web browser.
Here it is, not too bad heh?
package main
import (    "fmt"    "log"    "net/http" )
func handler(w http.ResponseWriter, r *http.Request) {    fmt.Fprintf(w, "Hello, world") }
func main() {    http.HandleFunc("/", handler)    log.Fatal(http.ListenAndServe(":8080", nil)) }