-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathexport_test.go
54 lines (45 loc) · 1.01 KB
/
export_test.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
54
package lambroll
import (
"os"
"sync"
)
var (
CreateZipArchive = createZipArchive
ExpandExcludeFile = expandExcludeFile
LoadZipArchive = loadZipArchive
MergeTags = mergeTags
FillDefaultValues = fillDefaultValues
JSONStr = jsonStr
MarshalJSON = marshalJSON
NewFunctionFrom = newFunctionFrom
NewCallerIdentity = newCallerIdentity
)
type VersionsOutput = versionsOutput
type VersionsOutputs = versionsOutputs
func (app *App) CallerIdentity() *CallerIdentity {
return app.callerIdentity
}
func (app *App) LoadFunction(f string) (*Function, error) {
return app.loadFunction(f)
}
func init() {
Setenv = tSetenv
}
var envs = sync.Map{}
func tSetenv(key, value string) error {
orig, ok := os.LookupEnv(key)
os.Setenv(key, value)
if ok {
envs.Store(key, func() { os.Setenv(key, orig) })
} else {
envs.Store(key, func() { os.Unsetenv(key) })
}
return nil
}
func ResetEnv() {
envs.Range(func(key, value interface{}) bool {
value.(func())()
return true
})
envs = sync.Map{}
}