-
-
Save hiepndd/90b54b6ba5aed736e103fb20562059b5 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