func sum(x, y int64) int64 {
func varInt(init int64, pars ...int64) int64 {
func shortLen(s string) (int64, error) {
return 0, fmt.Errorf("string %s is too long", s)
var customLib = []gentee.EmbedItem{
{Prototype: `sum(int,int) int`, Object: sum},
{Prototype: `InitSum(int) int`, Object: varInt},
{Prototype: `ShortLen(str) int`, Object: shortLen},
err := gentee.Customize(&gentee.Custom{
workspace := gentee.New()
exec, _, err := workspace.Compile(`run {
Println("Sum = %{sum(10, 6)}")
Println("InitSum = " + InitSum(4, 67, 4, 22))
ShortLen("this string is too long")