Wiki Journal

Learn Golang

On my recent job search I've come across quite a few postings with Go as their primary programming language. I believe that I can learn it on the job but I would rather give potential employers more confidence when it comes to my knowledge of Go. Also, I've always been interested in Go but never required to write it.

These are some of my jots of note when it comes to learning Go. This list is only beginning. I'll add here over time as I go along.

Notes

Bonus

The site https://pkg.go.dev has no API to search packages, but you can still achieve command-line package search by scraping the results from the search page.

Along with curl and tools from html-xml-utils, you can look up packages on the Go packages website:

read -p 'Search go packages: ' query && curl --get --data-urlencode "q=$query" "https://pkg.go.dev/search" | hxnormalize -x | hxselect -c -s '\n' '.SearchSnippet-synopsis, .SearchSnippet-header-path'

Alternatively, you can add this bash function to your profile and invoke it like gopkg <query>:

function gopkg {
  if [[ $# -ne 1 ]]; then
    echo "Usage: gopkg <query>"
    return 1
  fi
  
  curl --get --data-urlencode "q=$1" "https://pkg.go.dev/search" | hxnormalize -x | hxselect -c -s '\n' '.SearchSnippet-synopsis, .SearchSnippet-header-path'
}

Last built on 2025-03-25