stack

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package stack defines supported technology stacks and detects the active stack for a Go project (portsmith.yaml, go.mod, or explicit flag).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindProjectRoot

func FindProjectRoot(startDir string) (string, error)

FindProjectRoot walks upward from startDir until a directory containing go.mod is found.

Types

type Stack

type Stack string

Stack identifies HTTP + persistence choices for scaffolding and lint rules.

const (
	// GinGORM is the default: Gin HTTP + GORM.
	GinGORM Stack = "gin-gorm"
	// ChiSqlx is Chi HTTP + sqlx (e.g. PostgreSQL via pgx stdlib driver).
	ChiSqlx Stack = "chi-sqlx"
)

func Detect

func Detect(projectRoot string) Stack

Detect returns the stack for a project root (directory that contains go.mod). Priority: portsmith.yaml → go.mod heuristics → GinGORM.

func FromFlag

func FromFlag(s string) (Stack, error)

FromFlag parses a --stack value.

func Resolve

func Resolve(pkgDir, stackFlag string) (Stack, error)

Resolve returns the stack to use: explicit flag wins, else Detect from project root of pkgDir.

func ResolveFromWD

func ResolveFromWD(stackFlag string) (Stack, error)

ResolveFromWD is like Resolve but uses the current working directory as the start point for finding go.mod (for commands that are not tied to a single package path).

Jump to

Keyboard shortcuts

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