Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Golang API cannot find package #2

Open
kongyanye opened this issue Mar 11, 2021 · 2 comments
Open

Golang API cannot find package #2

kongyanye opened this issue Mar 11, 2021 · 2 comments

Comments

@kongyanye
Copy link

Hi marosmars,

Thanks for sharing your blog and example scripts. I'm currently trying to use the GO version VPP api from https://github.com/fdio/govpp. I've installed the VPP binaries on Ubuntu 20 (including the vpp-dev optional package) and followed their official github repo to install the GO package. But I can't successfully run neither their quick start script nor your example script.

There are mainly two problems:

  1. Seems the API structure is broken. I successfully installed binapi-generator and generated the GO bindings, and then put the generated files under $GOROOT/vppapi (/usr/local/go/src/vppapi). After that, when importing package "interfaces" and "l2", it shows error "cannot find package std/std/vppapi/ethernet_types" and several other packages like "ip_types" and "vpe". These packages indeed exist under $GOROOT/vppapi, but GO seems can't find it because they automatically add the "std/std" prefix before module name. How can I fix it?

  2. The package "interfaces" actually does not exist (you can check it in their official example and repo files), but there do exist a package called "interface". I don't know how it can be imported.

Their official repo does not provide the issue function and there are almost no materials I can find online to use VPP api in GO. So I ask the question here. I would really appreciate it if you can give me some insights. Thanks!

@pan2za
Copy link

pan2za commented Apr 4, 2021

you'd first build the bin-api using command like,

cd $GOPATH/src/git.fd.io/govpp.git
binapi-generator --output-dir=binapi

the binapi locates at,
$GOPATH/src/git.fd.io/govpp.git/binapi

@kongyanye
Copy link
Author

I figured out the problem. The api source file should be placed under $GOPATH/src/git.fd.io/govpp.git and the new packages is indeed called "interfaces" instead of "interface".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants