New ask Hacker News story: Golang – Pull all the structs out???
Golang – Pull all the structs out???
2 by brianvoe | 6 comments on Hacker News.
Something I am dealing with at work right now is the idea of pulling all the main structs of our packages into a single package to alleviate(not get rid of) cyclical import issue. The issue I have with this is that when we pull all of the main structs from there packages you disconnect the logic from data structs that us it. Plus remove certain core functionality like more advance logic that would go into a method that cant be simple getters and setters in that struct package. The other issue I contend with is that in doing so it just doesn't "feel" like idiomatic Go. For the many years I have been using Go both core package and open source ones(big and small) and I just don't see many cases where packages completely pull their main structs out. I also try to think about what more advanced developers would do like Rob Pike(https://www.youtube.com/watch?v=PAAkCSZUG1c&t=568s), Brad Fitzpatrick, Russ Cox, I assume they wouldn't think this is a good idea. Presenting various example and quotes from core Go developers didn't seem to sway them. Does anyone have experience in this area? Has anyone pulled their main structs out and have been better off for it? Has anyone pulled them out and then realized it was bad and moved them all back? What are your thought?
2 by brianvoe | 6 comments on Hacker News.
Something I am dealing with at work right now is the idea of pulling all the main structs of our packages into a single package to alleviate(not get rid of) cyclical import issue. The issue I have with this is that when we pull all of the main structs from there packages you disconnect the logic from data structs that us it. Plus remove certain core functionality like more advance logic that would go into a method that cant be simple getters and setters in that struct package. The other issue I contend with is that in doing so it just doesn't "feel" like idiomatic Go. For the many years I have been using Go both core package and open source ones(big and small) and I just don't see many cases where packages completely pull their main structs out. I also try to think about what more advanced developers would do like Rob Pike(https://www.youtube.com/watch?v=PAAkCSZUG1c&t=568s), Brad Fitzpatrick, Russ Cox, I assume they wouldn't think this is a good idea. Presenting various example and quotes from core Go developers didn't seem to sway them. Does anyone have experience in this area? Has anyone pulled their main structs out and have been better off for it? Has anyone pulled them out and then realized it was bad and moved them all back? What are your thought?
Comments
Post a Comment