Skip to content

Commit

Permalink
dev: lint should honor the number of CPUs when building cockroach
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
rickystewart committed Apr 1, 2022
1 parent dee0bbe commit ea619e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion pkg/cmd/dev/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package main

import (
"fmt"
"log"
"os"
"strings"

Expand Down Expand Up @@ -80,10 +81,15 @@ func (d *dev) lint(cmd *cobra.Command, commandLine []string) error {
if err != nil {
return err
}
if !short {
if !short && filter == "" {
args := []string{"build", "//pkg/cmd/cockroach-short", "--//build/toolchains:nogo_flag"}
if numCPUs != 0 {
args = append(args, fmt.Sprintf("--local_cpu_resources=%d", numCPUs))
}
logCommand("bazel", args...)
return d.exec.CommandContextInheritingStdStreams(ctx, "bazel", args...)
} else if !short {
log.Printf("Skipping building cockroach-short with nogo due to provided test filter")
}
return nil
}
7 changes: 6 additions & 1 deletion pkg/cmd/dev/testdata/datadriven/lint
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ exec
dev lint -f TestLowercaseFunctionNames --cpus 4
----
bazel run --config=test //build/bazelutil:lint --local_cpu_resources=4 -- -test.v -test.run Lint/TestLowercaseFunctionNames
bazel build //pkg/cmd/cockroach-short --//build/toolchains:nogo_flag

exec
dev lint --cpus 4
----
bazel run --config=test //build/bazelutil:lint --local_cpu_resources=4 -- -test.v
bazel build //pkg/cmd/cockroach-short --//build/toolchains:nogo_flag --local_cpu_resources=4

exec
dev lint pkg/cmd/dev pkg/spanconfig
Expand Down

0 comments on commit ea619e1

Please sign in to comment.