简体   繁体   中英

Import a specific package inside a GitHub repository

Intention

I intend to import exactly this package (subdirectory) to reuse its methods and types:

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

Which is inside this repository:

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

Tried

I tried to import the whole repository:

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

But go get github.com/hemantasapkota/go-convexhull is throwing errors. Since its main.go file contains import "github.com/hemantasapkota/glu" which is a private repository.

Question

How can I import just the package convexhull inside a sub-directory of that repository? I mean, I don't need its main.go and its troubles.

Of course, I can copy over the files of convexhull sub-directory/package into my project. But I'm looking for a way to just simply import it from GitHub. Any idea?

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM