Skip to content

Commit 7372dac

Browse files
MaciejKarasfealebenpae
authored andcommitted
Fixes issue with go-licenses generating empty report due to module vendoring (#3996)
# Summary It was observed in the past that sometimes the `licenses.csv` file is generated empty. Finally found the issue, it was due to vendoring of the go modules. `go-licenses` could not handle it correctly and added this kind of entry every time the module was found in the vendor folder. This is also reported as an issue in google/go-licenses#178 ``` github.com/davecgh/go-spew/spew,Unknown,https://github.com/10gen/ops-manager-kubernetes/blob/HEAD/vendor/github.com/davecgh/go-spew/LICENSE,ISC github.com/emicklei/go-restful/v3,Unknown,https://github.com/10gen/ops-manager-kubernetes/blob/HEAD/vendor/github.com/emicklei/go-restful/v3/LICENSE,MIT github.com/evanphx/json-patch/v5,Unknown,https://github.com/10gen/ops-manager-kubernetes/blob/HEAD/vendor/github.com/evanphx/json-patch/v5/LICENSE,BSD-3-Clause ``` By adding `GOFLAGS="-mod=mod"` we completely omit vendor folder and switch back to `go.mod`. ## Documentation changes * [ ] Add an entry to [release notes](.../RELEASE_NOTES.md). * [ ] When needed, make sure you create a new [DOCSP ticket](https://jira.mongodb.org/projects/DOCSP) that documents your change. ## Changes to CRDs * [ ] Add `slaskawi`(Sebastian) and `@giohan` (George) as reviewers. * [ ] Make sure any changes are reflected on `/public/samples` directory.
1 parent 33bea32 commit 7372dac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/evergreen/update_licenses.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ process_licenses() {
2020
return 1
2121
fi
2222

23-
PATH=$GOPATH/bin:$PATH GOOS=linux GOARCH=amd64 go-licenses report . --template "$SCRIPTS_DIR/update_licenses.tpl" > licenses_full.csv 2> licenses_stderr || true
23+
PATH=$GOPATH/bin:$PATH GOOS=linux GOARCH=amd64 GOFLAGS="-mod=mod" go-licenses report . --template "$SCRIPTS_DIR/update_licenses.tpl" > licenses_full.csv 2> licenses_stderr || true
2424

2525
# Filter and sort the licenses report
2626
grep -v 10gen licenses_full.csv | grep -v "github.com/mongodb" | grep -v "^golang.org" | sort > licenses.csv || true

0 commit comments

Comments
 (0)