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

uber-go / cadence-client / 018e9ff9-d8ed-403a-8c3a-5ffe0c57f644

02 Apr 2024 06:02PM UTC coverage: 64.75% (+0.08%) from 64.67%
018e9ff9-d8ed-403a-8c3a-5ffe0c57f644

push

buildkite

web-flow
Update client wrappers with new async APIs (#1327)

182 of 242 new or added lines in 2 files covered. (75.21%)

3 existing lines in 2 files now uncovered.

13389 of 20678 relevant lines covered (64.75%)

314.89 hits per line

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

53.85
/internal/common/util/util.go
1
// Copyright (c) 2017-2020 Uber Technologies, Inc.
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a copy
4
// of this software and associated documentation files (the "Software"), to deal
5
// in the Software without restriction, including without limitation the rights
6
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
// copies of the Software, and to permit persons to whom the Software is
8
// furnished to do so, subject to the following conditions:
9
//
10
// The above copyright notice and this permission notice shall be included in
11
// all copies or substantial portions of the Software.
12
//
13
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
// THE SOFTWARE.
20

21
package util
22

23
import (
24
        "reflect"
25
        "sync"
26
        "time"
27
)
28

29
// MergeDictoRight copies the contents of src to dest
30
func MergeDictoRight(src map[string]string, dest map[string]string) {
×
31
        for k, v := range src {
×
32
                dest[k] = v
×
33
        }
×
34
}
35

36
// MergeDicts creates a union of the two dicts
37
func MergeDicts(dic1 map[string]string, dic2 map[string]string) (resultDict map[string]string) {
×
38
        resultDict = make(map[string]string)
×
39
        MergeDictoRight(dic1, resultDict)
×
40
        MergeDictoRight(dic2, resultDict)
×
41
        return
×
42
}
×
43

44
// AwaitWaitGroup calls Wait on the given wait
45
// Returns true if the Wait() call succeeded before the timeout
46
// Returns false if the Wait() did not return before the timeout
47
func AwaitWaitGroup(wg *sync.WaitGroup, timeout time.Duration) bool {
384✔
48

384✔
49
        doneC := make(chan struct{})
384✔
50

384✔
51
        go func() {
768✔
52
                wg.Wait()
384✔
53
                close(doneC)
384✔
54
        }()
384✔
55

56
        select {
384✔
UNCOV
57
        case <-doneC:
×
UNCOV
58
                return true
×
59
        case <-time.After(timeout):
384✔
60
                return false
384✔
61
        }
62
}
63

64
var typeOfByteSlice = reflect.TypeOf(([]byte)(nil))
65

66
// IsTypeByteSlice checks whether the type passed in is a ByteSlice type
67
func IsTypeByteSlice(inType reflect.Type) bool {
703✔
68
        return inType == typeOfByteSlice || inType == reflect.PtrTo(typeOfByteSlice)
703✔
69
}
703✔
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

© 2025 Coveralls, Inc