Read method, one take byte slice argument. Return two values namely n int type and err error type. In this example, an assumption that the file already opens with os.Open(). a make initializes the variable on a slice of byte type with has a quantity of 100 of memory of Read more…
Package os provides a platform-independent interface to operating system functionality. The design is Unix-like, although the error handling is Go-like; failing calls return values of type error rather than error numbers. Often, more information is available within the error. For example, if a call that takes a file name fails, such as Open or Stat, the error will include the failing file name when printed and will be of type *PathError, which may be unpacked for more information.
The os interface is intended to be uniform across all operating systems. Features not generally available appear in the system-specific package syscall.