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

Import project with go get #158

Closed
xorduna opened this issue Mar 21, 2022 · 4 comments
Closed

Import project with go get #158

xorduna opened this issue Mar 21, 2022 · 4 comments

Comments

@xorduna
Copy link

xorduna commented Mar 21, 2022

Hi!

We would like to use gmqtt as our mqtt broker with some plugins to integrate it with our existing application.

We have seen that if we do "go get github.com/DrmagicE/gmqtt" only the folder pkg is imported. We have seen this command in v0.1.1.

How would you recommend to integrate gmqtt into an existing project as a library?

Thank you very much!

Xavi

@DrmagicE
Copy link
Owner

@xorduna Hi, how about git clone the repository instead of using go get, because now gmqtt is intended to be used as an application rather than a library.
However, if you want to import gmqtt as a library, go get github.com/DrmagicE/gmqtt@v0.4.1 should work, but you may take a look into the cmd folder to learn how to build a gmqtt server.

FYI:

The examples folder is outdated. It is recommended to use the gmqtt as an application and leverage the plugin system to custom and extend the capabilities if required, rather than import it as a building block for your own binary.

Using gmqtt as a go package is possible but required additional knowledge about the codebase which may bring you troubles.
#143 (comment)

@xorduna
Copy link
Author

xorduna commented Mar 21, 2022

Hi @DrmagicE!

First of all, thank you so much for such quick answer! The main reason to use it as a library was to do the development of our plugin in the same repo as the main application.

What I am worried about doing a git clone is how we keep the track of the original project while having our own plugins implemented in their own repo.

In any case we will explore options from there.

Thanks!

Xavi

@zhoujinfu
Copy link

I have created some gmqtt plugins before. it seems that there is no any graceful way to develop a brand new plugin without the main binary. But we can develop our own plugins on a forked repo and test it in the main binary. The only way to keep the track of the origin repo is use a new remote url and merge from the new remote repeatedly :

e.g: remote named github

  1. git remote set-url github git@github.com:DrmagicE/gmqtt.git when forked the repo.
  2. develop & test your plugins in your fork.
  3. merge from the remote origin git pull github master

@zhoujinfu
Copy link

btw, it will be cool to keep the binary separate from library.

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

3 participants