Skip to content

Commit

Permalink
fix: add -mod flag in GOFLAGS.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Dec 29, 2020
1 parent b3491fd commit c6ffc11
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/lint/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ func (cl *ContextLoader) makeBuildFlags() ([]string, error) {
return nil, fmt.Errorf("invalid modules download path %s, only (%s) allowed", mod, strings.Join(allowedMods, "|"))
}

// https://github.com/golangci/golangci-lint/issues/1502#issuecomment-752105778
raw := os.Getenv("GOFLAGS")
goflags := strings.Fields(raw)
goflags = append(goflags, fmt.Sprintf("-mod=%s", mod))
_ = os.Setenv("GOFLAGS", strings.Join(goflags, " "))

buildFlags = append(buildFlags, fmt.Sprintf("-mod=%s", cl.cfg.Run.ModulesDownloadMode))
}

Expand Down

0 comments on commit c6ffc11

Please sign in to comment.