Answer the question
In order to leave comments, you need to log in
How to interrupt code execution in Golang?
How to interrupt code execution in Golang? (similar to exit()/die() in php)
There is
func Index(w http.ResponseWriter, r *http.Request) {
parametr=0
if parametr!="1" {
fmt.Fprintln(w, "Parameter=1" )
}
fmt.Fprintln(w, "text after validation") //I don't want to display this if parametr!="1"
}
//Need, if the parameter is not 1, then exit the function. (but not the application at all )
Of course, you can put else , but then do wrappers everywhere? or you can somehow exit the function
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question