1
:短い道
foo := struct{
bar func(string, int, bool) error
}{ bar: func(a string, b int, c bool) error {
// ...
}}
あなたは、私が二回bar
の署名を記述する必要が見ることができるように。これを書くための短い方法がありますか?
:短い道
foo := struct{
bar func(string, int, bool) error
}{ bar: func(a string, b int, c bool) error {
// ...
}}
あなたは、私が二回bar
の署名を記述する必要が見ることができるように。これを書くための短い方法がありますか?
これより短い方法はありません。
構造体は本当にあなたがfoo
の種類を変更したい場合があり、一方のフィールドのみを持っている場合:
foo := func(a string, b int, c bool) error {
// ...
}