> ## Content Index
> Fetch the complete content index at: https://blogs.remobjects.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Importing Go Projects
- URL: https://blogs.remobjects.com/2020/06/18/importing-go-projects/
- Published: 2020-06-18T14:20:27.000Z
- Updated: 2020-06-18T14:20:27.000Z
- Author: marc hoffman
- Tags: #Import 2026-08-17 20:17

One of the main use cases of the [Go](https://www.elementscompiler.com/elements/gold?ref=blogs.remobjects.com) language with Elements is to use functionality from one of the countless existing Go libraries in your own project. Of course, it is always possible to just add the `.go`source files to your project directly, but for using complete libraries there's an easier way: Go Imports.

The [EBuild](https://docs.elementscompiler.com/EBuild/?ref=blogs.remobjects.com) command line tool offers a special option to import a Go library project – along with all its dependencies – from a git repository, create one or more`.elements` projects from it for you, and build it — so that all that is left for you to do is add a [Project Reference](https://docs.elementscompiler.com/Projects/References/ProjectReferences/?ref=blogs.remobjects.com) to the project where you need it.

This mode of EBuild is run by specifying the `--import-go-project` command line switch, alongside the URL of the Go project (same as you would pass it to "`go get`") and a set of additional parameters. e.g.:

```sh
ebuild --import-go-project github.com/nakagami/firebirdsql

```

Since pretty much all Go libraries depend on a fully covered [Go Base Library](https://docs.elementscompiler.com/API/GoBaseLibrary/?ref=blogs.remobjects.com), Go Import is only supported for [.NET](https://docs.elementscompiler.com/Platforms/NET/?ref=blogs.remobjects.com) and [Island](https://docs.elementscompiler.com/Compiler/BackEnds/Island/?ref=blogs.remobjects.com)\-based projects.

## **How the Import Works**

The import will determine the base URL of the repository specified by the URL. Supported are GitHub repositories, `gopkg.in` URLs, as well as any valid git URL or any URL that supports the `?go-get=1`parameter.

It will clone that URL into a folder underneath the output folder and generate a `.elements` project containing all `.go` files within the specified subdirectory.

It will then check the `import` sections of all these `.go` files for additional external dependencies, and repeat the same steps, recursively if necessary, until all dependencies are covered.

A separate `.elements` project will be generated for each repository; if imports dependencies request subdirectories of the same repository, the project for that repository will be extended to include the additional files.

Optionally, the root project and all its dependencies will be build using a regular EBuild build run, as the final step.

![](https://blogs.remobjects.com/content/images/2019/09/image-1.png)

Once imported, you can use the generated main `.elements` file in a [Project Reference](http://docs.elementscompiler.com/Projects/References/ProjectReferences/?ref=blogs.remobjects.com) from your actual projects. (I would recommend against openign the imported projects in an IDE, because the solution can cecome *huge* for some imports, we;'re talking hundreds ot projects).

Read more about Go Imports on our docs site [here](https://docs.elementscompiler.com/Tools/GoImport/?ref=blogs.remobjects.com).

![](https://www.remobjects.com/images/product-logos/language-go-1024.png)