So i have created a package named app
inside which there are two go files named entry.go
and entry1.go
where entry.go
is having function main while entry1.go
is having a function which is being called by entry.go
.
content of entry.go
:
package main
import "fmt"
import "app"
func main(){
fmt.Println("app/entry.go")
app.FunctionOne()
}
content of entry1.go
:
package main
func FunctionOne() {
fmt.Println("this is having different name")
}
on running go build it shows import cycle
You don't have to import app
! you're in the same package which is main
package.
just remove the extra import, and use FunctionOne()
no need for app