V4 how to properly import go api? [solved]

Hi Friends!

v4.0.0 /api seemingly provides pre-built grpc files to use in go project (/api/go subfolder).

However I’m a bit lost how to import it in my project. Neither

import "github.com/chirpstack/chirpstack/v4/api/go/api"

nor

import "github.com/chirpstack/chirpstack/api/go/api"

would work :frowning:

If I try directly go get, e.g.:

go get github.com/chirpstack/chirpstack@v4.0.0

Then downloaded module is v4.0.0+incompatible and it lacks go subfolder

Thanks in advance for all the hints and clues!

Your first import looks correct, see:

https://www.chirpstack.io/docs/chirpstack/api/go-examples.html

If your IDE isn’t automatically downloading the dependencies for you, you should be able to use go get with the same line.

1 Like

Great, thanks a lot!

Obviously I should learn go dependencies/versioning better :sweat_smile:

It is just about properly writing the import

"github.com/chirpstack/chirpstack/api/go/v4/api"

then go get works like a charm (for I had a scratch test in notepad) and as you mentioned should work seamlessly in any mighty IDE.

Thank you very much!

1 Like