D
D
Dasha Tsiklauri2020-11-02 16:52:09
go
Dasha Tsiklauri, 2020-11-02 16:52:09

[Updated] Is protobuf + go + grpc alive?

Colleagues, is the connection alive? Today I can't find any tutorial that works as expected: go to grpc - you get to deprecated packages, go to protobuf - code generators don't work there. Issues with this problem on github in the amount of several pieces are closed, but in fact the generator does not work

protoc --go_out=pkg/ pkg/models.proto
cat pkg/models.pb.go

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
//   protoc-gen-go v1.25.0
//   protoc        v3.13.0
// source: reddar/models.proto

package pkg

import (
  proto "github.com/golang/protobuf/proto"
  protoreflect "google.golang.org/protobuf/reflect/protoreflect"
  protoimpl "google.golang.org/protobuf/runtime/protoimpl"
  reflect "reflect"
  sync "sync"
)


proto "github.com/golang/protobuf/proto"why does it link to github?

@pav5000

UPD:
it seems to have worked out, even taking into account that from different packages
, it turns out that it was necessary to marshal like this,
proto.Marshal(payload.ProtoReflect().Interface())
but it was like this
proto.Marshal(payload.ProtoReflect())

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pikeev, 2020-11-02
@dasha_programmist

The module posted on GitHub is imported (go get github.com/golang/protobuf/proto).

proto "github.com/golang/protobuf/proto" why does it link to github?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question