Log in from a computer to take this course

You'll need to log in from a computer to start Learn Go. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store

Previously, we imported a single package, fmt. But, we can import so many more! Go has an extensive list of packages that we can take advantage of. Here’s a list of Go’s standard packages

To import multiple packages we can add multiple import statements, like so:

import "package1" import "package2"

Or we can use a single import with a pair of parentheses that contain our packages:

import ( "package1" "package2" )

Notice, when using an import with parentheses, we’re not separating each package with a comma. Instead, each package is on a different line.

We can also provide an alias to a package by including the alias name before the file. Including an alias will make it easier to refer to the package without typing out the full package name:

import ( p1 "package1" "package2" )

In the example above we’ve aliased package1 as p1 and now we can call functions from package1 by using p1 like:


Instead of:




In main.go, we have our “Hello World” program set up.

Let’s import another package, "time".


Assign an alias of t to the time package.


Inside of main, let’s use the time package add the line:


The line provided will print the current time using both the fmt and time packages.

Note: the time printed will be UTC time zone.


Run the program using the command line and the command go run main.go. Press enter to see the time printed out!

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?