You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"url":"http://localhost:4000/404.html","description":"C coder learing golang. C C++ python to golang.","@type":"WebPage","headline":"Ari’s page","@context":"http://schema.org"}</script>
{"url":"http://localhost:4000/another-page.html","description":"C coder learing golang. C C++ python to golang.","@type":"WebPage","headline":"Ari’s page","@context":"http://schema.org"}</script>
{"url":"http://localhost:4000/","description":"C coder learing golang. C C++ python to golang.","name":"Ari’s page","@type":"WebSite","headline":"Ari’s page","@context":"http://schema.org"}</script>
<p>Of course I made some assosations in my mind with C/C++/python. I know golang tutorials let you know that you should not make such assumptions.. but you will anyway.</p>
<p>The thing why I really like golang (so far) is that it makes standalone executable.</p>
74
+
75
+
<p>Of course this means that everything is staticly linked to the executable/binary and the size grows compared e.g C.. but compared to benefit of having executable standalone, I could not care less.</p>
76
+
77
+
<p>No different path settings/exports/registry entries, install programs etc.. just run or compile+run the binary ;)</p>
78
+
79
+
<p>have you ever seen python or ruby script to fail due imported library incombability ;)</p>
80
+
81
+
<p>And so far what I have tried, the same code compiles to windows and runs the same way.. standalone. (You can even copile it at linux for windows).</p>
70
82
71
83
<h1id="-first-look"><ahref="#header-1"></a> first look</h1>
But then there is sometimes stuff just after the ‘func’ keyword, tutorials somehow seem to skip this .. I leared this by googling the very similar question.</p>
110
+
111
+
<p>But then function can be also ‘class/struct’ function.</p>
112
+
113
+
<p>That is the stuff in brackets after ‘func’ is like automaticly made class/struct instance.. and used like this-pointer in C++.</p>
<p>For some really good reason there ++really is no++ api/function to get the go routine id (thread id), so I just use some id for now. Perhaps in future I’ll use the ‘context’ stuff they included quite resently.</p>
162
+
<p>For some really good reason there ++really is no++ official api/function to get the go routine id (thread id), so I just use some id for now. I did try to use uuid but those make log line too long.
163
+
Perhaps in future I’ll use the ‘context’ stuff they included quite resently.
164
+
I also heard that golang has inbuilt thread/go routine/function engine.. so you should be able to run more than real threads.. never needed that much yet.</p>
<p>Because my_server is private I can not use Foo(), I can not even access/set the bar variable if I change the my_server to public My_server !!</p>
223
+
224
+
<p>Now because the my_server is private I can not overwrite the Foo() anymore in my main().</p>
225
+
226
+
<p>In C++ you could inherit the whole class (my_utils), and then overwrite the Foo().</p>
227
+
228
+
<p>As far I know ,you can not do this in golang with out tricks ;(</p>
229
+
230
+
<h1id="-some-whining-about-this-issue"><ahref="#header-3"></a> some whining about this issue</h1>
231
+
232
+
<p>“They are privat for a reason”.. bollocks, my personal quess is that I would do it.. because as said in C++ you can just inherit and do what ever you want with members.</p>
233
+
234
+
<p>Yeah, I know this is what the golang interface stuff is for but you see this all the time.. and end up ripping others code.</p>
235
+
236
+
<p>A lot of code/project what I have seen are not writen to be extended or used anywhere else than specific case, even the projects intention was to create interface !</p>
237
+
238
+
<p>In general I have started to be little sceptical of projects started 2/3 years ago.. A lot of them seem to be playing with golang and just dumped to github.
239
+
I hope standard library has sceptical members what to put there or were are in the mess as some many other languages.</p>
240
+
241
+
<p>So I learned <strong>my lesson</strong>, I have to think what members really need be private or use interface in an github project.
242
+
If I think it is any use to anybody other than just cut and paste code.</p>
122
243
123
244
<divclass="highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>The end so far.
0 commit comments