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

bug: Gop encountered unnecessary line breaks and annotation errors while generating yap code #1761

Closed
LiusCraft opened this issue Feb 20, 2024 · 1 comment
Labels

Comments

@LiusCraft
Copy link
Contributor

LiusCraft commented Feb 20, 2024

The following program sample.gop triggers an unexpected result

// add a sample

//line cmd/gopcomm/community_yap.gox:41:1
	this.Get("/error", func(ctx *yap.Context) {
//line cmd/gopcomm/community_yap.gox:42:1
		ctx.Yap__1("4xx", map[string]interface {
		}{})
	})

Expected result

//line cmd/gopcomm/community_yap.gox:41:1
	this.Get("/error", func(ctx *yap.Context) {
//line cmd/gopcomm/community_yap.gox:42:1
		ctx.Yap__1("4xx", map[string]interface{}{})
	})

Got

$ gop run .\community_yap.gox
2024/02/20 11:48:47.328083 [INFO] cmd/gopcomm/community_yap.gox:582: Started in endpoint:  0.0.0.0:8080

Gop Version

gop v1.2.2 devel windows/amd64

Additional Notes

The gop code for this code is:

get "/error", ctx => {
	ctx.yap "4xx", {}
}

So it should be:

ctx.Yap__1("4xx", map[string]interface{}{})

But the generated code takes up two lines:

ctx.Yap__1("4xx", map[string]interface {
}{})
@LiusCraft
Copy link
Contributor Author

This issue affects the ability of gop delve to accurately breakpoint to the specified line

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

No branches or pull requests

2 participants