Skip to content

Commit

Permalink
exit(1) on vfmt error (that means go2v failed)
Browse files Browse the repository at this point in the history
  • Loading branch information
medvednikov committed Nov 12, 2024
1 parent fc763e3 commit ff4f5a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion expr.v
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn (mut app App) binary_expr(b BinaryExpr) {
}

fn (mut app App) unary_expr(u UnaryExpr) {
if u.op == '^' {
if false && u.op == '^' {
// In Go bitwise NOT is ^x
// In V it's ~x, ^ is only used for XOR: x^b
app.gen('~')
Expand Down
5 changes: 4 additions & 1 deletion main.v
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ fn (mut app App) translate_file(go_file_path string) {
v_path := go_file_path.replace('.go', '.v')
os.write_file(v_path, generated_v_code) or { panic(err) }
println('${v_path} has been successfully generated')
os.system('v -translated-go fmt -w ${v_path}')
res := os.system('v -translated-go fmt -w ${v_path}')
if res != 0 {
exit(1)
}
}

fn (mut app App) run_test(subdir string, test_name string) ! {
Expand Down

0 comments on commit ff4f5a5

Please sign in to comment.