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

v1.13 go mod incompatible #91

Closed
alexbeltran opened this issue Sep 17, 2019 · 5 comments
Closed

v1.13 go mod incompatible #91

alexbeltran opened this issue Sep 17, 2019 · 5 comments

Comments

@alexbeltran
Copy link

alexbeltran commented Sep 17, 2019

When running:

go mod tidy

The following is outputted from the generated mock package.

go: finding github.com/petergtz/pegomock/matchers latest
github.com/...../mock/mCommand imports
        github.com/petergtz/pegomock tested by
        github.com/petergtz/pegomock.test imports
        github.com/petergtz/pegomock/matchers: module github.com/petergtz/pegomock@latest (v2.5.0+incompatible) found, but does not contain package github.com/petergtz/pegomock/matchers

Not clear why it is looking for a matchers library since it isn't in the generated mock package. See imports:

package mCommand

import (
	pegomock "github.com/petergtz/pegomock"
	command "....command"
	"reflect"
	"time"
)
@petergtz
Copy link
Owner

Hi @alexbeltran,

thank you very much for reporting this. I don't have time to look into this right now, but will see if I can address it in the coming days. If you could provide me with some example file/directory structure, that would help to speed things up quite a bit.

Thank you,
Peter

@petergtz
Copy link
Owner

petergtz commented Sep 20, 2019

@alexbeltran OK, finally had the time to look into this. So here's the issue:

go mod tidy adds your dependencies' test dependencies to your module. (See golang/go#29323, golang/go#27633, golang/go#26626 and golang/go#26955)

This causes an issue here, because pegomock's own tests depend on a package (i.e. the matchers package) which itself gets generated as part of the test suite.

I'm not sure I'm excited about the fact go mod tidy adds test dependencies, because I don't see the use case of running your dependencies' test suites. Any integration test suite requires a certain environment to run anyway, so it's unrealistic to run them.

I guess we could do the following: commit the matchers package to git and therefore satisfy go mod tidy. They get temporarily removed by scripts/run_tests.sh anyway to make sure they get generated properly before the tests run.

Do you think that would solve your problem?

@petergtz
Copy link
Owner

@alexbeltran I just went ahead an made the change on develop. Could you try and see if that solves your problem?

@alexbeltran
Copy link
Author

Thanks for investigating this so qiuckly. Sorry I didn't get back to you immediately.

The develop branch works for me which is great. :) I also agree, it is strange that go mod tidy would add test dependencies. >.> Including them does fix tidy though.

@petergtz
Copy link
Owner

Okay cool. Will make a release later this week.

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

No branches or pull requests

2 participants