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

go-resty import requires replacement propagation #2

Closed
kevingentile opened this issue Apr 7, 2020 · 6 comments
Closed

go-resty import requires replacement propagation #2

kevingentile opened this issue Apr 7, 2020 · 6 comments

Comments

@kevingentile
Copy link

Scenario

Import morepheus-go-sdk into a project and tidy modules. Task fails due to invalid mapping of indirect dependency. The existing import targets v1.12 but the replacement points to v1.11. Workaround is to propagate the replacement in the downstream project.

Failed build

go.mod

module mymodule

go 1.14

require github.com/gomorpheus/morpheus-go-sdk v0.0.0-20191127142315-97a336ca228d
$ go mod tidy
go: github.com/gomorpheus/[email protected] requires
        github.com/go-resty/[email protected]: parsing go.mod:
        module declares its path as: gopkg.in/resty.v1
                but was required as: github.com/go-resty/resty

Valid build

module mymodule

go 1.14

require github.com/gomorpheus/morpheus-go-sdk v0.0.0-20191127142315-97a336ca228d

replace github.com/go-resty/resty => gopkg.in/resty.v1 v1.12.0
$ go mod tidy
go: finding module for package gopkg.in/resty.v1
go: found gopkg.in/resty.v1 in gopkg.in/resty.v1 v1.12.0
go: gopkg.in/[email protected] used for two different module paths (github.com/go-resty/resty and gopkg.in/resty.v1)

go-resty documentation states modules are supported from go v1.10+ but this appears to be misleading. May want to entertain upgrading to V2.

Replacement target

The existing module replacement is pointing to v1.11 of go-resty as the target for the import of v1.12:

replace github.com/go-resty/resty => gopkg.in/resty.v1 v1.11.0

should be

replace github.com/go-resty/resty => gopkg.in/resty.v1 v1.12.0
@kevingentile kevingentile changed the title Stale go-resty import requires replacement propagation go-resty import requires replacement propagation Apr 7, 2020
@jamesdickson6
Copy link
Contributor

Changed it to:
replace github.com/go-resty/resty => gopkg.in/resty.v1 v1.12.0

@kevingentile
Copy link
Author

Still having issues with replacement propagation.

module mymodule

go 1.14

require (
	github.com/gomorpheus/morpheus-go-sdk v0.0.0-20200407214633-a8c5318e32b7
	golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect
)

//TODO https://github.com/gomorpheus/morpheus-go-sdk/issues/2
// replace github.com/go-resty/resty => gopkg.in/resty.v1 v1.12.0

$ go mod tidy
go: github.com/gomorpheus/[email protected] requires
        github.com/go-resty/[email protected]: parsing go.mod:
        module declares its path as: gopkg.in/resty.v1
                but was required as: github.com/go-resty/resty

@jamesdickson6
Copy link
Contributor

Ah I see. This does not appear to be an issue on go 1.13.4.
I'll have to look at this again later.

@jamesdickson6 jamesdickson6 reopened this Apr 8, 2020
@jamesdickson6
Copy link
Contributor

@kevingentile I commited the changes after go mod tidy.
Want to give it another try for me?

@kevingentile
Copy link
Author

@jamesdickson6 Thanks for taking another look. Yeah, I'm still running into issues. I can copy the replacement line into my go.mod, but it's not intuitive.

Related issues:
go-resty/resty#178
go-resty/resty#230

I've created a sample app targeting go 1.13 and 1.14 you can find here

@jamesdickson6
Copy link
Contributor

The repo has been upgraded to go 1.14 and resty v2. I think this issue is gone now.
Thanks for the help!

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