简体   繁体   English

如何修改 ChirpStack Simulator 有效载荷

[英]How to modify ChirpStack Simulator payload

ChirpStack doesn't have it's own tag, so was hoping this might still be applicable to the GO tag, as that is the dominant language here. ChirpStack 没有自己的标签,因此希望这可能仍然适用于 GO 标签,因为这是这里的主要语言。

I was hoping someone could help me out with a problem I have.我希望有人可以帮助我解决我遇到的问题。 I am trying to modify the payload of the ChirpStack Simulator in order to pass some additional values to ChirpStack for some dashboards I would like to make on ThingsBoard.我正在尝试修改 ChirpStack Simulator 的有效负载,以便为我想在 ThingsBoard 上制作的一些仪表板向 ChirpStack 传递一些附加值。 I am having a few issues though.我有一些问题。

I have tried making a fork of the ChirpStack-Api, as the objects used in the Simulator come from there, however after editing the files and attempting to build the simulator I keep getting an error like below我尝试制作 ChirpStack-Api 的分支,因为模拟器中使用的对象来自那里,但是在编辑文件并尝试构建模拟器后,我不断收到如下错误

Compiling source
go build -a -installsuffix cgo -ldflags "-s -w -X main.version=63fdb49" -o buildv2.1/chirpstack-simulator cmd/chirpstack-simulator/main.go
go: github.com/******/chirpstack-api/go/v3@v3.1.3: parsing go.mod:
        module declares its path as: github.com/brocaar/chirpstack-api/go/v3
                but was required as: github.com/******/chirpstack-api/go/v3
make: *** [Makefile:7: build] Error 1

When I make a change that I think might help I push the code to my own repo with that forked api code, and attempt to build the simulator, but it seems that the simulator builds with the files it has already downloaded, rather than pulling fresh.当我做出一个我认为可能有助于我使用分叉的 api 代码将代码推送到我自己的仓库的更改时,并尝试构建模拟器,但似乎模拟器是使用它已经下载的文件构建的,而不是拉新鲜的. I'm not sure what to do on that front either, honestly.老实说,我也不确定在这方面该怎么做。

I hope this is enough information that someone might be able to help, but if more is needed I can provide.我希望这是足够的信息,有人可以提供帮助,但如果需要更多信息,我可以提供。

Thanks谢谢

So the answer to my own question, and why I was hitting the error I was, is that GO seems to be quite sensitive to import paths.所以我自己的问题的答案,以及我为什么遇到错误,是 GO 似乎对导入路径非常敏感。 My solution (which may not be the best way, but worked for me) was to move both file structures to a shared directory, and do a relative path.我的解决方案(这可能不是最好的方法,但对我有用)是将两个文件结构移动到共享目录,并执行相对路径。 In my go.mod file (in the simulator, not api) I put the following:在我的 go.mod 文件中(在模拟器中,而不是 api 中),我输入了以下内容:

replace github.com/brocaar/chirpstack-api/go/v3 v3.1.3 => ./chirpstack-api/go/

Hopefully this helps someone with this problem in the future.希望这可以帮助将来解决此问题的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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