bigwhite/functrace

generate empty file when pass option -w

bigwhite opened this issue · 1 comments

when the source file passed to gen command(with option -w) is like below:

// github.com/panjf2000/internal/netpoll/queue/queue.go
package queue

// Task is a asynchronous function.
type Task func() error

// AsyncTaskQueue is a queue storing asynchronous tasks.
type AsyncTaskQueue interface {
    Enqueue(Task)
    Dequeue() Task
    Empty() bool
}

then,gen command generate an empty queue.go with success hint.

the file to add trace has no function or method,so the rewrite func return "nil, nil". we should handle the first nil gracefully.