From b5d21c0adf38a4726b14157786be8ad11c1eda22 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 9 Sep 2022 17:33:01 +0200 Subject: Generate go-licenses during tidy again (#21108) We can not have the `frontend` target depend on golang because of they way drone is set up. Move the `go-licenses` generation back into `tidy` where it will now also be checked for consistency during `tidy-check`. (I assume all `main` branch builds should currently fail [like this](https://drone.gitea.io/go-gitea/gitea/60244/1/11)). The reasony why it shouldn't be treated the same as for example `go generate` is because output files are checked in. tidy is imho the optimal target to run this after. Co-authored-by: Lunny Xiao --- build/generate-go-licenses.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'build') diff --git a/build/generate-go-licenses.go b/build/generate-go-licenses.go index 8840cae4a5..fedfdc315e 100644 --- a/build/generate-go-licenses.go +++ b/build/generate-go-licenses.go @@ -54,9 +54,17 @@ func main() { } path := strings.Replace(path, base+string(os.PathSeparator), "", 1) + name := filepath.Dir(path) + + // There might be a bug somewhere in go-licenses that sometimes interprets the + // root package as "." and sometimes as "code.gitea.io/gitea". Workaround by + // removing both of them for the sake of stable output. + if name == "." || name == "code.gitea.io/gitea" { + continue + } entries = append(entries, LicenseEntry{ - Name: filepath.Dir(path), + Name: name, Path: path, LicenseText: string(licenseText), }) -- cgit v1.2.3