Conf42 Golang 2023 - Online

golings - a tool for beginners learning golang

Video size:

Abstract

I am the author of the golings (https://github.com/mauricioabreu/golings/), a golang version of the very famous rustlings (for the Rust programming language). Designing the tool and the exercises has been a cool journey. How to better teach a programming language interactively?

Summary

  • Golings is a tool to help beginners to learn the programming language by fixing small problems. I created golings because I believe in fast feedback while learning new programming language. All the exercise can be found in the director Golings exercises. They are ordered by the difficult.
  • Ato, like Golang, shines by giving you fast feedback. Fast feedback is something very important to me, and I believe that it's very important for beginners as well. If you feel like your exercises will be useful to other beginners, other students of the language, I would be very happy to review your pull request.
  • You can add a function to a struct by adding code similar to the one below. I think it's a good hint to the person so they can explore in the Internet books to find the answer. Now it outputs the error and you can ask a heat for go links.
  • And now we have a new exercises. I hope you have enjoyed this talk. If you want to know more about the project, you can send me DM on Twitter or find me on GitHub.

Transcript

This transcript was autogenerated. To make changes, submit a PR.
Welcome to my talk about buildings. Well, let's start explaining what is Golings. Golings is a tool to help beginners to learn the programming language by fixing small problems. This is malpractice. They have some errors in the problem so you can compile them before you fix them. And there are some other exercise that they are actually tests. So you need to make the tests pass so you can go to the next exercises. The tests are already written in go. So your task is to fix the test so you can remove the comment that I will explain later. I'm not done and you can go to the next exercise. So why I created golings? Well I created golings because I believe in fast feedback while learning new programming language. So go links like rust links for rust and zig links for zig. They behave the same way, they work the same way. You have a tool, a binary that you can install in your computer, a program and this programming. You can also download the list of exercise and a file that is indexed for all this exercise and you can run go links to verify if you check if your exercise are correct after trying to fix them trying to fix them. So this is what Golings is. Now I will show you the repository and here you can find Golings GitHub. So you have pretty good documentation here it can guide you installing the program. You can install it either by using the go install comment or finding a binary for your operating system and architecture here in the releases page. Okay, after downloading go installing go and cloning the repository and installing the golings binary, you can start to fix all the exercises. Right. All the exercise can be found in the director Golings exercises and the top q one sugar the file the file infotomo. It has a list of all the exercise. They are ordered by the difficult. So if you start right now, the range of difficulty of the exercise will be from the most east to the most hard exercise to the harder exercises. Okay, let's try go links. Okay, before I go into the attempt of fixing some exercise, I want to give you my thoughts about fast feedback and a little more detail on why I created the goal links for the goal language. I believe in fast feedback because when you are reading a book, the book has a lot of theory that is very important and necessary. But some books they don't have the fast fit backup beginner needs. Sometimes, even if you are experienced programmer, you know most of the theory behind the programming language. So you are used to learning new programming language. So it gets easier with time and you want fast feedback because you want to learn faster and you don't want to get stuck by reading a huge book before typing some code. So this is where Ato, like Golang, shines by giving you fast feedback. And fast feedback is something very important to me, and I believe that it's very important for beginners as well. Now, how does Goldink work? When you want to try gold links, you can run gold links. Let's install so I can copy it here. Okay, it's installed, it's already cloned, right? And you can type go links. Run next. Go link is run. Next is a comment to run the next exercise that you haven't fixed it yet. Now after running the comment, we can see that it tried to compile the exercise. It has an output of the error of the compiler, right? It says that there is a syntax error in your program. It was expected to have the variable was expected to have a name. Variables in go have names. You can declare it either with VAR or with column before they cosign. And also you can see that in the end of the output of the comment, it tells you if you are stuck trying to fix in the program, you can ask a hint to the program and all the hints are declared in the promo file. So let's ask a heat for the program. Okay, variables that have names. Yeah, let's open the exercise and fix it so you can go to the next. There's another comment called Golings. Golings verify it runs all the exercise from the first to the last to check if you succeed by fixing all the exercises. Okay, it stopped it in the first because you haven't fixed it yet. Variables. Let's open the program here and we need a variable. The printf call here, it says that it has a message. The first argument of print chef is a format string, right? It's a message. And the next parameters are the variables that must be interpolated here. So it says that x has a value, the value and the format. It's integer. It's how you represent an integer when formatting a string. So we need to add the axe name here and it will compile. Let's check go links. Run next. Okay, it says we are done and it now passes the compiler rules and the programming outputs what we were expecting. Nice. We can remove the comment. The comment is what makes you that? When we remove the comment, go links know that we want to go to the next exercise, right? If you don't remove it here after fixing the problem, it won't run the next exercises. So let's remove okay, now it goes to the second exercise. It tries to compile and it failed to complete. You now can ask another hint to the problem. It says that we miss a symbol used to declare initialize variable variables. Now you can open it here, right? And you can declare the variable the right way using the column and I can remove it here and run the verify. It runs the first for the second. It runs all the exercise. This is how golings work. Let's add a new exercises to the Golings repository so it will go to the main upstream. Actually go links is a tool that works with any folder, with any exercises. We can have your own exercises. You just need to have your own thumb file to describe the exercises. Your own exercises actually. But if you feel like your exercises will be useful to other beginners, other students of the language, I will be very happy to review your pull request so we can merge it to the upstream branch. Okay, let's create a new exercises here. Struct okay, we can copy copy this can copy create a new folder. Struct three. Now we can copy the second exercise. Let's do something similar. Great. Okay, let's move it here it is just a comment. Let's create an exercise that it must print the person full name, right? So we can change the message here. Person full name is and use the s person s. It means that you are format I string and full name is a string. Change name replace name by first name and surname. It's also string. Let's do the structure with the right attributes. It's not. Let's put my input my name here. Well, one of the problems of any kind of this cool is that the problem just it just passed the compiler. It must obey the compiler and if the compiler is happy, you will succeed. So we can add comments to make the person that is using all links to help the person to know what they need to achieve. Like here it must be. It must output person full name is Maurice. Okay, let's add this exercise will be about adding a function to a struct. So we need to create the exercises. Added exercises here. Strep three actually two. So I can edit right after the second exercises. Guys, about structs. Struct three struct tree since it is. Let's add a hint. You can add a function to a struct by adding code similar to the one below. Funk the something structure here the something. I think it's a good hint to the person so they can explore in the Internet books to find the answer. The something return. Let's submit it here. We already covered the function, so they will know that functions can have return types return values actually with a type. Okay, now let's change this comment, golings. There's a way to run a specific exercises, so let's run it stripped three. Okay, now it outputs the error and you can ask a heat for go links. And now we have a new exercises. Well, this is golings. I hope you have enjoyed this talk and if you want to know more about the project, if you want to know how it works in details and help with new features or issues, you can send me DM on Twitter or find me on GitHub. And that's all. Thank you.
...

Mauricio Antunes

Software Developer @ Globo

Mauricio Antunes's LinkedIn account Mauricio Antunes's twitter account



Awesome tech events for

Priority access to all content

Video hallway track

Community chat

Exclusive promotions and giveaways