unsafe

command module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: ISC Imports: 17 Imported by: 0

README

unsafe

CI Go Report Card

--

Package unsafe is a program that localises a type from another package allowing the access to unexported fields.

Highlights

  • Generates local copy of third-party type and a function to convert to it.
  • Optionally adds go:generate comment to allow easy regeneration.

Usage

go run vimagination.zapto.org/unsafe@latest -o OUTPUT.go [-p PACKAGE_NAME] [-x] package.type [packge.type...]

At a minimum, the executable needs to be provided with an output file, via the -o flag, and one or more types to localise.

In addition, you can supply the -x flag to exclude the go:generate header comment, and can provide the -p flag to override the package name.

The following is an example command:

go run vimagination.zapto.org/unsafe@latest -o test/a_test.go -p a_test vimagination.zapto.org/cache.LRU

After the first time, assuming that the -x flag wasn't provided, the go generate command can be used to regenerate and update the output file.

Documentation

Overview

Package unsafe is a program that localises a type from another package.

Jump to

Keyboard shortcuts

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