November 2017
Intermediate to advanced
670 pages
17h 35m
English
This time, we will import packagea into featureb.go:
// circulardep/src/packageb/featureb.gopackage packagebimport a "packagea"func Btask() { println("B") a.Atask()}
The featurea.go file remains unchanged:
package packageaimport b "packageb"func Atask() { println("A") b.Btask()}
The main.go file also remains unchanged:
package mainimport a "packagea"func main() { a.Atask()}
The following is the output:
import cycle not allowedpackage mainimports packageaimports packagebimports packagea
We violated the dependency rule when we imported packagea into featureb.go.