GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 62d30f...b48a48 )
by zuochao
14s queued 12s
created

credentials/utils/runtime.go   A

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 22
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A utils.NewRuntime 0 6 1
A utils.Timeout 0 6 2
1
package utils
2
3
import (
4
	"context"
5
	"net"
6
	"time"
7
)
8
9
// Runtime is for setting timeout, proxy and host
10
type Runtime struct {
11
	ReadTimeout    int
12
	ConnectTimeout int
13
	Proxy          string
14
	Host           string
15
}
16
17
// NewRuntime returns a Runtime
18
func NewRuntime(readTimeout, connectTimeout int, proxy string, host string) *Runtime {
19
	return &Runtime{
20
		ReadTimeout:    readTimeout,
21
		ConnectTimeout: connectTimeout,
22
		Proxy:          proxy,
23
		Host:           host,
24
	}
25
}
26
27
// Timeout is for connect Timeout
28
func Timeout(connectTimeout time.Duration) func(cxt context.Context, net, addr string) (c net.Conn, err error) {
29
	return func(ctx context.Context, network, address string) (net.Conn, error) {
30
		return (&net.Dialer{
31
			Timeout:   connectTimeout,
32
			DualStack: true,
33
		}).DialContext(ctx, network, address)
34
	}
35
}
36