Support empty strings in bp2build
Previously, could not set an empty string as a value of an attribute;
however, this is necessary in some cases. To not unnecessarily create an
empty string, use string pointers for attributes rather than strings.
Test: go test bp2build tests
Change-Id: I03b3a3567452d455246d22d81f86c317d06b7c39
diff --git a/bp2build/build_conversion.go b/bp2build/build_conversion.go
index 10ee582..eb60cd1 100644
--- a/bp2build/build_conversion.go
+++ b/bp2build/build_conversion.go
@@ -698,9 +698,9 @@
} else {
return true
}
- // Always print bools, if you want a bool attribute to be able to take the default value, use a
- // bool pointer instead
- case reflect.Bool:
+ // Always print bool/strings, if you want a bool/string attribute to be able to take the default value, use a
+ // pointer instead
+ case reflect.Bool, reflect.String:
return false
default:
if !value.IsValid() {