diff --git a/.github/workflows/test-and-lint.yaml b/.github/workflows/test-and-lint.yaml index 84d41d1..e6972c0 100644 --- a/.github/workflows/test-and-lint.yaml +++ b/.github/workflows/test-and-lint.yaml @@ -30,32 +30,16 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v4 - with: - submodules: recursive - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "^1.24.1" - - - name: Get libgit2 cache key from submodule committish - id: cache-key - run: echo "key=$(git ls-tree --object-only HEAD git2go)" >> $GITHUB_OUTPUT - - - name: Cache libgit2 - uses: actions/cache@v4 - with: - path: git2go/static-build/install - key: ${{ steps.cache-key.outputs.key }} + go-version: "^1.25" - - name: Build libgit2 from submodule - run: make install-static - working-directory: git2go - - name: Run unit test run: make test - name: Lint with golangci-lint uses: golangci/golangci-lint-action@v8 with: - version: "v2.2.1" + version: "v2.6.1" diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 0cda055..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "git2go"] - path = git2go - url = https://github.com/libgit2/git2go.git diff --git a/.golangci.yaml b/.golangci.yaml index a0057b0..0d56815 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -100,7 +100,7 @@ linters: - path: '^auth/cache\.go$' linters: - gosec - # crypto/sha1 is used for hashing, not encryption. + # crypto/sha1 is used for hashing, not encryption. text: "weak cryptographic primitive" - path: '^cmd/toolkit-assume-role/main\.go$' linters: @@ -114,10 +114,9 @@ linters: text: "G114: Use of net/http serve function that has no support for setting timeouts" paths: - adhoc/ - - git2go/ issues: - max-issues-per-linter: 0 + max-issues-per-linter: 0 max-same-issues: 0 formatters: enable: @@ -129,7 +128,4 @@ formatters: - standard - default - localmodule - exclusions: - paths: - - git2go/ - \ No newline at end of file + diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79260c2..7923bc0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,12 @@ repos: - repo: https://github.com/golangci/golangci-lint - rev: v2.2.1 + rev: v2.6.1 hooks: - id: golangci-lint-config-verify - id: golangci-lint-fmt - id: golangci-lint-full + + - repo: https://github.com/godaddy/tartufo + rev: v6.0.0 + hooks: + - id: tartufo diff --git a/Makefile b/Makefile index 9587524..e21de39 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,5 @@ .DEFAULT_GOAL := all -export PKG_CONFIG_PATH=$(CURDIR)/git2go/static-build/install/lib/pkgconfig - test: @go test ./... .PHONY: test @@ -32,11 +30,3 @@ lint-all: all: test lint .PHONY: all - -toolkit-git-hook: - @go build -tags static ./cmd/toolkit-git-hook -.PHONY: toolkit-git-hook - -try-run-hook: toolkit-git-hook - @./toolkit-git-hook -.PHONY: test-run-hook diff --git a/cmd/toolkit-assume-role/main.go b/cmd/toolkit-assume-role/main.go index 1e2b70d..b1439cf 100644 --- a/cmd/toolkit-assume-role/main.go +++ b/cmd/toolkit-assume-role/main.go @@ -37,6 +37,7 @@ func registerFlagsAndHelp() { flag.Usage = func() { _, _ = fmt.Fprintf(flag.CommandLine.Output(), helpMsg, os.Args[0]) + flag.PrintDefaults() } } diff --git a/cmd/toolkit-git-hook/main.go b/cmd/toolkit-git-hook/main.go deleted file mode 100644 index 08dab5a..0000000 --- a/cmd/toolkit-git-hook/main.go +++ /dev/null @@ -1,14 +0,0 @@ -package main - -import ( - "fmt" - "os" - - git "github.com/libgit2/git2go/v34" -) - -func main() { - repo, _ := git.OpenRepository(".git") - - fmt.Fprintf(os.Stderr, "Hello - %s\n", repo.Path()) -} diff --git a/cmd/toolkit-serve-static/main.go b/cmd/toolkit-serve-static/main.go index 4abd1db..cc1381f 100644 --- a/cmd/toolkit-serve-static/main.go +++ b/cmd/toolkit-serve-static/main.go @@ -27,6 +27,7 @@ func main() { flag.Usage = func() { _, _ = fmt.Fprintf(flag.CommandLine.Output(), helpMsg, os.Args[0]) + flag.PrintDefaults() } diff --git a/git2go b/git2go deleted file mode 160000 index c1ec21d..0000000 --- a/git2go +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c1ec21d89caa0cdb0aefd6f6b8f95648418a3543 diff --git a/go.mod b/go.mod index 2aa2e4c..fc36e3f 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,6 @@ require ( github.com/charmbracelet/lipgloss v1.1.0 github.com/davecgh/go-spew v1.1.1 github.com/goccy/go-yaml v1.18.0 - github.com/libgit2/git2go/v34 v34.0.0 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c github.com/stretchr/testify v1.10.0 github.com/yuin/goldmark v1.7.13 @@ -49,7 +48,6 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect - golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c // indirect golang.org/x/sync v0.15.0 // indirect golang.org/x/sys v0.33.0 // indirect golang.org/x/text v0.3.8 // indirect diff --git a/go.sum b/go.sum index a26737d..408dfaf 100644 --- a/go.sum +++ b/go.sum @@ -62,12 +62,8 @@ github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6 github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw= github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -github.com/libgit2/git2go/v34 v34.0.0 h1:UKoUaKLmiCRbOCD3PtUi2hD6hESSXzME/9OUZrGcgu8= -github.com/libgit2/git2go/v34 v34.0.0/go.mod h1:blVco2jDAw6YTXkErMMqzHLcAjKkwF0aWIRHBqiJkZ0= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -95,27 +91,17 @@ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavM github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/yuin/goldmark v1.7.13 h1:GPddIs617DnBLFFVJFgpo1aBfe/4xcvMc3SB5t/D0pA= github.com/yuin/goldmark v1.7.13/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c h1:9HhBz5L/UjnK9XLtiZhYAdue5BVKep3PMmS2LuPDt8k= -golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E= golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=