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: remove duplicate check from windows os.Stat #21075

Closed
markus-oberhumer opened this issue Jul 18, 2017 · 2 comments
Closed

os: remove duplicate check from windows os.Stat #21075

markus-oberhumer opened this issue Jul 18, 2017 · 2 comments

Comments

@markus-oberhumer
Copy link

@markus-oberhumer markus-oberhumer commented Jul 18, 2017

There is a duplicate check for file == nil in the windows version of os.Stat().

Seems like an oversight in git commit 11c7b44 by @ianlancetaylor .

What version of Go are you using (go version)?

Current go git master 1.9.x 73d0273 .

What did you do?

$ git diff 73d02735734e1ed1e4d1f5a7c534206596f3903a
diff --git a/src/os/stat_windows.go b/src/os/stat_windows.go
index 667b99905d..f9d8904bc4 100644
--- a/src/os/stat_windows.go
+++ b/src/os/stat_windows.go
@@ -16,9 +16,6 @@ func (file *File) Stat() (FileInfo, error) {
        if file == nil {
                return nil, ErrInvalid
        }
-       if file == nil {
-               return nil, syscall.EINVAL
-       }
        if file.isdir() {
                // I don't know any better way to do that for directory
                return Stat(file.dirinfo.path)

Please feel free to fix this trivial issue by yourself - I don't have a Gerrit account and a CLA (yet).

@johnnyluo

This comment has been minimized.

Copy link
Contributor

@johnnyluo johnnyluo commented Jul 20, 2017

I would like to work on this

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jul 20, 2017

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

@gopherbot gopherbot closed this in 5125a96 Jul 20, 2017
@golang golang locked and limited conversation to collaborators Jul 20, 2018
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
5 participants
You can’t perform that action at this time.