猿问

将项目中的 go 模块导入同一项目中的另一个模块

我有以下项目结构:


.

├── daos

│   ├── daos.go

│   ├── daos.iml

│   ├── go.mod

│   └── go.sum

├── entities

│   ├── entities

│   │   └── pets.go

│   ├── entities.iml

│   └── go.mod

└── pkg.iml

我想将模块导入entities到daos,但出现以下错误:


go: finding module for package github.com/goncharovmvdev/pets/entities/pets

github.com/goncharovmvdev/pets/daos imports

    github.com/goncharovmvdev/pets/entities/pets: module github.com/goncharovmvdev/pets@latest found (v0.0.0-20220625073141-e49db91a04de), but does not contain package github.com/goncharovmvdev/pets/entities/pets


千万里不及你
浏览 196回答 1
1回答

largeQ

如果要将实体导入daos,有2种方式:将实体的源代码推送到您的 Github。您可以像这样使用替换指令(https://go.dev/doc/tutorial/call-module-code)
随时随地看视频慕课网APP

相关分类

Go
我要回答