c-kzg-4844/bindings/go
Justin Traglia c448e9bfcc
Fix minor memleak in Go bindings (#241)
* Fix minor memleak in Go bindings

* Move fclose back to after nil check

* Move it to correct spot, ugh
2023-03-24 22:50:15 +09:00
..
blst_headers Add go bindings (#77) 2023-01-26 17:04:24 +00:00
example Add example for go bindings (#238) 2023-03-22 12:28:42 +02:00
README.md Add example for go bindings (#238) 2023-03-22 12:28:42 +02:00
main.go Fix minor memleak in Go bindings (#241) 2023-03-24 22:50:15 +09:00
main_test.go Add ref test count checks for all bindings (#211) 2023-03-15 16:39:19 +02:00

README.md

cgo-kzg-4844

This package implements Go bindings (using Cgo) for the exported functions in C-KZG-4844.

Installation

go get github.com/ethereum/c-kzg-4844

Go version

This package requires 1.19rc1 or later. Version 1.19beta1 and before will not work. These versions have a linking issue and are unable to see blst functions.

Example

For reference, see the example module in this directory. You can test it out with go run:

user@system ~/c-kzg-4844/bindings/go/example $ go run .
go: downloading github.com/ethereum/c-kzg-4844 v0.0.0-20230321204456-577d146c0a5a
go: downloading github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2
88f1aea383b825371cb98acfbae6c81cce601a2e3129461c3c2b816409af8f3e5080db165fd327db687b3ed632153a62

Tests

Run the tests with this command:

go test

Benchmarks

Run the benchmarks with this command:

go test -bench=Benchmark

Note

The go.mod and go.sum files are in the project's root directory because the bindings need access to the c-kzg-4844 source, but Go cannot reference files outside its module/package. The best way to deal with this is to make the whole project available, that way everything is accessible.