@@ -29,7 +29,7 @@ The authoritative source is https://github.com/openSUSE/obs-service-go_modules.
2929Using
3030[ ` go.mod ` and ` go.sum ` ] ( https://github.com/golang/go/wiki/Modules )
3131present in a Go application,
32- ` obs-service-go_modules ` will call Go tools in sequence:
32+ ` obs-service-go_modules ` using the default strategy ` vendor ` will call Go tools in sequence:
3333
3434```
3535go mod download
@@ -39,6 +39,10 @@ go mod vendor
3939
4040` obs-service-go_modules ` will create a ` vendor.tar.gz ` archive or other supported compression type
4141containing the ` vendor/ ` directory populated by ` go mod vendor ` .
42+
43+ In some cases it can useful to use the ` gomodcache ` strategy which omits the ` go mod vendor ` step and creates
44+ a ` gomodcache.tar.gz ` archive containing the ` $GOMODCACHE/cache ` directory populated by ` go mod download ` .
45+
4246The archive is generated in the rpm package directory, and can be committed to
4347[ OBS] ( https://build.opensuse.org ) to facilitate offline Go application package builds
4448for [ openSUSE] ( https://www.opensuse.org ) ,
@@ -156,6 +160,13 @@ To ensure the top-level `vendor/` directory is used by go build, either:
156160
157161- set environment variable ` GOFLAGS=-mod=vendor ` to apply the setting to all invocations
158162
163+ ### Using the ` gomodcache ` strategy
164+
165+ During ` %setup ` use the ` -b… ` option to uncompress the gomodcache archive before entering the working directory.
166+
167+ Set the environment variable ` GOMODCACHE ` and either run ` go mod vendor ` in the ` %setup ` or ` %build `
168+ section or just don't use the ` -mod=vendor ` option mentioned above.
169+
159170More information about additional controls is available at:
160171[ Go Module Knobs] ( https://github.com/thepudds/go-module-knobs/blob/master/README.md ) ,
161172[ Go Wiki: Modules: How do I use vendoring] ( https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away ) and
0 commit comments