Answers for "print working directory golang"

Go
4

goland how to print out your current path

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 || dir == "" {
		log.Fatalf("Error: %v", err.Error())
	}
	log.Printf("Current Working Dir: %v", dir)
}
Posted by: Guest on May-06-2020

Code answers related to "print working directory golang"

Browse Popular Code Answers by Language