fix(plugin): remove quotation mark about version and add default revision

This commit is contained in:
LinkinStar 2023-02-01 18:20:33 +08:00
parent b4ae373309
commit d538b531bd
2 changed files with 3 additions and 3 deletions

View File

@ -23,9 +23,9 @@ var (
// Version is the version of the project
Version = "0.0.0"
// Revision is the git short commit revision number
Revision = ""
Revision = "-"
// Time is the build time of the project
Time = ""
Time = "-"
// log level
logLevel = os.Getenv("LOG_LEVEL")
// log path

View File

@ -192,7 +192,7 @@ func copyDirEntries(sourceFs embed.FS, sourceDir string, targetDir string) (err
func buildBinary(b *buildingMaterial) (err error) {
versionInfo := b.originalAnswerInfo
cmdPkg := "github.com/answerdev/answer/cmd"
ldflags := fmt.Sprintf("-X %s.Version='%s' -X %s.Revision='%s' -X %s.Time='%s'",
ldflags := fmt.Sprintf("-X %s.Version=%s -X %s.Revision=%s -X %s.Time=%s",
cmdPkg, versionInfo.Version, cmdPkg, versionInfo.Revision, cmdPkg, versionInfo.Time)
err = b.newExecCmd("go", "build",
"-ldflags", ldflags, "-o", b.outputPath, ".").Run()