logo
0
0
Login
Forkfromexamples/ecosystem/go-private-repo-server, ahead:master3 commits

Building Go Projects with Private Repository Dependencies

badge badge badge

In this example, you will use Cloud Native Build (CNB) to implement "go-private-repo-server" as a private Go repository dependency.

Prerequisites

  1. Use Cloud Native Build (CNB) to build your project
  2. Write a Dockerfile
  3. Declarative build cache
  4. Understand environment variables and their usage
  5. Learn how to use Docker Artifact Repository

Dependency Analysis

Key Points for Building Private Repository Dependencies in CNB

  • Configure pipeline with GOPRIVATE and GONOSUMDB environment variables
  • Configure git credentials:
git config --global url."https://${CNB_TOKEN_USER_NAME}:${CNB_TOKEN}@cnb.cool".insteadOf "https://cnb.cool"

Key Points for Local Development with Private Repository Dependencies

  • Add these environment variables to your .bashrc or .zshrc:
export GOPRIVATE=e.coding.net,cnb.cool export GONOSUMDB=e.coding.net,cnb.cool
  • Configure .netrc with your CNB personal token:
machine cnb.cool login cnb password xxxxxxxx

About

No description, topics, or website provided.
Language
Markdown63.5%
Go18.9%
Dockerfile16.9%
gitignore0.7%