Explorar o código

Return errors getting extensions when formatting text,
rather than writing the error to stderr.

David Symonds %!s(int64=11) %!d(string=hai) anos
pai
achega
aece6fb931
Modificáronse 1 ficheiros con 1 adicións e 5 borrados
  1. 1 5
      proto/text.go

+ 1 - 5
proto/text.go

@@ -41,7 +41,6 @@ import (
 	"io"
 	"io"
 	"log"
 	"log"
 	"math"
 	"math"
-	"os"
 	"reflect"
 	"reflect"
 	"sort"
 	"sort"
 	"strings"
 	"strings"
@@ -669,10 +668,7 @@ func writeExtensions(w *textWriter, pv reflect.Value) error {
 
 
 		pb, err := GetExtension(ep, desc)
 		pb, err := GetExtension(ep, desc)
 		if err != nil {
 		if err != nil {
-			if _, err := fmt.Fprintln(os.Stderr, "proto: failed getting extension: ", err); err != nil {
-				return err
-			}
-			continue
+			return fmt.Errorf("failed getting extension: %v", err)
 		}
 		}
 
 
 		// Repeated extensions will appear as a slice.
 		// Repeated extensions will appear as a slice.