chmodTarEntry is used to adjust the file permissions used in tar header based on the platform the archival is done.
(perm os.FileMode)
| 353 | // chmodTarEntry is used to adjust the file permissions used in tar header based |
| 354 | // on the platform the archival is done. |
| 355 | func chmodTarEntry(perm os.FileMode) os.FileMode { |
| 356 | if runtime.GOOS != "windows" { |
| 357 | return perm |
| 358 | } |
| 359 | |
| 360 | // perm &= 0755 // this 0-ed out tar flags (like link, regular file, directory marker etc.) |
| 361 | permPart := perm & os.ModePerm |
| 362 | noPermPart := perm &^ os.ModePerm |
| 363 | // Add the x bit: make everything +x from windows |
| 364 | permPart |= 0111 |
| 365 | permPart &= 0755 |
| 366 | |
| 367 | return noPermPart | permPart |
| 368 | } |
| 369 | |
| 370 | // fillGo18FileTypeBits fills type bits which have been removed on Go 1.9 archive/tar |
| 371 | // https://github.com/golang/go/commit/66b5a2f |