Golang os.NewFile() function example

package os

Golang os.NewFile() function usage example

  file := os.NewFile(3, "")

NOTE : From the source code ( https://golang.org/src/os/file_unix.go?s=1063:1106#L31 ) ... NewFile does not create a new file, all it does is to setup a Go os.File wrapper with the given file descriptor (see http://www.theunixschool.com/2010/08/unix-file-descriptors.html )

References :

http://golang.org/pkg/os/#NewFile

https://www.socketloop.com/references/golang-net-filelistener-and-os-newfile-functions-example

Advertisement