-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* tests: add case for looping structure (stack overflow) * Add tracking for already seen structs Fixes #8 Co-authored-by: Lucas Bremgartner <lucas@bremis.ch>
- Loading branch information
Showing
3 changed files
with
37 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package example | ||
|
||
import ( | ||
"encoding/json" | ||
) | ||
|
||
type entry struct { | ||
Name string `json:"name"` | ||
Fields schema `json:"fields"` | ||
} | ||
|
||
type schema []entry | ||
|
||
// JSONMarshalStructWithLoop contains a struct with a loop. | ||
func JSONMarshalStructWithLoop() { | ||
var structWithLoop schema | ||
_, _ = json.Marshal(structWithLoop) | ||
} |