GoLang

For json

func golang_to_str(request *C.char) *C.char {
    var requestMap map[string]string
    var output string
    err = json.UnMarshal(C.GoBytes(request, C.strlen(requestStr)), requestMap)
    //todo: something with requestMap ?
    root = Result{"Go World", "success", []Result{}}
    output, err = json.Marshal(root)
    if err == nil {
        output, err = JsonError(err)
        if err == nil {
            output = err.Error();
        }
    }
    fmt.Println("OUTPUT!", output)
    return C.CString(output);*/
}
type Result struct {
    Name string `json: "name"`
    Status string `json: "status"`
    Result []Result `json: "result"`
}

Structs to JSON

extern void _cgoexp_05c401ca05cf_golang_to_str(void *, int);

char* golang_to_str(char* p0)
{
	_cgo_wait_runtime_init_done();
	struct {
		char* p0;
		char* r0;
	} __attribute__((__packed__, __gcc_struct__)) a;
	a.p0 = p0;
	crosscall2(_cgoexp_05c401ca05cf_golang_to_str, &a, 16);
	return a.r0;
}

Generated Interface

void crosscall2(void(*fn)(void*, int), void *a, int c) { }
void _cgo_wait_runtime_init_done() { }
char* _cgo_topofstack(void) { return (char*)0; }
void _cgo_allocate(void *a, int c) { }
void _cgo_panic(void *a, int c) { }
void _cgo_reginit(void) { }
int _cgoexp_05c401ca05cf_golang_to_str;
int _cgoexp_05c401ca05cf_golang_to_json;
int _cgoexp_05c401ca05cf_golang_free;

Unfortunately

Unable to parse response ��x%H�C H�

crosscall2 should be this

Rebuild fortidev with

--enable-languages=c,c++,go 

If i had more time.....

Made with Slides.com