accounts/abi/bind, mobile: review fixes and android tests

This commit is contained in:
Péter Szilágyi
2016-11-11 10:27:30 +02:00
parent b61f48e5aa
commit 5513c49c54
3 changed files with 215 additions and 8 deletions

View File

@ -120,12 +120,16 @@ func Bind(types []string, abis []string, bytecodes []string, pkg string, lang La
if err := tmpl.Execute(buffer, data); err != nil {
return "", err
}
// Pass the code through goimports to clean it up and double check
code, err := imports.Process("", buffer.Bytes(), nil)
if err != nil {
return "", fmt.Errorf("%v\n%s", err, buffer)
// For Go bindings pass the code through goimports to clean it up and double check
if lang == LangGo {
code, err := imports.Process("", buffer.Bytes(), nil)
if err != nil {
return "", fmt.Errorf("%v\n%s", err, buffer)
}
return string(code), nil
}
return string(code), nil
// For all others just return as is for now
return string(buffer.Bytes()), nil
}
// bindType is a set of type binders that convert Solidity types to some supported