summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-11-22 23:02:41 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2017-11-22 23:02:41 -0500
commit4a566395874113e38b5785fc5e436c96c001b032 (patch)
treeb0e388a6d84e49897e54ce2fe95bb6df0a65b7dc
parent8071395b87f7611b06b6121ff4d8ae1db5aef3cb (diff)
textprot.Mode: also implement GoStringer to have octal when debugging
-rw-r--r--textproto/types.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/textproto/types.go b/textproto/types.go
index dd4c48d..a4b438a 100644
--- a/textproto/types.go
+++ b/textproto/types.go
@@ -84,6 +84,10 @@ func (m Mode) String() string {
return fmt.Sprintf("%06o", m)
}
+func (m Mode) GoString() string {
+ return fmt.Sprintf("%07o", m)
+}
+
func PathEscape(path Path) string {
if strings.HasPrefix(string(path), "\"") || strings.ContainsRune(string(path), '\n') {
return "\"" + strings.Replace(strings.Replace(strings.Replace(string(path), "\\", "\\\\", -1), "\"", "\\\"", -1), "\n", "\\n", -1) + "\""