diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 49446481..4d9e845f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -30,6 +30,6 @@ jobs: run: git checkout mise.lock - name: Lint - run: make lint + run: mise run lint timeout-minutes: 10 diff --git a/AGENTS.md b/AGENTS.md index 47de1944..cf406c0c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -98,33 +98,6 @@ management. - **`misc/`**: Design documents and guides -## Key Technologies - -### Core Dependencies - -```go -// Networking and orchestration -github.com/docker/docker // Docker API client -github.com/docker/compose/v2 // Docker Compose integration -golang.zx2c4.com/wireguard // WireGuard implementation -github.com/hashicorp/serf // Gossip protocol - -// State management -github.com/ipfs/go-ds-crdt // CRDT distributed storage -github.com/dgraph-io/badger/v3 // Embedded database - -// Web proxy -github.com/caddyserver/caddy/v2 // HTTP server and reverse proxy - -// CLI and UX -github.com/spf13/cobra // CLI framework -github.com/charmbracelet/huh // Interactive forms - -// gRPC and networking -google.golang.org/grpc // gRPC framework -github.com/siderolabs/grpc-proxy // gRPC proxy for forwarding -``` - ## Development Workflow ### Build and Development @@ -135,16 +108,18 @@ go build -o uc ./cmd/uc go build -o uncloudd ./cmd/uncloudd ``` -### Key Make Targets +### Formatting and Linting + +- `mise run lint`: Check Go code and formatting without changing files +- `mise run lint:fix`: Apply formatting and available lint fixes + +### Other Development Tasks - `proto`: Generate protobuf code - `ucind-cluster`: Create development cluster - `update-dev`: Deploy to development machines - `demo-reset`: Reset demo environment -- `fmt`: Format code - `test`: Run all tests -- `lint`: Lint the code using golangci-lint -- `lint-and-fix`: Lint the code and fix issues whenever possible ## CLI Commands Structure diff --git a/HACKING.md b/HACKING.md index ad17cd13..b489db33 100644 --- a/HACKING.md +++ b/HACKING.md @@ -100,10 +100,16 @@ mise run dev:reset user@host1 user@host2 ## Linting and formatting -Lint and format the code: +Check the code and formatting without changing files: ```shell -make lint-and-fix +mise run lint +``` + +Apply formatting and available lint fixes: + +```shell +mise run lint:fix ``` ## Code generation diff --git a/Makefile b/Makefile index f910f10b..fa5aab75 100644 --- a/Makefile +++ b/Makefile @@ -47,21 +47,3 @@ test-clean: else \ echo "Nothing to clean."; \ fi - -.PHONY: vet -vet: - go vet ./... - -.PHONY: format fmt -format fmt: - GOOS=linux golangci-lint fmt - -LINT_TARGETS := lint lint-and-fix -.PHONY: $(LINT_TARGETS) _lint -$(LINT_TARGETS): _lint -lint: ARGS= -lint-and-fix: ARGS=--fix -_lint: -# Explicitly set OS to Linux to not skip *_linux.go files when running on macOS. -# Uncloud daemon won't likely support OS other than Linux anytime soon, so for now we can rely on that. - GOOS=linux golangci-lint run $(ARGS) diff --git a/mise.toml b/mise.toml index 1fd3b553..67802b19 100644 --- a/mise.toml +++ b/mise.toml @@ -46,6 +46,25 @@ description = "Run the documentation website locally" dir = "website" run = "npm start --" +[tasks.fmt] +description = "Format Go code and imports" +alias = "format" +env.GOOS = "linux" +run = "golangci-lint fmt" + +[tasks.lint] +description = "Check Go code and formatting" +# Explicitly set OS to Linux to not skip *_linux.go files when running on macOS. +# Uncloud daemon won't likely support OS other than Linux anytime soon, so for now we can rely on that. +env.GOOS = "linux" +run = "golangci-lint run" + +[tasks."lint:fix"] +description = "Format Go code and apply available lint fixes" +alias = "lint-and-fix" +env.GOOS = "linux" +run = "golangci-lint run --fix" + [tasks.mocks] description = "Regenerate Go test mocks" run = "mockery"