diff --git a/transpile/service.go b/transpile/service.go index 0252634..10068a3 100644 --- a/transpile/service.go +++ b/transpile/service.go @@ -643,6 +643,8 @@ func handleValueSpecValues(values []ast.Expr) string { switch v := value.(type) { case *ast.BasicLit: code += handleBasicLit(v) + case *ast.BinaryExpr: + code += handleBinaryExpr(v) case *ast.SelectorExpr: code += handleSelectorExpr(value) case *ast.CallExpr: diff --git a/transpile/service_test.go b/transpile/service_test.go index 1fc8adb..616b384 100644 --- a/transpile/service_test.go +++ b/transpile/service_test.go @@ -62,6 +62,15 @@ var _ = Describe("Go Translator", func() { ` Compare(source, expected) }) + It("Const Int Calculated Declaration", func() { + source := `package test + const foo int = 3 - 1 + ` + expected := ` + const int foo = 3 - 1; + ` + Compare(source, expected) + }) It("Var_String_Declaration", func() { source := `package test