k0kubun/pp

test failed if Golang over 1.4

walf443 opened this issue · 5 comments

It seems to crash on printer_test.go line 82:

    checkCases = []interface{}{
        map[string]int{"hell": 23, "world": 34},
        map[string]map[string]string{"s1": map[string]string{"v1": "m1", "va1": "me1"}, "si2": map[string]string{"v2": "m2"}},
        Foo{Bar: 1, Hoge: "a", Hello: map[string]string{"hel": "world", "a": "b"}, HogeHoges: []HogeHoge{HogeHoge{Hell: "a", World: 1}, HogeHoge{Hell: "bbb", World: 100}}},
        arr,
        []string{"aaa", "bbb", "ccc"},
        make(chan bool, 10),
        unsafe.Pointer(uintptr(1)),
        func(a string, b float32) int { return 0 },
        &HogeHoge{},
        &Piyo{Field1: map[string]string{"a": "b", "cc": "dd"}, F2: &Foo{}, Fie3: 128},
        []interface{}{1, 3},
        interface{}(1),
        HogeHoge{A: "test"},
        FooPri{Public: "hello", private: "world"},
        new(regexp.Regexp), // THIS LINE
    }

hmm. it seems to be Golang's bug. SEE golang/go#9384

Thank you for your report!

hmm. it seems to be Golang's bug. SEE golang/go#9384

I see. I commited a workaround in cdb03a4. Now CI passes.

In my current understanding, uintptr(1) means a pointer whose address is 0x00000001.
Because it is an invalid address, conversion to unsafe.Pointer crashes.

So I changed to cast a pointer of a real struct to unsafe.Pointer. bbb232f

I see. thanks.