luciotato / golang-notes Goto Github PK
View Code? Open in Web Editor NEWNotes to understand golang
License: Other
Notes to understand golang
License: Other
Currently, only struct on struct or interface on interface embedding is explained in OOP.md.
It would be nice to have an explanation about embedding interfaces into structs.
Here's a nice example:
https://github.com/dapr/components-contrib/blob/master/state/store.go#L51
In this example the DefaultBulkStore
struct embeds the Store
interface, DefaultBulkStore
the uses the embedded Store
interface to also implement BulkStore
.
20, 2.5 should read 20, 2.5,
"golang" is used for tags, for SEO, etc. Please use "Go" for the actual name in text.
Just want to ask about the jmp-table
in OOP.md,
Is it jmp-table
or jump-table
? Because I couldn't find anything with jmp table
,
I googled it and found jmp is a software.
Here's a few things you may want to add:
func New(name string, age int) Person {...}
and maybe how the factory pattern can be used with interfaces.I personally have been recently favoring function type definitions and interfaces far more over struct methods, especially when your datasources may change. This is extremely helpful when writing unit tests because you can much create mock functions that adhere to your function type definitions or interfaces. Otherwise, you basically end up being forced to write special cases in your code or creating functional tests instead of unit tests.
Just my thoughts.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.