In my golang application, I'm setting some global variables to true based on form input, and then discovering that they have changed to false when used in a subsequent function. Question, what is the proper way to declare and set Boolean values in golang?
var withKetchup bool
var withMustard bool
func orderProcess(w http.ResponseWriter, r *http.Request){
r.ParseForm()
withKetchup := r.FormValue("withKetchup") //set to true (in form js form selection)
withMustard := r.FormValue("withMustard") //set to true
code omitted ///
}
func prepareOrder(){
code omitted//
fmt.Println(withKetchup, withMustard) //both are false even though initially set to true
if withKetchup == true && withMustard == true{
}else {
}
}