2 ms·
Searching around a few blogs mention _linux.go files are only compiled on Linux. But I see nothing in the official documentation, will at least in my quick sear
by quickthrower2 4y ago
Searching around a few blogs mention _linux.go files are only compiled on Linux. But I see nothing in the official documentation, will at least in my quick searches.
It will catch someone out who uses BSD as an acronym for something in their domain model (Bulk Sales Discount?) then xyz_bsd.go doesn't compile.
- j16sdiz 4y agohttps://pkg.go.dev/cmd/go#hdr-Build_constraints https://pkg.go.dev/cmd/go#hdr-Build_constraints If a file's name, after stripping the extension and a possible _test suffix, matches any of the following patterns: *_GOOS *_GOARCH \*_GOOS_GOARCH (example: source_windows_amd64.go) where GOOS and GOARCH represent any known operating system and architecture values respectively, then the file is considered to have an implicit build constraint requiring those terms (in addition to any explicit constraints in the file).
- morelisp 4y agoIdiomatically in Go that file would be named `xyz-bsd.go`. All special filename behavior is triggered by `_suffix`.