MCPcopy Create free account
hub / github.com/celer-pkg/celer / Setup

Method Setup

configs/ccache.go:24–52  ·  view source on GitHub ↗

Setup setup ccache.

()

Source from the content-addressed store, hash-verified

22
23// Setup setup ccache.
24func (c CCache) Setup() error {
25 if c.Enabled {
26 os.Unsetenv("CCACHE_DISABLE")
27 } else {
28 os.Setenv("CCACHE_DISABLE", "1")
29 }
30
31 // Create ccache dir if not exist.
32 if err := os.MkdirAll(c.Dir, os.ModePerm); err != nil {
33 return fmt.Errorf("failed to mkdir ccache dir -> %w", err)
34 }
35
36 os.Setenv("CCACHE_DIR", c.Dir)
37 os.Setenv("CCACHE_MAXSIZE", c.MaxSize)
38
39 if c.RemoteStorage != "" {
40 os.Setenv("CCACHE_REMOTE_STORAGE", c.RemoteStorage)
41
42 if c.RemoteOnly {
43 os.Setenv("CCACHE_REMOTE_ONLY", "1")
44 } else {
45 os.Unsetenv("CCACHE_REMOTE_ONLY")
46 }
47 }
48
49 // Default to workspace dir as base dir.
50 os.Setenv("CCACHE_BASEDIR", dirs.WorkspaceDir)
51 return nil
52}
53
54func (c *CCache) init() {
55 c.Enabled = true

Callers 4

TestCCache_Setup_EnabledFunction · 0.95

Calls 1

MkdirAllMethod · 0.80

Tested by 4

TestCCache_Setup_EnabledFunction · 0.76