tools/golang: Remove existing *.gen.go before re-creating them
PATCH 1/1 tools/golang: Remove existing *.gen.go before re-creating them
In cases where we don't have permission to write to the existing *.gen.go, we should be able to remove them and recreate them.
Signed-off-by Anthony PERARD <[email protected]>
---
For 4.17:
Without this, it is possible that the Gitlab CI got in a state where writing to the file would fail, but removing it and creating a new one should work.
This issue have been observed only on fedora-gcc* jobs as fedora is our only container that have golang installed. And it runs the build as a user instead of `root.
--- tools/golang/xenlight/gengotypes.py | 2 ++ 1 file changed, 2 insertions(+)
tools/golang/xenlight/gengotypes.py +2 -0
@@ -45,6 +45,7 @@ def xenlight_golang_generate_types(path = None, types = None, comment = None): if path is None: path = 'types.gen.go' + os.unlink(path) with open(path, 'w') as f: if comment is not None: f.write(comment)
@@ -209,6 +210,7 @@ def xenlight_golang_generate_helpers(path = None, types = None, comment = None): if path is None: path = 'helpers.gen.go' + os.unlink(path) with open(path, 'w') as f: if comment is not None: f.write(comment)
Signature · 1 line
Anthony PERARD