Member-only story

Go and Julia Packages and Modules Compared

Comparing how Julia and Go deal with dependencies to other code

Erik Engheim
10 min readFeb 13, 2021
Gopher image by Ashley McNamara CC BY-NC-SA 4.0

Julia and Go are a fun exercise in how terminology can get really confusing. In Julia and Go, the package and module concepts have basically been swapped.

The Go documentation defines a module as:

A module is a collection of packages that are released, versioned, and distributed together. Modules may be downloaded directly from version control repositories or from module proxy servers.

This is pretty much the reverse of Julia. In Julia a package is what get distributed and version controlled. A package however may contain multiple modules.

In Julia modules exist at the language level providing a namespace for your types and functions. In Go packages serve that same purpose. To be honest I think Go is the language that kind of screwed up in this case. Go began by rolling the idea of a namespace for code and the versioning and distribution of that code all into one concept called package.

Long term this was not a practical solution because Go did not offer a good way of specifying which particular version of a package your code depended on.

In Julia I can write the code:

using Greetings

--

--

Erik Engheim
Erik Engheim

Written by Erik Engheim

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

No responses yet