FAQ
I'm trying to work out a redirect with the meta tag as
described http://golang.org/cmd/go/#hdr-Remote_import_paths for the target
system being authenticated git over ssh, and I wonder what the value of
repo-root should be in this case in the go-import meta tag, content field.
  The spec says:

<meta name="go-import" content="import-prefix vcs repo-root">
and gives and example of the import of "example.org/pkg/foo" and the
redirect page containing the tag:
<meta name="go-import" content="example.org git
" rel="nofollow">https://code.org/r/p/exproj">

I'm trying to figure out what I should put instead of https://code.org...
  I tried first to return https://code.org and use the insteadOf setting in
.gitconfig:
[url "git@code.org:"]
insteadOf = https://code.org/

It works in the sense that it checks out the code - but then go get
complains:
example.org/pkg/foo is a custom import path for https://code.org/pkg/foo,
but /Users/dmitris/go/src/example.org/pkg/foo is checked out from
git@code.org:pkg/foo (...Bummer!)

I also tried to return as repo-root something like ssh://code.org:pkg/foo,
ssh://git@code.org:pkg/foo, git+ssh://git@code.org:pkg/foo, and
git+ssh://code.org:pkg/foo - but then the "git clone" did not work. The
expected git@code.org:pkg/foo would work - but "go get" does not like that
there is no known scheme...

Is there a solution that I'm missing? I would really appreciate a hint!

Thanks,

