I always see the code,
//go:build linux
// build linux
what mean? I don't understand.
just give me some examples
CodePudding user response:
These are build constraints, see https://pkg.go.dev/go/build#hdr-Build_Constraints
In older versions of Go, you would say
// build linux
where the new syntax from Go 1.17 and up is
//go:build linux
but they do the same thing: only include this file in the Linux build.