Golang: Get current working direactory path.
import (
"os"
"fmt"
)
func GetCurrentDir() string {
dir, err := os.Getwd()
if err != nil {
fmt.Println(err)
os.Exit(-1)
}
return dir
}
Cheatsheet collection for go, rust, python, shell and javascript.
Golang: Get current working direactory path.
import (
"os"
"fmt"
)
func GetCurrentDir() string {
dir, err := os.Getwd()
if err != nil {
fmt.Println(err)
os.Exit(-1)
}
return dir
}