How to dump cfg for method ?

71 views
Skip to first unread message

eric fang

unread,
May 19, 2020, 7:49:53 AM5/19/20
to golang-nuts
How to generate the cfg of the following Replace method ? I used this command "GOSSAFUNC=Replace:* go tool compile main.go" but it doesn't work. Thanks.

package main

type byteReplacer [256]byte

func (r *byteReplacer) Replace(s string) string {
        var buf []byte // lazily allocated
        for i := 0; i < len(s); i++ {
                b := s[i]
                if r[b] != b {
                        if buf == nil {
                                buf = []byte(s)
                        }
                        buf[i] = r[b]
                }
        }
        if buf == nil {
                return s
        }
        return string(buf)
}

func main() {
}

eric fang

unread,
May 21, 2020, 7:13:48 AM5/21/20
to golang-nuts
Does anyone know this? Or this is an unimplemented feature ?

在 2020年5月19日星期二 UTC+8下午7:49:53,eric fang写道:
Reply all
Reply to author
Forward
0 new messages