Added support for Go's repository retrieval.
Created by: brunoga
- Simply adds the relevant meta link in the project's show action.
- Information about this meta tag can be found here: http://golang.org/cmd/go/#hdr-Remote_import_paths
Note I am not sure how to do unit tests for this, but I am willing to do those if someone can point me to how to do it. Also I did not update the CHANGELOG as I am not sure where to put the change. Is it under v6.5.0?
Merge request reports
Activity
Created by: brunoga
Forgot to mention that this implements this suggestion: http://feedback.gitlab.com/forums/176466-general/suggestions/5252663-golang-support-or-easy-clone-via-base-url-
By Administrator on 2013-12-30T15:40:57 (imported from GitLab project)
By Administrator on 2013-12-30T15:40:57 (imported from GitLab)
Created by: dosire
You can't reply to issues
On Mon, Dec 30, 2013 at 9:19 PM, Bruno Albuquerque <notifications@github.com
wrote:
You are right. Changed it to use the web_url method. I had to add a similar method to get the project url without the scheme part.
— Reply to this email directly or view it on GitHubhttps://github.com/gitlabhq/gitlabhq/pull/5958#issuecomment-31366158 .
By Administrator on 2013-12-30T21:14:49 (imported from GitLab project)
By Administrator on 2013-12-30T21:14:49 (imported from GitLab)
201 201 [Gitlab.config.gitlab.url, path_with_namespace].join("/") 202 202 end 203 203 204 def web_url_without_protocol 201 201 [Gitlab.config.gitlab.url, path_with_namespace].join("/") 202 202 end 203 203 204 def web_url_without_protocol 205 web_url.split("://")[1] Created by: dosire
What if Gitlab.config.gitlab.url is www.example.com? (doesn't include the protocol)
Please add tests for this
By Administrator on 2014-01-20T13:01:38 (imported from GitLab project)
By Administrator on 2014-01-20T13:01:38 (imported from GitLab)
201 201 [Gitlab.config.gitlab.url, path_with_namespace].join("/") 202 202 end 203 203 204 def web_url_without_protocol Created by: brunoga
The formal name for this part of a URI is scheme. But I would be ok changing it to protocol if you prefer.
http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax
By Administrator on 2014-01-20T13:01:38 (imported from GitLab project)
By Administrator on 2014-01-20T13:01:38 (imported from GitLab)
201 201 [Gitlab.config.gitlab.url, path_with_namespace].join("/") 202 202 end 203 203 204 def web_url_without_protocol 205 web_url.split("://")[1] 201 201 [Gitlab.config.gitlab.url, path_with_namespace].join("/") 202 202 end 203 203 204 def web_url_without_protocol 205 web_url.split("://")[1] Created by: brunoga
Actually, this should never happen. The user-configurable component of this is the host name only. Then the web_url is built by build_gitlab_url in config/initializers/01_settings.rb (note the "://" is a constant on the url even if protocol is not present, so this would work anyway unless there was an empty host name, which is probably not allowed). i can still add a test for this if you want. Please let me know.
By Administrator on 2014-01-20T13:01:38 (imported from GitLab project)
By Administrator on 2014-01-20T13:01:38 (imported from GitLab)
201 201 [Gitlab.config.gitlab.url, path_with_namespace].join("/") 202 202 end 203 203 204 def web_url_without_protocol 205 web_url.split("://")[1] 201 201 [Gitlab.config.gitlab.url, path_with_namespace].join("/") 202 202 end 203 203 204 def web_url_without_protocol 201 201 [Gitlab.config.gitlab.url, path_with_namespace].join("/") 202 202 end 203 203 204 def web_url_without_protocol 205 web_url.split("://")[1] Created by: brunoga
Yes, please. I actually asked for pointers in a previous comment. :) In any case, here is what i said:
Ok, will do it. I searched but could not find where unit tests usually go in the gitlab codebase. Can you give me some pointers?
By Administrator on 2014-01-20T12:40:51 (imported from GitLab project)
By Administrator on 2014-01-20T12:40:51 (imported from GitLab)
Created by: dosire
@brunoga I saw it in an email, I just couldn't find the comment here anymore :-)
Anyway, this should probably go in the project spec, just below other url functions in there https://github.com/gitlabhq/gitlabhq/blob/master/spec/models/project_spec.rb#L97
By Administrator on 2014-01-20T12:43:54 (imported from GitLab project)
By Administrator on 2014-01-20T12:43:54 (imported from GitLab)
Created by: dosire
@brunoga You can set up your own environment https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/doc/development.md or wait for the Travis tests to run.
By Administrator on 2014-01-20T12:57:06 (imported from GitLab project)
By Administrator on 2014-01-20T12:57:06 (imported from GitLab)
Created by: brunoga
Travis seem to like the CL:
https://travis-ci.org/gitlabhq/gitlabhq/builds/17274227
This probably only means Travis is drunk tough. ;)
By Administrator on 2014-01-20T19:02:49 (imported from GitLab project)
By Administrator on 2014-01-20T19:02:49 (imported from GitLab)
Created by: dosire
Two people suddenly report problems with this on GitLab.com https://twitter.com/schmichael/status/466254402693496832
https://gitlab.com/snippets/1118
By Administrator on 2014-05-14T07:32:35 (imported from GitLab project)
By Administrator on 2014-05-14T07:32:35 (imported from GitLab)
Created by: brunoga
Thanks for the heads up. The error is weird and I would need a pointer to a repository where this is not working to be able to check what might be happening.
On Wed May 14 2014 at 4:33:00 AM, Sytse Sijbrandij notifications@github.com wrote:
Two people suddenly report problems with this on GitLab.com https://twitter.com/schmichael/status/466254402693496832
https://gitlab.com/snippets/1118
— Reply to this email directly or view it on GitHubhttps://github.com/gitlabhq/gitlabhq/pull/5958#issuecomment-43050527 .
By Administrator on 2014-05-14T11:15:26 (imported from GitLab project)
By Administrator on 2014-05-14T11:15:26 (imported from GitLab)
Created by: dosire
@brunoga You're way ahead of me :-) https://twitter.com/brunoga/status/466537439801405440
By Administrator on 2014-05-14T11:30:17 (imported from GitLab project)
By Administrator on 2014-05-14T11:30:17 (imported from GitLab)
Created by: schmichael
I don't think it's private:
Still getting:
$ GOPATH=$HOME/tmp go get -u -v gitlab.com/schmichael/go-signup Fetching https://gitlab.com/schmichael/go-signup?go-get=1 Parsing meta tags from https://gitlab.com/schmichael/go-signup?go-get=1 (status code 200) import "gitlab.com/schmichael/go-signup": parsing gitlab.com/schmichael/go-signup: XML syntax error on line 5: expected attribute name in element package gitlab.com/schmichael/go-signup: unrecognized import path "gitlab.com/schmichael/go-signup"
Thanks for looking into it gentlemen. Hopefully I'm just doing something wrong!
By Administrator on 2014-05-14T21:30:36 (imported from GitLab project)
By Administrator on 2014-05-14T21:30:36 (imported from GitLab)
Created by: brunoga
What do you get when you access this link in your browser? https://gitlab.com/schmichael/go-signup
I get a 404. On May 14, 2014 6:31 PM, "Michael Schurter" notifications@github.com wrote:
I don't think it's private:
[image: screenshot from 2014-05-14 14 29 21]https://cloud.githubusercontent.com/assets/113362/2977726/de6712d8-dbae-11e3-8ec1-89f66c6a883f.png
Still getting:
$ GOPATH=$HOME/tmp go get -u -v gitlab.com/schmichael/go-signup Fetching https://gitlab.com/schmichael/go-signup?go-get=1 Parsing meta tags from https://gitlab.com/schmichael/go-signup?go-get=1 (status code 200) import "gitlab.com/schmichael/go-signup": parsing gitlab.com/schmichael/go-signup: XML syntax error on line 5: expected attribute name in element package gitlab.com/schmichael/go-signup: unrecognized import path "gitlab.com/schmichael/go-signup"
Thanks for looking into it gentlemen. Hopefully I'm just doing something wrong!
— Reply to this email directly or view it on GitHubhttps://github.com/gitlabhq/gitlabhq/pull/5958#issuecomment-43140334 .
By Administrator on 2014-05-15T00:02:09 (imported from GitLab project)
By Administrator on 2014-05-15T00:02:09 (imported from GitLab)
Created by: jbowtie
Different repository, same error here.
$ go get -v gitlab.com/jbowtie/ratago Fetching https://gitlab.com/jbowtie/ratago?go-get=1 Parsing meta tags from https://gitlab.com/jbowtie/ratago?go-get=1 (status code 200) import "gitlab.com/jbowtie/ratago": parsing gitlab.com/jbowtie/ratago: XML syntax error on line 5: expected attribute name in element package gitlab.com/jbowtie/ratago: unrecognized import path "gitlab.com/jbowtie/ratago"
Telling go get that it's a git repo doesn't fare any better:
$ go get -v gitlab.com/jbowtie/ratago.git # cd .; git ls-remote git://gitlab.com/jbowtie/ratago fatal: unable to connect to gitlab.com: gitlab.com[0: 54.243.197.170]: errno=Connection timed out # cd .; git ls-remote https://gitlab.com/jbowtie/ratago fatal: https://gitlab.com/jbowtie/ratago/info/refs not valid: is this a git repository? # cd .; git ls-remote http://gitlab.com/jbowtie/ratago fatal: http://gitlab.com/jbowtie/ratago/info/refs not valid: is this a git repository? # cd .; git ls-remote git+ssh://gitlab.com/jbowtie/ratago Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
By Administrator on 2014-05-30T03:52:54 (imported from GitLab project)
By Administrator on 2014-05-30T03:52:54 (imported from GitLab)
Created by: brunoga
So what happens is that HTML is not necessarily valid XML, so go get breaks due to a "<" in that javascript code (which is interpreted as a tag being opened). The best solution would probably be to check if the URL contains ?go-get=1 https://gitlab.com/jbowtie/ratago?go-get=1 and, if so, return a simpler HTML("
<meta ...>").This should work but I will not be able to try to implement this in the foreseeable future. Do you think you can pass this along to someone else that could do it? it should not be that difficult (basically, use a different template if go-get=1 is present).
On Fri May 30 2014 at 9:09:20 AM, Sytse Sijbrandij notifications@github.com wrote:
Thanks for investigating Bruno!
— Reply to this email directly or view it on GitHub https://github.com/gitlabhq/gitlabhq/pull/5958#issuecomment-44643797.
By Administrator on 2014-05-30T12:56:22 (imported from GitLab project)
By Administrator on 2014-05-30T12:56:22 (imported from GitLab)
Created by: dosire
@brunoga Thanks for investigating. This would have to be community contributed and I'm not sure the technical complexity is acceptable. Can the be solved at the Golang side?
By Administrator on 2014-05-30T12:59:45 (imported from GitLab project)
By Administrator on 2014-05-30T12:59:45 (imported from GitLab)
Created by: jbowtie
I've submitted a bug report on the Golang side (https://code.google.com/p/go/issues/detail?id=8163); they shouldn't be using an XML parser to process HTML5.
After looking through their code, a simple solution would be to move the generation of the meta tag to the top of the
(or at least before the javascript is rendered).By Administrator on 2014-06-07T01:14:02 (imported from GitLab project)
By Administrator on 2014-06-07T01:14:02 (imported from GitLab)
Created by: dosire
@jbowtie I hope you are right, I submitted https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/128
By Administrator on 2014-06-18T14:19:45 (imported from GitLab project)
By Administrator on 2014-06-18T14:19:45 (imported from GitLab)
Created by: brunoga
This should work. Thanks for doing this.
On Wed Jun 18 2014 at 11:20:13 AM, Sytse Sijbrandij < notifications@github.com> wrote:
@jbowtie https://github.com/jbowtie I hope you are right, I submitted https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/128
— Reply to this email directly or view it on GitHub https://github.com/gitlabhq/gitlabhq/pull/5958#issuecomment-46441353.
By Administrator on 2014-06-18T18:20:11 (imported from GitLab project)
By Administrator on 2014-06-18T18:20:11 (imported from GitLab)
Created by: brunoga
Great.
On 1404289704625, Sytse Sijbrandij notifications@github.com wrote:
Will go out in GitLab 7.1
— Reply to this email directly or view it on GitHub https://github.com/gitlabhq/gitlabhq/pull/5958#issuecomment-47749445.
By Administrator on 2014-07-02T11:59:35 (imported from GitLab project)
By Administrator on 2014-07-02T11:59:35 (imported from GitLab)
Created by: jmunson
I'm still having this issue (" XML syntax error on line 6: expected attribute name in element"), trying to use go get to install something from a private gitlab repo on gitlab.com. The help page on gitlab says you're currently running GitLab Enterprise Edition 7.3.2-ee e4cb921 if that helps any.
By Administrator on 2014-10-06T17:05:39 (imported from GitLab project)
By Administrator on 2014-10-06T17:05:39 (imported from GitLab)
Created by: dosire
@jmunson Someone will have to troubleshoot this.
By Administrator on 2014-10-08T14:58:58 (imported from GitLab project)
By Administrator on 2014-10-08T14:58:58 (imported from GitLab)
Created by: brunoga
James.
Can you, by any chance, post here (or mail me) the top of the HTML code for the page in question? I just need the data up to (and including) the go specific stuff.
Em Wed Oct 08 2014 at 11:59:25 AM, Sytse Sijbrandij < notifications@github.com> escreveu:
@jmunson https://github.com/jmunson Someone will have to troubleshoot this.
— Reply to this email directly or view it on GitHub https://github.com/gitlabhq/gitlabhq/pull/5958#issuecomment-58371193.
By Administrator on 2014-10-08T16:06:13 (imported from GitLab project)
By Administrator on 2014-10-08T16:06:13 (imported from GitLab)
Created by: jmunson
Here is the results from a project used as an example earlier in the discussion, https://gitlab.com/jbowtie/ratago?go-get=1
I tried to paste the html, but I don't think github is fond of me pasting javascript into the comment box, so here's a gist: https://gist.github.com/jmunson/cfc501461467631fde24
By Administrator on 2014-10-08T17:11:36 (imported from GitLab project)
By Administrator on 2014-10-08T17:11:36 (imported from GitLab)
Created by: brunoga
So, this is exactly the same issue. There is some javascript code being inserted BEFORE the go import directive and this is what is breaking things. There are 2 things that might have happened:
1 - Somone did some change that added that code before the import directive. The solution here is probably to move the import directive to the top again and add a HUGE comment to the code mentioning nothing should be added above it. 2 - This is the enterprise version of Gitlab. Maybe it did not pick up the original fix for some reason?
Sytse?
Em Wed Oct 08 2014 at 2:12:18 PM, James Munson notifications@github.com escreveu:
Here is the results from a project used as an example earlier in the discussion, https://gitlab.com/jbowtie/ratago?go-get=1
I tried to paste the html, but I don't think github is fond of me pasting javascript into the comment box, so here's a gist: https://gist.github.com/jmunson/cfc501461467631fde24
— Reply to this email directly or view it on GitHub https://github.com/gitlabhq/gitlabhq/pull/5958#issuecomment-58392242.
By Administrator on 2014-10-08T17:27:30 (imported from GitLab project)
By Administrator on 2014-10-08T17:27:30 (imported from GitLab)
Created by: dosire
Below is the current (088774bc) state of EE (master)
Seems to be the top thing to me.
@jmunson What version are you on?
› git grep -C 15 go-import app/views/layouts/_head.html.haml-%head app/views/layouts/_head.html.haml- %meta{charset: "utf-8"} app/views/layouts/_head.html.haml- app/views/layouts/_head.html.haml- -# Go repository retrieval support app/views/layouts/_head.html.haml- -# Need to be the fist thing in the head app/views/layouts/_head.html.haml- -# Since Go is using an XML parser to process HTML5 app/views/layouts/_head.html.haml- -# https://github.com/gitlabhq/gitlabhq/pull/5958#issuecomment-45397555 app/views/layouts/_head.html.haml- - if controller_name == 'projects' && action_name == 'show' app/views/layouts/_head.html.haml: %meta{name: "go-import", content: "#{@project.web_url_without_protocol} git #{@project.web_url}.git"} app/views/layouts/_head.html.haml- %meta{content: "GitLab Enterprise Edition", name: "description"} app/views/layouts/_head.html.haml-
By Administrator on 2014-10-08T18:41:56 (imported from GitLab project)
By Administrator on 2014-10-08T18:41:56 (imported from GitLab)
Created by: jmunson
Thats using whatever is live on gitlab.com, as of the time of me posting this that is currently GitLab Enterprise Edition 7.3.2-ee e4cb921
By Administrator on 2014-10-08T19:44:35 (imported from GitLab project)
By Administrator on 2014-10-08T19:44:35 (imported from GitLab)
Created by: dosire
@jmunson Sorry, I missed that. I checked that commit but the git grep looks the same. The code inserted before contains
beacon-2.newrelic.com
so I think it is inserted by the newrelic gem.@jacobvosmaer I don't think we use the browser time tracking from New Relic heavily and I don't like that it is inserting tracking stuff in our header. Shall we disable it?
https://ellislab.com/expressionengine/user-guide/monitoring/new-relic.html To disable New Relic’s RUM JavaScript from being inserted, turn off the Enable New Relic RUM JavaScript? preference in the Output and Debugging settings.
By Administrator on 2014-10-08T20:03:09 (imported from GitLab project)
By Administrator on 2014-10-08T20:03:09 (imported from GitLab)
Created by: dosire
@jacobvosmaer OK, thanks. Please comment back when done.
By Administrator on 2014-10-09T08:03:20 (imported from GitLab project)
By Administrator on 2014-10-09T08:03:20 (imported from GitLab)
Created by: jacobvosmaer
I added an env setting for New Relic (
NEW_RELIC_BROWSER_MONITORING_AUTO_INSTRUMENT=false
) and I now see no more JS before themeta content=
declarations:$ curl -s https://gitlab.com/jbowtie/ratago?go-get=1 | sed "/meta content='GitLab/q" <!DOCTYPE html> <html lang='en'> <head> <meta charset='utf-8'> <meta content='gitlab.com/jbowtie/ratago git https://gitlab.com/jbowtie/ratago.git' name='go-import'> <meta content='GitLab Enterprise Edition' name='description'>
By Administrator on 2014-10-09T08:05:31 (imported from GitLab project)
By Administrator on 2014-10-09T08:05:31 (imported from GitLab)
Created by: dosire
@jacobvosmaer You mean you managed to disable RUM?
By Administrator on 2014-10-09T08:05:44 (imported from GitLab project)
By Administrator on 2014-10-09T08:05:44 (imported from GitLab)
Created by: dosire
@jacobvosmaer Awesome, thanks!
By Administrator on 2014-10-09T08:11:53 (imported from GitLab project)
By Administrator on 2014-10-09T08:11:53 (imported from GitLab)
Created by: lfyzjck
It seems that, golang can only recognized
<meta name='go-import' content='gitlab.com/jbowtie/ratago git https://gitlab.com/jbowtie/ratago.git'>
but not:<meta content='gitlab.com/jbowtie/ratago git https://gitlab.com/jbowtie/ratago.git' name='go-import'>
I still got error:
no go-import meta tags
even if i havego-import
meta tagsBy Administrator on 2014-10-14T04:07:33 (imported from GitLab project)
By Administrator on 2014-10-14T04:07:33 (imported from GitLab)
Created by: jacobvosmaer
@lfyzjck I am getting the following with Go 1.3.3:
$ GOPATH=/tmp go get -v gitlab.com/jbowtie/ratago Fetching https://gitlab.com/jbowtie/ratago?go-get=1 Parsing meta tags from https://gitlab.com/jbowtie/ratago?go-get=1 (status code 200) get "gitlab.com/jbowtie/ratago": found meta tag main.metaImport{Prefix:"gitlab.com/jbowtie/ratago", VCS:"git", RepoRoot:"https://gitlab.com/jbowtie/ratago.git"} at https://gitlab.com/jbowtie/ratago?go-get=1 gitlab.com/jbowtie/ratago (download) github.com/jbowtie/ratago (download) <snip>
It looks like it's working on gitlab.com at the moment.
By Administrator on 2014-10-14T07:36:08 (imported from GitLab project)
By Administrator on 2014-10-14T07:36:08 (imported from GitLab)
Created by: lfyzjck
@jacobvosmaer I have made a mistake, in my own project, i have make it's visibility to "Internal", when i call
go get package
, it just get a login page of gitlab. I have make it's visibility to "Public", and it just works.thanks for you help!
By Administrator on 2014-10-14T09:48:30 (imported from GitLab project)
By Administrator on 2014-10-14T09:48:30 (imported from GitLab)