Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go:generate yaegi extract "XXX" not support custom tags #1671

Open
Tudongye opened this issue Dec 2, 2024 · 0 comments
Open

go:generate yaegi extract "XXX" not support custom tags #1671

Tudongye opened this issue Dec 2, 2024 · 0 comments

Comments

@Tudongye
Copy link

Tudongye commented Dec 2, 2024

The following program sample.go triggers an unexpected result

// ~/hello/h.go

//go:build custom
// +build custom

package hello

func Hello() {
}

Expected result

$ cd ~/hello
$ yaegi extract h.go
$ ls
hello.go h.go

// if delete "go:build custom" "+build custom", i can get "hello.go" 
/*
 func init() {
        Symbols["hello/hello"].....
*/

Got

$ cd ~/hello
$ yaegi extract hello.go
no buildable Go source files in /home/hello

Yaegi Version

0.16.1

Additional Notes

func (e *Extractor) Extract( ...... pkg, err := importer.ForCompiler(token.NewFileSet(), "source", nil).Import(pkgIdent)
I think the problm lies here.
Compiler of "source" use the default buildcontext.
Its BuildTags always is "".
So my Go files that have build tag "custom" will be ignored by "Import".
I try "yaegi extract -tag=pb hello.go", but not useful.The "tag" is not the one I want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant