mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 03:53:42 +00:00
compiler: support compiling individual .go files
For example:
tinygo run ./src/examples/test/test.go
This commit is contained in:
@@ -169,7 +169,11 @@ func (c *Compiler) Parse(mainPath string) error {
|
||||
ParserMode: parser.ParseComments,
|
||||
}
|
||||
config.Import("runtime")
|
||||
config.Import(mainPath)
|
||||
if strings.HasSuffix(mainPath, ".go") {
|
||||
config.CreateFromFilenames("main", mainPath)
|
||||
} else {
|
||||
config.Import(mainPath)
|
||||
}
|
||||
lprogram, err := config.Load()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user