#Quick help!

26 messages · Page 1 of 1 (latest)

rain eagle
#

It gives me this error for some reason!

worn gorge
rain eagle
#

oh

worn gorge
#

You return UserHash but it seems like your function isn't meant to return anything

rain eagle
#

oh yeah true!

#

Thanks!

#

❤️

worn gorge
#

You should read the errors :P haha np

rain eagle
worn gorge
#

Hmm? What do you mean?

rain eagle
#

@worn gorge

worn gorge
#

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...
}
rain eagle
#

oh

#

Idk what i was doing either sory

fallen solstice
#

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)
rain eagle
#

Anyways

#

@worn gorge Do you know how to fix this?

#

How to get the value of it