Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
cbcbd86
feat: update libdave + prebuilt library
davfsa Jan 18, 2026
c3735b2
chore: cleanup scripts
davfsa Jan 18, 2026
f7d377a
fix: multiple fixes
davfsa Jan 20, 2026
bed94ce
feat: add CI
davfsa Jan 20, 2026
afd9e4d
fix: path for go build
davfsa Jan 20, 2026
d67f2f8
feat: improve ux for adding required fields to .bashrc
davfsa Jan 20, 2026
7eb2707
fix: yes broken pipe in CI
davfsa Jan 20, 2026
b17601a
fix: attempt 2
davfsa Jan 20, 2026
662a823
feat: add non interactive installation
davfsa Jan 20, 2026
cda4f64
feat: setup missing go.work
davfsa Jan 20, 2026
2c0fab3
fix: source bashrc when testing and install pkg-config on windows
davfsa Jan 20, 2026
fa46400
chore: cat .bashrc before sourcing
davfsa Jan 20, 2026
6c23c49
fix: properly export necessary variables
davfsa Jan 20, 2026
2be961b
feat: auto-detect NON_INTERACTIVE
davfsa Jan 20, 2026
396e13b
chore: print pkgconfig dir for debug
davfsa Jan 20, 2026
b0468d6
feat: include pre-built binaries
davfsa Jan 20, 2026
f6352ce
fix: properly call update script
davfsa Jan 20, 2026
92478d0
fix: windows libdave test
davfsa Jan 20, 2026
2b80c92
fix: windows libdave test
davfsa Jan 20, 2026
116a9a8
fix: test with static link
davfsa Jan 20, 2026
aaef756
fix: properly place libdave.lib in PATH
davfsa Jan 20, 2026
ff655fc
chore: test adding more build flags
davfsa Jan 20, 2026
f4c06d7
chore: test rename libdave.lib to libdave.a
davfsa Jan 20, 2026
d792c7f
chore: more testing
davfsa Jan 20, 2026
b971552
chore: more testing
davfsa Jan 20, 2026
1c6e7b7
chore: more testing
davfsa Jan 20, 2026
331bce6
chore: more testing
davfsa Jan 20, 2026
368803e
chore: more testing
davfsa Jan 20, 2026
9ef2014
chore: disable windows support for now
davfsa Jan 20, 2026
6bf233b
chore: add windows flags, but dont do anything with them
davfsa Jan 20, 2026
3872a34
feat: windows
davfsa Jan 20, 2026
e4fbd4d
fix: CI
davfsa Jan 20, 2026
bafae83
fix: correct header path
davfsa Jan 20, 2026
8c70491
chore: cleanup
davfsa Jan 20, 2026
c6312c1
chore: move libdave.dll to correct path
davfsa Jan 20, 2026
0bb430d
chore: delete vendor folder to test CI
davfsa Jan 20, 2026
1fda4d4
chore: add GH_TOKEN env variable
davfsa Jan 20, 2026
53944a0
fix: invoke proper script
davfsa Jan 20, 2026
5308209
fix: properly use GITHUB_OUTPUT (hopefully)
davfsa Jan 20, 2026
9b763f3
fix: set proper outputs
davfsa Jan 20, 2026
e2ac9d8
chore: update libdave to v1.1.0/cpp
github-actions[bot] Jan 20, 2026
b08eb76
fix: properly check for latest version
davfsa Jan 22, 2026
fb5d45e
chore: remove vendored package
davfsa Jan 22, 2026
0be383f
feat: add linux ARM support
davfsa Jan 22, 2026
07fc61e
chore: update libdave to v1.1.0/cpp (#3)
github-actions[bot] Jan 22, 2026
d4398c7
chore: switch back (again!) to install script
davfsa Jan 22, 2026
d087346
chore: fix CI
davfsa Jan 22, 2026
2f81843
chore: hardcode rpath
davfsa Jan 22, 2026
f774c0f
fix: powershell script
davfsa Jan 22, 2026
948177e
fix: set env vars on windows CI
davfsa Jan 22, 2026
b1018a4
chore: remove unnecessary workflow
davfsa Jan 22, 2026
1f03f86
fix: typo
davfsa Jan 22, 2026
6f8a1bd
fix: concatanation character on Windows
davfsa Jan 22, 2026
48a5772
fix: windows is stupid
davfsa Jan 22, 2026
d73d4d8
Update ci.yml
davfsa Jan 22, 2026
d710317
Update ci.yml
davfsa Jan 22, 2026
6154cec
Update scripts/libdave_install.sh
davfsa Jan 23, 2026
182d577
fix: use handler for authSessionID
davfsa Feb 11, 2026
9b0cabd
chore: docs
davfsa Feb 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
push:
pull_request:

defaults:
run:
shell: bash

env:
LIBDAVE_VERSION: v1.1.0

jobs:
libdave:
strategy:
matrix:
runner: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, macos-15-intel, windows-latest]
fail-fast: false

runs-on: ${{matrix.runner}}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.24

- name: Setup go.work
run: |
go work init . ./libdave ./golibdave

- name: "[Windows Only] Install pkgconfiglite"
if: runner.os == 'Windows'
run: choco install pkgconfiglite

- name: Install libdave
run: |
if [ "$RUNNER_OS" = "Windows" ]; then
pwsh ./scripts/libdave_install.ps1 "$LIBDAVE_VERSION"
echo "$LOCALAPPDATA/libdave/bin" >> "$GITHUB_PATH"
else
./scripts/libdave_install.sh "$LIBDAVE_VERSION"
fi

