I generated a .go file from a .proto file. I added the .go file generated by GPB underneath my local project directory in mdproto directory. My package is called mdproto.go.
In go, I say
package main
import (
"./mdproto"
"encoding/hex"
"log"
"net"
"time"
)
... more go stufff
But when I try to run it, the output is as below. Not sure what I am doing wrong.
[idf@node1 9664255]$sudo go run gistfile1.go
# command-line-arguments
./gistfile1.go:4: imported and not used: "_/home/idf/Documents/go/9664255/mdproto" as MarketData
EDIT: This fixes it:
package main
import (
"github.com/golang/protobuf/proto"
"./mdproto"
"encoding/hex"
"log"
"net"
"time"
)
const (
srvAddr = "239.0.0.222:345"
maxDatagramSize = 8192
)
func main() {
md := &MarketData.MD {
Firm: int64(1),
Id : int64(1),
Bid : float64(17),
Ask : float64(18),
}
data, err := proto.Marshal(md)
log.Println(data, err)
go ping(srvAddr)
serveMulticastUDP(srvAddr, msgHandler)
}
etc...