如何针对Linux和Windows进行不同的构建

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 Linux.

I'm just asking, is there a convenient way of organizing build process? Of course, I can just make a project for every OS and change import name for every OS.

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.