From 9761adf3f9389a2537e763822d5a41e6c4c3f364 Mon Sep 17 00:00:00 2001 From: dimitar Date: Sun, 2 Aug 2026 08:30:23 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20phase=200=20=E2=80=94=20project=20scaff?= =?UTF-8?q?olding=20and=20build=20tooling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bootstrap the gitflow module so subsequent phases build on a verified, linted foundation. - go.mod: initialize module gitea.oblak.solutions/dimitar/gitFlow at go 1.24 - cmd/gitflow/main.go: minimal entrypoint that prints the version string; this is a placeholder that Phase 2 (CLI & config) replaces with Cobra - internal/version: version metadata injectable at build time via ldflags, with a Makefile target wiring VERSION through - Makefile: build / test / fmt / vet / lint / install / clean targets with ldflags version injection - .golangci.yml: enable errcheck, govet, staticcheck, gosimple, ineffassign, unused, misspell, gofmt, goimports - .github/workflows/ci.yml: GitHub Actions CI running build + vet + tests (with -race) across Go 1.24/1.26, plus a golangci-lint job - .gitignore: build artifacts, test outputs, editor cruft, and local config overrides (never committed) Verified locally: go build, go vet, gofmt clean, binary prints version. --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ .gitignore | 17 +++++++++++++++++ .golangci.yml | 24 ++++++++++++++++++++++++ Makefile | 35 +++++++++++++++++++++++++++++++++++ cmd/gitflow/main.go | 16 ++++++++++++++++ go.mod | 3 +++ internal/version/version.go | 8 ++++++++ 7 files changed, 140 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 .golangci.yml create mode 100644 Makefile create mode 100644 cmd/gitflow/main.go create mode 100644 go.mod create mode 100644 internal/version/version.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7993d64 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + name: Test (Go ${{ matrix.go }}) + runs-on: ubuntu-latest + strategy: + matrix: + go: ["1.24", "1.26"] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + - name: Build + run: go build ./... + - name: Vet + run: go vet ./... + - name: Test + run: go test -race ./... + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "1.26" + - uses: golangci/golangci-lint-action@v6 + with: + version: latest diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..180d5c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Binaries and build artifacts +/gitflow +/dist/ +*.exe + +# Test artifacts +*.test +coverage.out + +# Editor / OS cruft +.DS_Store +.idea/ +.vscode/ +*.swp + +# Local config overrides (never commit personal settings) +.gitflow.local.yaml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..d6c8a57 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,24 @@ +# golangci-lint configuration for gitflow. +# Docs: https://golangci-lint.run/usage/configuration/ + +run: + timeout: 5m + +linters: + enable: + - errcheck # unchecked errors + - govet # go vet + - staticcheck # static analysis + - gosimple # simplify code + - ineffassign # ineffective assignments + - unused # unused declarations + - misspell # typos in comments/strings + - gofmt # formatting + - goimports # import grouping + +issues: + exclude-rules: + # Tests may use underscores to match fixture naming. + - path: _test\.go + linters: + - errcheck diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3778b2e --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +BINARY := gitflow +MODULE := gitea.oblak.solutions/dimitar/gitFlow +VERSION ?= dev +LDFLAGS := -ldflags "-X $(MODULE)/internal/version.Version=$(VERSION)" + +.PHONY: build test fmt vet lint install clean + +## build: compile the gitflow binary into the repo root +build: + go build $(LDFLAGS) -o $(BINARY) ./cmd/gitflow + +## test: run the full test suite +test: + go test ./... + +## fmt: format all Go sources +fmt: + gofmt -l -w . + +## vet: run go vet over all packages +vet: + go vet ./... + +## lint: run golangci-lint (requires golangci-lint on PATH) +lint: + golangci-lint run + +## install: install gitflow into GOBIN +install: + go install $(LDFLAGS) ./cmd/gitflow + +## clean: remove build artifacts +clean: + rm -f $(BINARY) + rm -f coverage.out diff --git a/cmd/gitflow/main.go b/cmd/gitflow/main.go new file mode 100644 index 0000000..3b3e0b7 --- /dev/null +++ b/cmd/gitflow/main.go @@ -0,0 +1,16 @@ +// Command gitflow is a CLI tool that discovers Git repositories under a +// user-specified parent directory, scans their status, and presents findings +// with AI-driven suggestions for next actions. +package main + +import ( + "fmt" + "os" + + "gitea.oblak.solutions/dimitar/gitFlow/internal/version" +) + +func main() { + fmt.Printf("gitflow %s\n", version.Version) + os.Exit(0) +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..82c3d32 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module gitea.oblak.solutions/dimitar/gitFlow + +go 1.24 diff --git a/internal/version/version.go b/internal/version/version.go new file mode 100644 index 0000000..4e28d63 --- /dev/null +++ b/internal/version/version.go @@ -0,0 +1,8 @@ +// Package version exposes build metadata for the gitflow binary. +package version + +// Version is the semantic version of the binary. It can be overridden at +// build time with: +// +// go build -ldflags "-X gitea.oblak.solutions/dimitar/gitFlow/internal/version.Version=v1.2.3" ./cmd/gitflow +var Version = "dev"