DEV Community

Cover image for Day 2 of #30DaysOfCode
Shubham Saurav
Shubham Saurav

Posted on

2 2

Day 2 of #30DaysOfCode

Today, I started my day with writing Go Code. I learnt about Byte data type, saving data to a file and then reading them. I wrote some error handler function to handle errors in my program. After writing code for all of this, I wrote a function to generate pseudo-random numbers. I had to dig into the documentation a lot deeper than I expected to get it working. Fun fact: Randon number generation in Computer Science still is an impossible task.

After generating pseudo-random numbers, my program was almost over but it needed a bit of testing. So, I learnt some testing in Go. One thing that I want you to take out of this post is that testing is a bit different in Go than other languages. You don't need any testing frameworks like mocha, jasmine, selenium or RSpec. Go has a built-in testing functionality that lets you test Go code. All you need to do is to end your code file with _test.go and run the go test command to test your program. Go will automatically run all the tests in your files.

After writing my test and verifying them, I was happy and satisfied with myself and I started writing this post. So, here we are.

Alright! that's all for today and hopefully, I will see you in my next post.



Image Credit: Kyle The Dev

Connect With Me:
Youtube: ShubhamSauravYT.
Twitter: @hiShubhamSaurav
Instagram: @hiShubhamSaurav
Facebook: @hiShubhamSaurav

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay