Spreading Go Through Education: Two Merpay Engineers Talk About Programming Languages

日本語記事を読む

Go is a programming language developed by Google. Although it has a relatively short history compared to other languages, its benefits include simple language design and syntax, abundance of standard libraries and tools, and its ability to handle parallel processing. It was used when creating Souzoh, a former part of the Mercari Group. Products like Mercari Atte and Kauru were developed using Go, and banner tools on the Mercari app use this language as well. The recent migration to microservices has also seen a significant amount of code rewritten in Go.

Our company is home to members who, in addition to using Go for day-to-day development, are also spreading the language through education. Those members are none other than Takuya Ueda from Merpay’s Expert Team and Yoshiki Shibata from the Backend Team.

As passionate members who run events and study sessions both internally and externally, the two discuss why Go is special and why they were fascinated by it. They also talk about some issues in Merpay’s development teams that were found when using Go. Our engineers begin their discussion about Go and talk about their personal interests as well.

Why we started using Go – Simple curiosity

Ueda: My first time using Go was when I was a university student, so I believe it was in 2010. I was using Java for computer simulation research, but I wanted to do more. I discovered Go when trying out new languages.

Shibata: That was when Go hadn’t even reached version 1. At the time, I think the compiler (a type of program used for automatic programming) and linker (a linkage editor) were still separate.

Ueda: Yeah. It’s kind of nostalgic, looking back now (laughs). Shibata, why did you start using Go?

Takuya Ueda (Merpay Expert Team)

Shibata: I’m not sure why I remember the exact date, but it was August 2010. I was working with some other young engineers at the time, and we mentioned that we wanted to have study sessions to learn a new language. That’s how things started. There weren’t any Japanese books about Go at the time, so we thought about writing our own and got really excited at the idea. I became the translator and got more and more involved in making technical books and documents about Go.

Ueda: This happened before Go was officially released, so the language specifications weren’t fixed yet. We were kind of just making the book and figuring things out at the same time.

Shibata: I used C++ to program embedded systems for a long time, but something about Go was mysterious to me. Even if the programming itself was buggy, local variable addresses always got responses for some reason. Nowadays, I almost always use Go when making small tools. Speaking of which, the new Go1.13 is being released soon, right?

Yoshiki Shibata (Merpay Backend Team)

Ueda: The beta’s already out, so I’m looking forward to the August release.

The best part of Go is its simplicity

Ueda: One major benefit of Go is that you can get a rough idea of the code’s state by compiling. With other languages, it’s not uncommon to have to spend an entire day just to find a typo. There are times when we’ll spend hours searching, only to end up with a conclusion like “oh, I missed an ‘s’ over here…” Go is great because it doesn’t involve any wasted time like that. Of course, unit tests can be done when using other languages but the actual process of finding typos is generally very difficult. Also, having gofmt (one of Go’s tools) is a huge plus. If I write some really rough code and save it, I can have it automatically formatted.

Shibata: When the formatting gets messy after I copy and paste something, I can have everything rearranged when I save it. For me, being able to develop with Vim is also a huge benefit. For other languages, using an IDE (integrated development environment) is more efficient using Vim, but Go allows for development using just a plugin. Those are some of the advantages. When I worked at Ricoh, I took on a project where I used Go to rewrite controller software for hardware control, for things like scanner and printer engines.

Ueda: That sounds amazing!

Shibata: The controller software codebase used up to that point had a lot of limitations. To address that, the members who were part of the Go study sessions wrote everything from scratch and worked entirely using test-driven development. Although it took about two years, we were able to complete it. With that development, we were running the Go-written controller software and test programs all night. If we left the office with a test running and came back the next morning to find it stopped, we would need to investigate the cause. For these situations, we had a system where instead of the person who wrote the code, the person owning the development PC used to run the tests would investigate. Since younger engineers generally have less experience, we made it clear that if they couldn’t find the solution after two hours of research, they should ask someone for help.

Ueda: That sounds really good because it means that both young and senior engineers are randomly chosen to read code written by other people. Merpay also utilizes code reviews, but I’d have to say that there are lots of cases where it isn’t so in-depth. This kind of method might be good for Merpay to adopt.

The reason we engineers want to provide Go education

Shibata: This is where I want to talk about our efforts to expand the usage of Go.

Ueda: Let’s get started!

Shibata: As mentioned before, there were very few Japanese resources about Go when I started using it, so I got involved with making books and documents as a translator. Ueda hosted internal and external events and study sessions. Why did you choose education specifically as a means of spreading Go?

Ueda: First off, Go is a very easy language to teach. Deploying it into a development environment is easy, and roughly-written code is automatically formatted when you save. Even lectures about making web applications can be run simply by preparing a Go development environment. Because of that, I teach at my lectures using dev content that can be used with command line tools and web apps.

Shibata: Do you give any assignments?

Ueda: For the final project, I have participants take all the knowledge they’ve gained to produce some kind of output. For example, “make a tool to solve a problem faced by students.” As expected, people will learn and remember much more when they work on something that they’re interested in.

