Skip to content

Commit 4a238a4

Browse files
EtiennePerotgvisor-bot
authored andcommitted
profiletool merge: Skip empty profile files.
These can be created for short-lived containers or for Gofers that sit and do nothing. Ignore them when merging. PiperOrigin-RevId: 780364804
1 parent a5ded54 commit 4a238a4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/profiletool/profiletool.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ func mergeProfiles() error {
8787
if info.IsDir() {
8888
return nil
8989
}
90+
if info.Size() == 0 {
91+
return nil
92+
}
9093
profilePaths = append(profilePaths, path)
9194
return nil
9295
})
@@ -95,7 +98,7 @@ func mergeProfiles() error {
9598
}
9699
}
97100
if len(profilePaths) == 0 {
98-
return errors.New("no profiles (or directories containing profiles) specified as positional arguments")
101+
return errors.New("no non-empty profiles (or directories containing profiles) specified as positional arguments")
99102
}
100103
profiles := make([]*profile.Profile, len(profilePaths))
101104
for i, profilePath := range profilePaths {

0 commit comments

Comments
 (0)