Interesting. At first sight this should work. You definitely don't need a go.mod file in ~HOME/src/myrepo/cmd/cmd1
Which go version are you running? What is your $GOPATH set to? What output does cd ~HOME/src/myrepo; go build give? The usual convention is to push the code in a VCS such as github and use the vcs path as an argument to go mod init e.g. go mod init github.com/myuser/myrepo - Amnon On Monday, 4 May 2020 14:59:22 UTC+1, web user wrote: > > I have a personal project using GOPATH > > But recently, I wanted to use go-redis for a project and v7 forces you to > use go mod. So I figured, I'd migrate the account over to go mod. But I'm > stuck. > > > My directory structure is: > > ~HOME/src/myrepo > ~HOME/src/myrepo/cmd/cmd1 > ~HOME/src/myrepo/commong > ~HOME/src/github > > So I did the following command: cd ~HOME/src/myrepo; go mod init > ~HOME/src/myrepo > > when I run the command go build ~HOME/src/myrepo/cmd/cmd1/... > > It does not update the go.mod in the directory ~HOME/src/myrepo? Do I need > a go.mod in ~HOME/src/myrepo/cmd/cmd1 > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/11a98c18-6b02-4a00-907c-1cded0ba4d79%40googlegroups.com.