aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/acl/perms.go
blob: 829b134ff93fcd93ed851bdf941df4fd9978b747 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package acl

import "unsafe"

// String returns a text representation of perms.
func (perms Perm) String() string {
	buf := []byte{'-', '-', '-'}
	if perms&Read != 0 {
		buf[0] = 'r'
	}
	if perms&Write != 0 {
		buf[1] = 'w'
	}
	if perms&Execute != 0 {
		buf[2] = 'x'
	}
	return unsafe.String(unsafe.SliceData(buf), len(buf))
}