create a directory with normal permission in go -


how can create directory normal permissions (say 0700 in octal notation) os.mkdir method. did not manage find how set perm value correctly.

you can use octal notation directly:

os.mkdir("dirname", 0700) 

from documentation filemode:

the 9 least-significant bits standard unix rwxrwxrwx permissions

the mode bits defined may use normal octal notation chmod. however, must prefix 0 tell go octal literal.

also, remember 4th number doesn't exist in chmod. chmod, 1700 set sticky bit. in go, need set bit defined in os lib doing like: 0700 | os.modesticky


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -