golang package local does not find



我不能导入我的包。

我已经使用go mod init,但它不工作。go.mod:

目录
module github.com/grafeno30/golang_redes/rat
go 1.13

我的项目有以下结构:

github.com/grafeno30/golang_redes/
├── rat
│   ├── client
│   │   └── main.go
│   ├── server
│   │   ├── core
│   │   │   └── handleConnection
│   │   │       └── establishedConnection.go
│   │   ├── main.go
│   │   └── server
│   ├── go.mod
│   └── go.sum
└── README.md

当我在文件夹"github.com/grafeno30/golang_redes/rat/server">中执行go build .时我得到以下错误:

# github.com/grafeno30/golang_redes/rat/server
./main.go:14:13: undefined: handleConnection
总之,我使用了模块中的一个函数/server/core/handleConnection在主go文件rat/server/main.go

Thanks in advance

我终于想通了

我不得不使用:go mod, go mod init, go mod edit -replace和go mod tidy。

基本上我已经做了一个替换"go mod edit -replace github.com/grafeno30/golang_redes/rat/server/core/handler=./core/handler">

谢谢大家!!

相关内容

最新更新