简体   繁体   中英

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.

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. 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

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. 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. 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:

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

Hopefully this helps someone with this problem in the future.

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