Q:

How to create a top level object with no fields or methods in Golang?

Since I am from Java and new to Golang, I will try to explain what I want in Java.
    interface Car { }

    class MyCarA implements Car {
      int specificToA
    }

    class MyCarB implements Car {
      int specificToB
    }

I think such an interface (like Car) is called a marker interface in Java. It is just to indicate the compiler the necessary abstraction. 
How can I do this in Golang ?
I have 
type MyCarA struct {
   specificToA int
}
type MyCarB struct {
  specificToB int
}

How can I generalise these structs now ? Should it be an interface or another struct ?

A:

You can do this:
type Car interface { IAmACar() }

type MyCarA struct {
  specificToA int
}
func (MyCarA) IAmACar() {}

type MyCarB struct {
  specificToB int
}
func (MyCarB) IAmACar() {}

You test for the marker using a type assertion:
_, itIsACar := v.(Car)

playground example
The Car interface can also be used to detect errors statically:
var c Car
c = MyCarA{0} // ok
c = 0 // error, int is not a car

The go/ast package does something similar. See uses of the function exprNode in the file ast.go.

