---
metadata:
  - name: generator
    content: Diplodoc Platform v5.57.3
alternate:
  - https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/go-get.md
  - https://sourcecraft.dev/portal/docs/ru/sourcecraft/operations/go-get.md
  - href: en/sourcecraft/operations/go-get.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt

# Using a SourceCraft repository as a Go package source

<!-- source: en/_includes/sourcecraft/go-get-description.md -->
In SourceCraft, you can use public [repositories](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md#repos) in public [organizations](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md#org) as a source of packages for projects in [Go](https://go.dev/).
<!-- endsource: en/_includes/sourcecraft/go-get-description.md -->

1. [Install](https://go.dev/doc/install) Go.
1. Create a project directory and navigate to it:

    ```bash
    mkdir <project_directory>
    cd <project_directory>
    ```

1. Initialize a new Go module to manage dependencies:

    ```bash
    go mod init <module_name>
    ```

    Result:

    ```text
    go: creating new go.mod: module test-module
    ```

    [Learn more about the `go mod init` command](https://go.dev/ref/mod#go-mod-init)

1. Upload the third-party package and add it to dependencies:

    ```bash
    go get sourcecraft.dev/<organization_name>/<repository_name>@<tag>
    ```

    Here is an example:

    ```bash
    go get sourcecraft.dev/project-golang-test/golang-lib@v1.0.0
    ```

    Result:

    ```text
    go: added sourcecraft.dev/project-golang-test/golang-lib v1.0.0
    ```

    [Learn more about the `go get` command](https://go.dev/ref/mod#go-get)

#### Useful links {#see-also}

* [Code in SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md#code)
* [Working with packages](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/index.md#packages)
