recursiveprint: 4d63.com/recursiveprint Index | Examples | Files

package recursiveprint

import "4d63.com/recursiveprint"

Index

Examples

Package Files

recursiveprint.go

func Write Uses

func Write(w io.Writer, v interface{})

Code:

package main

import (
    "os"
)

func main() {
    type A struct {
        I1  int
        I2  int
        I3  *int
        M1  map[string]string
    }
    type B struct {
        A1  []bool
        A2  []*string
        A3  []interface{}
    }
    type C struct {
        A   A
        B   *B
        S1  string
        S2  *string
    }

    a := C{
        A: A{
            I1: 5,
            I2: 99,
            M1: map[string]string{
                "One": "1",
                "Two": "2",
            },
        },
        B: &B{
            A1: []bool{true, false, false, true},
            A2: []*string{nil, strptr("hi")},
            A3: []interface{}{nil, "hello", strptr("world"), A{}},
        },
        S1: "hello world",
    }

    Write(os.Stdout, a)

}

func strptr(s string) *string {
    return &s
}

Package recursiveprint imports 4 packages (graph). Updated 2019-08-21. Refresh now. Tools for package owners.