rancher/trash

Git submodules support

bdandy opened this issue · 4 comments

Subject. If project use some package as submodule, it will not work with trash.

Are you talking about vendored packages using submodules? Do you have an example?

I think this is what @bogdan-d is referring to: Masterminds/glide#776

the TL;DR scenario:

$GOPATH/src/my-pkg/submodule-pkg

In, for example, main.go:

import (
    "my-pkg/submodule-pkg"
)

Glide fails with a cannot find SVC error. In glide, this is easily solved by adding that submodule to the ignore list (it's your repo, your submodule, you manage it).
Adding ignore to trash might be worth investigating

My point was not to ignore submodules, but also check out them like with git submodule update --init

@bogdan-d That would make them a nightmare to maintain. How do you update the version of a submodule reliably? The problem I've experienced with having something like vendor/submodule, and then introducing a package manager is that it just removes the submodules already in vendor. You'd probably have to create a yaml file something along the lines of:

- package: package-name
  version: tag/sha1/...
  type: submodule
  repo: optional repo

But submodules are a git thing. SVN has externals, and mercurial has subrepositories. They behave similarly, but there are differences. Also, internally trash and glide, and most other managers rely on go get. They also cache dependencies. Submodules can't be processed in the same way. They'd have to rely on whatever version git/svn/mercurial someone is running locally, which puts you at the mercy of third party binaries.

If one decides to track the vendor directory (which, in case of submodules is a requirement), you can't simply strip the .git directory, as glide does by default.

TL;DR: having a dependency manager handle submodules is something I believe is unlikely to happen. People use(d) submodules en lieu of a dependency manager. Handling a SVC specific construct, AFAIK, implies:

  • Relying on third party binaries working as expected
  • Bypassing dependency managers' cache
  • Ropey handling of updates and removals of packages
  • ... list could go on forever