I’m trying to update the Go version in my project, but I’m encountering numerous errors. Here is the problem I’m facing:
Directory Structure:
/root/go/src/bitbucket.org/Learning/Web_Project
Contents of Web_Project:
-
main.go
-
build
-
handler/
(contains some API files) -
util/
(contains some common code) -
vendor/
(contains external packages)-
bitbucket.org/Learning/goauth
-
bitbucket.org/Learning/relay
-
github.org
,golang.org
,go.uber.org
, etc. (contains some files)
-
When building the binary using Go version 1.12, it generates the binary successfully. However, after changing the Go version from 1.12 to 1.22.3 and running the build script, I get the following error:
go: cannot find main module, but found .git/config in /root/go/src/bitbucket.org/Learning/Web_Project to create a module there, run: go mod init
After running go mod init
, I then run go mod tidy
. Some modules are fetched successfully, but for some modules, I get the following error:
go: found github.com/golang/snappy in github.com/golang/snappy v0.0.4 go: found gopkg.in/linkedin/goavro.v1 in gopkg.in/linkedin/goavro.v1 v1.0.5 bitbucket.org/Learning/goauth: cannot find module providing package bitbucket.org/Learning/goauth: module bitbucket.org/Learning/goauth: git ls-remote -q origin in /root/go/pkg/mod/cache/vcs/11f96d93a23a7d4a46dea5201561ac9dc651d3fed77e6cac3e339a0e30af0e11: exit status 128: The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. go: bitbucket.org/Learning/Web_Project imports bitbucket.org/Learning/gorelay: bitbucket.org/Learning/[email protected]: verifying module: bitbucket.org/Learning/[email protected]: reading https://sum.golang.org/lookup/bitbucket.org/Learning/[email protected]: 404 Not Found
I also tried go mod vendor
, which shows this output:
go: bitbucket.org/Learning/Web_Project imports bitbucket.org/Learning/goauth: no required module provides package bitbucket.org/Learning/goauth; to add it: go get bitbucket.org/Learning/goauth
When I run the command go get bitbucket.org/Learning/goauth
, I get the following error:
go: module bitbucket.org/Learning/goauth: git ls-remote -q origin in /root/go/pkg/mod/cache/vcs/67f96d93a23a7d4a46dea5201561ac9dc651d3fed77e6cac3e339a0e30af0e6d: exit status 128: The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you’re authenticated. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
FYI: I am using git with SSH, and git pull
, fetch
, push
are working fine.
Can someone help me resolve these issues?
Akash Kaplesh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.