Skip to content

Error with time.Sleep #279

Closed
Closed
@govlas

Description

@govlas

if use gopherjs with time.Sleep without any reference to time.Time structure, this code:

package main

import (
    "time"

    "github.com/gopherjs/gopherjs/js"
)

//var _ = time.Now()

func log(i ...interface{}) {
    js.Global.Get("console").Call("log", i...)
}

type Test struct {
    A int
    B string
}

func main() {
    log(Test{1, "hello"})
    time.Sleep(time.Second)
}

produces error in browser:

go-js.js:1738: Uncaught TypeError: Cannot read property 'ptr' of undefined

in function $externalize

    if (timePkg && v.constructor === timePkg.Time.ptr) {

timePkg.Time is not defined in javascript code

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions