Hello,
I keep all my code in a single go file and it starts to getting big so I wanted to separate into multiple go files. I currently have it setup and working fine but I have to reuse a lot of imports from my main.go file in “other” go files. These “other” go files are separated into different folders under different package names, is this inefficient by any chance in that I am reloading same imports twice? Is this the correct way to setup a multi-file go program?
For example:
under root folder:
package main
import (
"fmt"
"./gostuff"
)
func main(){
fmt.Println("blah blah")
gostuff.CallFunc()
}
under root/gostuff
package gostuff
import (
"fmt" <- duplicate import a problem or no? Is this the correct way to do this?
)
func CallFunc(){
fmt.Println("random text blah")
}