-
-
Save d1y/1a03d0f3aaaf9f640e1d246dac4a43ef to your computer and use it in GitHub Desktop.
How to get the current working directory in golang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// More info on Getwd() | |
// https://golang.org/src/os/getwd.go | |
// | |
import( | |
"os" | |
"fmt" | |
"log" | |
) | |
func main() { | |
dir, err := os.Getwd() | |
if err != nil { | |
log.Fatal(err) | |
} | |
fmt.Println(dir) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment