Tag: golang

  • Go – Finding and removing duplicate files on a Mac

    My laptop’s hard drive is plagued with the same family pics stored in different folders. So, I wrote a simple app in Go to take care of this for me. The app does this by comparing MD5 hashes of files. Usage Assuming you saved the code in a file called main.go, here is how you…

  • Why Golang/Go is so awesome

    I have been working with Go for quite some time now and know more about it. My initial thoughts about it were accurate, I think with some variations. Go really can do almost everything. It can be run like any interpreted language for development and compiled for production This is something I love about Go…

  • Golang: Restart web server on file change

    A great feature of scripting languages like PHP, Python and Ruby is that you don’t need to re-compile the app or restart a web server every time you change something. With Go, you need to restart the web server for your changes to take affect. This can be a pretty daunting task. We can, however,…

  • Golang: Connect to Postgres and selecting data from a table

    You will need to get the Postgres driver first. In the terminal type: go get github.com/lib/pq Connecting to Postgres package main import ( _ “github.com/lib/pq” “database/sql” “fmt” ) func main() { // Connect to the DB, panic if failed db, err := sql.Open(“postgres”, “postgres://user:password@localhost/dbName?sslmode=disable”) if err != nil { fmt.Println(`Could not connect to db`) panic(err)…