Hi Folks, If I need to compile c files in a package conditionally based on the OS that I am running on, seems like +build is the right way to do it. I can have two versions of the file:
somefile_linux.go which has // +build linux and also an import "C" and somefile_nonlinux.go which has // +build !linux and no importing of "C" In addition, I have file some_cfile.c However, I hit an issue that there is a hard check in the pkg.go which is throwing an error: // The gc toolchain only permits C source files with cgo. if len(p.CFiles) > 0 && !p.usesCgo() && !p.usesSwig() && buildContext.Compiler == "gc" { p.Error = &PackageError{ ImportStack: stk.copy(), Err: fmt.Sprintf("C source files not allowed when not using cgo or SWIG: %s", strings.Join(p.CFiles, " ")), } return p } Well if the go file being compiled doesnt need any c files, why is "gc" even trying to see the c files ? How do I achieve my intent ? Thanks, Satyam -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.