Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ungerik/pkgreflect
A Go preprocessor for package scoped reflection
https://github.com/ungerik/pkgreflect
Last synced: 4 days ago
JSON representation
A Go preprocessor for package scoped reflection
- Host: GitHub
- URL: https://github.com/ungerik/pkgreflect
- Owner: ungerik
- License: mit
- Created: 2012-09-03T07:53:00.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2017-09-05T12:27:27.000Z (about 7 years ago)
- Last Synced: 2024-08-01T22:51:59.974Z (3 months ago)
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 105
- Watchers: 7
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - pkgreflect - A Go preprocessor for package scoped reflection - ★ 71 (Generation and Generics)
README
## pkgreflect - A Go preprocessor for package scoped reflection
Problem: Go reflection does not support enumerating types, variables and functions of packages.
pkgreflect generates a file named pkgreflect.go in every parsed package directory.
This file contains the following maps of exported names to reflection types/values:var Types = map[string]reflect.Type{ ... }
var Functions = map[string]reflect.Value{ ... }
var Variables = map[string]reflect.Value{ ... }
var Consts = map[string]reflect.Value{ ... }Command line usage:
pkgreflect --help
pkgreflect [-notypes][-nofuncs][-novars][-noconsts][-unexported][-norecurs][-gofile=filename.go] [DIR_NAME]If -norecurs is not set, then pkgreflect traverses recursively into sub-directories.
If no DIR_NAME is given, then the current directory is used as root.