Text file src/cmd/go/testdata/mod/example.com_stack_v1.0.1.txt

     1  Module with a function that prints file name for the top stack frame.
     2  Different versions of this module are identical, but they should return
     3  different file names with -trimpath.
     4  -- .mod --
     5  module example.com/stack
     6  
     7  go 1.14
     8  -- .info --
     9  {"Version":"v1.0.1"}
    10  -- stack.go --
    11  package stack
    12  
    13  import "runtime"
    14  
    15  func TopFile() string {
    16  	_, file, _, _ := runtime.Caller(0)
    17  	return file
    18  }
    19  

View as plain text