mirror of
https://github.com/psviderski/uncloud.git
synced 2026-11-10 04:34:17 +00:00
chore: migrate linting and formatting commands to mise tasks
This commit is contained in:
@@ -30,6 +30,6 @@ jobs:
|
|||||||
run: git checkout mise.lock
|
run: git checkout mise.lock
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: make lint
|
run: mise run lint
|
||||||
|
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
|
|||||||
@@ -98,33 +98,6 @@ management.
|
|||||||
|
|
||||||
- **`misc/`**: Design documents and guides
|
- **`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
|
## Development Workflow
|
||||||
|
|
||||||
### Build and Development
|
### Build and Development
|
||||||
@@ -135,16 +108,18 @@ go build -o uc ./cmd/uc
|
|||||||
go build -o uncloudd ./cmd/uncloudd
|
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
|
- `proto`: Generate protobuf code
|
||||||
- `ucind-cluster`: Create development cluster
|
- `ucind-cluster`: Create development cluster
|
||||||
- `update-dev`: Deploy to development machines
|
- `update-dev`: Deploy to development machines
|
||||||
- `demo-reset`: Reset demo environment
|
- `demo-reset`: Reset demo environment
|
||||||
- `fmt`: Format code
|
|
||||||
- `test`: Run all tests
|
- `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
|
## CLI Commands Structure
|
||||||
|
|
||||||
|
|||||||
+8
-2
@@ -100,10 +100,16 @@ mise run dev:reset user@host1 user@host2
|
|||||||
|
|
||||||
## Linting and formatting
|
## Linting and formatting
|
||||||
|
|
||||||
Lint and format the code:
|
Check the code and formatting without changing files:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
make lint-and-fix
|
mise run lint
|
||||||
|
```
|
||||||
|
|
||||||
|
Apply formatting and available lint fixes:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mise run lint:fix
|
||||||
```
|
```
|
||||||
|
|
||||||
## Code generation
|
## Code generation
|
||||||
|
|||||||
@@ -47,21 +47,3 @@ test-clean:
|
|||||||
else \
|
else \
|
||||||
echo "Nothing to clean."; \
|
echo "Nothing to clean."; \
|
||||||
fi
|
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)
|
|
||||||
|
|||||||
@@ -46,6 +46,25 @@ description = "Run the documentation website locally"
|
|||||||
dir = "website"
|
dir = "website"
|
||||||
run = "npm start --"
|
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]
|
[tasks.mocks]
|
||||||
description = "Regenerate Go test mocks"
|
description = "Regenerate Go test mocks"
|
||||||
run = "mockery"
|
run = "mockery"
|
||||||
|
|||||||
Reference in New Issue
Block a user