Skip to content

fix: handle os.Getwd() error silently ignored in AddStaticFiles #3322

@SatishKumar620

Description

@SatishKumar620

Bug Description

In AddStaticFiles function in pkg/gofr/gofr.go (line 402), the error
returned by os.Getwd() is silently ignored using _.

Current Code

currentWorkingDir, _ := os.Getwd()
filePath = filepath.Join(currentWorkingDir, filePath)
Problem
If os.Getwd() fails, currentWorkingDir becomes an empty string,
causing filePath to be resolved incorrectly without any error or log
message to the developer. This makes debugging very difficult.


##Expected Behavior
The error should be handled and logged so developers are informed when
working directory resolution fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions