Move shared checks into validation package
This commit is contained in:
33
internal/validation/validation.go
Normal file
33
internal/validation/validation.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// Package validation owns the shared checks run against a captured candidate.
|
||||
package validation
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"gitea.maximumdirect.net/eric/ReleaseKit/internal/gotool"
|
||||
)
|
||||
|
||||
// Settings selects shared validation behavior. Its zero value runs the current
|
||||
// default Go suite.
|
||||
type Settings struct{}
|
||||
|
||||
// Request identifies the captured source and output used by shared validation.
|
||||
type Request struct {
|
||||
RepositoryDir string
|
||||
Commit string
|
||||
Output io.Writer
|
||||
Settings Settings
|
||||
}
|
||||
|
||||
// Run executes shared validation for the captured candidate.
|
||||
func Run(ctx context.Context, request Request) error {
|
||||
tool, err := gotool.New(ctx, request.RepositoryDir)
|
||||
if err != nil {
|
||||
return fmt.Errorf("prepare Go toolchain: %w", err)
|
||||
}
|
||||
_, err = tool.Run(ctx, request.RepositoryDir, gotool.Native, gotool.Target{}, request.Output,
|
||||
"test", "-mod=readonly", "-count=1", "./...")
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user