Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- run: sudo apt-get install -y libgpgme-dev
- uses: actions/setup-go@v3
with:
go-version: '1.17.12'
- run: go test -v ./...
go-version: '1.25.4'
- run: go test -v -v ./...

ubuntu-ppe64le:
runs-on: ubuntu-latest
Expand All @@ -32,14 +32,14 @@ jobs:
apt-get update -q -y
apt-get install -y libgpgme-dev golang
run: |
go test -v ./...
go test -v -v ./...

macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- run: brew install gpgme gnupg@1.4
- run: brew install gpgme gnupg
- uses: actions/setup-go@v3
with:
go-version: '1.17.12'
- run: go test -v ./...
go-version: '1.25.4'
- run: GPGME_DEBUG=9 go test -v -v ./...
4 changes: 4 additions & 0 deletions data.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"
"runtime"
"runtime/cgo"
"strings"
"unsafe"
)

Expand Down Expand Up @@ -45,6 +46,9 @@ func gogpgme_writefunc(handle, buffer unsafe.Pointer, size C.size_t) C.ssize_t {
d := h.Value().(*Data)
n, err := d.w.Write(unsafe.Slice((*byte)(buffer), size))
if err != nil && err != io.EOF {
if !strings.Contains(err.Error(), "a special error") {
panic("UNEXPECTED WRITE ERROR: " + err.Error())
}
d.err = err
C.gpgme_err_set_errno(C.EIO)
return -1
Expand Down
12 changes: 10 additions & 2 deletions gpgme_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@ func TestGetDirInfo(t *testing.T) {
}

func ctxWithCallback(t *testing.T) *Context {
ensureVersion(t, "1.", "can only set password callback for GPG v1.x")
//ensureVersion(t, "1.", "can only set password callback for GPG v1.x")

ctx, err := New()
checkError(t, err)
ctx.SetPinEntryMode(PinEntryLoopback)
checkError(t, err)

checkError(t, ctx.SetCallback(func(uid_hint string, prev_was_bad bool, f *os.File) error {
if prev_was_bad {
Expand Down Expand Up @@ -246,8 +248,14 @@ func TestContext_Verify(t *testing.T) {
ctx, err := New()
checkError(t, err)

_, err = ctx.GetKey("test@example.com", false)
key, err := ctx.GetKey("test@example.com", false)
checkError(t, err)
if key == nil {
t.Fatal("Expected key, got nil")
}
if key.Fingerprint() != "44B646DC347C31E867FF4F450327FFB0229F6136" {
t.Fatalf("Unexpected fingerprint %q", key.Fingerprint())
}

signed, err := NewDataBytes([]byte(testSignedText))
checkError(t, err)
Expand Down
Loading