I published a go module in github: github.com/zhaoyi0113/test-go-module
. The go.mod
file is in apps
folder rather than root folder.
When I import it from another project, I run go get github.com/zhaoyi0113/test-go-module@0.0.2
and it runs successfully. However, I get the error when compiling:
main.go
import (
log "github.com/zhaoyi0113/test-go-module/apps/logger"
)
log.Test()
main.go:11:2: no required module provides package github.com/zhaoyi0113/test-go-module/apps/logger; to add it:
go get github.com/zhaoyi0113/test-go-module/apps/logger
I get error when import the sub folder:
> go get github.com/zhaoyi0113/test-go-module/apps/logger@v0.0.2
go: module github.com/zhaoyi0113/test-go-module@v0.0.2 found, but does not contain package github.com/zhaoyi0113/test-go-module/apps/logger
How should I solve this issue?