简体   繁体   中英

the “hero” component of iris not installed when using “dep” to manage project dependencies

this question also posted here: https://github.com/kataras/iris/issues/1081

I am using "iris" as the MVC framework in my golang project, and i use "dep" to manage the dependencies of my project.

the "iris" dependency was configured in "Gopkg.toml" as bellow:

在此处输入图片说明

在此处输入图片说明

and later i use "dep ensure -v" to download all the dependencies.

after the "ensure" command finished, i check the downloaded files in "vendor/github.com/kataras/iris/hero" folder, i found there is no source code files were downloaded, refer to the screen capture bellow:

在此处输入图片说明

so i cannot use "hero" component in my project, because the "hero" related package not installed in my project.

在此处输入图片说明

thanks all for your help ~

I'm very new to Go; but I had a similar issue with another library ' https://github.com/jedib0t/go-pretty '

$ dep ensure -add github.com/jedib0t/go-pretty
"github.com/jedib0t/go-pretty" is not imported by your project, and has been temporarily added to Gopkg.lock and vendor/.
If you run "dep ensure" again before actually importing it, it will disappear from Gopkg.lock and vendor/.

The repo is cloned into pkg/dep/sources/https---github.com-jedib0t-go--pretty/ however there is no Go code in vendor/github.com/jedib0t/go-pretty/

I added an import "github.com/jedib0t/go-pretty" into one of my source code files and ran dep ensure -v however the vendor copy does not have any Go code it it. I removed the folder and tried again however same result.

What solved it for me was specifically importing the package I wanted into my code eg: "github.com/jedib0t/go-pretty/table" and running dep ensure -v again. I'm not sure why it worked but maybe my experience can help you or someone else.

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