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.
Test Failed
Push — master ( 2016e1...3270f6 )
by 光春
01:27
created

dlog.createFiles   A

Complexity

Conditions 2

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nop 2
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
package dlog
2
3
import (
4
	"log"
5
	"os"
6
	"time"
7
)
8
9
func init() {
10
	getDir, _ := os.Getwd()
11
	// 判断文件夹
12
	logStatus, _ := existFiles(getDir + "log/")
13
	if logStatus == false {
14
		_, _ = createFiles(getDir+"log/", 0755)
15
	}
16
}
17
18
func Info(accessLog string) {
0 ignored issues
show
introduced by
exported function Info should have comment or be unexported
Loading history...
19
	if f, err := os.OpenFile("log/"+getCurrentWjDate()+".log", os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666); err != nil {
20
		log.Println(err)
21
	} else {
22
		_, _ = f.WriteString(accessLog + "\n")
23
	}
24
}
25
func getCurrentWjDate() string {
26
	return time.Now().Format("20060102")
27
}
28
29
func existFiles(path string) (bool, error) {
30
	_, err := os.Stat(path)
31
	if err == nil {
32
		return true, nil
33
	}
34
	if os.IsNotExist(err) {
35
		return false, nil
36
	}
37
	return false, err
38
}
39
40
func createFiles(path string, perm int) (bool, error) {
41
	err := os.MkdirAll(path, os.FileMode(perm))
42
	if err != nil {
43
		return false, err
44
	} else {
0 ignored issues
show
introduced by
if block ends with a return statement, so drop this else and outdent its block
Loading history...
45
		return true, nil
46
	}
47
}
48