Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Panic with a global value whose type is an alias to string #545

Open
@hajimehoshi

Description

@hajimehoshi

http://www.gopherjs.org/play/#/OAURs5D1wS

package main

import (
	"fmt"
)

type Foo string

func (foo *Foo) Hello() {
	fmt.Printf("Hello, I am %s\n", *foo)
}

var theFoo = Foo("the global foo")

func main() {
	theFoo.Hello()
}

This panics with the message panic: theFoo$24ptr is not defined.

This works fine with the original Go: https://play.golang.org/p/h8I6Uqc0SP

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions