Felix Lange
90983d99de
apply slice, map pointer wrapping to named types only
7 years ago
Felix Lange
cd4d995e32
use pointer-wrapping for slices and maps
...
This is important because named slice types might have a custom decoder
that doesn't allow null.
7 years ago
Felix Lange
55422dcc4d
add fake uses of the override type to prevent dead code
8 years ago
Felix Lange
df2bde176a
disable pointer-wrapping of interface fields
8 years ago
Felix Lange
bab2d3046d
fix crash for fields of built-in type
8 years ago
Felix Lange
8b5010f571
use a temp variable for loop conversions on function calls
...
This avoids calling the function more than once.
8 years ago
Bas van Kervel
f1b18f569a
add support for mapping to functions in override type
8 years ago
Felix Lange
cbfa5be5a8
remove outdated documentation in README
8 years ago
Felix Lange
fba4187079
remove `optional:"true"` tag, add `gencodec:"required"` in its place
...
Declaring fields optional gets annoying pretty quickly, especially for
big configuration structs.
8 years ago
Felix Lange
dc5291c62a
update test files to match the previous commit
8 years ago
Felix Lange
1c8a99a71b
Name the intermediate marshaling type exactly like the original type
...
The type name shows up in error messages and it's nicer to have the
original struct name there.
8 years ago
Felix Lange
faf3ce92a4
don't reset all fields in Unmarshal*
...
This preserves decoding into a struct with pre-filled, possibly
unexported fields.
8 years ago
Felix Lange
b2a8c619f3
add support for github.com/naoina/toml
8 years ago
Felix Lange
1a75a21610
remove superfluous nil check for simple slices, maps conversions
8 years ago
Felix Lange
8c7f4ae1e5
disable field type pointer-wrapping for Marshal*
...
This makes the ,omitempty tag work correctly.
8 years ago
Felix Lange
50a5fcc22f
implement "DO NOT EDIT" comment convention
...
See https://github.com/golang/go/issues/13560 for details.
8 years ago
Felix Lange
75f278cf92
use non-pointer receiver for Marshal* methods
8 years ago
Felix Lange
72fbea27b0
preserve nil maps and slices in generated Marshal* methods
8 years ago
Felix Lange
9f20d19e75
fix small nits in godoc
8 years ago
Felix Lange
ee3195a59d
add full tool import path to generated comment
8 years ago
Felix Lange
71af48c00f
add quotes around field name in required field error
8 years ago
Felix Lange
2bc71e15d7
fix go vet nits
8 years ago
Felix Lange
788895d3d8
recognize named map and slice types
8 years ago
Felix Lange
1fd1f70537
fix bug where package name suffix increased with every use
8 years ago
Felix Lange
c180464f1d
improve generated code
...
* remove weird temporaries for pointer conversions
* use key, value instead of accessing map/slice values via indexing
* make generated MarshalYAML compile
* fix bug where errCheck didn't check errors 🤦
8 years ago
Felix Lange
ce9e87e161
add missing BUG: in panic calls
8 years ago
Felix Lange
265175060b
fix a godoc nit
8 years ago
Felix Lange
0b6d9f67f2
add -formats flag
8 years ago
Felix Lange
0cac4e4994
explain use of goimports better
8 years ago
Felix Lange
837142166a
use go/loader to load type-checked packages
...
This makes it work even if dependency packages are not installed yet.
8 years ago
Felix Lange
5b3e75f776
add support for map/slice conversions, tests
8 years ago
Felix Lange
e94794fd37
fix documentation typos
8 years ago
Felix Lange
627ec9333a
initial commit
8 years ago