DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 968,873 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Day 2 of #30DaysOfCode
Shubham Saurav
Shubham Saurav

Posted on

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

Top comments (0)

DEV has this feature:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. πŸ›