chore(tools): update golangci-lint to v2.13.2
- commit
- 179fb63724bcc16a36320d7297f11b73e102689c
- author
- brice · · 2026-08-29 11:23 UTC
- parent
- f2f6f15
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +22 -8
M Makefile +3 -2
| @@ -14,7 +14,7 @@ MAIN_PATH=./cmd/dumber | |||
| 14 | 14 | DIST_DIR=dist | |
| 15 | 15 | LOCAL_BIN_DIR?=$(HOME)/.local/bin | |
| 16 | 16 | TOOL_BIN_DIR?=$(shell go env GOPATH)/bin | |
| 17 | - | GOLANGCI_LINT_VERSION?=v2.12.2 | |
| 17 | + | GOLANGCI_LINT_VERSION?=v2.13.2 | |
| 18 | 18 | STATICCHECK_VERSION?=v0.7.0 | |
| 19 | 19 | ||
| 20 | 20 | # Detect number of CPU cores for parallel compilation | |
| @@ -165,7 +165,8 @@ install-golangci-lint: ## Install pinned golangci-lint | |||
| 165 | 165 | # Build the pinned version with the active Go toolchain instead of using the | |
| 166 | 166 | # upstream install.sh helper, which currently misidentifies release assets now | |
| 167 | 167 | # that golangci-lint publishes sibling .sbom.json files for each tarball. | |
| 168 | - | GOBIN=$(TOOL_BIN_DIR) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) | |
| 168 | + | # Run outside this module so Go resolves the requested tool version independently. | |
| 169 | + | cd "$${TMPDIR:-/tmp}" && GOBIN=$(TOOL_BIN_DIR) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) | |
| 169 | 170 | ||
| 170 | 171 | install-staticcheck: ## Install pinned Staticcheck with the active Go toolchain | |
| 171 | 172 | @echo "Installing staticcheck $(STATICCHECK_VERSION)..." | |
| @@ -14,7 +14,7 @@ MAIN_PATH=./cmd/dumber | |||||
| 14 | DIST_DIR=dist | 14 | DIST_DIR=dist | ||
| 15 | LOCAL_BIN_DIR?=$(HOME)/.local/bin | 15 | LOCAL_BIN_DIR?=$(HOME)/.local/bin | ||
| 16 | TOOL_BIN_DIR?=$(shell go env GOPATH)/bin | 16 | TOOL_BIN_DIR?=$(shell go env GOPATH)/bin | ||
| 17 | - | GOLANGCI_LINT_VERSION?=v2.12.2 | 17 | + | GOLANGCI_LINT_VERSION?=v2.13.2 |
| 18 | STATICCHECK_VERSION?=v0.7.0 | 18 | STATICCHECK_VERSION?=v0.7.0 | ||
| 19 | 19 | ||||
| 20 | # Detect number of CPU cores for parallel compilation | 20 | # Detect number of CPU cores for parallel compilation | ||
| @@ -165,7 +165,8 @@ install-golangci-lint: ## Install pinned golangci-lint | |||||
| 165 | # Build the pinned version with the active Go toolchain instead of using the | 165 | # Build the pinned version with the active Go toolchain instead of using the | ||
| 166 | # upstream install.sh helper, which currently misidentifies release assets now | 166 | # upstream install.sh helper, which currently misidentifies release assets now | ||
| 167 | # that golangci-lint publishes sibling .sbom.json files for each tarball. | 167 | # that golangci-lint publishes sibling .sbom.json files for each tarball. | ||
| 168 | - | GOBIN=$(TOOL_BIN_DIR) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) | 168 | + | # Run outside this module so Go resolves the requested tool version independently. |
| 169 | + | cd "$${TMPDIR:-/tmp}" && GOBIN=$(TOOL_BIN_DIR) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) | |||
| 169 | 170 | ||||
| 170 | install-staticcheck: ## Install pinned Staticcheck with the active Go toolchain | 171 | install-staticcheck: ## Install pinned Staticcheck with the active Go toolchain | ||
| 171 | @echo "Installing staticcheck $(STATICCHECK_VERSION)..." | 172 | @echo "Installing staticcheck $(STATICCHECK_VERSION)..." | ||
M internal/ui/theme/palette.go +19 -6
| @@ -279,7 +279,18 @@ func (p Palette) ToCSSVars() string { | |||
| 279 | 279 | return sb.String() | |
| 280 | 280 | } | |
| 281 | 281 | ||
| 282 | - | const minimumReadableContrast = 4.5 | |
| 282 | + | const ( | |
| 283 | + | minimumReadableContrast = 4.5 | |
| 284 | + | contrastLuminanceOffset = 0.05 | |
| 285 | + | sRGBLinearThreshold = 0.04045 | |
| 286 | + | sRGBLinearDivisor = 12.92 | |
| 287 | + | sRGBGammaOffset = 0.055 | |
| 288 | + | sRGBGammaScale = 1.055 | |
| 289 | + | sRGBGammaExponent = 2.4 | |
| 290 | + | redLuminanceWeight = 0.2126 | |
| 291 | + | greenLuminanceWeight = 0.7152 | |
| 292 | + | blueLuminanceWeight = 0.0722 | |
| 293 | + | ) | |
| 283 | 294 | ||
| 284 | 295 | func readableTextColor(background, preferred string) string { | |
| 285 | 296 | if contrastRatio(background, preferred) >= minimumReadableContrast { | |
| @@ -297,19 +308,21 @@ func contrastRatio(first, second string) float64 { | |||
| 297 | 308 | if firstLuminance < secondLuminance { | |
| 298 | 309 | firstLuminance, secondLuminance = secondLuminance, firstLuminance | |
| 299 | 310 | } | |
| 300 | - | return (firstLuminance + 0.05) / (secondLuminance + 0.05) | |
| 311 | + | return (firstLuminance + contrastLuminanceOffset) / (secondLuminance + contrastLuminanceOffset) | |
| 301 | 312 | } | |
| 302 | 313 | ||
| 303 | 314 | func relativeLuminance(color string) float64 { | |
| 304 | 315 | r, g, b, _ := HexToRGBA(color) | |
| 305 | 316 | linearize := func(channel float32) float64 { | |
| 306 | 317 | value := float64(channel) | |
| 307 | - | if value <= 0.04045 { | |
| 308 | - | return value / 12.92 | |
| 318 | + | if value <= sRGBLinearThreshold { | |
| 319 | + | return value / sRGBLinearDivisor | |
| 309 | 320 | } | |
| 310 | - | return math.Pow((value+0.055)/1.055, 2.4) | |
| 321 | + | return math.Pow((value+sRGBGammaOffset)/sRGBGammaScale, sRGBGammaExponent) | |
| 311 | 322 | } | |
| 312 | - | return 0.2126*linearize(r) + 0.7152*linearize(g) + 0.0722*linearize(b) | |
| 323 | + | return redLuminanceWeight*linearize(r) + | |
| 324 | + | greenLuminanceWeight*linearize(g) + | |
| 325 | + | blueLuminanceWeight*linearize(b) | |
| 313 | 326 | } | |
| 314 | 327 | ||
| 315 | 328 | // ToWebCSSVars generates CSS custom properties for web UI (Tailwind compatibility). | |
| @@ -279,7 +279,18 @@ func (p Palette) ToCSSVars() string { | |||||
| 279 | return sb.String() | 279 | return sb.String() | ||
| 280 | } | 280 | } | ||
| 281 | 281 | ||||
| 282 | - | const minimumReadableContrast = 4.5 | 282 | + | const ( |
| 283 | + | minimumReadableContrast = 4.5 | |||
| 284 | + | contrastLuminanceOffset = 0.05 | |||
| 285 | + | sRGBLinearThreshold = 0.04045 | |||
| 286 | + | sRGBLinearDivisor = 12.92 | |||
| 287 | + | sRGBGammaOffset = 0.055 | |||
| 288 | + | sRGBGammaScale = 1.055 | |||
| 289 | + | sRGBGammaExponent = 2.4 | |||
| 290 | + | redLuminanceWeight = 0.2126 | |||
| 291 | + | greenLuminanceWeight = 0.7152 | |||
| 292 | + | blueLuminanceWeight = 0.0722 | |||
| 293 | + | ) | |||
| 283 | 294 | ||||
| 284 | func readableTextColor(background, preferred string) string { | 295 | func readableTextColor(background, preferred string) string { | ||
| 285 | if contrastRatio(background, preferred) >= minimumReadableContrast { | 296 | if contrastRatio(background, preferred) >= minimumReadableContrast { | ||
| @@ -297,19 +308,21 @@ func contrastRatio(first, second string) float64 { | |||||
| 297 | if firstLuminance < secondLuminance { | 308 | if firstLuminance < secondLuminance { | ||
| 298 | firstLuminance, secondLuminance = secondLuminance, firstLuminance | 309 | firstLuminance, secondLuminance = secondLuminance, firstLuminance | ||
| 299 | } | 310 | } | ||
| 300 | - | return (firstLuminance + 0.05) / (secondLuminance + 0.05) | 311 | + | return (firstLuminance + contrastLuminanceOffset) / (secondLuminance + contrastLuminanceOffset) |
| 301 | } | 312 | } | ||
| 302 | 313 | ||||
| 303 | func relativeLuminance(color string) float64 { | 314 | func relativeLuminance(color string) float64 { | ||
| 304 | r, g, b, _ := HexToRGBA(color) | 315 | r, g, b, _ := HexToRGBA(color) | ||
| 305 | linearize := func(channel float32) float64 { | 316 | linearize := func(channel float32) float64 { | ||
| 306 | value := float64(channel) | 317 | value := float64(channel) | ||
| 307 | - | if value <= 0.04045 { | 318 | + | if value <= sRGBLinearThreshold { |
| 308 | - | return value / 12.92 | 319 | + | return value / sRGBLinearDivisor |
| 309 | } | 320 | } | ||
| 310 | - | return math.Pow((value+0.055)/1.055, 2.4) | 321 | + | return math.Pow((value+sRGBGammaOffset)/sRGBGammaScale, sRGBGammaExponent) |
| 311 | } | 322 | } | ||
| 312 | - | return 0.2126*linearize(r) + 0.7152*linearize(g) + 0.0722*linearize(b) | 323 | + | return redLuminanceWeight*linearize(r) + |
| 324 | + | greenLuminanceWeight*linearize(g) + | |||
| 325 | + | blueLuminanceWeight*linearize(b) | |||
| 313 | } | 326 | } | ||
| 314 | 327 | ||||
| 315 | // ToWebCSSVars generates CSS custom properties for web UI (Tailwind compatibility). | 328 | // ToWebCSSVars generates CSS custom properties for web UI (Tailwind compatibility). | ||