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

Move from Glide to Dep: dep ensure -add fails #1108

Closed
lawrencegripper opened this issue Feb 21, 2018 · 3 comments
Closed

Move from Glide to Dep: dep ensure -add fails #1108

lawrencegripper opened this issue Feb 21, 2018 · 3 comments
Assignees
Labels

Comments

@lawrencegripper
Copy link
Contributor

lawrencegripper commented Feb 21, 2018

Currently docs suggest the following method to import the SDK with dep however this fails with the latest version of dep

dep:
 version     : v0.4.1
 build date  : 2018-01-27
 git hash    : 37d9ea0
 go version  : go1.9.3
 go compiler : gc
 platform    : darwin/amd64

I created a new package with a main.go then ran dep init then tried to import the sdk:

~/ dep ensure -add github.com/Azure/azure-sdk-for-go@14.1.1
Fetching sources...

Solving failure: No versions of github.com/Azure/azure-sdk-for-go met constraints:
   14.1.1: Could not introduce github.com/Azure/azure-sdk-for-go@14.1.1, as its subpackage github.com/Azure/azure-sdk-for-go does not contain usable Go code (*build.NoGoError).. (Package is required by (root).)
   v14.1.1: Could not introduce github.com/Azure/azure-sdk-for-go@v14.1.1, as its subpackage github.com/Azure/azure-sdk-for-go does not contain usable Go code (*build.NoGoError).. (Package is required by (root).)
   v14.1.0: Could not introduce github.com/Azure/azure-sdk-for-go@v14.1.0, as it is not allowed by constraint ^14.1.1 from project github.com/lawrencegripper/azuresdkgotest.
   v14.0.2: Could not introduce github.com/Azure/azure-sdk-for-go@v14.0.2, as it is not allowed by constraint ^14.1.1 from project github.com/lawrencegripper/azuresdkgotest.
.....

It seems that adding a sub-directory succeeds.

✘ dep ensure -add github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch@14.1.1
Fetching sources...

"github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch" is not imported by your project, and has been temporarily added to Gopkg.lock and vendor/.
If you run "dep ensure" again before actually importing it, it will disappear from Gopkg.lock and vendor/.

This creates a gopkg.lock like so

[[projects]]
  name = "github.com/Azure/azure-sdk-for-go"
  packages = [
    "services/batch/2017-09-01.6.0/batch",
    "version"
  ]
  revision = "1e334c402ea1460704b0263e5d188f28ad946ce1"
  version = "14.1.1"

I can then go into my go code and start using it, at which point the warning isn't a problem any more.

It looks like this is being worked on by dep here and here

I'm relatively new to dep having spent some time getting my head around glide so this may simply be user error. If it's not then I think it would be good to update the docs to call this out.

Any help and pointers much appreciated!

@joshgav
Copy link
Contributor

joshgav commented Mar 16, 2018

Thanks for noting this @lawrencegripper. I think the solution may be to turn the root into a Go package by adding a doc.go file. Did so in #1310.

@lawrencegripper
Copy link
Contributor Author

Awesome that sounds like it will do the trick - good call

@vladbarosan
Copy link

Fixed by #1310

@ghost ghost removed the review label Mar 28, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants