#Quick help!
26 messages · Page 1 of 1 (latest)
You mean to access userHashResponse and not body after the unmarshal i assume
You return UserHash but it seems like your function isn't meant to return anything
You should read the errors :P haha np
How can i give my Struct values?
Hmm? What do you mean?
I've no idea what you're doing here, you're declaring structs inside functions?
Usually you're define structs at the start of your code, outside the functions, and use the structs wherever you need em then you can do
myVar = MyStruct{
values...
}
it's totally fine to define types inside functions. What you're doing wrong in the last screenshot is that you're try to pass values while you define it which is just invalid syntax
you first define a type and then you use them in variables
type userSomething struct { AuthMethod string }
somevar := userSomething{ AuthMethod : "value here" }
fmt.Println(somevar.AuthMethod)
The only way to define a type while passing values to it is with anonymous types
somevar := struct { AuthMethod string } { AuthMethod : "value here" }
fmt.Println(somevar.AuthMethod)