【发布时间】:2019-02-08 02:21:05
【问题描述】:
all: gotool
@go build -v .
clean:
rm -f apiserver
find . -name "[._]*.s[a-w][a-z]" | xargs -i rm -f {}
gotool:
gofmt -w .
go tool vet . |& grep -v vendor;true
help:
@echo "make - compile the source code"
@echo "make clean - remove binary file and vim swp files"
@echo "make gotool - run go tool 'fmt' and 'vet'"
@echo "make ca - generate ca files"
.PHONY: clean gotool help
对这个推荐感到困惑go tool vet . |& grep -v vendor;true
并在进行此操作时出错...
$ make
gofmt -w .
go tool vet . |& grep -v vendor;true
/bin/sh: 1: Syntax error: "&" unexpected
Makefile:7: recipe for target 'gotool' failed
make: *** [gotool] Error 2
【问题讨论】:
-
你的 shell 不支持
|&。要么不要使用|&语法,要么使用支持它的shell。 -
我的 bash 版本是 4.4.19(1)-release (x86_64-pc-linux-gnu),或者关于如何围绕
|&重新调整上述语法的任何建议? -
你可能没有使用 bash,错误提示
/bin/sh,这通常是一个更基本的 shell。你只是问|&是什么意思吗?见stackoverflow.com/questions/35384999/what-does-mean-in-bash -
所以整个句子是什么意思?
go tool vet . |& grep -v vendor;true -
提示:您可以告诉 vim 将交换文件写入特定位置。将此添加到您的 .vimrc 中:
silent execute '!mkdir -p ~/.vim/mydir',然后添加以下行set directory=~/.vim/mydir、set backupdir=~/.vim/mydir和set backupskip=~/.vim/mydir/*