Using a SourceCraft repository as a Go package source

In SourceCraft, you can use public repositories in public organizations as a source of packages for projects in Go.

  1. Install Go.

  2. Create a project directory and navigate to it:

    mkdir <project_directory>
    cd <project_directory>
    
  3. Initialize a new Go module to manage dependencies:

    go mod init <module_name>
    

    Result:

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

    Learn more about the go mod init command

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

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

    e.g.,

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

    Result:

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

    Learn more about the go get command

See also