Skip to content

Commit

Permalink
Conditionally clear umask if non-windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
andriygm committed Aug 1, 2024
1 parent f881884 commit 5062d1c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ go.work
dvs

# Testing environment
testing/environment/
testing/environment/
dist/
2 changes: 2 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: 2

project_name: dvs

before:
Expand Down
9 changes: 9 additions & 0 deletions internal/umask.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//go:build !windows

package internal

import "syscall"

func ClearUmask() {
syscall.Umask(0)
}
5 changes: 5 additions & 0 deletions internal/umask_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package internal

func ClearUmask() {

}
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package main

import (
"dvs/cmd"
"syscall"
"dvs/internal"
)

func main() {
// Clear default umask
syscall.Umask(0)
internal.ClearUmask()

cmd.Execute()
}

0 comments on commit 5062d1c

Please sign in to comment.