You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gojscache/factory/factory.go : constructs a *gojscache.Foo
gojscache/use/main.go: imports gojscache and gojscache/factory. Uses gojscache/factory to construct a *gojscache.Foo.
Now, when modifying the top package to add fields to Foo and rebuilding gojscache/use, Gopherjs doesn't rebuild gojscache/factory. This causes the constructor in gojscache/factory to erroneously omit the newly added fields in Foo, leading to errors such as:
..js:13680 Uncaught TypeError: Cannot read property 'constructor' of undefined
at Object.$packages.reflect.Value.ptr.object (..js:13680)
at valueInterface (reflect.go:677)
at Object.$packages.reflect.Value.ptr.Interface (..js:15774)
at Object.$packages.fmt.pp.ptr.printValue (print.go:699)
at Object.$packages.fmt.pp.ptr.printValue (print.go:783)
at Object.$packages.fmt.pp.ptr.printValue (print.go:853)
at Object.$packages.fmt.pp.ptr.printArg (print.go:689)
at Object.$packages.fmt.pp.ptr.doPrintln (print.go:1146)
at Fprintln (print.go:254)
at Object.Println (..js:17476)
at main (main.go:11)
at $init (..js:18826)
at $goroutine (..js:1471)
at $runScheduled (..js:1511)
at $schedule (..js:1527)
at $go (..js:1503)
at ..js:18837
at ..js:18840
This is still present in GopherJS 1.11-1. To reproduce with the files below, first build foo/use. Then add the member C to foo.Foo. Rebuilding foo/use incorrectly uses the archive foo/factory/factory.a even if its dependency foo is modified (and has a more recent timestamp). Removing said archive corrects the build.
// foo/foo.go
package foo
type Foo struct {
A int
B int
// C int // Uncomment and recompile foo/use to trigger bug
}
Go 1.10.2 on Windows, GopherJS 1.10-4 (8dffc02)
Compiling using
GOOS=linux gopherjs.exe ....
Assume the following package layout:
gojscache/gojscache.go
: defines typeFoo
.gojscache/factory/factory.go
: constructs a*gojscache.Foo
gojscache/use/main.go
: importsgojscache
andgojscache/factory
. Usesgojscache/factory
to construct a*gojscache.Foo
.Now, when modifying the top package to add fields to
Foo
and rebuildinggojscache/use
, Gopherjs doesn't rebuildgojscache/factory
. This causes the constructor ingojscache/factory
to erroneously omit the newly added fields inFoo
, leading to errors such as:This is fixed by #805 .
The text was updated successfully, but these errors were encountered: