Navigation Menu

Skip to content
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

x/tools/cmd/goimports: removes imports ending in ".git" or whatever vcs #8655

Closed
gopherbot opened this issue Sep 4, 2014 · 5 comments
Closed

Comments

@gopherbot
Copy link

by xofyarg:

What does 'go version' print?

go version go1.3.1 linux/amd64

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.

1. use a custom git repo: foo.com/bar.git
2. import "foo.com/bar.git" and add some code using it, say bar.Do()
3. call goimports

What happened?

it removes the import line above

What should have happened instead?

keep the import line
@bradfitz
Copy link
Contributor

bradfitz commented Sep 4, 2014

Comment 1:

The final path component of your import should be the same as your package name. 
"bar.git" isn't a valid package name.
This doesn't have anything to do with the git repo being private or not.
Can you give more details? Actual minimal example, and details of what the package name
actually is?

@gopherbot
Copy link
Author

Comment 2 by xofyarg:

If I strip the extension from the import path, then it is not go get-able. Here's a
quote from `go help importpath':
> For code hosted on other servers, import paths may either be qualified
> with the version control type, or the go tool can dynamically fetch
> the import path over https/http and discover where the code resides
> from a <meta> tag in the HTML.
> 
> To declare the code location, an import path of the form
> 
>         repository.vcs/path
> 
> specifies the given repository, with or without the .vcs suffix,
> using the named version control system, and then the path inside
> that repository.  The supported version control systems are:
> 
>         Bazaar      .bzr
>         Git         .git
>         Mercurial   .hg
>         Subversion  .svn
> 
> For example,
> 
>         import "example.org/user/foo.hg"
The go get command has some popular repositories hardcoded, to support custom repo, I
need to show the repo type.
The package is in our private server(sorry, not accessable from outside), and we have
some code like this: http://play.golang.org/p/6IiGpjOjgN

@ianlancetaylor
Copy link
Contributor

Comment 3:

Labels changed: added repo-tools.

@dmitshur
Copy link
Contributor

dmitshur commented Nov 22, 2014

My first guess is that it might be the regexp that matches imports doesn't take this possibility into account.

@bradfitz bradfitz removed the new label Dec 18, 2014
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title goimports: removes imports ending in ".git" or whatever vcs x/tools/cmd/goimports: removes imports ending in ".git" or whatever vcs Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-tools label Apr 14, 2015
@heschi
Copy link
Contributor

heschi commented Nov 7, 2019

Triaging old goimports bugs: I'm pretty sure this should be fixed by now, and a quick test seems to confirm it. Please comment if you disagree.

@heschi heschi closed this as completed Nov 7, 2019
@golang golang locked and limited conversation to collaborators Nov 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants