Skip to content
Merged
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
69 changes: 0 additions & 69 deletions .cirrus.yml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Build
run: |
go version
go get ./...
go build -race -v ./...
- name: Test
run: go test -race -v ./...
- name: Bench
run: go test -run=XXX -bench=. ./...

macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Build
run: |
go version
go get ./...
go build -race -v ./...
- name: Test
run: go test -race -v ./...
- name: Bench
run: go test -run=XXX -bench=. ./...

windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Install MinGW (for gcc)
run: choco install -y mingw
- name: Build
run: |
go version
go get ./...
$env:CGO_ENABLED=1; go build -race -v ./...
- name: Test
run: |
$env:CGO_ENABLED=1; go test -race -v ./...
- name: Bench
run: go test -run=XXX -bench=. ./...
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/awnumar/memcall

go 1.18
go 1.23.0

require golang.org/x/sys v0.20.0
require golang.org/x/sys v0.35.0
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
6 changes: 0 additions & 6 deletions memcall.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package memcall

import (
"reflect"
"runtime"
"unsafe"
)
Expand Down Expand Up @@ -56,8 +55,3 @@ func _getStartPtr(b []byte) unsafe.Pointer {
func _getPtr(b []byte) uintptr {
return uintptr(_getStartPtr(b))
}

func _getBytes(ptr uintptr, len int, cap int) []byte {
var sl = reflect.SliceHeader{Data: ptr, Len: len, Cap: cap}
return *(*[]byte)(unsafe.Pointer(&sl))
}
1 change: 1 addition & 0 deletions memcall_solaris.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//go:build solaris

package memcall

import (
Expand Down
3 changes: 2 additions & 1 deletion memcall_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package memcall
import (
"errors"
"fmt"
"unsafe"

"golang.org/x/sys/windows"
)
Expand Down Expand Up @@ -36,7 +37,7 @@ func Alloc(n int) ([]byte, error) {
}

// Convert this pointer to a slice.
b := _getBytes(ptr, n, n)
b := unsafe.Slice((*byte)(unsafe.Pointer(ptr)), n)

// Wipe it just in case there is some remnant data.
wipe(b)
Expand Down
Loading