Masterminds / glide

Package Management for Golang
https://glide.sh
Other
8.15k stars 541 forks source link

Glide install can't handle deep directories #1006

Open nathanjsweet opened 6 years ago

nathanjsweet commented 6 years ago

glide version:

13.2

given the following config:

package: gitlab.com/silexica/cloud/controller
import:
- package: github.com/BurntSushi/toml
  version: ~0.3.0
- package: github.com/sirupsen/logrus
  version: ~1.0.6
- package: github.com/spf13/cobra
  version: ~0.0.3
- package: gitlab.com/silexica/cloud/api
  repo: https://gitlab.com/silexica/cloud/api.git
  vcs: git
  subpackages:
  - client
  - client/execution

running

glide install

I get the following errors:

[ERROR] Error scanning gitlab.com/silexica/cloud/api/client: cannot find package "." in:
    /home/nathan/.glide/cache/src/https-gitlab.com-silexica-cloud-api.git/api/client
[ERROR] Error scanning gitlab.com/silexica/cloud/api/client/execution: cannot find package "." in:
    /home/nathan/.glide/cache/src/https-gitlab.com-silexica-cloud-api.git/api/client/execution
[ERROR] Failed to retrieve a list of dependencies: Error resolving imports

It cannot seem to figure out that the package is two directories deep.

peterfraedrich commented 6 years ago

I too am seeing this issue with a package hosted in a Gitlab subproject.

glide version:

0.13.1

glide config:

- package: golang.org/x/sys
  subpackages:
  - unix
- package: gitlab.com/somegroup/someproject/somerepo
  repo: https://gitlab.com/somegroup/someproject/somerepo.git
- package: github.com/dgrijalva/jwt-go
  version: ^3.2.0

running glide install:

❯ glide install
[INFO]  Lock file (glide.lock) does not exist. Performing update.
[INFO]  Downloading dependencies. Please wait...
[INFO]  --> Fetching updates for golang.org/x/sys
[INFO]  --> Fetching updates for github.com/gobuffalo/packr
[INFO]  --> Fetching updates for gopkg.in/yaml.v2
[INFO]  --> Fetching gitlab.com/taskfitio/fit-proto
[INFO]  --> Fetching updates for github.com/dgrijalva/jwt-go
[INFO]  --> Fetching updates for github.com/shirou/gopsutil
[INFO]  --> Fetching updates for github.com/davecgh/go-spew
[WARN]  Unable to checkout gitlab.com/taskfitio/fit-proto
[ERROR] Update failed for gitlab.com/somegroup/someproject/somerepo: Unable to get repository: Cloning into '/Users/frg105/.glide/cache/src/https-gitlab.com-somegroup-someproject-somerepo'...
remote: The project you were looking for could not be found.
fatal: repository 'https://gitlab.com/somegroup/someproject.git/' not found
: exit status 128
[ERROR] Failed to do initial checkout of config: Unable to get repository: Cloning into '/Users/frg105/.glide/cache/src/https-gitlab.com-somegroup-someproject-somerepo'...
remote: The project you were looking for could not be found.
fatal: repository 'https://gitlab.com/somegroup/someproject.git/' not found
: exit status 128

It looks that glide is expecting a certain group/project/repo format in the repo URI instead of working backwards from the end of the URI string.

moooofly commented 5 years ago

Meeting the same issue with a package hosted in a Gitlab subproject.

$glide -v
glide version v0.13.1

$glide update
[INFO]  Downloading dependencies. Please wait...
[INFO]  --> Fetching updates for github.com/golang/protobuf
[INFO]  --> Fetching git.llsapp.com/ops/hunter
[INFO]  --> Fetching updates for go.opencensus.io
[INFO]  --> Fetching updates for golang.org/x/net
[INFO]  --> Fetching updates for google.golang.org/grpc
Username for 'https://git.llsapp.com': fei.sun
Password for 'https://fei.sun@git.llsapp.com':
[WARN]  Unable to checkout git.llsapp.com/ops/hunter
[ERROR] Update failed for git.llsapp.com/ops/hunter: Unable to get repository: Cloning into '/root/.glide/cache/src/https-git.llsapp.com-ops-hunter'...
remote: The project you were looking for could not be found.
fatal: repository 'https://git.llsapp.com/ops/hunter.git/' not found
: exit status 128
[ERROR] Failed to do initial checkout of config: Unable to get repository: Cloning into '/root/.glide/cache/src/https-git.llsapp.com-ops-hunter'...
remote: The project you were looking for could not be found.
fatal: repository 'https://git.llsapp.com/ops/hunter.git/' not found
: exit status 128

It looks that glide is expecting a certain group/project/repo format in the repo URI instead of working backwards from the end of the URI string.

I think this is the key.

moooofly commented 5 years ago

@nathanjsweet the error you met may be related with the situation that your target repo is on a wrong branch or tag or commit id.

Nalum commented 5 years ago

I have just moved some of my groups to subgroups because of paid features we require on gitlab.com and have come up against this issue. Other than not using glide or not tracking this particular set of repos in glide is there a work around for this?

Edit: Didn't notice this in the opening comment:

- package: gitlab.com/silexica/cloud/api
  repo: https://gitlab.com/silexica/cloud/api.git
  vcs: git
  subpackages:
  - client
  - client/execution

If you change repo from https://gitlab.com/silexica/cloud/api.git to git@gitlab.com:silexica/cloud/api.git that will work. Just figured that out now.

peterfraedrich commented 5 years ago

Use godep

On Thu, Oct 11, 2018 at 4:55 AM Luke Mallon notifications@github.com wrote:

I have just moved some of my groups to subgroups because of paid features we require on gitlab.com and have come up against this issue. Other than not using glide or not tracking this particular set of repos in glide is there a work around for this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Masterminds/glide/issues/1006#issuecomment-428875662, or mute the thread https://github.com/notifications/unsubscribe-auth/AGbgOch3JDnmB6ojbOlEWxwVJY0rhYNGks5ujweXgaJpZM4VuiXj .

Nalum commented 5 years ago

Nevermind my edited comment. Setting repo to the git url didn't work, not sure why it appeared to work on my other machine yesterday.

Running it on this machine I get the following output when running glide up

[ERROR] Error scanning gitlab.com/group/subgroup/repo/pkg/subpkg: cannot find package "." in:
        /home/nalum/.glide/cache/src/git-gitlab.com-group-subgroup-repo.git/repo/pkg/subpkg
[ERROR] Failed to retrieve a list of dependencies: Error resolving imports

Looking in the cache the repo is cloned directly into /home/nalum/.glide/cache/src/git-gitlab.com-group-subgroup-repo.git and not the subfolder of /home/nalum/.glide/cache/src/git-gitlab.com-group-subgroup-repo.git/repo.