登录
首页 >  Golang >  Go问答

在 GitHub 存储库中安装特定包

来源:stackoverflow

时间:2024-03-15 16:18:27 318浏览 收藏

目前golang学习网上已经有很多关于Golang的文章了,自己在初次阅读这些文章中,也见识到了很多学习思路;那么本文《在 GitHub 存储库中安装特定包》,也希望能帮助到大家,如果阅读完后真的对你学习Golang有帮助,欢迎动动手指,评论留言并分享~

问题内容

意图

我打算完全导入这个包(子目录)以重用它的方法和类型:

https://github.com/hemantasapkota/go-convexhull/tree/master/convexhull

它位于此存储库中:

https://github.com/hemantasapkota/go-convexhull

尝试过

我尝试导入整个存储库:

import (
    "github.com/hemantasapkota/go-convexhull"
)

但是 go get github.com/hemantasapkota/go-convexhull 抛出错误。由于其 main.go 文件包含 import "github.com/hemantasapkota/glu" 这是一个私有存储库。

问题

如何在该存储库的子目录中仅导入包 convexhull ?我的意思是,我不需要它的 main.go 及其麻烦。

当然,我可以将 convexhull 子目录/包的文件复制到我的项目中。但我正在寻找一种简单地从 github 导入它的方法。有什么想法吗?


正确答案


这有效:

import (
    "github.com/hemantasapkota/go-convexhull/convexhull"
)

但是,在构建时,我收到了这个错误,我需要弄清楚:

Build Error: go test -c -o /tmp/__debug_bin930480706 -gcflags all=-N -l .
package printer/app/threed/detect/dental
    imports github.com/hemantasapkota/go-convexhull/convexhull
    imports github.com/go-gl/gl: build constraints exclude all Go files in /home/m3/go/pkg/mod/github.com/go-gl/[email protected] (exit status 1)

终于介绍完啦!小伙伴们,这篇关于《在 GitHub 存储库中安装特定包》的介绍应该让你收获多多了吧!欢迎大家收藏或分享给更多需要学习的朋友吧~golang学习网公众号也会发布Golang相关知识,快来关注吧!

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>