From eedf9578a61d44b09803b33c0be1df5293d919cf Mon Sep 17 00:00:00 2001 From: Carlos A Becker Date: Thu, 24 Nov 2022 18:17:46 -0300 Subject: [PATCH] docs: clarify cgo Signed-off-by: Carlos A Becker --- www/docs/cookbooks/cgo-and-crosscompiling.md | 16 +++++++++++++--- www/docs/limitations/cgo.md | 12 ++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/www/docs/cookbooks/cgo-and-crosscompiling.md b/www/docs/cookbooks/cgo-and-crosscompiling.md index 6ab619491e1..1817cf4e718 100644 --- a/www/docs/cookbooks/cgo-and-crosscompiling.md +++ b/www/docs/cookbooks/cgo-and-crosscompiling.md @@ -1,5 +1,15 @@ # Cross-compiling Go with CGO -Best option to cross-compile Go project with CGO dependencies would be in using Docker image. -[This project](https://github.com/goreleaser/goreleaser-cross) provides the docker [images](https://hub.docker.com/repository/docker/goreleaser/goreleaser-cross) with bunch of ready to use cross-compilers as well as how-to make sysroot. -All that wrapped into [example](https://github.com/goreleaser/goreleaser-cross-example) +The best option to cross-compile Go project with CGO dependencies would be in +using Docker image. +[This project](https://github.com/goreleaser/goreleaser-cross) provides the +[Docker images](https://hub.docker.com/repository/docker/goreleaser/goreleaser-cross) +with a bunch of ready-to-use cross-compilers as well as how-to make a `sysroot`. +All that wrapped into [this example](https://github.com/goreleaser/goreleaser-cross-example) + +If you have [GoReleaser Pro](/pro), you can also use the split and merge feature +to build for each platform natively and merge the builds later. +Check [this article][1] for an example, and the [documentation here][2]. + +[1]: https://carlosbecker.com/posts/goreleaser-split-merge/ +[2]: /customization/partial diff --git a/www/docs/limitations/cgo.md b/www/docs/limitations/cgo.md index a210636244d..28af1eeedae 100644 --- a/www/docs/limitations/cgo.md +++ b/www/docs/limitations/cgo.md @@ -1,11 +1,11 @@ # CGO -If you need to cross-compile with CGO enabled, our Docker image is not -supported, and your configuration will not look that "clean", unfortunately. +Compiling with CGO is a bit trickier. +It won't work "out of the box" with or without GoReleaser: you have to set more +things up. -You can check [this cookbook](/cookbooks/cgo-and-crosscompiling/) for an -example. +[This cookbook](/cookbooks/cgo-and-crosscompiling/) contains more information. -You can also see the discussion about CGO in -[this issue](https://github.com/goreleaser/goreleaser/issues/708). +Tools like `xgo` are not natively supported, and we make no promises about +whether or how well they work withing GoReleaser or not.