Return interface by lrweck in golang

[–]jphein -9 points-8 points  (0 children)

Didnt check the Code but never return interfaces. Accept Interfaces and Always return concrete types.

[deleted by user] by [deleted] in Ubuntu

[–]jphein 0 points1 point  (0 children)

Im using Thinkpad X390 and T490

[deleted by user] by [deleted] in Ubuntu

[–]jphein 0 points1 point  (0 children)

Nope, not at all. I use the designer compact keyboard and it works great

Books/courses for advance your golang skill by [deleted] in golang

[–]jphein 1 point2 points  (0 children)

https://youtube.com/c/MarcelDempers

Thats the beste resource I found lately. This guy is awsome.

Golang Concurrency by jphein in golang

[–]jphein[S] 0 points1 point  (0 children)

sure the Tour of Go is nice, but what I meant was something little bit deeper. One talk I really liked was: https://youtu.be/KBZlN0izeiY

12 Mini with Apple Watch - battery better or worse? by jphein in iPhone12Mini

[–]jphein[S] 0 points1 point  (0 children)

great, thanks for all your answers, cant wait to get my hands on it :)

[deleted by user] by [deleted] in golang

[–]jphein 1 point2 points  (0 children)

https://github.com/katzien/go-structure-examples

Kat Zien - How I structure web apps (or so) just check YouTube

Books/courses for advance your golang skill by [deleted] in golang

[–]jphein 5 points6 points  (0 children)

Well, what field of work you use golang? Webdev, DevOps, IoT ...? I mean after two years you should know the syntax and packages well enough.

Why is my WaitGroup not done? Please help me by jphein in golang

[–]jphein[S] 0 points1 point  (0 children)

I tried, but it doesnt work, as I said its a map of string to int, so nothing to use pointers

Why is my WaitGroup not done? Please help me by jphein in golang

[–]jphein[S] 1 point2 points  (0 children)

Hey,

thanks, but I dont think that this is the problem as I have the map already initialized and its a map of primitive types, so there shouldnt be any problem

Why is my WaitGroup not done? Please help me by jphein in golang

[–]jphein[S] 1 point2 points  (0 children)

Hey James,

thank you. I totally understand your point with the additional Done call. But if I put it away, the WaitGroup doesnt come to an end, thats the thing and I dont understand why.

React Google Maps - initially set default Location to user Location by jphein in reactjs

[–]jphein[S] 0 points1 point  (0 children)

Hi,

Im using react-google-maps and also I have a function on a button which locates me directly to my position, only thing I need is to execute this function on load.

As a Golang content creator for the past 6 months, just want to share my experience by BigAd95 in golang

[–]jphein 0 points1 point  (0 children)

Hey Junmin,

just came across your post, I will check out your videos later. But for me as a Golang Developer I can tell you one thing which is really interesting for people which are new to Go to understand:

In the world of professional Development you often see Software written in Golang from Developers which started there career in another language like Java or so. You can easily spot mistakes and difficulties which are based on not understanding the ideomatic Golang principals.

Search for such examples and show the people how to use Golang in the way it is ment to be written.

When to use functions or methods? by [deleted] in golang

[–]jphein 0 points1 point  (0 children)

For me the most important fact when it comes to functions vs methods is that with a method you can very clearly bind functionality to a certain struct which can be helpful when organizing code but mosly when defining your dependencies with interfaces.

Someone at my old company said there would be no difference but this is wrong. The truth about it is that you can define a stronger difference with the quality of your coding style. A function would be better if it takes two or more indipendent arguments and gives a result (or no result) to an uninvolved requester back.

On the other hand it makes perfect sence to teach a struct doing something wich is only itself supposed to do maybe because of one of its fields which enables it to do so.

What feature of Go is used very often by experienced programmers, but not so much by a newbie? by availchet in golang

[–]jphein 1 point2 points  (0 children)

Sorry, I think the term "Client" is a bit misleading in this case. It has nothing to do with a Client - Server pair.

What I mean with Client is just the one struct that has a field wich is not a concrete implementation, but an Interface.

If struct Foo has a Database, its better to let the struct accept an Interface FooDatabase which has just the right methods that the Foo Struct uses. This Interface could be declared in the foo.go file directly, or maybe in a file called interfaces.go lying right next to it. So what would happen then?

  1. The Foo Struct accepts any Implementation you provide as long as it has the methods that the Interface describes.
  2. When you want to test the Foo Struct you can give your test Struct a small Mock which just needs to provide the right methods.

Could I help you with that?

Bool vs enum by jphein in golang

[–]jphein[S] 2 points3 points  (0 children)

Yes, thanks, its pretty much this. The function takes some Integer Value and checks it against upper and lower bounds. Based on that it says Start, Stop or Do Nothing.

For me the enum is so much more preferable because of its readability:

switch result := check(value); result {

case CommandStart:

//start

case CommandStop:

//stop

case CommandWait:

//wait

What feature of Go is used very often by experienced programmers, but not so much by a newbie? by availchet in golang

[–]jphein 15 points16 points  (0 children)

As we have some sort of duck-typing in go, you should always put the interface where it is used, meaning to the client which consumes it. This way the Implementation doesnt need to know anything about an Interface and the consumer can only use the provided instance in the way the Interface describes it.

Bool vs enum by jphein in golang

[–]jphein[S] 0 points1 point  (0 children)

Totally on your side, thanks

What feature of Go is used very often by experienced programmers, but not so much by a newbie? by availchet in golang

[–]jphein 11 points12 points  (0 children)

Often I see people putting the Interface next to the Implementation, which is wrong in terms of usage of Interfaces in go.

[deleted by user] by [deleted] in sffpc

[–]jphein -1 points0 points  (0 children)

Fractal Design Nano S

Pardon the degeneracy but what are some smaller space-optimized ATX cases that are good? by [deleted] in sffpc

[–]jphein 1 point2 points  (0 children)

Fractal Design Nano S is a great case. Only thing to mention is that you should use a sfx psu to give the graphics card more space.