You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working on a large template project that composed from a lot of files, and you accidentally created an import cycle, what you will get on the execution is a huge chunk that is hard to debug and figure out where was the problem.
I'm proposing to add support for circular import detection in the template package, and return an informative message in cases like this.
Also, if this proposal will be accepted, I would like to create a CL.
@a8m thank you for the proposal/request. This looks interesting, and IMHO fire away and go ahead with a prototype for it; the results will perhaps give more weight to your proposal. The complexity, invasiveness, benefits are easier to evaluate with an exhibit, so all yours ;)
Of course the due process proposal reviews will be performed.
This is no different from a program that calls itself recursively:
func main() {
main()
}
We don't detect those in the Go compiler because it's very difficult in general. I was going to suggest a maximum depth check, but there's already one in the code. If I change the snippet to use the error result and show it:
When working on a large template project that composed from a lot of files, and you accidentally created an import cycle, what you will get on the execution is a huge chunk that is hard to debug and figure out where was the problem.
I'm proposing to add support for circular import detection in the template package, and return an informative message in cases like this.
Also, if this proposal will be accepted, I would like to create a CL.
Here's an example that demonstrates that: https://play.golang.org/p/6moF8cH8rW
The text was updated successfully, but these errors were encountered: