We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5e655d8 commit 53e32e8Copy full SHA for 53e32e8
go.mod
@@ -14,4 +14,4 @@ require (
14
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
15
)
16
17
-go 1.19
+go 1.20
string_bytes.go
@@ -2,21 +2,7 @@ package swag
2
3
import "unsafe"
4
5
-type internalString struct {
6
- Data unsafe.Pointer
7
- Len int
8
-}
9
-
10
// hackStringBytes returns the (unsafe) underlying bytes slice of a string.
11
-func hackStringBytes(str string) []byte {
12
- p := (*internalString)(unsafe.Pointer(&str)).Data
13
- return unsafe.Slice((*byte)(p), len(str))
-/*
- * go1.20 version (for when go mod moves to a go1.20 requirement):
18
19
func hackStringBytes(str string) []byte {
20
return unsafe.Slice(unsafe.StringData(str), len(str))
21
}
22
-*/
0 commit comments