Есть мои коды:как assgin ERRORCODE (int32) к переменной (* ErrorCode) из прото данных
file1.go:
type ErrorCode Int32
var result ErrorCode
file2.pb.go:
type CollectionGC struct {
Result *ErrorCode `protobuf:"varint,1,opt,name=result,enum=api.ErrorCode" json:"result,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
messageGC := &CollectionGC {
Result: result, // a error occurs
}
Это дает:
Invalid assignment from result(ErrorCode) to Result(*ErrorCode), and fun CollectionGC.SetResult(value int32) is nonexisted in file2.pb.go.
Как избежать этой ошибки?
Я пробовал «Результат: * результат», и теперь я знаю, что случилось с моим умом ... Спасибо за ваше время и ответ! – Tal
@Tal да, https://gist.github.com/josephspurrier/7686b139f29601c3b370 хорошо читается – VonC
Вау, эти коды точно используют мою потребность. Он имеет ясный ум – Tal