I've found this code on github for attaching to the dahua cameras:
https://github.com/drblez/dahuaevents2mqtt
I'm trying to make it into a container, but I've never looked at go before (why paddle when you can swim with sharks).
So what's I'm looking at is cloning the code to a local machine:
/src/dahuaevents2mqtt
Then using the following docker file to build it:
FROM golang:1.9
ARG version="0.0.1"
RUN mkdir -p /go/src/dahuaevents2mqtt
ADD . /go/src/dahuaevents2mqtt
WORKDIR /go/src/dahuaevents2mqtt
RUN go get .
RUN go build -o main .
#COPY . .
CMD ["/go/src/dahuaevents2mqtt/main"]
Now this seems to build, but fails in running with an error with syslog. But I had a lot of issues figuring out how to add the dependancies (ie the code in separate .go files in subdirectories)
I think in these lines:
log = s
if err != nil {
fmt.Printf("%s unable to start: %s", displayName, err)
return
}
Does anyone have any guidance? I'd like to build it and then start learning go to modify it for my purposes (at the moment it only deals with standalone cameras, and not an nvr).