Golang os.Chmod() function examples

package os

Golang os.Chmod() function usage examples

Example 1:

 header, err := tarBallReader.Next()
 ...
 err = os.Chmod(filename, os.FileMode(header.Mode))

 if err != nil {
 fmt.Println(err)
 os.Exit(1)
 }

see full example at : https://www.socketloop.com/tutorials/golang-untar-or-extract-tar-ball-archive-example

Example 2:

 Chmod(file, 0777)

Reference :

http://golang.org/pkg/os/#Chmod

Advertisement