I\'m trying to create a log file at the start of my program.
I need to check if a \"/log\" directory exists if it doesn\'t create the directory then move on to creat
@Daniel's statement in his answer is not really correct, and also it talks about a decimal number and then uses an octal one, as @SashaCrofter correctly pointed out in his comment.
In reality, it doesn't matter what form your permission value is in as long as it represents sensible Unix permissions.
Since permission bits on POSIX file systems come in triples of bits — three bits for owner, group and others access, plus three bits of modifiers (such as sticky bits), — it's customary to use octal numbers to represent permissions as each digit in an octal number represents a three-bit value.
Hence, when you use 0700 in Go code, the leading 0 is stripped and is only there to tell the parser it sees an octal number literal, and the following three letters stand for the owner, group and others permissions, in this order. Should you, say, want to also set the group sticky bit as well as making the file system object group-readable and executable, you'd specify 02750 and so on.
Note that the actual permissions the file system object acquires is further modulated by the active umask
of the process which creates the object.
To get more grip on these topics, it's best to read the chmod
manual pages and general literature on Unix-like operating systems.