A Practical Guide to Pointers in Go

Поділитися
Вставка
  • Опубліковано 3 лип 2024
  • 🌎 Follow me here:
    Discord: / discord
    Twitter: / tomdoes_tech
    Facebook: / tomdoestech​
    Instagram: / tomdoestech​
    TikTok: / tomdoes_tech
    ☕ Buy me a coffee: www.buymeacoffee.com/tomn
  • Розваги

КОМЕНТАРІ • 21

  • @mohit84604
    @mohit84604 4 місяці тому +2

    this is great for clearifyiing the doubts.

  • @samskulj
    @samskulj 4 місяці тому +1

    Great tutorial!

  • @WebDevCody
    @WebDevCody 4 місяці тому +1

    The fact that the editor doesn’t warn when trying to access a potentially nil pointer makes me miss typescript. Are you saying all structs should just have some internal value you use to know if the thing was set or not? Like an isInitalized true bool?

    • @TomDoesTech
      @TomDoesTech  4 місяці тому +2

      I'm not sure I understand the question, but everything has default values, see this playground: go.dev/play/p/qCJQAwYbCID
      I should do a video on what you posted on twitter the other day about no required values on a struct. It would be a nice feature but there's ways to construct the program so you don't really need it.

    • @dhruvsaxena8254
      @dhruvsaxena8254 4 місяці тому

      Hi Tom, can you please share some ways to handle the construction with having the required check,

    • @TomDoesTech
      @TomDoesTech  4 місяці тому +1

      @@dhruvsaxena8254 you can't get your editor to tell you that it's required, but you can use the builder pattern and either return, or panic in the build method if a field is missing.

  • @IkraamDev
    @IkraamDev 4 місяці тому +1

    Great video, pointers take some time to get your head around.
    Editing goof around 4:20 lol

    • @TomDoesTech
      @TomDoesTech  4 місяці тому

      Don't point it out lol 😂

  • @samarpanharit4268
    @samarpanharit4268 4 місяці тому +1

    Nice video

  • @avg_user-dd2yb
    @avg_user-dd2yb 4 місяці тому

    Should i learn node js or go, iam so confused?

    • @TomDoesTech
      @TomDoesTech  4 місяці тому

      Are you trying to get a job? JavaScript

    • @avg_user-dd2yb
      @avg_user-dd2yb 4 місяці тому

      @@TomDoesTech want to get into backend and actually also looking for a job,I have tried both but i really want to stick to one and go deeper into it, what do you suggest?

    • @TomDoesTech
      @TomDoesTech  4 місяці тому +1

      @@avg_user-dd2yb I think your chances of getting a job are higher if you focus on node

  • @kirakira160
    @kirakira160 4 місяці тому

    Cool next goroutine and concurrency?

    • @TomDoesTech
      @TomDoesTech  4 місяці тому

      Yeah, I think that's a good idea

  • @coder_one
    @coder_one 4 місяці тому +1

    It is a great pity that such a pleasant language as Go is not null safety.... :(

    • @TomDoesTech
      @TomDoesTech  4 місяці тому

      To be honest, it's rare that I come across these issues. That's why I suggest to not use pointers to make properties optional

    • @jalalle1995
      @jalalle1995 4 місяці тому

      It's more common in js where everything is nullable

    • @coder_one
      @coder_one 4 місяці тому

      @@jalalle1995 We're talking about Go, so stop getting unhealthily excited about JavaScript and making empty comments about it.

    • @jalalle1995
      @jalalle1995 4 місяці тому

      ​@@coder_one let me rephrase it, null bugs are more common in languages where everything is nullable

    • @coder_one
      @coder_one 4 місяці тому

      @@jalalle1995 do you have some kind of programming complex that the only thing you can write when the conversation is about the Go language is that in other languages are like this and like that? Seriously, who cares? Grow up boy!