gobuild 0.1.0-alpha.2

A build-time dependency for Cargo build scripts to invoke the go compiler to compile go code into a static archive/dynamic library to be linked into Rust code.
Documentation
  • Coverage
  • 100%
    18 out of 18 items documented1 out of 16 items with examples
  • Size
  • Source code size: 18.89 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.23 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • myagley/gobuild
    16 15 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • myagley

gobuild

A library to compile go code into a Rust library/application. This library takes inspiration from the cc crate.

Using gobuild

First, you'll want to both add a build script for your crate (build.rs) and also add this crate to your Cargo.toml via:

[build-dependencies]
gobuild = "0.1.0-alpha.1"

Next, update the build.rs to something like:

// build.rs

fn main() {
    gobuild::Build::new()
        .file("hello.go")
        .compile("hello");
}

This will produce a libhello.h and libhello.a in OUT_DIR.