Go - Function


func (file *File) Write(b []byte) (n int, err error)


  • (file *File) defines with which type the method function is coupled
  • Write is the name of the function
  • b []byte is the parameter of the function
  • (n int, err error) is the return variables


As a map is a reference, a function receives a copy of the map reference (not of the data). So any changes the called function makes to the underlying data structure are also be visible through the caller’s map reference too.


Write a comment before the declaration of each function to specify its behavior. These conventions are important, because they are used by tools like go doc and godoc to locate and display documentation.

Powered by ComboStrap