mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 13:32:24 +00:00
shebang #! now is a constant
This commit is contained in:
parent
f63a25d794
commit
7b7157e061
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user