unsafec

package
v0.0.0-...-f5c3557 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package unsafec makes unsafe even more unsafe.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(s string) []byte

Bytes is the opposite String. This is unsafe as it leaves a string mutable. Don't not, under any circumstances, modify the returned byte slice. Seriously, if you do, unicorns will die, kittens will commit suicide, and puppies will maul you.

func String

func String(b []byte) string

String turns a byte slice into a string. This is unsafe as it leaves a string mutable. Don't use this if you will EVER modify the underlying byte slice.

From: https://github.com/golang/go/issues/2632#issuecomment-66061057

As bradfitz says, "As a medium-term hack, I showed they could do... But I felt bad even pointing that out."

Until golang can optimize this case, sadness everywhere.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL