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

"dep init" failes to import glide with an importpath to a remote subpackage #861

Closed
michael-go opened this issue Jul 20, 2017 · 3 comments
Closed
Assignees

Comments

@michael-go
Copy link
Contributor

given main.go:

package main

import "github.com/c9s/goprocinfo/linux"

func main() {
	linux.ReadStat("/proc/stat")
}

and glide.yaml:

package: demo
import:
- package: github.com/c9s/goprocinfo/linux

glide install works and creates glide.lock:

hash: fe4cb6bd2a948473e3fca37a298728aef1ffa50bd542157f2893fd78f56f5d08
updated: 2017-07-20T13:49:53.844798928+03:00
imports:
- name: github.com/c9s/goprocinfo
  version: b34328d6e0cd139894ea7347d2624ccf31fa3c58
  subpackages:
  - linux
testImports: []

however dep init fails.
I should mention that dep init does support importing remote subpackages (as it should https://golang.org/cmd/go/#hdr-Remote_import_paths), but seems that it gets confused by glide.yaml here

I stumbled upon this issue when playing with dep and trying to run dep init on a popular go repo https://github.com/bcicen/ctop

What version of Go (go version) and dep (git describe --tags) are you using?

go version: go1.8.3 linux/amd64
dep version: v0.1.0-236-g98f1d99

What dep command did you run?

dep init

What did you expect to see?

success

What did you see instead?

Importing configuration from glide. These are only initial constraints, and are further refined during the solve process.
Detected glide configuration files...
  Loading /home/michael/projects/gopath/src/dep-bug/glide.yaml
  Loading /home/michael/projects/gopath/src/dep-bug/glide.lock
Converting from glide.yaml and glide.lock...
  Using master as initial constraint for imported dep github.com/c9s/goprocinfo/linux
  Trying * (b34328d) as initial lock for imported dep github.com/c9s/goprocinfo
Root project is "dep-bug"
 1 transitively valid internal packages
 1 external packages imported from 1 projects
(0)   ✓ select (root)
(1)	? attempt github.com/c9s/goprocinfo/linux with 1 pkgs; 1 versions to try
(1)	    try github.com/c9s/goprocinfo/linux@master
(2)	✗   github.com/c9s/goprocinfo/linux at master has problem subpkg(s):
(2)	  	github.com/c9s/goprocinfo/linux has err (*build.NoGoError); required by (root).
(1)	  ← no more versions of github.com/c9s/goprocinfo/linux to try; begin backtrack
  ✗ solving failed

Solver wall times by segment:
  b-source-exists: 977.660627ms
      b-list-pkgs:  62.115878ms
      select-root:     347.29µs
          satisfy:    184.856µs
         new-atom:    150.751µs
  b-list-versions:     86.203µs
            other:      4.744µs

  TOTAL: 1.040550349s

No versions of github.com/c9s/goprocinfo/linux met constraints:
	master: Could not introduce github.com/c9s/goprocinfo/linux@master, as its subpackage github.com/c9s/goprocinfo/linux does not contain usable Go code (*build.NoGoError).. (Package is required by (root).)

It seems like dep tries to fetch github.com/c9s/goprocinfo/linux url directly instead of fetching the actual repository url github.com/c9s/goprocinfo

@michael-go michael-go changed the title init failes to import glide with an importpath to a remote subpackage "dep init" failes to import glide with an importpath to a remote subpackage Jul 20, 2017
@carolynvs carolynvs self-assigned this Jul 20, 2017
@carolynvs
Copy link
Collaborator

carolynvs commented Jul 20, 2017

This is the same root cause as #843. Thanks for the bug report!

@michael-go
Copy link
Contributor Author

@carolynvs It seem this bug is fixed (probably thanks to #1100)

Just tested on the example above and on an older revision of https://github.com/bcicen/ctop that failed for me when I opened this issue (8 days ago they moved to dep anyhow 😄 )

@carolynvs
Copy link
Collaborator

Thanks for the help finding fixed issues!

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

2 participants