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

Improve VCS detection #68

Closed
phifty opened this issue Mar 15, 2017 · 6 comments
Closed

Improve VCS detection #68

phifty opened this issue Mar 15, 2017 · 6 comments

Comments

@phifty
Copy link

phifty commented Mar 15, 2017

Hi,

Thanks for the great work on glide! It seems pretty streaigh-forward to me and helps really a lot to manage dependecies.
There is one thing I've noticed about the VCS detection. I have some dependendies of my project in private repositories and Glide cannot detect the vcs from the package name. I can fix this by specifying repo and vcs in the glide.yml, but I think it could be done automatically. The go-import header in the HTML fetched afterwards (see https://github.com/Masterminds/vcs/blob/master/vcs_remote_lookup.go#L107) contains the right VCS. The HTML is just not fetched, because the function returns the error before. By changing the flow here, the usibility could be improved without breaking anything.

Best regards

@mattfarina
Copy link
Member

What error is returned at what point in your case?

@dmitshur
Copy link

Just as an observation, it looks like that the detectVcsFromRemote function and most of vcs_remote_lookup.go file can be replaced by a solution provided by the tools sub-repository of the Go project:

https://godoc.org/golang.org/x/tools/go/vcs#RepoRootForImportPath

// RepoRootForImportPath analyzes importPath to determine
// the version control system, and code repository to use.

It returns a RepoRoot, containing:

type RepoRoot struct {
    VCS *Cmd

    // Repo is the repository URL, including scheme.
    Repo string

    // Root is the import path corresponding to the root of the
    // repository.
    Root string
}

vcs.RepoRootForImportPath is the same code that cmd/go uses internally to implement go get functionality, so it's very accurate. It's located in the tools sub-repository so that other projects can import it and reuse it.

@mattfarina
Copy link
Member

I'm familiar with that codebase. Are you suggesting importing golang.org/x/tools/go/vcs to be able to use the one function?

You'll find this lib detects things like git.launchpad.net which the tools/vcs package doesn't. How would you handle that?

@dmitshur
Copy link

Does go get work on git.launchpad.net?

Is it a goal to have the same behavior for resolving import paths to underlying VCS information as go get does?

@phifty
Copy link
Author

phifty commented Mar 23, 2017

@mattfarina I don't have the exact error right now, but it was basically just can't detect VCS (or similar). I'm pretty sure, that not much more information was given. I hope that helps.

@mattfarina
Copy link
Member

Closing since this has not had any movement in 5 years and some things have changed since then.

Note, the go tooling has changed to detect things differently. This may be useful for this package but I would as those requests come as separate issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants