Help us shape the future of Go! Take the 2026 Go Developer Survey

compose

package
v2.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package compose ingests Docker Compose files and the .env files they read into the code graph, so how deployments address each other is graph data rather than something a reader has to go and look up.

A compose service becomes a Deployment node; each environment key it passes and each service it depends_on becomes a references edge. An .env key becomes a Config node holding its value. Nothing here decides what calls what: the service map follows these edges and expands ${VAR} through Config nodes, and a value that names another deployment is the address one service uses to reach it — the same evidence whether the stack is Go, Kotlin or nginx.

Like the Kubernetes scan, this is a line scan, not a YAML parse: compose files interpolate ${VAR:-default} into places a strict parser rejects, and a scan keeps every other service when one block is malformed.

Values are credentials often enough to be treated as such: a key that names a password, secret, token or key keeps its name and loses its value, and a URL's user:password@ is dropped before anything is stored.

Index

Constants

View Source
const (
	KindDeployment = "Deployment"
	KindConfig     = "Config"

	// ExtraRef says what a Deployment's references edge is: RefEnv (Target is
	// "env:KEY", ExtraValue the inline value when the file sets one),
	// RefDependsOn (Target "deploy:NAME") or RefBuild (Target the Dockerfile
	// path as written, possibly ${VAR}).
	ExtraRef     = "composeRef"
	ExtraValue   = "value"
	RefEnv       = "env"
	RefDependsOn = "depends_on"
	RefBuild     = "build"
)

Node kinds and edge hints.

Variables

This section is empty.

Functions

func IsComposeFile

func IsComposeFile(src []byte) bool

IsComposeFile reports whether a YAML file is a compose file: it has a top-level services: key.

func IsDotEnv

func IsDotEnv(path string) bool

IsDotEnv reports whether a path is an .env file (.env, .env.override, …).

func Parse

func Parse(path string, src []byte) parser.Result

Parse turns a compose file into Deployment nodes and their references edges.

func ParseDotEnv

func ParseDotEnv(path string, src []byte) parser.Result

ParseDotEnv turns an .env file into one Config node per key.

func Redact

func Redact(key, value string) string

Redact strips credentials from a value: a secret-named key's value entirely, any URL's user:password@ otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL