如何在ARM中将返回的uint8_u转换为GoString?

I call a C function from Go using cgo. The return type of the function is uint8_u *. I know it is a string and need to print it in Go.

I have the following in myFile.go

package main

// #cgo CFLAGS: -g
// #include <stdlib.h>
// #include "cLogic.h"
import "C"
import (
    "fmt"
    "unsafe"
)    

func main() {
    myString := "DUMMY"
    cMyString := C.CString(myString)
    defer C.free(unsafe.Pointer(cMyString))

    cMyInt := C.int(10)

    cResult := C.MyCFunction(cMyString, cMyInt) // Result is type *_Ctype_schar (int8_t *)
    goResult := C.GoString(cResult)
    fmt.Println("GoResult: " + goResult + "
")
}

In file cLogic.h

#include <stdint.h>

int8_t *MyCFunction(char *myString, int myInt);

In File cLogic.c

#include <stdint.h>

int8_t *MyCFunction(char *myString, int myInt){
    return "this is test";
}

I get an error in the line

goResult := C.GoString(cResult)

cannot use cResult (type *_Ctype_schar) as type *_Ctype_char in argument to _Cfunc_GoString

I understand it has a casting issue, but if I cast uint8_u * to char * in C it is fine (I'm sure I won't have issues by this cast).

When I cast it on my amd64 pc with "go version go1.10.3 linux/amd64" it builds, although on an arm machine with "go version go1.10.3 linux/arm" I get the error

cannot convert cResult (type *_Ctype_schar) to type *_Ctype_char

So add the wrapper

wrapper.h

#include <stdint.h>

char *mywrapper(char *myString, int myInt);

wrapper.c

#include <stdint.h>
#include "cLogic.h"

char *mywrapper(char *myString, int myInt);
{
  return (char *)MyCFunction(myString, myInt);
}

And include this wrapper ino your go code