All standard library of Golang can be accessed here pkg.go.dev/std
.
os
Package os
provides a platform-independent interface to operating system functinality.
os.Executable()
Returns the path name for the executable that started the current process.
Put this lines into file tryme.go
|
|
And run go build .
in the file dir. Then exec the output file ./tryme
and you will see the terminal show your current file path like path/to/tryme
io
Package io
provides basic interfaces to I/O primitives
net
Package net
provides a portable interface for network I/O, including TCP/IP, UDP, domain name, resolution, and Unix domain sockets.
strings
Package strings
implements simple function to manipulate UTF-8 encoded strings
References: