-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make key level tags in order and unique
- Loading branch information
1 parent
b8b0e18
commit 0fdd17a
Showing
5 changed files
with
92 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package gateway | ||
|
||
// appendIfMissing appends the given new item to the given slice. | ||
func appendIfMissing(slice []string, new string) []string { | ||
for _, item := range slice { | ||
if item == new { | ||
return slice | ||
} | ||
} | ||
return append(slice, new) | ||
} | ||
|
||
// contains checks whether the given slice contains the given item. | ||
func contains(s []string, i string) bool { | ||
for _, a := range s { | ||
if a == i { | ||
return true | ||
} | ||
} | ||
return false | ||
} |