Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Tips and Traps

  1. The package main tells the Go compiler that the package should compile as an executable program instead of a shared library. The main function in the main package is the entry point of the program.

     mkdir myproj
     cd myproj
     go mod init legendu.net/myproj
  2. You can play with Golang code in Go Playground. Even better, you can play with Golang code in a JupyterLab notebook using gonb . A pre-compile Docker images is also available at janpfeifer/gonb_jupyterlab .

import "fmt"
import "reflect"
import "os/exec"

Updating Dependencies

go get -u
go get example.com/some/module@latest

Cleaning up dependencies

go mod tidy

Verifying dependencies

go mod verify

go get vs go install

Please refer to Deprecation of ‘go get’ for installing executables for detailed discussions.