Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
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
.
Hands on the filepath Library in Golang
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Embed File in Golang Binary
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Tips and Traps¶
My understanding is that embeded files are loaded into memory, which means that the Go app might consume large memory if you embed a large file.
The "embed" package does not work with the Gophernotes kernel (for Jupyter/Lab notebooks).
A Text File Is Marked as a Binary File
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
The issue can be fix by stripping null characters using the following command.
tr -d '\000' < filein > fileout