Moo
(Marc)
1
type Lock struct {
User_key string
Date string
}
type Rules struct {
Write float64
Read float64
Lock []Lock
}
temp.Read = rul.Read
temp.Write = rul.Write
temp.Lock = rul.Lock // <- this is []Lock
I give back from function
return &Rules{
Write: temp.Write,
Read: temp.Read,
Lock: temp.Lock,
}
The Write & Read -value get with
myreturn.Write
myreturn.Read
when I try a values from myreturn.Lock give me a failure
`
myreturn.Lock.User_key
`
How di I get the value from myreturn.Lock.User_key??
radovskyb
(Benjamin Radovsky)
2
Hey @Moo,
If Lock
is a slice you can not simply call myreturn.Lock.User_key
.
You will need to index a specific Lock
from the slice of Lock
s, for example: myreturn.Lock[0].User_key
.
Moo
(Marc)
3
Thx it works!!!
I still have so my problem with slices, maps and array…
radovskyb
(Benjamin Radovsky)
4
Glad to help!
That’s okay, you’ll get the hang of it the more you write programs with Go
Feel free to ask a question anytime you get stuck anyway!
Moo
(Marc)
5
Who I do! This is the right place for help.
system
(system)
Closed
6
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.