Permalink
Browse files

dont write out boolean values, just write the attribute name

  • Loading branch information...
daaku committed May 22, 2012
1 parent 5ee106e commit 9f807521e811605960bf5da8c5530aecdc9f535c
Showing with 10 additions and 1 deletion.
  1. +10 −1 attributes.go
View
@@ -65,7 +65,16 @@ func writeKeyValue(w io.Writer, key string, val interface{}) (int, error) {
return 0, nil
}
var written, i int
- i, err = fmt.Fprintf(w, ` %s="`, key)
+ i, err = fmt.Fprintf(w, ` %s`, key)
+ written += i
+ if err != nil {
+ return written, err
+ }
+ // bool values are not written, only the key is
+ if reflect.ValueOf(val).Kind() == reflect.Bool {
+ return written, nil
+ }
+ i, err = fmt.Fprintf(w, `="`)
written += i
if err != nil {
return written, err

0 comments on commit 9f80752

Please sign in to comment.