I know this gets asked a lot but I still don't understand how to fix it. Say I have this structure:
foo
- foos.go // custom foo type
database
- database.go // interface
- postgres.go // implementation
In database.go I need to import foo, so I can saveOnDb(foo.myfoo), and in foos.go I need to import database, so I can database.saveOnDb(myfoo).
This doesn't compile because of the import cycle. What would the correct design be?
Aucun commentaire:
Enregistrer un commentaire