diff options
author | Dave Cheney <dave@cheney.net> | 2015-06-02 11:04:45 +1000 |
---|---|---|
committer | Dave Cheney <dave@cheney.net> | 2015-06-02 05:35:29 +0000 |
commit | f6d43b746a683b63f93999f07a27db79be1ca146 (patch) | |
tree | d5bbc1385ff77a6c7cc3faa7402f6466979aff2c /src/net/file_unix.go | |
parent | 1831e1ec3725c987c42aef81264433a219756226 (diff) | |
download | go-git-f6d43b746a683b63f93999f07a27db79be1ca146.tar.gz |
net: fix undetected set and not used error
Fixes an error where the compiler did not spot that the shadowed err
value was set again after being read. That second assignment was lost
as the value was redeclared in an inner scope.
Spotted by Gordon Klass, https://groups.google.com/forum/#!topic/golang-nuts/MdDLbvOjb4o
Change-Id: I28f2da6f98c52afcbb45e17d2b4f36c586598f98
Reviewed-on: https://go-review.googlesource.com/10600
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Diffstat (limited to 'src/net/file_unix.go')
-rw-r--r-- | src/net/file_unix.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net/file_unix.go b/src/net/file_unix.go index df884d1603..83a2936c82 100644 --- a/src/net/file_unix.go +++ b/src/net/file_unix.go @@ -45,7 +45,8 @@ func newFileFD(f *os.File, sa SocketAddr) (*netFD, error) { fd, err = newFD(s, -1, -1, laddr.Network()) } else { family := syscall.AF_UNSPEC - sotype, err := syscall.GetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_TYPE) + var sotype int + sotype, err = syscall.GetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_TYPE) if err != nil { closeFunc(s) return nil, os.NewSyscallError("getsockopt", err) |