Skip to content

Commit ce8fc2c

Browse files
committed
refactor: modernize codebase to Go 1.23 with performance improvements
1 parent 07d11ce commit ce8fc2c

10 files changed

Lines changed: 452 additions & 40 deletions

File tree

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
strategy:
13+
matrix:
14+
go-version: [ '1.23', '1.24', '1.25' ]
15+
os: [ ubuntu-latest, macos-latest, windows-latest ]
16+
runs-on: ${{ matrix.os }}
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: ${{ matrix.go-version }}
26+
27+
- name: Verify dependencies
28+
run: go mod verify
29+
30+
- name: Run go vet
31+
run: go vet ./...
32+
33+
- name: Run tests
34+
run: go test -v -race -coverprofile=coverage.out ./...
35+
36+
- name: Upload coverage
37+
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.25'
38+
uses: codecov/codecov-action@v4
39+
with:
40+
file: ./coverage.out
41+
continue-on-error: true
42+
43+
lint:
44+
name: Lint
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@v4
50+
51+
- name: Set up Go
52+
uses: actions/setup-go@v5
53+
with:
54+
go-version: '1.25'
55+
56+
- name: Run golangci-lint
57+
uses: golangci/golangci-lint-action@v4
58+
with:
59+
version: latest
60+
61+
benchmark:
62+
name: Benchmark
63+
runs-on: ubuntu-latest
64+
65+
steps:
66+
- name: Checkout code
67+
uses: actions/checkout@v4
68+
69+
- name: Set up Go
70+
uses: actions/setup-go@v5
71+
with:
72+
go-version: '1.25'
73+
74+
- name: Run benchmarks
75+
run: go test -bench=. -benchmem -run=^$

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release:
14+
name: Release
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: '1.25'
26+
27+
- name: Run tests
28+
run: go test -v -race ./...
29+
30+
- name: Create release
31+
uses: googleapis/release-please-action@v4
32+
id: release
33+
with:
34+
release-type: go
35+
package-name: gotree
36+
token: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Tag major and minor versions
39+
if: ${{ steps.release.outputs.release_created }}
40+
run: |
41+
git config user.name github-actions[bot]
42+
git config user.email github-actions[bot]@users.noreply.github.com
43+
git tag -d v${{ steps.release.outputs.major }} 2>/dev/null || true
44+
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} 2>/dev/null || true
45+
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}"
46+
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
47+
git push origin v${{ steps.release.outputs.major }} --force
48+
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} --force

.golangci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
linters:
2+
enable:
3+
- gofmt
4+
- govet
5+
- staticcheck
6+
- ineffassign
7+
- misspell
8+
- unconvert
9+
- unparam
10+
- unused
11+
- errcheck
12+
- gosimple
13+
14+
linters-settings:
15+
govet:
16+
check-shadowing: true
17+
18+
issues:
19+
exclude-use-default: false

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# DEPRECATED: This project has migrated to GitHub Actions
2+
# See .github/workflows/ci.yml for current CI configuration
3+
# This file is kept for historical reference only
4+
15
language: go
26
go_import_path: github.com/disiqueira/gotree
37
git:

Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.PHONY: test bench lint fmt vet coverage clean help
2+
3+
# Default target
4+
help:
5+
@echo "GoTree Makefile"
6+
@echo ""
7+
@echo "Available targets:"
8+
@echo " make test - Run all tests"
9+
@echo " make bench - Run benchmarks"
10+
@echo " make lint - Run linter"
11+
@echo " make fmt - Format code"
12+
@echo " make vet - Run go vet"
13+
@echo " make coverage - Generate coverage report"
14+
@echo " make clean - Clean build artifacts"
15+
16+
test:
17+
go test -v -race ./...
18+
19+
bench:
20+
go test -bench=. -benchmem -run=^$$
21+
22+
lint:
23+
golangci-lint run
24+
25+
fmt:
26+
go fmt ./...
27+
28+
vet:
29+
go vet ./...
30+
31+
coverage:
32+
go test -coverprofile=coverage.out ./...
33+
go tool cover -html=coverage.out -o coverage.html
34+
@echo "Coverage report generated: coverage.html"
35+
36+
clean:
37+
rm -f coverage.out coverage.html
38+
go clean -testcache

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# ![GoTree](https://rawgit.com/DiSiqueira/GoTree/master/gotree-logo.png)
1+
# ![GoTree](https://raw.githubusercontent.com/d6o/GoTree/master/gotree-logo.png)
22

3-
# GoTree ![Language Badge](https://img.shields.io/badge/Language-Go-blue.svg) ![Go Report](https://goreportcard.com/badge/github.com/DiSiqueira/GoTree) ![License Badge](https://img.shields.io/badge/License-MIT-blue.svg) ![Status Badge](https://img.shields.io/badge/Status-Beta-brightgreen.svg) [![GoDoc](https://godoc.org/github.com/DiSiqueira/GoTree?status.svg)](https://godoc.org/github.com/DiSiqueira/GoTree) [![Build Status](https://travis-ci.org/DiSiqueira/GoTree.svg?branch=master)](https://travis-ci.org/DiSiqueira/GoTree)
3+
# GoTree ![Language Badge](https://img.shields.io/badge/Language-Go-blue.svg) ![Go Report](https://goreportcard.com/badge/github.com/d6o/GoTree) ![License Badge](https://img.shields.io/badge/License-MIT-blue.svg) ![Status Badge](https://img.shields.io/badge/Status-Beta-brightgreen.svg) [![GoDoc](https://godoc.org/github.com/d6o/GoTree?status.svg)](https://godoc.org/github.com/d6o/GoTree) [![CI](https://github.com/d6o/GoTree/workflows/CI/badge.svg)](https://github.com/d6o/GoTree/actions)
44

