{"id":1171,"date":"2020-01-16T04:56:21","date_gmt":"2020-01-16T04:56:21","guid":{"rendered":"https:\/\/golangbyexamples.com\/?p=1171"},"modified":"2020-01-16T04:57:08","modified_gmt":"2020-01-16T04:57:08","slug":"current-working-directory-golang","status":"publish","type":"post","link":"https:\/\/golangbyexamples.com\/current-working-directory-golang\/","title":{"rendered":"Get Current Working Directory in Go (Golang)"},"content":{"rendered":"\n
os.Getwd() <\/strong>is used to get the current working directory. Output will similar to pwd<\/strong> command on linux<\/p>\n\n\n\n Output:<\/strong><\/p>\n\n\n\n Current Working Direcoty: <will be current working directory on the machine><\/p>\n","protected":false},"excerpt":{"rendered":" os.Getwd() is used to get the current working directory. Output will similar to pwd command on linux Output: Current Working Direcoty: <will be current working directory on the machine><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[1],"tags":[154,3,4,160],"class_list":["post-1171","post","type-post","status-publish","format-standard","hentry","category-tech","tag-directory","tag-go","tag-golang","tag-pwd"],"yoast_head":"\npackage main\nimport (\n \"fmt\"\n \"log\"\n \"os\"\n)\n\nfunc main() {\n currentWorkingDirectory, err := os.Getwd()\n if err != nil {\n log.Fatal(err)\n }\n fmt.Printf(\"Current Wroking Direcoty: %s\", currentWorkingDirectory)\n}<\/code><\/pre>\n\n\n\n