Skip to Content
Hands-On Software Engineering with Golang
book

Hands-On Software Engineering with Golang

by Achilleas Anagnostopoulos
January 2020
Intermediate to advanced
640 pages
16h 56m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Golang

The Message interface

It logically follows that the contents of messages that are exchanged between vertices heavily depend on the application or graph algorithm that we are trying to execute. Consequently, to avoid passing plain interface{} values around, we need to come up with a plausible interface for describing messages in a generic way. The Message interface, which lives in the Chapter08/bspgraph/message package, is an attempt at doing exactly that:

type Message interface {
    // Type returns the type of this Message.
    Type() string
}

At this point, you are probably dubious about the usefulness of having a Type method on this interface. Can this really be any better than simply using an interface{}?

If you recall our discussion of the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Golang

Hands-On Software Architecture with Golang

Jyotiswarup Raiturkar

Publisher Resources

ISBN: 9781838554491Supplemental Content