Cgo enables go programs to call C code. Cgo reads a go source file written in a special format and outputs Go and C programs, so that C programs can be packaged into Go language packages.
For example, the following is a Go language package, which contains two functions-Random and Seed-and is the vest of Random and srandom functions in the C language library.