- name: Test libdave
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export PKG_CONFIG_PATH="$LOCALAPPDATA/pkgconfig;$PKG_CONFIG_PATH"
else
export PKG_CONFIG_PATH="$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH"
fi

go test ./libdave
199 changes: 0 additions & 199 deletions .github/workflows/update_libdave.yml

This file was deleted.

73 changes: 47 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,68 @@

# GoDave

GoDave is a library that provides Go bindings for [libdave](https://github.com/discord/libdave) and provides a generic DAVE interface allowing for different implementations in the future.
GoDave is a library that provides Go bindings for [libdave](https://github.com/discord/libdave) and provides a generic DAVE interface allowing for
different implementations in the future.

## Summary

1. [Libdave Installation](#libdave-installation)
2. [Installation Script (Recommended)](#installation-script-recommended)
3. [Manual Build](#manual-build)
4. [Example Usage](#example-usage)
5. [License](#license)
1. [Windows Installation](#windows-instructions)
2. [Installing manually](#manual-installation)
2. [Example Usage](#example-usage)
3. [License](#license)

## Libdave Installation

This library uses CGO and dynamic linking to use libdave. As such, it needs to be installed in the system beforehand
to build this library.
# FIXME: Needs rewriting

This library uses CGO and dynamic linking to use libdave. We automatically pull the latest libdave version and link
against the [shared libraries published by Discord](https://github.com/discord/libdave/releases).

We provide helpful scripts under [scripts/](https://github.com/disgoorg/godave/tree/master/scripts) to allow you to
download pre-built binaries of build them yourself, depending on your needs. Please audit them before executing!

> [!NOTE]
> Due to the nature of this project, it might be necessary to re-install libdave when updating to a new GoDave version.
>
> Versions requiring this will be denoted with a bump in the major version (for reference: major.minor.patch).
> The version that require this may be indicated with a minor bump (for reference: `mayor.minor.patch`).
>
> You can see what version is required by checking [this file](https://github.com/disgoorg/godave/tree/master/libdave/release.txt)

### Installation Script (Recommended)
### Linux/MacOS/WSL instructions

We provide helpful scripts in [scripts/](https://github.com/disgoorg/godave/tree/master/scripts) to simplify installing
a compatible libdave version. Grab whichever one is applicable to your OS (`.sh` for Linux and MacOS; `ps1` for
Windows PowerShell) and (after auditing its contents) run it and follow any instructions it might output.
Open a terminal and execute the following commands:

Once that step is complete, you can continue with the installation of GoDave.
```bash
# Set CC/CXX variables to change the compiler used (ie, for clang
#export CC=/usr/bin/clang CXX=/usr/bin/clang

### Manual Build
./libdave_install.sh v1.1.0
```

For a manual build, please clone https://github.com/discord/libdave and use revision
`74979cb33febf4ddef0c2b66e57520b339550c17`.
### MUSL Linux

> [!NOTE]
> We provide no guarantees for this version of GoDave to run for other revisions other than that the one mentioned above.
>
> As the library evolves and new versions of libdave are released, the above revision will be updated to match the
> GoDave version

Once checked out, please follow the
[build instructions](https://github.com/discord/libdave/tree/74979cb33febf4ddef0c2b66e57520b339550c17/cpp#building) and
setup the appropriate `pkg-config` file and configuration to allow for discovery at compilation time.
If you want to build a MUSL version of libdave, you can execute the following commands:

```bash
export VCPKG_FORCE_SYSTEM_BINARIES=1
export CC=/usr/bin/gcc CXX=/usr/bin/g++
export CXXFLAGS="-Wno-error=maybe-uninitialized"

# Install necessary packages
apk add build-base cmake ninja zip unzip curl git pkgconfig perl nams go

# FORCE_BUILD=1 as Discord do not provide pre-built binaries
FORCE_BUILD=1 ./libdave_install.sh v1.1.0
```

### Windows instructions

Open Powershell and execute the following commands:

```ps1
Set-ExecutionPolicy RemoteSigned –Scope Process
.\libdave_install.ps1 v1.1.0
```

## Example Usage

Expand Down
10 changes: 5 additions & 5 deletions libdave/commit_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ func newCommitResult(handle commitResultHandle) *CommitResult {
handle: handle,
}

runtime.AddCleanup(commitResult, func(handle commitResultHandle) {
C.daveCommitResultDestroy(handle)
}, commitResult.handle)
runtime.SetFinalizer(commitResult, func(c *CommitResult) {
C.daveCommitResultDestroy(c.handle)
})

return commitResult
}
Expand All @@ -37,7 +37,7 @@ func (r *CommitResult) GetRosterMemberIDs() []uint64 {
)
C.daveCommitResultGetRosterMemberIds(r.handle, &rosterIDs, &rosterIDsLength)

return newCUint64MemoryView(rosterIDs, rosterIDsLength)
return newUint64Slice(rosterIDs, rosterIDsLength)
}

func (r *CommitResult) GetRosterMemberSignature(rosterID uint64) []byte {
Expand All @@ -47,5 +47,5 @@ func (r *CommitResult) GetRosterMemberSignature(rosterID uint64) []byte {
)
C.daveCommitResultGetRosterMemberSignature(r.handle, C.uint64_t(rosterID), &rosterMemberSignature, &rosterMemberSignatureLength)

return newCBytesMemoryView(rosterMemberSignature, rosterMemberSignatureLength)
return newByteSlice(rosterMemberSignature, rosterMemberSignatureLength)
}
Loading