Skip to content

Commit b8293ac

Browse files
committed
test/, script/: Run "make build" instead of "go install"
1 parent bfd3c3c commit b8293ac

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

scripts/gen_readme/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func buildTemplateContext() (map[string]interface{}, error) {
5353
return nil, fmt.Errorf("can't read .golangci.example.yml: %s", err)
5454
}
5555

56-
if err = exec.Command("go", "install", "./cmd/...").Run(); err != nil {
56+
if err = exec.Command("make", "build").Run(); err != nil {
5757
return nil, fmt.Errorf("can't run go install: %s", err)
5858
}
5959

test/data.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package test
33
import "path/filepath"
44

55
const testdataDir = "testdata"
6-
const binName = "golangci-lint"
6+
const binName = "../golangci-lint"
77

88
func getProjectRoot() string {
99
return filepath.Join("..", "...")

test/testshared/testshared.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"io/ioutil"
55
"os"
66
"os/exec"
7-
"path/filepath"
87
"strings"
98
"syscall"
109

@@ -18,8 +17,6 @@ type LintRunner struct {
1817
t assert.TestingT
1918
log logutils.Log
2019
env []string
21-
22-
installed bool
2320
}
2421

2522
func NewLintRunner(t assert.TestingT, environ ...string) *LintRunner {
@@ -33,13 +30,12 @@ func NewLintRunner(t assert.TestingT, environ ...string) *LintRunner {
3330
}
3431

3532
func (r *LintRunner) Install() {
36-
if r.installed {
33+
if _, err := os.Stat("../golangci-lint"); err == nil {
3734
return
3835
}
3936

40-
cmd := exec.Command("go", "install", filepath.Join("..", "cmd", "golangci-lint"))
37+
cmd := exec.Command("make", "-C", "..", "build")
4138
assert.NoError(r.t, cmd.Run(), "Can't go install golangci-lint")
42-
r.installed = true
4339
}
4440

4541
type RunResult struct {
@@ -84,7 +80,7 @@ func (r *LintRunner) Run(args ...string) *RunResult {
8480

8581
runArgs := append([]string{"run"}, args...)
8682
r.log.Infof("golangci-lint %s", strings.Join(runArgs, " "))
87-
cmd := exec.Command("golangci-lint", runArgs...)
83+
cmd := exec.Command("../golangci-lint", runArgs...)
8884
cmd.Env = append(os.Environ(), r.env...)
8985
out, err := cmd.CombinedOutput()
9086
if err != nil {

0 commit comments

Comments
 (0)