Dmitry

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Dmitri S at Feb 19, 2015 at 9:27 pm
    I was able to get it work perfectly for my use case - but I had to hack the
    go command and make a two-line change in vcs.go, namely put instead of
    http://golang.org/src/cmd/go/vcs.go#L639

        if !strings.Contains(metaImport.RepoRoot, "://") {
              return nil, fmt.Errorf("%s: invalid repo root %q; no scheme",
    urlStr, metaImport.RepoRoot)
        }
    the following:
    if !strings.Contains(metaImport.RepoRoot, "://") &&
    !strings.HasPrefix(metaImport.RepoRoot, "git@") {
         return nil, fmt.Errorf("%s: invalid repo root %q; no scheme and does
    not start with git@", urlStr, metaImport.RepoRoot)
    }

    The redirector (like "example.org?go-get=1" in the
    http://golang.org/cmd/go/#hdr-Remote_import_paths example) responds with a
    page containing the following meta tag:
    <meta name="go-import" content="go.corp.kulplace.com/y/dmitris/foo git
    git@git.corp.kulplace.com:dmitris/foo">

    With the change above, using "go get" does not require any "insteadOf"
    hacking in the ~/.gitconfig - which would make setting up the
    environment easier , especially for developers who are new to Go. And you
    also don't need to put the literal ".git" in the package names and can keep
    your import paths clean and tidy! :))

    Is there a way to do this without modifying the go command? (I spent a full
    day trying to find it, both playing with "go get" and trying to change the
    meta tag in all possible ways, and also reading the source code - and could
    not find it; but maybe I'm missing something obvious? Please let me know
    if so!). If not, would there be a chance to add this or similar change to
    the Go command? it does not break the tests... I would love to be able to
    use the standard toolchain and not have to maintain a custom fork :) -
    hopefully we would not be the only ones to benefit from the feature. I'd
    be happy to open an issue if it's not a categorical "no way, forget it".

    On Thursday, February 19, 2015 at 6:23:34 PM UTC+1, Dmitri S wrote:

    I'm trying to work out a redirect with the meta tag as described
    http://golang.org/cmd/go/#hdr-Remote_import_paths for the target system
    being authenticated git over ssh, and I wonder what the value of repo-root
    should be in this case in the go-import meta tag, content field. The spec
    says:

    <meta name="go-import" content="import-prefix vcs repo-root">
    and gives and example of the import of "example.org/pkg/foo" and the
    redirect page containing the tag:
    <meta name="go-import" content="example.org git
    " rel="nofollow">https://code.org/r/p/exproj">

    I'm trying to figure out what I should put instead of https://code.org...
    I tried first to return https://code.org and use the insteadOf setting
    in .gitconfig:
    [url "git@code.org:"]
    insteadOf = https://code.org/

    It works in the sense that it checks out the code - but then go get
    complains:
    example.org/pkg/foo is a custom import path for https://code.org/pkg/foo,
    but /Users/dmitris/go/src/example.org/pkg/foo is checked out from
    git@code.org:pkg/foo (...Bummer!)

    I also tried to return as repo-root something like ssh://code.org:pkg/foo,
    ssh://git@code.org:pkg/foo, git+ssh://git@code.org:pkg/foo, and
    git+ssh://code.org:pkg/foo - but then the "git clone" did not work. The
    expected git@code.org:pkg/foo would work - but "go get" does not like that
    there is no known scheme...

    Is there a solution that I'm missing? I would really appreciate a hint!

    Thanks,

    Dmitry
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Feyyaz Esatoglu at Feb 19, 2015 at 11:48 pm
    http://blog.wercker.com/2013/09/23/import-go-package-from-private-git-repository.html
    in this blog post author writes post againts private repo on github or
    bitbucket but in "No SSH Support" section he gave some information, it may
    help you.
    On Thursday, February 19, 2015 at 7:23:34 PM UTC+2, Dmitri S wrote:

    I'm trying to work out a redirect with the meta tag as described
    http://golang.org/cmd/go/#hdr-Remote_import_paths for the target system
    being authenticated git over ssh, and I wonder what the value of repo-root
    should be in this case in the go-import meta tag, content field. The spec
    says:

    <meta name="go-import" content="import-prefix vcs repo-root">
    and gives and example of the import of "example.org/pkg/foo" and the
    redirect page containing the tag:
    <meta name="go-import" content="example.org git
    " rel="nofollow">https://code.org/r/p/exproj">

    I'm trying to figure out what I should put instead of https://code.org...
    I tried first to return https://code.org and use the insteadOf setting
    in .gitconfig:
    [url "g...@code.org <javascript:>:"]
    insteadOf = https://code.org/

    It works in the sense that it checks out the code - but then go get
    complains:
    example.org/pkg/foo is a custom import path for https://code.org/pkg/foo,
    but /Users/dmitris/go/src/example.org/pkg/foo is checked out from
    git@code.org:pkg/foo (...Bummer!)

    I also tried to return as repo-root something like ssh://code.org:pkg/foo,
    ssh://git@code.org:pkg/foo, git+ssh://git@code.org:pkg/foo, and
    git+ssh://code.org:pkg/foo - but then the "git clone" did not work. The
    expected git@code.org:pkg/foo would work - but "go get" does not like that
    there is no known scheme...

    Is there a solution that I'm missing? I would really appreciate a hint!

    Thanks,

    Dmitry
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Dmitri S at Feb 20, 2015 at 11:20 pm
    I was able to solve the problem with:
    - returning https://code.org in the meta tag (not git@)
    - using the "insteadOf" setting in .gitconfig (can be done by editing
    ~/.gitconfig or the command: git config --global
    url."git@example.com:".insteadOf "https://example.com/" )
    - using -u *-f* options for "go get" to prevent this error " [...] is a
    custom import path for https://code.org/pkg/foo, but [...] is checked out
    from git@..."

    Documentation for the go get -f option:

    The -f flag, valid only when -u is set, forces get -u not to verify that
    each package has been checked out from the source control repository
    implied by its import path. This can be useful if the source is a local fork
    of the original.
    On Thursday, February 19, 2015 at 6:23:34 PM UTC+1, Dmitri S wrote:

    I'm trying to work out a redirect with the meta tag as described
    http://golang.org/cmd/go/#hdr-Remote_import_paths for the target system
    being authenticated git over ssh, and I wonder what the value of repo-root
    should be in this case in the go-import meta tag, content field. The spec
    says:

    <meta name="go-import" content="import-prefix vcs repo-root">
    and gives and example of the import of "example.org/pkg/foo" and the
    redirect page containing the tag:
    <meta name="go-import" content="example.org git
    " rel="nofollow">https://code.org/r/p/exproj">

    I'm trying to figure out what I should put instead of https://code.org...
    I tried first to return https://code.org and use the insteadOf setting
    in .gitconfig:
    [url "git@code.org:"]
    insteadOf = https://code.org/

    It works in the sense that it checks out the code - but then go get
    complains:
    example.org/pkg/foo is a custom import path for https://code.org/pkg/foo,
    but /Users/dmitris/go/src/example.org/pkg/foo is checked out from
    git@code.org:pkg/foo (...Bummer!)

    I also tried to return as repo-root something like ssh://code.org:pkg/foo,
    ssh://git@code.org:pkg/foo, git+ssh://git@code.org:pkg/foo, and
    git+ssh://code.org:pkg/foo - but then the "git clone" did not work. The
    expected git@code.org:pkg/foo would work - but "go get" does not like that
    there is no known scheme...

    Is there a solution that I'm missing? I would really appreciate a hint!

    Thanks,

    Dmitry
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 19, '15 at 5:23p
activeFeb 20, '15 at 11:20p
posts4
users2
websitegolang.org

2 users in discussion

Dmitri S: 3 posts Feyyaz Esatoglu: 1 post

People

Translate

site design / logo © 2022 Grokbase