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

Allow use of vendored package with gauge-go #9

Open
juame opened this issue Aug 17, 2017 · 9 comments
Open

Allow use of vendored package with gauge-go #9

juame opened this issue Aug 17, 2017 · 9 comments
Assignees
Labels

Comments

@juame
Copy link

juame commented Aug 17, 2017

I'm not sure if this is a issue or not, because I just started with gauge-go. Maybe someone can verify this?

I want to use golang/dep for dependency management. It creates a vendor/ directory in the project directory:

.
├── Gopkg.lock
├── Gopkg.toml
├── README.md
├── env
│   └── default
├── manifest.json
├── specs
│   └── example.spec
├── stepImpl
│   └── stepImplementation.go
└── vendor
    └── github.com

Following error appears with this vendor/ directory:

$ gauge run specs
# command-line-arguments
/var/folders/2j/q4yqy0_j2295gylf32x24_k4_6wltz/T/gauge_temp1502981050198162865/gauge_test.go:6:2: use of vendored package not allowed
FAIL	command-line-arguments [setup failed]
Failed to build project: Failed to compile project: exit status 1
Please ensure the project is in GOPATH.

Killing go runner. 
Failed to start gauge API: Runner with pid 2482 quit unexpectedly(exit status 1).

When there's no vendor/ directory it works again.

I believe this shouldn't be a problem for gauge? Am I wrong?
Thanks for any feedback.

@manuviswam manuviswam added the bug label Aug 18, 2017
@manuviswam manuviswam self-assigned this Aug 18, 2017
@manuviswam
Copy link
Member

This has been fixed in the branch fixVendorFolderBug
Can you please verify it solves your issue. If yes we can merge the changes and resolve the issue.

PS:-
For testing this build, take a pull to your local and switched to this branch then run go run build/make.go --install
And run gauge specs again

@juame
Copy link
Author

juame commented Aug 19, 2017

Thanks for working on this! Unfortunately, I believe it's not fixed yet:

$ gauge uninstall go
Successfully uninstalled plugin go 0.1.1.

$ gauge uninstall go
Plugin go not found.

$ git status
On branch fixVendorFolderBug
Your branch is up-to-date with 'origin/fixVendorFolderBug'.
nothing to commit, working tree clean

$ go run build/make.go
2017/08/19 12:04:46 Execute [go build]

$ go run build/make.go --install
2017/08/19 12:04:57 Copying bin/darwin_x86_64/gauge-go -> deploy/gauge-go/bin
2017/08/19 12:04:57 Copying go.json -> deploy/gauge-go
2017/08/19 12:04:57 Copying stepImpl/stepImplementation.go -> deploy/gauge-go/skel
2017/08/19 12:04:57 Copying deploy/gauge-go -> /Users/myusername/.gauge/plugins/go/0.1.1

$gauge version
Gauge version: 0.9.1
Plugins
-------
go (0.1.1)
...
...

$ cd $GOPATH/src/github.com/myproject
$ gauge run specs
# command-line-arguments
/var/folders/2j/q4yqy0_j2295gylf32x24_k4_6wltz/T/gauge_temp1503137222591910283/gauge_test.go:6:2: use of vendored package not allowed
FAIL	command-line-arguments [setup failed]
Failed to build project: Failed to compile project: exit status 1
Please ensure the project is in GOPATH.

Killing go runner. 
Failed to start gauge API: Runner with pid 8738 quit unexpectedly(exit status 1).

My project is set up like:

mkdir myproject; cd myproject
gauge --init go
dep init
dep ensure

@manuviswam
Copy link
Member

Yea. I'm sorry, figured out that my fix will work only if your project is in $GOPATH/src . I am working on a proper fix.
Issue is related with well known vendor problem using wild card

@manuviswam
Copy link
Member

To give you more context on the issue, gauge-go is scanning for packages using the command go list ./... which does not skip the vendor packages.

@juame
Copy link
Author

juame commented Dec 23, 2017

@manuviswam I just tested this again with gauge (0.9.5) and go (0.1.1) plugin:

Project Structure:

.
├── Gopkg.lock
├── Gopkg.toml
├── env
│   └── default
├── manifest.json
├── reports
│   └── html-report
├── specs
│   ├── example.spec
├── stepImpl
│   └── stepImplementation.go
└── vendor
    ├── github.com
    └── golang.org

Vendored (with vendor folder):

$ gauge run specs
[ValidationError] $GOPATH/src/github.com/juame/myproject/specs/example.spec:9 Step implementation not found => '...'
[ValidationError] $GOPATH/src/github.com/juame/myproject/specs/example.spec:10 Step implementation not found => '...'
Successfully generated html-report to => $GOPATH/src/github.com/juame/myproject/reports/html-report
ok  	command-line-arguments	0.152s
Specifications:	0 executed	0 passed	0 failed	1 skipped
Scenarios:	0 executed	0 passed	0 failed	1 skipped

Total time taken: 12ms

Without the vendor folder it works...

@steve-gray
Copy link

@juame / @manuviswam - Did this issue ever get resolved?

@juame
Copy link
Author

juame commented May 4, 2018

@steve-gray don't think that this is fixed. Sorry!

@clarenswd
Copy link

A colleague at work pointed me to add the following to my Gopkg.toml:


# we need to ignore gauge-go from dep, else it can't find our specs
ignored = [
  "github.com/getgauge-contrib/gauge-go/*"
]

@jameshochadel
Copy link

@clarenswd Thank you— I am having the same issue, and this is the only solution that has worked for me after many hours of searching and experimenting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants