Rediscover Go settings only when Go work needs them
This commit is contained in:
@@ -304,6 +304,28 @@ func TestCheckRefreshesGoSettingsAfterAdditionalChecks(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckNeedsNoGoDiscoveryAfterFinalCallback(t *testing.T) {
|
||||
repository := newRepository(t, "# Example Product v1.2.3\n\nRelease note.\n")
|
||||
gitPath, err := exec.LookPath("git")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
gitOnly := t.TempDir()
|
||||
if err := os.Symlink(gitPath, filepath.Join(gitOnly, "git")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = Check(context.Background(), Request{
|
||||
RepositoryDir: repository, Product: "Example Product", Version: testVersion,
|
||||
AfterValidate: func(context.Context, Candidate, *gotool.Owner) error {
|
||||
t.Setenv("PATH", gitOnly)
|
||||
return nil
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("completed Go work was rediscovered after final callback: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckSharesGoDiscoveryWithAfterValidateCallback(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("the controlled Go command fixture uses a POSIX shell")
|
||||
|
||||
Reference in New Issue
Block a user