Skip to content

can't detect type from channel #2215

Closed
Closed
@inotnako

Description

@inotnako

plugin GO v0.10.852
idea 15.0.1 #IC-143.382

2016-01-06 13 17 15

package main

import "fmt"

type Neuron struct {
    ID int
}

type Signal struct {
    Value float64
    ID    string
}

func (s *Signal) IsNull() bool {
    if s.Value != 0 {
        return false
    }
    return true
}

type Dendrit chan *Signal

func (d Dendrit) Sinops(n *Neuron) {
    for {
        select {
        case signal := <-d:
            if signal.IsNull() { // not found method
                continue
            }
            // Value not found also
            fmt.Printf("NID=%d\t<- %g (IN)\n", n.ID, signal.Value)
        default:
            continue
        }
    }
}

func main() {
    fmt.Println("Hello, playground")
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions