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

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

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

Create account Log in
Cover image for Hello World in Goby
Jeremy Grifski
Jeremy Grifski

Posted on • Originally published at sample-programs.therenegadecoder.com on

Hello World in Goby

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.

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/gobybrew install gobygoby -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.

Top comments (4)

Collapse
 
vicoerv profile image
Vico

why not just use ruby?

Collapse
 
renegadecoder94 profile image
Jeremy Grifski Author

I always find it interesting when I get comments like this even after a year of writing about all kinds of programming languages. That said, here's the Hello World in Ruby article.

Collapse
 
st0012 profile image
Stan Lo

Hey Jeremy, I’m the author of Goby and just found this great post (how come nobody share this with me!!).
Thank you so much for trying out Goby and even wrote this article ❀️

Collapse
 
renegadecoder94 profile image
Jeremy Grifski Author

Of course! Thanks for putting together the language.

Update Your DEV Experience Level:

Settings

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