-
Notifications
You must be signed in to change notification settings - Fork 2
/
notes.txt
253 lines (190 loc) · 5.28 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
Magesh Kuppan
Schedule
Commence : 9:30
Tea break : 11:30 (20 mins)
Lunch Break : 13:00 (1 hr)
Commence : 14:00
Tea Break : 15:30 (20 mins)
Wind up : 17:30
Name
Experience
Primary Skillset
Experience in Go (if any)
Any book you read recently / Any shows or movies you watched recently ( it has be interesting)
Not a nice man to know (B)
Designing Data Intensive Applications (B)
Cinnoman Gardens (B)
Expanse (V) (Prime)
777 Charlie (V)
Schitt's Creek (V)
The Last World (V)
C
C++
Python
Ruby (1993)
JavaScript (1995)
Java (1995)
C# (1998)
Golang (2008)
The Paradox of Choice (Barry Schwartz) (TED )
Why?
Performance (Runtime)
Easy to learn
Community Support
Concurrency friendly (better performance, better memory footprint)
Simplicity
- 25 keywords
- package, import, var, func, return, if, for, switch, select, range, chan, close, defer, go, type, interface, struct, make
- NO list
no classes
no inheritance (prefer composition over inheritance)
no access modifiers
no generics
no exceptions (only errors)
no try catch finally
no function overloading
Built for concurrency
Concurrency features are built in the language
go, chan (built in DATA TYPE), range, select
Builtin Scheduler
1000s of goroutines using 1 thread (extremely memory effiencient when compared the traditional multi threading techniques)
golang.org
go version
Visual Studio Code / goland (licensed)
http://code.visualstudio.com
Data Types in Go
bool
string
int
int8
int16
int32
int64
uint
unit8
uint16
uint32
uint64
float32
float64
complex64 (real float32, imaginary float32)
complex128 (real float64, imaginary float64)
byte (alias for unit8)
rune (alias for int32, represents 1 unicode character)
complex types
=============
Array
Slice
Map
Assignment : 1
Write program that prints the first 10 prime number from 2
Higher Order Functions
Functions as data
1. Functions can be assigned to variables
2. Functions can be passed as arguments to other functions
Modularity
Modules & Packages
Before Go 1.13
The Application code has to be in a particular folder
GOPATH
bin
pkg
src
github.com
tkmagesh
ibm-go-jun-2021
GOROOT
go tool binaries
GOPATH
go.mod (like package.json in javascript applications)
module name
go version
other third party modules
to create a module file run the following command
go mod init modularity-demo
to install a third party package
go get github.com/fatih/color
to update an existing dependency
go get -u github.com/fatih/color
to create a build
go build
go build -o <binary_name>
to get the list of build tool chains of different OS and Architecture
go tool dist list
cross compilation of the application
GOOS=windows go build
TODO:
implement the data structures in golang (stack, queue, linked list, doubly linked list, trees)
IO operations
io
foundational types (like Reader, Writer, Seeker)
iouitls
high level apis
os
manipulate files & directories
bufio
buffered io & for manipulating textual data
gRPC
Application to Application communication
.NET
.NET Remoting
binary
Java
RMI
Web
IP
TCP
HTTP
XML
Web Services
SOAP (Simple Object Access Protocol) - XML Vocabulary for representing request & response formats
WSDL (Web Service Description Language) - XML Vocabulary
REST (Respresentational State Transfer)
Data as a Resource
What data ? - URL
http://myApp.com/products
What operation ?
http verbs GET, POST, PUT, PATCH, DELETE, HEAD
Status of requested operation
http status codes 200, 201, 302, 403, 404, 500
JSON
HTTP overheads
Stateless protocol
Text
ONLY frequent polling to get realtime data
IT DEPENDS
Product Master
Read Only
Read Optimized
Reviews
Read Write
Mostly Read / Rarely Write
Customers who bought this item also bought
Analytical
Delivery
Realtime
RDBMS
Integrity of the data (transactional)
gRPC
Language agnostic
protocol buffers
binary
tcp
communication patterns
request response
client streaming
server streaming
bidirectional streaming
Toos for gRPC
go get -u github.com/golang/protobuf/protoc-gen-go
OR
brew install protobuf
go get -u google.golang.org/grpc
to generate the proxy
protoc ./proto/service.proto --go_out=plugins=grpc:.
For go 1.16
protoc --go_out=. --go_opt=paths=source_relative \ --go-grpc_out=. --go-grpc_opt=paths=source_relative \ proto/service.proto
Troubleshoot generating proto proxy
export PATH="$PATH:$(go env GOPATH)/bin"
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
go get -u google.golang.org/grpc@latest