Building the embedded static assets prototype

140 views
Skip to first unread message

David Moles

unread,
Oct 8, 2020, 6:46:41 PM10/8/20
to golang-nuts
I'm trying to build the prototype code for the embedded static assets proposal, but I'm not having any luck. I'm new to building Go from source, and new to gerrit and to the Go contribution & development process, so apologies in advance if I'm missing something obvious.

I've cloned the Go source and applied the change with

git fetch https://go.googlesource.com/go refs/changes/45/243945/2 && git checkout -b change-243945 FETCH_HEAD

but when I try to build with src/all.bash (using either go 1.15.2 or go 1.14.9, on macOS Catalina), I get:

/Users/david/Projects/Scratch/goroot/src/cmd/internal/obj/dwarf.go:49: s.Func.Text undefined (type func() *FuncInfo has no field or method Text)

followed by a bunch of similar errors. (Note that neither dwarf.go nor funcinfo.go are involved in the prototype patchset.)

Figuring the tree might have been in a broken state at the time the prototype was committed, I then tried cherry-picking the commit (95a456f) on top of the go1.15.2 release tag. This got me past the error above, but the build then failed with:

go tool dist: FAILED: /Users/david/Projects/Scratch/goroot/pkg/tool/darwin_amd64/compile -std -pack -o /var/folders/mq/dw4wtwsn7dlb_q99_qcd9kdc0000gn/T/go-tool-dist-150877791/cmd/go/internal/load/_go_.a -p cmd/go/internal/load -importcfg /var/folders/mq/dw4wtwsn7dlb_q99_qcd9kdc0000gn/T/go-tool-dist-150877791/cmd/go/internal/load/importcfg /Users/david/Projects/Scratch/goroot/src/cmd/go/internal/load/flag.go /Users/david/Projects/Scratch/goroot/src/cmd/go/internal/load/path.go /Users/david/Projects/Scratch/goroot/src/cmd/go/internal/load/pkg.go /Users/david/Projects/Scratch/goroot/src/cmd/go/internal/load/search.go /Users/david/Projects/Scratch/goroot/src/cmd/go/internal/load/test.go: exit status 2
go tool dist: open /var/folders/mq/dw4wtwsn7dlb_q99_qcd9kdc0000gn/T/go-tool-dist-150877791/cmd/go/internal/modfetch/codehost/_go_.a: no such file or directory
go tool dist: open /var/folders/mq/dw4wtwsn7dlb_q99_qcd9kdc0000gn/T/go-tool-dist-150877791/cmd/go/internal/load/_go_.a: no such file or directory
go tool dist: open /var/folders/mq/dw4wtwsn7dlb_q99_qcd9kdc0000gn/T/go-tool-dist-150877791/cmd/go/internal/version/_go_.a: no such file or directory

I assume that I'm doing this wrong, and that there's a right way to be doing it -- what is the right way? 

Ian Lance Taylor

unread,
Oct 8, 2020, 6:57:49 PM10/8/20
to David Moles, golang-nuts
These errors look like you have some mix of old and new sources. Make
sure to start with an empty directory, with no files left over from
earlier changes.

Ian

David Moles

unread,
Oct 9, 2020, 3:02:52 PM10/9/20
to golang-nuts
Good thought. Even after git clean -fdx, though, the branch change-243945 fails with the dwarf-related errors, and with go1.15.2 + cherry-picked 95a456f I get this:

/Users/david/Projects/Scratch/goroot/src/cmd/go/internal/load/pkg.go:404:22: pp.EmbedPatterns undefined (type *build.Package has no field or method EmbedPatterns)
/Users/david/Projects/Scratch/goroot/src/cmd/go/internal/load/pkg.go:405:26: pp.TestEmbedPatterns undefined (type *build.Package has no field or method TestEmbedPatterns)
/Users/david/Projects/Scratch/goroot/src/cmd/go/internal/load/pkg.go:406:27: pp.XTestEmbedPatterns undefined (type *build.Package has no field or method XTestEmbedPatterns)

followed by the missing _go_.a above. (It's possible this was in the previous error as well, and I just forgot to paste it, sorry.)

I think the problem is with the cherry-pick — I was expecting the top-level commit to contain the complete prototype, but it doesn't; there's probably at least six commits I need, if not everything in the relation chain of the top-level commit. I'm not sure what the best way to apply all those is — I guess I can try one at a time and see what happens.

Boy howdy do branches and pull requests seem easier. But I assume this makes sense to experienced Gerrit users.

David Moles

unread,
Oct 9, 2020, 4:19:07 PM10/9/20
to golang-nuts
I think I'm overthinking this -- what it seems to amount to is that this change broke dwarf.go (as well as a bunch of other files) and that either the prototype never compiled, or there were some changes RSC forgot to check in. I found a few unrelated compilation errors as well, some only in tests, and had a go at fixing them (see attached patch) but still ran into test fialures. Time to give up and wait for the beta, I guess.
0001-Clean-up-most-compilation-errors.patch
Reply all
Reply to author
Forward
0 new messages