Skip to content

Commit 05da150

Browse files
gustavobertoiclaude
andcommitted
build: rename Go module to github.com/open-source-cloud/devstack
Project renamed to devstack; repo created under the open-source-cloud org. Rewrite the module path across go.mod, all internal imports, the goreleaser ldflags, and the version package. Add Makefile install/uninstall (XDG_BIN_HOME-aware) and a smoke target that exercises the built binary (version, help, alias round-trip, argv[0] dispatch, doctor --json). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 5088f34 commit 05da150

11 files changed

Lines changed: 64 additions & 21 deletions

File tree

.goreleaser.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ builds:
2020
- -trimpath
2121
ldflags:
2222
- -s -w
23-
- -X github.com/open-source-cloud/devdock-go/internal/version.Version={{.Version}}
24-
- -X github.com/open-source-cloud/devdock-go/internal/version.Commit={{.ShortCommit}}
25-
- -X github.com/open-source-cloud/devdock-go/internal/version.Date={{.Date}}
23+
- -X github.com/open-source-cloud/devstack/internal/version.Version={{.Version}}
24+
- -X github.com/open-source-cloud/devstack/internal/version.Commit={{.ShortCommit}}
25+
- -X github.com/open-source-cloud/devstack/internal/version.Date={{.Date}}
2626

2727
archives:
2828
- id: default

Makefile

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# devstack developer tasks. The binary is named `devstack` (from ./cmd/devstack)
2-
# regardless of the repo folder name.
1+
# devstack developer tasks. The binary is `devstack` (built from ./cmd/devstack);
2+
# the Go module is github.com/open-source-cloud/devstack. `make install` drops the
3+
# binary into a local bin dir; `make smoke` exercises the built binary end-to-end.
34

45
BINARY := devstack
5-
PKG := github.com/open-source-cloud/devdock-go
6+
PKG := github.com/open-source-cloud/devstack
67
VERSION_PKG := $(PKG)/internal/version
78
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
89
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
@@ -12,9 +13,15 @@ LDFLAGS := -s -w \
1213
-X $(VERSION_PKG).Commit=$(COMMIT) \
1314
-X $(VERSION_PKG).Date=$(DATE)
1415

16+
# Where `make install` puts the binary: $XDG_BIN_HOME if set, else $(PREFIX)/bin
17+
# (~/.local/bin — the same place `devstack alias add` installs symlinks).
18+
# Override: make install PREFIX=/usr/local or make install BINDIR=/somewhere/bin
19+
PREFIX ?= $(HOME)/.local
20+
BINDIR ?= $(or $(XDG_BIN_HOME),$(PREFIX)/bin)
21+
1522
# The release binary MUST be CGO-free (static), but `go test -race` REQUIRES cgo.
1623
# So CGO is set per-target, never globally.
17-
.PHONY: build run test test-race test-one vet fmt fmt-check lint tidy vuln clean snapshot ci help
24+
.PHONY: build run test test-race test-one vet fmt fmt-check lint tidy vuln clean snapshot ci install uninstall smoke help
1825

1926
build: ## Build the static binary into ./dist
2027
CGO_ENABLED=0 go build -trimpath -ldflags '$(LDFLAGS)' -o dist/$(BINARY) ./cmd/devstack
@@ -52,6 +59,42 @@ snapshot: ## Local goreleaser snapshot build (no publish)
5259

5360
ci: fmt-check vet build test-race ## What CI runs
5461

