You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import _ "bitbucket.org/phiggins/db2cli"funcmain() {}
go.mod
module bug-report
go 1.14
Since this dependency isn't a direct one, I'm still able to run many commands (eg: go mod vendor, go test) without any trouble. However, upon trying to run go mod tidy, I get the following error:
go: finding module for package code.google.com/p/odbc
bug-report imports
bitbucket.org/phiggins/db2cli tested by
bitbucket.org/phiggins/db2cli.test imports
code.google.com/p/odbc: cannot find module providing package code.google.com/p/odbc: unrecognized import path "code.google.com/p/odbc": parse https://code.google.com/p/odbc?go-get=1: no go-import meta tags ()
Once I realized this was a moved dependency, I addressed this with the following replace directive in my go.mod:
Unfortunately, go mod tidy still does not work fully, though as far as I understand the replace directive is what should be used to resolve such an issue.
What did you expect to see?
I would expect the replace directive to allow go mod tidy to continue working, notably to prune unused dependencies.
What did you see instead?
Running go mod tidy prints this error just before exiting with error code 1:
go: github.com/alexbrainman/odbc@v0.0.0-20200426075526-f0492dfa1575 used for two different module paths (code.google.com/p/odbc and github.com/alexbrainman/odbc)
Consequently, go mod tidy no longer prunes unused dependencies. On a related note, the command go mod why prints this same error and also fails to work as designed.
The text was updated successfully, but these errors were encountered:
an unfortunate consequence of the way modules work
the odbc package declares it's module name as github.com/alexbrainman/odbchere but was required as code.google.com/p/odbc in your dependency and in your replace
I believe the only correct fix is to update the dependency to use the new path (or since it appears inactive, fork the repo and fix it yourself)
@dominicbarnes I'm going to mark this as a duplicate issue and close it since there is already an existing issue #26904. Please feel free to follow up if you feel this issue was closed in error.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
My project is using a dependency (bitbucket.org/phiggins/db2cli) that has a test package with another dependency ("odbc") which has recently moved from Google Code to Github.
main.go
go.mod
Since this dependency isn't a direct one, I'm still able to run many commands (eg:
go mod vendor
,go test
) without any trouble. However, upon trying to rungo mod tidy
, I get the following error:Once I realized this was a moved dependency, I addressed this with the following
replace
directive in mygo.mod
:Unfortunately,
go mod tidy
still does not work fully, though as far as I understand thereplace
directive is what should be used to resolve such an issue.What did you expect to see?
I would expect the
replace
directive to allowgo mod tidy
to continue working, notably to prune unused dependencies.What did you see instead?
Running
go mod tidy
prints this error just before exiting with error code 1:Consequently,
go mod tidy
no longer prunes unused dependencies. On a related note, the commandgo mod why
prints this same error and also fails to work as designed.The text was updated successfully, but these errors were encountered: