From fe9626af296f7c7893af8cff88bc4195724bea07 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 16 Mar 2022 03:50:26 +0100 Subject: Use `go run` for tool dependencies, require go 1.17 (#18874) This ensures the tools only run in the versions we've tested and it also does not polute PATH with those tools so they are truly isolated. This syntax of `go run` requires go 1.17, so the minimum version is set accordingly. Fixes: https://github.com/go-gitea/gitea/issues/18867 Co-authored-by: techknowlogick --- build/code-batch-process.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'build') diff --git a/build/code-batch-process.go b/build/code-batch-process.go index 8139fe7623..b2290af771 100644 --- a/build/code-batch-process.go +++ b/build/code-batch-process.go @@ -40,7 +40,7 @@ func passThroughCmd(cmd string, args []string) error { } c := exec.Cmd{ Path: foundCmd, - Args: args, + Args: append([]string{cmd}, args...), Stdin: os.Stdin, Stdout: os.Stdout, Stderr: os.Stderr, @@ -271,9 +271,9 @@ func main() { log.Print("the -d option is not supported by gitea-fmt") } cmdErrors = append(cmdErrors, giteaFormatGoImports(files, containsString(subArgs, "-l"), containsString(subArgs, "-w"))) - cmdErrors = append(cmdErrors, passThroughCmd("gofumpt", append([]string{"-extra", "-lang", "1.16"}, substArgs...))) + cmdErrors = append(cmdErrors, passThroughCmd("go", append([]string{"run", os.Getenv("GOFUMPT_PACKAGE"), "-extra", "-lang", "1.17"}, substArgs...))) case "misspell": - cmdErrors = append(cmdErrors, passThroughCmd("misspell", substArgs)) + cmdErrors = append(cmdErrors, passThroughCmd("go", append([]string{"run", os.Getenv("MISSPELL_PACKAGE")}, substArgs...))) default: log.Fatalf("unknown cmd: %s %v", subCmd, subArgs) } -- cgit v1.2.3