Github操作在存储库中找不到包 [英] Github actions can't find package within repository

查看:133
本文介绍了Github操作在存储库中找不到包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置github动作管道时,我找不到它来查找存储库中的软件包,并且测试失败,因为它缺少软件包.

When setting up a github actions pipeline, I can't get it to find packages that are within my repository, and the test fails because it's missing packages.

发生的事情是,它在某个地方克隆了仓库,但不包括克隆的仓库的目录来寻找软件包.失败是因为我正在代码中从该存储库中导入软件包.

What happens is that it clones the repo someplace but doesn't include the cloned repo's directories to look for packages. That fails because I am importing packages from within that repo in my code.

我相信我的目录结构是合理的,因为我在本地进行测试和构建都没有问题:

I believe my directory structure is sound because I have no trouble testing and building locally:

.                                                                                                                                                           │
├── extractors                                                                                                                                              │
│   ├── fip.go                                                                                                                                              │
│   └── fip_test.go                                                                                                                                         │
├── fixtures                                                                                                                                                │
│   └── fip                                                                                                                                                 │
│       ├── bad_req.json                                                                                                                                    │
│       └── history_response.json                                                                                                                           │
├── .github                                                                                                                                                 │
│   └── workflows                                                                                                                                           │
│       └── go_test.yml                                                                                                                                     │
├── main.go                                                                                                                                                 │
├── Makefile                                                                                                                                                │
├── playlist                                                                                                                                                │
│   └── playlist.go                                                                                                                                         │
├── README.md                                                                                                                                                                                                                                                                                          │
└── utils                                                                                                                                                   │
    ├── logger                                                                                                                                              │
    │   └── logger.go                                                                                                                                       │
    └── mocks                                                                                                                                               │
        └── server.go                                                                                                                                       │
                                                                                                                                                            │

在此处查看运行情况

我如何让Github操作也在克隆的目录中查找包?

How do I make Github actions look for the package within the cloned dir as well?

推荐答案

请确保运行go mod init MODULE_NAME(如果项目在GOROOT或GOPATH之外)或仅运行go mod init(如果项目在GOROOT或GOPATH内) .该命令应在项目的根文件夹上运行.这将创建一个go.mod文件,该文件将使go能够解析您的软件包.

Make sure to run go mod init MODULE_NAME (if the project is outside GOROOT or GOPATH) or just simply go mod init (if the project is inside GOROOT or GOPATH). The command should be run on the root folder of your project. This would create a go.mod file that would enable go resolve your packages.

这篇关于Github操作在存储库中找不到包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