After I read most recent blog post https://blog.golang.org/module-compatibility.
I wondered if many of the issues couldn't be avoided by allowing modules to provide fixes to automatically upgrade between major versions using go fix.
I'm currently not sure how this can be achieved exactly.
The text was updated successfully, but these errors were encountered:
@lu4p I understand that the maintainer provides the fix. If it doesn't have to be perfect, then I'm not sure why it needs any particular support from the Go toolchain. The maintainer can just say: this is what you have to change, and here is a program that can do most of the changes for you. That program can be a go fix module.
What do you think should change in the Go toolchain?
@ianlancetaylor You are right it would probably only make sense to provide "perfect" fixes.
Maybe we can have some code generation tool which can outline all the possible cases so no case is missed. Another approach would be to force the implementation of a FuncFixer interface.
Something like go fix new func
Which would generate a file like %time_func.fix.go
There probably needs to be a seperate directory where all fixfiles are stored, because reserving a directory name like fixes is not hard make this configurable in the modfile with a new directive like fixdir.
The fixfiles should be normal go files, but they probably need a standard layout (version, affected subpackage, description), therfore a go fix new command.