feat: phase 0 — project scaffolding and build tooling

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.
This commit is contained in:
dimitar 2026-08-02 08:30:23 +02:00
parent 3ef7c601bd
commit 9761adf3f9
7 changed files with 140 additions and 0 deletions

37
.github/workflows/ci.yml vendored Normal file
View File

@ -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

17
.gitignore vendored Normal file
View File

@ -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

24
.golangci.yml Normal file
View File

@ -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

35
Makefile Normal file
View File

@ -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

16
cmd/gitflow/main.go Normal file
View File

@ -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)
}

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module gitea.oblak.solutions/dimitar/gitFlow
go 1.24

View File

@ -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"