Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Support importing godep config during dep init #577

Closed
darkowlzz opened this issue May 13, 2017 · 5 comments · Fixed by #742
Closed

Support importing godep config during dep init #577

darkowlzz opened this issue May 13, 2017 · 5 comments · Fixed by #742

Comments

@darkowlzz
Copy link
Collaborator

Similar to #380 , part of epic #186 .

@darkowlzz
Copy link
Collaborator Author

Is anybody secretly working on it or have an 👁 on it?

I'm about to give it a try. Will post findings and questions here.

Any suggestions/advise/tips are welcome.

@darkowlzz
Copy link
Collaborator Author

darkowlzz commented May 14, 2017

Posting some available code to refer at glide/godep/godep.go :)

@sdboyer
Copy link
Member

sdboyer commented May 14, 2017

sweet!

ping @carolynvs - you should weigh in, we def want to make sure the same pattern of relying on the Analyzer is used here 😄

@carolynvs
Copy link
Collaborator

@darkowlzz You may want to take a look at #500 where I have import working for glide, and hope to have that merged this week. I am still hammering out / slimming down the interface for importers, so that will likely change (removing unnecessary methods).

The general idea is that when importers are enabled (i.e. -skip-tools isn't present), the init command will use an importAnalyzer to call the applicable importers for other tools (like glide or godep), and then combine their results with what init does today to fill in the gaps.

So if you wanted to try to build on top of that PR:

  1. Make a godep config struct which can read in the config files and convert them to a glide manifest and lock. Example: glideConfig.go
  2. Add unit tests for the config struct. Example: glideConfig_test.go
  3. Make a godep importer struct that handles detecting config and converting if applicable. Example: glideImporter. This is the interface that I'm hoping to make smaller, hopefully removing DeriveManifestAndLock and PostSolveShenanigans (which was a placeholder name 😁).
  4. Add integration tests for importing godep. Example: glide import test case](https://github.com/golang/dep/pull/500/files#diff-32d63b76ca0ad2ef4b4f0436a9ede556)

I'd love any feedback you have as you work on this, nothing is set in stone.

@darkowlzz
Copy link
Collaborator Author

Created #589 based on @carolynvs 's #500.

Seems to work, but I would need help from others to verify that it works as expected.

Godep struct:

type Godeps struct {
	ImportPath   string
	GoVersion    string   // Abridged output of 'go version'.
	GodepVersion string   // Abridged output of 'godep version'
	Packages     []string // Arguments to godep save, if any.
	Deps         []struct {
		ImportPath string
		Comment    string // Description of commit, if present.
		Rev        string // VCS-specific commit ID.
	}
}

From the above Godep struct, godep importer implemented in #589 ignores GoVersion, GodepVersion and Packages. I couldn't figure out how Packages could be used. If someone could explain how we could use it, would be great :)

Some vendoring tools support import path rewriting, I couldn't find that in godep. Hence, no import path rewriting.

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

Successfully merging a pull request may close this issue.

3 participants