Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/cmd/go/internal/modcmd/vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,10 @@ func vendorPkg(s *modload.State, vdir, pkg string) {
// TODO(#42504): Find a better way to avoid errors from ImportDir. We'll
// need to figure this out when we switch to PackagesAndErrors as per the
// TODO above.
var multiplePackageError *build.MultiplePackageError
var noGoError *build.NoGoError
if err != nil {
if errors.As(err, &noGoError) {
if _, ok := errors.AsType[*build.NoGoError](err); ok {
return // No source files in this package are built. Skip embeds in ignored files.
} else if !errors.As(err, &multiplePackageError) { // multiplePackageErrors are OK, but others are not.
} else if _, ok := errors.AsType[*build.MultiplePackageError](err); !ok { // multiplePackageErrors are OK, but others are not.
base.Fatalf("internal error: failed to find embedded files of %s: %v\n", pkg, err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/encoding/asn1/asn1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ func TestParsingMemoryConsumption(t *testing.T) {
Value []byte
}
_, err := Unmarshal(derBomb, &out)
if !errors.As(err, &SyntaxError{}) {
if _, ok := errors.AsType[SyntaxError](err); !ok {
t.Fatalf("Incorrect error result: want (%v), but got (%v) instead", &SyntaxError{}, err)
}

Expand Down