-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a go-import meta tag, necessary for go get to work #161
Conversation
Hi, thanks for the contribution! It is a niche feature indeed, but it doesn't add any complexity, so I'm OK with adding it. I'll add a few source code nitpicks that should be resolved before the merge |
Let's make this a bit clearer for me first: Where can I read this up? Why is this necessary for go get? |
This should explain the behaviour of |
If I understand things correctly, this could also be solved by serving all repositories under the Having said that, I need some help understanding the documentation you pointed me at:
The same meta tag? How can example.org (read: your "landing page") contain the path to exproj (a specific repository)? |
Yes it can work with the .git suffix however in that case your imports need to be suffixed too. So instead of importing The part you quoted has to do with subpackages I think. Not 100% sure about it because I'm learning on the way too, I only started using custom imports yesterday. When go getting the package https://gopkg.in/mgo.v2/bson (gopkg.in is a service that uses the same custom imports to work) I get this:
So as far as I understand this output, every subpackage (subdirectory essentially) of a repo should have a meta tag that points to the root of the repo. |
The |
Well with the |
Are you saying that no modification to the klaus source code is necessary at all? I'm not familiar with the Go ecosystem. Would you say it's frowned upon to use |
yes it looks like it. I deployed master on my webserver, and it worked. As the doc says, when suffixed with The only downside really is that now the import paths (and the directory name) has a With that said, I just realized my PR is not enough to handle go getting sub packages, for example At this point I think it's becoming too complicated, because that use case would involve having multiple dynamic routes dependent on the directories in the repository you're in...I have no idea how to do that, nor do I really want to :) I think the best thing to do is to leave Klaus like it is: in my personal case I'm just hardcoding the meta tag that I want, it's no big deal. In the general case we can just use Klaus with the |
OK, cool! Thanks for bringing this up anyways. For future reference, if anyone is interested in implementing "proper" support for I'll also link this ticket in the Wiki. |
Hi,
discovered klaus yesterday, extremely happy with it, thanks a lot :)
I mostly work with Go and one thing I wanted to be able to do is make my projects "go get-able" meaning you could run
go get git.mydomain.com/myproject
and it would work.By default go get works with popular source hosting services like github, bitbucket, and there's a way to make it handle any custom url: you put a simple tag on any url you want which points
go get
to the git url repository.I'm not sure if it's really something you would want to include because it's a super niche feature in my opinion, but I figured since I made the patch might as well share it.