mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-21 22:36:39 +00:00
``` $ gvt delete github.com/weaveworks/weave/vendor/github.com/gogo/protobuf/proto $ gvt delete github.com/docker/docker/vendor/github.com/gogo/protobuf/proto $ gvt delete github.com/gogo/protobuf/gogoproto $ gvt delete github.com/gogo/protobuf/proto $ gvt delete github.com/gogo/protobuf/protoc-gen-gogo/descriptor $ gvt delete github.com/gogo/protobuf/sortkeys $ gvt delete github.com/gogo/protobuf/types $ gvt delete google.golang.org/genproto/googleapis/rpc/status $ gvt delete github.com/golang/protobuf/jsonpb $ gvt delete github.com/golang/protobuf/proto $ gvt delete github.com/golang/protobuf/protoc-gen-go/descriptor $ gvt delete github.com/golang/protobuf/ptypes $ gvt delete github.com/matttproud/golang_protobuf_extensions/pbutil $ gvt fetch github.com/gogo/protobuf/proto 2018/07/23 18:33:10 Fetching: github.com/gogo/protobuf/proto 2018/07/23 18:33:15 · Fetching recursive dependency: github.com/gogo/protobuf/types 2018/07/23 18:33:15 ·· Fetching recursive dependency: github.com/gogo/protobuf/sortkeys $ gvt fetch github.com/golang/protobuf/proto 2018/07/23 18:33:16 Fetching: github.com/golang/protobuf/proto 2018/07/23 18:33:19 · Fetching recursive dependency: github.com/golang/protobuf/ptypes/any $ gvt fetch github.com/golang/protobuf/ptypes 2018/07/23 18:33:19 Fetching: github.com/golang/protobuf/ptypes 2018/07/23 18:33:19 Deleting existing subpackage to prevent overlap: github.com/golang/protobuf/ptypes/any 2018/07/23 18:33:22 · Skipping (existing): github.com/golang/protobuf/proto $ gvt fetch github.com/matttproud/golang_protobuf_extensions/pbutil 2018/07/23 18:33:23 Fetching: github.com/matttproud/golang_protobuf_extensions/pbutil 2018/07/23 18:33:25 · Skipping (existing): github.com/golang/protobuf/proto $ gvt fetch google.golang.org/genproto/googleapis/rpc/status 2018/07/23 18:33:25 Fetching: google.golang.org/genproto/googleapis/rpc/status 2018/07/23 18:33:31 · Skipping (existing): github.com/golang/protobuf/proto 2018/07/23 18:33:31 · Skipping (existing): github.com/golang/protobuf/ptypes/any ``` fixed: ``` vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go:111:28: undefined: proto.InternalMessageInfo ```
47 lines
1.5 KiB
Go
47 lines
1.5 KiB
Go
// Copyright 2013 Matt T. Proud
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package pbutil
|
|
|
|
import (
|
|
"encoding/binary"
|
|
"io"
|
|
|
|
"github.com/golang/protobuf/proto"
|
|
)
|
|
|
|
// WriteDelimited encodes and dumps a message to the provided writer prefixed
|
|
// with a 32-bit varint indicating the length of the encoded message, producing
|
|
// a length-delimited record stream, which can be used to chain together
|
|
// encoded messages of the same type together in a file. It returns the total
|
|
// number of bytes written and any applicable error. This is roughly
|
|
// equivalent to the companion Java API's MessageLite#writeDelimitedTo.
|
|
func WriteDelimited(w io.Writer, m proto.Message) (n int, err error) {
|
|
buffer, err := proto.Marshal(m)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
|
|
var buf [binary.MaxVarintLen32]byte
|
|
encodedLength := binary.PutUvarint(buf[:], uint64(len(buffer)))
|
|
|
|
sync, err := w.Write(buf[:encodedLength])
|
|
if err != nil {
|
|
return sync, err
|
|
}
|
|
|
|
n, err = w.Write(buffer)
|
|
return n + sync, err
|
|
}
|