Go offers a series of functions that make it possible to manipulate file paths that are platform-independent and that are contained mainly in the path/filepath and os packages.
Handling paths
Working directory
Each process has a directory associated with it called the working directory, which is usually inherited from the parent process. This makes it possible to specify relative paths – one that doesn't start with the root folder. This will be / on Unix and macOS and C:\ (or any other drive letter) on Windows.Â
An absolute/full path starts with the root directory and it represents the same location in a filesystem, that is, /usr/local.
A relative path doesn&apos...
A relative path doesn&apos...