THRIFT-5650: Implement UUID in Go compiler

Client: go
diff --git a/test/go/src/common/clientserver_test.go b/test/go/src/common/clientserver_test.go
index 64b326a..a39519d 100644
--- a/test/go/src/common/clientserver_test.go
+++ b/test/go/src/common/clientserver_test.go
@@ -102,6 +102,13 @@
 var defaultCtx = context.Background()
 
 func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, handler *MockThriftTest) {
+	u := thrift.Tuuid{
+		0x00, 0x11, 0x22, 0x33,
+		0x44, 0x55,
+		0x66, 0x77,
+		0x88, 0x99,
+		0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
+	}
 	gomock.InOrder(
 		handler.EXPECT().TestVoid(gomock.Any()),
 		handler.EXPECT().TestString(gomock.Any(), "thing").Return("thing", nil),
@@ -111,6 +118,7 @@
 		handler.EXPECT().TestI32(gomock.Any(), int32(4242)).Return(int32(4242), nil),
 		handler.EXPECT().TestI64(gomock.Any(), int64(424242)).Return(int64(424242), nil),
 		// TODO: add TestBinary()
+		handler.EXPECT().TestUuid(gomock.Any(), u).Return(u, nil),
 		handler.EXPECT().TestDouble(gomock.Any(), float64(42.42)).Return(float64(42.42), nil),
 		handler.EXPECT().TestStruct(gomock.Any(), &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}).Return(&thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}, nil),
 		handler.EXPECT().TestNest(gomock.Any(), &thrifttest.Xtruct2{StructThing: &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}}).Return(&thrifttest.Xtruct2{StructThing: &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}}, nil),
@@ -182,6 +190,16 @@
 		t.Errorf("Unexpected TestI64() result expected 424242, got %d ", i64)
 	}
 
+	// TODO: add TestBinary() call
+
+	uret, err := client.TestUuid(defaultCtx, u)
+	if err != nil {
+		t.Errorf("Unexpected error in TestUuid() call: %s", err)
+	}
+	if uret != u {
+		t.Errorf("Unexpected TestUuid() result expected %v, got %v ", uret, u)
+	}
+
 	d, err := client.TestDouble(defaultCtx, 42.42)
 	if err != nil {
 		t.Errorf("Unexpected error in TestDouble() call: %s", err)
@@ -190,8 +208,6 @@
 		t.Errorf("Unexpected TestDouble() result expected 42.42, got %f ", d)
 	}
 
-	// TODO: add TestBinary() call
-
 	xs := thrifttest.NewXtruct()
 	xs.StringThing = "thing"
 	xs.ByteThing = 42
diff --git a/test/go/src/common/printing_handler.go b/test/go/src/common/printing_handler.go
index b726373..0939a01 100644
--- a/test/go/src/common/printing_handler.go
+++ b/test/go/src/common/printing_handler.go
@@ -26,6 +26,8 @@
 	"fmt"
 	"time"
 
+	"github.com/apache/thrift/lib/go/thrift"
+
 	//lint:ignore ST1001 allow dot import here
 	. "github.com/apache/thrift/test/go/src/gen/thrifttest"
 )
@@ -45,7 +47,7 @@
 // @return string - returns the string 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestString(ctx context.Context, thing string) (r string, err error) {
 	fmt.Printf("testString(\"%s\")\n", thing)
 	return thing, nil
@@ -56,7 +58,7 @@
 // @return bool - returns the bool 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestBool(ctx context.Context, thing bool) (r bool, err error) {
 	fmt.Printf("testBool(%t)\n", thing)
 	return thing, nil
@@ -67,7 +69,7 @@
 // @return byte - returns the byte 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestByte(ctx context.Context, thing int8) (r int8, err error) {
 	fmt.Printf("testByte(%d)\n", thing)
 	return thing, nil
@@ -78,7 +80,7 @@
 // @return i32 - returns the i32 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestI32(ctx context.Context, thing int32) (r int32, err error) {
 	fmt.Printf("testI32(%d)\n", thing)
 	return thing, nil
@@ -89,7 +91,7 @@
 // @return i64 - returns the i64 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestI64(ctx context.Context, thing int64) (r int64, err error) {
 	fmt.Printf("testI64(%d)\n", thing)
 	return thing, nil
@@ -100,7 +102,7 @@
 // @return double - returns the double 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestDouble(ctx context.Context, thing float64) (r float64, err error) {
 	fmt.Printf("testDouble(%f)\n", thing)
 	return thing, nil
