Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Golang binding #22

Merged
merged 2 commits into from
Jan 23, 2020
Merged

Golang binding #22

merged 2 commits into from
Jan 23, 2020

Commits on Jan 22, 2020

  1. contrib: bindings: add go binding

    This binding is mainly inspired by python building.
    The public interface is built on the shoulders of `Root` and `Handle`
    structures, in a similar way as the original library does.
    These ones are straightforward wrappers of the C api to provide
    a safe and idiomatic interface.
    
    As for error handling it upholds the idea to copy all the data which is
    provided by ffi interface including backtrace.
    It copies it to an internal structure to not being bound
    by handling errors on place. Since golang does not has a
    standart way to manage stackraces it can be get by casting
    error to `pathrs.Error` type and call `Backtrace` method.
    
    This binding does not provide configuration interface of pathrs.
    
    Signed-off-by: Maxim Zhiburt <[email protected]>
    zhiburt committed Jan 22, 2020
    Configuration menu
    Copy the full SHA
    80d793c View commit details
    Browse the repository at this point in the history
  2. examples: create a golang 'cat' binding example

    This is a simple program to print the whole file to
    stdout using safe path resolution.
    And demonstrates safe handling errors and key functions
    such as `*Root`.Resolve, `*Handle`.Open.
    
    To start this program was set a pile of env variables:
    `CGO_LDFLAGS`, `CGO_CFLAGS` and `LD_LIBRARY_PATH`.
    
    Signed-off-by: Maxim Zhiburt <[email protected]>
    zhiburt committed Jan 22, 2020
    Configuration menu
    Copy the full SHA
    e6737f8 View commit details
    Browse the repository at this point in the history