Skip to content

Commit

Permalink
fix: main.go build by moving Umask methods to utils (#1967)
Browse files Browse the repository at this point in the history
* fix : builds

Signed-off-by: charankamarapu <kamarapucharan@gmail.com>

* fix: go build

Signed-off-by: charankamarapu <kamarapucharan@gmail.com>

---------

Signed-off-by: charankamarapu <kamarapucharan@gmail.com>
  • Loading branch information
charankamarapu committed Jun 14, 2024
1 parent b02c0b5 commit ecb8ba8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 30 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ func start(ctx context.Context) {
// Setting 'umask' to '0' ensures that 'keploy' can precisely control the permissions of the files it creates.
// However, it's important to note that this approach may not work in scenarios involving mounted volumes,
// as the 'umask' is set by the host system, and cannot be overridden by 'keploy' or individual processes.
oldMask := SetUmask()
defer RestoreUmask(oldMask)
oldMask := utils.SetUmask()
defer utils.RestoreUmask(oldMask)

userDb := userDb.New(logger)
if dsn != "" {
Expand Down
15 changes: 0 additions & 15 deletions mask_linux.go

This file was deleted.

13 changes: 0 additions & 13 deletions mask_others.go

This file was deleted.

13 changes: 13 additions & 0 deletions utils/mask_others.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build !windows

package utils

import "syscall"

func SetUmask() int {
return syscall.Umask(0)
}

func RestoreUmask(oldMask int) {
syscall.Umask(oldMask)
}
11 changes: 11 additions & 0 deletions utils/mask_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//go:build windows

package utils

func SetUmask() int {
return 0
}

func RestoreUmask(oldMask int) {
// Do nothing
}

0 comments on commit ecb8ba8

Please sign in to comment.