📚Cheatsheets

Cheatsheet collection for go, rust, python, shell and javascript.

GetCurrentDir

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
}