1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-07 09:45:37 +01:00
Files
AJ Bahnken 15dfcfafcb Vendoring update (#472)
It's been around 9 months since our last vendor update. This is also
needed for some new features being worked on for sops workspace.

Additionally, this PR regenerates the kms mocks.
2019-06-06 17:40:34 +00:00

24 lines
620 B
Go

package codegenerator
import (
"fmt"
"io"
"io/ioutil"
"github.com/golang/protobuf/proto"
plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
)
// ParseRequest parses a code generator request from a proto Message.
func ParseRequest(r io.Reader) (*plugin.CodeGeneratorRequest, error) {
input, err := ioutil.ReadAll(r)
if err != nil {
return nil, fmt.Errorf("failed to read code generator request: %v", err)
}
req := new(plugin.CodeGeneratorRequest)
if err = proto.Unmarshal(input, req); err != nil {
return nil, fmt.Errorf("failed to unmarshal code generator request: %v", err)
}
return req, nil
}