summaryrefslogtreecommitdiff
path: root/obo.go
diff options
context:
space:
mode:
authorSilvan Jegen <s.jegen@gmail.com>2014-11-08 15:50:13 +0100
committerSilvan Jegen <s.jegen@gmail.com>2014-11-08 15:50:13 +0100
commit475ffd33cea6a209408cfe9aac9c51e90893cbc6 (patch)
treef64519afe38fe90527ca68a5cba1fb070007b751 /obo.go
parent389e98a4fa0b9d1fde5343a62b64df3ca5ccbda9 (diff)
Use a switch statement for readability reasons
Add a test for comments parsing as well.
Diffstat (limited to 'obo.go')
-rw-r--r--obo.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/obo.go b/obo.go
index 7ae6e00..99af41e 100644
--- a/obo.go
+++ b/obo.go
@@ -89,7 +89,8 @@ func parseObo(oboinput bufio.Reader, obochan chan *OboTermEntry, parentchildren
fmt.Fprintf(os.Stderr, "Chopped line number: %d\n", lineno)
}
- if line == "[Term]" {
+ switch line {
+ case "[Term]":
termsstarted = true
if entry != nil {
obochan <- entry
@@ -97,14 +98,16 @@ func parseObo(oboinput bufio.Reader, obochan chan *OboTermEntry, parentchildren
entry = new(OboTermEntry)
continue
- } else if line == "\n" {
+ case "\n":
continue
- } else if line == "[Typedef]" {
+ case "[Typedef]":
continue
- } else if line == "" {
- continue
- } else if line[0] == '!' {
+ case "":
continue
+ default:
+ if line[0] == '!' {
+ continue
+ }
}
if termsstarted {