summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/extra
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/uptrace/bun/extra')
-rw-r--r--vendor/github.com/uptrace/bun/extra/bunotel/README.md2
-rw-r--r--vendor/github.com/uptrace/bun/extra/bunotel/unsafe.go16
2 files changed, 10 insertions, 8 deletions
diff --git a/vendor/github.com/uptrace/bun/extra/bunotel/README.md b/vendor/github.com/uptrace/bun/extra/bunotel/README.md
index 50b3e6c48..1773ecf02 100644
--- a/vendor/github.com/uptrace/bun/extra/bunotel/README.md
+++ b/vendor/github.com/uptrace/bun/extra/bunotel/README.md
@@ -1,3 +1,3 @@
# OpenTelemetry instrumentation for Bun
-See [example](../example/opentelemetry) for details.
+See [example](../../example/opentelemetry) for details.
diff --git a/vendor/github.com/uptrace/bun/extra/bunotel/unsafe.go b/vendor/github.com/uptrace/bun/extra/bunotel/unsafe.go
index 23accd40e..67b687cbe 100644
--- a/vendor/github.com/uptrace/bun/extra/bunotel/unsafe.go
+++ b/vendor/github.com/uptrace/bun/extra/bunotel/unsafe.go
@@ -1,3 +1,4 @@
+//go:build !appengine
// +build !appengine
package bunotel
@@ -5,14 +6,15 @@ package bunotel
import "unsafe"
func bytesToString(b []byte) string {
- return *(*string)(unsafe.Pointer(&b))
+ if len(b) == 0 {
+ return ""
+ }
+ return unsafe.String(&b[0], len(b))
}
func stringToBytes(s string) []byte {
- return *(*[]byte)(unsafe.Pointer(
- &struct {
- string
- Cap int
- }{s, len(s)},
- ))
+ if s == "" {
+ return []byte{}
+ }
+ return unsafe.Slice(unsafe.StringData(s), len(s))
}