Line 21: |
Line 21: |
| * Boolean to generate indented and multi-line JSON output | | * Boolean to generate indented and multi-line JSON output |
| * Boolean to skip payload data | | * Boolean to skip payload data |
− |
| |
− | <syntaxhighlight lang="go">
| |
− | c := crit.New(
| |
− | "inventory.img", /* input path */
| |
− | "", /* output path */
| |
− | "", /* input dir path (for Explore*()) */
| |
− | false, /* indenting for JSON */
| |
− | false, /* no payload */
| |
− | )
| |
− | </syntaxhighlight>
| |
| | | |
| The below operations are provided by the service. | | The below operations are provided by the service. |
| | | |
− | <syntaxhighlight lang="go"> | + | <pre> |
− | Decode() (*CriuImage, error)
| + | Decode() (*CriuImage, error) |
− | Info() (*CriuImage, error)
| + | Info() (*CriuImage, error) |
− | Parse() (*CriuImage, error)
| + | Parse() (*CriuImage, error) |
− | Encode(*CriuImage) error
| + | Encode(*CriuImage) error |
− | ExplorePs() (*PsTree, error)
| + | ExplorePs() (*PsTree, error) |
− | ExploreFds() ([]*Fd, error)
| + | ExploreFds() ([]*Fd, error) |
− | ExploreMems() ([]*MemMap, error)
| + | ExploreMems() ([]*MemMap, error) |
− | ExploreRss() ([]*RssMap, error)
| + | ExploreRss() ([]*RssMap, error) |
− | </syntaxhighlight> | + | </pre> |
| | | |
| Documentation about the types and methods provided by the library can be found [https://pkg.go.dev/github.com/checkpoint-restore/go-criu/v5/crit here]. | | Documentation about the types and methods provided by the library can be found [https://pkg.go.dev/github.com/checkpoint-restore/go-criu/v5/crit here]. |
Line 52: |
Line 42: |
| | | |
| '''example.go''' | | '''example.go''' |
− | <syntaxhighlight lang="go"> | + | <pre> |
| package main | | package main |
| | | |
Line 77: |
Line 67: |
| fmt.Println("Image version is ", imgVersion) | | fmt.Println("Image version is ", imgVersion) |
| } | | } |
− | </syntaxhighlight> | + | </pre> |
| | | |
| == Difference between Go and Python CLI == | | == Difference between Go and Python CLI == |
| * The Go CLI uses JSON as the standard output format for all commands, whereas the Python CLI uses custom formats for <code>crit explore</code>. This results in different outputs for the same command, although the content remains the same. | | * The Go CLI uses JSON as the standard output format for all commands, whereas the Python CLI uses custom formats for <code>crit explore</code>. This results in different outputs for the same command, although the content remains the same. |
− | * The Go JSON output uses camelCased field names, whereas the Python CLI JSON output uses snake_case field names. | + | * The Go JSON output uses <code>camelCased</code> field names, whereas the Python CLI JSON output uses <code>snake_case</code> field names. |
| | | |
| [[Category: Images]] | | [[Category: Images]] |
| [[Category: API]] | | [[Category: API]] |
| [[Category: Go]] | | [[Category: Go]] |