Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
package

GitHub Action

Golang CGO cross compiler

v2.3.0

Golang CGO cross compiler

package

Golang CGO cross compiler

GitHub Action for xgo, a Golang CGO cross compiler

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Golang CGO cross compiler

uses: crazy-max/[email protected]

Learn more about this action in crazy-max/ghaction-xgo

Choose a version

GitHub release GitHub marketplace Test workflow Codecov Become a sponsor Paypal Donate

About

A GitHub Action for xgo, a Golang CGO cross-compiler.


Usage

name: build

on:
  push:
  pull_request:

jobs:
  xgo:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Build
        uses: crazy-max/ghaction-xgo@v2
        with:
          xgo_version: latest
          go_version: 1.18
          dest: build
          prefix: myapp
          targets: windows/amd64,linux/amd64,linux/arm64,darwin/arm64
          v: true
          x: false
          race: false
          ldflags: -s -w
          buildmode: default
          trimpath: true

Customizing

inputs

Following inputs can be used as step.with keys

Name Type Default Description
xgo_version String latest xgo version (e.g., v0.3.2)
go_version String latest Go release to use for cross compilation from those docker tags (e.g., 1.17)
dest String build Destination folder to put binaries in
pkg String Sub-package to build if not root import
prefix String package name Prefix to use for output naming
targets String */* Comma separated targets to build for (e.g. windows/amd64,linux/386)
v Bool false Prints the names of packages as they are compiled
x Bool false Prints the build commands as compilation progresses
race Bool false Enable data race detection
tags String Comma separated list of build tags to consider satisfied during the build
ldflags String Arguments to pass on each go tool link invocation
buildmode String default Indicates which kind of object file to build
buildvcs String Whether to stamp binaries with version control information
trimpath Bool false Remove all file system paths from the resulting executable
working_dir String $GITHUB_WORKSPACE Working directory

Limitation

This action is only available for Linux virtual environments.

Contributing

Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. If you want to open a pull request, please read the contributing guidelines.

You can also support this project by becoming a sponsor on GitHub or by making a Paypal donation to ensure this journey continues indefinitely!

Thanks again for your support, it is much appreciated! 🙏

License

MIT. See LICENSE for more details.