55
Simple Go module to print tree structures in terminal. Heavily inspired by [The Tree Command for Linux][treecommand]
66

@@ -10,7 +10,7 @@ The GoTree's goal is to be a simple tool providing a stupidly easy-to-use and fa
1010

1111
## Project Status
1212

13-
GoTree is on beta. Pull Requests [are welcome](https://github.com/DiSiqueira/GoTree#social-coding)
13+
GoTree is on beta. Pull Requests [are welcome](https://github.com/d6o/GoTree#social-coding)
1414

1515
![](http://image.prntscr.com/image/2a0dbf0777454446b8083fb6a0dc51fe.png)
1616

@@ -20,14 +20,14 @@ GoTree is on beta. Pull Requests [are welcome](https://github.com/DiSiqueira/GoT
2020
- Intuitive names
2121
- Easy to extend
2222
- Uses only native libs
23-
- STUPIDLY [EASY TO USE](https://github.com/DiSiqueira/GoTree#usage)
23+
- STUPIDLY [EASY TO USE](https://github.com/d6o/GoTree#usage)
2424

2525
## Installation
2626

2727
### Go Get
2828

2929
```bash
30-
$ go get github.com/disiqueira/gotree
30+
$ go get github.com/d6o/gotree
3131
```
3232

3333
## Usage
@@ -42,7 +42,7 @@ package main
4242
import (
4343
"fmt"
4444

45-
"github.com/disiqueira/gotree"
45+
"github.com/d6o/gotree"
4646
)
4747

4848
func main() {
@@ -58,21 +58,21 @@ func main() {
5858

5959
### Bug Reports & Feature Requests
6060

61-
Please use the [issue tracker](https://github.com/DiSiqueira/GoTree/issues) to report any bugs or file feature requests.
61+
Please use the [issue tracker](https://github.com/d6o/GoTree/issues) to report any bugs or file feature requests.
6262

6363
### Developing
6464

6565
PRs are welcome. To begin developing, do this:
6666

6767
```bash
68-
$ git clone --recursive git@github.com:DiSiqueira/GoTree.git
68+
$ git clone --recursive git@github.com:d6o/GoTree.git
6969
$ cd GoTree/
7070
```
7171

7272
## Social Coding
7373

7474
1. Create an issue to discuss about your idea
75-
2. [Fork it] (https://github.com/DiSiqueira/GoTree/fork)
75+
2. [Fork it] (https://github.com/d6o/GoTree/fork)
7676
3. Create your feature branch (`git checkout -b my-new-feature`)
7777
4. Commit your changes (`git commit -am 'Add some feature'`)
7878
5. Push to the branch (`git push origin my-new-feature`)

coverage.out

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
mode: atomic
2+
github.com/disiqueira/gotree/v3/gotree.go:43.28,48.2 1 145
3+
github.com/disiqueira/gotree/v3/gotree.go:53.38,57.2 3 119
4+
github.com/disiqueira/gotree/v3/gotree.go:61.35,62.17 1 3
5+
github.com/disiqueira/gotree/v3/gotree.go:62.17,64.3 1 1
6+
github.com/disiqueira/gotree/v3/gotree.go:65.2,65.33 1 2
7+
github.com/disiqueira/gotree/v3/gotree.go:69.30,71.2 1 147
8+
github.com/disiqueira/gotree/v3/gotree.go:74.31,76.2 1 238
9+
github.com/disiqueira/gotree/v3/gotree.go:79.31,81.2 1 6
10+
github.com/disiqueira/gotree/v3/gotree.go:83.27,85.2 1 6
11+
github.com/disiqueira/gotree/v3/gotree.go:88.40,97.2 6 6
12+
github.com/disiqueira/gotree/v3/gotree.go:99.75,107.31 3 117
13+
github.com/disiqueira/gotree/v3/gotree.go:107.31,108.12 1 4961
14+
github.com/disiqueira/gotree/v3/gotree.go:108.12,110.4 1 4953
15+
github.com/disiqueira/gotree/v3/gotree.go:110.9,112.4 1 8
16+
github.com/disiqueira/gotree/v3/gotree.go:114.2,117.10 3 117
17+
github.com/disiqueira/gotree/v3/gotree.go:117.10,119.3 1 108
18+
github.com/disiqueira/gotree/v3/gotree.go:122.2,126.23 4 117
19+
github.com/disiqueira/gotree/v3/gotree.go:126.23,128.13 2 122
20+
github.com/disiqueira/gotree/v3/gotree.go:128.13,133.12 5 117
21+
github.com/disiqueira/gotree/v3/gotree.go:135.3,135.11 1 5
22+
github.com/disiqueira/gotree/v3/gotree.go:135.11,137.4 1 2
23+
github.com/disiqueira/gotree/v3/gotree.go:137.9,139.4 1 3
24+
github.com/disiqueira/gotree/v3/gotree.go:140.3,143.31 4 5
25+
github.com/disiqueira/gotree/v3/gotree.go:146.2,146.25 1 117
26+
github.com/disiqueira/gotree/v3/gotree.go:149.62,150.17 1 110
27+
github.com/disiqueira/gotree/v3/gotree.go:150.17,152.3 1 2
28+
github.com/disiqueira/gotree/v3/gotree.go:154.2,160.22 3 108
29+
github.com/disiqueira/gotree/v3/gotree.go:160.22,163.25 3 117
30+
github.com/disiqueira/gotree/v3/gotree.go:163.25,166.4 2 104
31+
github.com/disiqueira/gotree/v3/gotree.go:168.2,168.25 1 108

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module github.com/disiqueira/gotree/v3
1+
module github.com/d6o/gotree/v3
22

3-
go 1.13
3+
go 1.23

0 commit comments

Comments
 (0)