Re:Go’s major versioning sucks – From a fanboy
by dmitriid on Saturday March 05, 2022 @01:37AM
(#30564955)
> you sure as hell want to check the correctness of every single line of code written using that package
Yes, I do. Doing the monkey job of changing every import line (which will be done with a global search/replace) is definitely not that.
If you're relying on import statements to tell you which files to check, you're definitely doing something wrong
Re:Go’s major versioning sucks – From a fanboy
by paskozdilar on Saturday March 05, 2022 @02:38AM
(#30565337)
What mechanism, if not the presence of import statements, do you use to locate all the places where a certain package is used in a large project?
Re:Go’s major versioning sucks – From a fanboy
by dmitriid on Saturday March 05, 2022 @07:06AM
(#30566788)
1. You build your project, and it fails in the places where API changed.
IDEs can even pinpoint those locations without building a project
2. You run tests and they fail if the behavior changed
Literally nowhere is "oh, do an automatic search/replace of imports" is a tool for fixing your project or figuring out necessary changes. Except in go, apparently.
Re:Go’s major versioning sucks – From a fanboy
by paskozdilar on Saturday March 05, 2022 @11:59AM
(#30569220)
Willingness to play russian roulette with major versions may work in small organizations. In large-scale, you can't risk subtle behavior change that still compiles. That's the source of many black magic debugging sessions.
Re:Go’s major versioning sucks – From a fanboy
by dmitriid on Sunday March 06, 2022 @12:24AM
(#30575257)
Grepping and replacing import paths isn't a good tool for finding subtle behavior changes. Especially in big projects.
Re:Go’s major versioning sucks – From a fanboy
by paskozdilar on Sunday March 06, 2022 @05:43AM
(#30576560)
Yeah, but checking each line of code that uses the import is. Especially in big projects.
You don't have to, if you don't want to upgrade to a new major version.
If you do want to upgrade to a major version, which means that there are breaking changes in a package's API or behavior - you sure as hell want to check the correctness of every single line of code written using that package. Since every file that uses that package must contain an import statement, the import statements are an easily greppable indicator of which files you have to check and potentially fix.