-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gmd.go
53 lines (47 loc) · 917 Bytes
/
gmd.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"errors"
"fmt"
"io"
"net/http"
"os"
"os/exec"
"path/filepath"
)
func init() {
var err error
this, err = os.Getwd()
if err != nil {
panic(err)
}
tempDir = filepath.Join(this, "temp")
if err := os.MkdirAll(tempDir, os.ModePerm); err != nil {
panic(err)
}
for _, tool := range tools {
_, err = exec.LookPath(tool)
if err != nil {
fmt.Printf("%s is not installed\n", tool)
os.Exit(1)
}
}
for _, url := range []string{pornBlackList} {
resp, err := http.Get(url)
if errors.Is(err, nil) {
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if errors.Is(err, nil) {
sources[url] = string(body)
}
}
}
ascii := filepath.Join(this, ".github", "ascii.txt")
file, err := os.Open(ascii)
if errors.Is(err, nil) {
defer file.Close()
content, err := io.ReadAll(file)
if errors.Is(err, nil) {
fmt.Println(string(content))
}
}
}