Fixed code section.
This commit is contained in:
parent
7382dde1f6
commit
593e665606
1 changed files with 3 additions and 3 deletions
6
main.go
6
main.go
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
const warning = "//WARNING! DO NOT EDIT THIS FILE BY HAND. IT IS AUTO GENERATED.\n"
|
const warning = "//WARNING! DO NOT EDIT THIS FILE BY HAND. IT IS AUTO GENERATED.\n"
|
||||||
|
|
||||||
const header = "package main\nconst gitVersion = \""
|
const header = "package main\n"
|
||||||
|
|
||||||
const code = `
|
const code = `
|
||||||
import (
|
import (
|
||||||
|
@ -25,7 +25,7 @@ func init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
const gitVersion = "`
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cmd := exec.Command("git", "describe", "--tags", "--abbrev=0")
|
cmd := exec.Command("git", "describe", "--tags", "--abbrev=0")
|
||||||
|
@ -36,7 +36,7 @@ func main() {
|
||||||
}
|
}
|
||||||
version := string(out)
|
version := string(out)
|
||||||
version = version[:len(version)-1]
|
version = version[:len(version)-1]
|
||||||
content := warning + header + version + "\"" + code
|
content := warning + header + code + version + "\""
|
||||||
|
|
||||||
ioutil.WriteFile("version.go", []byte(content), 0644)
|
ioutil.WriteFile("version.go", []byte(content), 0644)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue