In golang, structs are instantiated differently from "regular" types:
If it's a regular type: MyFloat(2)
If it's a struct: MyFloat{2}
Is there a particular reason for this?
package main
import (
"fmt"
)
type MyFloat float64
type MyFloat2 struct {
X float64
}
func main() {
f1 := MyFloat(2)
f2 := MyFloat2{3}
fmt.Println(f1)
fmt.Println(f2)
}