mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-31 01:59:39 -05:00
Bumps [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) from 1.6.0 to 1.8.0. - [Release notes](https://github.com/open-policy-agent/opa/releases) - [Changelog](https://github.com/open-policy-agent/opa/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-policy-agent/opa/compare/v1.6.0...v1.8.0) --- updated-dependencies: - dependency-name: github.com/open-policy-agent/opa dependency-version: 1.8.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
31 lines
520 B
Go
31 lines
520 B
Go
package fastjson
|
|
|
|
import (
|
|
"reflect"
|
|
"unsafe"
|
|
)
|
|
|
|
func b2s(b []byte) string {
|
|
return *(*string)(unsafe.Pointer(&b))
|
|
}
|
|
|
|
func s2b(s string) (b []byte) {
|
|
strh := (*reflect.StringHeader)(unsafe.Pointer(&s))
|
|
sh := (*reflect.SliceHeader)(unsafe.Pointer(&b))
|
|
sh.Data = strh.Data
|
|
sh.Len = strh.Len
|
|
sh.Cap = strh.Len
|
|
return b
|
|
}
|
|
|
|
const maxStartEndStringLen = 80
|
|
|
|
func startEndString(s string) string {
|
|
if len(s) <= maxStartEndStringLen {
|
|
return s
|
|
}
|
|
start := s[:40]
|
|
end := s[len(s)-40:]
|
|
return start + "..." + end
|
|
}
|