go中的int和C.int有什么区别?

import "C"

func f() {
  var vGo int
  var vC  C.int
  // fails to compile with error
  // cannot use &vGo (type *int) as type *C.int in argument to...
  C.c_function(&vGo)  
  // compiles just fine:
  C.c_function(&vC)
}

I compile with CGO_ENABLED=1 GOARCH=arm...

What's the different in int and C.int types in this case?
Where do I find additional information on C types in GO?

What's the difference between the types? It depends. If you're on 64bit, the Go int will be 64 bits while the C int will be 32. If you're on 32bit, there is no real difference.

Where do I find additional information on C types in Go? Look at documentation for C. As mentioned in the comments, implicit numeric type conversions aren't allowed in Go so a conversion is required.

Go deliberately does not support implicit type conversion, with some exceptions1:

A value x is assignable to a variable of type T ("x is assignable to T") in any of these cases:

  • x's type is identical to T.
  • x's type V and T have identical underlying types and at least one of V or T is not a named type.
  • T is an interface type and x implements T.
  • x is a bidirectional channel value, T is a channel type, x's type V and T have identical element types, and at least one of V or T is not a named type.
  • x is the predeclared identifier nil and T is a pointer, function, slice, map, channel, or interface type.
  • x is an untyped constant representable by a value of type T.

The conversion in your case is needed to match potentially different memory layouts2.