In nodejs I use __dirname . What is the equivalent of this in Golang?
I have googled and found out this article http://andrewbrookins.com/tech/golang-get-directory-o
dir, err := os.Getwd() if err != nil { fmt.Println(err) }
this is for golang version: go version go1.13.7 linux/amd64
go version go1.13.7 linux/amd64
works for me, for go run main.go. If I run go build -o fileName, and put the final executable in some other folder, then that path is given while running the executable.
go run main.go
go build -o fileName