os.Getwd() is used to get the current working directory. Output will similar to pwd command on linux
package main
import (
"fmt"
"log"
"os"
)
func main() {
currentWorkingDirectory, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
fmt.Printf("Current Wroking Direcoty: %s", currentWorkingDirectory)
}
Output:
Current Working Direcoty: <will be current working directory on the machine>