└── readme.MD /readme.MD: -------------------------------------------------------------------------------- 1 | # Go-Gotchas 2 | 3 | Hey there! Do you know I send a weekly Golang newsletter/tutorial? You can [subscribe here](https://goatspeed.substack.com/) 4 | 5 | ## Some gotchas, tricks & snippets to show Golang principles. Shorten your learning curve! 6 | 7 | A repository for snippets I've posted on [Twitter](https://twitter.com/GolangAtSpeed) and sometimes [Linkedin](https://www.linkedin.com/company/GolangAtSpeed/). All are in the Go Playground for you to experiment with. 8 | 9 | ## Why? 10 | 11 | I'm Ollie, I'm based in the UK and I offer Go Training, on-site with you, or 12 | fully hosted off-site. I love coding in Golang (I've worked in Fintech and Healthtech for lots of years), and I want to help others get there a bit quicker than I did - Go is simple, until it's not :) 13 | 14 | Check out the [GolangatSpeed website](https://golangatspeed.com) or, get in touch for more information --> Training@GolangAtSpeed.com 15 | 16 | ## There are no answers here, only questions ;) 17 | 18 | For now organised in chronological order (sorry about the hiatus between June and August - blame Covid!) 19 | 20 | ### March 2020 21 | 22 | - [Same string different lengths. Wha?](https://play.golang.org/p/ujUnmx-LsWu) \#strings 23 | - [Omit that time. It is empty!](https://play.golang.org/p/X9g27jPpFej) \#time 24 | - [Never rely on Sorcery. It's not guaranteed to work forever..](https://play.golang.org/p/81LRVLTXk5L) \#builtin 25 | - [Print my list in a Goroutine. Where is it?](https://play.golang.org/p/9TXTz-rgGBX) \#goroutines 26 | - [Filthy aliasing. Avert your eyes. So NSFW!](https://play.golang.org/p/ZF-_djzT2P3) \#imports 27 | - [Imported just for its side effects, 'init?](https://play.golang.org/p/01Jl4WAoI40) \#imports 28 | - [It doesn't add up?](https://play.golang.org/p/S30PkUi_O7T) \#valuespointers 29 | - [Thirsty? Empty inter'face :baby_bottle:](https://play.golang.org/p/z7V1Qv-mf2b) \#interfaces 30 | - [Can iteration be an irritation?](https://play.golang.org/p/wgPgpzgHZAW) \#values 31 | - [The winner isn't always the one you expect!](https://play.golang.org/p/XWTKv7Y04wt) \#races 32 | - [This one is for all you reference types](https://play.golang.org/p/AzsVMTGca3t) \#types 33 | - [Why 'that' time? You know THAT one?](https://play.golang.org/p/uTZHA5_-otO) \#time 34 | - [Pass a value, pass a reference? Copycat!](https://play.golang.org/p/UjXFKuoikv3) \#copies 35 | 36 | ### April 2020 37 | 38 | - [I am determined to extend and inherit!](https://play.golang.org/p/Eg06RbUM-Ym) \#oop 39 | - [What a fussy flamin' marshal!](https://play.golang.org/p/DVqLfawKQsD) \#json \#marshaler 40 | - [What problems do interfaces solve?](https://play.golang.org/p/BVdaxNA4tIg) \#interfaces 41 | - [Embedding an interface will save you lines of code](https://play.golang.org/p/vVDAmeUF1gX) \#interfaces 42 | - [Go is not so opinionated on some things..](https://play.golang.org/p/K2zJ_0XuCgD) \#variables 43 | - [Cheeky overuse of memory by identical array](https://play.golang.org/p/ZyL1tftwhxW) \#variables \#padding 44 | 45 | ### May 2020 46 | 47 | - [Slice & Array, same length same capacity. Same treatment?](https://play.golang.org/p/U838ZjZZYE7) \#referencetypes 48 | - [Nobody will complain, but this won't work](https://play.golang.org/p/FXiCLKf-i_G) \#returns 49 | - [Add new stuff to an imported package](https://play.golang.org/p/-CDNDNV41fP) 50 | - [This doesn't add up...](https://play.golang.org/p/_uoAHQeoh9h) 51 | 52 | ### September 2020 53 | - [Empty Slice vs Nil Slice. It'll getcha!](https://play.golang.org/p/77iksaEukUX) \#compositetypes \#referencetypes 54 | - [There's something not right with my method](https://play.golang.org/p/33Qr6eZUEV8) \#compositetypes \#receivers \#methods 55 | 56 | ### October 2020 57 | - [Naff Map, sorry I mean Nil Map](https://play.golang.org/p/LmrbYWnNrpa) \#map \#compositetypes \#referencetypes 58 | - [That's a lot of capacity, do we need it?](https://play.golang.org/p/HKO1Zq9_8Ep) \#make \#capacity \#compositetypes 59 | - [When is an int not an int?](https://play.golang.org/p/QSGDPNe5Zj9) \#customtypes 60 | --------------------------------------------------------------------------------