Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os: Rename should document that it returns LinkError, if that is the intended specification. #10061

Closed
AlexFinkel opened this issue Mar 3, 2015 · 1 comment

Comments

@AlexFinkel
Copy link

@AlexFinkel AlexFinkel commented Mar 3, 2015

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.

@bradfitz bradfitz added this to the Go1.5 milestone Mar 3, 2015
@adg adg changed the title os.Rename should document that it returns LinkError, if that is the intended specification. os: Rename should document that it returns LinkError, if that is the intended specification. Mar 3, 2015
@bradfitz bradfitz closed this in fb90f4c Jul 17, 2015
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 17, 2015

CL https://golang.org/cl/12329 mentions this issue.

davecheney added a commit that referenced this issue Jul 17, 2015
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 <iant@golang.org>
@golang golang locked and limited conversation to collaborators Jul 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.