Skip to content

Commit

Permalink
Expose package name of a compiled source
Browse files Browse the repository at this point in the history
Exposing package name of the compiled source allows using it in `Eval`, as well as in logs and for other purposes.
  • Loading branch information
dennwc committed Nov 7, 2022
1 parent 7bb8b46 commit 97cf8c4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions interp/program.go
Expand Up @@ -17,6 +17,11 @@ type Program struct {
init []*node
}

// PackageName returns name used in a package clause.
func (p *Program) PackageName() string {
return p.pkgName
}

// FileSet is the fileset that must be used for parsing Go that will be passed
// to interp.CompileAST().
func (interp *Interpreter) FileSet() *token.FileSet {
Expand Down

0 comments on commit 97cf8c4

Please sign in to comment.