61
deman
30d

I'm learning golang currently. I 'designed' a mug to keep myself motivated. Turned out pretty good.

Comments
  • 7
    I love that. Where can I get that?

    Also welcome, fellow gopher
  • 4
    @frogstair I just uploaded the gopher svg, arranged it and added some text. I think there are plenty of webshops in the US (or where are you located), which offer such a service. It was about 12-13 EUR + shipping costs.

    Thanks for welcoming me, but I think it will need some more time, to become good in go. Currently trying to initialize a slice of structs in an extra function... Maybe the mug will motivate me again later.
  • 2
    @deman why not just use make()?
  • 2
    @frogstair I am actually not sure about what is best practice. I created a struct "Runes" for runes (the viking stuff, not the larger byte type). Then I just created a slice named "rune", which contains 24 runes from the elder futhark, their name, the number value, normal alphabet equivalent and the rune itself in unicode. For now it's in the main func, but to keep it clean I want to put it in an own function, so I can call it. Dunno if it's good practice.

    It's just a small "project", which I thought about, since it contains struct, slice, some math, some working on strings, loops and if/case. Just to cover the basics.
  • 2
    @deman make is in the standard library, so I think it's the best practice

    It's just make([]Runes, length)

    Also rune is a reserved token, be careful about naming your variables like that
  • 0
    @frogstair I will check it later. Thank you. Do you know of small projects on github etc.? I'd like to read some actual well written code in context to learn golang specific best practice.
  • 2
    @deman I am working on a small project at the moment, but I dont know if the code is well written (see my last rant)

    I will definitely ping you if I find/make something nice for a beginner to comprehend or use
  • 1
    @frogstair Great, thank you.
  • 2
    @deman @frogstair Hello fellow gophers!

    Nice mug!

    Also - The nice thing about go, is that the standard libs are open for you to read. So.... If you want to read some idomatic go (the go way of doing things) go read that!
    The way to init a slice is to use a make, with the size you want, then iterate over the slice using range, and init each instance. You could "go" routine it - but you will need to "wait" for it to complete before using it.
    Also - go read the go FAQ page!
  • 0
    @deman @magicMirror yes! If you are using VsCode, you can Ctrl+click on a function, it will take you to it's declaration and you can read through it
  • 2
    Ohh Go. Any good (and checked) resources for advanced use? Currently digging some open source project in Go and I want to contribute with more advanced stuff
  • 1
    @arfro github > topics > go
    There is so much advanced stuff there, mostly advanced actually
  • 1
    That should definitely be a post of #wk211 - you made it.

    Sorry for the pun.
    Congratulations on the awesome mug, btw.
  • 1
    @frogstair oh i think you misunderstood, I'm contributing already to one project, it's going good but I want to put my hands on more advanced features and I feel like I'm lacking some Go specific knowledge
  • 0
    shut up and take my money
  • 0
    I want it
  • 0
    I love this
Add Comment