swaggo / swag

Automatically generate RESTful API documentation with Swagger 2.0 for Go.
MIT License
10.58k stars 1.19k forks source link

Handle case of empty GOROOT #1798

Closed evan-goode closed 5 months ago

evan-goode commented 5 months ago

Describe the PR

In some situations, such as when using the go-swag Nix package, runtime.GOROOT() will be empty, and RangeFiles will skip all source paths since technically, all paths are prefixed with the empty string.

See also https://github.com/NixOS/nixpkgs/issues/224701

May resolve some cases of https://github.com/swaggo/swag/issues/1622.

Relation issue https://github.com/NixOS/nixpkgs/issues/224701 https://github.com/swaggo/swag/issues/1622

Additional context

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.70%. Comparing base (91624ad) to head (4aab213). Report is 7 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1798 +/- ## ========================================== - Coverage 83.40% 81.70% -1.71% ========================================== Files 16 17 +1 Lines 3881 3962 +81 ========================================== Hits 3237 3237 - Misses 545 626 +81 Partials 99 99 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.