26 Commits

Author SHA1 Message Date
Nicolas S. Dade 89250dbfdd Support for json:",omitzero" tag (#429)
* add support for the json:",omitzero" tag

omitzero was added to the go stdlib encoder/json in go 1.24

* add case which omitempty missed: uintptr is encodable in json

and does accept omitempty in the go stdlib encoder/json.

* add omitzero test cases for pointer-to-"" and pointer-to-{}

(both should marshal to something in order to match stdlib json, and
they do)

* fix and add tests for the case when omitzero is combined with omitempty

Without a special case the generated code can look like

   if v != nil && v != nil {
or
   if v != "" && v != "" {

and that gets flagged by go vet (go 1.25.5)
2026-03-14 17:51:56 +03:00
Niall Newman 34d2f3ad1a Only add tags to run command if set 2024-01-28 19:13:32 +00:00
Max 8ba3c7bdce Added logic to pass build flags when running the generator (#290)
* Added logic to pass build flags when running the generator while bootstrapping

* fixed parsing build args for differenct cases

* cleanup code
2020-05-24 13:40:11 +03:00
Kirill Korotaev 9a01c9afdb Add new -disable_members_unescape option to avoid unescaping of member names, ints, ...
Improves performance for about 15% on BenchmarkEJ_Unmarshal_M-8
2020-04-11 19:11:39 +03:00
GoWebProd f93cc0b288 fix bootstrap 2020-03-30 23:48:27 +03:00
GoWebProd 7db1436caf Merge branch 'master' into master 2020-03-30 23:46:53 +03:00
Kenneth Shaw 3b3f3665d3 Convert exec.Command for gofmt to standard go/format package
Converts exec.Command call for formatting the generated Go code from the
bootstrapper to use the standard `go/format` package for formatting.

Fixes an issue / problem that the `cdproto-gen` tool is encountering.
2019-10-03 08:15:46 +07:00
Sayan Nandan f9215f98e1 Fix a little typo 2019-02-20 17:47:27 +05:30
Aleksandr Zelenin f4d3cd0fd0 relative paths fix 2018-08-23 05:35:26 +03:00
Aleksandr Zelenin e0ec68febc go modules support 2018-08-23 03:47:26 +03:00
Aleksandr Petrukhin c63cf99c78 [Generator] implement DisallowUnknownFields from go 1.10 2018-05-29 16:19:21 +00:00
Alexandr Kozlenkov 8008ddf9ab added tag for generate slice byte instead of Base64Bytes 2017-11-22 21:11:58 +03:00
Brad Reed 0ff8e2bbb1 Use lower camel case in code 2017-06-18 20:41:21 +01:00
Brad Reed 60b8bcfe44 Add lower camel case 2017-06-18 20:24:19 +01:00
Kenneth Shaw e1682275f9 Changing to fixed ordering for generator when multiple types in single file 2017-02-14 15:28:23 +07:00
Vadim Petrov 2b7d5bf368 Fix generating valid files with no types to marshal/unmarshal in file 2016-07-13 18:17:55 +03:00
hjusforgues ff14d442c9 Remove pointer-receivers for Marshalling func in bootstrap file 2016-07-13 13:50:58 +07:00
Victor Starodub 7b35f91cec Closes #21: File-unique auxiliary function names. 2016-04-25 02:11:43 +03:00
Connor Peet 6a66ca1770 Add support for Windows paths, fix file handling errors for Windows 2016-04-13 17:27:56 -04:00
Caleb Spare f05a38d34b Put bootstrap file alongside target file
This is necessary if the target file is inside an internal package
(otherwise the bootstrap file cannot be built).
2016-04-07 15:05:47 -07:00
Victor Starodub 2c16fcd215 Fixes #6: Support marshallers for unexported types. 2016-03-30 15:55:25 +03:00
Victor Starodub 57a7965db5 Closes #3: Output is formatted w/gofmt by default. Added comment lines to generated files. 2016-03-25 13:36:51 +03:00
Victor Starodub 732107e356 Fixes #2: create temporary output file in the same dir as final output. 2016-03-25 12:59:52 +03:00
Victor Starodub 4534d5e7c5 Fixed stub generation: correct interface is used for unmarshalling. 2016-03-05 01:13:13 +10:00
Victor Starodub 04b6211116 Standard encoding/json marshaller interface support. 2016-03-04 23:27:56 +10:00