Reputation: 1381
So I'm attempting to create a CMS where each user makes their own website and it is stored in a directory named as their choosing. However when I use
os.Mkdir("/Users/anonrose/Documents/goCode/src/github.com/anonrose/GoDataStructs/tests/myWebsite", os."some permission")
the "some permission" part is what I'm having troubles with. When I attempt to access the directory once it's been created I never have the correct permission. Is there a os.FileMode
that I can use to set the permissions as read and write for anyone when I go to create the directory.
Upvotes: 9
Views: 10472
Reputation: 1
I always use os.ModeDir:
package main
import "os"
func main() {
os.Mkdir("March", os.ModeDir)
}
Upvotes: 1