Hello World in Goby

Hello World in Goby Featured Image

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 documentationOpens in a new tab..

Table of Contents

Goby Background

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.

Beyond that, the project didn’t have much to offer in terms of use cases or samples. That said, the official website does give a few examples of language features including:

  • 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:

puts("Hello, World!")

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.

Sample Programs in Every Language (44 Articles)—Series Navigation

For 100 Days of Code, I’ve decided to implement a few sample programs in as many languages as possible. Each implementation details a brief history of the language and a description of the code.

The plan for the series is to explore the major general-purpose language like Java, Python, C, C++, and C#. From there, we’ll take a look at some sample programs in web development languages like Ruby, PHP, and JavaScript. As we continue, we’ll cover proprietary languages like Swift and Objective-C. Eventually, we’ll start to tackle less popular languages like Rust, x86, and Verilog. Finally, we’ll play around with some of the esoteric languages like Brainf*ck and LOLCODE.

Who knows? Maybe the Sample Programs in Every Language series will become so popular it’ll never end. To help this series grow, consider sharing it on social media with your friends. Or, if you have a language you want to see, drop your suggestion in the comments.

Jeremy Grifski

Jeremy grew up in a small town where he enjoyed playing soccer and video games, practicing taekwondo, and trading Pokémon cards. Once out of the nest, he pursued a Bachelors in Computer Engineering with a minor in Game Design. After college, he spent about two years writing software for a major engineering company. Then, he earned a master's in Computer Science and Engineering. Today, he pursues a PhD in Engineering Education in order to ultimately land a teaching gig. In his spare time, Jeremy enjoys spending time with his wife, playing Overwatch and Phantasy Star Online 2, practicing trombone, watching Penguins hockey, and traveling the world.

Recent Posts