Passed
Push — master ( 1dbab0...58c7cb )
by Serhii
02:41 queued 50s
created

config.go   A

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
cc 4
eloc 15
dl 0
loc 26
ccs 4
cts 5
cp 0.8
crap 4.128
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A timeago.SetConfig 0 6 2
A timeago.locationIsSet 0 2 1
A timeago.locationIsNotSet 0 2 1
1
package timeago
2
3
type Config struct {
4
	Language string
5
	Location string
6
}
7
8
var config = Config{
9
	Language: "en",
10
	Location: "",
11
}
12
13
func SetConfig(conf Config) {
14 1
	if conf.Language == "" {
15 1
		conf.Language = config.Language
16
	}
17
18 1
	config = conf
19
}
20
21
func locationIsSet() bool {
22 1
	return config.Location != ""
23
}
24
25
func locationIsNotSet() bool {
26
	return !locationIsSet()
27
}
28