diff options
author | Rasmus Dahlberg <rasmus@rgdd.se> | 2023-04-02 13:47:57 +0200 |
---|---|---|
committer | Rasmus Dahlberg <rasmus@rgdd.se> | 2023-04-02 14:33:31 +0200 |
commit | 89e2b5f0bbbf9b2e3e6bc7f30a12e28e7109d82b (patch) | |
tree | 2d8480278bc5b0fecb750612f6e77e06964bb2f2 /internal/line | |
parent | 1bd49fe925f73bbff94477b9b847252885729b92 (diff) |
Fix bug where a few input lines are skipped
Diffstat (limited to 'internal/line')
-rw-r--r-- | internal/line/line.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/line/line.go b/internal/line/line.go new file mode 100644 index 0000000..02dbbcc --- /dev/null +++ b/internal/line/line.go @@ -0,0 +1,22 @@ +package line + +import "sync" + +type Line struct { + sync.Mutex + num int64 +} + +func (l *Line) Inc() { + l.Lock() + defer l.Unlock() + + l.num++ +} + +func (l *Line) Num() int64 { + l.Lock() + defer l.Unlock() + + return l.num +} |