Small Lesson About Pointers and Slices in Go
Today I learned a little bit more about how pointers work in Go.
We had this object that we want other functions to directly modify. So we pass a pointer to this object to various functions and then in our tests we check to see that the original object has been modified correctly. We also have these helper functions that are supposed to return a pointer to an object buried inside of the struct.
Creating Your Own BeforeEach in Go
I’m developing my own budgeting app using Go and have been using it to learn new things as well. For testing, because I’m TDD’ing the entire project, I decided to just use the built-in Go testing framework. I use Ginkgo at work and enjoy it, but decided to see what vanilla testing in Go is like.
After writing a bunch of tests for a lot of my boilerplate functions, I quickly had a lot of duplicated set-up code that looked like this at the start of all my tests:
Halo Helmet
This year, I decided to participate in my company’s halloween contest. My Instagram news feed usually has a few cosplayers on there, and they started inspiring me to try and build a costume of my own. First I thought of dressing as Geralt from the Witcher, since I’m still in the middle of playing Witcher 3. All the sewing and fabric cutting got me a bit nervous though. Then I came across a video of a cosplayer showing how she built armour and she made it look SO easy!
Creating a Custom Chooser
Sometimes you want to modify some of the defaults that appear in the chooser, like when you’re sharing a text or image to any other android app that can accept text or images. The most common use case for this is when users press the “Share” button in your app.
To create the custom chooser, you use the ShareCompat.IntentBuilder class.
String title = "Share weather details"; String mimeType = "text/plain"; String shareText = "I want to share this string"; Intent intent = ShareCompat.