go2v icon indicating copy to clipboard operation
go2v copied to clipboard

Problem with initialize array.

Open JalonSolov opened this issue 2 years ago • 0 comments

Go code:

package main

import "fmt"

func main() {
        matrix := [][]int{
                {1, 2, 3},
                {4, 5, 6},
                {7, 8, 9},
        }
        fmt.Printf("%v\n", matrix)
}

go2v translates this as

module main
fn main() {mut matrix:=[[{1 ,2 ,3 } ,[{4 ,5 ,6 } ,[{7 ,8 ,9 } ]  
strconv.v_printf("%v\n" ,matrix ,)
}

which of course, can't be formatted.

The first problem is the array. It should've been translated to

mut matrix:=[[1, 2, 3], [4, 5, 6], [7, 8, 9]] 

There are other problems, but this issue is about the matrix being translated incorrectly.

JalonSolov avatar Aug 05 '22 02:08 JalonSolov