shell脚本:
#!/bin/bashset -exexport GOPATH=/go
...(略)
执行命令报错:
$ ./build.sh
: invalid option 2: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
./build.sh: line 3: $'\r': command not found
./build.sh: line 5: $'\r': command not found
go: unknown environment setting GO111MODULE=on
原因:
格式错误:CRLF
解决方案:
修改为LF格式: