Skip to content

Commit 1892fcc

Browse files
committed
Make LEEWAY_WORKSPACE_ROOT available in build commands
allows to reference a golangci-lint config in the linter command
1 parent 5d8c7c7 commit 1892fcc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/leeway/build.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ func (p *Package) buildGo(buildctx *buildContext, wd, result string) (res *packa
12651265
testCommand = append(testCommand, fmt.Sprintf("-coverprofile=%v", codecovComponentName(p.FullName())))
12661266
} else {
12671267
testCommand = append(testCommand, "-coverprofile=testcoverage.out")
1268-
reportCoverage = collectGoTestCoverage(filepath.Join(wd, "testcoverage.out"), p.FullName())
1268+
reportCoverage = collectGoTestCoverage(filepath.Join(wd, "testcoverage.out"))
12691269
}
12701270
testCommand = append(testCommand, "./...")
12711271

@@ -1300,7 +1300,7 @@ func (p *Package) buildGo(buildctx *buildContext, wd, result string) (res *packa
13001300
}, nil
13011301
}
13021302

1303-
func collectGoTestCoverage(covfile, fullName string) testCoverageFunc {
1303+
func collectGoTestCoverage(covfile string) testCoverageFunc {
13041304
return func() (coverage, funcsWithoutTest, funcsWithTest int, err error) {
13051305
// We need to collect the coverage for all packages in the module.
13061306
// To that end we load the coverage file.
@@ -1680,6 +1680,7 @@ func executeCommandsForPackage(buildctx *buildContext, p *Package, wd string, co
16801680
}
16811681

16821682
env := append(os.Environ(), p.Environment...)
1683+
env = append(env, fmt.Sprintf("LEEWAY_WORKSPACE_ROOT=%s", p.C.W.Origin))
16831684
for _, cmd := range commands {
16841685
err := run(buildctx.Reporter, p, env, wd, cmd[0], cmd[1:]...)
16851686
if err != nil {

0 commit comments

Comments
 (0)