-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Describe the bug
When running swag fmt
, the formatter updates the permission of the files.
This minor difference usually don't cause any issues, only in some cases like if someone is running swag fmt
with root permission. The owner is changed the root. With group read permission gone, the user cannot access the formatted file.
Overall, I believe fmt
should preserve the permission from the original file as a default behavior.
To Reproduce
- Check the file permission before formatting
> ls -l
-rw-r--r-- 1 user user 7755 Aug 2 9:42 main.go
- run
swag fmt
- Check the file permission again
> ls -l
-rw------- 1 user user 7755 Aug 2 9:43 main.go
// If running with root, because user is change, user don't have permission to read the file anymore
Expected behavior
fmt
should preserve the permission from the original file.
Your swag version
v1.8.12
Your go version
e.g. 1.12.0
Desktop (please complete the following information):
- OS: macOS
- Version: Ventura 13.0
Metadata
Metadata
Assignees
Labels
No labels