Shibata: So you run lectures in a systematic way.

Ueda: Yeah. This is one reason why I’m using lectures to spread Go, but to be honest, you don’t need to read books about Go to learn it. At the same time though, if you learn it randomly and without any sort of system, you’re likely to end up with very limited knowledge. There are some Go-related specs that are only written in books. Even if you use Go in real situations, it’s likely that you’re only using it in a limited scope. One reason I’m holding these lectures is to increase the number of opportunities to acquire Go knowledge systematically.

Shibata: I see! While I was doing translation at my last job, I was also working on Go research with a different company. I was doing most of this research using a specific textbook, but after presenting the results, everyone agreed on two things: “That’s probably the first time I read a technical book from start to finish” and “that was a fantastic experience.”

Ueda: (Laughs) What kind of Go training do you do, Shibata?

Shibata:I have students prepare by readingThe Go Programming Language, the Go textbook used for the training sessions. Students read the designated content needed to prepare for the course, write down questions on a list, and upload their answers to the practice problems on GitHub. During lectures, we discuss answers to the questions on the list, and solve practice problems. We run the training course this way for 6 months. I still run this course with other companies as a side business.

Ueda:So you’ve been doing this for quite a long time.

Shibata:”The Go Programming Language” has over 130 practice questions, so it’s pretty tough (laughs). What I want students to achieve during this training is to experience “reading” a text. It’s easy to pick up Go just by browsing through online resources. That’s why I want learners to pick up a “Go Bible” so to speak, and read through all of it just once. I also want participants to learn through hands-on training.

Ueda:Good point. It seems like most people out there only do the reading part. There aren’t that many books out there about Go, so it shouldn’t take long to read them all anyways.

Issues with Merpay’s development environment that we found through Go

Shibata:I heard that the Mercari Group has been using Go since the early stages. Was Souzoh the reason it was fully adopted?

Ueda:Yes. We decided that Souzoh would develop everything using Go. After that, I think the entire company decided to adopt Go as well. It really took off after Merpay was founded.

Shibata:I personally chose Merpay because it was an opportunity to use Go for software development and work together with lots of younger software engineers. I’m now part of Merpay’s Backend Team, and we’re switching to Go Module (a management system for Go’s new modules), but we’re not using it for anything more elaborate than that.

Ueda:That’s right. As mentioned earlier, even if you try to learn Go development through real tasks in the workplace, it doesn’t mean you’re learning in a systematic way. That’s because learning just what’s needed for day-to-day development is enough. Go is also a new language, meaning that there aren’t many opportunities to learn it systematically.

Shibata:So you’re saying that if you really want to master Go, you have to try solving some high-level tasks?

Ueda:Yep. That being said, if people are going to get started with Go, I hope to see everyone learn it to some degree. The challenge is that day-to-day development doesn’t present many situations requiring the use of goroutine (used in Go to attach a keyword and call a function, similar to a lightweight thread).

Shibata:The memory model is one thing that’s difficult even after gaining an understanding of Go, although it’s used in Java as well. Two difficult aspects are the definition of a memory model, and whether or not you can read goroutine, one of Go’s main functions. It’s really difficult because most people don’t have a solid understanding of memory models themselves.

Ueda:Official documents do explain memory models, but it can’t be fully comprehended without doing some debugging.

Ueda:True. Fundamental goroutine and channel functions are written in the language’s specs. However, Go’s memory models are written separately from the language specs. I think it’s difficult to interact with them in day-to-day work.

Ueda:These are some of the deeper challenges that still exist when using Go development environments. That’s exactly why the company is proactively running initiatives like ”Go Friday,” a study session and lecture to help members learn the language systematically. Fortunately, nearly everything related to Go is written in the language specs or in the FAQ. Since documents are available, we simply let engineers know that they should check the official website when they need to look something up. There are also some great blog posts from 2013 to 2014.

Shibata:Detailed checks are even more important with these resources because they’re updated periodically. The least we want at Merpay and Mercari is for people to read about Go, learn what it is, and continue that learning process. For Merpay, it might be a good idea for engineers to hold periodic FAQ-reading sessions (laughs).

Ueda:That might be a good idea (laughs). Our efforts to deepen everyone’s understanding of Go are far from over!

Takuya Ueda

Started with Go during his university years and has been immersed ever since. Works as a member of Merpay’s Expert Team and uses Go as a backend engineer. Google Developer Expert (Go). Runs internal and external training sessions to spread the usage of Go. Organizer of Go Conference and also runs golang.tokyo, Go Beginners, and GCPUG Tokyo. Likes drawing Gopher, the mascot. Wants humanity to become Gophers.

Yoshiki Shibata

Works in software development. Starting in 2000, he worked on translating The Go Programming Language (Maruzen Publishing) in his free time. He has been running Java training programs since 2000 and Go training programs since 2016. He now works for Merpay as a backend engineer, developing in Go.

Related Links Check out these articles too!✨

Follow us for updates!