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

cmd/go2go: build fails when using argument types from packages #39642

uhthomas opened this issue Jun 17, 2020 · 4 comments

cmd/go2go: build fails when using argument types from packages #39642

uhthomas opened this issue Jun 17, 2020 · 4 comments


Copy link

@uhthomas uhthomas commented Jun 17, 2020

What version of Go are you using (go version)?

> runtime.Version()
devel +ad307489d4 Tue Jun 16 05:49:35 2020 +0000

Does this issue reproduce with the latest release?


What operating system and processor architecture are you using (go env)?

What did you do?

Using an argument type *url.Error results in a failed build.


What did you expect to see?

A successful build.

What did you see instead?

panic: prog.go2:19:21: unexpected type string character '/' in "*net/url.Error"

goroutine 1 [running]:
go/go2go.(*translator).instantiatedName(0xc0004d5960, 0x0, 0xc00000c8a0, 0xc00001d050, 0x1, 0x1, 0x6da9e0, 0xc00000c740, 0xc00000c740, 0x5739f20317549601)
	/usr/local/go-faketime/src/go/go2go/names.go:61 +0x72b
go/go2go.(*translator).instantiateFunction(0xc0004d5960, 0x0, 0xc00000c8a0, 0xc00001c640, 0x1, 0x1, 0xc00001d050, 0x1, 0x1, 0xc0004d5080, ...)
	/usr/local/go-faketime/src/go/go2go/instantiate.go:94 +0x85
go/go2go.(*translator).translateFunctionInstantiation(0xc0004d5960, 0xc0000566c0)
	/usr/local/go-faketime/src/go/go2go/rewrite.go:687 +0x3ea
go/go2go.(*translator).translateExpr(0xc0004d5960, 0xc0000566c0)
	/usr/local/go-faketime/src/go/go2go/rewrite.go:567 +0x3e5
go/go2go.(*translator).translateExpr(0xc0004d5960, 0xc00001c670)
	/usr/local/go-faketime/src/go/go2go/rewrite.go:572 +0x398
go/go2go.(*translator).translateExprList(0xc0004d5960, 0xc00001c670, 0x1, 0x1)
	/usr/local/go-faketime/src/go/go2go/rewrite.go:646 +0x46
go/go2go.(*translator).translateStmt(0xc0004d5960, 0xc0000567c8)
	/usr/local/go-faketime/src/go/go2go/rewrite.go:447 +0x29d
go/go2go.(*translator).translateStmt(0xc0004d5960, 0xc000056830)
	/usr/local/go-faketime/src/go/go2go/rewrite.go:462 +0x3e5
go/go2go.(*translator).translateStmt(0xc0004d5960, 0xc00000cad0)
	/usr/local/go-faketime/src/go/go2go/rewrite.go:465 +0x445
go/go2go.(*translator).translateBlockStmt(0xc0004d5960, 0xc000010de0)
	/usr/local/go-faketime/src/go/go2go/rewrite.go:408 +0x52
go/go2go.(*translator).translateFuncDecl(0xc0004d5960, 0xc000056860)
	/usr/local/go-faketime/src/go/go2go/rewrite.go:401 +0xc5
go/go2go.(*translator).translate(0xc0004d5960, 0xc000076200)
	/usr/local/go-faketime/src/go/go2go/rewrite.go:329 +0x391
go/go2go.rewriteAST(0xc000056280, 0xc000056240, 0x0, 0x0, 0xc00005f680, 0xc000076200, 0x1, 0xc00005f310, 0xc00005f680)
	/usr/local/go-faketime/src/go/go2go/rewrite.go:141 +0x109
go/go2go.RewriteBuffer(0xc000056240, 0x7ffe6f323dd8, 0x1e, 0xc00012c000, 0x179, 0x379, 0x0, 0xc00008cd60, 0x40dd18, 0x30, ...)
	/usr/local/go-faketime/src/go/go2go/go2go.go:132 +0x2c5
main.translateFile(0xc000056240, 0x7ffe6f323dd8, 0x1e)
	/usr/local/go-faketime/src/cmd/go2go/translate.go:26 +0xa9
	/usr/local/go-faketime/src/cmd/go2go/main.go:64 +0x456

Go build failed.
@uhthomas uhthomas changed the title cmd/go2go: build fails when using argument types from external packages cmd/go2go: build fails when using argument types from packages Jun 17, 2020
Copy link

@andybons andybons commented Jun 17, 2020

@andybons andybons added this to the Unplanned milestone Jun 17, 2020
Copy link

@griesemer griesemer commented Jun 17, 2020

This is a bug in the translator part. Type-checking is fine.

Copy link

@gopherbot gopherbot commented Jun 17, 2020

Change mentions this issue: [dev.go2go] go/go2go: accept slash in an instantiated type name

Copy link

@ianlancetaylor ianlancetaylor commented Jun 17, 2020

Thanks. This should be fixed now.

gopherbot pushed a commit that referenced this issue Jun 17, 2020
It shows up when instantiating with types with a package path
containing a slash, as in net/url.Error.

Fixes #39642

Change-Id: Icf40e7bcdf1de7c84f58ebde35ebffadbb071d72
Reviewed-by: Ian Lance Taylor <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.