errors.New() Function in Golang with Examples Last Updated : 03 May, 2020 Comments Improve Suggest changes Like Article Like Report Errors package in Golang is used to implement the functions to manipulate the errors. errors.New()function returns an error that formats like given text. Each call to New returns distinct error value indeed in the event that the content is indistinguishable. Syntax: func New(text string) error It returns an error. Example 1: C // Golang program to illustrate // the errors.new() function package main import ( "errors" "fmt" ) // Main function func main() { err := errors.New("Sample Error") if err != nil { fmt.Print(err) } } Output: Sample Error Example 2: C // Golang program to illustrate // the errors.new() function package main import ( "errors" "fmt" ) // Main function func main() { err := errors.New("It Says Error!") if err != nil { fmt.Print(err) } } Output: It Says Error! Comment More infoAdvertise with us Next Article errors.New() Function in Golang with Examples A avengerjanus123 Follow Improve Article Tags : Go Language Golang-errors Similar Reads fmt.Errorf() Function in Golang With Examples In Go language, fmt package implements formatted I/O with functions analogous to C's printf() and scanf() function. The fmt.Errorf() function in Go language allow us use formatting features to create descriptive error messages. Moreover, this function is defined under the fmt package. Here, you need 2 min read io.Copy() Function in Golang with Examples In Go language, io packages supply fundamental interfaces to the I/O primitives. And its principal job is to enclose the ongoing implementations of such king of primitives. The Copy() function in Go language is used to copy from the stated src i.e, source to the dst i.e, destination till either the 3 min read reflect.New() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package.The reflect.New() Function in Golang is used to get the Value representing a pointer to a new zero value for the specified typ 2 min read io.CopyN() Function in Golang with Examples In Go language, io packages supply fundamental interfaces to the I/O primitives. And its principal job is to enclose the ongoing implementations of such king of primitives. The CopyN() function in Go language is used to copy "n" bytes from source to the destination. And if dst is implemented by the 3 min read reflect.Close() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.Close() Function in Golang is used to close the channel v. To access this function, one needs to imports the refl 2 min read reflect.Addr() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.Addr() Function in Golang is used to get the pointer value representing the address of v. To access this function 2 min read time.ParseError.Error() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The ParseError.Error() function in Go language is used to output the string description of a ParseError. Moreover, this function is defined under the time package. Here, you need to import "time" package in 2 min read reflect.Elem() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.Elem() Function in Golang is used to get the value that the interface v contains or that the pointer v points to. 2 min read reflect.Copy() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.Copy() Function in Golang is used to copies the contents of the source into destination until either destination 2 min read reflect.NewAt() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.NewAt() Function in Golang is used to get the Value representing a pointer to a value of the specified type, usin 2 min read Like