在golang中定义类型作为参考

To my surprise this block

type Object *struct{
  X int
}

compiles in golang. However, I don't know how to create an instance of the underlying struct.

Functionally, what I wanted to achieve is to remove all the stars from all type signatures without hacks (redefining the type and other tricks). This would make the type/structs very much like Java classes.

The question is - is this construction supported in golang? Or should I stick to putting stars everywhere?

If you don't want to pass pointers around everywhere, you don't have to. You could just pass your structs around by value.

E.g.

Define your struct as:

type Object struct{
  X int
}

And then define your functions as:

func DoStuffToObject(obj Object) {
    // Do things with obj here
}

There's nothing wrong with passing around objects by value if that's what you wish to do.