Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It sounds to me like there are some people who don't follow the style, rather than there not being a consistent style.


Which of those options do you view as 'the style'? One block, two blocks (core library and others), or three (core library, 3rd party, same-source-tree).


The first rule of any style guide should be "adhere to the conventions of surrounding code." So the answer to your question is it depends on what the convention in the file (and surrounding files) has already chosen. If there is only one grouping and you're adding enough imports that you have to choose between making two or three, then I would say use two because that is what the canonical & normative style guide recommends [0], but if you're working in an organization that has chosen to use goimports or has alternative guidance in its org-specific style guide then go ahead and make it three groups.

[0]: https://google.github.io/styleguide/go/decisions#import-grou...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: