What do I have:
submodule/
submodule.go
go.mod
go.sum
main.go
go.mod
go.sum
go.mod
contains
module github.com/username/privaterepo
go 1.16
require github.com/username/privaterepo/submodule latest
replace (
github.com/username/privaterepo/submodule latest => target ./submodule
)
submodule/go.mod
contains
module github.com/username/privaterepo/submodule
go 1.16
I didn't push anything to the repository yet. I'm trying to go mod tidy
in the root of my app:
$ env GIT_TERMINAL_PROMPT=1 go mod tidy
Username for 'https://github.com': username
Password for 'https://[email protected]':
go: errors parsing go.mod:
<...>/go.mod:5: no matching versions for query "latest"
<...>/go.mod:8:2: no matching versions for query "latest"
Which version should I use for my local submodule which is not pushed to the repository yet? Is it even possible to use such local submodule when it's not pushed to the repository (I thought that go mod
wouldn't even go to remote source when it sees replace
)?
I fixed go.mod
with
module github.com/username/privaterepo
go 1.16
require github.com/username/privaterepo/submodule v0.0.0 //version changed to v0.0.0-00010101000000-000000000000 after go mod tidy
replace github.com/username/privaterepo/submodule => ./submodule