infdahai commented on code in PR #1491:
URL:
https://github.com/apache/incubator-kvrocks/pull/1491#discussion_r1228923746
##########
x.py:
##########
@@ -192,15 +194,36 @@ def clang_tidy(dir: str, jobs: Optional[int],
clang_tidy_path: str, run_clang_ti
run(run_command, *options, *regexes, verbose=True, cwd=basedir)
-def golangci_lint() -> None:
- go = find_command('go', msg='go is required for testing')
- gopath = run_pipe(go, 'env', 'GOPATH').read().strip()
- bindir = Path(gopath).absolute() / 'bin'
- binpath = bindir / 'golangci-lint'
- if not binpath.exists():
+def golangci_lint(golangci_lint_path: str) -> None:
+ def get_gopath() -> Tuple[Path, Path]:
+ go = find_command('go', msg='go is required for testing')
+ gopath = run_pipe(go, 'env', 'GOPATH').read().strip()
+ bindir = Path(gopath).absolute() / 'bin'
+ binpath = bindir / 'golangci-lint'
+ return bindir, binpath
+
+ def get_syspath(sys_path: str) -> Tuple[str, str]:
+ golangci_command = find_command(sys_path, msg="golangci-lint is
required")
+ version_res = run_pipe(golangci_command, '--version').read().strip()
+ version_str = re.search(r'version\s+((?:\w|\.)+)',
version_res).group(1)
+ return golangci_command, version_str
+
+ def download_package(bindir: str) -> None:
output = run_pipe('curl', '-sfL',
'https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh',
- verbose=True)
- run('sh', '-s', '--', '-b', str(bindir), 'v1.49.0', verbose=True,
stdin=output)
+ verbose=True)
+ version_str = 'v' + '.'.join(map(str, GOLANGCI_LINT_REQUIRED_VERSION))
+ run('sh', '-s', '--', '-b', bindir, version_str, verbose=True,
stdin=output)
+
+ binpath = ""
+ if which(golangci_lint_path) is None:
+ bindir, binpath = get_gopath()
Review Comment:
`binpath` -> Type error.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]