📝Get your *FREE Golang Cheat Sheet* - golangdojo.com/cheatsheet
@stephenoginga59269 ай бұрын
understood
@farzadmf3 жыл бұрын
Thank you for the great and engaging video. Small go nit suggestion: when using receiver functions, it's recommended to be consistent to either use a value pointer or a reference pointer. In fact, if you use mixed, go lint tools will complain.
@GolangDojo3 жыл бұрын
I use golangci-lint which I heard is supposed to be strict, and nothing came up. Let me do some digging.
@GolangDojo3 жыл бұрын
I'd imagine it's safer to pass by value and only use pointers when modifications to the data structure are needed. I asked around in the official Discord too and that seems to be the case. Also, golint is deprecated for what that's worth. Thanks for pointing this out!
@farzadmf3 жыл бұрын
I have a bunch of checks being run on my Go code usually and maybe linting is fine and it's one of the tools showing me warnings about that. What you mentioned is 100% true (using pointer receivers when modifying something); it's the consistency that matters usually: if you have one function receiving a pointer receiver because it's modifying something, even the ones not modifying anything are usually changed to receive a pointer receiver. Of course if you find a link or something that says you can have a mix of receivers, please let me know
@GolangDojo3 жыл бұрын
I honestly have no idea which is preferred and don't have strong preference on either. If the linter is complaining, I'd probably listen to the linter in use. I'll keep an eye out on this, and maybe even mention our conversation here in a future video comparing popular Goalng linters!
@manpt123 Жыл бұрын
Thank you sir, when you said it took a day to create this video I immediately subscribed.
@letsgetrusty3 жыл бұрын
This guy putting out movies
@GolangDojo3 жыл бұрын
HAHAHA
@alfredogrande24303 жыл бұрын
everyone: array golang dojo: *awway* jk, love your tutorials keep it up!
@GolangDojo3 жыл бұрын
You should've seen my older channels. My accent was way worse lol. And thanks!
@patbateman-o4g3 жыл бұрын
Honestly great video, already understood the concept of a linked list, however, you solidified my knowledge and you explained this much better than any of my prior instructors even did xD
@GolangDojo3 жыл бұрын
Glad it was helpful!
@kaushikplays46763 жыл бұрын
func (l *LinkedList) remove(value int) { previous := l.head for current := l.head; current != nil; current = current.next { if current.value == value { if l.head == current { l.head = current.next } previous.next = current.next break } previous = current } } I kept head as the placeholder for previous. Do you think this is wrong?
@GolangDojo3 жыл бұрын
The best way to figure it out is write some unit tests ;)
@linwei29062 жыл бұрын
me too. func (l *linkedList) remove(value int) { /* if head.value = vlaue head = head->next */ if l.head.value == value { l.head = l.head.next } else { p := l.head iterator := p.next for ; iterator != nil; iterator = iterator.next{ if iterator.value == value { p.next = iterator.next } else { p = p.next } } } }
@dcastro972 жыл бұрын
great video man!!.. I think we missed up to write a method to get length of a linked list, right?
@GolangDojo2 жыл бұрын
Nice catch :)
@JC-jn9kp2 жыл бұрын
For linkedlist, How are we able to input multiple values? Like "string", "string", Int
@Levelord92 Жыл бұрын
But isn't Add() operation is O(n) since we need to iterate over the whole linked list in order to insert new element to the back?
@simonedandreta78833 жыл бұрын
How would you write a unit test for a method that doesn't return anything? For example the add() method. Thanks!
@GolangDojo2 жыл бұрын
Testing series on the pipeline!
@simonedandreta78832 жыл бұрын
@@GolangDojo I have written few methods on linked lists in Go along with tests, but I am looking forward to your series!
@gwnbw2 жыл бұрын
17:34 whats that you use that package and method pops up if you hover over it?
@koushikhridoy8180 Жыл бұрын
Please work on your English. It's difficult to understand. Great video though.
@vanshajdhar92233 жыл бұрын
Amazing long awaited series
@GolangDojo3 жыл бұрын
More on the way!
@lasfito Жыл бұрын
Great content, man. Appreciate it
@kaushik50553 жыл бұрын
Was waiting for this series 😃
@GolangDojo3 жыл бұрын
Here we go! :)
@Levelord92 Жыл бұрын
I would also suggest to use strconv.Itoa instead of fmt.Sprintf for converting our value into string, since we decide to max out our performance with strings builder