internal/impl: change Go representation of extension lists to []T

Change-Id: Iebcefe0330c8f858c7735f9362abfd87043ee39d
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/192458
Reviewed-by: Joe Tsai <joetsai@google.com>
diff --git a/internal/impl/codec_tables.go b/internal/impl/codec_tables.go
index 31fc412..a332922 100644
--- a/internal/impl/codec_tables.go
+++ b/internal/impl/codec_tables.go
@@ -431,10 +431,13 @@
 func encoderFuncsForValue(fd pref.FieldDescriptor, ft reflect.Type) valueCoderFuncs {
 	switch {
 	case fd.Cardinality() == pref.Repeated && !fd.IsPacked():
-		if ft.Kind() != reflect.Ptr || ft.Elem().Kind() != reflect.Slice {
+		if ft.Kind() == reflect.Ptr {
+			ft = ft.Elem()
+		}
+		if ft.Kind() != reflect.Slice {
 			break
 		}
-		ft := ft.Elem().Elem()
+		ft := ft.Elem()
 		switch fd.Kind() {
 		case pref.BoolKind:
 			if ft.Kind() == reflect.Bool {
@@ -512,10 +515,13 @@
 			return coderGroupSliceValue
 		}
 	case fd.Cardinality() == pref.Repeated && fd.IsPacked():
-		if ft.Kind() != reflect.Ptr || ft.Elem().Kind() != reflect.Slice {
+		if ft.Kind() == reflect.Ptr {
+			ft = ft.Elem()
+		}
+		if ft.Kind() != reflect.Slice {
 			break
 		}
-		ft := ft.Elem().Elem()
+		ft := ft.Elem()
 		switch fd.Kind() {
 		case pref.BoolKind:
 			if ft.Kind() == reflect.Bool {