lab.nexedi.com/kirr/go123@v0.0.0-20240207185015-8299741fa871/tracing/cmd/gotrace/testdata/src/a/pkg1/pkg1.go (about)

     1  package pkg1
     2  
     3  import (
     4  	"net/url"
     5  
     6  	// extra import which is used in package but should not be used in tracing code
     7  	"fmt"
     8  )
     9  
    10  // probe receives no args
    11  //trace:event traceNewTPre()
    12  
    13  // probe receives type this package defines
    14  //trace:event traceNewT(t *T)
    15  
    16  type T struct {}
    17  
    18  func NewT() *T {
    19  	traceNewTPre()
    20  	t := &T{}
    21  	traceNewT(t)
    22  	return t
    23  }
    24  
    25  // probe receives type from another package
    26  //trace:event traceURLParsed(u *url.URL)
    27  
    28  func ParseURL(ustr string) (*url.URL, error) {
    29  	u, err := url.Parse(ustr)
    30  	if err != nil {
    31  		return nil, fmt.Errorf("oh my bad: %v", err)
    32  	}
    33  
    34  	traceURLParsed(u)
    35  	return u, nil
    36  }
    37  
    38  // probe receives builtin type
    39  //trace:event traceDoSomething(topic string)
    40  
    41  func DoSomething(topic string) {
    42  	traceDoSomething(topic)
    43  }
    44  
    45  
    46  // XXX do we need vvv ?
    47  // package-local non-exported tracepoint
    48  //type t struct {}
    49  ////trace:event tracedoSomethingLocal(arg *t)