[英]Import a specific package inside a GitHub repository
I intend to import exactly this package (subdirectory) to reuse its methods and types:我打算准确地导入这个 package(子目录)以重用它的方法和类型:
https://github.com/hemantasapkota/go-convexhull/tree/master/convexhull https://github.com/hemantasapkota/go-convexhull/tree/master/convexhull
Which is inside this repository:在这个存储库中:
https://github.com/hemantasapkota/go-convexhull https://github.com/hemantasapkota/go-convexhull
I tried to import the whole repository:我试图导入整个存储库:
import (
"github.com/hemantasapkota/go-convexhull"
)
But go get github.com/hemantasapkota/go-convexhull
is throwing errors.但是go get github.com/hemantasapkota/go-convexhull
正在抛出错误。 Since its main.go
file contains import "github.com/hemantasapkota/glu"
which is a private repository.由于其main.go
文件包含import "github.com/hemantasapkota/glu"
,这是一个私有存储库。
How can I import just the package convexhull
inside a sub-directory of that repository?如何在该存储库的子目录中仅导入 package convexhull
? I mean, I don't need its main.go
and its troubles.我的意思是,我不需要它的main.go
和它的麻烦。
Of course, I can copy over the files of convexhull
sub-directory/package into my project.当然,我可以将convexhull
子目录/包的文件复制到我的项目中。 But I'm looking for a way to just simply import it from GitHub. Any idea?但我正在寻找一种方法来简单地从 GitHub导入它。有什么想法吗?
This worked:这有效:
import (
"github.com/hemantasapkota/go-convexhull/convexhull"
)
However, when building, I received this error which I need to figure out:但是,在构建时,我收到了这个错误,我需要弄清楚:
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/gl@v0.0.0-20190320180904-bf2b1f2f34d7 (exit status 1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.