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/[email protected]
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/[email protected]
go: module github.com/zhaoyi0113/[email protected] found, but does not contain package github.com/zhaoyi0113/test-go-module/apps/logger
How should I solve this issue?