Golang errors.New() function example

package errors

New returns an error that formats as the given text.

Golang errors.New() function usage example

  package main

 import  "fmt"
 import  "errors"

 func main(){
 fmt.Println(errors.New("New type of Error message here"))
 }

Reference :

http://golang.org/pkg/errors/#New

Advertisement