diff --git a/cmd/cue/cmd/get_go.go b/cmd/cue/cmd/get_go.go index de66b053a3e..935ef0de7cb 100644 --- a/cmd/cue/cmd/get_go.go +++ b/cmd/cue/cmd/get_go.go @@ -1132,6 +1132,8 @@ func (e *extractor) makeType(expr types.Type) (result cueast.Expr) { switch t := x.String(); t { case "uintptr": return e.ident("uint64", false) + case "byte": + return e.ident("uint8", false) default: return e.ident(t, false) } diff --git a/cmd/cue/cmd/testdata/script/get_go_types.txt b/cmd/cue/cmd/testdata/script/get_go_types.txt index 0e4ccbbc0c1..36dc2e6acd7 100644 --- a/cmd/cue/cmd/testdata/script/get_go_types.txt +++ b/cmd/cue/cmd/testdata/script/get_go_types.txt @@ -65,6 +65,8 @@ type Foozer struct { Ptr uintptr + Byte byte + // Time is mapped to CUE's internal type. Time time.Time @@ -81,6 +83,7 @@ type Foozer struct { Array1 [5]int Array2 [5]interface{} Array3 *[5]json.Marshaler + Array4 [5]byte Intf Interface `protobuf:"varint,2,name=intf"` Intf2 interface{} @@ -397,6 +400,7 @@ import ( AnyText: string @go(,encoding.TextMarshaler) bar?: int & >10 @go(Bar) Ptr: uint64 @go(,uintptr) + Byte: uint8 @go(,byte) // Time is mapped to CUE's internal type. Time: time.Time @@ -412,6 +416,7 @@ import ( Array1: 5 * [int] @go(,[5]int) Array2: 5 * [_] @go(,[5]interface{}) Array3?: null | 5*[_] @go(,*[5]json.Marshaler) + Array4: bytes @go(,[5]byte) Intf: #Interface @protobuf(2,varint,name=intf) Intf2: _ @go(,interface{}) Intf3: {