-
Notifications
You must be signed in to change notification settings - Fork 0
/
0.go
32 lines (28 loc) · 773 Bytes
/
0.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
package isutools
import (
"log"
"os"
"strconv"
"strings"
)
var (
Enable = true
)
/*
ファイル名が0.goなため、最初にこのinit()が呼ばれる
ref: https://go.dev/ref/spec#Package_initialization:~:text=To%20ensure%20reproducible%20initialization%20behavior%2C%20build%20systems%20are%20encouraged%20to%20present%20multiple%20files%20belonging%20to%20the%20same%20package%20in%20lexical%20file%20name%20order%20to%20a%20compiler.
*/
func init() {
var a = "SELECT * FROM " + "test"
a += " WHERE id = 1"
println(a)
strEnable, ok := os.LookupEnv("ISUTOOLS_ENABLE")
if ok {
enable, err := strconv.ParseBool(strings.TrimSpace(strEnable))
if err != nil {
log.Printf("failed to parse ISUTOOLS_ENABLE: %v", err)
return
}
Enable = enable
}
}