I have been looking trough the go documentation but so far I haven't found anything. I need help to find the current working directory programmaticly in go language. Does any one know how to do that?
Getwd from the os package will return your current working directory. For more operating system related functions look in the os package.
If you want to print it do the following.
import (
"fmt"
"os"
)
func main() {
wd, _ := os.Getwd()
fmt.Println("Working Directory:", wd)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With