AlecAivazis / survey

A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
MIT License
4.08k stars 350 forks source link

Dep ensure failing for survey #229

Closed vermdeep closed 5 years ago

vermdeep commented 5 years ago

I have the following constraint in Gopkg.toml

[[constraint]]
  name = "github.com/AlecAivazis/survey"
  version = "2.0.0"

Dep ensure with the above constraint is failing with error:

v2.0.0:  "github.com/AlecAivazis/survey" imports "github.com/AlecAivazis/survey/v2/core", which contains malformed code: no package exists at "github.com/AlecAivazis/survey/v2/core"`

After ignoring the pkg github.com/AlecAivazis/survey/v2/core in dep, build is failing with the following error:

# github.com/Zomato/ZomatoDBQuery/query-parser/vendor/github.com/AlecAivazis/survey
vendor/github.com/AlecAivazis/survey/multiselect.go:46:18: undefined: core.OptionAnswer
ahmetb commented 5 years ago

related: #230

AlecAivazis commented 5 years ago

Are you sure @ahmetb? I don't see anywhere how @vermdeep would be pulling the wrong casing...

ahmetb commented 5 years ago

my bad, I jumped into conclusions as dep is known not to work well with case-sensitivity.

AlecAivazis commented 5 years ago

No worries! Just wanted to make sure I wasn't missing anything.

I'm not quite sure what is going on with dep here @vermdeep. Can you make a small repo that reproduces this issue so I can take a look?

vermdeep commented 5 years ago

By default, dep is picking up v1.8.5. When I am running dep ensure in my sample repository here after updating Gopkg.toml file to use v2.0.0 following errors are coming:

Solving failure: No versions of github.com/AlecAivazis/survey met constraints:
    v1.8.5: Could not introduce github.com/AlecAivazis/survey@v1.8.5, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v2.0.1: "github.com/AlecAivazis/survey" imports "github.com/AlecAivazis/survey/v2/core", which contains malformed code: no package exists at "github.com/AlecAivazis/survey/v2/core"
    v2.0.0: "github.com/AlecAivazis/survey" imports "github.com/AlecAivazis/survey/v2/core", which contains malformed code: no package exists at "github.com/AlecAivazis/survey/v2/core"
    v1.8.4: Could not introduce github.com/AlecAivazis/survey@v1.8.4, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.8.3: Could not introduce github.com/AlecAivazis/survey@v1.8.3, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.8.2: Could not introduce github.com/AlecAivazis/survey@v1.8.2, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.8.1: Could not introduce github.com/AlecAivazis/survey@v1.8.1, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.8.0: Could not introduce github.com/AlecAivazis/survey@v1.8.0, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.8: Could not introduce github.com/AlecAivazis/survey@v1.8, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.7.1: Could not introduce github.com/AlecAivazis/survey@v1.7.1, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.7.0: Could not introduce github.com/AlecAivazis/survey@v1.7.0, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.6.4: Could not introduce github.com/AlecAivazis/survey@v1.6.4, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.6.3: Could not introduce github.com/AlecAivazis/survey@v1.6.3, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.6.2: Could not introduce github.com/AlecAivazis/survey@v1.6.2, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.6.1: Could not introduce github.com/AlecAivazis/survey@v1.6.1, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.6.0: Could not introduce github.com/AlecAivazis/survey@v1.6.0, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.5.3: Could not introduce github.com/AlecAivazis/survey@v1.5.3, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.5.2: Could not introduce github.com/AlecAivazis/survey@v1.5.2, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.5.1: Could not introduce github.com/AlecAivazis/survey@v1.5.1, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.5.0: Could not introduce github.com/AlecAivazis/survey@v1.5.0, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.4.2: Could not introduce github.com/AlecAivazis/survey@v1.4.2, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.4.1: Could not introduce github.com/AlecAivazis/survey@v1.4.1, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.4.0: Could not introduce github.com/AlecAivazis/survey@v1.4.0, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.3.4: Could not introduce github.com/AlecAivazis/survey@v1.3.4, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.3.1: Could not introduce github.com/AlecAivazis/survey@v1.3.1, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.3.0: Could not introduce github.com/AlecAivazis/survey@v1.3.0, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.2.5: Could not introduce github.com/AlecAivazis/survey@v1.2.5, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    1.2.4: Could not introduce github.com/AlecAivazis/survey@1.2.4, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.2.4: Could not introduce github.com/AlecAivazis/survey@v1.2.4, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.2.3: Could not introduce github.com/AlecAivazis/survey@v1.2.3, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.2.2: Could not introduce github.com/AlecAivazis/survey@v1.2.2, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.2.1: Could not introduce github.com/AlecAivazis/survey@v1.2.1, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.2.0: Could not introduce github.com/AlecAivazis/survey@v1.2.0, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.1.4: Could not introduce github.com/AlecAivazis/survey@v1.1.4, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.1.3: Could not introduce github.com/AlecAivazis/survey@v1.1.3, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.1.2: Could not introduce github.com/AlecAivazis/survey@v1.1.2, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.1.1: Could not introduce github.com/AlecAivazis/survey@v1.1.1, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.1.0: Could not introduce github.com/AlecAivazis/survey@v1.1.0, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.0.3: Could not introduce github.com/AlecAivazis/survey@v1.0.3, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.0.2: Could not introduce github.com/AlecAivazis/survey@v1.0.2, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1.0.1: Could not introduce github.com/AlecAivazis/survey@v1.0.1, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1: Could not introduce github.com/AlecAivazis/survey@v1, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v0.5.1: Could not introduce github.com/AlecAivazis/survey@v0.5.1, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v0.5: Could not introduce github.com/AlecAivazis/survey@v0.5, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v0: Could not introduce github.com/AlecAivazis/survey@v0, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    master: Could not introduce github.com/AlecAivazis/survey@master, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.
    v1: Could not introduce github.com/AlecAivazis/survey@v1, as it is not allowed by constraint ^2.0.0 from project github.com/vermdeep/survey.

I am using go1.11.4 darwin/amd64 with 0.5.0 dep version:

dep:
 version     : v0.5.0
 build date  : 2018-08-16
 git hash    : 224a564
 go version  : go1.10.3
 go compiler : gc
 platform    : darwin/amd64
 features    : ImportDuringSolve=false
AlecAivazis commented 5 years ago

Any luck with this @vermdeep? I'm not familiar enough with dep to debug this and I am very busy for the next few months so this likely won't get much attention any time soon 😢

vermdeep commented 5 years ago

Actually, the issue here is that v2 directory is not present in your repo, yet you are using github.com/AlecAivazis/survey/v2/core in many places. I am not sure how it is working for others, but locally I am copying core and terminal into manually created v2 directory, to make go build work.

AlecAivazis commented 5 years ago

That's how gomodules work - the path underneath the package name is for major versions. You can see more here. That's why I was saying it's on dep to integrate with go modules

AlecAivazis commented 5 years ago

Whoops wrong button! But it sounds like you have a solution that works for now and the problem is part of a wider issue in dep on how to support go modules. Sorry i couldn't be more help!

vermdeep commented 5 years ago

Thanks for the help 👍, will checkout if there is a way to support go modules in dep, Will update here once I find a solution.

mkumatag commented 5 years ago

ah! I also faced the same issue when I tried updating to latest v2 version, here is my analysis why it is happening. I tried all the possible way to fix it via dep tool by couldn't able to do it. My analysis is here with sample code - https://github.com/AlecAivazis/survey/issues/241

There is PR hanging our there in the golang/dep community which may fix this issue - https://github.com/golang/dep/pull/1963, but don't see much activity.

The only option I'm left with is to start using go mod!