errBuf := new(bytes.Buffer), new(bytes.Buffer) 3 4 // with "--descriptor_set_out=/dev/stdout" 5 cmd := exec.Command("protoc", args...) 6 cmd.Stdout = buf 7 cmd.Stderr = errBuf 8 if err := cmd.Run(); err != nil { 9 if errBuf.Len() != 0 { 10 return nil, errors.New(errBuf.String()) 11 } 12 return nil, err 13 } 14 return buf.Bytes(), nil 15 }