hdmistat/Makefile
sneak 2f8256b310 Refactor hdmistat to use dependency injection and fix linter issues
Major changes:
- Converted all cobra commands from global variables to CLI struct methods
- Eliminated global logger variable in favor of dependency injection
- Fixed all errcheck linter issues by properly handling errors
- Fixed Makefile to check formatting instead of modifying files
- Integrated smartconfig library for configuration management
- Added CLAUDE.md with project-specific development guidelines

Key improvements:
- All commands (daemon, install, status, info) now use CLI struct methods
- Logger is injected as dependency through fx providers
- Proper error handling for all DrawText and file.Close() calls
- Configuration loading now uses smartconfig with proper defaults
- Fixed formatting check in Makefile (make test no longer modifies files)

Technical details:
- Created CLI struct with log field (renamed from logger per request)
- All command constructors return *cobra.Command from CLI methods
- Config package uses smartconfig.NewFromAppName() correctly
- Fixed all critical errcheck issues throughout the codebase
- Maintained backward compatibility with existing functionality

All tests passing, code formatted, and ready for deployment.
2025-07-23 15:01:51 +02:00

42 lines
610 B
Makefile

.PHONY: all build test fmt lint clean install
all: fmt lint test build
build:
go build -o hdmistat ./cmd/hdmistat
test: fmt-check lint
go test -v ./...
fmt:
go fmt ./...
fmt-check:
@echo "Checking formatting..."
@test -z "$$(gofmt -l .)" || (echo "Files need formatting. Run 'make fmt'" && gofmt -l . && exit 1)
lint:
golangci-lint run
clean:
rm -f hdmistat
go clean
install: build
sudo cp hdmistat /usr/local/bin/
# Development helpers
.PHONY: run run-daemon
run: build
./hdmistat
run-daemon: build
sudo ./hdmistat daemon
# Dependencies
.PHONY: deps
deps:
go mod download
go mod tidy