Skip to content

GopherJS incorrectly uses stale archive files when latest source code fails to build. #559

Closed
@alltom

Description

@alltom
  1. Create the following three files.
  2. Run gopherjs serve and load alltom/ in your browser.
  3. Edit iface.go to change Bar() int to Bar2() int.
  4. Edit main.go to change impl.MakeFoo().Bar() to impl.MakeFoo().Bar2().
  5. Reload your browser.

Instead of seeing a compile error about FooImpl no longer implementing Foo, you get a runtime error saying "Uncaught TypeError: impl.MakeFoo(...).Bar2 is not a function". It looks like gopherjs serve doesn't realize that impl.go needs to be recompiled.

alltom/iface/iface.go

package iface

type Foo interface {
	Bar() int
}

alltom/impl/impl.go

package impl

import "alltom/iface"

type FooImpl int

func MakeFoo() iface.Foo {
	return FooImpl(0)
}

func (f FooImpl) Bar() int {
	return 42
}

alltom/main.go

package main

import "alltom/impl"

func main() {
	impl.MakeFoo().Bar()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggopherjs-toolRelated to the gopherjs tool or its build system (but not the compiler itself).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions