|
@@ -18,8 +18,16 @@ type UrlInstruction interface {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func FormUrlInstruction(instructions ...UrlInstruction) string {
|
|
func FormUrlInstruction(instructions ...UrlInstruction) string {
|
|
|
|
|
+ if instructions == nil || len(instructions) == 0 {
|
|
|
|
|
+ return ""
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
urlInstructions := make([]string, 0)
|
|
urlInstructions := make([]string, 0)
|
|
|
for _, instruction := range instructions {
|
|
for _, instruction := range instructions {
|
|
|
|
|
+ if instruction == nil {
|
|
|
|
|
+ continue
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
urlInstruction, err := instruction.FormUrlInstruction()
|
|
urlInstruction, err := instruction.FormUrlInstruction()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
panic(err)
|
|
panic(err)
|
|
@@ -28,6 +36,10 @@ func FormUrlInstruction(instructions ...UrlInstruction) string {
|
|
|
urlInstructions = append(urlInstructions, urlInstruction)
|
|
urlInstructions = append(urlInstructions, urlInstruction)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if urlInstructions == nil || len(urlInstructions) == 0 {
|
|
|
|
|
+ return ""
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return "${" + strings.Join(urlInstructions, " ") + "}$"
|
|
return "${" + strings.Join(urlInstructions, " ") + "}$"
|
|
|
}
|
|
}
|
|
|
|
|
|