shebang #! now is a constant

This commit is contained in:
Manuel Carmona 2017-04-19 11:48:01 +02:00
parent f63a25d794
commit 7b7157e061

View File

@ -7,6 +7,8 @@ import (
"strings" "strings"
) )
const shebang = `#!`
var ( var (
shebangExecHack = regexp.MustCompile(`exec (\w+).+\$0.+\$@`) shebangExecHack = regexp.MustCompile(`exec (\w+).+\$0.+\$@`)
pythonVersion = regexp.MustCompile(`python\d\.\d+`) pythonVersion = regexp.MustCompile(`python\d\.\d+`)
@ -68,7 +70,7 @@ func getFirstLine(data []byte) []byte {
} }
func hasShebang(line []byte) bool { func hasShebang(line []byte) bool {
shebang := []byte{'#', '!'} shebang := []byte(shebang)
return bytes.HasPrefix(line, shebang) return bytes.HasPrefix(line, shebang)
} }