Ben Chuanlong Du's Blog

It is never too late to learn.

Check Whether a Path Exists in Golang

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

Tips & Traps

There is no built-in function to check for the existence of a path in Golang. However, you can achieve it using os.Stat + os.IsNotExist.

Tuple in Golang

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

Tips and Traps

  1. Golang implements the type Tuple in the standard library go/types, however, Tuple is NOT a first class citizen in Golang.

  2. Multiple return parameters in Golang is implemented via Tuple in a limited way (since Tuple

Tips on Golang

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

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.