do not inline printOption and rename it to writeOption
diff --git a/ini_private.go b/ini_private.go
index b35cffb..7fdf7b3 100644
--- a/ini_private.go
+++ b/ini_private.go
@@ -81,18 +81,6 @@
 	sectionwritten := false
 	comments := (options & IniIncludeComments) != IniNone
 
-	printOption := func(commentOption string, optionName string, optionType reflect.Kind, optionKey string, optionValue string) {
-		if optionType == reflect.String {
-			optionValue = quoteIfNeeded(optionValue)
-		}
-
-		if optionKey == "" {
-			fmt.Fprintf(writer, "%s%s = %s\n", commentOption, optionName, optionValue)
-		} else {
-			fmt.Fprintf(writer, "%s%s = %s:%s\n", commentOption, optionName, optionKey, optionValue)
-		}
-	}
-
 	for _, option := range group.options {
 		if option.isFunc() {
 			continue
@@ -129,7 +117,7 @@
 		case reflect.Slice:
 			for idx := 0; idx < val.Len(); idx++ {
 				v, _ := convertToString(val.Index(idx), option.tag)
-				printOption(commentOption, oname, val.Type().Elem().Kind(), "", v)
+				writeOption(writer, commentOption, oname, val.Type().Elem().Kind(), "", v)
 			}
 
 			if val.Len() == 0 {
@@ -150,7 +138,7 @@
 			for _, k := range keys {
 				v, _ := convertToString(val.MapIndex(kkmap[k]), option.tag)
 
-				printOption(commentOption, oname, val.Type().Elem().Kind(), k, v)
+				writeOption(writer, commentOption, oname, val.Type().Elem().Kind(), k, v)
 			}
 
 			if val.Len() == 0 {
@@ -160,7 +148,7 @@
 			v, _ := convertToString(val, option.tag)
 
 			if len(v) != 0 {
-				printOption(commentOption, oname, kind, "", v)
+				writeOption(writer, commentOption, oname, kind, "", v)
 			} else {
 				fmt.Fprintf(writer, "%s%s =\n", commentOption, oname)
 			}
@@ -176,6 +164,18 @@
 	}
 }
 
+func writeOption(writer io.Writer, commentOption string, optionName string, optionType reflect.Kind, optionKey string, optionValue string) {
+	if optionType == reflect.String {
+		optionValue = quoteIfNeeded(optionValue)
+	}
+
+	if optionKey == "" {
+		fmt.Fprintf(writer, "%s%s = %s\n", commentOption, optionName, optionValue)
+	} else {
+		fmt.Fprintf(writer, "%s%s = %s:%s\n", commentOption, optionName, optionKey, optionValue)
+	}
+}
+
 func writeCommandIni(command *Command, namespace string, writer io.Writer, options IniOptions) {
 	command.eachGroup(func(group *Group) {
 		writeGroupIni(command, group, namespace, writer, options)