@@ -111,18 +113,29 @@
 // @return []byte - returns the binary 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestBinary(ctx context.Context, thing []byte) (r []byte, err error) {
 	fmt.Printf("testBinary(%s)\n", hex.EncodeToString(thing))
 	return thing, nil
 }
 
+// Prints 'testUuid("%s")' where '%s' is the uuid given. Note that the uuid byte order should be correct.
+// @param uuid  thing - the uuid to print
+// @return uuid  - returns the uuid 'thing'
+//
+// Parameters:
+//   - Thing
+func (p *printingHandler) TestUuid(ctx context.Context, thing thrift.Tuuid) (r thrift.Tuuid, err error) {
+	fmt.Printf("testUuid(%s)\n", thing.String())
+	return thing, nil
+}
+
 // Prints 'testStruct("{%s}")' where thing has been formatted into a string of comma separated values
 // @param Xtruct thing - the Xtruct to print
 // @return Xtruct - returns the Xtruct 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestStruct(ctx context.Context, thing *Xtruct) (r *Xtruct, err error) {
 	fmt.Printf("testStruct({\"%s\", %d, %d, %d})\n", thing.StringThing, thing.ByteThing, thing.I32Thing, thing.I64Thing)
 	return thing, err
@@ -133,7 +146,7 @@
 // @return Xtruct2 - returns the Xtruct2 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestNest(ctx context.Context, nest *Xtruct2) (r *Xtruct2, err error) {
 	thing := nest.StructThing
 	fmt.Printf("testNest({%d, {\"%s\", %d, %d, %d}, %d})\n", nest.ByteThing, thing.StringThing, thing.ByteThing, thing.I32Thing, thing.I64Thing, nest.I32Thing)
@@ -141,12 +154,14 @@
 }
 
 // Prints 'testMap("{%s")' where thing has been formatted into a string of  'key => value' pairs
-//  separated by commas and new lines
+//
+//	separated by commas and new lines
+//
 // @param map<i32,i32> thing - the map<i32,i32> to print
 // @return map<i32,i32> - returns the map<i32,i32> 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestMap(ctx context.Context, thing map[int32]int32) (r map[int32]int32, err error) {
 	fmt.Printf("testMap({")
 	first := true
@@ -163,12 +178,14 @@
 }
 
 // Prints 'testStringMap("{%s}")' where thing has been formatted into a string of  'key => value' pairs
-//  separated by commas and new lines
+//
+//	separated by commas and new lines
+//
 // @param map<string,string> thing - the map<string,string> to print
 // @return map<string,string> - returns the map<string,string> 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestStringMap(ctx context.Context, thing map[string]string) (r map[string]string, err error) {
 	fmt.Printf("testStringMap({")
 	first := true
@@ -185,12 +202,14 @@
 }
 
 // Prints 'testSet("{%s}")' where thing has been formatted into a string of  values
-//  separated by commas and new lines
+//
+//	separated by commas and new lines
+//
 // @param set<i32> thing - the set<i32> to print
 // @return set<i32> - returns the set<i32> 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestSet(ctx context.Context, thing []int32) (r []int32, err error) {
 	fmt.Printf("testSet({")
 	first := true
@@ -207,12 +226,14 @@
 }
 
 // Prints 'testList("{%s}")' where thing has been formatted into a string of  values
