From 101a8981cbc0555cbdea2ddb9ea856be4bcf6a81 Mon Sep 17 00:00:00 2001 From: Awn Umar Date: Fri, 8 May 2026 17:31:16 +0100 Subject: [PATCH] Upgrade dependencies, run go fix --- core/buffer.go | 9 ++------- core/exit.go | 2 +- examples/deadlock/x01/poc.go | 2 +- examples/stream/stream.go | 2 +- go.mod | 8 ++++---- go.sum | 6 ++++++ memguard.go | 2 +- signals_test.go | 1 - stream_test.go | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/core/buffer.go b/core/buffer.go index fd100299..040f1f26 100644 --- a/core/buffer.go +++ b/core/buffer.go @@ -2,6 +2,7 @@ package core import ( "errors" + "slices" "sync" "unsafe" @@ -302,13 +303,7 @@ func (l *bufferList) exists(b *Buffer) bool { l.RLock() defer l.RUnlock() - for _, v := range l.list { - if b == v { - return true - } - } - - return false + return slices.Contains(l.list, b) } // Flush clears the list and returns its previous contents. diff --git a/core/exit.go b/core/exit.go index eb29ef16..35197557 100644 --- a/core/exit.go +++ b/core/exit.go @@ -81,7 +81,7 @@ func Exit(c int) { /* Panic is identical to the builtin panic except it purges the session before calling panic. */ -func Panic(v interface{}) { +func Panic(v any) { Purge() // creates a new key so it is safe to recover from this panic panic(v) } diff --git a/examples/deadlock/x01/poc.go b/examples/deadlock/x01/poc.go index c82275e9..99b12843 100644 --- a/examples/deadlock/x01/poc.go +++ b/examples/deadlock/x01/poc.go @@ -28,7 +28,7 @@ func OpenEnclave(ctx context.Context) { } threads := 20 - for i := 0; i < threads; i++ { + for range threads { go func(ctx context.Context) { for { select { diff --git a/examples/stream/stream.go b/examples/stream/stream.go index 294cfc7f..d7c301e9 100644 --- a/examples/stream/stream.go +++ b/examples/stream/stream.go @@ -54,7 +54,7 @@ func SlowRandByte() byte { } // Do some example computation on this data. - for i := 0; i < n; i++ { + for i := range n { parity = parity ^ buf.Bytes()[i] } } diff --git a/go.mod b/go.mod index 4f36358d..97b4cba7 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/awnumar/memguard -go 1.23.1 +go 1.25.0 require ( - github.com/awnumar/memcall v0.4.0 - golang.org/x/crypto v0.41.0 - golang.org/x/sys v0.35.0 + github.com/awnumar/memcall v0.5.0 + golang.org/x/crypto v0.50.0 + golang.org/x/sys v0.44.0 lukechampine.com/frand v1.5.1 ) diff --git a/go.sum b/go.sum index bfddea75..7d4447c0 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,14 @@ github.com/awnumar/memcall v0.4.0 h1:B7hgZYdfH6Ot1Goaz8jGne/7i8xD4taZie/PNSFZ29g= github.com/awnumar/memcall v0.4.0/go.mod h1:8xOx1YbfyuCg3Fy6TO8DK0kZUua3V42/goA5Ru47E8w= +github.com/awnumar/memcall v0.5.0 h1:31zYqzH08fM1UBzr53ywXFvqVP4grhAIFFd1Pfd7Gtk= +github.com/awnumar/memcall v0.5.0/go.mod h1:5q5zKsL4XfYgqzCQEvUt9Dou4fEXWsn+tNrm1z1oYgQ= golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= +golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= +golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ= +golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= lukechampine.com/frand v1.5.1 h1:fg0eRtdmGFIxhP5zQJzM1lFDbD6CUfu/f+7WgAZd5/w= lukechampine.com/frand v1.5.1/go.mod h1:4VstaWc2plN4Mjr10chUD46RAVGWhpkZ5Nja8+Azp0Q= diff --git a/memguard.go b/memguard.go index 32182194..d348d717 100644 --- a/memguard.go +++ b/memguard.go @@ -32,7 +32,7 @@ func Purge() { /* SafePanic wipes all it can before calling panic(v). */ -func SafePanic(v interface{}) { +func SafePanic(v any) { core.Panic(v) } diff --git a/signals_test.go b/signals_test.go index b31f75c3..4b6ca0fc 100644 --- a/signals_test.go +++ b/signals_test.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package memguard diff --git a/stream_test.go b/stream_test.go index 4f2d3abf..3c7712a4 100644 --- a/stream_test.go +++ b/stream_test.go @@ -100,7 +100,7 @@ func TestStreamReadWrite(t *testing.T) { write(t, s, b) // Read back four pages - for i := 0; i < 4; i++ { + for i := range 4 { read(t, s, ref[i*os.Getpagesize():(i+1)*os.Getpagesize()], nil) }