Skip to content

Unresolved reference on map of struct? #1723

Closed
@nhooyr

Description

@nhooyr

See below

package main

type (
    client struct {
        message chan string
    }
    clientList struct {
        m (map[string]*client)
    }
)

func main() {
    clientList := clientList{m: make(map[string]*client)}
    message := ""
    for _, c := range clientList.m {
        c.message <- message   // c.message is not resolved.
    }
}

Original issue:

http://pastebin.com/XBiNkfSN - little chat server i've been working on. For the function broadcastLoop inside of manageChannel it says on line 201 that message is unresolved. Everything compiles and runs and the function works as expected. Don't know what's wrong.

screen shot 2015-07-06 at 2 10 45 pm

Latest nightly build btw.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions