{"action":"created","issue":{"url":"https://api.github.com/repos/constabulary/gb/issues/284","labels_url":"https://api.github.com/repos/constabulary/gb/issues/284/labels{/name}","comments_url":"https://api.github.com/repos/constabulary/gb/issues/284/comments","events_url":"https://api.github.com/repos/constabulary/gb/issues/284/events","html_url":"https://github.com/constabulary/gb/issues/284","id":98413513,"number":284,"title":"structuring a project to build with gb but also to be friendly to `go get` et al","user":{"login":"oconnor663","id":860932,"avatar_url":"https://avatars.githubusercontent.com/u/860932?v=3","gravatar_id":"","url":"https://api.github.com/users/oconnor663","html_url":"https://github.com/oconnor663","followers_url":"https://api.github.com/users/oconnor663/followers","following_url":"https://api.github.com/users/oconnor663/following{/other_user}","gists_url":"https://api.github.com/users/oconnor663/gists{/gist_id}","starred_url":"https://api.github.com/users/oconnor663/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oconnor663/subscriptions","organizations_url":"https://api.github.com/users/oconnor663/orgs","repos_url":"https://api.github.com/users/oconnor663/repos","events_url":"https://api.github.com/users/oconnor663/events{/privacy}","received_events_url":"https://api.github.com/users/oconnor663/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-31T15:29:16Z","updated_at":"2015-08-02T02:07:28Z","closed_at":"2015-08-02T02:07:28Z","body":"It doesn't seem like it's possible to create a project that will build with `gb build` while *also* being friendly to people fetching my project with `go get`. Have I missed anything obvious?\r\n\r\nI've created an example project at https://github.com/oconnor663/gbexample. It looks like this:\r\n\r\n```\r\n.\r\n└── src\r\n    └── github.com\r\n        └── oconnor663\r\n            └── gbexample\r\n                ├── libexample\r\n                │   └── libexample.go\r\n                └── main.go\r\n```\r\n\r\nThis builds and runs great with `gb build`. But if I try to fetch and build with the regular Go tool, I get failures:\r\n\r\n```\r\ngo get github.com/oconnor663/gbexample      # gives an error, but still works\r\ngo install github.com/oconnor663/gbexample  # fails\r\n```\r\n\r\nThat's because `main.go` imports `libexample` the way `gb` understands it, like this\r\n\r\n```go\r\nimport  \"github.com/oconnor663/gbexample/libexample\"\r\n```\r\n\r\nInstead of the way standard `go build` sees it, which would've been this kind of gross path:\r\n\r\n```go\r\nimport  \"github.com/oconnor663/gbexample/src/github.com/libexample\"\r\n```\r\n\r\nThe workaround for regular `go build` seems to be to give it a special place in my `GOPATH` like this:\r\n\r\n    export GOPATH=\"$GOPATH:[whatever]/gbexample\"\r\n\r\nThat works in a pinch, but it means that you can't use the regular `go get` workflow to fetch dependencies for a project that takes my `libexample` as a dependency. You'd have to do that `GOPATH` hack, even if `libexample` was a second- or third-order dependency. Not very friendly to anyone who might want to use my code.\r\n\r\nWhat would be *incredibly awesome* is if I were able to use symlinks to satisfy both build systems. Maybe like this:\r\n\r\n```\r\n.\r\n├── libexample\r\n│   └── libexample.go\r\n├── main.go\r\n└── src\r\n    └── github.com\r\n        └── oconnor663\r\n            └── gbexample -> ../../..\r\n```\r\n\r\nUnfortunately neither `gb build` nor `go build` will traverse symlinks by design. (https://github.com/constabulary/gb/issues/91)\r\n\r\nIs there another way to trick `gb` into building my otherwise-conventionally-structured project? If not, would it be possible to add a flag for this purpose. Maybe something like this?\r\n\r\n    gb build --pretend-import-path-for-the-cwd=github.com/oconnor663/gbexample\r\n\r\nApologies for the wall of text :) Thanks for building `gb`!"},"comment":{"url":"https://api.github.com/repos/constabulary/gb/issues/comments/126977536","html_url":"https://github.com/constabulary/gb/issues/284#issuecomment-126977536","issue_url":"https://api.github.com/repos/constabulary/gb/issues/284","id":126977536,"user":{"login":"davecheney","id":7171,"avatar_url":"https://avatars.githubusercontent.com/u/7171?v=3","gravatar_id":"","url":"https://api.github.com/users/davecheney","html_url":"https://github.com/davecheney","followers_url":"https://api.github.com/users/davecheney/followers","following_url":"https://api.github.com/users/davecheney/following{/other_user}","gists_url":"https://api.github.com/users/davecheney/gists{/gist_id}","starred_url":"https://api.github.com/users/davecheney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davecheney/subscriptions","organizations_url":"https://api.github.com/users/davecheney/orgs","repos_url":"https://api.github.com/users/davecheney/repos","events_url":"https://api.github.com/users/davecheney/events{/privacy}","received_events_url":"https://api.github.com/users/davecheney/received_events","type":"User","site_admin":false},"created_at":"2015-08-02T02:07:28Z","updated_at":"2015-08-02T02:07:28Z","body":"> It doesn't seem like it's possible to create a project that will build with gb build while also being friendly to people fetching my project with go get. Have I missed anything obvious?\r\n\r\nI'm sorry for not replying in detail. You have not missed anything, gb projects are not go gettable. This is very much by design; if gb was just another tool that tried to work within the limitations of GOPATH and go get, what would be the compelling factor for people to use it ?"}}