From 1a4e6200b66b68d30efc4f94d588e3afb1704239 Mon Sep 17 00:00:00 2001 From: Kevin Lyda <kevin@lyda.ie> Date: Wed, 21 May 2025 12:49:12 +0100 Subject: [PATCH] Add dupl and a dupl make target --- .gitignore | 1 + Makefile | 6 ++++++ go.mod | 6 +++++- go.sum | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8c0ef17..6517223 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ *.obj *.lzh .*.swp +dupl.html diff --git a/Makefile b/Makefile index 57f50a0..614e534 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,12 @@ all: go generate ./... go install ./... +dupl: + find . -name '*.go' \ + | grep -Fv .sql.go \ + | go tool github.com/mibk/dupl -html -t 50 -files \ + > dupl.html + xdg-open dupl.html # vim:ft=make # diff --git a/go.mod b/go.mod index 9c7734c..7334816 100644 --- a/go.mod +++ b/go.mod @@ -61,6 +61,7 @@ require ( github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/mibk/dupl v1.0.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect @@ -113,4 +114,7 @@ require ( mvdan.cc/gofumpt v0.7.0 // indirect ) -tool github.com/sqlc-dev/sqlc/cmd/sqlc +tool ( + github.com/mibk/dupl + github.com/sqlc-dev/sqlc/cmd/sqlc +) diff --git a/go.sum b/go.sum index af023d1..89449aa 100644 --- a/go.sum +++ b/go.sum @@ -122,6 +122,8 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mibk/dupl v1.0.0 h1:aZc3jqrF9n0tUHwHt/+jsRxA8cRgA0Gdl56M7W7PoqE= +github.com/mibk/dupl v1.0.0/go.mod h1:pCr4pNxxIbFGvtyCOi0c7LVjmV6duhKWV+ex5vh38ME= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= -- GitLab