Skip to content

Commit 8b5d850

Browse files
Welcome to lintree.sh - OpenSource directory space visualiser
0 parents  commit 8b5d850

26 files changed

Lines changed: 2863 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
ci:
14+
name: Build & Test
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: "1.26"
24+
cache: true
25+
26+
- name: Download dependencies
27+
run: go mod download
28+
29+
- name: Vet
30+
run: go vet ./...
31+
32+
- name: Lint
33+
uses: golangci/golangci-lint-action@v6
34+
with:
35+
version: latest
36+
37+
- name: Build
38+
run: go build -o /dev/null ./...
39+
40+
- name: Test
41+
run: go test -race -count=1 ./...

.github/workflows/release.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build ${{ matrix.os }}/${{ matrix.arch }}
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- os: linux
20+
arch: amd64
21+
ext: ""
22+
compress: tar
23+
- os: linux
24+
arch: arm64
25+
ext: ""
26+
compress: tar
27+
- os: darwin
28+
arch: amd64
29+
ext: ""
30+
compress: tar
31+
- os: darwin
32+
arch: arm64
33+
ext: ""
34+
compress: tar
35+
- os: windows
36+
arch: amd64
37+
ext: ".exe"
38+
compress: zip
39+
- os: windows
40+
arch: arm64
41+
ext: ".exe"
42+
compress: zip
43+
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
with:
48+
fetch-depth: 0
49+
50+
- name: Setup Go
51+
uses: actions/setup-go@v5
52+
with:
53+
go-version: "1.26"
54+
cache: true
55+
56+
- name: Derive version metadata
57+
id: meta
58+
run: |
59+
TAG="${GITHUB_REF#refs/tags/}"
60+
DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
61+
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
62+
echo "date=${DATE}" >> "$GITHUB_OUTPUT"
63+
64+
- name: Build binary
65+
env:
66+
GOOS: ${{ matrix.os }}
67+
GOARCH: ${{ matrix.arch }}
68+
CGO_ENABLED: "0"
69+
run: |
70+
BINARY="lintree-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}"
71+
LDFLAGS="-s -w"
72+
LDFLAGS="${LDFLAGS} -X lintree/internal/version.Version=${{ steps.meta.outputs.tag }}"
73+
LDFLAGS="${LDFLAGS} -X lintree/internal/version.Commit=${GITHUB_SHA}"
74+
LDFLAGS="${LDFLAGS} -X lintree/internal/version.Date=${{ steps.meta.outputs.date }}"
75+
76+
go build -trimpath -ldflags "${LDFLAGS}" -o "${BINARY}" .
77+
echo "BINARY=${BINARY}" >> "$GITHUB_ENV"
78+
79+
- name: Compress (tar.gz)
80+
if: matrix.compress == 'tar'
81+
run: |
82+
ARCHIVE="lintree-${{ matrix.os }}-${{ matrix.arch }}.tar.gz"
83+
tar -czf "${ARCHIVE}" "${BINARY}"
84+
echo "ARCHIVE=${ARCHIVE}" >> "$GITHUB_ENV"
85+
86+
- name: Compress (zip)
87+
if: matrix.compress == 'zip'
88+
run: |
89+
ARCHIVE="lintree-${{ matrix.os }}-${{ matrix.arch }}.zip"
90+
zip "${ARCHIVE}" "${BINARY}"
91+
echo "ARCHIVE=${ARCHIVE}" >> "$GITHUB_ENV"
92+
93+
- name: Generate checksum
94+
run: |
95+
sha256sum "${ARCHIVE}" > "${ARCHIVE}.sha256"
96+
97+
- name: Upload artifacts
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: release-${{ matrix.os }}-${{ matrix.arch }}
101+
path: |
102+
${{ env.ARCHIVE }}
103+
${{ env.ARCHIVE }}.sha256
104+
retention-days: 1
105+
106+
release:
107+
name: Create GitHub Release
108+
needs: build
109+
runs-on: ubuntu-latest
110+
steps:
111+
- name: Checkout
112+
uses: actions/checkout@v4
113+
with:
114+
fetch-depth: 0
115+
116+
- name: Download all artifacts
117+
uses: actions/download-artifact@v4
118+
with:
119+
pattern: release-*
120+
merge-multiple: true
121+
path: dist
122+
123+
- name: Combine checksums
124+
run: |
125+
cd dist
126+
cat *.sha256 | sort > checksums.txt
127+
rm -f *.sha256
128+
echo "--- checksums.txt ---"
129+
cat checksums.txt
130+
131+
- name: Create release
132+
uses: softprops/action-gh-release@v2
133+
with:
134+
generate_release_notes: true
135+
files: |
136+
dist/*
137+
env:
138+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Binary
2+
lintree
3+
4+
# Distribution
5+
dist/
6+
7+
# Windows
8+
*.exe
9+
10+
# macOS
11+
.DS_Store
12+
13+
# Test artifacts
14+
*.test
15+
*.out
16+
17+
# Dependencies
18+
vendor/
19+
20+
# IDE
21+
.idea/
22+
.vscode/
23+
24+
# Swap files
25+
*.swp
26+
*.swo

.golangci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
run:
2+
timeout: 5m
3+
go: "1.26"
4+
5+
linters:
6+
enable:
7+
# Default-tier linters
8+
- errcheck
9+
- staticcheck
10+
- unused
11+
- ineffassign
12+
- govet
13+
- gosimple
14+
- typecheck
15+
16+
# Formatting
17+
- gofmt
18+
- goimports
19+
20+
# Code quality
21+
- misspell
22+
- unconvert
23+
- unparam
24+
25+
# Security
26+
- gosec
27+
28+
linters-settings:
29+
errcheck:
30+
check-type-assertions: true
31+
govet:
32+
enable-all: true
33+
disable:
34+
- fieldalignment # too noisy for most projects
35+
gosec:
36+
excludes:
37+
- G104 # duplicates errcheck
38+
goimports:
39+
local-prefixes: lintree
40+
misspell:
41+
locale: US
42+
43+
issues:
44+
exclude-rules:
45+
# Test files: relax some linters that produce noise in tests
46+
- path: _test\.go
47+
linters:
48+
- errcheck
49+
- unparam
50+
- gosec
51+
52+
# Show all issues from a linter, not just the default max
53+
max-issues-per-linter: 0
54+
max-same-issues: 0

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 PatchMon
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
VERSION := $(shell git describe --tags --always 2>/dev/null || echo "dev")
2+
COMMIT := $(shell git rev-parse HEAD 2>/dev/null || echo "unknown")
3+
DATE := $(shell date -u)
4+
LDFLAGS := -ldflags "-X 'lintree/internal/version.Version=$(VERSION)' -X 'lintree/internal/version.Commit=$(COMMIT)' -X 'lintree/internal/version.Date=$(DATE)'"
5+
6+
.PHONY: build install test clean lint run
7+
8+
build:
9+
go build $(LDFLAGS) -o lintree .
10+
11+
install:
12+
go install $(LDFLAGS) .
13+
14+
test:
15+
go test ./...
16+
17+
clean:
18+
rm -f lintree
19+
rm -rf dist/
20+
21+
lint:
22+
@if command -v golangci-lint >/dev/null 2>&1; then \
23+
golangci-lint run ./...; \
24+
else \
25+
echo "golangci-lint not found. Install it: https://golangci-lint.run/welcome/install/"; \
26+
echo "Falling back to go vet..."; \
27+
go vet ./...; \
28+
fi
29+
30+
run: build
31+
./lintree $(ARGS)

0 commit comments

Comments
 (0)