Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Get Current Working Directory (cwd)

  • cwd
  • pwd
  • Getcwd
package main

import (
	"fmt"
	"log"
	"os"
)

func main() {
	fmt.Println("hello")
	cwd, err := os.Getwd()
	if err != nil {
		log.Panic(err)
	} else {
		fmt.Println(cwd)
	}
}