From 4424943ffcb276102e68646d306cdcdcab8d2f71 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 27 Mar 2025 23:33:11 +0800 Subject: [PATCH] Lint and add CI --- .build.yml | 19 +++++++++++++++++++ http_handle_repo_raw.go | 2 +- http_handle_repo_tree.go | 2 +- diff --git a/.build.yml b/.build.yml new file mode 100644 index 0000000000000000000000000000000000000000..38e25712ec7f44988baeee2ab557460538fd2b75 --- /dev/null +++ b/.build.yml @@ -0,0 +1,19 @@ +image: alpine/edge +packages: + - go + - golangci-lint + - make + - gcc + - musl-dev +sources: + - ssh://forge.lindenii.runxiyu.org/lindenii/forge/:/repos/server/ +tasks: + - prepare: | + cd server + git checkout go + - build: | + cd server + make + - lint: | + cd server + golangci-lint run . diff --git a/http_handle_repo_raw.go b/http_handle_repo_raw.go index 36e59d7b32f832158972831b44083047097e4ad8..aab64b6ea6042be0b6af262feaf96cfa27354a72 100644 --- a/http_handle_repo_raw.go +++ b/http_handle_repo_raw.go @@ -33,7 +33,7 @@ return } refHashSlice = refHash[:] - cacheHandle := append(refHashSlice, []byte(pathSpec)...) + cacheHandle := append(refHashSlice, []byte(pathSpec)...) //nolint:gocritic if value, found := treeReadmeCache.Get(cacheHandle); found { params["files"] = value.DisplayTree diff --git a/http_handle_repo_tree.go b/http_handle_repo_tree.go index 7d95c023e4b3809ffd609075561bd6dd976191e8..1bb9940157319bded167ec30d79e451e8ff664d5 100644 --- a/http_handle_repo_tree.go +++ b/http_handle_repo_tree.go @@ -39,7 +39,7 @@ return } refHashSlice = refHash[:] - cacheHandle := append(refHashSlice, []byte(pathSpec)...) + cacheHandle := append(refHashSlice, []byte(pathSpec)...) //nolint:gocritic if value, found := treeReadmeCache.Get(cacheHandle); found { params["files"] = value.DisplayTree -- 2.48.1