You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-13Lines changed: 47 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,8 +33,12 @@ go install github.com/richardartoul/gobuildcache@latest
33
33
34
34
## Usage
35
35
36
+
You can configure `gobuildcache` by passing arguments directly to the program via `GOCACHEPROG`, or by using environment variables. The CLI argument approach is recommended for CI/CD workflows.
37
+
38
+
### Using CLI Arguments (Recommended)
39
+
36
40
```bash
37
-
export GOCACHEPROG=gobuildcache
41
+
export GOCACHEPROG="gobuildcache --backend=disk"
38
42
go build ./...
39
43
go test ./...
40
44
```
@@ -43,63 +47,93 @@ By default, `gobuildcache` uses an on-disk cache stored in the OS default tempor
43
47
44
48
For "production" use-cases in CI, you'll want to configure `gobuildcache` to use S3 Express One Zone, Google Cloud Storage, or a similarly low latency distributed backend.
45
49
50
+
### Using Environment Variables (Alternative)
51
+
52
+
You can also configure `gobuildcache` using environment variables:
53
+
54
+
```bash
55
+
export GOCACHEPROG=gobuildcache
56
+
export GOBUILDCACHE_BACKEND_TYPE=disk
57
+
go build ./...
58
+
go test ./...
59
+
```
60
+
61
+
**Note:** CLI arguments take precedence over environment variables when both are provided.
You'll also have to provide AWS credentials. `gobuildcache` embeds the AWS V2 S3 SDK so any method of providing credentials to that library will work, but the simplest is to use environment variables as demonstrated below.
You'll need to provide AWS credentials. `gobuildcache` embeds the AWS V2 S3 SDK so any method of providing credentials to that library will work (environment variables, IAM roles, etc.).
91
+
66
92
> **Note**: All configuration environment variables support both `GOBUILDCACHE_<KEY>` and `<KEY>` forms (e.g., both `GOBUILDCACHE_S3_BUCKET` and `S3_BUCKET` work). The prefixed version takes precedence if both are set. The prefixed form is recommended to avoid conflicts with other tools. If the prefixed variable is set to an empty string, it falls through to the unprefixed version (or default).
0 commit comments