I\'m taking look on Go language. And I have a question: for example I will create a new library, that should use methods from one Go package for Windows and from other for L
Use build constraints and file names. See Package build. The source code for Package os has many examples: https://golang.org/src/os/. Go Source Code: https://go.googlesource.com/go or https://github.com/golang/go.
A build contraint for Unix:
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
Some build file names:
stat_darwin.go stat_linux.go stat_openbsd.go stat_unix.go
stat_dragonfly.go stat_nacl.go stat_plan9.go stat_windows.go
stat_freebsd.go stat_netbsd.go stat_solaris.go
The Go tools and standard library started out using build file names and then, as the requirements became more complex, began using build constraints.