INNER CODE UNIT · Go
removeOutputFile
NVIDIA/k8s-device-plugin · cmd/gpu-feature-discovery/main.go:318
func removeOutputFile(path string) error {
absPath, err := filepath.Abs(path)
if err != nil {
return fmt.Errorf("failed to retrieve absolute path of output file: %v", err)
}
absDir := filepath.Dir(absPath)
tmpDir := filepath.Join(absDir, "gfd-tmp")
err = os.RemoveAll(tmpDir)
if err != nil {
return fmt.Errorf("failed to remove temporary output directory: %v", err)
}
err = os.Remove(absPath)
if err != nil {
return fmt.Errorf("failed to remove output file: %v", err)
}