62+
install: build ## Install the binary into $(BINDIR) (override with PREFIX= or XDG_BIN_HOME=)
63+
@install -d "$(BINDIR)"
64+
@install -m 0755 dist/$(BINARY) "$(BINDIR)/$(BINARY)"
65+
@echo "installed $(BINDIR)/$(BINARY) ($(VERSION))"
66+
@case ":$$PATH:" in *":$(BINDIR):"*) ;; *) echo "note: $(BINDIR) is not on your PATH — add it to use \`$(BINARY)\` directly";; esac
67+
68+
uninstall: ## Remove the installed binary from $(BINDIR)
69+
@rm -f "$(BINDIR)/$(BINARY)" && echo "removed $(BINDIR)/$(BINARY)"
70+
71+
smoke: build ## Exercise the built binary end-to-end in an isolated XDG sandbox
72+
@set -eu; \
73+
bin="$$PWD/dist/$(BINARY)"; \
74+
sandbox="$$(mktemp -d)"; \
75+
trap 'rm -rf "$$sandbox"' EXIT; \
76+
export XDG_CONFIG_HOME="$$sandbox/config" XDG_DATA_HOME="$$sandbox/data" \
77+
XDG_STATE_HOME="$$sandbox/state" XDG_CACHE_HOME="$$sandbox/cache" \
78+
XDG_BIN_HOME="$$sandbox/bin" XDG_RUNTIME_DIR="$$sandbox/run"; \
79+
printf '\n== smoke: %s ==\n' "$$bin"; \
80+
echo "-> version is build-stamped"; \
81+
"$$bin" version | tee "$$sandbox/version.txt"; \
82+
grep -q 'commit' "$$sandbox/version.txt" || { echo "FAIL: unexpected version output"; exit 1; }; \
83+
echo "-> --help lists the command surface"; \
84+
"$$bin" --help 2>&1 | grep -q 'doctor' || { echo "FAIL: help missing 'doctor'"; exit 1; }; \
85+
echo "-> alias add/list/remove round-trip"; \
86+
"$$bin" alias add rq >/dev/null; \
87+
test -L "$$XDG_BIN_HOME/rq" || { echo "FAIL: alias symlink not created"; exit 1; }; \
88+
"$$bin" alias list | grep -qx 'rq' || { echo "FAIL: alias not listed"; exit 1; }; \
89+
echo "-> argv[0] dispatch: the symlink runs the identical tree under its own name"; \
90+
"$$XDG_BIN_HOME/rq" version >/dev/null || { echo "FAIL: symlinked alias does not dispatch"; exit 1; }; \
91+
"$$bin" alias remove rq >/dev/null; \
92+
! test -e "$$XDG_BIN_HOME/rq" || { echo "FAIL: alias symlink not removed"; exit 1; }; \
93+
echo "-> doctor --json emits the checks contract (a down daemon is OK here)"; \
94+
"$$bin" doctor --json >"$$sandbox/doctor.json" 2>/dev/null || true; \
95+
grep -q '"checks"' "$$sandbox/doctor.json" || { echo "FAIL: doctor --json missing \"checks\""; exit 1; }; \
96+
printf '\n\033[32mok\033[0m smoke passed\n'
97+
5598
clean:
5699
rm -rf dist
57100

cmd/devstack/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"context"
99
"os"
1010

11-
"github.com/open-source-cloud/devdock-go/internal/alias"
12-
"github.com/open-source-cloud/devdock-go/internal/cli"
11+
"github.com/open-source-cloud/devstack/internal/alias"
12+
"github.com/open-source-cloud/devstack/internal/cli"
1313
)
1414

1515
func main() {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/open-source-cloud/devdock-go
1+
module github.com/open-source-cloud/devstack
22

33
// Go 1.25 toolchain floor — the max required by fang, validator/v10 (1.25),
44
// compose-go (1.24), infisical-sdk (1.24). Enforced project-wide and in CI.

internal/alias/alias.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"sort"
2020
"strings"
2121

22-
"github.com/open-source-cloud/devdock-go/internal/xdg"
22+
"github.com/open-source-cloud/devstack/internal/xdg"
2323
)
2424

2525
// Canonical is the tool's primary name; always valid regardless of the registry.

internal/alias/alias_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"slices"
77
"testing"
88

9-
"github.com/open-source-cloud/devdock-go/internal/xdg"
9+
"github.com/open-source-cloud/devstack/internal/xdg"
1010
)
1111

1212
// hermeticHome isolates XDG_BIN_HOME/XDG_CONFIG_HOME to temp dirs for a test.

internal/cli/alias.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/spf13/cobra"
77

8-
"github.com/open-source-cloud/devdock-go/internal/alias"
8+
"github.com/open-source-cloud/devstack/internal/alias"
99
)
1010

1111
func newAliasCmd(g *GlobalOpts) *cobra.Command {

internal/cli/doctor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77

88
"github.com/spf13/cobra"
99

10-
"github.com/open-source-cloud/devdock-go/internal/docker"
11-
"github.com/open-source-cloud/devdock-go/internal/state"
12-
"github.com/open-source-cloud/devdock-go/internal/xdg"
10+
"github.com/open-source-cloud/devstack/internal/docker"
11+
"github.com/open-source-cloud/devstack/internal/state"
12+
"github.com/open-source-cloud/devstack/internal/xdg"
1313
)
1414

1515
func newDoctorCmd(g *GlobalOpts) *cobra.Command {

internal/cli/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
fang "charm.land/fang/v2"
1414
"github.com/spf13/cobra"
1515

16-
"github.com/open-source-cloud/devdock-go/internal/alias"
17-
"github.com/open-source-cloud/devdock-go/internal/version"
16+
"github.com/open-source-cloud/devstack/internal/alias"
17+
"github.com/open-source-cloud/devstack/internal/version"
1818
)
1919

2020
// GlobalOpts holds the global flags every command renders through.

internal/state/state.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import (
2020

2121
_ "modernc.org/sqlite"
2222

23-
"github.com/open-source-cloud/devdock-go/internal/lock"
24-
"github.com/open-source-cloud/devdock-go/internal/xdg"
23+
"github.com/open-source-cloud/devstack/internal/lock"
24+
"github.com/open-source-cloud/devstack/internal/xdg"
2525
)
2626

2727
// DefaultContext is used when no Docker context can be resolved.

0 commit comments

Comments
 (0)