DEV Community

Cover image for Golang perk series : structs & partial inheritance with embedded structs #6.1
Lukas Gaucas
Lukas Gaucas

Posted on • Updated on

Golang perk series : structs & partial inheritance with embedded structs #6.1

TL;DR : Sructs in Go enables us to define custom types , yes I said type*S* (in plural!), upon which is passed type checking on build (compile-time) can instantiate "object-like" blueprint of data : hereby I mentioned "object-like" as we going to compared "non-comparable" with JavaScript objects mocking struct-like behaviour, whilst utilising a small extendible utility called – _is I've recently written for this purpose (the later example) :

In Golang :

TIP : refer to structs_factory.go on REPLIT IDE in File Explorer

Meanwhile in JavaScript :

TIP : refer to structs_factory.js on REPLIT IDE in File Explorer

Top comments (1)

Collapse
 
projektorius96 profile image
Lukas Gaucas

Upvoted for 6.1 ed. which included a code example of "embbeded" (optionally anonymous) structs

Stay tuned for more !