structstringer

command module
v0.0.0-...-9bee9ae Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: MIT Imports: 6 Imported by: 0

README

Go Report Card github action

structstringer - generator of stringer interface for structs

One example (more in examples folder):

package simple

type A struct {
	i    int
	flag bool
	b    B
}

type B struct {
	i    int
	flag bool
}

// generated stringer
simple.A{
	i    int      42
	flag bool     true
	b    simple.B {
		i    int  43
		flag bool false
	}
}

// %#v formater
simple.A{i:42, flag:true, b:simple.B{i:43, flag:false}}

BenchmarkRecursiveAString-4   	1000000000	         0.000780 ns/op	       0 B/op	       0 allocs/op
BenchmarkRecursiveAfmt-4      	1000000000	         0.00186 ns/op	       0 B/op	       0 allocs/op

TODO:

  • [v] basic types in POD struct
  • [v] struct fields
  • [v] struct from other package field
  • pointers
  • enums
  • aliases
  • interfaces
  • slices and maps
  • unexported fields

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
examples
recursive
Code generated by structstringer DO NOT EDIT! Code generated by structstringer DO NOT EDIT! Code generated by structstringer DO NOT EDIT!
Code generated by structstringer DO NOT EDIT! Code generated by structstringer DO NOT EDIT! Code generated by structstringer DO NOT EDIT!
simple
Code generated by structstringer DO NOT EDIT!
Code generated by structstringer DO NOT EDIT!
internal
declaration
find declaration of the type
find declaration of the type
extractor
create field.Fields from type declaration
create field.Fields from type declaration
field
stringer of the fields for generator
stringer of the fields for generator
generator
main logic
main logic
packinfo
get package info
get package info
printer
print to file template
print to file template
saver
format source and save to file
format source and save to file

Jump to

Keyboard shortcuts

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