golang.org/x/net@v0.25.1-0.20240516223405-c87a5b62e243/internal/socket/error_windows.go (about) 1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package socket 6 7 import "syscall" 8 9 var ( 10 errERROR_IO_PENDING error = syscall.ERROR_IO_PENDING 11 errEINVAL error = syscall.EINVAL 12 ) 13 14 // errnoErr returns common boxed Errno values, to prevent allocations 15 // at runtime. 16 func errnoErr(errno syscall.Errno) error { 17 switch errno { 18 case 0: 19 return nil 20 case syscall.ERROR_IO_PENDING: 21 return errERROR_IO_PENDING 22 case syscall.EINVAL: 23 return errEINVAL 24 } 25 return errno 26 }