Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
os: Rename should document that it returns LinkError, if that is the intended specification. #10061
Looking at the source, os.Rename will always return a LinkError if it returns an error, however the documentation does NOT state that behaviour.
If it's intended to be a reliable feature of this function, it should be in the docstring, in the same way that os.Create and os.Stat return PathError. Otherwise, I feel that I need to manually ensure that the information provided by LinkError is logged separately, in case future implementations of the os.Rename function don't return the details of the renamed files in the error message.
Updates #10061 CL 12353 updated the documentation for os.Rename to stipulate the function will return errors of type *os.LinkError. This CL adds a test to ensure that the implementations continue to obey this contract. Change-Id: I41beb8c9d8356c737de251fdc6f652caab3ee636 Reviewed-on: https://go-review.googlesource.com/12329 Reviewed-by: Ian Lance Taylor <email@example.com>