Skip to content

Commit c1e2026

Browse files
committed
add actions/setup-go to workflow
Signed-off-by: Joel Dice <[email protected]>
1 parent 7f48df4 commit c1e2026

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ jobs:
8585
dotnet-version: '9.x'
8686
if: matrix.lang == 'csharp'
8787

88+
- name: Setup Go
89+
uses: actions/setup-go@v5
90+
with:
91+
go-version: 1.25.4
92+
if: matrix.lang == 'go'
93+
8894
# Hacky work-around for https://github.com/dotnet/runtime/issues/80619
8995
- run: dotnet new console -o /tmp/foo
9096
if: matrix.os != 'windows-latest' && matrix.lang == 'csharp'

crates/go/src/wit_runtime.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ import (
66
"unsafe"
77
)
88

9+
type Handle struct {
10+
value int32
11+
}
12+
13+
func (self *Handle) Use() int32 {
14+
if self.value == 0 {
15+
panic("nil handle")
16+
}
17+
return self.value
18+
}
19+
20+
func (self *Handle) Take() int32 {
21+
value := self.value
22+
self.value = 0
23+
return value
24+
}
25+
926
func Allocate(pinner *runtime.Pinner, size, align uintptr) unsafe.Pointer {
1027
pointer := allocateRaw(size, align)
1128
pinner.Pin(pointer)

0 commit comments

Comments
 (0)