{"blog_title":"podhmo's diary","height":"190","author_name":"podhmo","published":"2018-02-22 21:28:04","url":"https://pod.hatenablog.com/entry/2018/02/22/212804","provider_url":"https://hatena.blog","width":"100%","version":"1.0","categories":["golang","memo"],"image_url":null,"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpod.hatenablog.com%2Fentry%2F2018%2F02%2F22%2F212804\" title=\"package\u304b\u3089filepath\u3092\u63a8\u6e2c\u3059\u308b\u65b9\u6cd5\u3042\u308b\u3044\u306f\u305d\u306e\u9006 - podhmo&#39;s diary\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","blog_url":"https://pod.hatenablog.com/","author_url":"https://blog.hatena.ne.jp/podhmo/","provider_name":"Hatena Blog","type":"rich","title":"package\u304b\u3089filepath\u3092\u63a8\u6e2c\u3059\u308b\u65b9\u6cd5\u3042\u308b\u3044\u306f\u305d\u306e\u9006","description":"package\u304b\u3089filepath\u3092\u63a8\u6e2c\u3059\u308b\u65b9\u6cd5\u306a\u3069\u3092\u307e\u3068\u3081\u3066\u304a\u304d\u305f\u304b\u3063\u305f\u3002 (\u3064\u3044\u3067\u306b\u500b\u4eba\u7684\u306a\u4fe1\u4ef0\u304b\u3089\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f~\u306b\u306a\u3063\u3066\u3044\u308b) package\u304b\u3089filepath package main import ( \"go/build\" \"os\" \"os/user\" \"path/filepath\" \"strings\" \"github.com/pkg/errors\" ) func guessPath(pkgname string) (string, error) { ctxt := build.Default for _, srcdir := range ctxt.SrcDirs() { \u2026"}