nitter/build/format.go
Peter Kurfer c1c1667d9f
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is passing
feat(gitea): add lint-pr command
lint-pr runs golangci-lint, captures the result and uses it directly without temporary files
It also allows to automatically retrieve the PRs base commit and run golangci-lint only against changes in the current PR
2023-03-09 12:15:35 +01:00

33 lines
573 B
Go

//go:build mage
package main
import (
"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
)
func Format() {
mg.Deps(GoImports)
mg.Deps(GoFumpt)
}
func GoImports() error {
if err := ensureGoTool("goimports", "golang.org/x/tools/cmd/goimports", "latest"); err != nil {
return err
}
return sh.RunV(
"goimports",
"-local=inetmock.icb4dc0.de/inetmock",
"-w",
WorkingDir,
)
}
func GoFumpt() error {
if err := ensureGoTool("gofumpt", "mvdan.cc/gofumpt", "latest"); err != nil {
return err
}
return sh.RunV("gofumpt", "-l", "-w", WorkingDir)
}