I have two packages main and test. I'm working on test package and I need to import a struct that is decalared inside main package, but it seems to be impossible!
This is my directory structure:
root/
├── test/
│ └── test.go
├── main.go
└── go.mod
go.mod:
module my_project
go 1.20
main.go:
package main
import "my_project/test"
type MainStruct struct {
Name string
}
func main() {
test.TestFunction()
}
test.go:
package test
func TestFunction() {
// I want to access 'MainStruct' here
}
Is it possible to import from parent package?