Skip to content

When checking file/dir existence, manage all errors #26

@proofrock

Description

@proofrock

It only happened once, when testing wolfi as docker base: the mounting of resources in docker was somehow faulty, and this code:

func fileExists(filename string) bool {
	info, err := os.Stat(filename)
	if os.IsNotExist(err) {
		return false
	}
	return !info.IsDir()
}

(also the similar dirExists right below) would panic with a "pointer dereference", because there was an err not of the "right" type and it wasn't caught, so info was nil. Give a fault and exit if this happen, so that the reason is more evident.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions