nitter/build/lint.go

43 lines
608 B
Go
Raw Normal View History

//go:build mage
package main
import (
"context"
"fmt"
"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
)
func Lint(ctx context.Context) {
mg.CtxDeps(ctx, Generate)
mg.CtxDeps(ctx, Format)
mg.Deps(LintGo)
}
func LintGo() (err error) {
if IsPRBuild {
return lintGoPR()
}
return sh.RunV(
"golangci-lint",
"run",
"-v",
"--issues-exit-code=1",
)
}
func lintGoPR() error {
return GoRun(
"main.go",
"gitea",
"lint-pr",
"--from-pr-base",
fmt.Sprintf("--namespace=%s", repoOwner),
fmt.Sprintf("--repo=%s", repoName),
fmt.Sprintf("--pull-index=%d", prIndex),
)
}