You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "fgksgf (via GitHub)" <gi...@apache.org> on 2025/07/07 08:19:31 UTC

[PR] Fix version output for go install installations [skywalking-eyes]

fgksgf opened a new pull request, #203:
URL: https://github.com/apache/skywalking-eyes/pull/203

   ## Summary
   
   Fixes the issue where `license-eye --version` outputs `version dev` instead of the correct version number when installed via `go install`.
   
     ## Problem
   
   When users install license-eye using `go install github.com/apache/skywalking-eyes/cmd/license-eye@v0.7.0`, the version command shows "dev" instead of "v0.7.0". This happens because:
   
   1. `go install` builds directly from source without using the Makefile
   2. The Makefile uses `-ldflags` to inject version information at build time
   3. Without these build flags, the version defaults to "dev"
   
     ## Solution
   
   Added a fallback mechanism that reads version information from Go's build metadata when ldflags injection is not available:
   
   1. **First priority**: Version injected via `-ldflags` (existing behavior)
   2. **Second priority**: Version from `runtime/debug.ReadBuildInfo()` (new fallback)
   3. **Last resort**: "dev" (existing default)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix version output for go install installations [skywalking-eyes]

Posted by "liubog2008 (via GitHub)" <gi...@apache.org>.
liubog2008 commented on PR #203:
URL: https://github.com/apache/skywalking-eyes/pull/203#issuecomment-3051446499

   @kezhenxu94 Could you please release a new version?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix version output for go install installations [skywalking-eyes]

Posted by "kezhenxu94 (via GitHub)" <gi...@apache.org>.
kezhenxu94 merged PR #203:
URL: https://github.com/apache/skywalking-eyes/pull/203


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix version output for go install installations [skywalking-eyes]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #203:
URL: https://github.com/apache/skywalking-eyes/pull/203#discussion_r2189335248


##########
commands/version.go:
##########
@@ -17,4 +17,17 @@
 
 package commands
 
+import (
+	"runtime/debug"
+)

Review Comment:
   [nitpick] Since there’s only one import here, consider using a single-line import (`import "runtime/debug"`) to keep the code concise and idiomatic.
   ```suggestion
   import "runtime/debug"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org