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 :
Advertisement
Something interesting
Tutorials
+10.1k Golang : Test a slice of integers for odd and even numbers
+7.7k Golang : Generate human readable password
+14.2k Elastic Search : Mapping date format and sort by date
+7.7k Golang : Error reading timestamp with GORM or SQL driver
+4.9k HTTP common errors and their meaning explained
+6.1k Golang : Debug with Godebug
+16.1k Golang : Generate universally unique identifier(UUID) example
+6.5k Elasticsearch : Shutdown a local node
+11.6k Golang : Display a text file line by line with line number example
+19.5k Golang : Example for DSA(Digital Signature Algorithm) package functions