Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nahuel opened this issue Apr 28, 2021 · 0 comments

Comments

@nahuel
Copy link

nahuel commented Apr 28, 2021

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)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant