In this article, we’re tackling Hello World in Goby, a Ruby-like language written in Go. For the most up-to-date version of this article, check out the official documentation.
Table of Contents
According to the GitHub project, Goby, formerly known as Rooby, is a Ruby-like language written in Go. The goal of the language is to provide a small environment for building microservices and API servers.
- Concurrency Support
- Builtin Multi-threaded Server
- Plugin System
For anyone who would like to give the language a try, Goby can be installed and ran in REPL mode with the following commands:
brew tap goby-lang/goby brew install goby goby -i
Alternatively, you can try running all the sample code snippets using the samplerunner script included in the repo:
./samplerunner.sh run -l goby
In the following sections, we’ll cover the solution and how to run it.
How to Implement the Solution
As seen many times in this collection, Hello World in Goby is actually really simple. In total, it’s one line of code which looks a lot like Ruby:
Alternatively, we can leave out the parentheses:
puts "Hello, World!"
In either case,
puts writes the “Hello, World!” string to the user on standard output. That’s it!
How to Run Solution
To run this solution, we can take advantage of the samplerunner script included in the Sample Programs repo. If our system is setup correctly, the following command should get the job done:
./samplerunner.sh run -s hello-world.gb
Alternatively, we may want to get a copy of the Goby interpreter. According to the documentation, there are a few ways to do that, but we won’t dig into that now.
Unlike many other languages in this collection, Goby does not have an online interpreter at this time.
Sample Programs in Every Language
It’s been a long time since I published one of these articles. In fact, I wasn’t planning on doing it again with the sample-programs subdomain up and running. However, I ultimately decided that it was best if I could both support that website and this one simultaneously. As a result, I’ve begun cross-posting new sample-programs articles here.
Honestly, I’m pretty excited for the change. I can continue writing fun technical content on the other site while adding a personal flair here. Also, when I post here, the new content goes out to all my subscribers, so I expand my reach. It would be silly not to!
As always, if you like this series or you just want to show your support, find your way over to my membership page where you can subscribe.
I'm embracing the virtual world and moving all of my computer science exams online. Here's why!
Amid all the chaos of my daily TODO list, I was able to find order by sorting my tasks by my values. Maybe you'll find some "value" in this tip as well.