• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gatewayd-io / gatewayd / 20144174851

11 Dec 2025 07:00PM UTC coverage: 59.742% (-0.02%) from 59.764%
20144174851

push

github

web-flow
Add renovate.json (#707)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

5611 of 9392 relevant lines covered (59.74%)

18.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.33
/network/stack.go
1
package network
2

3
import "sync"
4

5
type Request struct {
6
        Data []byte
7
}
8

9
type Stack struct {
10
        items []*Request
11
        mu    sync.RWMutex
12
}
13

14
func (s *Stack) Push(req *Request) {
4✔
15
        s.mu.Lock()
4✔
16
        defer s.mu.Unlock()
4✔
17

4✔
18
        s.items = append(s.items, req)
4✔
19
}
4✔
20

21
func (s *Stack) GetLastRequest() *Request {
×
22
        s.mu.RLock()
×
23
        defer s.mu.RUnlock()
×
24

×
25
        if len(s.items) == 0 {
×
26
                return nil
×
27
        }
×
28

29
        return s.items[len(s.items)-1]
×
30
}
31

32
func (s *Stack) PopLastRequest() *Request {
4✔
33
        s.mu.Lock()
4✔
34
        defer s.mu.Unlock()
4✔
35

4✔
36
        if len(s.items) == 0 {
4✔
37
                return nil
×
38
        }
×
39

40
        lastItem := len(s.items) - 1
4✔
41
        req := s.items[lastItem]
4✔
42
        s.items = append(s.items[:lastItem], s.items[lastItem+1:]...)
4✔
43
        return req
4✔
44
}
45

46
func (s *Stack) UpdateLastRequest(req *Request) {
4✔
47
        s.mu.Lock()
4✔
48
        defer s.mu.Unlock()
4✔
49

4✔
50
        if len(s.items) == 0 {
4✔
51
                return
×
52
        }
×
53

54
        s.items[len(s.items)-1] = req
4✔
55
}
56

57
func (s *Stack) Clear() {
2✔
58
        s.mu.Lock()
2✔
59
        defer s.mu.Unlock()
2✔
60

2✔
61
        s.items = make([]*Request, 0)
2✔
62
}
2✔
63

64
func NewStack() *Stack {
2✔
65
        return &Stack{
2✔
66
                items: make([]*Request, 0),
2✔
67
                mu:    sync.RWMutex{},
2✔
68
        }
2✔
69
}
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc