| --- |
| title: InvalidUnsafeString |
| layout: article |
| --- |
| <!-- Copyright 2023 The Go Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style |
| license that can be found in the LICENSE file. --> |
| |
| <!-- Code generated by generrordocs.go; DO NOT EDIT. --> |
| |
| ``` |
| InvalidUnsafeString occurs when unsafe.String is called with |
| a length argument that is not of integer type, negative, or |
| out of bounds. It also occurs if it is used in a package |
| compiled for a language version before go1.20. |
| |
| Example: |
| import "unsafe" |
| |
| var b [10]byte |
| var _ = unsafe.String(&b[0], -1) |
| ``` |
| |