{"action":"opened","issue":{"url":"https://api.github.com/repos/struCoder/pmgo/issues/32","repository_url":"https://api.github.com/repos/struCoder/pmgo","labels_url":"https://api.github.com/repos/struCoder/pmgo/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/struCoder/pmgo/issues/32/comments","events_url":"https://api.github.com/repos/struCoder/pmgo/issues/32/events","html_url":"https://github.com/struCoder/pmgo/issues/32","id":361951897,"node_id":"MDU6SXNzdWUzNjE5NTE4OTc=","number":32,"title":"Working directory for pmgo processes is not project folder","user":{"login":"Anton-Cao","id":8326522,"node_id":"MDQ6VXNlcjgzMjY1MjI=","avatar_url":"https://avatars0.githubusercontent.com/u/8326522?v=4","gravatar_id":"","url":"https://api.github.com/users/Anton-Cao","html_url":"https://github.com/Anton-Cao","followers_url":"https://api.github.com/users/Anton-Cao/followers","following_url":"https://api.github.com/users/Anton-Cao/following{/other_user}","gists_url":"https://api.github.com/users/Anton-Cao/gists{/gist_id}","starred_url":"https://api.github.com/users/Anton-Cao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Anton-Cao/subscriptions","organizations_url":"https://api.github.com/users/Anton-Cao/orgs","repos_url":"https://api.github.com/users/Anton-Cao/repos","events_url":"https://api.github.com/users/Anton-Cao/events{/privacy}","received_events_url":"https://api.github.com/users/Anton-Cao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-19T22:29:28Z","updated_at":"2018-09-19T22:29:28Z","closed_at":null,"author_association":"NONE","body":"(More of a detail than an issue with `pmgo`, but I spent some time debugging a bug that was caused by this so I'm hoping that noting it down here can help other people later.)\r\n\r\nChild processes that the `pmgo` daemon manages have the same working directory as the `pmgo` process. This means the working directory is **not** the project folder, so relative file paths can break.\r\n\r\nTo get around this, you can change the working directory:\r\n\r\n```\r\nimport (\r\n        \"os\"\r\n...\r\n\r\nfunc main() {\r\n        gopath := os.Getenv(\"GOPATH\")\r\n        err := os.Chdir(gopath + \"/src/{path to project}\")\r\n        if err != nil {\r\n                fmt.Println(\"error changing directories: \", err)\r\n        }\r\n...\r\n```"}}
{"actor":{"display_login":"Anton-Cao"}}