ob-go icon indicating copy to clipboard operation
ob-go copied to clipboard

feature request: support import's in source with main() auto-wrapping enabled

Open nahuel opened this issue 4 years ago • 0 comments

It will be handy if ob-go detected import statements and put them at the beginning of the generated file, without needing to explicitly declare a main() function, so:

import "fmt"
fmt.Println(1)

will be internally translated to:

package main
import "fmt"
func main() {
    fmt.Println(1)
}

Currently this block is translated to invalid go and the compilation fails:

package main
func main() {
    import "fmt"
    fmt.Println(1)
}

nahuel avatar Apr 28 '21 19:04 nahuel