-//  separated by commas and new lines
+//
+//	separated by commas and new lines
+//
 // @param list<i32> thing - the list<i32> to print
 // @return list<i32> - returns the list<i32> 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestList(ctx context.Context, thing []int32) (r []int32, err error) {
 	fmt.Printf("testList({")
 	for i, v := range thing {
@@ -230,7 +251,7 @@
 // @return Numberz - returns the Numberz 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestEnum(ctx context.Context, thing Numberz) (r Numberz, err error) {
 	fmt.Printf("testEnum(%d)\n", thing)
 	return thing, nil
@@ -241,7 +262,7 @@
 // @return UserId - returns the UserId 'thing'
 //
 // Parameters:
-//  - Thing
+//   - Thing
 func (p *printingHandler) TestTypedef(ctx context.Context, thing UserId) (r UserId, err error) {
 	fmt.Printf("testTypedef(%d)\n", thing)
 	return thing, nil
@@ -250,10 +271,11 @@
 // Prints 'testMapMap("%d")' with hello as '%d'
 // @param i32 hello - the i32 to print
 // @return map<i32,map<i32,i32>> - returns a dictionary with these values:
-//   {-4 => {-4 => -4, -3 => -3, -2 => -2, -1 => -1, }, 4 => {1 => 1, 2 => 2, 3 => 3, 4 => 4, }, }
+//
+//	{-4 => {-4 => -4, -3 => -3, -2 => -2, -1 => -1, }, 4 => {1 => 1, 2 => 2, 3 => 3, 4 => 4, }, }
 //
 // Parameters:
-//  - Hello
+//   - Hello
 func (p *printingHandler) TestMapMap(ctx context.Context, hello int32) (r map[int32]map[int32]int32, err error) {
 	fmt.Printf("testMapMap(%d)\n", hello)
 
@@ -267,15 +289,17 @@
 // So you think you've got this all worked, out eh?
 //
 // Creates a the returned map with these values and prints it out:
-//   { 1 => { 2 => argument,
-//            3 => argument,
-//          },
-//     2 => { 6 => <empty Insanity struct>, },
-//   }
+//
+//	{ 1 => { 2 => argument,
+//	         3 => argument,
+//	       },
+//	  2 => { 6 => <empty Insanity struct>, },
+//	}
+//
 // @return map<UserId, map<Numberz,Insanity>> - a map with the above values
 //
 // Parameters:
-//  - Argument
+//   - Argument
 func (p *printingHandler) TestInsanity(ctx context.Context, argument *Insanity) (r map[UserId]map[Numberz]*Insanity, err error) {
 	fmt.Printf("testInsanity()\n")
 	r = make(map[UserId]map[Numberz]*Insanity)
@@ -297,15 +321,16 @@
 // @param Numberz arg4 -
 // @param UserId arg5 -
 // @return Xtruct - returns an Xtruct with StringThing = "Hello2, ByteThing = arg0, I32Thing = arg1
-//    and I64Thing = arg2
+//
+//	and I64Thing = arg2
 //
 // Parameters:
-//  - Arg0
-//  - Arg1
-//  - Arg2
-//  - Arg3
-//  - Arg4
-//  - Arg5
+//   - Arg0
+//   - Arg1
+//   - Arg2
+//   - Arg3
+//   - Arg4
+//   - Arg5
 func (p *printingHandler) TestMulti(ctx context.Context, arg0 int8, arg1 int32, arg2 int64, arg3 map[int16]string, arg4 Numberz, arg5 UserId) (r *Xtruct, err error) {
 	fmt.Printf("testMulti()\n")
 	r = NewXtruct()
@@ -324,7 +349,7 @@
 // else do not throw anything
 //
 // Parameters:
-//  - Arg
+//   - Arg
 func (p *printingHandler) TestException(ctx context.Context, arg string) (err error) {
 	fmt.Printf("testException(%s)\n", arg)
 	switch arg {
@@ -348,8 +373,8 @@
 // @return Xtruct - an Xtruct with StringThing = arg1
 //
 // Parameters:
-//  - Arg0
-//  - Arg1
+//   - Arg0
+//   - Arg1
 func (p *printingHandler) TestMultiException(ctx context.Context, arg0 string, arg1 string) (r *Xtruct, err error) {
 	fmt.Printf("testMultiException(%s, %s)\n", arg0, arg1)
 	switch arg0 {
@@ -378,7 +403,7 @@
 // @param i32 secondsToSleep - the number of seconds to sleep
 //
 // Parameters:
-//  - SecondsToSleep
+//   - SecondsToSleep
 func (p *printingHandler) TestOneway(ctx context.Context, secondsToSleep int32) (err error) {
 	fmt.Printf("testOneway(%d): Sleeping...\n", secondsToSleep)
 	time.Sleep(time.Second * time.Duration(secondsToSleep))
diff --git a/test/go/src/common/simple_handler.go b/test/go/src/common/simple_handler.go
index fb95457..be5bc82 100644
--- a/test/go/src/common/simple_handler.go
+++ b/test/go/src/common/simple_handler.go
@@ -23,6 +23,8 @@
 	"errors"
 	"time"
 
+	"github.com/apache/thrift/lib/go/thrift"
+
 	//lint:ignore ST1001 allow dot import here
 	. "github.com/apache/thrift/test/go/src/gen/thrifttest"
 )
@@ -63,6 +65,10 @@
 	return thing, nil
 }
 
+func (p *simpleHandler) TestUuid(thing thrift.Tuuid) (r thrift.Tuuid, err error) {
+	return thing, nil
+}
+
 func (p *simpleHandler) TestStruct(thing *Xtruct) (r *Xtruct, err error) {
 	return r, err
 }